e-virt-table 0.0.7 → 0.0.9
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 +5 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +557 -576
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Config.d.ts +0 -1
- package/dist/lib/Config.js +0 -6
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/EVirtTable.js +2 -0
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.js +13 -4
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/Header.d.ts +1 -1
- package/dist/lib/Header.js +26 -30
- package/dist/lib/Header.js.map +1 -1
- package/dist/lib/Scroller.js +16 -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,24 +169,24 @@ 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, f = [], d = new Promise(function(x, u) {
|
|
173
173
|
var y = function(w) {
|
|
174
|
-
if (
|
|
175
|
-
return i(
|
|
174
|
+
if (f.push.apply(f, w), h++, h === l)
|
|
175
|
+
return i(f), f.length ? u(new Xt(f, Ct(f))) : x(s);
|
|
176
176
|
};
|
|
177
|
-
n.length || (i(
|
|
177
|
+
n.length || (i(f), x(s)), n.forEach(function(g) {
|
|
178
178
|
var w = a[g];
|
|
179
179
|
o.indexOf(g) !== -1 ? Ft(w, e, y) : Re(w, e, y);
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
|
-
return
|
|
182
|
+
return d.catch(function(x) {
|
|
183
183
|
return x;
|
|
184
|
-
}),
|
|
184
|
+
}), d;
|
|
185
185
|
}
|
|
186
186
|
function _e(a) {
|
|
187
187
|
return !!(a && a.message !== void 0);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function Se(a, t) {
|
|
190
190
|
for (var e = a, i = 0; i < t.length; i++) {
|
|
191
191
|
if (e == null)
|
|
192
192
|
return e;
|
|
@@ -197,7 +197,7 @@ function Te(a, t) {
|
|
|
197
197
|
function Nt(a, t) {
|
|
198
198
|
return function(e) {
|
|
199
199
|
var i;
|
|
200
|
-
return a.fullFields ? i =
|
|
200
|
+
return a.fullFields ? i = Se(t, a.fullFields) : i = t[e.field || a.fullField], _e(e) ? (e.field = e.field || a.fullField, e.fieldValue = i, e) : {
|
|
201
201
|
message: typeof e == "function" ? e() : e,
|
|
202
202
|
fieldValue: i,
|
|
203
203
|
field: e.field || a.fullField
|
|
@@ -216,11 +216,11 @@ function Kt(a, t) {
|
|
|
216
216
|
}
|
|
217
217
|
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
|
+
}, Te = 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]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", d = 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\\.)" + f + "(?:localhost|" + d + "|" + 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",
|
|
304
|
-
if (x ?
|
|
303
|
+
var o = typeof t.len == "number", n = typeof t.min == "number", l = typeof t.max == "number", h = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, f = e, d = null, x = typeof e == "number", u = typeof e == "string", y = Array.isArray(e);
|
|
304
|
+
if (x ? d = "number" : u ? d = "string" : y && (d = "array"), !d)
|
|
305
305
|
return !1;
|
|
306
|
-
y && (
|
|
306
|
+
y && (f = e.length), u && (f = e.replace(h, "_").length), o ? f !== t.len && s.push(H(r.messages[d].len, t.fullField, t.len)) : n && !l && f < t.min ? s.push(H(r.messages[d].min, t.fullField, t.min)) : l && !n && f > t.max ? s.push(H(r.messages[d].max, t.fullField, t.max)) : n && l && (f < t.min || f > t.max) && s.push(H(r.messages[d].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) {
|
|
@@ -317,7 +317,7 @@ var Gt = function(t, e, i, s, r, o) {
|
|
|
317
317
|
}
|
|
318
318
|
}, v = {
|
|
319
319
|
required: Gt,
|
|
320
|
-
whitespace:
|
|
320
|
+
whitespace: Te,
|
|
321
321
|
type: Ae,
|
|
322
322
|
range: He,
|
|
323
323
|
enum: Me,
|
|
@@ -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,10 +533,10 @@ 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
|
|
539
|
-
function
|
|
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
|
+
function f(g) {
|
|
540
540
|
var w = [], p = {};
|
|
541
541
|
function E(b) {
|
|
542
542
|
if (Array.isArray(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 (
|
|
553
|
-
var
|
|
554
|
-
|
|
552
|
+
if (l.messages) {
|
|
553
|
+
var d = this.messages();
|
|
554
|
+
d === Rt && (d = vt()), Kt(d, l.messages), l.messages = d;
|
|
555
555
|
} else
|
|
556
|
-
|
|
557
|
-
var x = {}, u =
|
|
556
|
+
l.messages = this.messages();
|
|
557
|
+
var x = {}, u = l.keys || Object.keys(this.rules);
|
|
558
558
|
u.forEach(function(g) {
|
|
559
559
|
var w = o.rules[g], p = n[g];
|
|
560
560
|
w.forEach(function(E) {
|
|
@@ -570,51 +570,51 @@ 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
|
-
function m(R,
|
|
577
|
-
return $({},
|
|
576
|
+
function m(R, T) {
|
|
577
|
+
return $({}, T, {
|
|
578
578
|
fullField: p.fullField + "." + R,
|
|
579
579
|
fullFields: p.fullFields ? [].concat(p.fullFields, [R]) : [R]
|
|
580
580
|
});
|
|
581
581
|
}
|
|
582
582
|
function b(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
|
-
var
|
|
585
|
-
!
|
|
586
|
-
var L =
|
|
587
|
-
if (
|
|
584
|
+
var T = Array.isArray(R) ? R : [R];
|
|
585
|
+
!l.suppressWarning && T.length && a.warning("async-validator:", T), T.length && p.message !== void 0 && (T = [].concat(p.message));
|
|
586
|
+
var L = T.map(Nt(p, n));
|
|
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;
|
|
597
597
|
}), A = $({}, A, g.rule.fields);
|
|
598
598
|
var D = {};
|
|
599
599
|
Object.keys(A).forEach(function(O) {
|
|
600
|
-
var
|
|
600
|
+
var S = A[O], _ = Array.isArray(S) ? S : [S];
|
|
601
601
|
D[O] = _.map(m.bind(null, O));
|
|
602
602
|
});
|
|
603
603
|
var B = new a(D);
|
|
604
|
-
B.messages(
|
|
605
|
-
var
|
|
606
|
-
L && L.length &&
|
|
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
|
+
var S = [];
|
|
606
|
+
L && L.length && S.push.apply(S, L), O && O.length && S.push.apply(S, O), w(S.length ? S : null);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
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
|
}
|
|
@@ -626,7 +626,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
626
626
|
return b(R);
|
|
627
627
|
});
|
|
628
628
|
}, function(g) {
|
|
629
|
-
|
|
629
|
+
f(g);
|
|
630
630
|
}, n);
|
|
631
631
|
}, t.getType = function(i) {
|
|
632
632
|
if (i.type === void 0 && i.pattern instanceof RegExp && (i.type = "pattern"), typeof i.validator != "function" && i.type && !it.hasOwnProperty(i.type))
|
|
@@ -751,12 +751,12 @@ 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: f } = this.ctx.config, d = i[o], x = d ?? 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
|
|
759
|
-
const w = i[
|
|
758
|
+
if (typeof h == "function" && (g = h), f) {
|
|
759
|
+
const w = i[f];
|
|
760
760
|
if (this.checkboxKeyMap.has(w)) {
|
|
761
761
|
const p = this.checkboxKeyMap.get(w);
|
|
762
762
|
p.push(x), this.checkboxKeyMap.set(w, p);
|
|
@@ -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:
|
|
839
|
-
this.sumHeight +=
|
|
840
|
-
top:
|
|
841
|
-
height:
|
|
838
|
+
const n = this.itemRowKeyMap.get(o), { expand: l, hasChildren: h, height: f } = this.rowKeyMap.get(n), d = this.sumHeight;
|
|
839
|
+
this.sumHeight += f, this.rowIndexRowKeyMap.set(e, n), this.positions.push({
|
|
840
|
+
top: d,
|
|
841
|
+
height: f,
|
|
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,22 +963,22 @@ 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:
|
|
969
|
-
key:
|
|
970
|
-
oldValue:
|
|
966
|
+
const { value: l, rowKey: h, key: f } = n, { oldValue: d, newValue: x } = this.setItemValue(h, f, l);
|
|
967
|
+
s.add(h), i.push({
|
|
968
|
+
rowKey: h,
|
|
969
|
+
key: f,
|
|
970
|
+
oldValue: d,
|
|
971
971
|
newValue: x
|
|
972
972
|
});
|
|
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,36 +1004,36 @@ 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(
|
|
1016
|
-
const
|
|
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
|
+
const f = this.ctx.database.getRowDataItemForRowKey(t), d = {
|
|
1017
1017
|
rowKey: t,
|
|
1018
1018
|
key: e,
|
|
1019
1019
|
value: i,
|
|
1020
|
-
row:
|
|
1020
|
+
row: f
|
|
1021
1021
|
};
|
|
1022
|
-
this.ctx.emit("change", [
|
|
1022
|
+
this.ctx.emit("change", [d], [f]), 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(
|
|
1028
|
-
row:
|
|
1027
|
+
originalValue: this.originalDataMap.get(h),
|
|
1028
|
+
row: f
|
|
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,37 +1256,37 @@ 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
|
-
const
|
|
1261
|
+
const f = o({
|
|
1262
1262
|
row: s.item,
|
|
1263
1263
|
rowIndex: s.rowIndex,
|
|
1264
1264
|
colIndex: r.colIndex,
|
|
1265
1265
|
column: n,
|
|
1266
1266
|
value: this.getItemValue(t, e)
|
|
1267
1267
|
});
|
|
1268
|
-
|
|
1268
|
+
f && (l = f);
|
|
1269
1269
|
}
|
|
1270
|
-
if (
|
|
1271
|
-
let
|
|
1272
|
-
if (
|
|
1273
|
-
const x =
|
|
1270
|
+
if (l) {
|
|
1271
|
+
let h = {}, f = {};
|
|
1272
|
+
if (f[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(f).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: f } = r;
|
|
1516
1516
|
this.ctx.save(), o && (this.ctx.fillStyle = o, this.ctx.fillRect(t, e, i, s));
|
|
1517
|
-
let
|
|
1517
|
+
let d;
|
|
1518
1518
|
switch (n) {
|
|
1519
1519
|
case "left":
|
|
1520
|
-
|
|
1520
|
+
d = this.ctx.createLinearGradient(t - l, e, t, e), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t - l, e, l, s);
|
|
1521
1521
|
break;
|
|
1522
1522
|
case "right":
|
|
1523
|
-
|
|
1523
|
+
d = this.ctx.createLinearGradient(
|
|
1524
1524
|
t + i,
|
|
1525
1525
|
e,
|
|
1526
|
-
t + i +
|
|
1526
|
+
t + i + l,
|
|
1527
1527
|
e
|
|
1528
|
-
),
|
|
1528
|
+
), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t + i, e, l, s);
|
|
1529
1529
|
break;
|
|
1530
1530
|
case "top":
|
|
1531
|
-
|
|
1531
|
+
d = this.ctx.createLinearGradient(t, e - l, t, e), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e - l, i, l);
|
|
1532
1532
|
break;
|
|
1533
1533
|
case "bottom":
|
|
1534
|
-
|
|
1534
|
+
d = this.ctx.createLinearGradient(
|
|
1535
1535
|
t,
|
|
1536
1536
|
e + s,
|
|
1537
1537
|
t,
|
|
1538
|
-
e + s +
|
|
1539
|
-
),
|
|
1538
|
+
e + s + l
|
|
1539
|
+
), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, 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, f, d, 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 + f, f), this.ctx.arcTo(t + i, e + s, t + i - d, e + s, d), this.ctx.arcTo(t, e + s, t, e + s - x, x), this.ctx.arcTo(t, e, t + h, e, h);
|
|
1566
1566
|
}
|
|
1567
1567
|
n !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
1568
1568
|
}
|
|
@@ -1580,17 +1580,17 @@ class ei {
|
|
|
1580
1580
|
this.ctx.save();
|
|
1581
1581
|
const {
|
|
1582
1582
|
font: n = "12px Arial",
|
|
1583
|
-
align:
|
|
1584
|
-
color:
|
|
1585
|
-
padding:
|
|
1586
|
-
verticalAlign:
|
|
1583
|
+
align: l = "center",
|
|
1584
|
+
color: h = "#495060",
|
|
1585
|
+
padding: f = 0,
|
|
1586
|
+
verticalAlign: d = "middle"
|
|
1587
1587
|
} = o;
|
|
1588
|
-
this.ctx.font = n, this.ctx.fillStyle =
|
|
1588
|
+
this.ctx.font = n, this.ctx.fillStyle = h, this.ctx.textBaseline = d, this.ctx.textAlign = l;
|
|
1589
1589
|
let x = 0;
|
|
1590
|
-
|
|
1590
|
+
d === "top" ? x = i + f : d === "bottom" ? x = i + r - f : x = i + (r + f) / 2;
|
|
1591
1591
|
let u = 0;
|
|
1592
|
-
|
|
1593
|
-
const { _text: y, ellipsis: g } = this.handleEllipsis(t, s,
|
|
1592
|
+
l === "left" ? u = e + f : l === "right" ? u = e + s - f : u = e + s / 2;
|
|
1593
|
+
const { _text: y, ellipsis: g } = this.handleEllipsis(t, s, f);
|
|
1594
1594
|
return this.ctx.fillText(y, u, x), this.ctx.restore(), g;
|
|
1595
1595
|
}
|
|
1596
1596
|
handleEllipsis(t, e, i = 0) {
|
|
@@ -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
|
}
|
|
@@ -1679,8 +1679,6 @@ class Bt {
|
|
|
1679
1679
|
c(this, "ENABLE_SELECTOR", !1);
|
|
1680
1680
|
c(this, "ENABLE_EDIT_SINGLE_CLICK", !1);
|
|
1681
1681
|
// 启用单点击立马编辑
|
|
1682
|
-
c(this, "ENABLE_EDIT_TEXT_ENTER", !0);
|
|
1683
|
-
// 启用文本编辑器回车键确认
|
|
1684
1682
|
c(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
|
|
1685
1683
|
// 启用点击选择器编辑
|
|
1686
1684
|
c(this, "ENABLE_SELECTOR_SINGLE", !1);
|
|
@@ -1829,15 +1827,15 @@ class ii {
|
|
|
1829
1827
|
}
|
|
1830
1828
|
async createImageFromSVG(t, e) {
|
|
1831
1829
|
const r = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
1832
|
-
e && r.querySelectorAll("*").forEach((
|
|
1833
|
-
|
|
1830
|
+
e && r.querySelectorAll("*").forEach((h) => {
|
|
1831
|
+
h.setAttribute("fill", e);
|
|
1834
1832
|
});
|
|
1835
1833
|
const o = new Image(), n = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
1836
1834
|
type: "image/svg+xml"
|
|
1837
|
-
}),
|
|
1838
|
-
return o.src =
|
|
1839
|
-
o.onerror = () =>
|
|
1840
|
-
|
|
1835
|
+
}), l = URL.createObjectURL(n);
|
|
1836
|
+
return o.src = l, new Promise((h, f) => {
|
|
1837
|
+
o.onerror = () => f(new Error("Failed to load image")), o.onload = () => {
|
|
1838
|
+
h(o);
|
|
1841
1839
|
};
|
|
1842
1840
|
});
|
|
1843
1841
|
}
|
|
@@ -1883,8 +1881,8 @@ class Jt {
|
|
|
1883
1881
|
}
|
|
1884
1882
|
}
|
|
1885
1883
|
class Qt extends Jt {
|
|
1886
|
-
constructor(e, i, s, r, o, n, h,
|
|
1887
|
-
super(e, r, o, n,
|
|
1884
|
+
constructor(e, i, s, r, o, n, l, h, f, d = "body") {
|
|
1885
|
+
super(e, r, o, n, l, h.fixed, d);
|
|
1888
1886
|
c(this, "formatter");
|
|
1889
1887
|
c(this, "hoverIconName", "");
|
|
1890
1888
|
c(this, "align");
|
|
@@ -1929,7 +1927,7 @@ class Qt extends Jt {
|
|
|
1929
1927
|
c(this, "overflowTooltipShow", !0);
|
|
1930
1928
|
c(this, "overflowTooltipMaxWidth", 500);
|
|
1931
1929
|
c(this, "overflowTooltipPlacement", "top");
|
|
1932
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key =
|
|
1930
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "text", this.editorType = h.editorType || "text", this.cellType = d, this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level, this.column = h, this.rules = h.rules, this.row = f, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.update();
|
|
1933
1931
|
}
|
|
1934
1932
|
getValidationMessage() {
|
|
1935
1933
|
const e = this.ctx.database.getValidationError(this.rowKey, this.key);
|
|
@@ -2023,13 +2021,13 @@ class Qt extends Jt {
|
|
|
2023
2021
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2024
2022
|
let r, o = 0, n = "";
|
|
2025
2023
|
if (this.type === "tree" && s === "body") {
|
|
2026
|
-
const
|
|
2027
|
-
if (
|
|
2024
|
+
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: f = !1, expandLoading: d = !1, level: x = 0 } = l || {};
|
|
2025
|
+
if (d) {
|
|
2028
2026
|
const u = this.ctx.icons.get("loading");
|
|
2029
2027
|
n = "loading", r = u, o = x * 8;
|
|
2030
|
-
} else if (
|
|
2028
|
+
} else if (f) {
|
|
2031
2029
|
const u = this.ctx.icons.get("expand"), y = this.ctx.icons.get("shrink");
|
|
2032
|
-
r =
|
|
2030
|
+
r = h ? y : u, n = h ? "shrink" : "expand", o = x * 8;
|
|
2033
2031
|
} else
|
|
2034
2032
|
o = x * 8;
|
|
2035
2033
|
if (r) {
|
|
@@ -2046,10 +2044,10 @@ class Qt extends Jt {
|
|
|
2046
2044
|
FOOTER_CELL_STYLE_METHOD: r,
|
|
2047
2045
|
READONLY_TEXT_COLOR: o,
|
|
2048
2046
|
FOOTER_BG_COLOR: n,
|
|
2049
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2050
|
-
HIGHLIGHT_SELECTED_ROW_COLOR:
|
|
2051
|
-
HIGHLIGHT_HOVER_ROW:
|
|
2052
|
-
HIGHLIGHT_HOVER_ROW_COLOR:
|
|
2047
|
+
HIGHLIGHT_SELECTED_ROW: l,
|
|
2048
|
+
HIGHLIGHT_SELECTED_ROW_COLOR: h,
|
|
2049
|
+
HIGHLIGHT_HOVER_ROW: f,
|
|
2050
|
+
HIGHLIGHT_HOVER_ROW_COLOR: d
|
|
2053
2051
|
} = this.ctx.config;
|
|
2054
2052
|
if (this.cellType === "footer") {
|
|
2055
2053
|
let p = n, E = o;
|
|
@@ -2068,7 +2066,7 @@ class Qt extends Jt {
|
|
|
2068
2066
|
}
|
|
2069
2067
|
let x = "transparent";
|
|
2070
2068
|
const u = this.ctx.focusCell, y = this.ctx.hoverCell;
|
|
2071
|
-
|
|
2069
|
+
f && (y == null ? void 0 : y.rowKey) === this.rowKey && (x = d), l && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = h), this.drawCellSkyBgColor = x;
|
|
2072
2070
|
let g = e, w = o;
|
|
2073
2071
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2074
2072
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
@@ -2087,24 +2085,24 @@ class Qt extends Jt {
|
|
|
2087
2085
|
this.drawCellBgColor = g, this.drawTextColor = w;
|
|
2088
2086
|
}
|
|
2089
2087
|
updateSelection() {
|
|
2090
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: n, rowIndex:
|
|
2088
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: n, rowIndex: l, rowKey: h } = this;
|
|
2091
2089
|
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(n)) {
|
|
2092
|
-
const
|
|
2090
|
+
const f = this.ctx.database.getRowSelection(h), d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, y = this.drawY + (i - x) / 2;
|
|
2093
2091
|
let g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
|
|
2094
|
-
|
|
2092
|
+
f && d ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : f && d ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !f && d ? (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
2093
|
}
|
|
2096
2094
|
}
|
|
2097
2095
|
updateHoverIcon() {
|
|
2098
2096
|
const { CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2099
2097
|
if (typeof e == "function") {
|
|
2100
|
-
const
|
|
2098
|
+
const l = e({
|
|
2101
2099
|
row: this.row,
|
|
2102
2100
|
rowIndex: this.rowIndex,
|
|
2103
2101
|
colIndex: this.colIndex,
|
|
2104
2102
|
column: this.column,
|
|
2105
2103
|
value: this.getValue()
|
|
2106
2104
|
});
|
|
2107
|
-
|
|
2105
|
+
l !== void 0 && (this.hoverIconName = l);
|
|
2108
2106
|
}
|
|
2109
2107
|
const r = this.drawX + this.width - i - s, o = this.drawY + (this.height - i) / 2;
|
|
2110
2108
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
@@ -2221,8 +2219,8 @@ class Qt extends Jt {
|
|
|
2221
2219
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2222
2220
|
if (!s || !i)
|
|
2223
2221
|
return;
|
|
2224
|
-
const { xArr: r, yArr: o } = this.ctx.selector, n = r[1],
|
|
2225
|
-
|
|
2222
|
+
const { xArr: r, yArr: o } = this.ctx.selector, n = r[1], l = o[1], { colIndex: h, rowIndex: f, drawX: d, drawY: x } = this;
|
|
2223
|
+
h === n && f === l && this.ctx.paint.drawRect(d + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2226
2224
|
borderColor: "#fff",
|
|
2227
2225
|
fillColor: e
|
|
2228
2226
|
});
|
|
@@ -2276,32 +2274,32 @@ class Qt extends Jt {
|
|
|
2276
2274
|
});
|
|
2277
2275
|
}
|
|
2278
2276
|
drawBorder(e) {
|
|
2279
|
-
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: n } = this,
|
|
2280
|
-
let
|
|
2281
|
-
o === 0 && (
|
|
2282
|
-
const { xArr:
|
|
2283
|
-
n >= p && n <= E && o === m && this.ctx.paint.drawLine([h, l
|
|
2277
|
+
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: n } = this, l = i + 0.5;
|
|
2278
|
+
let h = s + 0.5, f = this.height;
|
|
2279
|
+
o === 0 && (h = this.y + 1, f = f - 1);
|
|
2280
|
+
const { xArr: d, yArr: x, lineDash: u = [], borderWidth: y = 1, borderColor: g, fillColor: w } = e, p = d[0], E = d[1], m = x[0], b = x[1];
|
|
2281
|
+
n >= p && n <= E && o === m && this.ctx.paint.drawLine([l, h, l + r - 2, h], {
|
|
2284
2282
|
borderColor: g,
|
|
2285
2283
|
fillColor: w,
|
|
2286
2284
|
borderWidth: y,
|
|
2287
2285
|
lineCap: "round",
|
|
2288
2286
|
lineJoin: "round",
|
|
2289
2287
|
lineDash: u
|
|
2290
|
-
}), n >= p && n <= E && o === b && this.ctx.paint.drawLine([
|
|
2288
|
+
}), n >= p && n <= E && o === b && this.ctx.paint.drawLine([l, h + f - 1.5, l + r, h + f - 1.5], {
|
|
2291
2289
|
borderColor: g,
|
|
2292
2290
|
fillColor: w,
|
|
2293
2291
|
borderWidth: y,
|
|
2294
2292
|
lineCap: "round",
|
|
2295
2293
|
lineJoin: "round",
|
|
2296
2294
|
lineDash: u
|
|
2297
|
-
}), n === p && o >= m && o <= b && this.ctx.paint.drawLine([h, l, h
|
|
2295
|
+
}), n === p && o >= m && o <= b && this.ctx.paint.drawLine([l, h, l, h + f - 1], {
|
|
2298
2296
|
borderColor: g,
|
|
2299
2297
|
fillColor: w,
|
|
2300
2298
|
borderWidth: y,
|
|
2301
2299
|
lineCap: "round",
|
|
2302
2300
|
lineJoin: "round",
|
|
2303
2301
|
lineDash: u
|
|
2304
|
-
}), n === E && o >= m && o <= b && this.ctx.paint.drawLine([
|
|
2302
|
+
}), n === E && o >= m && o <= b && this.ctx.paint.drawLine([l + r - 1, h, l + r - 1, h + f - 1], {
|
|
2305
2303
|
borderColor: g,
|
|
2306
2304
|
fillColor: w,
|
|
2307
2305
|
borderWidth: y,
|
|
@@ -2312,8 +2310,8 @@ class Qt extends Jt {
|
|
|
2312
2310
|
}
|
|
2313
2311
|
}
|
|
2314
2312
|
class te extends Jt {
|
|
2315
|
-
constructor(e, i, s, r, o, n,
|
|
2316
|
-
super(e, s, r, o, n,
|
|
2313
|
+
constructor(e, i, s, r, o, n, l) {
|
|
2314
|
+
super(e, s, r, o, n, l.fixed, "header");
|
|
2317
2315
|
c(this, "align");
|
|
2318
2316
|
c(this, "verticalAlign", "middle");
|
|
2319
2317
|
c(this, "fixed");
|
|
@@ -2346,7 +2344,7 @@ class te extends Jt {
|
|
|
2346
2344
|
c(this, "drawImageHeight", 0);
|
|
2347
2345
|
c(this, "drawImageName", "");
|
|
2348
2346
|
c(this, "drawImageSource");
|
|
2349
|
-
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = n, this.colIndex = i, this.key =
|
|
2347
|
+
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
2348
|
}
|
|
2351
2349
|
/**
|
|
2352
2350
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2366,11 +2364,11 @@ class te extends Jt {
|
|
|
2366
2364
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2367
2365
|
let r = i, o = s;
|
|
2368
2366
|
if (typeof e == "function") {
|
|
2369
|
-
const n = e, { backgroundColor:
|
|
2367
|
+
const n = e, { backgroundColor: l, color: h } = n({
|
|
2370
2368
|
colIndex: this.colIndex,
|
|
2371
2369
|
column: this.column
|
|
2372
2370
|
}) || {};
|
|
2373
|
-
|
|
2371
|
+
l && (r = l), h && (o = h);
|
|
2374
2372
|
}
|
|
2375
2373
|
this.drawCellBgColor = r, this.drawTextColor = o;
|
|
2376
2374
|
}
|
|
@@ -2381,11 +2379,11 @@ class te extends Jt {
|
|
|
2381
2379
|
const {
|
|
2382
2380
|
paint: e,
|
|
2383
2381
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2384
|
-
} = this.ctx, { drawX: o, drawY: n, displayText:
|
|
2382
|
+
} = this.ctx, { drawX: o, drawY: n, displayText: l } = this;
|
|
2385
2383
|
e.drawRect(o, n, this.width, this.height, {
|
|
2386
2384
|
borderColor: i,
|
|
2387
2385
|
fillColor: this.drawCellBgColor
|
|
2388
|
-
}), e.drawText(
|
|
2386
|
+
}), e.drawText(l, o, n, this.width, this.height, {
|
|
2389
2387
|
font: r,
|
|
2390
2388
|
padding: s,
|
|
2391
2389
|
color: this.drawTextColor,
|
|
@@ -2396,9 +2394,9 @@ class te extends Jt {
|
|
|
2396
2394
|
drawSelection() {
|
|
2397
2395
|
const { width: e, height: i, type: s } = this;
|
|
2398
2396
|
if (["index-selection", "selection"].includes(s)) {
|
|
2399
|
-
const { indeterminate: r, check: o, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE:
|
|
2400
|
-
let
|
|
2401
|
-
r ? (
|
|
2397
|
+
const { indeterminate: r, check: o, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: l = 0 } = this.ctx.config, h = this.drawX + (e - l) / 2, f = this.drawY + (i - l) / 2;
|
|
2398
|
+
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2399
|
+
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && n ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && n ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && n ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = h, this.drawImageY = f, this.drawImageWidth = l, this.drawImageHeight = l, this.drawImageName = x, this.drawImageSource = d, this.ctx.paint.drawImage(
|
|
2402
2400
|
this.drawImageSource,
|
|
2403
2401
|
this.drawImageX,
|
|
2404
2402
|
this.drawImageY,
|
|
@@ -2441,8 +2439,8 @@ class si {
|
|
|
2441
2439
|
return;
|
|
2442
2440
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2443
2441
|
for (const o of s) {
|
|
2444
|
-
const n = o.getDrawX(),
|
|
2445
|
-
if (i > n && i < n + o.width && e >
|
|
2442
|
+
const n = o.getDrawX(), l = o.getDrawY();
|
|
2443
|
+
if (i > n && i < n + o.width && e > l && e < l + o.height) {
|
|
2446
2444
|
this.ctx.focusCellHeader = o, this.ctx.emit("cellHeaderMousedown", o, t);
|
|
2447
2445
|
return;
|
|
2448
2446
|
}
|
|
@@ -2450,10 +2448,10 @@ class si {
|
|
|
2450
2448
|
const r = this.ctx.body.renderRows;
|
|
2451
2449
|
for (const o of r) {
|
|
2452
2450
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2453
|
-
for (const
|
|
2454
|
-
const
|
|
2455
|
-
if (i >
|
|
2456
|
-
this.ctx.setFocusCell(
|
|
2451
|
+
for (const l of n) {
|
|
2452
|
+
const h = l.getDrawX(), f = l.getDrawY();
|
|
2453
|
+
if (i > h && i < h + l.width && e > f && e < f + l.height) {
|
|
2454
|
+
this.ctx.setFocusCell(l), this.ctx.emit("cellMousedown", l, t);
|
|
2457
2455
|
return;
|
|
2458
2456
|
}
|
|
2459
2457
|
}
|
|
@@ -2463,8 +2461,8 @@ class si {
|
|
|
2463
2461
|
return;
|
|
2464
2462
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2465
2463
|
for (const o of s) {
|
|
2466
|
-
const n = o.getDrawX(),
|
|
2467
|
-
if (i > n && i < n + o.width && e >
|
|
2464
|
+
const n = o.getDrawX(), l = o.getDrawY();
|
|
2465
|
+
if (i > n && i < n + o.width && e > l && e < l + o.height) {
|
|
2468
2466
|
this.ctx.clickCellHeader = o, this.ctx.emit("cellHeaderClick", o, t), this.selectionClick(o);
|
|
2469
2467
|
return;
|
|
2470
2468
|
}
|
|
@@ -2472,10 +2470,10 @@ class si {
|
|
|
2472
2470
|
const r = this.ctx.body.renderRows;
|
|
2473
2471
|
for (const o of r) {
|
|
2474
2472
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2475
|
-
for (const
|
|
2476
|
-
const
|
|
2477
|
-
if (i >
|
|
2478
|
-
this.ctx.clickCell =
|
|
2473
|
+
for (const l of n) {
|
|
2474
|
+
const h = l.getDrawX(), f = l.getDrawY();
|
|
2475
|
+
if (i > h && i < h + l.width && e > f && e < f + l.height) {
|
|
2476
|
+
this.ctx.clickCell = l, this.ctx.emit("cellClick", l, t), this.selectionClick(l), this.treeClick(l);
|
|
2479
2477
|
return;
|
|
2480
2478
|
}
|
|
2481
2479
|
}
|
|
@@ -2485,8 +2483,8 @@ class si {
|
|
|
2485
2483
|
return;
|
|
2486
2484
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2487
2485
|
for (const o of s) {
|
|
2488
|
-
const n = o.getDrawX(),
|
|
2489
|
-
if (i > n && i < n + o.width && e >
|
|
2486
|
+
const n = o.getDrawX(), l = o.getDrawY();
|
|
2487
|
+
if (i > n && i < n + o.width && e > l && e < l + o.height) {
|
|
2490
2488
|
this.ctx.emit("cellHeaderContextMenuClick", o, t);
|
|
2491
2489
|
return;
|
|
2492
2490
|
}
|
|
@@ -2494,10 +2492,10 @@ class si {
|
|
|
2494
2492
|
const r = this.ctx.body.renderRows;
|
|
2495
2493
|
for (const o of r) {
|
|
2496
2494
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2497
|
-
for (const
|
|
2498
|
-
const
|
|
2499
|
-
if (i >
|
|
2500
|
-
this.ctx.emit("cellContextMenuClick",
|
|
2495
|
+
for (const l of n) {
|
|
2496
|
+
const h = l.getDrawX(), f = l.getDrawY();
|
|
2497
|
+
if (i > h && i < h + l.width && e > f && e < f + l.height) {
|
|
2498
|
+
this.ctx.emit("cellContextMenuClick", l, t);
|
|
2501
2499
|
return;
|
|
2502
2500
|
}
|
|
2503
2501
|
}
|
|
@@ -2508,8 +2506,8 @@ class si {
|
|
|
2508
2506
|
return;
|
|
2509
2507
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2510
2508
|
for (const n of s) {
|
|
2511
|
-
const
|
|
2512
|
-
if (i >
|
|
2509
|
+
const l = n.getDrawX(), h = n.getDrawY();
|
|
2510
|
+
if (i > l && i < l + n.width && e > h && e < h + n.height) {
|
|
2513
2511
|
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
2512
|
return;
|
|
2515
2513
|
this.ctx.hoverCellHeader = n, this.ctx.emit("cellHeaderHoverChange", n);
|
|
@@ -2518,12 +2516,12 @@ class si {
|
|
|
2518
2516
|
}
|
|
2519
2517
|
const r = this.ctx.body.renderRows;
|
|
2520
2518
|
for (const n of r) {
|
|
2521
|
-
const
|
|
2522
|
-
for (const
|
|
2523
|
-
const
|
|
2524
|
-
if (i >
|
|
2525
|
-
if (this.ctx.emit("cellMouseenter",
|
|
2526
|
-
((o = this.ctx.hoverCell) == null ? void 0 : o.rowKey) !==
|
|
2519
|
+
const l = n.fixedCells.concat(n.noFixedCells);
|
|
2520
|
+
for (const h of l) {
|
|
2521
|
+
const f = h.getDrawX(), d = h.getDrawY();
|
|
2522
|
+
if (i > f && i < f + h.visibleWidth && e > d && e < d + 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 > f && i < f + h.width && e > d && e < d + h.height) {
|
|
2523
|
+
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;
|
|
2524
|
+
((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
2525
|
return;
|
|
2528
2526
|
}
|
|
2529
2527
|
}
|
|
@@ -2558,10 +2556,10 @@ class si {
|
|
|
2558
2556
|
colIndex: t.colIndex,
|
|
2559
2557
|
column: t.column,
|
|
2560
2558
|
value: t.getValue()
|
|
2561
|
-
}).then((
|
|
2562
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2563
|
-
}).catch((
|
|
2564
|
-
this.ctx.database.expandLoading(t.rowKey, !1), console.error(
|
|
2559
|
+
}).then((l) => {
|
|
2560
|
+
this.ctx.database.setExpandChildren(t.rowKey, l), this.ctx.database.expandLoading(t.rowKey, !1);
|
|
2561
|
+
}).catch((l) => {
|
|
2562
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(l);
|
|
2565
2563
|
}));
|
|
2566
2564
|
else {
|
|
2567
2565
|
const n = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2715,8 +2713,8 @@ class ri {
|
|
|
2715
2713
|
for (let r = 0; r <= e[1] - e[0]; r++) {
|
|
2716
2714
|
const o = [];
|
|
2717
2715
|
for (let n = 0; n <= i[1] - i[0]; n++) {
|
|
2718
|
-
const
|
|
2719
|
-
|
|
2716
|
+
const l = r + e[0], h = n + i[0], f = this.database.getItemValueForRowIndexAndColIndex(l, h);
|
|
2717
|
+
f && o.push(f.value);
|
|
2720
2718
|
}
|
|
2721
2719
|
s += `${o.join(" ")}\r`, t.push(o);
|
|
2722
2720
|
}
|
|
@@ -2788,8 +2786,8 @@ class Wt {
|
|
|
2788
2786
|
// 滚动条的长度
|
|
2789
2787
|
c(this, "visibleDistance", 0);
|
|
2790
2788
|
//可见区域的长度
|
|
2791
|
-
c(this, "
|
|
2792
|
-
c(this, "
|
|
2789
|
+
c(this, "clientX", 0);
|
|
2790
|
+
c(this, "clientY", 0);
|
|
2793
2791
|
c(this, "dragStart", 0);
|
|
2794
2792
|
// 拖拽开始的位置
|
|
2795
2793
|
c(this, "isDragging", !1);
|
|
@@ -2800,26 +2798,26 @@ class Wt {
|
|
|
2800
2798
|
this.updateScroll(t);
|
|
2801
2799
|
}
|
|
2802
2800
|
onMouseDown(t) {
|
|
2803
|
-
const { offsetX: e, offsetY: i } = t;
|
|
2804
|
-
if (!(
|
|
2801
|
+
const { offsetX: e, offsetY: i, clientX: s, clientY: r } = t;
|
|
2802
|
+
if (!(s == this.clientX && r == this.clientY)) {
|
|
2805
2803
|
if (this.isOnScrollbar(e, i))
|
|
2806
|
-
this.
|
|
2804
|
+
this.clientX = s, this.clientY = r, this.isDragging = !0, this.ctx.scrollerMove = !0, this.isFocus = !0, this.dragStart = this.scroll;
|
|
2807
2805
|
else if (this.isOnTrack(e, i)) {
|
|
2808
|
-
let
|
|
2809
|
-
this.type === "vertical" ?
|
|
2806
|
+
let o = 0;
|
|
2807
|
+
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
2808
|
}
|
|
2811
2809
|
}
|
|
2812
2810
|
}
|
|
2813
2811
|
onMouseUp() {
|
|
2814
|
-
this.isDragging = !1, this.isFocus = !1, this.
|
|
2812
|
+
this.isDragging = !1, this.isFocus = !1, this.clientX = 0, this.clientY = 0;
|
|
2815
2813
|
}
|
|
2816
2814
|
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" ?
|
|
2815
|
+
const { offsetX: e, offsetY: i, clientX: s, clientY: r } = t;
|
|
2816
|
+
if (this.isOnScrollbar(e, i) && t.target === this.ctx.target ? this.isFocus = !0 : this.isFocus = !1, s == this.clientX && r == this.clientY) return;
|
|
2817
|
+
let o = 0;
|
|
2818
|
+
if (this.type === "horizontal" ? o = s - this.clientX : o = r - this.clientY, this.isDragging && o !== 0) {
|
|
2819
|
+
let n = 0;
|
|
2820
|
+
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
2821
|
}
|
|
2824
2822
|
}
|
|
2825
2823
|
isPointInElement(t, e, i, s, r, o) {
|
|
@@ -2832,30 +2830,29 @@ class Wt {
|
|
|
2832
2830
|
return this.isPointInElement(t, e, this.trackX, this.trackY, this.trackWidth, this.trackHeight);
|
|
2833
2831
|
}
|
|
2834
2832
|
updateScroll(t) {
|
|
2835
|
-
t.preventDefault();
|
|
2836
2833
|
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)));
|
|
2834
|
+
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 ? 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
2835
|
}
|
|
2839
2836
|
updatedSize() {
|
|
2840
2837
|
const {
|
|
2841
2838
|
body: t,
|
|
2842
2839
|
header: e,
|
|
2843
2840
|
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,
|
|
2841
|
+
} = this.ctx, r = this.ctx.target.width + 1, o = this.ctx.target.height, n = e.height, l = e.width, h = t.height, f = this.ctx.footer.height;
|
|
2845
2842
|
if (this.type === "vertical") {
|
|
2846
|
-
this.visibleDistance = o - i - n, this.distance =
|
|
2847
|
-
const
|
|
2848
|
-
let x = Math.floor(
|
|
2843
|
+
this.visibleDistance = o - i - n, this.distance = h - this.visibleDistance + f, 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;
|
|
2844
|
+
const d = this.distance ? this.visibleDistance / h : 0;
|
|
2845
|
+
let x = Math.floor(d * this.visibleDistance);
|
|
2849
2846
|
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
2847
|
} else {
|
|
2851
|
-
this.visibleDistance = r - i, this.distance =
|
|
2848
|
+
this.visibleDistance = r - i, this.distance = l - this.visibleDistance, this.splitPoints = [
|
|
2852
2849
|
r - i,
|
|
2853
2850
|
o - i,
|
|
2854
2851
|
r - i,
|
|
2855
2852
|
o
|
|
2856
2853
|
], this.trackX = 0, this.trackY = o - i, this.trackWidth = r, this.trackHeight = i;
|
|
2857
|
-
const
|
|
2858
|
-
let x = Math.floor(
|
|
2854
|
+
const d = this.distance ? this.visibleDistance / l : 0;
|
|
2855
|
+
let x = Math.floor(d * this.visibleDistance);
|
|
2859
2856
|
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
2857
|
}
|
|
2861
2858
|
}
|
|
@@ -2981,31 +2978,20 @@ class ni {
|
|
|
2981
2978
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
2982
2979
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
2983
2980
|
const s = Ut(i), r = It(i);
|
|
2984
|
-
this.height = t * s, this.width = r.reduce(
|
|
2985
|
-
(d, f) => d + ((f == null ? void 0 : f.width) || 100),
|
|
2986
|
-
0
|
|
2987
|
-
), this.visibleHeight = this.height;
|
|
2981
|
+
this.height = t * s, this.width = r.reduce((d, x) => d + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
|
|
2988
2982
|
const o = Ue(Zt(i, s));
|
|
2989
2983
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
2990
2984
|
const n = this.ctx.targetContainer.getBoundingClientRect();
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2985
|
+
this.resizeNum > 0 ? this.ctx.target.width = n.width : this.ctx.target.width = this.width + e - 1, this.visibleWidth = this.ctx.target.width - e;
|
|
2986
|
+
const l = this.visibleWidth - this.width;
|
|
2987
|
+
if (this.resizeNum && l > 0) {
|
|
2988
|
+
const d = Math.floor(l / this.resizeNum * 100) / 100;
|
|
2989
|
+
this.resizeAllColumn(d);
|
|
2994
2990
|
}
|
|
2995
|
-
const h = this.fixedLeftCellHeaders.filter(
|
|
2996
|
-
|
|
2997
|
-
);
|
|
2998
|
-
this.ctx.
|
|
2999
|
-
(d, f) => d + f.width,
|
|
3000
|
-
0
|
|
3001
|
-
);
|
|
3002
|
-
const l = this.fixedRightCellHeaders.filter(
|
|
3003
|
-
(d) => !d.hasChildren
|
|
3004
|
-
);
|
|
3005
|
-
this.ctx.fixedRightWidth = l.reduce(
|
|
3006
|
-
(d, f) => d + f.width,
|
|
3007
|
-
e
|
|
3008
|
-
), 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;
|
|
2991
|
+
const h = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
2992
|
+
this.ctx.fixedLeftWidth = h.reduce((d, x) => d + x.width, 0);
|
|
2993
|
+
const f = this.fixedRightCellHeaders.filter((d) => !d.hasChildren);
|
|
2994
|
+
this.ctx.fixedRightWidth = f.reduce((d, x) => d + x.width, e), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
|
|
3009
2995
|
}
|
|
3010
2996
|
// 调整表头的宽度
|
|
3011
2997
|
initResizeColumn() {
|
|
@@ -3030,13 +3016,10 @@ class ni {
|
|
|
3030
3016
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
3031
3017
|
return;
|
|
3032
3018
|
this.ctx.target.style.cursor === "col-resize" && (this.ctx.target.style.cursor = "default");
|
|
3033
|
-
const r = [
|
|
3034
|
-
...this.renderFixedCellHeaders,
|
|
3035
|
-
...this.renderCenterCellHeaders
|
|
3036
|
-
];
|
|
3019
|
+
const r = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3037
3020
|
for (const o of r) {
|
|
3038
|
-
const n = e.layerX,
|
|
3039
|
-
n >
|
|
3021
|
+
const n = e.layerX, l = o.getDrawX();
|
|
3022
|
+
n > l + o.width - 5 && n < l + o.width + 4 && n < i.width - 4 && // 视窗中最后一列不允许调整宽
|
|
3040
3023
|
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
3024
|
}
|
|
3042
3025
|
}
|
|
@@ -3091,19 +3074,11 @@ class ni {
|
|
|
3091
3074
|
let s = e;
|
|
3092
3075
|
const { HEADER_HEIGHT: r = 0 } = this.ctx.config;
|
|
3093
3076
|
for (let o = 0; o < i; o++) {
|
|
3094
|
-
const n = t[o],
|
|
3095
|
-
let
|
|
3096
|
-
n.children && (
|
|
3097
|
-
const
|
|
3098
|
-
|
|
3099
|
-
this.columnIndex,
|
|
3100
|
-
s,
|
|
3101
|
-
l,
|
|
3102
|
-
d,
|
|
3103
|
-
h,
|
|
3104
|
-
n
|
|
3105
|
-
);
|
|
3106
|
-
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;
|
|
3077
|
+
const n = t[o], l = r * (n.rowspan || 1), h = r * n.level;
|
|
3078
|
+
let f = n.width || 100;
|
|
3079
|
+
n.children && (f = It(n.children).reduce((u, y) => u + ((y == null ? void 0 : y.width) || 100), 0));
|
|
3080
|
+
const d = new te(this.ctx, this.columnIndex, s, h, f, l, n);
|
|
3081
|
+
this.ctx.database.setHeader(n.key, d), this.allCellHeaders.push(d), n.children || (this.leafCellHeaders.push(d), d.column.widthFillDisable || this.resizeNum++), n.fixed === "left" ? this.fixedLeftCellHeaders.push(d) : n.fixed === "right" ? this.fixedRightCellHeaders.push(d) : this.centerCellHeaders.push(d), !n.children && this.columnIndex++, n.children && this.render(n.children, s), s += f;
|
|
3107
3082
|
}
|
|
3108
3083
|
}
|
|
3109
3084
|
drawTipLine() {
|
|
@@ -3134,8 +3109,8 @@ class ni {
|
|
|
3134
3109
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3135
3110
|
colorEnd: "rgba(0,0,0,0)"
|
|
3136
3111
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3137
|
-
const
|
|
3138
|
-
this.ctx.paint.drawShadow(
|
|
3112
|
+
const l = s.width - (this.x + this.width) + r.width - e;
|
|
3113
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3139
3114
|
fillColor: o,
|
|
3140
3115
|
side: "left",
|
|
3141
3116
|
shadowWidth: 4,
|
|
@@ -3152,13 +3127,7 @@ class ni {
|
|
|
3152
3127
|
i.push(s), s.hasChildren || t.push(s);
|
|
3153
3128
|
}), this.fixedRightCellHeaders.forEach((s) => {
|
|
3154
3129
|
i.push(s), s.hasChildren || t.push(s);
|
|
3155
|
-
}), this.renderCenterCellHeaders = e, this.renderFixedCellHeaders = i, this.renderLeafCellHeaders = t.sort(
|
|
3156
|
-
(s, r) => s.x - r.x
|
|
3157
|
-
), this.visibleLeafColumns = this.renderLeafCellHeaders.map(
|
|
3158
|
-
(s) => s.column
|
|
3159
|
-
), this.ctx.header.visibleLeafColumns = this.visibleLeafColumns, this.ctx.header.leafCellHeaders = this.leafCellHeaders, this.ctx.header.renderLeafCellHeaders = this.renderLeafCellHeaders, this.ctx.header.renderCellHeaders = this.renderFixedCellHeaders.concat(
|
|
3160
|
-
this.renderCenterCellHeaders
|
|
3161
|
-
);
|
|
3130
|
+
}), this.renderCenterCellHeaders = e, this.renderFixedCellHeaders = i, this.renderLeafCellHeaders = t.sort((s, r) => s.x - r.x), this.visibleLeafColumns = this.renderLeafCellHeaders.map((s) => s.column), this.ctx.header.visibleLeafColumns = this.visibleLeafColumns, this.ctx.header.leafCellHeaders = this.leafCellHeaders, this.ctx.header.renderLeafCellHeaders = this.renderLeafCellHeaders, this.ctx.header.renderCellHeaders = this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders);
|
|
3162
3131
|
}
|
|
3163
3132
|
draw() {
|
|
3164
3133
|
this.renderCenterCellHeaders.forEach((t) => {
|
|
@@ -3169,7 +3138,7 @@ class ni {
|
|
|
3169
3138
|
}
|
|
3170
3139
|
}
|
|
3171
3140
|
class ee {
|
|
3172
|
-
constructor(t, e, i = 0, s = 0, r = 0, o = 0, n,
|
|
3141
|
+
constructor(t, e, i = 0, s = 0, r = 0, o = 0, n, l = "body") {
|
|
3173
3142
|
c(this, "ctx");
|
|
3174
3143
|
c(this, "x", 0);
|
|
3175
3144
|
c(this, "y", 0);
|
|
@@ -3182,7 +3151,7 @@ class ee {
|
|
|
3182
3151
|
c(this, "rowKey", "");
|
|
3183
3152
|
c(this, "rowType", "body");
|
|
3184
3153
|
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 =
|
|
3154
|
+
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
3155
|
}
|
|
3187
3156
|
update() {
|
|
3188
3157
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
@@ -3256,10 +3225,10 @@ class ai {
|
|
|
3256
3225
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3257
3226
|
BORDER_COLOR: o,
|
|
3258
3227
|
BORDER_RADIUS: n,
|
|
3259
|
-
HEIGHT:
|
|
3260
|
-
EMPTY_BODY_HEIGHT:
|
|
3261
|
-
MAX_HEIGHT:
|
|
3262
|
-
ENABLE_OFFSET_HEIGHT:
|
|
3228
|
+
HEIGHT: l,
|
|
3229
|
+
EMPTY_BODY_HEIGHT: h = 0,
|
|
3230
|
+
MAX_HEIGHT: f = 0,
|
|
3231
|
+
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3263
3232
|
OFFSET_HEIGHT: x = 0
|
|
3264
3233
|
}
|
|
3265
3234
|
} = this.ctx;
|
|
@@ -3271,7 +3240,7 @@ class ai {
|
|
|
3271
3240
|
const { top: g } = t.getBoundingClientRect();
|
|
3272
3241
|
this.width = e.width, this.visibleWidth = t.width - r;
|
|
3273
3242
|
const w = this.ctx.footer.height;
|
|
3274
|
-
this.data.length || (this.height =
|
|
3243
|
+
this.data.length || (this.height = h);
|
|
3275
3244
|
const p = this.data.length ? "not-empty" : "empty";
|
|
3276
3245
|
this.ctx.emit("emptyChange", {
|
|
3277
3246
|
isEmpty: p,
|
|
@@ -3280,14 +3249,14 @@ class ai {
|
|
|
3280
3249
|
bodyHeight: this.height,
|
|
3281
3250
|
footerHeight: w,
|
|
3282
3251
|
width: this.width,
|
|
3283
|
-
height: this.data.length ? 0 :
|
|
3252
|
+
height: this.data.length ? 0 : h + w
|
|
3284
3253
|
});
|
|
3285
3254
|
let E = this.height + e.height + r;
|
|
3286
3255
|
E += w;
|
|
3287
3256
|
let m = 0;
|
|
3288
|
-
this.data.length &&
|
|
3257
|
+
this.data.length && d ? (m = window.innerHeight - g - x, m < 0 && (m = 32, console.error(
|
|
3289
3258
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3290
|
-
))) : this.data.length &&
|
|
3259
|
+
))) : this.data.length && l ? m = l : this.data.length && f && E > f ? m = f : m = E, m > 0 && (this.ctx.target.height = m);
|
|
3291
3260
|
let b = t.height - e.height - r;
|
|
3292
3261
|
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
3262
|
"style",
|
|
@@ -3313,19 +3282,19 @@ class ai {
|
|
|
3313
3282
|
config: { RESIZE_ROW_MIN_HEIGHT: n = 0 }
|
|
3314
3283
|
} = this.ctx;
|
|
3315
3284
|
if (this.isResizing && this.resizeTarget) {
|
|
3316
|
-
const
|
|
3317
|
-
let
|
|
3318
|
-
|
|
3285
|
+
const l = this.resizeTarget.height;
|
|
3286
|
+
let h = i - this.offsetY;
|
|
3287
|
+
h + l < n && (h = -(l - n)), this.resizeDiff = h, this.ctx.emit("draw");
|
|
3319
3288
|
} else {
|
|
3320
3289
|
if (this.resizeTarget = null, this.isMouseDown || this.ctx.target.style.cursor === "crosshair")
|
|
3321
3290
|
return;
|
|
3322
3291
|
this.ctx.target.style.cursor === "row-resize" && (this.ctx.target.style.cursor = "default");
|
|
3323
|
-
for (let
|
|
3324
|
-
const
|
|
3325
|
-
if (i >
|
|
3326
|
-
for (let
|
|
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 =
|
|
3292
|
+
for (let l = 0; l < this.renderRows.length; l++) {
|
|
3293
|
+
const h = this.renderRows[l];
|
|
3294
|
+
if (i > h.y - o + h.height - 1.5 && i < h.y - o + h.height + 1.5 && i < r.height - 4)
|
|
3295
|
+
for (let d = 0; d < h.cells.length; d++) {
|
|
3296
|
+
const x = h.cells[d];
|
|
3297
|
+
s > x.drawX + 10 && s < x.drawX + x.width - 10 && x.rowspan === 1 && (this.ctx.target.style.cursor = "row-resize", this.resizeTarget = h);
|
|
3329
3298
|
}
|
|
3330
3299
|
}
|
|
3331
3300
|
}
|
|
@@ -3371,8 +3340,8 @@ class ai {
|
|
|
3371
3340
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3372
3341
|
colorEnd: "rgba(0,0,0,0)"
|
|
3373
3342
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3374
|
-
const
|
|
3375
|
-
this.ctx.paint.drawShadow(
|
|
3343
|
+
const l = s.width - (this.x + this.width) + r.width - e;
|
|
3344
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3376
3345
|
fillColor: o,
|
|
3377
3346
|
side: "left",
|
|
3378
3347
|
shadowWidth: 4,
|
|
@@ -3396,14 +3365,14 @@ class ai {
|
|
|
3396
3365
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: r, positions: o } = e.getData();
|
|
3397
3366
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3398
3367
|
const n = this.binarySearch(o, s);
|
|
3399
|
-
let
|
|
3400
|
-
|
|
3401
|
-
const
|
|
3402
|
-
for (let
|
|
3403
|
-
const
|
|
3404
|
-
|
|
3368
|
+
let l = this.binarySearch(o, s + this.visibleHeight);
|
|
3369
|
+
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;
|
|
3370
|
+
const h = [];
|
|
3371
|
+
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3372
|
+
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top: y } = this.ctx.database.getPositionForRowIndex(d), g = new ee(this.ctx, d, 0, y + this.y, t.width, u, x);
|
|
3373
|
+
h.push(g);
|
|
3405
3374
|
}
|
|
3406
|
-
this.renderRows =
|
|
3375
|
+
this.renderRows = h, this.ctx.body.renderRows = h;
|
|
3407
3376
|
}
|
|
3408
3377
|
draw() {
|
|
3409
3378
|
this.renderRows.forEach((t) => {
|
|
@@ -3444,16 +3413,16 @@ class ci {
|
|
|
3444
3413
|
target: r,
|
|
3445
3414
|
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: n }
|
|
3446
3415
|
} = this.ctx;
|
|
3447
|
-
let
|
|
3448
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3416
|
+
let l = this.y;
|
|
3417
|
+
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
3418
|
fillColor: o,
|
|
3450
3419
|
side: "right",
|
|
3451
3420
|
shadowWidth: 4,
|
|
3452
3421
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3453
3422
|
colorEnd: "rgba(0,0,0,0)"
|
|
3454
3423
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3455
|
-
const
|
|
3456
|
-
this.ctx.paint.drawShadow(
|
|
3424
|
+
const h = s.width - (this.x + this.width) + r.width - e;
|
|
3425
|
+
this.ctx.paint.drawShadow(h + 1, l, e, this.height, {
|
|
3457
3426
|
fillColor: o,
|
|
3458
3427
|
side: "left",
|
|
3459
3428
|
shadowWidth: 4,
|
|
@@ -3489,7 +3458,7 @@ class ci {
|
|
|
3489
3458
|
});
|
|
3490
3459
|
}
|
|
3491
3460
|
}
|
|
3492
|
-
class
|
|
3461
|
+
class li {
|
|
3493
3462
|
// 垂直滚动定时器
|
|
3494
3463
|
constructor(t) {
|
|
3495
3464
|
c(this, "isCut", !1);
|
|
@@ -3619,8 +3588,8 @@ class hi {
|
|
|
3619
3588
|
return;
|
|
3620
3589
|
const { ENABLE_SELECTOR_ALL_ROWS: t, ENABLE_SELECTOR_ALL_COLS: e } = this.ctx.config;
|
|
3621
3590
|
if (t && e) {
|
|
3622
|
-
const s = this.ctx.maxColIndex, r = 0, o = this.ctx.maxRowIndex, n = [1, s],
|
|
3623
|
-
this.setSelector(n,
|
|
3591
|
+
const s = this.ctx.maxColIndex, r = 0, o = this.ctx.maxRowIndex, n = [1, s], l = [r, o];
|
|
3592
|
+
this.setSelector(n, l);
|
|
3624
3593
|
}
|
|
3625
3594
|
}
|
|
3626
3595
|
selectRows(t, e = !0) {
|
|
@@ -3648,15 +3617,15 @@ class hi {
|
|
|
3648
3617
|
return;
|
|
3649
3618
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3650
3619
|
if (t && e && i) {
|
|
3651
|
-
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), n = Math.max(i.colIndex, r),
|
|
3652
|
-
this.setSelector(
|
|
3620
|
+
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), f = [o, n], d = [l, h];
|
|
3621
|
+
this.setSelector(f, d);
|
|
3653
3622
|
}
|
|
3654
3623
|
}
|
|
3655
3624
|
click(t = !1) {
|
|
3656
3625
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3657
3626
|
if (e)
|
|
3658
3627
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3659
|
-
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e,
|
|
3628
|
+
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e, l = Math.min(o, s), h = Math.max(o, s), f = Math.min(n, r), d = Math.max(n, r), x = [l, h], u = [f, d];
|
|
3660
3629
|
this.setSelector(x, u);
|
|
3661
3630
|
} else {
|
|
3662
3631
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3693,10 +3662,10 @@ class hi {
|
|
|
3693
3662
|
let s = [];
|
|
3694
3663
|
const r = /* @__PURE__ */ new Set();
|
|
3695
3664
|
for (let n = 0; n <= e[1] - e[0]; n++)
|
|
3696
|
-
for (let
|
|
3697
|
-
const
|
|
3698
|
-
if (
|
|
3699
|
-
const { rowKey: x, key: u } =
|
|
3665
|
+
for (let l = 0; l <= t[1] - t[0]; l++) {
|
|
3666
|
+
const h = n + e[0], f = l + t[0], d = this.ctx.database.getItemValueForRowIndexAndColIndex(h, f);
|
|
3667
|
+
if (d) {
|
|
3668
|
+
const { rowKey: x, key: u } = d;
|
|
3700
3669
|
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
3701
3670
|
rowKey: x,
|
|
3702
3671
|
key: u,
|
|
@@ -3728,18 +3697,18 @@ class hi {
|
|
|
3728
3697
|
let o = [];
|
|
3729
3698
|
const n = r.split("\r");
|
|
3730
3699
|
n.length === 1 ? o = n[0].split(`
|
|
3731
|
-
`).map((
|
|
3732
|
-
let
|
|
3733
|
-
for (let
|
|
3734
|
-
const
|
|
3735
|
-
for (let x = 0; x <=
|
|
3736
|
-
const u =
|
|
3700
|
+
`).map((d) => d.split(" ")) : o = n.map((f) => f.split(" "));
|
|
3701
|
+
let l = [];
|
|
3702
|
+
for (let f = 0; f <= o.length - 1; f++) {
|
|
3703
|
+
const d = o[f].length;
|
|
3704
|
+
for (let x = 0; x <= d - 1; x++) {
|
|
3705
|
+
const u = f + e, y = x + i, g = o[f][x], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3737
3706
|
u,
|
|
3738
3707
|
y
|
|
3739
3708
|
);
|
|
3740
3709
|
if (w) {
|
|
3741
3710
|
const { rowKey: p, key: E } = w;
|
|
3742
|
-
this.ctx.database.getReadonly(p, E) || (s.add(p),
|
|
3711
|
+
this.ctx.database.getReadonly(p, E) || (s.add(p), l.push({
|
|
3743
3712
|
rowKey: p,
|
|
3744
3713
|
key: E,
|
|
3745
3714
|
value: g,
|
|
@@ -3750,23 +3719,23 @@ class hi {
|
|
|
3750
3719
|
}
|
|
3751
3720
|
}
|
|
3752
3721
|
if (this.isCut) {
|
|
3753
|
-
const
|
|
3722
|
+
const f = this.clearSelectedData(
|
|
3754
3723
|
this.ctx.selector.xArrCopy,
|
|
3755
3724
|
this.ctx.selector.yArrCopy,
|
|
3756
3725
|
!0
|
|
3757
3726
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3758
|
-
),
|
|
3759
|
-
|
|
3760
|
-
|
|
3727
|
+
), d = l.map((x) => `${x.rowKey}-${x.key}`);
|
|
3728
|
+
f.forEach((x) => {
|
|
3729
|
+
d.includes(`${x.rowKey}-${x.key}`) || l.unshift(x);
|
|
3761
3730
|
}), this.isCut = !1;
|
|
3762
3731
|
}
|
|
3763
|
-
if (!
|
|
3732
|
+
if (!l.length)
|
|
3764
3733
|
return;
|
|
3765
|
-
this.ctx.database.batchSetItemValue(
|
|
3766
|
-
let
|
|
3767
|
-
s.forEach((
|
|
3768
|
-
|
|
3769
|
-
}), this.ctx.emit("pasteChange",
|
|
3734
|
+
this.ctx.database.batchSetItemValue(l, !0);
|
|
3735
|
+
let h = [];
|
|
3736
|
+
s.forEach((f) => {
|
|
3737
|
+
h.push(this.ctx.database.getRowDataItemForRowKey(f));
|
|
3738
|
+
}), this.ctx.emit("pasteChange", l, h), this.clearCopyLine(), this.ctx.emit("draw");
|
|
3770
3739
|
}).catch((r) => {
|
|
3771
3740
|
console.error("获取剪贴板内容失败:", r);
|
|
3772
3741
|
});
|
|
@@ -3782,7 +3751,7 @@ class hi {
|
|
|
3782
3751
|
if (!e)
|
|
3783
3752
|
return;
|
|
3784
3753
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3785
|
-
const r = 0, o = 0, n = this.ctx.maxColIndex,
|
|
3754
|
+
const r = 0, o = 0, n = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
|
|
3786
3755
|
switch (t) {
|
|
3787
3756
|
case "LEFT":
|
|
3788
3757
|
i > r && i--;
|
|
@@ -3794,16 +3763,16 @@ class hi {
|
|
|
3794
3763
|
i < n && i++;
|
|
3795
3764
|
break;
|
|
3796
3765
|
case "BOTTOM":
|
|
3797
|
-
s <
|
|
3766
|
+
s < l && s++;
|
|
3798
3767
|
break;
|
|
3799
3768
|
}
|
|
3800
|
-
const
|
|
3801
|
-
if (
|
|
3802
|
-
if (["index", "index-selection", "selection"].includes(
|
|
3769
|
+
const h = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
3770
|
+
if (d) {
|
|
3771
|
+
if (["index", "index-selection", "selection"].includes(d.type))
|
|
3803
3772
|
return;
|
|
3804
|
-
this.ctx.setFocusCell(
|
|
3773
|
+
this.ctx.setFocusCell(d);
|
|
3805
3774
|
}
|
|
3806
|
-
this.setSelector(
|
|
3775
|
+
this.setSelector(h, f), this.adjustBoundaryPosition(), this.ctx.emit("draw");
|
|
3807
3776
|
}
|
|
3808
3777
|
stopAdjustPosition() {
|
|
3809
3778
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -3819,8 +3788,8 @@ class hi {
|
|
|
3819
3788
|
let n = 10 * (s === "left" ? -1 : 1);
|
|
3820
3789
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3821
3790
|
n *= 1.5;
|
|
3822
|
-
const { scrollX:
|
|
3823
|
-
(
|
|
3791
|
+
const { scrollX: l } = this.ctx, h = l + n;
|
|
3792
|
+
(h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
|
|
3824
3793
|
}, 100);
|
|
3825
3794
|
}
|
|
3826
3795
|
if (r && this.adjustPositionY !== r) {
|
|
@@ -3828,8 +3797,8 @@ class hi {
|
|
|
3828
3797
|
let n = 10 * (r === "top" ? -1 : 1);
|
|
3829
3798
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3830
3799
|
n *= 1.5;
|
|
3831
|
-
const { scrollY:
|
|
3832
|
-
(
|
|
3800
|
+
const { scrollY: l } = this.ctx, h = l + n;
|
|
3801
|
+
(h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
|
|
3833
3802
|
}, 100);
|
|
3834
3803
|
}
|
|
3835
3804
|
}
|
|
@@ -3837,20 +3806,20 @@ class hi {
|
|
|
3837
3806
|
* 调整滚动条位置,让焦点单元格始终出现在可视区域内
|
|
3838
3807
|
*/
|
|
3839
3808
|
adjustBoundaryPosition() {
|
|
3840
|
-
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: r, footer: o, scrollX: n, scrollY:
|
|
3809
|
+
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: r, footer: o, scrollX: n, scrollY: l } = this.ctx;
|
|
3841
3810
|
if (!e)
|
|
3842
3811
|
return;
|
|
3843
|
-
const { SCROLLER_TRACK_SIZE:
|
|
3844
|
-
let
|
|
3845
|
-
|
|
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 -
|
|
3847
|
-
u > 0 && !e.fixed ? this.ctx.setScrollX(n + u) : x > 0 && !e.fixed && this.ctx.setScrollX(n - x), y > 0 ? this.ctx.setScrollY(
|
|
3812
|
+
const { SCROLLER_TRACK_SIZE: h = 0, FOOTER_FIXED: f } = this.ctx.config;
|
|
3813
|
+
let d = 0;
|
|
3814
|
+
f && (d = o.visibleHeight);
|
|
3815
|
+
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 - d - h);
|
|
3816
|
+
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
3817
|
}
|
|
3849
3818
|
destroy() {
|
|
3850
3819
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
3851
3820
|
}
|
|
3852
3821
|
}
|
|
3853
|
-
class
|
|
3822
|
+
class hi {
|
|
3854
3823
|
constructor(t) {
|
|
3855
3824
|
c(this, "ctx");
|
|
3856
3825
|
this.ctx = t, this.init();
|
|
@@ -3858,9 +3827,9 @@ class li {
|
|
|
3858
3827
|
init() {
|
|
3859
3828
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3860
3829
|
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 =
|
|
3830
|
+
const { xArr: i, yArr: s } = this.ctx.selector, r = i[1], o = s[1], { colIndex: n, rowIndex: l, drawX: h, drawY: f, width: d, height: x } = t;
|
|
3831
|
+
if (this.ctx.config.ENABLE_AUTOFILL && n === r && l === o) {
|
|
3832
|
+
const y = h + d - 6, g = f + x - 6;
|
|
3864
3833
|
e.offsetX > y && e.offsetY > g && (this.ctx.target.style.cursor = "crosshair");
|
|
3865
3834
|
}
|
|
3866
3835
|
this.mouseenter(t);
|
|
@@ -3896,12 +3865,12 @@ class li {
|
|
|
3896
3865
|
return;
|
|
3897
3866
|
let o = t, n = e;
|
|
3898
3867
|
if (!r) {
|
|
3899
|
-
const [
|
|
3900
|
-
n = [
|
|
3868
|
+
const [l] = n;
|
|
3869
|
+
n = [l, l];
|
|
3901
3870
|
}
|
|
3902
3871
|
if (!s) {
|
|
3903
|
-
const [
|
|
3904
|
-
o = [
|
|
3872
|
+
const [l] = o;
|
|
3873
|
+
o = [l, l];
|
|
3905
3874
|
}
|
|
3906
3875
|
(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
3876
|
}
|
|
@@ -3910,22 +3879,22 @@ class li {
|
|
|
3910
3879
|
*/
|
|
3911
3880
|
autofillData() {
|
|
3912
3881
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
3913
|
-
for (let
|
|
3882
|
+
for (let d = 0; d <= e.yArr[1] - e.yArr[0]; d++)
|
|
3914
3883
|
for (let x = 0; x <= e.xArr[1] - e.xArr[0]; x++) {
|
|
3915
|
-
const u =
|
|
3884
|
+
const u = d + e.yArr[0], y = x + e.xArr[0];
|
|
3916
3885
|
i.set(`${u}-${y}`, !0);
|
|
3917
3886
|
}
|
|
3918
|
-
const { value: s } = e, r = s[0].length, o = s.length, n = this.ctx.autofill.xArr,
|
|
3919
|
-
let
|
|
3920
|
-
for (let
|
|
3887
|
+
const { value: s } = e, r = s[0].length, o = s.length, n = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr;
|
|
3888
|
+
let h = [];
|
|
3889
|
+
for (let d = 0; d <= l[1] - l[0]; d++)
|
|
3921
3890
|
for (let x = 0; x <= n[1] - n[0]; x++) {
|
|
3922
|
-
const u = x + n[0], y =
|
|
3891
|
+
const u = x + n[0], y = d + l[0], g = s[d % o][x % r], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3923
3892
|
y,
|
|
3924
3893
|
u
|
|
3925
3894
|
), p = `${y}-${u}`;
|
|
3926
3895
|
if (w && !i.has(p)) {
|
|
3927
3896
|
const { rowKey: E, key: m } = w;
|
|
3928
|
-
this.ctx.database.getReadonly(E, m) || (t.add(E),
|
|
3897
|
+
this.ctx.database.getReadonly(E, m) || (t.add(E), h.push({
|
|
3929
3898
|
rowKey: E,
|
|
3930
3899
|
key: m,
|
|
3931
3900
|
value: g,
|
|
@@ -3933,13 +3902,13 @@ class li {
|
|
|
3933
3902
|
}));
|
|
3934
3903
|
}
|
|
3935
3904
|
}
|
|
3936
|
-
if (!
|
|
3905
|
+
if (!h.length)
|
|
3937
3906
|
return;
|
|
3938
|
-
this.ctx.database.batchSetItemValue(
|
|
3939
|
-
let
|
|
3940
|
-
t.forEach((
|
|
3941
|
-
|
|
3942
|
-
}), this.ctx.emit("autofillChange",
|
|
3907
|
+
this.ctx.database.batchSetItemValue(h, !0);
|
|
3908
|
+
let f = [];
|
|
3909
|
+
t.forEach((d) => {
|
|
3910
|
+
f.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
3911
|
+
}), this.ctx.emit("autofillChange", h, f), this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr, this.ctx.emit("draw");
|
|
3943
3912
|
}
|
|
3944
3913
|
mouseenter(t) {
|
|
3945
3914
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -4063,31 +4032,31 @@ function Pt(a, t, e) {
|
|
|
4063
4032
|
reference: i,
|
|
4064
4033
|
floating: s
|
|
4065
4034
|
} = a;
|
|
4066
|
-
const r = J(t), o = Mt(t), n = Ht(o),
|
|
4035
|
+
const r = J(t), o = Mt(t), n = Ht(o), l = q(t), h = r === "y", f = i.x + i.width / 2 - s.width / 2, d = i.y + i.height / 2 - s.height / 2, x = i[n] / 2 - s[n] / 2;
|
|
4067
4036
|
let u;
|
|
4068
|
-
switch (
|
|
4037
|
+
switch (l) {
|
|
4069
4038
|
case "top":
|
|
4070
4039
|
u = {
|
|
4071
|
-
x:
|
|
4040
|
+
x: f,
|
|
4072
4041
|
y: i.y - s.height
|
|
4073
4042
|
};
|
|
4074
4043
|
break;
|
|
4075
4044
|
case "bottom":
|
|
4076
4045
|
u = {
|
|
4077
|
-
x:
|
|
4046
|
+
x: f,
|
|
4078
4047
|
y: i.y + i.height
|
|
4079
4048
|
};
|
|
4080
4049
|
break;
|
|
4081
4050
|
case "right":
|
|
4082
4051
|
u = {
|
|
4083
4052
|
x: i.x + i.width,
|
|
4084
|
-
y:
|
|
4053
|
+
y: d
|
|
4085
4054
|
};
|
|
4086
4055
|
break;
|
|
4087
4056
|
case "left":
|
|
4088
4057
|
u = {
|
|
4089
4058
|
x: i.x - s.width,
|
|
4090
|
-
y:
|
|
4059
|
+
y: d
|
|
4091
4060
|
};
|
|
4092
4061
|
break;
|
|
4093
4062
|
default:
|
|
@@ -4098,10 +4067,10 @@ function Pt(a, t, e) {
|
|
|
4098
4067
|
}
|
|
4099
4068
|
switch (ct(t)) {
|
|
4100
4069
|
case "start":
|
|
4101
|
-
u[o] -= x * (e &&
|
|
4070
|
+
u[o] -= x * (e && h ? -1 : 1);
|
|
4102
4071
|
break;
|
|
4103
4072
|
case "end":
|
|
4104
|
-
u[o] += x * (e &&
|
|
4073
|
+
u[o] += x * (e && h ? -1 : 1);
|
|
4105
4074
|
break;
|
|
4106
4075
|
}
|
|
4107
4076
|
return u;
|
|
@@ -4112,15 +4081,15 @@ const yi = async (a, t, e) => {
|
|
|
4112
4081
|
strategy: s = "absolute",
|
|
4113
4082
|
middleware: r = [],
|
|
4114
4083
|
platform: o
|
|
4115
|
-
} = e, n = r.filter(Boolean),
|
|
4116
|
-
let
|
|
4084
|
+
} = e, n = r.filter(Boolean), l = await (o.isRTL == null ? void 0 : o.isRTL(t));
|
|
4085
|
+
let h = await o.getElementRects({
|
|
4117
4086
|
reference: a,
|
|
4118
4087
|
floating: t,
|
|
4119
4088
|
strategy: s
|
|
4120
4089
|
}), {
|
|
4121
|
-
x:
|
|
4122
|
-
y:
|
|
4123
|
-
} = Pt(
|
|
4090
|
+
x: f,
|
|
4091
|
+
y: d
|
|
4092
|
+
} = Pt(h, i, l), x = i, u = {}, y = 0;
|
|
4124
4093
|
for (let g = 0; g < n.length; g++) {
|
|
4125
4094
|
const {
|
|
4126
4095
|
name: w,
|
|
@@ -4131,37 +4100,37 @@ const yi = async (a, t, e) => {
|
|
|
4131
4100
|
data: b,
|
|
4132
4101
|
reset: C
|
|
4133
4102
|
} = await p({
|
|
4134
|
-
x:
|
|
4135
|
-
y:
|
|
4103
|
+
x: f,
|
|
4104
|
+
y: d,
|
|
4136
4105
|
initialPlacement: i,
|
|
4137
4106
|
placement: x,
|
|
4138
4107
|
strategy: s,
|
|
4139
4108
|
middlewareData: u,
|
|
4140
|
-
rects:
|
|
4109
|
+
rects: h,
|
|
4141
4110
|
platform: o,
|
|
4142
4111
|
elements: {
|
|
4143
4112
|
reference: a,
|
|
4144
4113
|
floating: t
|
|
4145
4114
|
}
|
|
4146
4115
|
});
|
|
4147
|
-
|
|
4116
|
+
f = E ?? f, d = m ?? d, u = {
|
|
4148
4117
|
...u,
|
|
4149
4118
|
[w]: {
|
|
4150
4119
|
...u[w],
|
|
4151
4120
|
...b
|
|
4152
4121
|
}
|
|
4153
|
-
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (
|
|
4122
|
+
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (h = C.rects === !0 ? await o.getElementRects({
|
|
4154
4123
|
reference: a,
|
|
4155
4124
|
floating: t,
|
|
4156
4125
|
strategy: s
|
|
4157
4126
|
}) : C.rects), {
|
|
4158
|
-
x:
|
|
4159
|
-
y:
|
|
4160
|
-
} = Pt(
|
|
4127
|
+
x: f,
|
|
4128
|
+
y: d
|
|
4129
|
+
} = Pt(h, x, l)), g = -1);
|
|
4161
4130
|
}
|
|
4162
4131
|
return {
|
|
4163
|
-
x:
|
|
4164
|
-
y:
|
|
4132
|
+
x: f,
|
|
4133
|
+
y: d,
|
|
4165
4134
|
placement: x,
|
|
4166
4135
|
strategy: s,
|
|
4167
4136
|
middlewareData: u
|
|
@@ -4176,19 +4145,19 @@ async function re(a, t) {
|
|
|
4176
4145
|
platform: r,
|
|
4177
4146
|
rects: o,
|
|
4178
4147
|
elements: n,
|
|
4179
|
-
strategy:
|
|
4148
|
+
strategy: l
|
|
4180
4149
|
} = a, {
|
|
4181
|
-
boundary:
|
|
4182
|
-
rootBoundary:
|
|
4183
|
-
elementContext:
|
|
4150
|
+
boundary: h = "clippingAncestors",
|
|
4151
|
+
rootBoundary: f = "viewport",
|
|
4152
|
+
elementContext: d = "floating",
|
|
4184
4153
|
altBoundary: x = !1,
|
|
4185
4154
|
padding: u = 0
|
|
4186
|
-
} = at(t, a), y = se(u), w = n[x ?
|
|
4155
|
+
} = at(t, a), y = se(u), w = n[x ? d === "floating" ? "reference" : "floating" : d], p = ut(await r.getClippingRect({
|
|
4187
4156
|
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:
|
|
4189
|
-
rootBoundary:
|
|
4190
|
-
strategy:
|
|
4191
|
-
})), E =
|
|
4157
|
+
boundary: h,
|
|
4158
|
+
rootBoundary: f,
|
|
4159
|
+
strategy: l
|
|
4160
|
+
})), E = d === "floating" ? {
|
|
4192
4161
|
x: i,
|
|
4193
4162
|
y: s,
|
|
4194
4163
|
width: o.floating.width,
|
|
@@ -4203,7 +4172,7 @@ async function re(a, t) {
|
|
|
4203
4172
|
elements: n,
|
|
4204
4173
|
rect: E,
|
|
4205
4174
|
offsetParent: m,
|
|
4206
|
-
strategy:
|
|
4175
|
+
strategy: l
|
|
4207
4176
|
}) : E);
|
|
4208
4177
|
return {
|
|
4209
4178
|
top: (p.top - C.top + y.top) / b.y,
|
|
@@ -4223,20 +4192,20 @@ const mi = (a) => ({
|
|
|
4223
4192
|
rects: r,
|
|
4224
4193
|
platform: o,
|
|
4225
4194
|
elements: n,
|
|
4226
|
-
middlewareData:
|
|
4195
|
+
middlewareData: l
|
|
4227
4196
|
} = t, {
|
|
4228
|
-
element:
|
|
4229
|
-
padding:
|
|
4197
|
+
element: h,
|
|
4198
|
+
padding: f = 0
|
|
4230
4199
|
} = at(a, t) || {};
|
|
4231
|
-
if (
|
|
4200
|
+
if (h == null)
|
|
4232
4201
|
return {};
|
|
4233
|
-
const
|
|
4202
|
+
const d = se(f), x = {
|
|
4234
4203
|
x: e,
|
|
4235
4204
|
y: i
|
|
4236
|
-
}, u = Mt(s), y = Ht(u), g = await o.getDimensions(
|
|
4237
|
-
let
|
|
4238
|
-
(!
|
|
4239
|
-
const L = b / 2 - C / 2, A =
|
|
4205
|
+
}, 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));
|
|
4206
|
+
let T = R ? R[m] : 0;
|
|
4207
|
+
(!T || !await (o.isElement == null ? void 0 : o.isElement(R))) && (T = n.floating[m] || r.floating[y]);
|
|
4208
|
+
const L = b / 2 - C / 2, A = T / 2 - g[y] / 2 - 1, D = rt(d[p], A), B = rt(d[E], A), O = D, S = T - g[y] - B, _ = T / 2 - g[y] / 2 + L, G = Ot(O, _, S), K = !l.arrow && ct(s) != null && _ !== G && r.reference[y] / 2 - (_ < O ? D : B) - g[y] / 2 < 0, X = K ? _ < O ? _ - O : _ - S : 0;
|
|
4240
4209
|
return {
|
|
4241
4210
|
[u]: x[u] + X,
|
|
4242
4211
|
data: {
|
|
@@ -4260,11 +4229,11 @@ const mi = (a) => ({
|
|
|
4260
4229
|
middlewareData: r,
|
|
4261
4230
|
rects: o,
|
|
4262
4231
|
initialPlacement: n,
|
|
4263
|
-
platform:
|
|
4264
|
-
elements:
|
|
4232
|
+
platform: l,
|
|
4233
|
+
elements: h
|
|
4265
4234
|
} = t, {
|
|
4266
|
-
mainAxis:
|
|
4267
|
-
crossAxis:
|
|
4235
|
+
mainAxis: f = !0,
|
|
4236
|
+
crossAxis: d = !0,
|
|
4268
4237
|
fallbackPlacements: x,
|
|
4269
4238
|
fallbackStrategy: u = "bestFit",
|
|
4270
4239
|
fallbackAxisSideDirection: y = "none",
|
|
@@ -4273,11 +4242,11 @@ const mi = (a) => ({
|
|
|
4273
4242
|
} = at(a, t);
|
|
4274
4243
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4275
4244
|
return {};
|
|
4276
|
-
const p = q(s), E = J(n), m = q(n) === n, b = await (
|
|
4245
|
+
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
4246
|
!x && R && C.push(...wi(n, g, y, b));
|
|
4278
|
-
const
|
|
4247
|
+
const T = [n, ...C], L = await re(t, w), A = [];
|
|
4279
4248
|
let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
4280
|
-
if (
|
|
4249
|
+
if (f && A.push(L[p]), d) {
|
|
4281
4250
|
const _ = xi(s, o, b);
|
|
4282
4251
|
A.push(L[_[0]], L[_[1]]);
|
|
4283
4252
|
}
|
|
@@ -4286,7 +4255,7 @@ const mi = (a) => ({
|
|
|
4286
4255
|
overflows: A
|
|
4287
4256
|
}], !A.every((_) => _ <= 0)) {
|
|
4288
4257
|
var B, O;
|
|
4289
|
-
const _ = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G =
|
|
4258
|
+
const _ = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G = T[_];
|
|
4290
4259
|
if (G)
|
|
4291
4260
|
return {
|
|
4292
4261
|
data: {
|
|
@@ -4301,8 +4270,8 @@ const mi = (a) => ({
|
|
|
4301
4270
|
if (!K)
|
|
4302
4271
|
switch (u) {
|
|
4303
4272
|
case "bestFit": {
|
|
4304
|
-
var
|
|
4305
|
-
const X = (
|
|
4273
|
+
var S;
|
|
4274
|
+
const X = (S = D.filter((W) => {
|
|
4306
4275
|
if (R) {
|
|
4307
4276
|
const P = J(W.placement);
|
|
4308
4277
|
return P === E || // Create a bias to the `y` side axis due to horizontal
|
|
@@ -4310,7 +4279,7 @@ const mi = (a) => ({
|
|
|
4310
4279
|
P === "y";
|
|
4311
4280
|
}
|
|
4312
4281
|
return !0;
|
|
4313
|
-
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, we) => P + we, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 :
|
|
4282
|
+
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, we) => P + we, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 : S[0];
|
|
4314
4283
|
X && (K = X);
|
|
4315
4284
|
break;
|
|
4316
4285
|
}
|
|
@@ -4334,26 +4303,26 @@ async function bi(a, t) {
|
|
|
4334
4303
|
placement: e,
|
|
4335
4304
|
platform: i,
|
|
4336
4305
|
elements: s
|
|
4337
|
-
} = a, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), n = ct(e),
|
|
4306
|
+
} = 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, f = r && l ? -1 : 1, d = at(t, a);
|
|
4338
4307
|
let {
|
|
4339
4308
|
mainAxis: x,
|
|
4340
4309
|
crossAxis: u,
|
|
4341
4310
|
alignmentAxis: y
|
|
4342
|
-
} = typeof
|
|
4343
|
-
mainAxis:
|
|
4311
|
+
} = typeof d == "number" ? {
|
|
4312
|
+
mainAxis: d,
|
|
4344
4313
|
crossAxis: 0,
|
|
4345
4314
|
alignmentAxis: null
|
|
4346
4315
|
} : {
|
|
4347
|
-
mainAxis:
|
|
4348
|
-
crossAxis:
|
|
4349
|
-
alignmentAxis:
|
|
4316
|
+
mainAxis: d.mainAxis || 0,
|
|
4317
|
+
crossAxis: d.crossAxis || 0,
|
|
4318
|
+
alignmentAxis: d.alignmentAxis
|
|
4350
4319
|
};
|
|
4351
|
-
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y),
|
|
4352
|
-
x: u *
|
|
4353
|
-
y: x *
|
|
4320
|
+
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y), l ? {
|
|
4321
|
+
x: u * f,
|
|
4322
|
+
y: x * h
|
|
4354
4323
|
} : {
|
|
4355
|
-
x: x *
|
|
4356
|
-
y: u *
|
|
4324
|
+
x: x * h,
|
|
4325
|
+
y: u * f
|
|
4357
4326
|
};
|
|
4358
4327
|
}
|
|
4359
4328
|
const Ci = function(a) {
|
|
@@ -4367,12 +4336,12 @@ const Ci = function(a) {
|
|
|
4367
4336
|
y: r,
|
|
4368
4337
|
placement: o,
|
|
4369
4338
|
middlewareData: n
|
|
4370
|
-
} = t,
|
|
4339
|
+
} = t, l = await bi(t, a);
|
|
4371
4340
|
return o === ((e = n.offset) == null ? void 0 : e.placement) && (i = n.arrow) != null && i.alignmentOffset ? {} : {
|
|
4372
|
-
x: s +
|
|
4373
|
-
y: r +
|
|
4341
|
+
x: s + l.x,
|
|
4342
|
+
y: r + l.y,
|
|
4374
4343
|
data: {
|
|
4375
|
-
...
|
|
4344
|
+
...l,
|
|
4376
4345
|
placement: o
|
|
4377
4346
|
}
|
|
4378
4347
|
};
|
|
@@ -4402,24 +4371,24 @@ const Ci = function(a) {
|
|
|
4402
4371
|
};
|
|
4403
4372
|
}
|
|
4404
4373
|
},
|
|
4405
|
-
...
|
|
4406
|
-
} = at(a, t),
|
|
4374
|
+
...l
|
|
4375
|
+
} = at(a, t), h = {
|
|
4407
4376
|
x: e,
|
|
4408
4377
|
y: i
|
|
4409
|
-
},
|
|
4410
|
-
let u =
|
|
4378
|
+
}, f = await re(t, l), d = J(q(s)), x = ie(d);
|
|
4379
|
+
let u = h[x], y = h[d];
|
|
4411
4380
|
if (r) {
|
|
4412
|
-
const w = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", E = u +
|
|
4381
|
+
const w = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", E = u + f[w], m = u - f[p];
|
|
4413
4382
|
u = Ot(E, u, m);
|
|
4414
4383
|
}
|
|
4415
4384
|
if (o) {
|
|
4416
|
-
const w =
|
|
4385
|
+
const w = d === "y" ? "top" : "left", p = d === "y" ? "bottom" : "right", E = y + f[w], m = y - f[p];
|
|
4417
4386
|
y = Ot(E, y, m);
|
|
4418
4387
|
}
|
|
4419
4388
|
const g = n.fn({
|
|
4420
4389
|
...t,
|
|
4421
4390
|
[x]: u,
|
|
4422
|
-
[
|
|
4391
|
+
[d]: y
|
|
4423
4392
|
});
|
|
4424
4393
|
return {
|
|
4425
4394
|
...g,
|
|
@@ -4428,7 +4397,7 @@ const Ci = function(a) {
|
|
|
4428
4397
|
y: g.y - i,
|
|
4429
4398
|
enabled: {
|
|
4430
4399
|
[x]: r,
|
|
4431
|
-
[
|
|
4400
|
+
[d]: o
|
|
4432
4401
|
}
|
|
4433
4402
|
}
|
|
4434
4403
|
};
|
|
@@ -4461,7 +4430,7 @@ function N(a) {
|
|
|
4461
4430
|
function Vt(a) {
|
|
4462
4431
|
return !gt() || typeof ShadowRoot > "u" ? !1 : a instanceof ShadowRoot || a instanceof M(a).ShadowRoot;
|
|
4463
4432
|
}
|
|
4464
|
-
function
|
|
4433
|
+
function lt(a) {
|
|
4465
4434
|
const {
|
|
4466
4435
|
overflow: t,
|
|
4467
4436
|
overflowX: e,
|
|
@@ -4529,19 +4498,19 @@ function z(a) {
|
|
|
4529
4498
|
}
|
|
4530
4499
|
function ne(a) {
|
|
4531
4500
|
const t = z(a);
|
|
4532
|
-
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) &&
|
|
4501
|
+
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) && lt(t) ? t : ne(t);
|
|
4533
4502
|
}
|
|
4534
|
-
function
|
|
4503
|
+
function St(a, t, e) {
|
|
4535
4504
|
var i;
|
|
4536
4505
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4537
4506
|
const s = ne(a), r = s === ((i = a.ownerDocument) == null ? void 0 : i.body), o = M(s);
|
|
4538
4507
|
if (r) {
|
|
4539
|
-
const n =
|
|
4540
|
-
return t.concat(o, o.visualViewport || [],
|
|
4508
|
+
const n = Tt(o);
|
|
4509
|
+
return t.concat(o, o.visualViewport || [], lt(s) ? s : [], n && e ? St(n) : []);
|
|
4541
4510
|
}
|
|
4542
|
-
return t.concat(s,
|
|
4511
|
+
return t.concat(s, St(s, [], e));
|
|
4543
4512
|
}
|
|
4544
|
-
function
|
|
4513
|
+
function Tt(a) {
|
|
4545
4514
|
return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
|
|
4546
4515
|
}
|
|
4547
4516
|
function ae(a) {
|
|
@@ -4573,7 +4542,7 @@ function Z(a) {
|
|
|
4573
4542
|
};
|
|
4574
4543
|
}
|
|
4575
4544
|
const Oi = /* @__PURE__ */ V(0);
|
|
4576
|
-
function
|
|
4545
|
+
function le(a) {
|
|
4577
4546
|
const t = M(a);
|
|
4578
4547
|
return !kt() || !t.visualViewport ? Oi : {
|
|
4579
4548
|
x: t.visualViewport.offsetLeft,
|
|
@@ -4588,24 +4557,24 @@ function ot(a, t, e, i) {
|
|
|
4588
4557
|
const s = a.getBoundingClientRect(), r = ce(a);
|
|
4589
4558
|
let o = V(1);
|
|
4590
4559
|
t && (i ? k(i) && (o = Z(i)) : o = Z(a));
|
|
4591
|
-
const n = _i(r, e, i) ?
|
|
4592
|
-
let
|
|
4560
|
+
const n = _i(r, e, i) ? le(r) : V(0);
|
|
4561
|
+
let l = (s.left + n.x) / o.x, h = (s.top + n.y) / o.y, f = s.width / o.x, d = s.height / o.y;
|
|
4593
4562
|
if (r) {
|
|
4594
4563
|
const x = M(r), u = i && k(i) ? M(i) : i;
|
|
4595
|
-
let y = x, g =
|
|
4564
|
+
let y = x, g = Tt(y);
|
|
4596
4565
|
for (; g && i && u !== y; ) {
|
|
4597
4566
|
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
|
-
|
|
4567
|
+
l *= w.x, h *= w.y, f *= w.x, d *= w.y, l += m, h += b, y = M(g), g = Tt(y);
|
|
4599
4568
|
}
|
|
4600
4569
|
}
|
|
4601
4570
|
return ut({
|
|
4602
|
-
width:
|
|
4603
|
-
height:
|
|
4604
|
-
x:
|
|
4605
|
-
y:
|
|
4571
|
+
width: f,
|
|
4572
|
+
height: d,
|
|
4573
|
+
x: l,
|
|
4574
|
+
y: h
|
|
4606
4575
|
});
|
|
4607
4576
|
}
|
|
4608
|
-
function
|
|
4577
|
+
function Si(a) {
|
|
4609
4578
|
let {
|
|
4610
4579
|
elements: t,
|
|
4611
4580
|
rect: e,
|
|
@@ -4615,23 +4584,23 @@ function Ti(a) {
|
|
|
4615
4584
|
const r = s === "fixed", o = Y(i), n = t ? wt(t.floating) : !1;
|
|
4616
4585
|
if (i === o || n && r)
|
|
4617
4586
|
return e;
|
|
4618
|
-
let
|
|
4587
|
+
let l = {
|
|
4619
4588
|
scrollLeft: 0,
|
|
4620
4589
|
scrollTop: 0
|
|
4621
|
-
},
|
|
4622
|
-
const
|
|
4623
|
-
if ((
|
|
4590
|
+
}, h = V(1);
|
|
4591
|
+
const f = V(0), d = N(i);
|
|
4592
|
+
if ((d || !d && !r) && ((tt(i) !== "body" || lt(o)) && (l = pt(i)), N(i))) {
|
|
4624
4593
|
const x = ot(i);
|
|
4625
|
-
|
|
4594
|
+
h = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4626
4595
|
}
|
|
4627
4596
|
return {
|
|
4628
|
-
width: e.width *
|
|
4629
|
-
height: e.height *
|
|
4630
|
-
x: e.x *
|
|
4631
|
-
y: e.y *
|
|
4597
|
+
width: e.width * h.x,
|
|
4598
|
+
height: e.height * h.y,
|
|
4599
|
+
x: e.x * h.x - l.scrollLeft * h.x + f.x,
|
|
4600
|
+
y: e.y * h.y - l.scrollTop * h.y + f.y
|
|
4632
4601
|
};
|
|
4633
4602
|
}
|
|
4634
|
-
function
|
|
4603
|
+
function Ti(a) {
|
|
4635
4604
|
return Array.from(a.getClientRects());
|
|
4636
4605
|
}
|
|
4637
4606
|
function Lt(a, t) {
|
|
@@ -4651,26 +4620,26 @@ function Li(a) {
|
|
|
4651
4620
|
}
|
|
4652
4621
|
function Ai(a, t) {
|
|
4653
4622
|
const e = M(a), i = Y(a), s = e.visualViewport;
|
|
4654
|
-
let r = i.clientWidth, o = i.clientHeight, n = 0,
|
|
4623
|
+
let r = i.clientWidth, o = i.clientHeight, n = 0, l = 0;
|
|
4655
4624
|
if (s) {
|
|
4656
4625
|
r = s.width, o = s.height;
|
|
4657
|
-
const
|
|
4658
|
-
(!
|
|
4626
|
+
const h = kt();
|
|
4627
|
+
(!h || h && t === "fixed") && (n = s.offsetLeft, l = s.offsetTop);
|
|
4659
4628
|
}
|
|
4660
4629
|
return {
|
|
4661
4630
|
width: r,
|
|
4662
4631
|
height: o,
|
|
4663
4632
|
x: n,
|
|
4664
|
-
y:
|
|
4633
|
+
y: l
|
|
4665
4634
|
};
|
|
4666
4635
|
}
|
|
4667
4636
|
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,
|
|
4637
|
+
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
4638
|
return {
|
|
4670
4639
|
width: o,
|
|
4671
4640
|
height: n,
|
|
4672
|
-
x:
|
|
4673
|
-
y:
|
|
4641
|
+
x: l,
|
|
4642
|
+
y: h
|
|
4674
4643
|
};
|
|
4675
4644
|
}
|
|
4676
4645
|
function zt(a, t, e) {
|
|
@@ -4682,7 +4651,7 @@ function zt(a, t, e) {
|
|
|
4682
4651
|
else if (k(t))
|
|
4683
4652
|
i = Hi(t, e);
|
|
4684
4653
|
else {
|
|
4685
|
-
const s =
|
|
4654
|
+
const s = le(a);
|
|
4686
4655
|
i = {
|
|
4687
4656
|
...t,
|
|
4688
4657
|
x: t.x - s.x,
|
|
@@ -4691,20 +4660,20 @@ function zt(a, t, e) {
|
|
|
4691
4660
|
}
|
|
4692
4661
|
return ut(i);
|
|
4693
4662
|
}
|
|
4694
|
-
function
|
|
4663
|
+
function he(a, t) {
|
|
4695
4664
|
const e = z(a);
|
|
4696
|
-
return e === t || !k(e) || Q(e) ? !1 : F(e).position === "fixed" ||
|
|
4665
|
+
return e === t || !k(e) || Q(e) ? !1 : F(e).position === "fixed" || he(e, t);
|
|
4697
4666
|
}
|
|
4698
4667
|
function Mi(a, t) {
|
|
4699
4668
|
const e = t.get(a);
|
|
4700
4669
|
if (e)
|
|
4701
4670
|
return e;
|
|
4702
|
-
let i =
|
|
4671
|
+
let i = St(a, [], !1).filter((n) => k(n) && tt(n) !== "body"), s = null;
|
|
4703
4672
|
const r = F(a).position === "fixed";
|
|
4704
4673
|
let o = r ? z(a) : a;
|
|
4705
4674
|
for (; k(o) && !Q(o); ) {
|
|
4706
|
-
const n = F(o),
|
|
4707
|
-
!
|
|
4675
|
+
const n = F(o), l = Dt(o);
|
|
4676
|
+
!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((f) => f !== o) : s = n, o = z(o);
|
|
4708
4677
|
}
|
|
4709
4678
|
return t.set(a, i), i;
|
|
4710
4679
|
}
|
|
@@ -4715,15 +4684,15 @@ function Di(a) {
|
|
|
4715
4684
|
rootBoundary: i,
|
|
4716
4685
|
strategy: s
|
|
4717
4686
|
} = a;
|
|
4718
|
-
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Mi(t, this._c) : [].concat(e), i], n = o[0],
|
|
4719
|
-
const
|
|
4720
|
-
return
|
|
4687
|
+
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Mi(t, this._c) : [].concat(e), i], n = o[0], l = o.reduce((h, f) => {
|
|
4688
|
+
const d = zt(t, f, s);
|
|
4689
|
+
return h.top = U(d.top, h.top), h.right = rt(d.right, h.right), h.bottom = rt(d.bottom, h.bottom), h.left = U(d.left, h.left), h;
|
|
4721
4690
|
}, zt(t, n, s));
|
|
4722
4691
|
return {
|
|
4723
|
-
width:
|
|
4724
|
-
height:
|
|
4725
|
-
x:
|
|
4726
|
-
y:
|
|
4692
|
+
width: l.right - l.left,
|
|
4693
|
+
height: l.bottom - l.top,
|
|
4694
|
+
x: l.left,
|
|
4695
|
+
y: l.top
|
|
4727
4696
|
};
|
|
4728
4697
|
}
|
|
4729
4698
|
function ki(a) {
|
|
@@ -4742,21 +4711,21 @@ function Fi(a, t, e) {
|
|
|
4742
4711
|
scrollLeft: 0,
|
|
4743
4712
|
scrollTop: 0
|
|
4744
4713
|
};
|
|
4745
|
-
const
|
|
4714
|
+
const l = V(0);
|
|
4746
4715
|
if (i || !i && !r)
|
|
4747
|
-
if ((tt(t) !== "body" ||
|
|
4716
|
+
if ((tt(t) !== "body" || lt(s)) && (n = pt(t)), i) {
|
|
4748
4717
|
const u = ot(t, !0, r, t);
|
|
4749
|
-
|
|
4750
|
-
} else s && (
|
|
4751
|
-
let
|
|
4718
|
+
l.x = u.x + t.clientLeft, l.y = u.y + t.clientTop;
|
|
4719
|
+
} else s && (l.x = Lt(s));
|
|
4720
|
+
let h = 0, f = 0;
|
|
4752
4721
|
if (s && !i && !r) {
|
|
4753
4722
|
const u = s.getBoundingClientRect();
|
|
4754
|
-
|
|
4723
|
+
f = u.top + n.scrollTop, h = u.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
4755
4724
|
Lt(s, u);
|
|
4756
4725
|
}
|
|
4757
|
-
const
|
|
4726
|
+
const d = o.left + n.scrollLeft - l.x - h, x = o.top + n.scrollTop - l.y - f;
|
|
4758
4727
|
return {
|
|
4759
|
-
x:
|
|
4728
|
+
x: d,
|
|
4760
4729
|
y: x,
|
|
4761
4730
|
width: o.width,
|
|
4762
4731
|
height: o.height
|
|
@@ -4807,12 +4776,12 @@ function Ni(a) {
|
|
|
4807
4776
|
return F(a).direction === "rtl";
|
|
4808
4777
|
}
|
|
4809
4778
|
const Ki = {
|
|
4810
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
4779
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Si,
|
|
4811
4780
|
getDocumentElement: Y,
|
|
4812
4781
|
getClippingRect: Di,
|
|
4813
4782
|
getOffsetParent: de,
|
|
4814
4783
|
getElementRects: Xi,
|
|
4815
|
-
getClientRects:
|
|
4784
|
+
getClientRects: Ti,
|
|
4816
4785
|
getDimensions: ki,
|
|
4817
4786
|
getScale: Z,
|
|
4818
4787
|
isElement: k,
|
|
@@ -4851,7 +4820,7 @@ let Bi = class {
|
|
|
4851
4820
|
borderRadius: "4px",
|
|
4852
4821
|
fontSize: "12px",
|
|
4853
4822
|
...r
|
|
4854
|
-
},
|
|
4823
|
+
}, l = {
|
|
4855
4824
|
position: "absolute",
|
|
4856
4825
|
width: "10px",
|
|
4857
4826
|
height: "10px",
|
|
@@ -4860,7 +4829,7 @@ let Bi = class {
|
|
|
4860
4829
|
transform: "rotate(45deg)",
|
|
4861
4830
|
zIndex: n.zIndex
|
|
4862
4831
|
};
|
|
4863
|
-
Object.assign(this.arrowEl.style,
|
|
4832
|
+
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
4833
|
}
|
|
4865
4834
|
init() {
|
|
4866
4835
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -4902,28 +4871,28 @@ let Bi = class {
|
|
|
4902
4871
|
placement: t.overflowTooltipPlacement,
|
|
4903
4872
|
middleware: [xe(), ue(), fe(6), Yi({ element: this.arrowEl })]
|
|
4904
4873
|
}).then((n) => {
|
|
4905
|
-
const { x:
|
|
4874
|
+
const { x: l, y: h, placement: f, middlewareData: d } = n;
|
|
4906
4875
|
if (Object.assign(this.floatingEl.style, {
|
|
4907
|
-
top: `${
|
|
4908
|
-
left: `${
|
|
4909
|
-
}),
|
|
4910
|
-
const x =
|
|
4911
|
-
["left", "left-start", "left-end"].includes(
|
|
4876
|
+
top: `${h}px`,
|
|
4877
|
+
left: `${l}px`
|
|
4878
|
+
}), d.arrow) {
|
|
4879
|
+
const x = d.arrow;
|
|
4880
|
+
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
4912
4881
|
top: `${x.y}px`,
|
|
4913
4882
|
bottom: "",
|
|
4914
4883
|
left: "",
|
|
4915
4884
|
right: "-5px"
|
|
4916
|
-
}) : ["right", "right-start", "right-end"].includes(
|
|
4885
|
+
}) : ["right", "right-start", "right-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
4917
4886
|
top: `${x.y}px`,
|
|
4918
4887
|
bottom: "",
|
|
4919
4888
|
left: "-5px",
|
|
4920
4889
|
right: ""
|
|
4921
|
-
}) : ["bottom", "bottom-start", "bottom-end"].includes(
|
|
4890
|
+
}) : ["bottom", "bottom-start", "bottom-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
4922
4891
|
top: "-5px",
|
|
4923
4892
|
bottom: "",
|
|
4924
4893
|
left: `${x.x}px`,
|
|
4925
4894
|
right: ""
|
|
4926
|
-
}) : ["top", "top-start", "top-end"].includes(
|
|
4895
|
+
}) : ["top", "top-start", "top-end"].includes(f) && Object.assign(this.arrowEl.style, {
|
|
4927
4896
|
top: "",
|
|
4928
4897
|
bottom: "-5px",
|
|
4929
4898
|
left: `${x.x}px`,
|
|
@@ -4995,13 +4964,25 @@ class Wi {
|
|
|
4995
4964
|
});
|
|
4996
4965
|
}
|
|
4997
4966
|
initTextEditor() {
|
|
4998
|
-
const { CSS_PREFIX: t, SELECT_BORDER_COLOR: e
|
|
4999
|
-
this.inputEl = document.createElement("div"), this.inputEl.addEventListener("keydown", (
|
|
5000
|
-
|
|
4967
|
+
const { CSS_PREFIX: t, SELECT_BORDER_COLOR: e } = this.ctx.config;
|
|
4968
|
+
this.inputEl = document.createElement("div"), this.inputEl.addEventListener("keydown", (o) => {
|
|
4969
|
+
if (this.enable) {
|
|
4970
|
+
if ((o.altKey || o.metaKey) && o.code === "Enter") {
|
|
4971
|
+
o.preventDefault();
|
|
4972
|
+
const n = this.inputEl.textContent;
|
|
4973
|
+
this.inputEl.textContent = `${n}
|
|
4974
|
+
|
|
4975
|
+
`;
|
|
4976
|
+
const l = window.getSelection();
|
|
4977
|
+
l == null || l.selectAllChildren(this.inputEl), l == null || l.collapseToEnd();
|
|
4978
|
+
return;
|
|
4979
|
+
}
|
|
4980
|
+
(o.code === "Escape" || o.code === "Enter") && (o.preventDefault(), this.inputEl.blur());
|
|
4981
|
+
}
|
|
5001
4982
|
}), this.inputEl.addEventListener("blur", () => {
|
|
5002
4983
|
this.doneEdit();
|
|
5003
4984
|
}), this.editorEl = document.createElement("div"), this.editorEl.className = `${t}-self-editor`, this.inputEl.className = `${t}-self-editor-input`;
|
|
5004
|
-
const
|
|
4985
|
+
const i = {
|
|
5005
4986
|
position: "absolute",
|
|
5006
4987
|
top: "-10000px",
|
|
5007
4988
|
left: "-10000px",
|
|
@@ -5017,8 +4998,8 @@ class Wi {
|
|
|
5017
4998
|
display: "flex",
|
|
5018
4999
|
alignItems: "center"
|
|
5019
5000
|
};
|
|
5020
|
-
Object.assign(this.editorEl.style,
|
|
5021
|
-
const
|
|
5001
|
+
Object.assign(this.editorEl.style, i);
|
|
5002
|
+
const s = {
|
|
5022
5003
|
width: "100%",
|
|
5023
5004
|
boxSizing: "border-box",
|
|
5024
5005
|
padding: "8px",
|
|
@@ -5034,17 +5015,17 @@ class Wi {
|
|
|
5034
5015
|
background: "#fff",
|
|
5035
5016
|
cursor: "text"
|
|
5036
5017
|
};
|
|
5037
|
-
Object.assign(this.inputEl.style,
|
|
5038
|
-
const
|
|
5039
|
-
this.inputEl.contentEditable =
|
|
5018
|
+
Object.assign(this.inputEl.style, s);
|
|
5019
|
+
const r = navigator.userAgent.toLowerCase().includes("firefox");
|
|
5020
|
+
this.inputEl.contentEditable = r ? "true" : "plaintext-only", this.editorEl.appendChild(this.inputEl), this.ctx.targetContainer.appendChild(this.editorEl);
|
|
5040
5021
|
}
|
|
5041
5022
|
startEditByInput(t) {
|
|
5042
5023
|
if (t.editorType !== "text")
|
|
5043
5024
|
return;
|
|
5044
5025
|
const e = t.getValue(), { width: i, height: s } = t, r = t.getDrawX(), o = t.getDrawY(), { CELL_PADDING: n } = this.ctx.config;
|
|
5045
5026
|
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
|
-
|
|
5027
|
+
const l = window.getSelection();
|
|
5028
|
+
l == null || l.selectAllChildren(this.inputEl), l == null || l.collapseToEnd();
|
|
5048
5029
|
}
|
|
5049
5030
|
doneEditByInput() {
|
|
5050
5031
|
if (!this.cellTarget || this.cellTarget.editorType !== "text")
|
|
@@ -5063,18 +5044,18 @@ class Wi {
|
|
|
5063
5044
|
e && !r && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = e, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5064
5045
|
}
|
|
5065
5046
|
editCell(t, e) {
|
|
5066
|
-
const i = this.ctx.body.renderRows.find((
|
|
5047
|
+
const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
|
|
5067
5048
|
if (!i)
|
|
5068
5049
|
return;
|
|
5069
|
-
const s = i.cells.find((
|
|
5050
|
+
const s = i.cells.find((h) => h.colIndex === e);
|
|
5070
5051
|
if (!s)
|
|
5071
5052
|
return;
|
|
5072
5053
|
this.ctx.emit("setSelectorCell", s);
|
|
5073
5054
|
const r = this.ctx.focusCell;
|
|
5074
5055
|
if (!r || ["index", "index-selection", "selection"].includes(r.type) || this.enable)
|
|
5075
5056
|
return;
|
|
5076
|
-
const { rowKey: o, key: n } = r,
|
|
5077
|
-
r && !
|
|
5057
|
+
const { rowKey: o, key: n } = r, l = this.ctx.database.getReadonly(o, n);
|
|
5058
|
+
r && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5078
5059
|
}
|
|
5079
5060
|
doneEdit() {
|
|
5080
5061
|
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,20 +5069,20 @@ class Pi {
|
|
|
5088
5069
|
c(this, "emptyEl");
|
|
5089
5070
|
this.ctx = t;
|
|
5090
5071
|
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:
|
|
5072
|
+
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
5073
|
if (i)
|
|
5093
5074
|
return;
|
|
5094
|
-
const
|
|
5075
|
+
const f = n + (l + h) / 2, d = {
|
|
5095
5076
|
display: o === "empty" ? "block" : "none",
|
|
5096
5077
|
position: "absolute",
|
|
5097
5078
|
fontSize: "14px",
|
|
5098
5079
|
color: "#666",
|
|
5099
5080
|
left: "50%",
|
|
5100
|
-
top: `${
|
|
5081
|
+
top: `${f}px`,
|
|
5101
5082
|
transform: "translate(-50%, -50%)",
|
|
5102
5083
|
...s
|
|
5103
5084
|
};
|
|
5104
|
-
Object.assign(this.emptyEl.style,
|
|
5085
|
+
Object.assign(this.emptyEl.style, d);
|
|
5105
5086
|
});
|
|
5106
5087
|
}
|
|
5107
5088
|
destroy() {
|
|
@@ -5128,9 +5109,9 @@ class Vi {
|
|
|
5128
5109
|
target: t,
|
|
5129
5110
|
config: { SCROLLER_TRACK_SIZE: e }
|
|
5130
5111
|
} = 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
|
|
5112
|
+
let l = [r, o, n];
|
|
5113
|
+
const { FOOTER_FIXED: h } = this.ctx.config;
|
|
5114
|
+
return h || (l = [r, o]), {
|
|
5134
5115
|
style: {
|
|
5135
5116
|
position: "absolute",
|
|
5136
5117
|
left: "0px",
|
|
@@ -5140,7 +5121,7 @@ class Vi {
|
|
|
5140
5121
|
width: `${i}px`,
|
|
5141
5122
|
height: `${s}px`
|
|
5142
5123
|
},
|
|
5143
|
-
views:
|
|
5124
|
+
views: l
|
|
5144
5125
|
};
|
|
5145
5126
|
}
|
|
5146
5127
|
getHeader() {
|
|
@@ -5149,11 +5130,11 @@ class Vi {
|
|
|
5149
5130
|
fixedRightWidth: e,
|
|
5150
5131
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5151
5132
|
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders: n } = this.ctx.header;
|
|
5152
|
-
let
|
|
5133
|
+
let l = [], h = [], f = [];
|
|
5153
5134
|
n.forEach((w) => {
|
|
5154
|
-
w.render && (w.fixed === "left" ?
|
|
5135
|
+
w.render && (w.fixed === "left" ? h.push(w) : w.fixed === "right" ? f.push(w) : l.push(w));
|
|
5155
5136
|
});
|
|
5156
|
-
const
|
|
5137
|
+
const d = e - i, x = {
|
|
5157
5138
|
key: "left",
|
|
5158
5139
|
style: {
|
|
5159
5140
|
position: "absolute",
|
|
@@ -5163,7 +5144,7 @@ class Vi {
|
|
|
5163
5144
|
width: `${t}px`,
|
|
5164
5145
|
height: `${o}px`
|
|
5165
5146
|
},
|
|
5166
|
-
cells:
|
|
5147
|
+
cells: h
|
|
5167
5148
|
}, u = {
|
|
5168
5149
|
key: "center",
|
|
5169
5150
|
style: {
|
|
@@ -5171,10 +5152,10 @@ class Vi {
|
|
|
5171
5152
|
top: `${0.5}px`,
|
|
5172
5153
|
left: `${t}px`,
|
|
5173
5154
|
overflow: "hidden",
|
|
5174
|
-
width: `${r - t -
|
|
5155
|
+
width: `${r - t - d}px`,
|
|
5175
5156
|
height: `${o}px`
|
|
5176
5157
|
},
|
|
5177
|
-
cells:
|
|
5158
|
+
cells: l
|
|
5178
5159
|
}, y = {
|
|
5179
5160
|
key: "right",
|
|
5180
5161
|
style: {
|
|
@@ -5182,10 +5163,10 @@ class Vi {
|
|
|
5182
5163
|
top: `${0.5}px`,
|
|
5183
5164
|
right: `${0.5}px`,
|
|
5184
5165
|
overflow: "hidden",
|
|
5185
|
-
width: `${
|
|
5166
|
+
width: `${d}px`,
|
|
5186
5167
|
height: `${o}px`
|
|
5187
5168
|
},
|
|
5188
|
-
cells:
|
|
5169
|
+
cells: f
|
|
5189
5170
|
};
|
|
5190
5171
|
return {
|
|
5191
5172
|
type: "header",
|
|
@@ -5210,8 +5191,8 @@ class Vi {
|
|
|
5210
5191
|
const {
|
|
5211
5192
|
fixedLeftWidth: r,
|
|
5212
5193
|
fixedRightWidth: o,
|
|
5213
|
-
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX:
|
|
5214
|
-
} = this.ctx, { visibleWidth:
|
|
5194
|
+
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX: l }
|
|
5195
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: f } = this.ctx.body, d = o - n, x = {
|
|
5215
5196
|
key: "left",
|
|
5216
5197
|
style: {
|
|
5217
5198
|
position: "absolute",
|
|
@@ -5219,7 +5200,7 @@ class Vi {
|
|
|
5219
5200
|
left: `${0.5}px`,
|
|
5220
5201
|
overflow: "hidden",
|
|
5221
5202
|
width: `${r}px`,
|
|
5222
|
-
height: `${
|
|
5203
|
+
height: `${f}px`
|
|
5223
5204
|
},
|
|
5224
5205
|
cells: e
|
|
5225
5206
|
}, u = {
|
|
@@ -5229,8 +5210,8 @@ class Vi {
|
|
|
5229
5210
|
top: `${0.5}px`,
|
|
5230
5211
|
left: `${r + 0.5}px`,
|
|
5231
5212
|
overflow: "hidden",
|
|
5232
|
-
width: `${
|
|
5233
|
-
height: `${
|
|
5213
|
+
width: `${h - r - d}px`,
|
|
5214
|
+
height: `${f}px`
|
|
5234
5215
|
},
|
|
5235
5216
|
cells: t
|
|
5236
5217
|
}, y = {
|
|
@@ -5240,19 +5221,19 @@ class Vi {
|
|
|
5240
5221
|
top: "0px",
|
|
5241
5222
|
right: "0px",
|
|
5242
5223
|
overflow: "hidden",
|
|
5243
|
-
width: `${
|
|
5244
|
-
height: `${
|
|
5224
|
+
width: `${d}px`,
|
|
5225
|
+
height: `${f}px`
|
|
5245
5226
|
},
|
|
5246
5227
|
cells: i
|
|
5247
5228
|
};
|
|
5248
5229
|
return {
|
|
5249
5230
|
type: "body",
|
|
5250
|
-
class: `${
|
|
5231
|
+
class: `${l}-overlayer-body`,
|
|
5251
5232
|
style: {
|
|
5252
5233
|
position: "relative",
|
|
5253
5234
|
overflow: "hidden",
|
|
5254
|
-
width: `${
|
|
5255
|
-
height: `${
|
|
5235
|
+
width: `${h}px`,
|
|
5236
|
+
height: `${f}px`
|
|
5256
5237
|
},
|
|
5257
5238
|
views: [x, u, y]
|
|
5258
5239
|
};
|
|
@@ -5268,7 +5249,7 @@ class Vi {
|
|
|
5268
5249
|
fixedLeftWidth: s,
|
|
5269
5250
|
fixedRightWidth: r,
|
|
5270
5251
|
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX: n }
|
|
5271
|
-
} = this.ctx, { visibleWidth:
|
|
5252
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, f = r - o, d = {
|
|
5272
5253
|
key: "left",
|
|
5273
5254
|
style: {
|
|
5274
5255
|
position: "absolute",
|
|
@@ -5276,7 +5257,7 @@ class Vi {
|
|
|
5276
5257
|
left: `${0.5}px`,
|
|
5277
5258
|
overflow: "hidden",
|
|
5278
5259
|
width: `${s}px`,
|
|
5279
|
-
height: `${
|
|
5260
|
+
height: `${h}px`
|
|
5280
5261
|
},
|
|
5281
5262
|
cells: e
|
|
5282
5263
|
}, x = {
|
|
@@ -5286,8 +5267,8 @@ class Vi {
|
|
|
5286
5267
|
top: `${0.5}px`,
|
|
5287
5268
|
left: `${s + 0.5}px`,
|
|
5288
5269
|
overflow: "hidden",
|
|
5289
|
-
width: `${
|
|
5290
|
-
height: `${
|
|
5270
|
+
width: `${l - s - f}px`,
|
|
5271
|
+
height: `${h}px`
|
|
5291
5272
|
},
|
|
5292
5273
|
cells: t
|
|
5293
5274
|
}, u = {
|
|
@@ -5297,8 +5278,8 @@ class Vi {
|
|
|
5297
5278
|
top: `${0.5}px`,
|
|
5298
5279
|
right: `${0.5}px`,
|
|
5299
5280
|
overflow: "hidden",
|
|
5300
|
-
width: `${
|
|
5301
|
-
height: `${
|
|
5281
|
+
width: `${f}px`,
|
|
5282
|
+
height: `${h}px`
|
|
5302
5283
|
},
|
|
5303
5284
|
cells: i
|
|
5304
5285
|
};
|
|
@@ -5308,10 +5289,10 @@ class Vi {
|
|
|
5308
5289
|
style: {
|
|
5309
5290
|
position: "relative",
|
|
5310
5291
|
overflow: "hidden",
|
|
5311
|
-
width: `${
|
|
5312
|
-
height: `${
|
|
5292
|
+
width: `${l}px`,
|
|
5293
|
+
height: `${h}px`
|
|
5313
5294
|
},
|
|
5314
|
-
views: [
|
|
5295
|
+
views: [d, x, u]
|
|
5315
5296
|
};
|
|
5316
5297
|
}
|
|
5317
5298
|
}
|
|
@@ -5325,8 +5306,8 @@ class zi {
|
|
|
5325
5306
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5326
5307
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5327
5308
|
e.preventDefault();
|
|
5328
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [n,
|
|
5329
|
-
|
|
5309
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [n, l] = s, { rowIndex: h, colIndex: f } = t;
|
|
5310
|
+
h >= n && h <= l && f >= r && f <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
5330
5311
|
const x = {
|
|
5331
5312
|
getBoundingClientRect: () => ({
|
|
5332
5313
|
width: 0,
|
|
@@ -5415,7 +5396,7 @@ class Gi {
|
|
|
5415
5396
|
c(this, "overlayer");
|
|
5416
5397
|
c(this, "contextMenu");
|
|
5417
5398
|
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
|
|
5399
|
+
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
5400
|
}
|
|
5420
5401
|
draw() {
|
|
5421
5402
|
requestAnimationFrame(() => {
|
|
@@ -5423,13 +5404,13 @@ class Gi {
|
|
|
5423
5404
|
});
|
|
5424
5405
|
}
|
|
5425
5406
|
loadConfig(t) {
|
|
5426
|
-
this.ctx.config.init(t), this.ctx.database.init(), this.contextMenu.updated(), this.ctx.emit("draw");
|
|
5407
|
+
this.ctx.config.init(t), this.ctx.database.init(), this.header.init(), this.contextMenu.updated(), this.ctx.emit("draw");
|
|
5427
5408
|
}
|
|
5428
5409
|
loadColumns(t) {
|
|
5429
5410
|
this.editor.doneEdit(), this.ctx.database.setColumns(t), this.header.init(), this.ctx.emit("draw");
|
|
5430
5411
|
}
|
|
5431
5412
|
loadData(t) {
|
|
5432
|
-
this.editor.doneEdit(), this.ctx.database.setData(t), this.ctx.emit("draw");
|
|
5413
|
+
this.editor.doneEdit(), this.ctx.database.setData(t), this.header.init(), this.ctx.emit("draw");
|
|
5433
5414
|
}
|
|
5434
5415
|
loadFooterData(t) {
|
|
5435
5416
|
this.ctx.database.setFooterData(t), this.ctx.emit("draw");
|
|
@@ -5479,8 +5460,8 @@ class Gi {
|
|
|
5479
5460
|
if (t && Array.isArray(s) && s.length) {
|
|
5480
5461
|
const [r] = s;
|
|
5481
5462
|
if (Array.isArray(r) && r.length) {
|
|
5482
|
-
const [o] = r, { rowKey: n, key:
|
|
5483
|
-
this.scrollToRowkey(n), this.scrollToColkey(
|
|
5463
|
+
const [o] = r, { rowKey: n, key: l } = o;
|
|
5464
|
+
this.scrollToRowkey(n), this.scrollToColkey(l);
|
|
5484
5465
|
}
|
|
5485
5466
|
}
|
|
5486
5467
|
i(s);
|
|
@@ -5505,8 +5486,8 @@ class Gi {
|
|
|
5505
5486
|
let r = [];
|
|
5506
5487
|
for (let o = 0; o < i.length; o++)
|
|
5507
5488
|
for (let n = 0; n < s.length; n++) {
|
|
5508
|
-
const
|
|
5509
|
-
Array.isArray(
|
|
5489
|
+
const l = this.ctx.database.getRowKeyByItem(i[o]), f = s[n].key, d = await this.ctx.database.getValidator(l, f);
|
|
5490
|
+
Array.isArray(d) && d.length && r.push(d);
|
|
5510
5491
|
}
|
|
5511
5492
|
r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
5512
5493
|
});
|