@ninebone/table 0.0.252 β 0.0.253
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 +40 -38
- 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 qe = class qe extends Pe.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
h(qe, "Trace");
|
|
24
24
|
let me = qe;
|
|
25
|
-
const
|
|
26
|
-
var
|
|
25
|
+
const L = new me();
|
|
26
|
+
var _, B, p, D, N, P, ie, V, se;
|
|
27
27
|
const ke = class ke extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
u(this,
|
|
30
|
+
u(this, _);
|
|
31
31
|
u(this, B, !1);
|
|
32
32
|
u(this, p);
|
|
33
33
|
u(this, D);
|
|
34
34
|
u(this, N);
|
|
35
35
|
u(this, P);
|
|
36
36
|
u(this, ie, /* @__PURE__ */ h(() => {
|
|
37
|
-
if (!e(this,
|
|
38
|
-
const t = e(this,
|
|
37
|
+
if (!e(this, _)) return;
|
|
38
|
+
const t = e(this, _).querySelector(".ng-container-body");
|
|
39
39
|
t && (y(this, P, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), e(this, P).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ h(() => {
|
|
44
|
-
if (!e(this,
|
|
44
|
+
if (!e(this, _) || !e(this, p) || e(this, B)) return;
|
|
45
45
|
const t = e(this, p).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = e(this, p).track, r = e(this, p).thumb, o = e(this,
|
|
47
|
+
const n = e(this, p).track, r = e(this, p).thumb, o = e(this, _).querySelector(".ng-container-bottom"), a = t.clientWidth, d = s.scrollWidth;
|
|
48
48
|
if (a !== 0 && d > a)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -59,7 +59,7 @@ const ke = class ke extends HTMLElement {
|
|
|
59
59
|
let b = 0;
|
|
60
60
|
g > 0 && (b = parseInt(f / g * (l - c), 10)), b < 0 && (b = 0);
|
|
61
61
|
const S = l - c;
|
|
62
|
-
b > S && (b = S), r.style.left = `${b}px`,
|
|
62
|
+
b > S && (b = S), r.style.left = `${b}px`, L.log(b), e(this, p).left.disabled = b === 0, e(this, p).right.disabled = b >= S - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
u(this, V, /* @__PURE__ */ h((t) => {
|
|
65
65
|
if (!e(this, p)) return !1;
|
|
@@ -113,7 +113,7 @@ const ke = class ke extends HTMLElement {
|
|
|
113
113
|
}, "#init"));
|
|
114
114
|
}
|
|
115
115
|
connectedCallback() {
|
|
116
|
-
if (y(this,
|
|
116
|
+
if (y(this, _, this.closest("nine-table-sheet") || this.getRootNode().host), !e(this, _)) return;
|
|
117
117
|
this.innerHTML = `
|
|
118
118
|
<style>
|
|
119
119
|
nine-table-hscrollbar {
|
|
@@ -178,7 +178,7 @@ const ke = class ke extends HTMLElement {
|
|
|
178
178
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
179
179
|
`;
|
|
180
180
|
const t = /* @__PURE__ */ h(() => {
|
|
181
|
-
const s = e(this,
|
|
181
|
+
const s = e(this, _).querySelector(".ng-container-body");
|
|
182
182
|
if (!s) {
|
|
183
183
|
setTimeout(t, 10);
|
|
184
184
|
return;
|
|
@@ -197,7 +197,7 @@ const ke = class ke extends HTMLElement {
|
|
|
197
197
|
e(this, P) && e(this, P).disconnect();
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
|
-
|
|
200
|
+
_ = new WeakMap(), B = new WeakMap(), p = new WeakMap(), D = new WeakMap(), N = new WeakMap(), P = new WeakMap(), ie = new WeakMap(), V = new WeakMap(), se = new WeakMap(), h(ke, "NineTableHScrollBar");
|
|
201
201
|
let we = ke;
|
|
202
202
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", we);
|
|
203
203
|
var $, I, R, W, H, M, ne, re, oe, le;
|
|
@@ -231,7 +231,7 @@ const Le = class Le {
|
|
|
231
231
|
const c = Math.max(r - o, 100);
|
|
232
232
|
if (e(this, H) !== c && (y(this, H, c), e(this, R) !== null)) {
|
|
233
233
|
const f = Math.ceil(e(this, H) / e(this, R));
|
|
234
|
-
y(this, M, f + 20),
|
|
234
|
+
y(this, M, f + 20), L.log(`[RowManager] Resized. Height: ${e(this, H)}px | Target Rows: ${e(this, M)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((g) => {
|
|
235
235
|
const b = s.querySelector(g);
|
|
236
236
|
b && b.querySelector("tbody") && e(this, le).call(this, b);
|
|
237
237
|
});
|
|
@@ -242,7 +242,7 @@ const Le = class Le {
|
|
|
242
242
|
}, "#initResizeObserver"));
|
|
243
243
|
// π― ν
νλ¦Ώ μΆμΆ, λμ΄ μΈ‘μ , μ΄κΈ° λ λλ§μ μμμ λ§κ² λ΄λΆμμ μΌκ΄ μ²λ¦¬
|
|
244
244
|
v(this, "initialize", /* @__PURE__ */ h((i) => {
|
|
245
|
-
|
|
245
|
+
L.log(i);
|
|
246
246
|
const t = e(this, $).querySelector(".ng-container-body"), s = i.querySelector("tbody"), n = Array.from(s.querySelectorAll("tr"));
|
|
247
247
|
y(this, I, n.map((r) => r.cloneNode(!0))), y(this, R, null), e(this, oe).call(this, t);
|
|
248
248
|
}, "initialize"));
|
|
@@ -310,12 +310,12 @@ const Le = class Le {
|
|
|
310
310
|
};
|
|
311
311
|
$ = new WeakMap(), I = new WeakMap(), R = new WeakMap(), W = new WeakMap(), H = new WeakMap(), M = new WeakMap(), ne = new WeakMap(), re = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), h(Le, "RowManager");
|
|
312
312
|
let xe = Le;
|
|
313
|
-
var A,
|
|
313
|
+
var A, F, G, U, ae, ce;
|
|
314
314
|
const j = class j extends HTMLElement {
|
|
315
315
|
constructor() {
|
|
316
316
|
super();
|
|
317
317
|
u(this, A, null);
|
|
318
|
-
u(this,
|
|
318
|
+
u(this, F);
|
|
319
319
|
/**
|
|
320
320
|
* π― 2μ°¨μ μ
격μ μΈλ±μ€λ₯Ό κ³μ°νμ¬ λ³ν©(`rowSpan`/`colSpan`) μ
μ μ λ μ»¬λΌ μμΉλ₯Ό λΆμ¬
|
|
321
321
|
*/
|
|
@@ -338,8 +338,8 @@ const j = class j extends HTMLElement {
|
|
|
338
338
|
}
|
|
339
339
|
const b = g.rowSpan || 1, S = g.colSpan || 1;
|
|
340
340
|
for (let x = 0; x < b; x++)
|
|
341
|
-
for (let
|
|
342
|
-
c + x < o && f +
|
|
341
|
+
for (let C = 0; C < S; C++)
|
|
342
|
+
c + x < o && f + C < a && (d[c + x][f + C] = x === 0 && C === 0 ? "1" : "0");
|
|
343
343
|
});
|
|
344
344
|
}), n.forEach((l) => {
|
|
345
345
|
const c = l.sectionRowIndex;
|
|
@@ -355,7 +355,7 @@ const j = class j extends HTMLElement {
|
|
|
355
355
|
/**
|
|
356
356
|
* π― μλ³Έ ν
μ΄λΈμ λΆμνμ¬ κ³ μ μ»¬λΌ μμλ³(left, body, right)λ‘ μλ²½νκ² μͺΌκ°μ§ ν
μ΄λΈ μμ±
|
|
357
357
|
*/
|
|
358
|
-
u(this,
|
|
358
|
+
u(this, U, /* @__PURE__ */ h((t, s) => {
|
|
359
359
|
const n = t.cloneNode(!0), r = n.querySelector("colgroup");
|
|
360
360
|
if (!r) return n;
|
|
361
361
|
const o = Array.from(r.querySelectorAll("col")), a = [];
|
|
@@ -376,10 +376,10 @@ const j = class j extends HTMLElement {
|
|
|
376
376
|
const s = /* @__PURE__ */ h((l) => {
|
|
377
377
|
const c = /* @__PURE__ */ h((g) => {
|
|
378
378
|
if (g.querySelector("colgroup")) return;
|
|
379
|
-
const b = g.querySelector("tbody tr") || g.querySelector("tr"), S = b ? b.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"),
|
|
379
|
+
const b = g.querySelector("tbody tr") || g.querySelector("tr"), S = b ? b.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), C = Math.max(Math.floor(g.clientWidth / S), 100);
|
|
380
380
|
for (let $e = 0; $e < S; $e++) {
|
|
381
381
|
const We = document.createElement("col");
|
|
382
|
-
We.setAttribute("width",
|
|
382
|
+
We.setAttribute("width", C), x.appendChild(We);
|
|
383
383
|
}
|
|
384
384
|
g.prepend(x);
|
|
385
385
|
}, "ensureColgroup"), f = /* @__PURE__ */ h((g) => {
|
|
@@ -394,14 +394,14 @@ const j = class j extends HTMLElement {
|
|
|
394
394
|
f && e(this, A).querySelectorAll(`[data-col="${c}"]`).forEach((g) => {
|
|
395
395
|
g.setAttribute("fixed", f);
|
|
396
396
|
});
|
|
397
|
-
}),
|
|
397
|
+
}), L.log(e(this, A));
|
|
398
398
|
const o = this.querySelector(".ng-container-left"), a = this.querySelector(".ng-container-body"), d = this.querySelector(".ng-container-right");
|
|
399
399
|
if (a) {
|
|
400
|
-
const l = e(this,
|
|
401
|
-
a.innerHTML = "", a.appendChild(l), e(this,
|
|
400
|
+
const l = e(this, U).call(this, e(this, A), null);
|
|
401
|
+
a.innerHTML = "", a.appendChild(l), e(this, F).initialize(e(this, A));
|
|
402
402
|
}
|
|
403
403
|
if (o) {
|
|
404
|
-
const l = e(this,
|
|
404
|
+
const l = e(this, U).call(this, e(this, A), "left");
|
|
405
405
|
let c = 0;
|
|
406
406
|
l.querySelectorAll("col").forEach((g) => {
|
|
407
407
|
const b = parseInt(g.getAttribute("width"), 10);
|
|
@@ -411,7 +411,7 @@ const j = class j extends HTMLElement {
|
|
|
411
411
|
o.style.flex = `0 0 ${f}px`, o.style.width = `${f}px`;
|
|
412
412
|
}
|
|
413
413
|
if (d) {
|
|
414
|
-
const l = e(this,
|
|
414
|
+
const l = e(this, U).call(this, e(this, A), "right");
|
|
415
415
|
let c = 0;
|
|
416
416
|
l.querySelectorAll("col").forEach((g) => {
|
|
417
417
|
const b = parseInt(g.getAttribute("width"), 10);
|
|
@@ -428,7 +428,7 @@ const j = class j extends HTMLElement {
|
|
|
428
428
|
(l = this.querySelector("nine-table-hscrollbar")) == null || l.refresh();
|
|
429
429
|
}, 0);
|
|
430
430
|
}, "generate"));
|
|
431
|
-
v(this, "getRowHeight", /* @__PURE__ */ h(() => e(this,
|
|
431
|
+
v(this, "getRowHeight", /* @__PURE__ */ h(() => e(this, F).getRowHeight(), "getRowHeight"));
|
|
432
432
|
v(this, "scrollToX", /* @__PURE__ */ h((t) => {
|
|
433
433
|
const s = this.querySelector(".ng-container-body");
|
|
434
434
|
s && (s.scrollLeft = t);
|
|
@@ -440,10 +440,10 @@ const j = class j extends HTMLElement {
|
|
|
440
440
|
u(this, ae, /* @__PURE__ */ h(() => {
|
|
441
441
|
const t = /* @__PURE__ */ h(() => {
|
|
442
442
|
var c, f, g;
|
|
443
|
-
|
|
443
|
+
L.log(":::::::::::::::");
|
|
444
444
|
const s = this.querySelector(".ng-container-left table"), n = this.querySelector(".ng-container-body table"), r = this.querySelector(".ng-container-right table");
|
|
445
|
-
if (!n) return;
|
|
446
|
-
|
|
445
|
+
if (L.log(n), !n) return;
|
|
446
|
+
L.log("22222");
|
|
447
447
|
const o = s ? Array.from(s.querySelectorAll("tr")) : [], a = Array.from(n.querySelectorAll("tr")), d = r ? Array.from(r.querySelectorAll("tr")) : [], l = Math.max(o.length, a.length, d.length);
|
|
448
448
|
for (let b = 0; b < l; b++) {
|
|
449
449
|
const S = [
|
|
@@ -451,10 +451,12 @@ const j = class j extends HTMLElement {
|
|
|
451
451
|
((f = a[b]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
452
452
|
((g = d[b]) == null ? void 0 : g.getBoundingClientRect().height) || 0
|
|
453
453
|
], x = Math.max(...S);
|
|
454
|
-
|
|
454
|
+
L.log(x), x > 0 && (o[b] && (o[b].style.height = `${x}px`), a[b] && (a[b].style.height = `${x}px`), d[b] && (d[b].style.height = `${x}px`));
|
|
455
455
|
}
|
|
456
456
|
}, "syncRowHeights");
|
|
457
|
-
e(this, ce).call(this),
|
|
457
|
+
e(this, ce).call(this), requestAnimationFrame(() => {
|
|
458
|
+
t();
|
|
459
|
+
}), new MutationObserver((s) => {
|
|
458
460
|
for (const n of s)
|
|
459
461
|
n.attributeName === "class" && this.classList.contains("active") && t();
|
|
460
462
|
}).observe(this, { attributes: !0 });
|
|
@@ -583,16 +585,16 @@ const j = class j extends HTMLElement {
|
|
|
583
585
|
</div>
|
|
584
586
|
`;
|
|
585
587
|
}, "#render"));
|
|
586
|
-
y(this,
|
|
588
|
+
y(this, F, new xe(this));
|
|
587
589
|
}
|
|
588
590
|
connectedCallback() {
|
|
589
591
|
e(this, ae).call(this);
|
|
590
592
|
}
|
|
591
593
|
disconnectedCallback() {
|
|
592
|
-
this.innerHTML = "",
|
|
594
|
+
this.innerHTML = "", L.log("NineTableSheet destroyed.");
|
|
593
595
|
}
|
|
594
596
|
};
|
|
595
|
-
A = new WeakMap(),
|
|
597
|
+
A = new WeakMap(), F = new WeakMap(), G = new WeakMap(), U = new WeakMap(), ae = new WeakMap(), ce = new WeakMap(), h(j, "NineTableSheet"), v(j, "SCROLLBAR_SIZE", 16);
|
|
596
598
|
let te = j;
|
|
597
599
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", te);
|
|
598
600
|
var he, J;
|
|
@@ -613,8 +615,8 @@ const Ce = class Ce extends HTMLElement {
|
|
|
613
615
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((b) => b.style.setProperty("display", "none"));
|
|
614
616
|
const g = c.filter((b) => b.classList.contains("active"));
|
|
615
617
|
g.length < 2 || g.forEach((b) => {
|
|
616
|
-
const S = parseInt(b.getAttribute("data-index"), 10), x = this.querySelector(`nine-splitter[data-split-index="${S}"]`),
|
|
617
|
-
x &&
|
|
618
|
+
const S = parseInt(b.getAttribute("data-index"), 10), x = this.querySelector(`nine-splitter[data-split-index="${S}"]`), C = c[S + 1];
|
|
619
|
+
x && C && C.classList.contains("active") && x.style.setProperty("display", "flex");
|
|
618
620
|
});
|
|
619
621
|
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), a = r.querySelectorAll(".nine-tab-item"), d = o.querySelectorAll("nine-table-sheet");
|
|
620
622
|
if (!a[t]) return;
|
|
@@ -978,10 +980,10 @@ const Me = class Me extends HTMLElement {
|
|
|
978
980
|
this.attachShadow({ mode: "open" }), y(this, Y, new Ae(this));
|
|
979
981
|
}
|
|
980
982
|
connectedCallback() {
|
|
981
|
-
y(this, pe, new Se(this)),
|
|
983
|
+
y(this, pe, new Se(this)), L.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
982
984
|
}
|
|
983
985
|
disconnectedCallback() {
|
|
984
|
-
|
|
986
|
+
L.log("NineTable disconnected.");
|
|
985
987
|
}
|
|
986
988
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
987
989
|
get data() {
|