@ninebone/table 0.0.510 β 0.0.511
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 +41 -39
- 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 Le = class Le extends Xe.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
h(Le, "Trace");
|
|
24
24
|
let oe = Le;
|
|
25
|
-
const
|
|
26
|
-
var
|
|
25
|
+
const O = new oe();
|
|
26
|
+
var z, j, w, X, K, Z, It, G, _t;
|
|
27
27
|
const He = class He extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
d(this,
|
|
30
|
+
d(this, z);
|
|
31
31
|
d(this, j, !1);
|
|
32
32
|
d(this, w);
|
|
33
33
|
d(this, X);
|
|
34
34
|
d(this, K);
|
|
35
35
|
d(this, Z);
|
|
36
36
|
d(this, It, /* @__PURE__ */ h(() => {
|
|
37
|
-
if (!t(this,
|
|
38
|
-
const e = t(this,
|
|
37
|
+
if (!t(this, z)) return;
|
|
38
|
+
const e = t(this, z).querySelector(".ng-container-body .ng-part-body");
|
|
39
39
|
e && (y(this, Z, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), t(this, Z).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
44
|
-
if (!t(this,
|
|
44
|
+
if (!t(this, z) || !t(this, w) || t(this, j)) return;
|
|
45
45
|
const e = t(this, w).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const r = t(this, w).track, n = t(this, w).thumb, o = t(this,
|
|
47
|
+
const r = t(this, w).track, n = t(this, w).thumb, o = t(this, z).querySelector(".ng-container-bottom"), a = e.clientWidth, c = s.scrollWidth;
|
|
48
48
|
if (a !== 0 && c > a)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -112,7 +112,7 @@ const He = class He extends HTMLElement {
|
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (y(this,
|
|
115
|
+
if (y(this, z, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, z)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -177,7 +177,7 @@ const He = class He extends HTMLElement {
|
|
|
177
177
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
178
178
|
`;
|
|
179
179
|
const e = /* @__PURE__ */ h(() => {
|
|
180
|
-
const s = t(this,
|
|
180
|
+
const s = t(this, z).querySelector(".ng-container-body .ng-part-body");
|
|
181
181
|
if (!s) {
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
@@ -198,7 +198,7 @@ const He = class He extends HTMLElement {
|
|
|
198
198
|
t(this, Z) && t(this, Z).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
201
|
+
z = new WeakMap(), j = new WeakMap(), w = new WeakMap(), X = new WeakMap(), K = new WeakMap(), Z = new WeakMap(), It = new WeakMap(), G = new WeakMap(), _t = new WeakMap(), h(He, "NineTableHScrollBar");
|
|
202
202
|
let ae = He;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ae);
|
|
204
204
|
var F, ot, J, q, xt, vt, Nt;
|
|
@@ -213,6 +213,7 @@ const Me = class Me extends HTMLElement {
|
|
|
213
213
|
d(this, vt, 0);
|
|
214
214
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
215
215
|
if (!t(this, F) || !t(this, q)) return;
|
|
216
|
+
O.log("nine-table-vscrollbar.refresh");
|
|
216
217
|
const e = t(this, q).container, s = t(this, q).track, r = t(this, q).thumb, n = e.clientHeight, a = (t(this, F).data.get() || []).length, c = t(this, ot).getRowHeight(), l = a * c;
|
|
217
218
|
if (l <= n) {
|
|
218
219
|
r.style.display = "none", t(this, q).top.disabled = !0, t(this, q).bottom.disabled = !0;
|
|
@@ -230,6 +231,7 @@ const Me = class Me extends HTMLElement {
|
|
|
230
231
|
m < 0 && (m = 0), m > v && (m = v), r.style.top = `${m}px`, t(this, q).top.disabled = b <= 0, t(this, q).bottom.disabled = b >= g - 1;
|
|
231
232
|
}, "refresh"));
|
|
232
233
|
d(this, Nt, /* @__PURE__ */ h(() => {
|
|
234
|
+
O.log("nine-table-vscrollbar.#init");
|
|
233
235
|
const e = t(this, q).container, s = /* @__PURE__ */ h(() => {
|
|
234
236
|
const n = (t(this, F).data.get() || []).length, o = t(this, ot).getRowHeight();
|
|
235
237
|
return n * o;
|
|
@@ -353,12 +355,12 @@ const Me = class Me extends HTMLElement {
|
|
|
353
355
|
F = new WeakMap(), ot = new WeakMap(), J = new WeakMap(), q = new WeakMap(), xt = new WeakMap(), vt = new WeakMap(), Nt = new WeakMap(), h(Me, "NineTableVScrollBar");
|
|
354
356
|
let le = Me;
|
|
355
357
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", le);
|
|
356
|
-
var
|
|
358
|
+
var P, S, D, M, V, Q, wt, Se, at, Wt, Ot, Bt, St, Et, zt, Dt, At, Ee, lt, Rt, Pt;
|
|
357
359
|
const $e = class $e {
|
|
358
360
|
constructor(i) {
|
|
359
|
-
d(this,
|
|
361
|
+
d(this, P);
|
|
360
362
|
d(this, S);
|
|
361
|
-
d(this,
|
|
363
|
+
d(this, D, /* @__PURE__ */ new Map());
|
|
362
364
|
d(this, M, null);
|
|
363
365
|
d(this, V, null);
|
|
364
366
|
d(this, Q, 0);
|
|
@@ -367,14 +369,14 @@ const $e = class $e {
|
|
|
367
369
|
d(this, at, !1);
|
|
368
370
|
d(this, Wt, 3);
|
|
369
371
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
370
|
-
|
|
372
|
+
O.log("rowManager.refresh");
|
|
371
373
|
const i = t(this, S).querySelector(".ng-container-body .ng-part-body");
|
|
372
374
|
i && (t(this, St).call(this), setTimeout(() => {
|
|
373
375
|
t(this, lt).call(this, i.scrollTop);
|
|
374
376
|
}, 500));
|
|
375
377
|
}, "refresh"));
|
|
376
378
|
A(this, "initialize", /* @__PURE__ */ h(() => {
|
|
377
|
-
y(this, M, null), t(this,
|
|
379
|
+
y(this, M, null), t(this, D).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
378
380
|
const a = t(this, S).querySelector(o);
|
|
379
381
|
if (!a) return;
|
|
380
382
|
const c = a.querySelector(".ng-part-body table");
|
|
@@ -382,7 +384,7 @@ const $e = class $e {
|
|
|
382
384
|
const l = c.querySelector("tbody.bindable-tbody");
|
|
383
385
|
if (!l) return;
|
|
384
386
|
const u = Array.from(l.querySelectorAll("tr")).map((b) => b.cloneNode(!0));
|
|
385
|
-
t(this,
|
|
387
|
+
t(this, D).set(o, u);
|
|
386
388
|
});
|
|
387
389
|
const i = t(this, S).querySelector(".ng-container-body .ng-part-body"), e = t(this, S).querySelector(".ng-container-left .ng-part-body"), s = t(this, S).querySelector(".ng-container-right .ng-part-body"), r = t(this, S).querySelector(".ng-container-body .ng-part-header"), n = t(this, S).querySelector(".ng-container-body .ng-part-footer");
|
|
388
390
|
if (i) {
|
|
@@ -402,7 +404,7 @@ const $e = class $e {
|
|
|
402
404
|
}
|
|
403
405
|
}, "initialize"));
|
|
404
406
|
d(this, Ot, /* @__PURE__ */ h((i, e) => {
|
|
405
|
-
const s = t(this,
|
|
407
|
+
const s = t(this, D).get(e);
|
|
406
408
|
if (!s || s.length === 0) return;
|
|
407
409
|
const r = i.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
408
410
|
if (!r) return;
|
|
@@ -417,8 +419,8 @@ const $e = class $e {
|
|
|
417
419
|
d(this, Bt, /* @__PURE__ */ h((i) => {
|
|
418
420
|
if (t(this, M) !== null && t(this, M) > 0)
|
|
419
421
|
return t(this, M);
|
|
420
|
-
|
|
421
|
-
const e = t(this,
|
|
422
|
+
O.log("#measureAndCacheHeight");
|
|
423
|
+
const e = t(this, D).get(".ng-container-body");
|
|
422
424
|
if (!e || e.length === 0) return 24;
|
|
423
425
|
const s = i.querySelector("tbody.bindable-tbody");
|
|
424
426
|
if (!s) return 24;
|
|
@@ -436,7 +438,7 @@ const $e = class $e {
|
|
|
436
438
|
}), u.forEach((b) => b.remove()), o.style.display = a, o.style.visibility = c, o.style.position = l, y(this, M, f > 0 ? f : 24), t(this, Et).call(this), t(this, M);
|
|
437
439
|
}, "#measureAndCacheHeight"));
|
|
438
440
|
d(this, St, /* @__PURE__ */ h(() => {
|
|
439
|
-
const e = (t(this,
|
|
441
|
+
const e = (t(this, P).data.get() || []).length, s = t(this, M), r = e * s;
|
|
440
442
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
441
443
|
const o = t(this, S).querySelector(n);
|
|
442
444
|
if (!o) return;
|
|
@@ -506,14 +508,14 @@ const $e = class $e {
|
|
|
506
508
|
if (!s) return;
|
|
507
509
|
const r = s.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
508
510
|
if (!r) return;
|
|
509
|
-
const n = Array.from(r.querySelectorAll("tr:not(.nodata)")), o = ((l = t(this,
|
|
511
|
+
const n = Array.from(r.querySelectorAll("tr:not(.nodata)")), o = ((l = t(this, D).get(e)) == null ? void 0 : l.length) || 1, c = (t(this, P).data.get() || []).length;
|
|
510
512
|
n.forEach((f, u) => {
|
|
511
513
|
const b = i + Math.floor(u / o);
|
|
512
514
|
if (b >= c) {
|
|
513
515
|
f.style.display = "none";
|
|
514
516
|
return;
|
|
515
517
|
}
|
|
516
|
-
const g = t(this,
|
|
518
|
+
const g = t(this, P).data.get(b);
|
|
517
519
|
f.style.display = "", t(this, Rt).call(this, f, g, b);
|
|
518
520
|
});
|
|
519
521
|
});
|
|
@@ -522,13 +524,13 @@ const $e = class $e {
|
|
|
522
524
|
var u;
|
|
523
525
|
const e = t(this, M);
|
|
524
526
|
if (!e || e <= 0) return;
|
|
525
|
-
const r = (t(this,
|
|
527
|
+
const r = (t(this, P).data.get() || []).length, n = Math.max(0, Math.floor(i / e)), o = n * e, a = ((u = t(this, D).get(".ng-container-body")) == null ? void 0 : u.length) || 1, c = t(this, S).querySelector(".ng-container-body"), l = c == null ? void 0 : c.querySelector(".ng-part-body tbody.bindable-tbody tr:not(.nodata)"), f = l && l.dataset.row !== void 0 ? parseInt(l.dataset.row, 10) : -1;
|
|
526
528
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((b) => {
|
|
527
529
|
const g = t(this, S).querySelector(b);
|
|
528
530
|
if (!g) return;
|
|
529
531
|
const m = g.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
530
532
|
m && (m.style.transform = `translateY(${o}px)`);
|
|
531
|
-
}),
|
|
533
|
+
}), O.log("#handleScroll", f, n), f !== n && [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((b) => {
|
|
532
534
|
const g = t(this, S).querySelector(b);
|
|
533
535
|
if (!g) return;
|
|
534
536
|
const m = g.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -539,7 +541,7 @@ const $e = class $e {
|
|
|
539
541
|
E.style.display = "none";
|
|
540
542
|
return;
|
|
541
543
|
}
|
|
542
|
-
const k = t(this,
|
|
544
|
+
const k = t(this, P).data.get(H);
|
|
543
545
|
E.style.display = "", t(this, Rt).call(this, E, k, H);
|
|
544
546
|
});
|
|
545
547
|
});
|
|
@@ -582,17 +584,17 @@ const $e = class $e {
|
|
|
582
584
|
A(this, "destroy", /* @__PURE__ */ h(() => {
|
|
583
585
|
t(this, V) && (t(this, V).disconnect(), y(this, V, null));
|
|
584
586
|
}, "destroy"));
|
|
585
|
-
y(this,
|
|
587
|
+
y(this, P, i.getRootNode().host), y(this, S, i), t(this, Dt).call(this);
|
|
586
588
|
}
|
|
587
589
|
getRowHeight() {
|
|
588
590
|
return t(this, M);
|
|
589
591
|
}
|
|
590
592
|
templateLength(i = ".ng-container-body") {
|
|
591
593
|
var e;
|
|
592
|
-
return ((e = t(this,
|
|
594
|
+
return ((e = t(this, D).get(i)) == null ? void 0 : e.length) || 1;
|
|
593
595
|
}
|
|
594
596
|
};
|
|
595
|
-
|
|
597
|
+
P = new WeakMap(), S = new WeakMap(), D = new WeakMap(), M = new WeakMap(), V = new WeakMap(), Q = new WeakMap(), wt = new WeakMap(), Se = new WeakMap(), at = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(), Bt = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), zt = new WeakMap(), Dt = new WeakMap(), At = new WeakMap(), Ee = new WeakMap(), lt = new WeakMap(), Rt = new WeakMap(), Pt = new WeakMap(), h($e, "RowManager");
|
|
596
598
|
let ce = $e;
|
|
597
599
|
const jt = class jt {
|
|
598
600
|
/**
|
|
@@ -641,15 +643,15 @@ const jt = class jt {
|
|
|
641
643
|
const v = m.sectionRowIndex;
|
|
642
644
|
let E = 0;
|
|
643
645
|
Array.from(m.querySelectorAll("th,td")).forEach((x) => {
|
|
644
|
-
for (let
|
|
645
|
-
if (g[v][
|
|
646
|
-
E =
|
|
646
|
+
for (let B = 0; B < g[v].length; B++)
|
|
647
|
+
if (g[v][B] === null) {
|
|
648
|
+
E = B;
|
|
647
649
|
break;
|
|
648
650
|
}
|
|
649
651
|
const H = x.rowSpan || 1, k = x.colSpan || 1;
|
|
650
|
-
for (let
|
|
652
|
+
for (let B = 0; B < H; B++)
|
|
651
653
|
for (let yt = 0; yt < k; yt++)
|
|
652
|
-
v +
|
|
654
|
+
v + B < u && E + yt < b && (g[v + B][E + yt] = B === 0 && yt === 0 ? "1" : "0");
|
|
653
655
|
});
|
|
654
656
|
}), l.forEach((m) => {
|
|
655
657
|
const v = m.sectionRowIndex;
|
|
@@ -898,7 +900,7 @@ const pt = class pt extends HTMLElement {
|
|
|
898
900
|
t(this, Ut).call(this);
|
|
899
901
|
}
|
|
900
902
|
disconnectedCallback() {
|
|
901
|
-
this.innerHTML = "",
|
|
903
|
+
this.innerHTML = "", O.log("NineTableSheet destroyed.");
|
|
902
904
|
}
|
|
903
905
|
};
|
|
904
906
|
Ft = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), ct = new WeakMap(), Ut = new WeakMap(), Xt = new WeakMap(), h(pt, "NineTableSheet"), A(pt, "SCROLLBAR_SIZE", 16);
|
|
@@ -1287,11 +1289,11 @@ const Oe = class Oe {
|
|
|
1287
1289
|
}), 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);
|
|
1288
1290
|
}, "#adjust"));
|
|
1289
1291
|
d(this, se, /* @__PURE__ */ h(() => {
|
|
1290
|
-
y(this, L, []),
|
|
1292
|
+
y(this, L, []), O.log(t(this, ut).querySelectorAll("table"));
|
|
1291
1293
|
const i = Array.from(t(this, ut).querySelectorAll("table"));
|
|
1292
1294
|
if (!(!i || i.length === 0)) {
|
|
1293
1295
|
for (const e of i)
|
|
1294
|
-
|
|
1296
|
+
O.log(e), $("[data-bind]", e).each((s, r) => {
|
|
1295
1297
|
const n = r.dataset.bind, o = r.getAttribute("data-type") || "string";
|
|
1296
1298
|
n && t(this, L).push({ name: n, type: o });
|
|
1297
1299
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1350,7 +1352,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1350
1352
|
d(this, rt);
|
|
1351
1353
|
d(this, ie);
|
|
1352
1354
|
d(this, re, /* @__PURE__ */ h(() => {
|
|
1353
|
-
this.fields = new ye(this), y(this, ie, new fe(this)),
|
|
1355
|
+
this.fields = new ye(this), y(this, ie, new fe(this)), O.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1354
1356
|
}, "#init"));
|
|
1355
1357
|
this.attachShadow({ mode: "open" }), y(this, rt, new be(this));
|
|
1356
1358
|
}
|
|
@@ -1358,7 +1360,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1358
1360
|
t(this, re).call(this);
|
|
1359
1361
|
}
|
|
1360
1362
|
disconnectedCallback() {
|
|
1361
|
-
|
|
1363
|
+
O.log("NineTable disconnected.");
|
|
1362
1364
|
}
|
|
1363
1365
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1364
1366
|
get data() {
|
|
@@ -1512,7 +1514,7 @@ const Pe = class Pe extends ve {
|
|
|
1512
1514
|
d(this, U);
|
|
1513
1515
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
1514
1516
|
const e = super.refresh();
|
|
1515
|
-
|
|
1517
|
+
O.log("::", e), t(this, Mt).value = e;
|
|
1516
1518
|
}, "refresh"));
|
|
1517
1519
|
/**
|
|
1518
1520
|
dataRefresh = (v) => {
|