@ninebone/table 0.0.415 β 0.0.417
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 +38 -38
- 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
|
@@ -22,7 +22,7 @@ const re = class re extends Se.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(re, "Trace");
|
|
24
24
|
let jt = re;
|
|
25
|
-
const
|
|
25
|
+
const T = new jt();
|
|
26
26
|
var _, O, p, V, Y, X, Et, U, Rt;
|
|
27
27
|
const le = class le extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -59,7 +59,7 @@ const le = class le extends HTMLElement {
|
|
|
59
59
|
let y = 0;
|
|
60
60
|
b > 0 && (y = parseInt(u / b * (c - f), 10)), y < 0 && (y = 0);
|
|
61
61
|
const m = c - f;
|
|
62
|
-
y > m && (y = m), r.style.left = `${y}px`,
|
|
62
|
+
y > m && (y = m), r.style.left = `${y}px`, T.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
h(this, U, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
@@ -215,7 +215,7 @@ const ae = class ae extends HTMLElement {
|
|
|
215
215
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
216
216
|
*/
|
|
217
217
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
218
|
-
|
|
218
|
+
T.log("refresh", t(this, z)), T.log("refresh2");
|
|
219
219
|
const e = t(this, S).container, s = t(this, S).track, o = t(this, S).thumb, r = e.clientHeight, l = (t(this, F).data.get() || []).length, d = t(this, Q).getRowHeight(), c = l * d;
|
|
220
220
|
if (c <= r) {
|
|
221
221
|
o.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
@@ -230,7 +230,7 @@ const ae = class ae extends HTMLElement {
|
|
|
230
230
|
let m = 0;
|
|
231
231
|
y > 0 && (m = b / y * (f - u));
|
|
232
232
|
const R = f - u;
|
|
233
|
-
m < 0 && (m = 0), m > R && (m = R), o.style.top = `${m}px`,
|
|
233
|
+
m < 0 && (m = 0), m > R && (m = R), o.style.top = `${m}px`, T.log("currentScrollTop", b), T.log("maxScrollTop", y), T.log("trackHeight", f), T.log("thumbHeight", u), t(this, S).top.disabled = b <= 0, t(this, S).bottom.disabled = b >= y - 1;
|
|
234
234
|
}, "refresh"));
|
|
235
235
|
h(this, At, /* @__PURE__ */ a(() => {
|
|
236
236
|
const e = t(this, S).container, s = /* @__PURE__ */ a(() => {
|
|
@@ -428,13 +428,13 @@ Tt = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), h(M, Tt, /* @__PU
|
|
|
428
428
|
});
|
|
429
429
|
}, "#resetColIndex"));
|
|
430
430
|
let Gt = M;
|
|
431
|
-
var I, w, W,
|
|
431
|
+
var I, w, W, q, D, j, B, et, qt, kt, Lt, ft, ut, Ht, Ct, gt, $t, it, bt;
|
|
432
432
|
const ce = class ce {
|
|
433
433
|
constructor(i) {
|
|
434
434
|
h(this, I);
|
|
435
435
|
h(this, w);
|
|
436
436
|
h(this, W, /* @__PURE__ */ new Map());
|
|
437
|
-
h(this,
|
|
437
|
+
h(this, q, null);
|
|
438
438
|
h(this, D, null);
|
|
439
439
|
h(this, j, 0);
|
|
440
440
|
h(this, B, 40);
|
|
@@ -446,7 +446,7 @@ const ce = class ce {
|
|
|
446
446
|
i && (t(this, ft).call(this), t(this, it).call(this, i.scrollTop), (e = t(this, w).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
447
447
|
}, "refresh"));
|
|
448
448
|
v(this, "initialize", /* @__PURE__ */ a(() => {
|
|
449
|
-
g(this,
|
|
449
|
+
g(this, q, null), t(this, W).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
450
450
|
const r = t(this, w).querySelector(o);
|
|
451
451
|
if (!r) return;
|
|
452
452
|
const n = r.querySelector("table");
|
|
@@ -484,8 +484,8 @@ const ce = class ce {
|
|
|
484
484
|
r ? r.before(n) : o.appendChild(n);
|
|
485
485
|
}, "#renderRows"));
|
|
486
486
|
h(this, Lt, /* @__PURE__ */ a((i) => {
|
|
487
|
-
if (t(this,
|
|
488
|
-
return t(this,
|
|
487
|
+
if (t(this, q) !== null && t(this, q) > 0)
|
|
488
|
+
return t(this, q);
|
|
489
489
|
const e = t(this, W).get(".ng-container-body");
|
|
490
490
|
if (!e || e.length === 0) return 24;
|
|
491
491
|
const s = i.querySelector("tbody.bindable-tbody") || i.querySelector("tbody.bindable-tbody:last-of-type");
|
|
@@ -501,20 +501,20 @@ const ce = class ce {
|
|
|
501
501
|
const u = s.querySelectorAll("tr:not(.nodata)");
|
|
502
502
|
return u.forEach((b) => {
|
|
503
503
|
f += b.offsetHeight || b.getBoundingClientRect().height;
|
|
504
|
-
}), u.forEach((b) => b.remove()), n.style.display = l, n.style.visibility = d, n.style.position = c, g(this,
|
|
504
|
+
}), u.forEach((b) => b.remove()), n.style.display = l, n.style.visibility = d, n.style.position = c, g(this, q, f > 0 ? f : 24), t(this, ut).call(this), t(this, q);
|
|
505
505
|
}, "#measureAndCacheHeight"));
|
|
506
506
|
h(this, ft, /* @__PURE__ */ a(() => {
|
|
507
507
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
508
|
-
const s = (t(this, I).data.get() || []).length, o = t(this,
|
|
509
|
-
|
|
508
|
+
const s = (t(this, I).data.get() || []).length, o = t(this, q) || 24, r = s * o;
|
|
509
|
+
T.log(`[VirtualHeight] totalCount: ${s}, rowHeight: ${o}, totalVirtualHeight: ${r}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
510
510
|
const l = t(this, w).querySelector(n), d = l == null ? void 0 : l.querySelector("table");
|
|
511
511
|
d && (d.style.height = `${r}px`);
|
|
512
512
|
});
|
|
513
513
|
}, "#updateVirtualScrollHeight"));
|
|
514
514
|
h(this, ut, /* @__PURE__ */ a(() => {
|
|
515
|
-
if ((t(this, I).data.get() || []).length, t(this, j) > 0 && t(this,
|
|
516
|
-
const e = Math.ceil(t(this, j) / t(this,
|
|
517
|
-
g(this, B, e + t(this, qt)),
|
|
515
|
+
if ((t(this, I).data.get() || []).length, t(this, j) > 0 && t(this, q) > 0) {
|
|
516
|
+
const e = Math.ceil(t(this, j) / t(this, q));
|
|
517
|
+
g(this, B, e + t(this, qt)), T.log("visibleRows:", e, "cachedRowCount:", t(this, B));
|
|
518
518
|
}
|
|
519
519
|
}, "#updateRowCount"));
|
|
520
520
|
h(this, Ht, /* @__PURE__ */ a(() => {
|
|
@@ -542,7 +542,7 @@ const ce = class ce {
|
|
|
542
542
|
const n = s.querySelector("thead");
|
|
543
543
|
n && (r += n.offsetHeight || n.getBoundingClientRect().height);
|
|
544
544
|
const l = Math.max(o - r, 100);
|
|
545
|
-
t(this, j) !== l && (g(this, j, l), t(this, ut).call(this), t(this,
|
|
545
|
+
t(this, j) !== l && (g(this, j, l), t(this, ut).call(this), t(this, q) !== null && t(this, gt).call(this));
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
})), t(this, D).observe(t(this, w)));
|
|
@@ -574,10 +574,10 @@ const ce = class ce {
|
|
|
574
574
|
}, "#adjustBufferRows"));
|
|
575
575
|
h(this, it, /* @__PURE__ */ a((i) => {
|
|
576
576
|
var d;
|
|
577
|
-
const e = t(this,
|
|
577
|
+
const e = t(this, q);
|
|
578
578
|
if (!e || e <= 0) return;
|
|
579
579
|
const o = (t(this, I).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), n = ((d = t(this, W).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this, B);
|
|
580
|
-
|
|
580
|
+
T.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, B)}, targetDataIndex range: ${r} ~ ${l} (Total: ${o})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((c) => {
|
|
581
581
|
const f = t(this, w).querySelector(c);
|
|
582
582
|
if (!f) return;
|
|
583
583
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
@@ -607,14 +607,14 @@ const ce = class ce {
|
|
|
607
607
|
g(this, I, i.getRootNode().host), g(this, w, i), t(this, Ct).call(this);
|
|
608
608
|
}
|
|
609
609
|
getRowHeight() {
|
|
610
|
-
return t(this,
|
|
610
|
+
return t(this, q);
|
|
611
611
|
}
|
|
612
612
|
templateLength(i = ".ng-container-body") {
|
|
613
613
|
var e;
|
|
614
614
|
return ((e = t(this, W).get(i)) == null ? void 0 : e.length) || 1;
|
|
615
615
|
}
|
|
616
616
|
};
|
|
617
|
-
I = new WeakMap(), w = new WeakMap(), W = new WeakMap(),
|
|
617
|
+
I = new WeakMap(), w = new WeakMap(), W = new WeakMap(), q = new WeakMap(), D = new WeakMap(), j = new WeakMap(), B = new WeakMap(), et = new WeakMap(), qt = new WeakMap(), kt = new WeakMap(), Lt = new WeakMap(), ft = new WeakMap(), ut = new WeakMap(), Ht = new WeakMap(), Ct = new WeakMap(), gt = new WeakMap(), $t = new WeakMap(), it = new WeakMap(), bt = new WeakMap(), a(ce, "RowManager");
|
|
618
618
|
let Jt = ce;
|
|
619
619
|
var yt, st, N, Mt, _t, It, Wt, Ot;
|
|
620
620
|
const ct = class ct extends HTMLElement {
|
|
@@ -666,7 +666,7 @@ const ct = class ct extends HTMLElement {
|
|
|
666
666
|
const o = (((d = (l = t(this, yt)) == null ? void 0 : l.data) == null ? void 0 : d.get()) || []).length, r = t(this, N).getRowHeight(), n = o * r;
|
|
667
667
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((c) => {
|
|
668
668
|
const f = this.querySelector(c), u = f == null ? void 0 : f.querySelector("table");
|
|
669
|
-
u && (u.style.height = `${n}px`, u.style.minHeight = `${n}px`);
|
|
669
|
+
T.log("=====================::::"), T.log(u, n), u && (u.style.height = `${n}px`, u.style.minHeight = `${n}px`);
|
|
670
670
|
}), setTimeout(() => {
|
|
671
671
|
var c;
|
|
672
672
|
(c = this.querySelector("nine-table-hscrollbar")) == null || c.refresh();
|
|
@@ -854,7 +854,7 @@ const ct = class ct extends HTMLElement {
|
|
|
854
854
|
t(this, Wt).call(this);
|
|
855
855
|
}
|
|
856
856
|
disconnectedCallback() {
|
|
857
|
-
this.innerHTML = "",
|
|
857
|
+
this.innerHTML = "", T.log("NineTableSheet destroyed.");
|
|
858
858
|
}
|
|
859
859
|
};
|
|
860
860
|
yt = new WeakMap(), st = new WeakMap(), N = new WeakMap(), Mt = new WeakMap(), _t = new WeakMap(), It = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(), a(ct, "NineTableSheet"), v(ct, "SCROLLBAR_SIZE", 16);
|
|
@@ -911,29 +911,29 @@ const he = class he extends HTMLElement {
|
|
|
911
911
|
zt = new WeakMap(), pt = new WeakMap(), a(he, "NineTableSheets");
|
|
912
912
|
let Qt = he;
|
|
913
913
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Qt);
|
|
914
|
-
var
|
|
914
|
+
var k, Dt, mt, Bt;
|
|
915
915
|
const de = class de {
|
|
916
916
|
constructor(i) {
|
|
917
|
-
h(this,
|
|
917
|
+
h(this, k);
|
|
918
918
|
h(this, Dt, /* @__PURE__ */ a(() => {
|
|
919
919
|
t(this, Bt).call(this), new ResizeObserver((i) => {
|
|
920
920
|
for (let e of i)
|
|
921
|
-
t(this,
|
|
922
|
-
}).observe(t(this,
|
|
921
|
+
t(this, k).getAttribute("auto-height") === "true" && t(this, mt).call(this);
|
|
922
|
+
}).observe(t(this, k));
|
|
923
923
|
}, "#init"));
|
|
924
924
|
h(this, mt, /* @__PURE__ */ a(() => {
|
|
925
925
|
var d, c;
|
|
926
|
-
const i = Array.from(t(this,
|
|
926
|
+
const i = Array.from(t(this, k).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
927
927
|
if (i.length === 0) return;
|
|
928
|
-
const e = parseInt(t(this,
|
|
929
|
-
t(this,
|
|
928
|
+
const e = parseInt(t(this, k).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), o = (d = t(this, k).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : d.getBoundingClientRect().height, r = (c = t(this, k).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : c.getBoundingClientRect().height, n = St.SCROLLBAR_SIZE, l = e * s + o + r + n;
|
|
929
|
+
t(this, k).style.height = `${l}px`;
|
|
930
930
|
}, "#applyAutoHeight"));
|
|
931
931
|
h(this, Bt, /* @__PURE__ */ a(() => {
|
|
932
|
-
const e = Array.from(t(this,
|
|
932
|
+
const e = Array.from(t(this, k).children).filter((d) => d.tagName === "TABLE"), s = t(this, k).getAttribute("auto-height") === "true", o = e.length, r = e.map((d, c) => {
|
|
933
933
|
const u = `<nine-table-sheet class="${c === 0 ? "active" : ""}" data-index="${c}"></nine-table-sheet>`, b = c < o - 1 ? `<nine-splitter class="h" data-split-index="${c}"></nine-splitter>` : "";
|
|
934
934
|
return u + b;
|
|
935
935
|
}).join(""), n = e.map((d, c) => `<div class="nine-tab-item ${c === 0 ? "active" : ""}" data-index="${c}">Sheet ${c + 1}</div>`).join("");
|
|
936
|
-
t(this,
|
|
936
|
+
t(this, k).shadowRoot.innerHTML = `
|
|
937
937
|
<style>
|
|
938
938
|
:host {
|
|
939
939
|
display: flex;
|
|
@@ -1024,17 +1024,17 @@ const de = class de {
|
|
|
1024
1024
|
</nine-table-body>
|
|
1025
1025
|
<nine-table-footer></nine-table-footer>
|
|
1026
1026
|
`;
|
|
1027
|
-
const l = t(this,
|
|
1027
|
+
const l = t(this, k).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1028
1028
|
l == null || l.forEach((d, c) => {
|
|
1029
1029
|
e[c] && setTimeout(() => {
|
|
1030
1030
|
d.generate(e[c]), s && t(this, mt).call(this);
|
|
1031
1031
|
});
|
|
1032
1032
|
});
|
|
1033
1033
|
}, "#render"));
|
|
1034
|
-
g(this,
|
|
1034
|
+
g(this, k, i), t(this, Dt).call(this);
|
|
1035
1035
|
}
|
|
1036
1036
|
};
|
|
1037
|
-
|
|
1037
|
+
k = new WeakMap(), Dt = new WeakMap(), mt = new WeakMap(), Bt = new WeakMap(), a(de, "LayoutManager");
|
|
1038
1038
|
let te = de;
|
|
1039
1039
|
var xt, nt;
|
|
1040
1040
|
const fe = class fe {
|
|
@@ -1243,11 +1243,11 @@ const ge = class ge {
|
|
|
1243
1243
|
}), g(this, A, Array.from(i, ([e, s]) => ({ name: e, type: s }))), g(this, A, t(this, A).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, A).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1244
1244
|
}, "#adjust"));
|
|
1245
1245
|
h(this, Xt, /* @__PURE__ */ a(() => {
|
|
1246
|
-
g(this, A, []),
|
|
1246
|
+
g(this, A, []), T.log(t(this, lt).querySelectorAll("table"));
|
|
1247
1247
|
const i = Array.from(t(this, lt).querySelectorAll("table"));
|
|
1248
1248
|
if (!(!i || i.length === 0)) {
|
|
1249
1249
|
for (const e of i)
|
|
1250
|
-
|
|
1250
|
+
T.log(e), $("[data-bind]", e).each((s, o) => {
|
|
1251
1251
|
const r = o.dataset.bind, n = o.getAttribute("data-type") || "string";
|
|
1252
1252
|
r && t(this, A).push({ name: r, type: n });
|
|
1253
1253
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1306,7 +1306,7 @@ const be = class be extends HTMLElement {
|
|
|
1306
1306
|
h(this, G);
|
|
1307
1307
|
h(this, Ut);
|
|
1308
1308
|
h(this, Ft, /* @__PURE__ */ a(() => {
|
|
1309
|
-
this.fields = new ne(this), g(this, Ut, new te(this)),
|
|
1309
|
+
this.fields = new ne(this), g(this, Ut, new te(this)), T.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1310
1310
|
}, "#init"));
|
|
1311
1311
|
this.attachShadow({ mode: "open" }), g(this, G, new se(this));
|
|
1312
1312
|
}
|
|
@@ -1314,7 +1314,7 @@ const be = class be extends HTMLElement {
|
|
|
1314
1314
|
t(this, Ft).call(this);
|
|
1315
1315
|
}
|
|
1316
1316
|
disconnectedCallback() {
|
|
1317
|
-
|
|
1317
|
+
T.log("NineTable disconnected.");
|
|
1318
1318
|
}
|
|
1319
1319
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1320
1320
|
get data() {
|