@ninebone/table 0.0.673 β 0.0.674
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 +33 -31
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +1 -1
- 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 He = class He extends Ke.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
c(He, "Trace");
|
|
24
24
|
let oe = He;
|
|
25
|
-
const
|
|
25
|
+
const H = new oe();
|
|
26
26
|
var B, j, S, X, K, Z, _t, G, Nt;
|
|
27
27
|
const Me = class Me extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -230,7 +230,7 @@ const $e = class $e extends HTMLElement {
|
|
|
230
230
|
u < 0 && (u = 0), u > v && (u = v), r.style.top = `${u}px`, t(this, T).top.disabled = g <= 0, t(this, T).bottom.disabled = g >= b - 1;
|
|
231
231
|
}, "refresh"));
|
|
232
232
|
d(this, Wt, /* @__PURE__ */ c(() => {
|
|
233
|
-
|
|
233
|
+
H.log("nine-table-vscrollbar.#init");
|
|
234
234
|
const e = t(this, T).container, s = /* @__PURE__ */ c(() => {
|
|
235
235
|
const n = (t(this, F).data.get() || []).length, o = t(this, at).getRowHeight();
|
|
236
236
|
return n * o;
|
|
@@ -371,12 +371,12 @@ const Ie = class Ie {
|
|
|
371
371
|
d(this, Ot, 3);
|
|
372
372
|
E(this, "refresh", /* @__PURE__ */ c(() => {
|
|
373
373
|
var e;
|
|
374
|
-
|
|
374
|
+
H.log("rowManager.refresh");
|
|
375
375
|
const i = t(this, x).querySelector(".ng-container-body .ng-part-body");
|
|
376
376
|
i && (t(this, St).call(this), t(this, Et).call(this), t(this, lt).call(this, i.scrollTop), (e = t(this, x).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
377
377
|
}, "refresh"));
|
|
378
378
|
E(this, "initialize", /* @__PURE__ */ c(() => {
|
|
379
|
-
|
|
379
|
+
H.log("rowManager.initialize"), y(this, Q, {
|
|
380
380
|
scrollTables: t(this, x).querySelectorAll(".ng-part-body table"),
|
|
381
381
|
firstTr: t(this, x).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")
|
|
382
382
|
}), y(this, I, null), t(this, D).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
@@ -407,7 +407,7 @@ const Ie = class Ie {
|
|
|
407
407
|
}
|
|
408
408
|
}, "initialize"));
|
|
409
409
|
d(this, zt, /* @__PURE__ */ c((i, e) => {
|
|
410
|
-
|
|
410
|
+
H.log("rowManager.#renderRows");
|
|
411
411
|
const s = t(this, D).get(e);
|
|
412
412
|
if (!s || s.length === 0) return;
|
|
413
413
|
const r = i.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -424,11 +424,11 @@ const Ie = class Ie {
|
|
|
424
424
|
if (t(this, I) !== null && t(this, I) > 0)
|
|
425
425
|
return t(this, I);
|
|
426
426
|
const i = t(this, x).querySelector(".ng-container-body .ng-part-body");
|
|
427
|
-
|
|
427
|
+
H.log("rowManager.#measureAndCacheHeight");
|
|
428
428
|
const e = t(this, D).get(".ng-container-body");
|
|
429
429
|
if (!e || e.length === 0) throw new Error("invalid dom");
|
|
430
430
|
const s = i.querySelector("tbody.bindable-tbody");
|
|
431
|
-
if (
|
|
431
|
+
if (H.log(s), !s) throw new Error("invalid dom");
|
|
432
432
|
s.querySelectorAll("tr:not(.nodata)").forEach((b) => b.remove());
|
|
433
433
|
const r = s.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
434
434
|
e.forEach((b) => {
|
|
@@ -449,9 +449,9 @@ const Ie = class Ie {
|
|
|
449
449
|
return y(this, I, f), t(this, At).call(this), t(this, I);
|
|
450
450
|
}, "#measureAndCacheHeight"));
|
|
451
451
|
d(this, Et, /* @__PURE__ */ c(() => {
|
|
452
|
-
|
|
452
|
+
H.log("rowManager.#updateVirtualScrollHeight");
|
|
453
453
|
const e = (t(this, P).data.get() || []).length, s = t(this, I), r = e * s;
|
|
454
|
-
|
|
454
|
+
H.log("π [VirtualHeight]", { totalCount: e, rowHeight: s, totalVirtualHeight: r }), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
455
455
|
const o = t(this, x).querySelector(n);
|
|
456
456
|
if (!o) return;
|
|
457
457
|
const a = o.querySelector(".ng-part-body .ng-virtual-spacer");
|
|
@@ -508,7 +508,7 @@ const Ie = class Ie {
|
|
|
508
508
|
})), t(this, V).observe(t(this, x)));
|
|
509
509
|
}, "#initResizeObserver"));
|
|
510
510
|
d(this, qt, /* @__PURE__ */ c(() => {
|
|
511
|
-
|
|
511
|
+
H.log("rowManager.#renderAllContainers"), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
512
512
|
const e = t(this, x).querySelector(i);
|
|
513
513
|
e && e.querySelector(".ng-part-body tbody.bindable-tbody") && t(this, zt).call(this, e, i);
|
|
514
514
|
}), t(this, Pt).call(this), t(this, Bt).call(this);
|
|
@@ -538,9 +538,11 @@ const Ie = class Ie {
|
|
|
538
538
|
if (!e || e <= 0) return;
|
|
539
539
|
const s = t(this, P).data.length;
|
|
540
540
|
if (s === 0) return;
|
|
541
|
-
const r = ((g = t(this, D).get(".ng-container-body")) == null ? void 0 : g.length) || 1, n = t(this, x).querySelector(".ng-container-body .ng-part-body")
|
|
541
|
+
const r = ((g = t(this, D).get(".ng-container-body")) == null ? void 0 : g.length) || 1, n = t(this, x).querySelector(".ng-container-body .ng-part-body");
|
|
542
|
+
H.log("bodyContainer.clientHeight", n.clientHeight);
|
|
543
|
+
const o = Math.max(0, s - Math.floor(n.clientHeight / e)), a = Math.min(o, Math.max(0, Math.floor(i / e)));
|
|
542
544
|
let h = Math.floor(a * e);
|
|
543
|
-
a === o &&
|
|
545
|
+
a === o && H.log(`π [Scroll Inspect] scrollTop: ${i}, rowHeight: ${e}, maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${h}`);
|
|
544
546
|
const l = t(this, Q).firstTr, f = l && l.dataset.row !== void 0 ? parseInt(l.dataset.row, 10) : -1;
|
|
545
547
|
(b = t(this, Q)) == null || b.scrollTables.forEach((u) => {
|
|
546
548
|
u.style.transform = `translate3d(0, ${h}px, 0)`;
|
|
@@ -583,7 +585,7 @@ const Ie = class Ie {
|
|
|
583
585
|
}, "#bindRowData"));
|
|
584
586
|
d(this, Pt, /* @__PURE__ */ c(() => {
|
|
585
587
|
var h, l, f;
|
|
586
|
-
|
|
588
|
+
H.log("rowManager.#syncHeaderHeights");
|
|
587
589
|
const i = t(this, x).querySelector(".ng-container-left .ng-part-header table"), e = t(this, x).querySelector(".ng-container-body .ng-part-header table"), s = t(this, x).querySelector(".ng-container-right .ng-part-header table");
|
|
588
590
|
if (!e) return;
|
|
589
591
|
const r = i ? Array.from(i.querySelectorAll("tr")) : [], n = Array.from(e.querySelectorAll("tr")), o = s ? Array.from(s.querySelectorAll("tr")) : [], a = Math.max(r.length, n.length, o.length);
|
|
@@ -955,7 +957,7 @@ const pt = class pt extends HTMLElement {
|
|
|
955
957
|
t(this, Ut).call(this);
|
|
956
958
|
}
|
|
957
959
|
disconnectedCallback() {
|
|
958
|
-
this.innerHTML = "",
|
|
960
|
+
this.innerHTML = "", H.log("NineTableSheet destroyed.");
|
|
959
961
|
}
|
|
960
962
|
};
|
|
961
963
|
Ft = new WeakMap(), et = new WeakMap(), st = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), ct = new WeakMap(), Ut = new WeakMap(), Xt = new WeakMap(), c(pt, "NineTableSheet"), E(pt, "SCROLLBAR_SIZE", 16);
|
|
@@ -1012,29 +1014,29 @@ const _e = class _e extends HTMLElement {
|
|
|
1012
1014
|
Kt = new WeakMap(), Tt = new WeakMap(), c(_e, "NineTableSheets");
|
|
1013
1015
|
let de = _e;
|
|
1014
1016
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", de);
|
|
1015
|
-
var
|
|
1017
|
+
var M, Zt, kt, Gt;
|
|
1016
1018
|
const Ne = class Ne {
|
|
1017
1019
|
constructor(i) {
|
|
1018
|
-
d(this,
|
|
1020
|
+
d(this, M);
|
|
1019
1021
|
d(this, Zt, /* @__PURE__ */ c(() => {
|
|
1020
1022
|
t(this, Gt).call(this), new ResizeObserver((i) => {
|
|
1021
1023
|
for (let e of i)
|
|
1022
|
-
t(this,
|
|
1023
|
-
}).observe(t(this,
|
|
1024
|
+
t(this, M).getAttribute("auto-height") === "true" && t(this, kt).call(this);
|
|
1025
|
+
}).observe(t(this, M));
|
|
1024
1026
|
}, "#init"));
|
|
1025
1027
|
d(this, kt, /* @__PURE__ */ c(() => {
|
|
1026
1028
|
var h, l;
|
|
1027
|
-
const i = Array.from(t(this,
|
|
1029
|
+
const i = Array.from(t(this, M).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
1028
1030
|
if (i.length === 0) return;
|
|
1029
|
-
const e = parseInt(t(this,
|
|
1030
|
-
t(this,
|
|
1031
|
+
const e = parseInt(t(this, M).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), r = (h = t(this, M).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : h.getBoundingClientRect().height, n = (l = t(this, M).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, o = It.SCROLLBAR_SIZE, a = e * s + r + n + o;
|
|
1032
|
+
t(this, M).style.height = `${a}px`;
|
|
1031
1033
|
}, "#applyAutoHeight"));
|
|
1032
1034
|
d(this, Gt, /* @__PURE__ */ c(() => {
|
|
1033
|
-
const e = Array.from(t(this,
|
|
1035
|
+
const e = Array.from(t(this, M).children).filter((h) => h.tagName === "TABLE"), s = t(this, M).getAttribute("auto-height") === "true", r = e.length, n = e.map((h, l) => {
|
|
1034
1036
|
const g = `<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>` : "";
|
|
1035
1037
|
return g + b;
|
|
1036
1038
|
}).join(""), o = e.map((h, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
1037
|
-
t(this,
|
|
1039
|
+
t(this, M).shadowRoot.innerHTML = `
|
|
1038
1040
|
<style>
|
|
1039
1041
|
:host {
|
|
1040
1042
|
display: flex;
|
|
@@ -1154,18 +1156,18 @@ const Ne = class Ne {
|
|
|
1154
1156
|
<nine-table-analysis></nine-table-analysis>
|
|
1155
1157
|
</nine-table-body>
|
|
1156
1158
|
<nine-table-footer></nine-table-footer>
|
|
1157
|
-
`, t(this,
|
|
1158
|
-
const a = t(this,
|
|
1159
|
+
`, t(this, M).shadowRoot.querySelector("nine-table-sheets").classList.add("nodata");
|
|
1160
|
+
const a = t(this, M).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1159
1161
|
a == null || a.forEach((h, l) => {
|
|
1160
1162
|
e[l] && setTimeout(() => {
|
|
1161
1163
|
h.generate(e[l]), s && t(this, kt).call(this);
|
|
1162
1164
|
});
|
|
1163
1165
|
});
|
|
1164
1166
|
}, "#render"));
|
|
1165
|
-
y(this,
|
|
1167
|
+
y(this, M, i), t(this, Zt).call(this);
|
|
1166
1168
|
}
|
|
1167
1169
|
};
|
|
1168
|
-
|
|
1170
|
+
M = new WeakMap(), Zt = new WeakMap(), kt = new WeakMap(), Gt = new WeakMap(), c(Ne, "LayoutManager");
|
|
1169
1171
|
let fe = Ne;
|
|
1170
1172
|
var Ct, ht;
|
|
1171
1173
|
const We = class We {
|
|
@@ -1378,11 +1380,11 @@ const ze = class ze {
|
|
|
1378
1380
|
}), y(this, L, Array.from(i, ([e, s]) => ({ name: e, type: s }))), y(this, L, t(this, L).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, L).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1379
1381
|
}, "#adjust"));
|
|
1380
1382
|
d(this, se, /* @__PURE__ */ c(() => {
|
|
1381
|
-
y(this, L, []),
|
|
1383
|
+
y(this, L, []), H.log(t(this, ut).querySelectorAll("table"));
|
|
1382
1384
|
const i = Array.from(t(this, ut).querySelectorAll("table"));
|
|
1383
1385
|
if (!(!i || i.length === 0)) {
|
|
1384
1386
|
for (const e of i)
|
|
1385
|
-
|
|
1387
|
+
H.log(e), $("[data-bind]", e).each((s, r) => {
|
|
1386
1388
|
const n = r.dataset.bind, o = r.getAttribute("data-type") || "string";
|
|
1387
1389
|
n && t(this, L).push({ name: n, type: o });
|
|
1388
1390
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1441,7 +1443,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1441
1443
|
d(this, nt);
|
|
1442
1444
|
d(this, ie);
|
|
1443
1445
|
d(this, re, /* @__PURE__ */ c(() => {
|
|
1444
|
-
this.fields = new ye(this), y(this, ie, new fe(this)),
|
|
1446
|
+
this.fields = new ye(this), y(this, ie, new fe(this)), H.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1445
1447
|
}, "#init"));
|
|
1446
1448
|
this.attachShadow({ mode: "open" }), y(this, nt, new be(this));
|
|
1447
1449
|
}
|
|
@@ -1449,7 +1451,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1449
1451
|
t(this, re).call(this);
|
|
1450
1452
|
}
|
|
1451
1453
|
disconnectedCallback() {
|
|
1452
|
-
|
|
1454
|
+
H.log("NineTable disconnected.");
|
|
1453
1455
|
}
|
|
1454
1456
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1455
1457
|
get data() {
|