@ninebone/table 0.0.770 → 0.0.771
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/nine-table.js +112 -111
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +5 -5
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -53,12 +53,12 @@ const Ke = class Ke extends HTMLElement {
|
|
|
53
53
|
}
|
|
54
54
|
const l = r.clientWidth;
|
|
55
55
|
if (l <= 0) return;
|
|
56
|
-
const
|
|
57
|
-
o.style.width = `${
|
|
58
|
-
const
|
|
56
|
+
const u = Math.max(Math.min(l * (a / c), l), 20);
|
|
57
|
+
o.style.width = `${u}px`;
|
|
58
|
+
const f = e.scrollLeft, b = c - a;
|
|
59
59
|
let g = 0;
|
|
60
|
-
b > 0 && (g = parseInt(
|
|
61
|
-
const y = l -
|
|
60
|
+
b > 0 && (g = parseInt(f / b * (l - u), 10)), g < 0 && (g = 0);
|
|
61
|
+
const y = l - u;
|
|
62
62
|
g > y && (g = y), o.style.left = `${g}px`, t(this, E).left.disabled = g === 0, t(this, E).right.disabled = g >= y - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
d(this, nt, /* @__PURE__ */ h((e) => {
|
|
@@ -70,8 +70,8 @@ const Ke = class Ke extends HTMLElement {
|
|
|
70
70
|
a < 0 && (a = 0);
|
|
71
71
|
const c = o.width - i;
|
|
72
72
|
a > c && (a = c), a = parseInt(a, 10), t(this, E).thumb.style.left = `${a}px`, t(this, E).left.disabled = a === 0, t(this, E).right.disabled = a >= c - 1;
|
|
73
|
-
const l = n.clientWidth,
|
|
74
|
-
return c > 0 &&
|
|
73
|
+
const l = n.clientWidth, f = r.scrollWidth - l;
|
|
74
|
+
return c > 0 && f > 0 && (n.scrollLeft = a / c * f), a > 0 && a < c - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
d(this, Vt, /* @__PURE__ */ h(() => {
|
|
77
77
|
const e = /* @__PURE__ */ h((r) => {
|
|
@@ -221,14 +221,14 @@ const Ge = class Ge extends HTMLElement {
|
|
|
221
221
|
this.style.display = "flex";
|
|
222
222
|
const l = n.clientHeight;
|
|
223
223
|
if (l <= 0) return;
|
|
224
|
-
const
|
|
225
|
-
r.style.height = `${
|
|
226
|
-
const
|
|
227
|
-
S.log(e,
|
|
224
|
+
const u = Math.max(Math.min(l * (o / c), l), 20);
|
|
225
|
+
r.style.height = `${u}px`;
|
|
226
|
+
const f = e.scrollTop, b = Math.max(c - o, 1);
|
|
227
|
+
S.log(e, f, b);
|
|
228
228
|
let g = 0;
|
|
229
|
-
b > 0 && (g =
|
|
230
|
-
const y = l -
|
|
231
|
-
g < 0 && (g = 0), g > y && (g = y), r.style.top = `${g}px`, t(this, k).top.disabled =
|
|
229
|
+
b > 0 && (g = f / b * (l - u));
|
|
230
|
+
const y = l - u;
|
|
231
|
+
g < 0 && (g = 0), g > y && (g = y), r.style.top = `${g}px`, t(this, k).top.disabled = f <= 0, t(this, k).bottom.disabled = f >= b - 1;
|
|
232
232
|
}, "refresh"));
|
|
233
233
|
d(this, Ut, /* @__PURE__ */ h(() => {
|
|
234
234
|
S.log("nine-table-vscrollbar.#init");
|
|
@@ -241,9 +241,9 @@ const Ge = class Ge extends HTMLElement {
|
|
|
241
241
|
r.stopPropagation(), r.preventDefault(), p(this, bt, !0), p(this, Tt, r.clientY), p(this, Ct, e.scrollTop);
|
|
242
242
|
const o = /* @__PURE__ */ h((a) => {
|
|
243
243
|
if (!t(this, bt)) return;
|
|
244
|
-
const c = t(this, k).track.getBoundingClientRect(), l = t(this, k).thumb.clientHeight,
|
|
245
|
-
if (
|
|
246
|
-
const v = b /
|
|
244
|
+
const c = t(this, k).track.getBoundingClientRect(), l = t(this, k).thumb.clientHeight, f = c.height - l, b = a.clientY - t(this, Tt), g = e.clientHeight, y = n(), w = Math.max(y - g, 1);
|
|
245
|
+
if (f > 0 && w > 0) {
|
|
246
|
+
const v = b / f * w;
|
|
247
247
|
let m = t(this, Ct) + v;
|
|
248
248
|
const C = Math.max(0, y - g);
|
|
249
249
|
m < 0 && (m = 0), m > C && (m = C), e.scrollTop = m;
|
|
@@ -255,7 +255,7 @@ const Ge = class Ge extends HTMLElement {
|
|
|
255
255
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", i);
|
|
256
256
|
}), t(this, k).track.addEventListener("mousedown", (r) => {
|
|
257
257
|
if (r.button !== 0 || r.target === t(this, k).thumb) return;
|
|
258
|
-
const o = t(this, k).track.getBoundingClientRect(), i = t(this, k).thumb.clientHeight, a = r.clientY - o.top - i / 2, l = o.height - i,
|
|
258
|
+
const o = t(this, k).track.getBoundingClientRect(), i = t(this, k).thumb.clientHeight, a = r.clientY - o.top - i / 2, l = o.height - i, u = e.clientHeight, f = n(), b = Math.max(f - u, 1);
|
|
259
259
|
if (l > 0 && b > 0) {
|
|
260
260
|
const g = Math.max(0, Math.min(1, a / l));
|
|
261
261
|
e.scrollTop = g * b;
|
|
@@ -385,19 +385,19 @@ const Ze = class Ze {
|
|
|
385
385
|
if (!c) return;
|
|
386
386
|
const l = c.querySelector("tbody.bindable-tbody");
|
|
387
387
|
if (!l) return;
|
|
388
|
-
const
|
|
389
|
-
t(this, P).set(i,
|
|
388
|
+
const f = Array.from(l.querySelectorAll("tr")).map((b) => b.cloneNode(!0));
|
|
389
|
+
t(this, P).set(i, f);
|
|
390
390
|
});
|
|
391
391
|
const s = t(this, R).querySelector(".ng-container-body .ng-part-body"), e = t(this, R).querySelector(".ng-container-left .ng-part-body"), n = t(this, R).querySelector(".ng-container-right .ng-part-body"), r = t(this, R).querySelector(".ng-container-body .ng-part-header"), o = t(this, R).querySelector(".ng-container-body .ng-part-footer");
|
|
392
392
|
if (s) {
|
|
393
393
|
t(this, Lt).call(this), t(this, $t).call(this), t(this, It).call(this), t(this, pt).call(this, s.scrollTop);
|
|
394
394
|
let i = !1;
|
|
395
395
|
const a = /* @__PURE__ */ h((c) => {
|
|
396
|
-
var
|
|
396
|
+
var f;
|
|
397
397
|
if (i) return;
|
|
398
398
|
i = !0;
|
|
399
|
-
const l = c.scrollTop,
|
|
400
|
-
s && s.scrollTop !== l && (s.scrollTop = l), e && e.scrollTop !== l && (e.scrollTop = l), n && n.scrollTop !== l && (n.scrollTop = l), r && r.scrollLeft !==
|
|
399
|
+
const l = c.scrollTop, u = c.scrollLeft;
|
|
400
|
+
s && s.scrollTop !== l && (s.scrollTop = l), e && e.scrollTop !== l && (e.scrollTop = l), n && n.scrollTop !== l && (n.scrollTop = l), r && r.scrollLeft !== u && (r.scrollLeft = u), o && o.scrollLeft !== u && (o.scrollLeft = u), t(this, pt).call(this, l), (f = t(this, R).querySelector("nine-table-vscrollbar")) == null || f.refresh(), i = !1;
|
|
401
401
|
}, "handleContainerScroll");
|
|
402
402
|
[s, e, n].forEach((c) => {
|
|
403
403
|
c == null || c.addEventListener("scroll", (l) => {
|
|
@@ -436,16 +436,16 @@ const Ze = class Ze {
|
|
|
436
436
|
}), r ? r.before(o) : n.appendChild(o);
|
|
437
437
|
const i = t(this, R), a = i.style.display, c = i.style.visibility, l = i.style.position;
|
|
438
438
|
(a === "none" || window.getComputedStyle(i).display === "none") && (i.style.display = "block", i.style.visibility = "hidden", i.style.position = "absolute");
|
|
439
|
-
let
|
|
440
|
-
const
|
|
441
|
-
return
|
|
439
|
+
let u = 0;
|
|
440
|
+
const f = n.querySelectorAll("tr");
|
|
441
|
+
return f.forEach((b) => {
|
|
442
442
|
let g = b.offsetHeight || b.getBoundingClientRect().height;
|
|
443
443
|
if (g === 0) {
|
|
444
444
|
const y = window.getComputedStyle(b);
|
|
445
445
|
g = parseFloat(y.height) || parseFloat(y.minHeight) || 0;
|
|
446
446
|
}
|
|
447
|
-
|
|
448
|
-
}),
|
|
447
|
+
u += g;
|
|
448
|
+
}), f.forEach((b) => b.remove()), i.style.display = a, i.style.visibility = c, i.style.position = l, u <= 0 ? -1 : (p(this, D, u), t(this, Ht).call(this), t(this, D));
|
|
449
449
|
}, "#measureAndCacheHeight"));
|
|
450
450
|
d(this, It, /* @__PURE__ */ h(() => {
|
|
451
451
|
S.log("rowManager.#updateVirtualScrollHeight");
|
|
@@ -464,7 +464,7 @@ const Ze = class Ze {
|
|
|
464
464
|
}
|
|
465
465
|
}, "#updateRowCount"));
|
|
466
466
|
d(this, Gt, /* @__PURE__ */ h(() => {
|
|
467
|
-
var a, c, l,
|
|
467
|
+
var a, c, l, u, f, b;
|
|
468
468
|
const s = t(this, R).querySelector(".ng-container-left .ng-part-body table"), e = t(this, R).querySelector(".ng-container-body .ng-part-body table"), n = t(this, R).querySelector(".ng-container-right .ng-part-body table");
|
|
469
469
|
if (e) {
|
|
470
470
|
const g = s ? Array.from(s.querySelectorAll("tbody tr")) : [], y = Array.from(e.querySelectorAll("tbody tr")), w = n ? Array.from(n.querySelectorAll("tbody tr")) : [], v = Math.max(g.length, y.length, w.length);
|
|
@@ -482,8 +482,8 @@ const Ze = class Ze {
|
|
|
482
482
|
const g = r ? Array.from(r.querySelectorAll("tfoot tr")) : [], y = Array.from(o.querySelectorAll("tfoot tr")), w = i ? Array.from(i.querySelectorAll("tfoot tr")) : [], v = Math.max(g.length, y.length, w.length);
|
|
483
483
|
for (let m = 0; m < v; m++) {
|
|
484
484
|
const C = [
|
|
485
|
-
((
|
|
486
|
-
((
|
|
485
|
+
((u = g[m]) == null ? void 0 : u.getBoundingClientRect().height) || 0,
|
|
486
|
+
((f = y[m]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
487
487
|
((b = w[m]) == null ? void 0 : b.getBoundingClientRect().height) || 0
|
|
488
488
|
], A = Math.max(...C);
|
|
489
489
|
A > 0 && (g[m] && (g[m].style.height = `${A}px`), y[m] && (y[m].style.height = `${A}px`), w[m] && (w[m].style.height = `${A}px`));
|
|
@@ -520,32 +520,32 @@ const Ze = class Ze {
|
|
|
520
520
|
const r = n.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
521
521
|
if (!r) return;
|
|
522
522
|
const o = Array.from(r.querySelectorAll("tr:not(.nodata)")), i = ((l = t(this, P).get(e)) == null ? void 0 : l.length) || 1, c = (t(this, j).data.get() || []).length;
|
|
523
|
-
o.forEach((
|
|
524
|
-
const b = s + Math.floor(
|
|
523
|
+
o.forEach((u, f) => {
|
|
524
|
+
const b = s + Math.floor(f / i);
|
|
525
525
|
if (b >= c) {
|
|
526
|
-
|
|
526
|
+
u.style.visibility = "hidden";
|
|
527
527
|
return;
|
|
528
528
|
}
|
|
529
529
|
const g = t(this, j).data.get(b);
|
|
530
|
-
|
|
530
|
+
u.style.display = "", t(this, Mt).call(this, u, g, b);
|
|
531
531
|
});
|
|
532
532
|
});
|
|
533
533
|
}, "#adjustBufferRows"));
|
|
534
534
|
d(this, pt, /* @__PURE__ */ h((s) => {
|
|
535
|
-
var
|
|
535
|
+
var f, b;
|
|
536
536
|
const e = t(this, D);
|
|
537
537
|
if (!e || e <= 0) return;
|
|
538
538
|
const n = t(this, j).data.length;
|
|
539
539
|
if (n === 0) return;
|
|
540
|
-
const r = ((
|
|
540
|
+
const r = ((f = t(this, P).get(".ng-container-body")) == null ? void 0 : f.length) || 1, o = t(this, R).querySelector(".ng-container-body .ng-part-body");
|
|
541
541
|
S.log("bodyContainer.clientHeight", o.clientHeight);
|
|
542
542
|
const i = Math.max(0, n - Math.floor(o.clientHeight / e)), a = Math.min(i, Math.max(0, Math.floor(s / e)));
|
|
543
543
|
let c = Math.floor(a * e);
|
|
544
544
|
S.log(`📜 [Scroll Calc] maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`), a === i && S.log(`📜 [Scroll Inspect] scrollTop: ${s}, rowHeight: ${e}, maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`);
|
|
545
|
-
const l = t(this, it).firstTr,
|
|
545
|
+
const l = t(this, it).firstTr, u = l && l.dataset.row !== void 0 ? parseInt(l.dataset.row, 10) : -1;
|
|
546
546
|
(b = t(this, it)) == null || b.scrollTables.forEach((g) => {
|
|
547
547
|
g.style.transform = `translate3d(0, ${c}px, 0)`;
|
|
548
|
-
}),
|
|
548
|
+
}), u !== a && (S.log(`🔄 [Row Bind Trigger] currentStartIndex(${u}) !== startIndex(${a})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((g) => {
|
|
549
549
|
const y = t(this, R).querySelector(g);
|
|
550
550
|
if (!y) return;
|
|
551
551
|
const w = y.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -583,18 +583,18 @@ const Ze = class Ze {
|
|
|
583
583
|
});
|
|
584
584
|
}, "#bindRowData"));
|
|
585
585
|
d(this, Jt, /* @__PURE__ */ h(() => {
|
|
586
|
-
var c, l,
|
|
586
|
+
var c, l, u;
|
|
587
587
|
S.log("rowManager.#syncHeaderHeights");
|
|
588
588
|
const s = t(this, R).querySelector(".ng-container-left .ng-part-header table"), e = t(this, R).querySelector(".ng-container-body .ng-part-header table"), n = t(this, R).querySelector(".ng-container-right .ng-part-header table");
|
|
589
589
|
if (!e) return;
|
|
590
590
|
const r = s ? Array.from(s.querySelectorAll("tr")) : [], o = Array.from(e.querySelectorAll("tr")), i = n ? Array.from(n.querySelectorAll("tr")) : [], a = Math.max(r.length, o.length, i.length);
|
|
591
|
-
for (let
|
|
591
|
+
for (let f = 0; f < a; f++) {
|
|
592
592
|
const b = [
|
|
593
|
-
((c = r[
|
|
594
|
-
((l = o[
|
|
595
|
-
((
|
|
593
|
+
((c = r[f]) == null ? void 0 : c.getBoundingClientRect().height) || 0,
|
|
594
|
+
((l = o[f]) == null ? void 0 : l.getBoundingClientRect().height) || 0,
|
|
595
|
+
((u = i[f]) == null ? void 0 : u.getBoundingClientRect().height) || 0
|
|
596
596
|
], g = Math.max(...b);
|
|
597
|
-
g > 0 && (r[
|
|
597
|
+
g > 0 && (r[f] && (r[f].style.height = `${g}px`), o[f] && (o[f].style.height = `${g}px`), i[f] && (i[f].style.height = `${g}px`));
|
|
598
598
|
}
|
|
599
599
|
}, "#syncHeaderHeights"));
|
|
600
600
|
q(this, "destroy", /* @__PURE__ */ h(() => {
|
|
@@ -626,23 +626,23 @@ const Qt = class Qt {
|
|
|
626
626
|
if (!s) return null;
|
|
627
627
|
const e = /* @__PURE__ */ h((a) => {
|
|
628
628
|
a.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach((l) => {
|
|
629
|
-
const
|
|
629
|
+
const u = l.getAttribute("cell-type") || "renderer";
|
|
630
630
|
if (l.children.length > 0 && l.firstElementChild.tagName.includes("-")) return;
|
|
631
|
-
let
|
|
631
|
+
let f = `cell-${u}`;
|
|
632
632
|
const b = l.getAttribute("data-bind"), g = l.getAttribute("data-expr"), y = l.getAttribute("maxbyte"), w = l.getAttribute("type");
|
|
633
633
|
let v = [];
|
|
634
|
-
b && v.push(`data-bind="${b}"`), g && v.push(`data-expr="${g}"`), y && v.push(`maxbyte="${y}"`), w && v.push(`type="${w}"`), l.innerHTML = `<${
|
|
634
|
+
b && v.push(`data-bind="${b}"`), g && v.push(`data-expr="${g}"`), y && v.push(`maxbyte="${y}"`), w && v.push(`type="${w}"`), l.innerHTML = `<${f} ${v.join(" ")}></${f}>`;
|
|
635
635
|
}), a.querySelectorAll("tbody td, tfoot td").forEach((l) => {
|
|
636
636
|
l.setAttribute("tabindex", "0");
|
|
637
637
|
});
|
|
638
638
|
}, "processCellTypes"), n = /* @__PURE__ */ h((a) => {
|
|
639
639
|
if (!a.querySelector("colgroup")) {
|
|
640
|
-
const c = a.querySelector("tbody tr") || a.querySelector("tr"), l = c ? c.querySelectorAll("th, td").length : 1,
|
|
640
|
+
const c = a.querySelector("tbody tr") || a.querySelector("tr"), l = c ? c.querySelectorAll("th, td").length : 1, u = document.createElement("colgroup"), f = Math.max(Math.floor(a.clientWidth / l), 100);
|
|
641
641
|
for (let b = 0; b < l; b++) {
|
|
642
642
|
const g = document.createElement("col");
|
|
643
|
-
g.setAttribute("width",
|
|
643
|
+
g.setAttribute("width", f), u.appendChild(g);
|
|
644
644
|
}
|
|
645
|
-
a.prepend(
|
|
645
|
+
a.prepend(u);
|
|
646
646
|
}
|
|
647
647
|
if (!a.querySelector("thead")) {
|
|
648
648
|
const c = document.createElement("thead"), l = a.querySelector("colgroup");
|
|
@@ -650,13 +650,13 @@ const Qt = class Qt {
|
|
|
650
650
|
}
|
|
651
651
|
a.classList.add("nine-table-element");
|
|
652
652
|
}, "ensureTableStructure"), r = /* @__PURE__ */ h((a, c) => {
|
|
653
|
-
const l = Array.from(a.querySelectorAll(c + " tr")),
|
|
654
|
-
if (
|
|
653
|
+
const l = Array.from(a.querySelectorAll(c + " tr")), u = Array.from(a.querySelectorAll(c + " th," + c + " td")), f = l.length;
|
|
654
|
+
if (f === 0 || u.length === 0) return;
|
|
655
655
|
let b = 0;
|
|
656
|
-
|
|
656
|
+
u.forEach((y) => {
|
|
657
657
|
b += y.colSpan || 1;
|
|
658
658
|
});
|
|
659
|
-
const g = Array.from(Array(
|
|
659
|
+
const g = Array.from(Array(f), () => Array(b).fill(null));
|
|
660
660
|
l.forEach((y) => {
|
|
661
661
|
const w = y.sectionRowIndex;
|
|
662
662
|
let v = 0;
|
|
@@ -669,7 +669,7 @@ const Qt = class Qt {
|
|
|
669
669
|
const C = m.rowSpan || 1, A = m.colSpan || 1;
|
|
670
670
|
for (let H = 0; H < C; H++)
|
|
671
671
|
for (let F = 0; F < A; F++)
|
|
672
|
-
w + H <
|
|
672
|
+
w + H < f && v + F < b && (g[w + H][v + F] = H === 0 && F === 0 ? "1" : "0");
|
|
673
673
|
});
|
|
674
674
|
}), l.forEach((y) => {
|
|
675
675
|
const w = y.sectionRowIndex;
|
|
@@ -684,8 +684,8 @@ const Qt = class Qt {
|
|
|
684
684
|
}, "resetColIndex"), o = s.cloneNode(!0);
|
|
685
685
|
return n(o), e(o), r(o, "thead"), r(o, "tbody"), r(o, "tfoot"), Array.from(o.querySelectorAll("colgroup col")).forEach((a, c) => {
|
|
686
686
|
const l = a.getAttribute("fixed");
|
|
687
|
-
l && o.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach((
|
|
688
|
-
|
|
687
|
+
l && o.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach((u) => {
|
|
688
|
+
u.setAttribute("fixed", l);
|
|
689
689
|
});
|
|
690
690
|
}), o;
|
|
691
691
|
}
|
|
@@ -700,28 +700,29 @@ const Je = class Je {
|
|
|
700
700
|
d(this, _);
|
|
701
701
|
d(this, Y, { startRow: -1, startCol: -1, endRow: -1, endCol: -1 });
|
|
702
702
|
q(this, "render", /* @__PURE__ */ h(() => {
|
|
703
|
+
var a;
|
|
703
704
|
const { startRow: s, startCol: e, endRow: n, endCol: r } = t(this, Y);
|
|
704
705
|
S.log("🎨 [CellSelection.render] Rendering range ->", t(this, Y));
|
|
705
706
|
const o = t(this, _).querySelectorAll(
|
|
706
707
|
".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"
|
|
707
708
|
);
|
|
708
|
-
if (o.forEach((
|
|
709
|
-
|
|
710
|
-
|
|
709
|
+
if (o.forEach((c) => {
|
|
710
|
+
c.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right").forEach((l) => {
|
|
711
|
+
l.classList.remove("selected", "selected-top", "selected-bottom", "selected-left", "selected-right");
|
|
711
712
|
});
|
|
712
|
-
}), s < 0 || e < 0) {
|
|
713
|
+
}), (a = o[0]) == null || a.offsetHeight, s < 0 || e < 0) {
|
|
713
714
|
S.log("⚠️ [CellSelection.render] Range is invalid (< 0), skipping render.");
|
|
714
715
|
return;
|
|
715
716
|
}
|
|
716
717
|
let i = 0;
|
|
717
|
-
o.forEach((
|
|
718
|
-
|
|
719
|
-
const { matrixRow:
|
|
720
|
-
|
|
721
|
-
const
|
|
722
|
-
if (isNaN(
|
|
723
|
-
const
|
|
724
|
-
|
|
718
|
+
o.forEach((c) => {
|
|
719
|
+
c.querySelectorAll("tbody tr").forEach((l) => {
|
|
720
|
+
const { matrixRow: u } = Q(this, V, At).call(this, l);
|
|
721
|
+
u < 0 || l.querySelectorAll("td, th").forEach((f) => {
|
|
722
|
+
const b = parseInt(f.dataset.col, 10);
|
|
723
|
+
if (isNaN(b)) return;
|
|
724
|
+
const g = parseInt(f.rowSpan || 1, 10), y = parseInt(f.colSpan || 1, 10), w = u + g - 1, v = b + y - 1;
|
|
725
|
+
w >= s && u <= n && v >= e && b <= r && (i++, f.classList.add("selected"), S.log(f, s, e, n, r), u <= s && f.classList.add("selected-top"), w >= n && f.classList.add("selected-bottom"), b <= e && f.classList.add("selected-left"), v >= r && f.classList.add("selected-right"));
|
|
725
726
|
});
|
|
726
727
|
});
|
|
727
728
|
}), S.log(`✨ [CellSelection.render] Total rendered cells marked: ${i}`);
|
|
@@ -740,9 +741,9 @@ const Je = class Je {
|
|
|
740
741
|
const l = t(this, _).querySelectorAll(
|
|
741
742
|
".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"
|
|
742
743
|
);
|
|
743
|
-
let
|
|
744
|
-
for (;
|
|
745
|
-
|
|
744
|
+
let u = !0, f = 0;
|
|
745
|
+
for (; u && f < 5; )
|
|
746
|
+
u = !1, f++, l.forEach((b) => {
|
|
746
747
|
b.querySelectorAll("tbody tr").forEach((g) => {
|
|
747
748
|
if (g.classList.contains("nodata")) return;
|
|
748
749
|
const { matrixRow: y } = Q(this, V, At).call(this, g);
|
|
@@ -752,7 +753,7 @@ const Je = class Je {
|
|
|
752
753
|
const m = parseInt(w.rowSpan || 1, 10), C = parseInt(w.colSpan || 1, 10), A = y + m - 1, H = v + C - 1;
|
|
753
754
|
if (A >= o && y <= i && H >= a && v <= c) {
|
|
754
755
|
const U = Math.min(o, y), cs = Math.max(i, A), hs = Math.min(a, v), ds = Math.max(c, H);
|
|
755
|
-
(U !== o || cs !== i || hs !== a || ds !== c) && (o = U, i = cs, a = hs, c = ds,
|
|
756
|
+
(U !== o || cs !== i || hs !== a || ds !== c) && (o = U, i = cs, a = hs, c = ds, u = !0);
|
|
756
757
|
}
|
|
757
758
|
});
|
|
758
759
|
});
|
|
@@ -784,14 +785,14 @@ _ = new WeakMap(), Y = new WeakMap(), V = new WeakSet(), At = /* @__PURE__ */ h(
|
|
|
784
785
|
}
|
|
785
786
|
S.log(`🖱️ [MouseDown Success] startRow: ${o}, startCol: ${i}`), t(this, _).navigation.currentCell = n;
|
|
786
787
|
let a = o, c = i;
|
|
787
|
-
const l = /* @__PURE__ */ h((
|
|
788
|
-
const b = document.elementFromPoint(
|
|
788
|
+
const l = /* @__PURE__ */ h((f) => {
|
|
789
|
+
const b = document.elementFromPoint(f.clientX, f.clientY);
|
|
789
790
|
let g = b == null ? void 0 : b.closest("td, th");
|
|
790
791
|
if (!g || !t(this, _).contains(g)) {
|
|
791
792
|
const m = t(this, _).querySelectorAll(".ng-part-body tbody tr:not(.nodata) td, .ng-part-body tbody tr:not(.nodata) th");
|
|
792
793
|
for (const C of m) {
|
|
793
794
|
const A = C.getBoundingClientRect();
|
|
794
|
-
if (
|
|
795
|
+
if (f.clientX >= A.left && f.clientX <= A.right && f.clientY >= A.top && f.clientY <= A.bottom) {
|
|
795
796
|
g = C;
|
|
796
797
|
break;
|
|
797
798
|
}
|
|
@@ -800,10 +801,10 @@ _ = new WeakMap(), Y = new WeakMap(), V = new WeakSet(), At = /* @__PURE__ */ h(
|
|
|
800
801
|
if (!g || g.dataset.row === void 0 || g.dataset.col === void 0 || g.closest("tr").classList.contains("nodata")) return;
|
|
801
802
|
const y = g.closest("tr"), { matrixRow: w } = Q(this, V, At).call(this, y), v = parseInt(g.dataset.col, 10);
|
|
802
803
|
w < 0 || a === w && c === v || (a = w, c = v, this.setRange(o, i, w, v));
|
|
803
|
-
}, "onMouseMove"),
|
|
804
|
-
S.log("🖱️ [MouseUp] Drag ended."), t(this, _).style.userSelect = "", t(this, _).style.webkitUserSelect = "", document.removeEventListener("mousemove", l), document.removeEventListener("mouseup",
|
|
804
|
+
}, "onMouseMove"), u = /* @__PURE__ */ h(() => {
|
|
805
|
+
S.log("🖱️ [MouseUp] Drag ended."), t(this, _).style.userSelect = "", t(this, _).style.webkitUserSelect = "", document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", u);
|
|
805
806
|
}, "onMouseUp");
|
|
806
|
-
document.addEventListener("mousemove", l), document.addEventListener("mouseup",
|
|
807
|
+
document.addEventListener("mousemove", l), document.addEventListener("mouseup", u);
|
|
807
808
|
});
|
|
808
809
|
}, "#initEvents"), h(Je, "CellSelection");
|
|
809
810
|
let Ee = Je;
|
|
@@ -830,16 +831,16 @@ const Qe = class Qe {
|
|
|
830
831
|
p(this, te, e), p(this, ee, n);
|
|
831
832
|
const r = s.closest("tr"), o = r == null ? void 0 : r.closest("tbody");
|
|
832
833
|
if (o) {
|
|
833
|
-
const a = Array.from(o.querySelectorAll("tr:not(.nodata)")).filter((
|
|
834
|
-
S.log("====================",
|
|
834
|
+
const a = Array.from(o.querySelectorAll("tr:not(.nodata)")).filter((f) => parseInt(f.dataset.row, 10) === e), c = a.length > 0 ? a.length : 1, l = a.indexOf(r), u = e * c + (l >= 0 ? l : 0);
|
|
835
|
+
S.log("====================", u, n, u, n), t(this, G).selection.setRange(u, n, u, n);
|
|
835
836
|
}
|
|
836
837
|
}
|
|
837
838
|
}
|
|
838
839
|
moveCell(s) {
|
|
839
840
|
var C, A, H, F;
|
|
840
841
|
if (!t(this, lt)) return;
|
|
841
|
-
const e = t(this, lt), n = e.closest("tr"), r = parseInt(e.dataset.row, 10), o = parseInt(e.dataset.col, 10), i = n == null ? void 0 : n.closest("tbody"), c = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((U) => parseInt(U.dataset.row, 10) === r), l = c.length > 0 ? c.length : 1,
|
|
842
|
-
let
|
|
842
|
+
const e = t(this, lt), n = e.closest("tr"), r = parseInt(e.dataset.row, 10), o = parseInt(e.dataset.col, 10), i = n == null ? void 0 : n.closest("tbody"), c = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((U) => parseInt(U.dataset.row, 10) === r), l = c.length > 0 ? c.length : 1, u = c.indexOf(n);
|
|
843
|
+
let f = r, b = u, g = o;
|
|
843
844
|
switch (s.code) {
|
|
844
845
|
case "Tab":
|
|
845
846
|
s.preventDefault(), g = s.shiftKey ? o - 1 : o + 1;
|
|
@@ -851,19 +852,19 @@ const Qe = class Qe {
|
|
|
851
852
|
g = o - 1;
|
|
852
853
|
break;
|
|
853
854
|
case "ArrowDown":
|
|
854
|
-
s.preventDefault(),
|
|
855
|
+
s.preventDefault(), u < l - 1 ? b = u + 1 : (f = r + 1, b = 0);
|
|
855
856
|
break;
|
|
856
857
|
case "ArrowUp":
|
|
857
|
-
s.preventDefault(),
|
|
858
|
+
s.preventDefault(), u > 0 ? b = u - 1 : (f = r - 1, b = l - 1);
|
|
858
859
|
break;
|
|
859
860
|
}
|
|
860
861
|
let y = null;
|
|
861
|
-
const m = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((U) => parseInt(U.dataset.row, 10) ===
|
|
862
|
+
const m = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((U) => parseInt(U.dataset.row, 10) === f)[b];
|
|
862
863
|
if (m && (y = m.querySelector(`[data-col="${g}"]`)), y)
|
|
863
864
|
this.currentCell = y;
|
|
864
|
-
else if (
|
|
865
|
+
else if (f !== r && f >= 0) {
|
|
865
866
|
const U = ((A = (C = t(this, G)).getRowHeight) == null ? void 0 : A.call(C)) || 40;
|
|
866
|
-
(F = (H = t(this, G)).scrollToY) == null || F.call(H,
|
|
867
|
+
(F = (H = t(this, G)).scrollToY) == null || F.call(H, f * U);
|
|
867
868
|
}
|
|
868
869
|
}
|
|
869
870
|
};
|
|
@@ -923,8 +924,8 @@ const Et = class Et extends HTMLElement {
|
|
|
923
924
|
const o = e.cloneNode(!0), i = o.querySelector("thead"), a = o.querySelector("tbody"), c = o.querySelector("tfoot");
|
|
924
925
|
if (r === "header") {
|
|
925
926
|
if (a && a.remove(), c && c.remove(), e.querySelector("tbody")) {
|
|
926
|
-
const
|
|
927
|
-
|
|
927
|
+
const u = document.createElement("tbody");
|
|
928
|
+
u.className = "fixed-tbody", o.appendChild(u);
|
|
928
929
|
}
|
|
929
930
|
} else r === "body" ? (i && i.remove(), c && c.remove(), a && (a.className = "bindable-tbody")) : r === "footer" && (i && i.remove(), a && a.remove());
|
|
930
931
|
return n === "left" ? o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((l) => {
|
|
@@ -1181,33 +1182,33 @@ const ts = class ts extends HTMLElement {
|
|
|
1181
1182
|
}, "#init"));
|
|
1182
1183
|
d(this, Dt, /* @__PURE__ */ h((e, n = !1) => {
|
|
1183
1184
|
const r = /* @__PURE__ */ h(() => {
|
|
1184
|
-
const
|
|
1185
|
+
const u = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
1185
1186
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((g) => g.style.setProperty("display", "none"));
|
|
1186
|
-
const b =
|
|
1187
|
+
const b = u.filter((g) => g.classList.contains("active"));
|
|
1187
1188
|
b.length < 2 || b.forEach((g) => {
|
|
1188
|
-
const y = parseInt(g.getAttribute("data-index"), 10), w = this.querySelector(`nine-splitter[data-split-index="${y}"]`), v =
|
|
1189
|
+
const y = parseInt(g.getAttribute("data-index"), 10), w = this.querySelector(`nine-splitter[data-split-index="${y}"]`), v = u[y + 1];
|
|
1189
1190
|
w && v && v.classList.contains("active") && w.style.setProperty("display", "flex");
|
|
1190
1191
|
});
|
|
1191
1192
|
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), i = this.querySelector("nine-table-sheets-body"), a = o.querySelectorAll(".nine-tab-item"), c = i.querySelectorAll("nine-table-sheet");
|
|
1192
1193
|
if (!a[e]) return;
|
|
1193
1194
|
if (!n)
|
|
1194
|
-
a.forEach((
|
|
1195
|
-
|
|
1196
|
-
}), c.forEach((
|
|
1197
|
-
const b =
|
|
1198
|
-
|
|
1195
|
+
a.forEach((u, f) => {
|
|
1196
|
+
u.classList.toggle("active", f === e);
|
|
1197
|
+
}), c.forEach((u, f) => {
|
|
1198
|
+
const b = f === e;
|
|
1199
|
+
u.classList.toggle("active", b), u.style.flex = b ? "1 1 100%" : "";
|
|
1199
1200
|
});
|
|
1200
1201
|
else {
|
|
1201
|
-
const
|
|
1202
|
-
if (
|
|
1202
|
+
const u = a[e], f = o.querySelectorAll(".nine-tab-item.active");
|
|
1203
|
+
if (u.classList.contains("active") && f.length <= 1)
|
|
1203
1204
|
return;
|
|
1204
|
-
|
|
1205
|
+
u.classList.toggle("active");
|
|
1205
1206
|
const b = i.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
1206
1207
|
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
1207
1208
|
}
|
|
1208
1209
|
const l = i.querySelectorAll("nine-table-sheet.active");
|
|
1209
|
-
l == null || l.forEach((
|
|
1210
|
-
|
|
1210
|
+
l == null || l.forEach((u) => {
|
|
1211
|
+
u.style.flex = l.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
1211
1212
|
}), r();
|
|
1212
1213
|
}, "#switchSheet"));
|
|
1213
1214
|
}
|
|
@@ -1232,13 +1233,13 @@ const es = class es {
|
|
|
1232
1233
|
var c, l;
|
|
1233
1234
|
const s = Array.from(t(this, N).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
1234
1235
|
if (s.length === 0) return;
|
|
1235
|
-
const e = parseInt(t(this, N).getAttribute("max-display-row"), 10) || 10, n = Math.max(...s.map((
|
|
1236
|
+
const e = parseInt(t(this, N).getAttribute("max-display-row"), 10) || 10, n = Math.max(...s.map((u) => u.getRowHeight())), r = (c = t(this, N).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : c.getBoundingClientRect().height, o = (l = t(this, N).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, i = jt.SCROLLBAR_SIZE, a = e * n + r + o + i;
|
|
1236
1237
|
t(this, N).style.height = `${a}px`;
|
|
1237
1238
|
}, "#applyAutoHeight"));
|
|
1238
1239
|
d(this, he, /* @__PURE__ */ h(() => {
|
|
1239
1240
|
const e = Array.from(t(this, N).children).filter((c) => c.tagName === "TABLE"), n = t(this, N).getAttribute("auto-height") === "true", r = e.length, o = e.map((c, l) => {
|
|
1240
|
-
const
|
|
1241
|
-
return
|
|
1241
|
+
const f = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`, b = l < r - 1 ? `<nine-splitter class="h" data-split-index="${l}"></nine-splitter>` : "";
|
|
1242
|
+
return f + b;
|
|
1242
1243
|
}).join(""), i = e.map((c, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
1243
1244
|
t(this, N).shadowRoot.innerHTML = `
|
|
1244
1245
|
<style>
|
|
@@ -1506,8 +1507,8 @@ const z = class z {
|
|
|
1506
1507
|
if (!s) return s;
|
|
1507
1508
|
const e = !Array.isArray(s), n = e ? [s] : s, r = typeof ((i = t(this, O).fields) == null ? void 0 : i.get) == "function" ? t(this, O).fields.get() : [], o = n.filter((a) => !a.__ng.deleted).map((a) => {
|
|
1508
1509
|
const c = {};
|
|
1509
|
-
return r.forEach((l,
|
|
1510
|
-
c[l] = a.v ? a.v[
|
|
1510
|
+
return r.forEach((l, u) => {
|
|
1511
|
+
c[l] = a.v ? a.v[u] : a[l];
|
|
1511
1512
|
}), c.__ng = a.__ng, c;
|
|
1512
1513
|
});
|
|
1513
1514
|
return e ? o[0] : o;
|
|
@@ -1730,9 +1731,9 @@ const is = class is extends Me {
|
|
|
1730
1731
|
if (parseInt(n.sectionRowIndex / t(this, I).template.length) > 0)
|
|
1731
1732
|
for (var i of r) {
|
|
1732
1733
|
if (i > e) break;
|
|
1733
|
-
var a = parseInt(t(this, x).dataset.row), c = a - 1, l = t(this, x).closest("tr").data,
|
|
1734
|
+
var a = parseInt(t(this, x).dataset.row), c = a - 1, l = t(this, x).closest("tr").data, u = t(this, I).data.get(c);
|
|
1734
1735
|
t(this, x).dataset.matrixRow;
|
|
1735
|
-
var
|
|
1736
|
+
var f = t(this, I).body.querySelector(`tbody.bindable [suppress="${i}"][data-matrix-row="${t(this, x).dataset.matrixRow}"]`), b = f.dataset.expr ? this.getExprValue(f.dataset.expr, l, a) : l[f.dataset.bind], g = f.dataset.expr ? this.getExprValue(f.dataset.expr, u, c) : u[f.dataset.bind];
|
|
1736
1737
|
if (b != g) {
|
|
1737
1738
|
o = !0;
|
|
1738
1739
|
break;
|