@ninebone/table 0.0.391 โ 0.0.392
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 +43 -43
- 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,29 +22,29 @@ const re = class re extends Se.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(re, "Trace");
|
|
24
24
|
let jt = re;
|
|
25
|
-
const
|
|
26
|
-
var
|
|
25
|
+
const H = new jt();
|
|
26
|
+
var _, O, p, V, Y, X, St, U, Et;
|
|
27
27
|
const le = class le extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
c(this,
|
|
30
|
+
c(this, _);
|
|
31
31
|
c(this, O, !1);
|
|
32
32
|
c(this, p);
|
|
33
33
|
c(this, V);
|
|
34
34
|
c(this, Y);
|
|
35
35
|
c(this, X);
|
|
36
36
|
c(this, St, /* @__PURE__ */ a(() => {
|
|
37
|
-
if (!t(this,
|
|
38
|
-
const e = t(this,
|
|
37
|
+
if (!t(this, _)) return;
|
|
38
|
+
const e = t(this, _).querySelector(".ng-container-body");
|
|
39
39
|
e && (g(this, X, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), t(this, X).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!t(this,
|
|
44
|
+
if (!t(this, _) || !t(this, p) || t(this, O)) 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, r = t(this, p).thumb, o = t(this,
|
|
47
|
+
const n = t(this, p).track, r = t(this, p).thumb, o = t(this, _).querySelector(".ng-container-bottom"), l = e.clientWidth, d = s.scrollWidth;
|
|
48
48
|
if (l !== 0 && d > l)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -59,7 +59,7 @@ const le = class le extends HTMLElement {
|
|
|
59
59
|
let y = 0;
|
|
60
60
|
b > 0 && (y = parseInt(u / b * (h - f), 10)), y < 0 && (y = 0);
|
|
61
61
|
const m = h - f;
|
|
62
|
-
y > m && (y = m), r.style.left = `${y}px`,
|
|
62
|
+
y > m && (y = m), r.style.left = `${y}px`, H.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
c(this, U, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
@@ -112,7 +112,7 @@ const le = class le extends HTMLElement {
|
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (g(this,
|
|
115
|
+
if (g(this, _, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, _)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -177,7 +177,7 @@ const le = class le 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, _).querySelector(".ng-container-body");
|
|
181
181
|
if (!s) {
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
@@ -198,7 +198,7 @@ const le = class le extends HTMLElement {
|
|
|
198
198
|
t(this, X) && t(this, X).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
201
|
+
_ = new WeakMap(), O = new WeakMap(), p = new WeakMap(), V = new WeakMap(), Y = new WeakMap(), X = new WeakMap(), St = new WeakMap(), U = new WeakMap(), Et = new WeakMap(), a(le, "NineTableHScrollBar");
|
|
202
202
|
let Kt = le;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Kt);
|
|
204
204
|
var z, Q, D, S, ht, dt, Rt;
|
|
@@ -215,7 +215,7 @@ const ae = class ae extends HTMLElement {
|
|
|
215
215
|
* ๐ฏ ์คํฌ๋กค๋ฐ ์์น ๋ฐ ์ธ๋ธ ํฌ๊ธฐ ๊ฐฑ์
|
|
216
216
|
*/
|
|
217
217
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
218
|
-
if (!t(this, z) || !t(this, S) || t(this, D)) return;
|
|
218
|
+
if (H.log("refresh"), !t(this, z) || !t(this, S) || t(this, D)) return;
|
|
219
219
|
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, l = (t(this, z).data.get() || []).length, d = t(this, Q).getRowHeight(), h = l * d;
|
|
220
220
|
if (h <= r) {
|
|
221
221
|
n.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), n.style.top = `${m}px`,
|
|
233
|
+
m < 0 && (m = 0), m > R && (m = R), n.style.top = `${m}px`, H.log(m), t(this, S).top.disabled = b <= 0, t(this, S).bottom.disabled = b >= y - 1;
|
|
234
234
|
}, "refresh"));
|
|
235
235
|
c(this, Rt, /* @__PURE__ */ a(() => {
|
|
236
236
|
const e = t(this, S).container, s = /* @__PURE__ */ a(() => {
|
|
@@ -356,12 +356,12 @@ z = new WeakMap(), Q = new WeakMap(), D = new WeakMap(), S = new WeakMap(), ht =
|
|
|
356
356
|
let Zt = ae;
|
|
357
357
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", Zt);
|
|
358
358
|
var At, tt;
|
|
359
|
-
const
|
|
359
|
+
const M = class M {
|
|
360
360
|
/**
|
|
361
361
|
* ๐ฏ ๋ ์ด์์ ๋ด์ ์ฌ๋ฌ rawTables ๋ฐฐ์ด์ ์ผ๊ด๋ก ๋ฐ์ ๋จ์ผ ๋ง์คํฐ ํ
ํ๋ฆฟ์ผ๋ก ์ฌ์ ์ปดํ์ผํฉ๋๋ค.
|
|
362
362
|
*/
|
|
363
363
|
static compileAll(i) {
|
|
364
|
-
return Array.isArray(i) ? i.map((e) =>
|
|
364
|
+
return Array.isArray(i) ? i.map((e) => M.compile(e)) : [];
|
|
365
365
|
}
|
|
366
366
|
/**
|
|
367
367
|
* ๐ฏ ๋จ์ผ ์๋ณธ ํ
์ด๋ธ์ ๋ฐ์ ๊ธฐ๋ณธ ๊ตฌ์กฐ ๋ณด์ ๋ฐ 2์ฐจ์ ๊ฒฉ์ ์ธ๋ฑ์ค ์ฌ์ ๋ถ์ฌ ์๋ฃ๋ ๋ง์คํฐ ํ
์ด๋ธ ๋ฐํ
|
|
@@ -370,7 +370,7 @@ const H = class H {
|
|
|
370
370
|
var n, r, o, l;
|
|
371
371
|
if (!i) return null;
|
|
372
372
|
const e = i.cloneNode(!0);
|
|
373
|
-
return t(n =
|
|
373
|
+
return t(n = M, At).call(n, e), t(r = M, tt).call(r, e, "thead"), t(o = M, tt).call(o, e, "tbody"), t(l = M, tt).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((d, h) => {
|
|
374
374
|
const f = d.getAttribute("fixed");
|
|
375
375
|
f && e.querySelectorAll(`thead [data-col="${h}"], tbody [data-col="${h}"], tfoot [data-col="${h}"]`).forEach((u) => {
|
|
376
376
|
u.setAttribute("fixed", f);
|
|
@@ -378,7 +378,7 @@ const H = class H {
|
|
|
378
378
|
}), e;
|
|
379
379
|
}
|
|
380
380
|
};
|
|
381
|
-
At = new WeakMap(), tt = new WeakMap(), a(
|
|
381
|
+
At = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, At, /* @__PURE__ */ a((i) => {
|
|
382
382
|
if (!i.querySelector("colgroup")) {
|
|
383
383
|
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
384
384
|
for (let o = 0; o < s; o++) {
|
|
@@ -392,7 +392,7 @@ At = new WeakMap(), tt = new WeakMap(), a(H, "TableCompiler"), c(H, At, /* @__PU
|
|
|
392
392
|
s ? s.after(e) : i.prepend(e);
|
|
393
393
|
}
|
|
394
394
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
395
|
-
}, "#ensureTableStructure")), c(
|
|
395
|
+
}, "#ensureTableStructure")), c(M, tt, /* @__PURE__ */ a((i, e) => {
|
|
396
396
|
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
397
397
|
if (r === 0 || n.length === 0) return;
|
|
398
398
|
let o = 0;
|
|
@@ -425,13 +425,13 @@ At = new WeakMap(), tt = new WeakMap(), a(H, "TableCompiler"), c(H, At, /* @__PU
|
|
|
425
425
|
});
|
|
426
426
|
});
|
|
427
427
|
}, "#resetColIndex"));
|
|
428
|
-
let Gt =
|
|
429
|
-
var
|
|
428
|
+
let Gt = M;
|
|
429
|
+
var I, w, W, T, B, F, N, et, Tt, qt, kt, ft, ut, Lt, Ct, gt, Ht, it, bt;
|
|
430
430
|
const ce = class ce {
|
|
431
431
|
constructor(i) {
|
|
432
|
-
c(this,
|
|
432
|
+
c(this, I);
|
|
433
433
|
c(this, w);
|
|
434
|
-
c(this,
|
|
434
|
+
c(this, W, /* @__PURE__ */ new Map());
|
|
435
435
|
c(this, T, null);
|
|
436
436
|
c(this, B, null);
|
|
437
437
|
c(this, F, 0);
|
|
@@ -444,7 +444,7 @@ const ce = class ce {
|
|
|
444
444
|
i && (t(this, ft).call(this), t(this, it).call(this, i.scrollTop), (e = t(this, w).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
445
445
|
}, "refresh"));
|
|
446
446
|
v(this, "initialize", /* @__PURE__ */ a(() => {
|
|
447
|
-
g(this, T, null), t(this,
|
|
447
|
+
g(this, T, null), t(this, W).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
448
448
|
const r = t(this, w).querySelector(n);
|
|
449
449
|
if (!r) return;
|
|
450
450
|
const o = r.querySelector("table");
|
|
@@ -452,7 +452,7 @@ const ce = class ce {
|
|
|
452
452
|
const l = o.querySelector("tbody.bindable-tbody");
|
|
453
453
|
if (!l) return;
|
|
454
454
|
const h = Array.from(l.querySelectorAll("tr")).map((f) => f.cloneNode(!0));
|
|
455
|
-
t(this,
|
|
455
|
+
t(this, W).set(n, h);
|
|
456
456
|
});
|
|
457
457
|
const i = t(this, w).querySelector(".ng-container-body"), e = t(this, w).querySelector(".ng-container-left"), s = t(this, w).querySelector(".ng-container-right");
|
|
458
458
|
if (i) {
|
|
@@ -469,7 +469,7 @@ const ce = class ce {
|
|
|
469
469
|
}
|
|
470
470
|
}, "initialize"));
|
|
471
471
|
c(this, qt, /* @__PURE__ */ a((i, e) => {
|
|
472
|
-
const s = t(this,
|
|
472
|
+
const s = t(this, W).get(e);
|
|
473
473
|
if (!s || s.length === 0) return;
|
|
474
474
|
const n = i.querySelector("tbody.bindable-tbody");
|
|
475
475
|
if (!n) return;
|
|
@@ -484,7 +484,7 @@ const ce = class ce {
|
|
|
484
484
|
c(this, kt, /* @__PURE__ */ a((i) => {
|
|
485
485
|
if (t(this, T) !== null && t(this, T) > 0)
|
|
486
486
|
return t(this, T);
|
|
487
|
-
const e = t(this,
|
|
487
|
+
const e = t(this, W).get(".ng-container-body");
|
|
488
488
|
if (!e || e.length === 0) return 24;
|
|
489
489
|
const s = i.querySelector("tbody.bindable-tbody") || i.querySelector("tbody.bindable-tbody:last-of-type");
|
|
490
490
|
if (!s) return 24;
|
|
@@ -503,16 +503,16 @@ const ce = class ce {
|
|
|
503
503
|
}, "#measureAndCacheHeight"));
|
|
504
504
|
c(this, ft, /* @__PURE__ */ a(() => {
|
|
505
505
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
506
|
-
const s = (t(this,
|
|
507
|
-
|
|
506
|
+
const s = (t(this, I).data.get() || []).length, n = t(this, T) || 24, r = s * n;
|
|
507
|
+
H.log(`[VirtualHeight] totalCount: ${s}, rowHeight: ${n}, totalVirtualHeight: ${r}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
508
508
|
const l = t(this, w).querySelector(o), d = l == null ? void 0 : l.querySelector("table");
|
|
509
509
|
d && (d.style.height = `${r}px`);
|
|
510
510
|
});
|
|
511
511
|
}, "#updateVirtualScrollHeight"));
|
|
512
512
|
c(this, ut, /* @__PURE__ */ a(() => {
|
|
513
|
-
if ((t(this,
|
|
513
|
+
if ((t(this, I).data.get() || []).length, t(this, F) > 0 && t(this, T) > 0) {
|
|
514
514
|
const e = Math.ceil(t(this, F) / t(this, T));
|
|
515
|
-
g(this, N, e + t(this, Tt)),
|
|
515
|
+
g(this, N, e + t(this, Tt)), H.log("visibleRows:", e, "cachedRowCount:", t(this, N));
|
|
516
516
|
}
|
|
517
517
|
}, "#updateRowCount"));
|
|
518
518
|
c(this, Lt, /* @__PURE__ */ a(() => {
|
|
@@ -558,14 +558,14 @@ const ce = class ce {
|
|
|
558
558
|
if (!s) return;
|
|
559
559
|
const n = s.querySelector("tbody.bindable-tbody");
|
|
560
560
|
if (!n) return;
|
|
561
|
-
const r = Array.from(n.querySelectorAll("tr:not(.nodata)")), o = ((h = t(this,
|
|
561
|
+
const r = Array.from(n.querySelectorAll("tr:not(.nodata)")), o = ((h = t(this, W).get(e)) == null ? void 0 : h.length) || 1, d = (t(this, I).data.get() || []).length;
|
|
562
562
|
r.forEach((f, u) => {
|
|
563
563
|
const b = i + Math.floor(u / o);
|
|
564
564
|
if (b >= d) {
|
|
565
565
|
f.style.display = "none";
|
|
566
566
|
return;
|
|
567
567
|
}
|
|
568
|
-
const y = t(this,
|
|
568
|
+
const y = t(this, I).data.get(b);
|
|
569
569
|
f.style.display = "", t(this, bt).call(this, f, y, b);
|
|
570
570
|
});
|
|
571
571
|
});
|
|
@@ -574,8 +574,8 @@ const ce = class ce {
|
|
|
574
574
|
var d;
|
|
575
575
|
const e = t(this, T);
|
|
576
576
|
if (!e || e <= 0) return;
|
|
577
|
-
const n = (t(this,
|
|
578
|
-
|
|
577
|
+
const n = (t(this, I).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, W).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this, N);
|
|
578
|
+
H.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) => {
|
|
579
579
|
const f = t(this, w).querySelector(h);
|
|
580
580
|
if (!f) return;
|
|
581
581
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
@@ -586,7 +586,7 @@ const ce = class ce {
|
|
|
586
586
|
y.style.display = "none";
|
|
587
587
|
return;
|
|
588
588
|
}
|
|
589
|
-
const J = t(this,
|
|
589
|
+
const J = t(this, I).data.get(R);
|
|
590
590
|
y.style.display = "", t(this, bt).call(this, y, J, R);
|
|
591
591
|
});
|
|
592
592
|
}), t(this, et) || (g(this, et, !0), setTimeout(() => {
|
|
@@ -602,17 +602,17 @@ const ce = class ce {
|
|
|
602
602
|
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
603
603
|
t(this, B) && (t(this, B).disconnect(), g(this, B, null));
|
|
604
604
|
}, "destroy"));
|
|
605
|
-
g(this,
|
|
605
|
+
g(this, I, i.getRootNode().host), g(this, w, i), t(this, Ct).call(this);
|
|
606
606
|
}
|
|
607
607
|
getRowHeight() {
|
|
608
608
|
return t(this, T);
|
|
609
609
|
}
|
|
610
610
|
templateLength(i = ".ng-container-body") {
|
|
611
611
|
var e;
|
|
612
|
-
return ((e = t(this,
|
|
612
|
+
return ((e = t(this, W).get(i)) == null ? void 0 : e.length) || 1;
|
|
613
613
|
}
|
|
614
614
|
};
|
|
615
|
-
|
|
615
|
+
I = new WeakMap(), w = new WeakMap(), W = new WeakMap(), T = new WeakMap(), B = new WeakMap(), F = new WeakMap(), N = new WeakMap(), et = new WeakMap(), Tt = new WeakMap(), qt = new WeakMap(), kt = new WeakMap(), ft = new WeakMap(), ut = new WeakMap(), Lt = new WeakMap(), Ct = new WeakMap(), gt = new WeakMap(), Ht = new WeakMap(), it = new WeakMap(), bt = new WeakMap(), a(ce, "RowManager");
|
|
616
616
|
let Jt = ce;
|
|
617
617
|
var Mt, st, j, _t, $t, It, Wt, Ot;
|
|
618
618
|
const ct = class ct extends HTMLElement {
|
|
@@ -845,7 +845,7 @@ const ct = class ct extends HTMLElement {
|
|
|
845
845
|
t(this, Wt).call(this);
|
|
846
846
|
}
|
|
847
847
|
disconnectedCallback() {
|
|
848
|
-
this.innerHTML = "",
|
|
848
|
+
this.innerHTML = "", H.log("NineTableSheet destroyed.");
|
|
849
849
|
}
|
|
850
850
|
};
|
|
851
851
|
Mt = new WeakMap(), st = new WeakMap(), j = 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);
|
|
@@ -1234,11 +1234,11 @@ const ge = class ge {
|
|
|
1234
1234
|
}), 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);
|
|
1235
1235
|
}, "#adjust"));
|
|
1236
1236
|
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1237
|
-
g(this, A, []),
|
|
1237
|
+
g(this, A, []), H.log(t(this, lt).querySelectorAll("table"));
|
|
1238
1238
|
const i = Array.from(t(this, lt).querySelectorAll("table"));
|
|
1239
1239
|
if (!(!i || i.length === 0)) {
|
|
1240
1240
|
for (const e of i)
|
|
1241
|
-
|
|
1241
|
+
H.log(e), $("[data-bind]", e).each((s, n) => {
|
|
1242
1242
|
const r = n.dataset.bind, o = n.getAttribute("data-type") || "string";
|
|
1243
1243
|
r && t(this, A).push({ name: r, type: o });
|
|
1244
1244
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1297,7 +1297,7 @@ const be = class be extends HTMLElement {
|
|
|
1297
1297
|
c(this, G);
|
|
1298
1298
|
c(this, Ut);
|
|
1299
1299
|
c(this, Ft, /* @__PURE__ */ a(() => {
|
|
1300
|
-
this.fields = new ne(this), g(this, Ut, new te(this)),
|
|
1300
|
+
this.fields = new ne(this), g(this, Ut, new te(this)), H.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1301
1301
|
}, "#init"));
|
|
1302
1302
|
this.attachShadow({ mode: "open" }), g(this, G, new se(this));
|
|
1303
1303
|
}
|
|
@@ -1305,7 +1305,7 @@ const be = class be extends HTMLElement {
|
|
|
1305
1305
|
t(this, Ft).call(this);
|
|
1306
1306
|
}
|
|
1307
1307
|
disconnectedCallback() {
|
|
1308
|
-
|
|
1308
|
+
H.log("NineTable disconnected.");
|
|
1309
1309
|
}
|
|
1310
1310
|
// ๐ฏ ์ธ๋ถ์์ grid.data.set(...) ํํ๋ก ์ ๊ทผํ ์ ์๋๋ก ๋ฐ์ดํฐ ๋งค๋์ ์คํ
|
|
1311
1311
|
get data() {
|