@ninebone/table 0.0.311 β 0.0.312
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 +35 -27
- 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,29 +22,29 @@ const Yt = class Yt extends oe.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(Yt, "Trace");
|
|
24
24
|
let _t = Yt;
|
|
25
|
-
const
|
|
26
|
-
var
|
|
25
|
+
const M = new _t();
|
|
26
|
+
var C, $, p, P, B, N, dt, V, ft;
|
|
27
27
|
const Xt = class Xt extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
h(this,
|
|
30
|
+
h(this, C);
|
|
31
31
|
h(this, $, !1);
|
|
32
32
|
h(this, p);
|
|
33
33
|
h(this, P);
|
|
34
34
|
h(this, B);
|
|
35
35
|
h(this, N);
|
|
36
36
|
h(this, dt, /* @__PURE__ */ a(() => {
|
|
37
|
-
if (!t(this,
|
|
38
|
-
const e = t(this,
|
|
37
|
+
if (!t(this, C)) return;
|
|
38
|
+
const e = t(this, C).querySelector(".ng-container-body");
|
|
39
39
|
e && (b(this, N, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), t(this, N).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
w(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!t(this,
|
|
44
|
+
if (!t(this, C) || !t(this, p) || t(this, $)) return;
|
|
45
45
|
const e = t(this, p).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = t(this, p).track, o = t(this, p).thumb, r = t(this,
|
|
47
|
+
const n = t(this, p).track, o = t(this, p).thumb, r = t(this, C).querySelector(".ng-container-bottom"), l = e.clientWidth, c = s.scrollWidth;
|
|
48
48
|
if (l !== 0 && c > l)
|
|
49
49
|
r && (r.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -59,7 +59,7 @@ const Xt = class Xt extends HTMLElement {
|
|
|
59
59
|
let y = 0;
|
|
60
60
|
g > 0 && (y = parseInt(f / g * (d - u), 10)), y < 0 && (y = 0);
|
|
61
61
|
const E = d - u;
|
|
62
|
-
y > E && (y = E), o.style.left = `${y}px`,
|
|
62
|
+
y > E && (y = E), o.style.left = `${y}px`, M.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= E - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
h(this, V, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
@@ -112,7 +112,7 @@ const Xt = class Xt extends HTMLElement {
|
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (b(this,
|
|
115
|
+
if (b(this, C, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, C)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -177,7 +177,7 @@ const Xt = class Xt extends HTMLElement {
|
|
|
177
177
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
178
178
|
`;
|
|
179
179
|
const e = /* @__PURE__ */ a(() => {
|
|
180
|
-
const s = t(this,
|
|
180
|
+
const s = t(this, C).querySelector(".ng-container-body");
|
|
181
181
|
if (!s) {
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
@@ -198,7 +198,7 @@ const Xt = class Xt extends HTMLElement {
|
|
|
198
198
|
t(this, N) && t(this, N).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
201
|
+
C = new WeakMap(), $ = new WeakMap(), p = new WeakMap(), P = new WeakMap(), B = new WeakMap(), N = new WeakMap(), dt = new WeakMap(), V = new WeakMap(), ft = new WeakMap(), a(Xt, "NineTableHScrollBar");
|
|
202
202
|
let $t = Xt;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", $t);
|
|
204
204
|
var Y, I, S, it, st, ut;
|
|
@@ -243,7 +243,7 @@ const Ut = class Ut extends HTMLElement {
|
|
|
243
243
|
const n = /* @__PURE__ */ a((r) => {
|
|
244
244
|
if (!t(this, I)) return;
|
|
245
245
|
const l = t(this, S).track.getBoundingClientRect(), c = t(this, S).thumb.clientHeight, u = l.height - c, f = r.clientY - t(this, it), g = e.clientHeight, y = e.querySelector("table");
|
|
246
|
-
|
|
246
|
+
M.log(y), M.log(y.scrollHeight);
|
|
247
247
|
const k = y.scrollHeight - g;
|
|
248
248
|
if (u > 0 && k > 0) {
|
|
249
249
|
const D = f / u * k;
|
|
@@ -355,12 +355,12 @@ Y = new WeakMap(), I = new WeakMap(), S = new WeakMap(), it = new WeakMap(), st
|
|
|
355
355
|
let It = Ut;
|
|
356
356
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", It);
|
|
357
357
|
var gt, F;
|
|
358
|
-
const
|
|
358
|
+
const H = class H {
|
|
359
359
|
/**
|
|
360
360
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
361
361
|
*/
|
|
362
362
|
static compileAll(i) {
|
|
363
|
-
return Array.isArray(i) ? i.map((e) =>
|
|
363
|
+
return Array.isArray(i) ? i.map((e) => H.compile(e)) : [];
|
|
364
364
|
}
|
|
365
365
|
/**
|
|
366
366
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
@@ -369,7 +369,7 @@ const C = class C {
|
|
|
369
369
|
var n, o, r, l;
|
|
370
370
|
if (!i) return null;
|
|
371
371
|
const e = i.cloneNode(!0);
|
|
372
|
-
return t(n =
|
|
372
|
+
return t(n = H, gt).call(n, e), t(o = H, F).call(o, e, "thead"), t(r = H, F).call(r, e, "tbody"), t(l = H, F).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((c, d) => {
|
|
373
373
|
const u = c.getAttribute("fixed");
|
|
374
374
|
u && e.querySelectorAll(`thead [data-col="${d}"], tbody [data-col="${d}"], tfoot [data-col="${d}"]`).forEach((f) => {
|
|
375
375
|
f.setAttribute("fixed", u);
|
|
@@ -377,7 +377,7 @@ const C = class C {
|
|
|
377
377
|
}), e;
|
|
378
378
|
}
|
|
379
379
|
};
|
|
380
|
-
gt = new WeakMap(), F = new WeakMap(), a(
|
|
380
|
+
gt = new WeakMap(), F = new WeakMap(), a(H, "TableCompiler"), h(H, gt, /* @__PURE__ */ a((i) => {
|
|
381
381
|
if (!i.querySelector("colgroup")) {
|
|
382
382
|
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"), o = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
383
383
|
for (let r = 0; r < s; r++) {
|
|
@@ -391,7 +391,7 @@ gt = new WeakMap(), F = new WeakMap(), a(C, "TableCompiler"), h(C, gt, /* @__PUR
|
|
|
391
391
|
s ? s.after(e) : i.prepend(e);
|
|
392
392
|
}
|
|
393
393
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
394
|
-
}, "#ensureTableStructure")), h(
|
|
394
|
+
}, "#ensureTableStructure")), h(H, F, /* @__PURE__ */ a((i, e) => {
|
|
395
395
|
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), o = s.length;
|
|
396
396
|
if (o === 0 || n.length === 0) return;
|
|
397
397
|
let r = 0;
|
|
@@ -424,7 +424,7 @@ gt = new WeakMap(), F = new WeakMap(), a(C, "TableCompiler"), h(C, gt, /* @__PUR
|
|
|
424
424
|
});
|
|
425
425
|
});
|
|
426
426
|
}, "#resetColIndex"));
|
|
427
|
-
let Wt =
|
|
427
|
+
let Wt = H;
|
|
428
428
|
var m, _, R, W, X, U, bt, pt, nt, ot, yt, mt, rt, Z, xt;
|
|
429
429
|
const Kt = class Kt {
|
|
430
430
|
constructor(i) {
|
|
@@ -462,10 +462,18 @@ const Kt = class Kt {
|
|
|
462
462
|
if (i) {
|
|
463
463
|
t(this, pt).call(this, i), t(this, rt).call(this), t(this, nt).call(this), t(this, Z).call(this, i.scrollTop);
|
|
464
464
|
let e = i.scrollTop;
|
|
465
|
+
const s = /* @__PURE__ */ a((n) => {
|
|
466
|
+
var o;
|
|
467
|
+
leftContainer && leftContainer.scrollTop !== n && (leftContainer.scrollTop = n), rightContainer && rightContainer.scrollTop !== n && (rightContainer.scrollTop = n), t(this, Z).call(this, n), (o = t(this, m).querySelector("nine-table-vscrollbar")) == null || o.refresh();
|
|
468
|
+
}, "syncScroll");
|
|
465
469
|
i.addEventListener("scroll", () => {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
470
|
+
const n = i.scrollTop;
|
|
471
|
+
e !== n && (e = n, s(n));
|
|
472
|
+
}), [leftContainer, rightContainer].forEach((n) => {
|
|
473
|
+
n && n.addEventListener("scroll", () => {
|
|
474
|
+
const o = n.scrollTop;
|
|
475
|
+
i.scrollTop !== o && (i.scrollTop = o, e = o, s(o));
|
|
476
|
+
});
|
|
469
477
|
});
|
|
470
478
|
}
|
|
471
479
|
}, "initialize"));
|
|
@@ -503,7 +511,7 @@ const Kt = class Kt {
|
|
|
503
511
|
const f = s.querySelectorAll("tr:not(.nodata)");
|
|
504
512
|
return f.forEach((g) => {
|
|
505
513
|
u += g.offsetHeight || g.getBoundingClientRect().height;
|
|
506
|
-
}), f.forEach((g) => g.remove()), r.style.display = l, r.style.visibility = c, r.style.position = d, b(this, R, u > 0 ? u : 24), t(this, ot).call(this),
|
|
514
|
+
}), f.forEach((g) => g.remove()), r.style.display = l, r.style.visibility = c, r.style.position = d, b(this, R, u > 0 ? u : 24), t(this, ot).call(this), M.log(`[RowManager] Height Cached: ${t(this, R)}px | RowCount: ${t(this, U)}`), t(this, R);
|
|
507
515
|
}, "#measureAndCacheHeight"));
|
|
508
516
|
/**
|
|
509
517
|
* π― μ 체 λ°μ΄ν° κ°μ κΈ°λ°μΌλ‘ κ°μ μ€ν¬λ‘€ λμ΄ μ€μ
|
|
@@ -515,9 +523,9 @@ const Kt = class Kt {
|
|
|
515
523
|
var o, r, l, c;
|
|
516
524
|
if (!t(this, m).querySelector(".ng-container-body")) return;
|
|
517
525
|
const e = (typeof ((o = t(this, m).data) == null ? void 0 : o.count) == "function" ? t(this, m).data.count() : null) ?? ((l = (r = t(this, m).dataManager) == null ? void 0 : r.rawRecords) == null ? void 0 : l.length) ?? ((c = t(this, m).data) == null ? void 0 : c.length) ?? 0, s = t(this, R) || 24, n = e * s;
|
|
518
|
-
|
|
526
|
+
M.log(`[RowManager] TotalCount: ${e} | RowHeight: ${s}px | TotalVirtualHeight: ${n}px`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((d) => {
|
|
519
527
|
const u = t(this, m).querySelector(d), f = u == null ? void 0 : u.querySelector("table");
|
|
520
|
-
f ? (f.style.height = `${n}px`,
|
|
528
|
+
f ? (f.style.height = `${n}px`, M.log(`[RowManager] Applied height to ${d} table:`, f.style.height)) : M.log(`[RowManager] Table not found for selector: ${d}`);
|
|
521
529
|
});
|
|
522
530
|
}, "#updateVirtualScrollHeight"));
|
|
523
531
|
h(this, ot, /* @__PURE__ */ a(() => {
|
|
@@ -813,7 +821,7 @@ const et = class et extends HTMLElement {
|
|
|
813
821
|
t(this, Et).call(this);
|
|
814
822
|
}
|
|
815
823
|
disconnectedCallback() {
|
|
816
|
-
this.innerHTML = "",
|
|
824
|
+
this.innerHTML = "", M.log("NineTableSheet destroyed.");
|
|
817
825
|
}
|
|
818
826
|
};
|
|
819
827
|
G = new WeakMap(), J = new WeakMap(), vt = new WeakMap(), wt = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), Rt = new WeakMap(), a(et, "NineTableSheet"), w(et, "SCROLLBAR_SIZE", 16);
|
|
@@ -1202,10 +1210,10 @@ const Jt = class Jt extends HTMLElement {
|
|
|
1202
1210
|
this.attachShadow({ mode: "open" }), b(this, j, new Nt(this));
|
|
1203
1211
|
}
|
|
1204
1212
|
connectedCallback() {
|
|
1205
|
-
b(this, Mt, new Dt(this)),
|
|
1213
|
+
b(this, Mt, new Dt(this)), M.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1206
1214
|
}
|
|
1207
1215
|
disconnectedCallback() {
|
|
1208
|
-
|
|
1216
|
+
M.log("NineTable disconnected.");
|
|
1209
1217
|
}
|
|
1210
1218
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1211
1219
|
get data() {
|