@ninebone/table 0.0.423 β 0.0.424
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 +72 -71
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +38 -25
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -428,7 +428,7 @@ At = new WeakMap(), et = new WeakMap(), a(H, "TableCompiler"), c(H, At, /* @__PU
|
|
|
428
428
|
});
|
|
429
429
|
}, "#resetColIndex"));
|
|
430
430
|
let Gt = H;
|
|
431
|
-
var _, w, I, T, D, j,
|
|
431
|
+
var _, w, I, T, D, j, N, it, Tt, qt, kt, ft, ut, Lt, Ct, bt, Ht, st, gt;
|
|
432
432
|
const ce = class ce {
|
|
433
433
|
constructor(i) {
|
|
434
434
|
c(this, _);
|
|
@@ -437,7 +437,7 @@ const ce = class ce {
|
|
|
437
437
|
c(this, T, null);
|
|
438
438
|
c(this, D, null);
|
|
439
439
|
c(this, j, 0);
|
|
440
|
-
c(this,
|
|
440
|
+
c(this, N, 40);
|
|
441
441
|
c(this, it, !1);
|
|
442
442
|
c(this, Tt, 3);
|
|
443
443
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
@@ -477,7 +477,7 @@ const ce = class ce {
|
|
|
477
477
|
if (!n) return;
|
|
478
478
|
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
479
479
|
const r = n.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
480
|
-
for (let l = 0; l < t(this,
|
|
480
|
+
for (let l = 0; l < t(this, N); l++)
|
|
481
481
|
s.forEach((d) => {
|
|
482
482
|
o.appendChild(d.cloneNode(!0));
|
|
483
483
|
});
|
|
@@ -503,38 +503,22 @@ const ce = class ce {
|
|
|
503
503
|
f += g.offsetHeight || g.getBoundingClientRect().height;
|
|
504
504
|
}), u.forEach((g) => g.remove()), o.style.display = l, o.style.visibility = d, o.style.position = h, b(this, T, f > 0 ? f : 24), t(this, ut).call(this), t(this, T);
|
|
505
505
|
}, "#measureAndCacheHeight"));
|
|
506
|
-
/**
|
|
507
|
-
#updateVirtualScrollHeight = () => {
|
|
508
|
-
const bodyContainer = this.#sheet.querySelector('.ng-container-body');
|
|
509
|
-
if (!bodyContainer) return;
|
|
510
|
-
|
|
511
|
-
const dataList = this.#host.data.get() || [];
|
|
512
|
-
const totalCount = dataList.length;
|
|
513
|
-
const rowHeight = this.#cachedTemplateHeight || 24;
|
|
514
|
-
const totalVirtualHeight = totalCount * rowHeight;
|
|
515
|
-
|
|
516
|
-
// π― λλ²κΉ
λ‘κ·Έ: μ 체 λ°μ΄ν°κ° λͺ 건μ΄κ³ ν
μ΄λΈ λμ΄κ° μΌλ§λ‘ μ‘νλμ§ νμΈ
|
|
517
|
-
trace.log(`[VirtualHeight] totalCount: ${totalCount}, rowHeight: ${rowHeight}, totalVirtualHeight: ${totalVirtualHeight}`);
|
|
518
|
-
|
|
519
|
-
['.ng-container-body', '.ng-container-left', '.ng-container-right'].forEach(selector => {
|
|
520
|
-
const container = this.#sheet.querySelector(selector);
|
|
521
|
-
const table = container?.querySelector('table');
|
|
522
|
-
if (table) {
|
|
523
|
-
table.style.height = `${totalVirtualHeight}px`;
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
}; */
|
|
527
506
|
c(this, ft, /* @__PURE__ */ a(() => {
|
|
528
507
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
529
|
-
(t(this, _).data.get() || []).length, t(this, T)
|
|
530
|
-
|
|
531
|
-
|
|
508
|
+
const s = (t(this, _).data.get() || []).length, n = t(this, T) || 24, r = s * n;
|
|
509
|
+
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
510
|
+
const l = t(this, w).querySelector(o);
|
|
511
|
+
if (!l) return;
|
|
512
|
+
const d = l.querySelector("table");
|
|
513
|
+
d && (d.style.height = "auto", d.style.minHeight = "auto");
|
|
514
|
+
const h = l.querySelector(".ng-virtual-spacer");
|
|
515
|
+
h && (h.style.height = `${r}px`);
|
|
532
516
|
});
|
|
533
517
|
}, "#updateVirtualScrollHeight"));
|
|
534
518
|
c(this, ut, /* @__PURE__ */ a(() => {
|
|
535
519
|
if ((t(this, _).data.get() || []).length, t(this, j) > 0 && t(this, T) > 0) {
|
|
536
520
|
const e = Math.ceil(t(this, j) / t(this, T));
|
|
537
|
-
b(this,
|
|
521
|
+
b(this, N, e + t(this, Tt)), P.log("visibleRows:", e, "cachedRowCount:", t(this, N));
|
|
538
522
|
}
|
|
539
523
|
}, "#updateRowCount"));
|
|
540
524
|
c(this, Lt, /* @__PURE__ */ a(() => {
|
|
@@ -596,8 +580,8 @@ const ce = class ce {
|
|
|
596
580
|
var d;
|
|
597
581
|
const e = t(this, T);
|
|
598
582
|
if (!e || e <= 0) return;
|
|
599
|
-
const n = (t(this, _).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, I).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this,
|
|
600
|
-
P.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this,
|
|
583
|
+
const n = (t(this, _).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, I).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this, N);
|
|
584
|
+
P.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, N)}, targetDataIndex range: ${r} ~ ${l} (Total: ${n})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
601
585
|
const f = t(this, w).querySelector(h);
|
|
602
586
|
if (!f) return;
|
|
603
587
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
@@ -634,9 +618,9 @@ const ce = class ce {
|
|
|
634
618
|
return ((e = t(this, I).get(i)) == null ? void 0 : e.length) || 1;
|
|
635
619
|
}
|
|
636
620
|
};
|
|
637
|
-
_ = new WeakMap(), w = new WeakMap(), I = new WeakMap(), T = new WeakMap(), D = new WeakMap(), j = new WeakMap(),
|
|
621
|
+
_ = new WeakMap(), w = new WeakMap(), I = new WeakMap(), T = new WeakMap(), D = new WeakMap(), j = new WeakMap(), N = new WeakMap(), it = new WeakMap(), Tt = new WeakMap(), qt = new WeakMap(), kt = new WeakMap(), ft = new WeakMap(), ut = new WeakMap(), Lt = new WeakMap(), Ct = new WeakMap(), bt = new WeakMap(), Ht = new WeakMap(), st = new WeakMap(), gt = new WeakMap(), a(ce, "RowManager");
|
|
638
622
|
let Jt = ce;
|
|
639
|
-
var Mt, nt, K, _t,
|
|
623
|
+
var Mt, nt, K, _t, $t, It, Wt, Ot;
|
|
640
624
|
const ct = class ct extends HTMLElement {
|
|
641
625
|
constructor() {
|
|
642
626
|
super();
|
|
@@ -659,11 +643,15 @@ const ct = class ct extends HTMLElement {
|
|
|
659
643
|
].forEach(({ selector: s, type: n }) => {
|
|
660
644
|
const r = this.querySelector(s);
|
|
661
645
|
if (!r) return;
|
|
662
|
-
const o = t(this,
|
|
663
|
-
r.innerHTML = ""
|
|
646
|
+
const o = t(this, It).call(this, t(this, nt), n);
|
|
647
|
+
r.innerHTML = "";
|
|
648
|
+
const l = document.createElement("div");
|
|
649
|
+
l.className = "ng-scroll-content", l.appendChild(o);
|
|
650
|
+
const d = document.createElement("div");
|
|
651
|
+
d.className = "ng-virtual-spacer", l.appendChild(d), r.appendChild(l);
|
|
664
652
|
});
|
|
665
653
|
}, "#renderSplitContainers"));
|
|
666
|
-
c(this,
|
|
654
|
+
c(this, $t, /* @__PURE__ */ a(() => {
|
|
667
655
|
["left", "right"].forEach((e) => {
|
|
668
656
|
const s = this.querySelector(`.ng-container-${e}`), n = s == null ? void 0 : s.querySelector("table");
|
|
669
657
|
if (!s || !n) return;
|
|
@@ -675,7 +663,7 @@ const ct = class ct extends HTMLElement {
|
|
|
675
663
|
});
|
|
676
664
|
}, "#updateContainerWidths"));
|
|
677
665
|
v(this, "generate", /* @__PURE__ */ a((e) => {
|
|
678
|
-
e && (b(this, nt, Gt.compile(e)), t(this, nt).style.display = "table", t(this, _t).call(this), t(this,
|
|
666
|
+
e && (b(this, nt, Gt.compile(e)), t(this, nt).style.display = "table", t(this, _t).call(this), t(this, $t).call(this), requestAnimationFrame(() => {
|
|
679
667
|
var n;
|
|
680
668
|
const s = (n = this.querySelector("thead")) == null ? void 0 : n.getBoundingClientRect().height;
|
|
681
669
|
this.querySelectorAll("tbody.fixed-tbody").forEach((r) => {
|
|
@@ -689,7 +677,7 @@ const ct = class ct extends HTMLElement {
|
|
|
689
677
|
/**
|
|
690
678
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
691
679
|
*/
|
|
692
|
-
c(this,
|
|
680
|
+
c(this, It, /* @__PURE__ */ a((e, s) => {
|
|
693
681
|
const n = e.cloneNode(!0), r = n.querySelector("tbody");
|
|
694
682
|
if (r) {
|
|
695
683
|
const o = document.createElement("tbody");
|
|
@@ -747,21 +735,14 @@ const ct = class ct extends HTMLElement {
|
|
|
747
735
|
nine-table-sheet .ng-container-left {
|
|
748
736
|
display: flex;
|
|
749
737
|
flex-direction: column;
|
|
750
|
-
overflow:
|
|
738
|
+
overflow-y: auto;
|
|
739
|
+
overflow-x: hidden;
|
|
751
740
|
background: #ffffff;
|
|
752
741
|
border-right: 1px solid #e5e7eb;
|
|
753
742
|
flex-shrink: 0;
|
|
743
|
+
scrollbar-width: none;
|
|
744
|
+
&::-webkit-scrollbar { display: none; }
|
|
754
745
|
}
|
|
755
|
-
|
|
756
|
-
nine-table-sheet thead {
|
|
757
|
-
position: sticky;
|
|
758
|
-
top: 0;
|
|
759
|
-
}
|
|
760
|
-
nine-table-sheet tbody.fixed-tbody {
|
|
761
|
-
position: sticky;
|
|
762
|
-
z-index: 4;
|
|
763
|
-
}
|
|
764
|
-
|
|
765
746
|
|
|
766
747
|
nine-table-sheet .ng-container-body {
|
|
767
748
|
display: flex;
|
|
@@ -771,23 +752,32 @@ const ct = class ct extends HTMLElement {
|
|
|
771
752
|
overflow-x: auto;
|
|
772
753
|
background: #ffffff;
|
|
773
754
|
position: relative;
|
|
774
|
-
|
|
775
|
-
&::-webkit-scrollbar {
|
|
776
|
-
display: none;
|
|
777
|
-
height: 0px;
|
|
778
|
-
}
|
|
779
|
-
|
|
780
755
|
scrollbar-width: none;
|
|
756
|
+
&::-webkit-scrollbar { display: none; height: 0px; }
|
|
781
757
|
}
|
|
782
758
|
|
|
783
759
|
nine-table-sheet .ng-container-right {
|
|
784
760
|
display: flex;
|
|
785
|
-
flex-init: 0;
|
|
786
761
|
flex-direction: column;
|
|
787
|
-
overflow:
|
|
762
|
+
overflow-y: auto;
|
|
763
|
+
overflow-x: hidden;
|
|
788
764
|
background: #ffffff;
|
|
789
765
|
border-left: 1px solid #e5e7eb;
|
|
790
766
|
flex-shrink: 0;
|
|
767
|
+
scrollbar-width: none;
|
|
768
|
+
&::-webkit-scrollbar { display: none; }
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
nine-table-sheet .ng-scroll-content {
|
|
772
|
+
position: relative;
|
|
773
|
+
width: 100%;
|
|
774
|
+
height: auto;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
nine-table-sheet .ng-virtual-spacer {
|
|
778
|
+
width: 100%;
|
|
779
|
+
visibility: hidden;
|
|
780
|
+
pointer-events: none;
|
|
791
781
|
}
|
|
792
782
|
|
|
793
783
|
nine-table-sheet .ng-container-bottom {
|
|
@@ -815,6 +805,17 @@ const ct = class ct extends HTMLElement {
|
|
|
815
805
|
position: relative;
|
|
816
806
|
}
|
|
817
807
|
|
|
808
|
+
nine-table-sheet thead {
|
|
809
|
+
position: sticky;
|
|
810
|
+
top: 0;
|
|
811
|
+
z-index: 3;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
nine-table-sheet tbody.fixed-tbody {
|
|
815
|
+
position: sticky;
|
|
816
|
+
z-index: 4;
|
|
817
|
+
}
|
|
818
|
+
|
|
818
819
|
nine-table-sheet th, nine-table-sheet td {
|
|
819
820
|
box-sizing: border-box;
|
|
820
821
|
overflow: hidden;
|
|
@@ -871,7 +872,7 @@ const ct = class ct extends HTMLElement {
|
|
|
871
872
|
this.innerHTML = "", P.log("NineTableSheet destroyed.");
|
|
872
873
|
}
|
|
873
874
|
};
|
|
874
|
-
Mt = new WeakMap(), nt = new WeakMap(), K = new WeakMap(), _t = new WeakMap(),
|
|
875
|
+
Mt = new WeakMap(), nt = new WeakMap(), K = new WeakMap(), _t = new WeakMap(), $t = new WeakMap(), It = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(), a(ct, "NineTableSheet"), v(ct, "SCROLLBAR_SIZE", 16);
|
|
875
876
|
let wt = ct;
|
|
876
877
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", wt);
|
|
877
878
|
var zt, yt;
|
|
@@ -925,12 +926,12 @@ const he = class he extends HTMLElement {
|
|
|
925
926
|
zt = new WeakMap(), yt = new WeakMap(), a(he, "NineTableSheets");
|
|
926
927
|
let Qt = he;
|
|
927
928
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Qt);
|
|
928
|
-
var q, Dt, pt,
|
|
929
|
+
var q, Dt, pt, Nt;
|
|
929
930
|
const de = class de {
|
|
930
931
|
constructor(i) {
|
|
931
932
|
c(this, q);
|
|
932
933
|
c(this, Dt, /* @__PURE__ */ a(() => {
|
|
933
|
-
t(this,
|
|
934
|
+
t(this, Nt).call(this), new ResizeObserver((i) => {
|
|
934
935
|
for (let e of i)
|
|
935
936
|
t(this, q).getAttribute("auto-height") === "true" && t(this, pt).call(this);
|
|
936
937
|
}).observe(t(this, q));
|
|
@@ -942,7 +943,7 @@ const de = class de {
|
|
|
942
943
|
const e = parseInt(t(this, q).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), n = (d = t(this, q).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : d.getBoundingClientRect().height, r = (h = t(this, q).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : h.getBoundingClientRect().height, o = wt.SCROLLBAR_SIZE, l = e * s + n + r + o;
|
|
943
944
|
t(this, q).style.height = `${l}px`;
|
|
944
945
|
}, "#applyAutoHeight"));
|
|
945
|
-
c(this,
|
|
946
|
+
c(this, Nt, /* @__PURE__ */ a(() => {
|
|
946
947
|
const e = Array.from(t(this, q).children).filter((d) => d.tagName === "TABLE"), s = t(this, q).getAttribute("auto-height") === "true", n = e.length, r = e.map((d, h) => {
|
|
947
948
|
const u = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, g = h < n - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
948
949
|
return u + g;
|
|
@@ -1048,7 +1049,7 @@ const de = class de {
|
|
|
1048
1049
|
b(this, q, i), t(this, Dt).call(this);
|
|
1049
1050
|
}
|
|
1050
1051
|
};
|
|
1051
|
-
q = new WeakMap(), Dt = new WeakMap(), pt = new WeakMap(),
|
|
1052
|
+
q = new WeakMap(), Dt = new WeakMap(), pt = new WeakMap(), Nt = new WeakMap(), a(de, "LayoutManager");
|
|
1052
1053
|
let te = de;
|
|
1053
1054
|
var mt, ot;
|
|
1054
1055
|
const fe = class fe {
|
|
@@ -1068,23 +1069,23 @@ const fe = class fe {
|
|
|
1068
1069
|
};
|
|
1069
1070
|
mt = new WeakMap(), ot = new WeakMap(), a(fe, "ngRow");
|
|
1070
1071
|
let ee = fe;
|
|
1071
|
-
var k, R, L, rt,
|
|
1072
|
+
var k, R, L, rt, Bt, B, Pt, Z, xt, Yt, Vt, lt;
|
|
1072
1073
|
const C = class C {
|
|
1073
1074
|
constructor(i, e) {
|
|
1074
1075
|
c(this, k);
|
|
1075
1076
|
c(this, R);
|
|
1076
1077
|
c(this, L, []);
|
|
1077
1078
|
c(this, rt, []);
|
|
1078
|
-
c(this,
|
|
1079
|
-
c(this,
|
|
1079
|
+
c(this, Bt, 0);
|
|
1080
|
+
c(this, B, []);
|
|
1080
1081
|
c(this, Pt, /* @__PURE__ */ a(() => {
|
|
1081
|
-
b(this,
|
|
1082
|
+
b(this, B, []);
|
|
1082
1083
|
const i = t(this, k).template || [];
|
|
1083
1084
|
Array.from(i).forEach((e) => {
|
|
1084
1085
|
var s;
|
|
1085
|
-
t(this,
|
|
1086
|
+
t(this, B).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1086
1087
|
}), (t(this, R).rawRecords || []).forEach((e) => {
|
|
1087
|
-
e.__ng || (e.__ng = t(this, xt).call(this)), e.__ng.height = t(this,
|
|
1088
|
+
e.__ng || (e.__ng = t(this, xt).call(this)), e.__ng.height = t(this, B).slice();
|
|
1088
1089
|
});
|
|
1089
1090
|
}, "#initialize"));
|
|
1090
1091
|
c(this, Z, /* @__PURE__ */ a(() => {
|
|
@@ -1112,10 +1113,10 @@ const C = class C {
|
|
|
1112
1113
|
rowState: C.ROW_STATE.EMPTY,
|
|
1113
1114
|
deleted: !1,
|
|
1114
1115
|
filtered: !1,
|
|
1115
|
-
height: t(this,
|
|
1116
|
+
height: t(this, B).slice(),
|
|
1116
1117
|
o: {},
|
|
1117
1118
|
c: {},
|
|
1118
|
-
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this,
|
|
1119
|
+
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, B).slice(), -1, {}, {}]
|
|
1119
1120
|
}), "#getDefaultMeta"));
|
|
1120
1121
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
1121
1122
|
b(this, L, []), b(this, rt, []), t(this, Z).call(this);
|
|
@@ -1198,7 +1199,7 @@ const C = class C {
|
|
|
1198
1199
|
this.clear(), this.add(i, !1);
|
|
1199
1200
|
}
|
|
1200
1201
|
get nextId() {
|
|
1201
|
-
return ++ve(this,
|
|
1202
|
+
return ++ve(this, Bt)._;
|
|
1202
1203
|
}
|
|
1203
1204
|
get length() {
|
|
1204
1205
|
return t(this, L).length;
|
|
@@ -1207,7 +1208,7 @@ const C = class C {
|
|
|
1207
1208
|
return this.length;
|
|
1208
1209
|
}
|
|
1209
1210
|
};
|
|
1210
|
-
k = new WeakMap(), R = new WeakMap(), L = new WeakMap(), rt = new WeakMap(),
|
|
1211
|
+
k = new WeakMap(), R = new WeakMap(), L = new WeakMap(), rt = new WeakMap(), Bt = new WeakMap(), B = new WeakMap(), Pt = new WeakMap(), Z = new WeakMap(), xt = new WeakMap(), Yt = new WeakMap(), Vt = new WeakMap(), lt = new WeakMap(), a(C, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1211
1212
|
v(C, "ROW_STATE", {
|
|
1212
1213
|
EMPTY: "EMPTY",
|
|
1213
1214
|
NORMAL: "NORMAL",
|