@ninebone/table 0.0.303 โ 0.0.305
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 +55 -44
- 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
|
@@ -21,30 +21,30 @@ const Vt = class Vt extends re.constructor {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
a(Vt, "Trace");
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
var
|
|
24
|
+
let $t = Vt;
|
|
25
|
+
const H = new $t();
|
|
26
|
+
var M, _, y, D, P, B, dt, N, ft;
|
|
27
27
|
const Xt = class Xt extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
d(this,
|
|
31
|
-
d(this,
|
|
30
|
+
d(this, M);
|
|
31
|
+
d(this, _, !1);
|
|
32
32
|
d(this, y);
|
|
33
33
|
d(this, D);
|
|
34
34
|
d(this, P);
|
|
35
35
|
d(this, B);
|
|
36
36
|
d(this, dt, /* @__PURE__ */ a(() => {
|
|
37
|
-
if (!t(this,
|
|
38
|
-
const e = t(this,
|
|
37
|
+
if (!t(this, M)) return;
|
|
38
|
+
const e = t(this, M).querySelector(".ng-container-body");
|
|
39
39
|
e && (b(this, B, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), t(this, B).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
S(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!t(this,
|
|
44
|
+
if (!t(this, M) || !t(this, y) || t(this, _)) return;
|
|
45
45
|
const e = t(this, y).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = t(this, y).track, o = t(this, y).thumb, r = t(this,
|
|
47
|
+
const n = t(this, y).track, o = t(this, y).thumb, r = t(this, M).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 p = 0;
|
|
60
60
|
g > 0 && (p = parseInt(f / g * (h - u), 10)), p < 0 && (p = 0);
|
|
61
61
|
const w = h - u;
|
|
62
|
-
p > w && (p = w), o.style.left = `${p}px`,
|
|
62
|
+
p > w && (p = w), o.style.left = `${p}px`, H.log(p), t(this, y).left.disabled = p === 0, t(this, y).right.disabled = p >= w - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
d(this, N, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, y)) return !1;
|
|
@@ -99,20 +99,20 @@ const Xt = class Xt extends HTMLElement {
|
|
|
99
99
|
t(this, N).call(this, n.clientX - o.left - r / 2);
|
|
100
100
|
}), t(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
101
101
|
if (n.button !== 0) return;
|
|
102
|
-
n.stopPropagation(), n.preventDefault(), b(this,
|
|
102
|
+
n.stopPropagation(), n.preventDefault(), b(this, _, !0), this.shiftX = n.clientX - t(this, y).thumb.getBoundingClientRect().left;
|
|
103
103
|
const o = /* @__PURE__ */ a((l) => {
|
|
104
|
-
if (!t(this,
|
|
104
|
+
if (!t(this, _)) return;
|
|
105
105
|
const c = t(this, y).track.getBoundingClientRect();
|
|
106
106
|
t(this, N).call(this, l.clientX - c.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), r = /* @__PURE__ */ a(() => {
|
|
108
|
-
b(this,
|
|
108
|
+
b(this, _, !1), s(), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
110
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", r);
|
|
111
111
|
});
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (b(this,
|
|
115
|
+
if (b(this, M, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, M)) 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, M).querySelector(".ng-container-body");
|
|
181
181
|
if (!s) {
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
@@ -189,7 +189,7 @@ const Xt = class Xt extends HTMLElement {
|
|
|
189
189
|
left: this.querySelector(".ng-scroll-left"),
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), s.addEventListener("scroll", () => {
|
|
192
|
-
t(this,
|
|
192
|
+
t(this, _) || this.refresh();
|
|
193
193
|
}), t(this, ft).call(this), t(this, dt).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
@@ -198,9 +198,9 @@ const Xt = class Xt extends HTMLElement {
|
|
|
198
198
|
t(this, B) && t(this, B).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
202
|
-
let
|
|
203
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar",
|
|
201
|
+
M = new WeakMap(), _ = new WeakMap(), y = new WeakMap(), D = new WeakMap(), P = new WeakMap(), B = new WeakMap(), dt = new WeakMap(), N = new WeakMap(), ft = new WeakMap(), a(Xt, "NineTableHScrollBar");
|
|
202
|
+
let _t = Xt;
|
|
203
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", _t);
|
|
204
204
|
var Y, I, E, it, st, ut;
|
|
205
205
|
const Ut = class Ut extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
@@ -353,12 +353,12 @@ Y = new WeakMap(), I = new WeakMap(), E = new WeakMap(), it = new WeakMap(), st
|
|
|
353
353
|
let It = Ut;
|
|
354
354
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", It);
|
|
355
355
|
var gt, j;
|
|
356
|
-
const
|
|
356
|
+
const C = class C {
|
|
357
357
|
/**
|
|
358
358
|
* ๐ฏ ๋ ์ด์์ ๋ด์ ์ฌ๋ฌ rawTables ๋ฐฐ์ด์ ์ผ๊ด๋ก ๋ฐ์ ๋จ์ผ ๋ง์คํฐ ํ
ํ๋ฆฟ์ผ๋ก ์ฌ์ ์ปดํ์ผํฉ๋๋ค.
|
|
359
359
|
*/
|
|
360
360
|
static compileAll(i) {
|
|
361
|
-
return Array.isArray(i) ? i.map((e) =>
|
|
361
|
+
return Array.isArray(i) ? i.map((e) => C.compile(e)) : [];
|
|
362
362
|
}
|
|
363
363
|
/**
|
|
364
364
|
* ๐ฏ ๋จ์ผ ์๋ณธ ํ
์ด๋ธ์ ๋ฐ์ ๊ธฐ๋ณธ ๊ตฌ์กฐ ๋ณด์ ๋ฐ 2์ฐจ์ ๊ฒฉ์ ์ธ๋ฑ์ค ์ฌ์ ๋ถ์ฌ ์๋ฃ๋ ๋ง์คํฐ ํ
์ด๋ธ ๋ฐํ
|
|
@@ -367,7 +367,7 @@ const H = class H {
|
|
|
367
367
|
var n, o, r, l;
|
|
368
368
|
if (!i) return null;
|
|
369
369
|
const e = i.cloneNode(!0);
|
|
370
|
-
return t(n =
|
|
370
|
+
return t(n = C, gt).call(n, e), t(o = C, j).call(o, e, "thead"), t(r = C, j).call(r, e, "tbody"), t(l = C, j).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((c, h) => {
|
|
371
371
|
const u = c.getAttribute("fixed");
|
|
372
372
|
u && e.querySelectorAll(`thead [data-col="${h}"], tbody [data-col="${h}"], tfoot [data-col="${h}"]`).forEach((f) => {
|
|
373
373
|
f.setAttribute("fixed", u);
|
|
@@ -375,7 +375,7 @@ const H = class H {
|
|
|
375
375
|
}), e;
|
|
376
376
|
}
|
|
377
377
|
};
|
|
378
|
-
gt = new WeakMap(), j = new WeakMap(), a(
|
|
378
|
+
gt = new WeakMap(), j = new WeakMap(), a(C, "TableCompiler"), d(C, gt, /* @__PURE__ */ a((i) => {
|
|
379
379
|
if (!i.querySelector("colgroup")) {
|
|
380
380
|
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);
|
|
381
381
|
for (let r = 0; r < s; r++) {
|
|
@@ -389,7 +389,7 @@ gt = new WeakMap(), j = new WeakMap(), a(H, "TableCompiler"), d(H, gt, /* @__PUR
|
|
|
389
389
|
s ? s.after(e) : i.prepend(e);
|
|
390
390
|
}
|
|
391
391
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
392
|
-
}, "#ensureTableStructure")), d(
|
|
392
|
+
}, "#ensureTableStructure")), d(C, j, /* @__PURE__ */ a((i, e) => {
|
|
393
393
|
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), o = s.length;
|
|
394
394
|
if (o === 0 || n.length === 0) return;
|
|
395
395
|
let r = 0;
|
|
@@ -422,12 +422,12 @@ gt = new WeakMap(), j = new WeakMap(), a(H, "TableCompiler"), d(H, gt, /* @__PUR
|
|
|
422
422
|
});
|
|
423
423
|
});
|
|
424
424
|
}, "#resetColIndex"));
|
|
425
|
-
let Wt =
|
|
426
|
-
var m,
|
|
425
|
+
let Wt = C;
|
|
426
|
+
var m, $, R, W, V, X, bt, pt, nt, ot, yt, mt, rt, F, xt;
|
|
427
427
|
const Kt = class Kt {
|
|
428
428
|
constructor(i) {
|
|
429
429
|
d(this, m);
|
|
430
|
-
d(this,
|
|
430
|
+
d(this, $, /* @__PURE__ */ new Map());
|
|
431
431
|
// ๊ฐ ์ปจํ
์ด๋๋ณ ๋
๋ฆฝ๋ ํ
ํ๋ฆฟ TR ๊ด๋ฆฌ
|
|
432
432
|
d(this, R, null);
|
|
433
433
|
d(this, W, null);
|
|
@@ -446,7 +446,7 @@ const Kt = class Kt {
|
|
|
446
446
|
*/
|
|
447
447
|
// [RowManager.js ์์ ๋ด์ฉ ๋ฐ์ท]
|
|
448
448
|
S(this, "initialize", /* @__PURE__ */ a(() => {
|
|
449
|
-
b(this, R, null), t(this,
|
|
449
|
+
b(this, R, null), t(this, $).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
450
450
|
const s = t(this, m).querySelector(e);
|
|
451
451
|
if (!s) return;
|
|
452
452
|
const n = s.querySelector("table");
|
|
@@ -454,7 +454,7 @@ const Kt = class Kt {
|
|
|
454
454
|
const o = n.querySelector("tbody");
|
|
455
455
|
if (!o) return;
|
|
456
456
|
const l = Array.from(o.querySelectorAll("tr")).map((c) => c.cloneNode(!0));
|
|
457
|
-
t(this,
|
|
457
|
+
t(this, $).set(e, l);
|
|
458
458
|
});
|
|
459
459
|
const i = t(this, m).querySelector(".ng-container-body");
|
|
460
460
|
if (i) {
|
|
@@ -463,12 +463,12 @@ const Kt = class Kt {
|
|
|
463
463
|
i.addEventListener("scroll", () => {
|
|
464
464
|
var n;
|
|
465
465
|
const s = i.scrollTop;
|
|
466
|
-
|
|
466
|
+
H.log(e, s), e !== s && (e = s, t(this, F).call(this, s)), (n = t(this, m).querySelector("nine-table-vscrollbar")) == null || n.refresh();
|
|
467
467
|
});
|
|
468
468
|
}
|
|
469
469
|
}, "initialize"));
|
|
470
470
|
d(this, bt, /* @__PURE__ */ a((i, e) => {
|
|
471
|
-
const s = t(this,
|
|
471
|
+
const s = t(this, $).get(e);
|
|
472
472
|
if (!s || s.length === 0) return;
|
|
473
473
|
const n = i.querySelector("tbody");
|
|
474
474
|
if (!n) return;
|
|
@@ -486,7 +486,7 @@ const Kt = class Kt {
|
|
|
486
486
|
d(this, pt, /* @__PURE__ */ a((i) => {
|
|
487
487
|
if (t(this, R) !== null && t(this, R) > 0)
|
|
488
488
|
return t(this, R);
|
|
489
|
-
const e = t(this,
|
|
489
|
+
const e = t(this, $).get(".ng-container-body");
|
|
490
490
|
if (!e || e.length === 0) return 24;
|
|
491
491
|
const s = i.querySelector("tbody");
|
|
492
492
|
if (!s) return 24;
|
|
@@ -501,7 +501,7 @@ const Kt = class Kt {
|
|
|
501
501
|
const f = s.querySelectorAll("tr:not(.nodata)");
|
|
502
502
|
return f.forEach((g) => {
|
|
503
503
|
u += g.offsetHeight || g.getBoundingClientRect().height;
|
|
504
|
-
}), f.forEach((g) => g.remove()), r.style.display = l, r.style.visibility = c, r.style.position = h, b(this, R, u > 0 ? u : 24), t(this, ot).call(this),
|
|
504
|
+
}), f.forEach((g) => g.remove()), r.style.display = l, r.style.visibility = c, r.style.position = h, b(this, R, u > 0 ? u : 24), t(this, ot).call(this), H.log(`[RowManager] Height Cached: ${t(this, R)}px | RowCount: ${t(this, X)}`), t(this, R);
|
|
505
505
|
}, "#measureAndCacheHeight"));
|
|
506
506
|
/**
|
|
507
507
|
* ๐ฏ ์ ์ฒด ๋ฐ์ดํฐ ๊ฐ์ ๊ธฐ๋ฐ์ผ๋ก ๊ฐ์ ์คํฌ๋กค ๋์ด ์ค์
|
|
@@ -513,9 +513,9 @@ const Kt = class Kt {
|
|
|
513
513
|
var o, r, l, c;
|
|
514
514
|
if (!t(this, m).querySelector(".ng-container-body")) return;
|
|
515
515
|
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;
|
|
516
|
-
|
|
516
|
+
H.log(`[RowManager] TotalCount: ${e} | RowHeight: ${s}px | TotalVirtualHeight: ${n}px`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
517
517
|
const u = t(this, m).querySelector(h), f = u == null ? void 0 : u.querySelector("table");
|
|
518
|
-
f ? (f.style.height = `${n}px`,
|
|
518
|
+
f ? (f.style.height = `${n}px`, H.log(`[RowManager] Applied height to ${h} table:`, f.style.height)) : H.log(`[RowManager] Table not found for selector: ${h}`);
|
|
519
519
|
});
|
|
520
520
|
}, "#updateVirtualScrollHeight"));
|
|
521
521
|
d(this, ot, /* @__PURE__ */ a(() => {
|
|
@@ -573,17 +573,28 @@ const Kt = class Kt {
|
|
|
573
573
|
/**
|
|
574
574
|
* ๐ฏ ์คํฌ๋กค ์์น์ ๋ฐ๋ฅธ ๋ฐ์ดํฐ ๋ฐ์ธ๋ฉ ๋ฐ tbody ๋ฏธ์ธ ํฝ์
์ด๋(translateY) ๊ฐฑ์
|
|
575
575
|
*/
|
|
576
|
+
/**
|
|
577
|
+
* ๐ฏ ์คํฌ๋กค ์์น์ ๋ฐ๋ฅธ ๋ฐ์ดํฐ ๋ฐ์ธ๋ฉ ๋ฐ tbody ๋ฏธ์ธ ํฝ์
์ด๋(translateY) ๊ฐฑ์
|
|
578
|
+
*/
|
|
576
579
|
d(this, F, /* @__PURE__ */ a((i) => {
|
|
577
580
|
var r;
|
|
578
581
|
const e = t(this, R);
|
|
579
|
-
if (!e || e <= 0)
|
|
580
|
-
|
|
582
|
+
if (!e || e <= 0) {
|
|
583
|
+
H.log("[RowManager] #handleScroll Aborted: rowHeight is invalid", e);
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
const s = Math.max(0, Math.floor(i / e)), n = i % e;
|
|
587
|
+
H.log(`[RowManager] ScrollTop: ${i} | StartIndex: ${s} | OffsetY: ${n}px`);
|
|
588
|
+
const o = ((r = t(this, $).get(".ng-container-body")) == null ? void 0 : r.length) || 1;
|
|
581
589
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((l) => {
|
|
582
590
|
const c = t(this, m).querySelector(l);
|
|
583
591
|
if (!c) return;
|
|
584
592
|
const h = c.querySelector("tbody");
|
|
585
|
-
if (!h)
|
|
586
|
-
|
|
593
|
+
if (!h) {
|
|
594
|
+
H.log(`[RowManager] tbody not found for selector: ${l}`);
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
window.getComputedStyle(h).position === "static" && (h.style.position = "relative"), h.style.transform = `translateY(-${n}px)`, h.style.willChange = "transform", Array.from(h.querySelectorAll("tr:not(.nodata)")).forEach((f, g) => {
|
|
587
598
|
var k, tt, Qt, te;
|
|
588
599
|
const p = s + Math.floor(g / o), w = (typeof t(this, m).getData == "function" ? t(this, m).getData(p) : null) ?? (typeof ((k = t(this, m).data) == null ? void 0 : k.get) == "function" ? t(this, m).data.get(p) : null) ?? ((Qt = (tt = t(this, m).dataManager) == null ? void 0 : tt.rawRecords) == null ? void 0 : Qt[p]) ?? ((te = t(this, m).data) == null ? void 0 : te[p]) ?? null;
|
|
589
600
|
w ? (f.style.display = "", t(this, xt).call(this, f, w, p)) : f.style.display = "none";
|
|
@@ -609,10 +620,10 @@ const Kt = class Kt {
|
|
|
609
620
|
}
|
|
610
621
|
templateLength(i = ".ng-container-body") {
|
|
611
622
|
var e;
|
|
612
|
-
return ((e = t(this,
|
|
623
|
+
return ((e = t(this, $).get(i)) == null ? void 0 : e.length) || 1;
|
|
613
624
|
}
|
|
614
625
|
};
|
|
615
|
-
m = new WeakMap(),
|
|
626
|
+
m = new WeakMap(), $ = new WeakMap(), R = new WeakMap(), W = new WeakMap(), V = new WeakMap(), X = new WeakMap(), bt = new WeakMap(), pt = new WeakMap(), nt = new WeakMap(), ot = new WeakMap(), yt = new WeakMap(), mt = new WeakMap(), rt = new WeakMap(), F = new WeakMap(), xt = new WeakMap(), a(Kt, "RowManager");
|
|
616
627
|
let Ot = Kt;
|
|
617
628
|
var Z, G, vt, wt, St, Et, Rt;
|
|
618
629
|
const et = class et extends HTMLElement {
|
|
@@ -817,7 +828,7 @@ const et = class et extends HTMLElement {
|
|
|
817
828
|
t(this, Et).call(this);
|
|
818
829
|
}
|
|
819
830
|
disconnectedCallback() {
|
|
820
|
-
this.innerHTML = "",
|
|
831
|
+
this.innerHTML = "", H.log("NineTableSheet destroyed.");
|
|
821
832
|
}
|
|
822
833
|
};
|
|
823
834
|
Z = new WeakMap(), G = new WeakMap(), vt = new WeakMap(), wt = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), Rt = new WeakMap(), a(et, "NineTableSheet"), S(et, "SCROLLBAR_SIZE", 16);
|
|
@@ -1206,10 +1217,10 @@ const Jt = class Jt extends HTMLElement {
|
|
|
1206
1217
|
this.attachShadow({ mode: "open" }), b(this, K, new Nt(this));
|
|
1207
1218
|
}
|
|
1208
1219
|
connectedCallback() {
|
|
1209
|
-
b(this, Mt, new Dt(this)),
|
|
1220
|
+
b(this, Mt, new Dt(this)), H.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1210
1221
|
}
|
|
1211
1222
|
disconnectedCallback() {
|
|
1212
|
-
|
|
1223
|
+
H.log("NineTable disconnected.");
|
|
1213
1224
|
}
|
|
1214
1225
|
// ๐ฏ ์ธ๋ถ์์ grid.data.set(...) ํํ๋ก ์ ๊ทผํ ์ ์๋๋ก ๋ฐ์ดํฐ ๋งค๋์ ์คํ
|
|
1215
1226
|
get data() {
|