@ninebone/table 0.0.806 β 0.0.807
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 +38 -39
- 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
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var ps = Object.defineProperty;
|
|
2
|
-
var ys = (
|
|
3
|
-
throw TypeError(
|
|
2
|
+
var ys = (q) => {
|
|
3
|
+
throw TypeError(q);
|
|
4
4
|
};
|
|
5
|
-
var vs = (
|
|
6
|
-
var h = (
|
|
7
|
-
var E = (
|
|
8
|
-
var t = (
|
|
9
|
-
var ms = (
|
|
5
|
+
var vs = (q, s, e) => s in q ? ps(q, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : q[s] = e;
|
|
6
|
+
var h = (q, s) => ps(q, "name", { value: s, configurable: !0 });
|
|
7
|
+
var E = (q, s, e) => vs(q, typeof s != "symbol" ? s + "" : s, e), Ee = (q, s, e) => s.has(q) || ys("Cannot " + e);
|
|
8
|
+
var t = (q, s, e) => (Ee(q, s, "read from private field"), e ? e.call(q) : s.get(q)), d = (q, s, e) => s.has(q) ? ys("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(q) : s.set(q, e), y = (q, s, e, n) => (Ee(q, s, "write to private field"), n ? n.call(q, e) : s.set(q, e), e), V = (q, s, e) => (Ee(q, s, "access private method"), e);
|
|
9
|
+
var ms = (q, s, e, n) => ({
|
|
10
10
|
set _(r) {
|
|
11
|
-
y(
|
|
11
|
+
y(q, s, r, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return t(
|
|
14
|
+
return t(q, s, n);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
import { trace as Ss } from "@ninebone/util";
|
|
@@ -22,7 +22,7 @@ const Qe = class Qe extends Ss.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
h(Qe, "Trace");
|
|
24
24
|
let qe = Qe;
|
|
25
|
-
const
|
|
25
|
+
const C = new qe();
|
|
26
26
|
var j, K, A, Q, tt, et, Zt, st, Jt;
|
|
27
27
|
const ts = class ts extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -69,7 +69,7 @@ const ts = class ts extends HTMLElement {
|
|
|
69
69
|
let a = e;
|
|
70
70
|
a < 0 && (a = 0);
|
|
71
71
|
const c = i.width - o;
|
|
72
|
-
a > c && (a = c), a = parseInt(a, 10), t(this, A).thumb.style.left = `${a}px`,
|
|
72
|
+
a > c && (a = c), a = parseInt(a, 10), t(this, A).thumb.style.left = `${a}px`, C.log("1111=========="), t(this, A).left.disabled = a === 0, t(this, A).right.disabled = a >= c - 1;
|
|
73
73
|
const l = n.clientWidth, f = r.scrollWidth - l;
|
|
74
74
|
return c > 0 && f > 0 && (n.scrollLeft = a / c * f), a > 0 && a < c - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
@@ -212,7 +212,7 @@ const es = class es extends HTMLElement {
|
|
|
212
212
|
d(this, kt, 0);
|
|
213
213
|
d(this, Lt, 0);
|
|
214
214
|
E(this, "refresh", /* @__PURE__ */ h(() => {
|
|
215
|
-
if (
|
|
215
|
+
if (!t(this, nt) || !t(this, k)) return;
|
|
216
216
|
const e = t(this, k).container, n = t(this, k).track, r = t(this, k).thumb, i = e.clientHeight, o = t(this, nt).data.length, a = t(this, rt).getRowHeight(), c = o * a;
|
|
217
217
|
if (c <= i || o === 0) {
|
|
218
218
|
this.style.display = "none";
|
|
@@ -224,14 +224,13 @@ const es = class es extends HTMLElement {
|
|
|
224
224
|
const g = Math.max(Math.min(l * (i / c), l), 20);
|
|
225
225
|
r.style.height = `${g}px`;
|
|
226
226
|
const f = e.scrollTop, b = Math.max(c - i, 1);
|
|
227
|
-
q.log(e, f, b);
|
|
228
227
|
let u = 0;
|
|
229
228
|
b > 0 && (u = f / b * (l - g));
|
|
230
229
|
const p = l - g;
|
|
231
230
|
u < 0 && (u = 0), u > p && (u = p), r.style.top = `${u}px`, t(this, k).top.disabled = f <= 0, t(this, k).bottom.disabled = f >= b - 1;
|
|
232
231
|
}, "refresh"));
|
|
233
232
|
d(this, Qt, /* @__PURE__ */ h(() => {
|
|
234
|
-
|
|
233
|
+
C.log("nine-table-vscrollbar.#init");
|
|
235
234
|
const e = t(this, k).container, n = /* @__PURE__ */ h(() => {
|
|
236
235
|
const i = (t(this, nt).data.get() || []).length, o = t(this, rt).getRowHeight();
|
|
237
236
|
return i * o;
|
|
@@ -370,12 +369,12 @@ const ss = class ss {
|
|
|
370
369
|
d(this, te, 3);
|
|
371
370
|
E(this, "refresh", /* @__PURE__ */ h(() => {
|
|
372
371
|
var e;
|
|
373
|
-
|
|
372
|
+
C.log("rowManager.refresh");
|
|
374
373
|
const s = t(this, R).querySelector(".ng-container-body .ng-part-body");
|
|
375
374
|
s && (t(this, Mt).call(this), t(this, Ht).call(this), t(this, mt).call(this, s.scrollTop), (e = t(this, R).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
376
375
|
}, "refresh"));
|
|
377
376
|
E(this, "initialize", /* @__PURE__ */ h(() => {
|
|
378
|
-
|
|
377
|
+
C.log("rowManager.initialize"), y(this, it, {
|
|
379
378
|
scrollTables: t(this, R).querySelectorAll(".ng-part-body table"),
|
|
380
379
|
firstTr: t(this, R).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")
|
|
381
380
|
}), y(this, O, null), t(this, Y).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
@@ -412,7 +411,7 @@ const ss = class ss {
|
|
|
412
411
|
}
|
|
413
412
|
}, "initialize"));
|
|
414
413
|
d(this, ee, /* @__PURE__ */ h((s, e) => {
|
|
415
|
-
|
|
414
|
+
C.log("rowManager.#renderRows");
|
|
416
415
|
const n = t(this, Y).get(e);
|
|
417
416
|
if (!n || n.length === 0) return;
|
|
418
417
|
const r = s.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -429,7 +428,7 @@ const ss = class ss {
|
|
|
429
428
|
if (t(this, O) !== null && t(this, O) > 0)
|
|
430
429
|
return t(this, O);
|
|
431
430
|
const s = t(this, R).querySelector(".ng-container-body .ng-part-body");
|
|
432
|
-
|
|
431
|
+
C.log("rowManager.#measureAndCacheHeight");
|
|
433
432
|
const e = t(this, Y).get(".ng-container-body");
|
|
434
433
|
if (!e || e.length === 0) throw new Error("invalid dom");
|
|
435
434
|
const n = s.querySelector("tbody.bindable-tbody");
|
|
@@ -453,7 +452,7 @@ const ss = class ss {
|
|
|
453
452
|
}), f.forEach((b) => b.remove()), o.style.display = a, o.style.visibility = c, o.style.position = l, g <= 0 ? -1 : (y(this, O, g), t(this, $t).call(this), t(this, O));
|
|
454
453
|
}, "#measureAndCacheHeight"));
|
|
455
454
|
d(this, Ht, /* @__PURE__ */ h(() => {
|
|
456
|
-
|
|
455
|
+
C.log("rowManager.#updateVirtualScrollHeight");
|
|
457
456
|
const e = (t(this, ot).data.get() || []).length, n = t(this, O), r = e * n;
|
|
458
457
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
459
458
|
const o = t(this, R).querySelector(i);
|
|
@@ -512,7 +511,7 @@ const ss = class ss {
|
|
|
512
511
|
})), t(this, G).observe(t(this, R)));
|
|
513
512
|
}, "#initResizeObserver"));
|
|
514
513
|
d(this, Nt, /* @__PURE__ */ h(() => {
|
|
515
|
-
|
|
514
|
+
C.log("rowManager.#renderAllContainers"), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((s) => {
|
|
516
515
|
const e = t(this, R).querySelector(s);
|
|
517
516
|
e && e.querySelector(".ng-part-body tbody.bindable-tbody") && t(this, ee).call(this, e, s);
|
|
518
517
|
}), t(this, oe).call(this), t(this, se).call(this);
|
|
@@ -567,7 +566,7 @@ const ss = class ss {
|
|
|
567
566
|
}, "#bindRowData"));
|
|
568
567
|
d(this, oe, /* @__PURE__ */ h(() => {
|
|
569
568
|
var c, l, g;
|
|
570
|
-
|
|
569
|
+
C.log("rowManager.#syncHeaderHeights");
|
|
571
570
|
const s = t(this, R).querySelector(".ng-container-left .ng-part-header table"), e = t(this, R).querySelector(".ng-container-body .ng-part-header table"), n = t(this, R).querySelector(".ng-container-right .ng-part-header table");
|
|
572
571
|
if (!e) return;
|
|
573
572
|
const r = s ? Array.from(s.querySelectorAll("tr")) : [], i = Array.from(e.querySelectorAll("tr")), o = n ? Array.from(n.querySelectorAll("tr")) : [], a = Math.max(r.length, i.length, o.length);
|
|
@@ -684,7 +683,7 @@ const ns = class ns {
|
|
|
684
683
|
d(this, U, { startRow: -1, startCol: -1, endRow: -1, endCol: -1 });
|
|
685
684
|
E(this, "render", /* @__PURE__ */ h(() => {
|
|
686
685
|
const { startRow: s, startCol: e, endRow: n, endCol: r } = t(this, U);
|
|
687
|
-
|
|
686
|
+
C.log("π¨ [CellSelection.render] Rendering range ->", t(this, U));
|
|
688
687
|
const i = t(this, N).querySelectorAll(
|
|
689
688
|
".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"
|
|
690
689
|
);
|
|
@@ -693,7 +692,7 @@ const ns = class ns {
|
|
|
693
692
|
c.classList.remove("selected", "selected-top", "selected-bottom", "selected-left", "selected-right");
|
|
694
693
|
});
|
|
695
694
|
}), s < 0 || e < 0) {
|
|
696
|
-
|
|
695
|
+
C.log("β οΈ [CellSelection.render] Range is invalid (< 0), skipping render.");
|
|
697
696
|
return;
|
|
698
697
|
}
|
|
699
698
|
let o = 0;
|
|
@@ -704,10 +703,10 @@ const ns = class ns {
|
|
|
704
703
|
const f = parseInt(g.dataset.col, 10);
|
|
705
704
|
if (isNaN(f)) return;
|
|
706
705
|
const b = parseInt(g.rowSpan || 1, 10), u = parseInt(g.colSpan || 1, 10), p = l + b - 1, x = f + u - 1;
|
|
707
|
-
p >= s && l <= n && x >= e && f <= r && (o++, g.classList.add("selected"),
|
|
706
|
+
p >= s && l <= n && x >= e && f <= r && (o++, g.classList.add("selected"), C.log(g, s, e, n, r), l <= s && g.classList.add("selected-top"), p >= n && g.classList.add("selected-bottom"), f <= e && g.classList.add("selected-left"), x >= r && g.classList.add("selected-right"));
|
|
708
707
|
});
|
|
709
708
|
});
|
|
710
|
-
}),
|
|
709
|
+
}), C.log(`β¨ [CellSelection.render] Total rendered cells marked: ${o}`);
|
|
711
710
|
}, "render"));
|
|
712
711
|
y(this, N, s), V(this, X, xs).call(this), t(this, N).querySelectorAll(
|
|
713
712
|
".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"
|
|
@@ -715,10 +714,10 @@ const ns = class ns {
|
|
|
715
714
|
n.addEventListener("scroll", () => {
|
|
716
715
|
t(this, U).startRow >= 0 && t(this, U).startCol >= 0 && this.render();
|
|
717
716
|
});
|
|
718
|
-
}),
|
|
717
|
+
}), C.log("π― [CellSelection] Initialized");
|
|
719
718
|
}
|
|
720
719
|
setRange(s, e, n, r) {
|
|
721
|
-
|
|
720
|
+
C.log(`π [CellSelection.setRange] Input -> startRow: ${s}, startCol: ${e}, endRow: ${n}, endCol: ${r}`);
|
|
722
721
|
let i = Math.min(s, n), o = Math.max(s, n), a = Math.min(e, r), c = Math.max(e, r);
|
|
723
722
|
const l = t(this, N).querySelectorAll(
|
|
724
723
|
".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"
|
|
@@ -740,7 +739,7 @@ const ns = class ns {
|
|
|
740
739
|
});
|
|
741
740
|
});
|
|
742
741
|
});
|
|
743
|
-
y(this, U, { startRow: i, startCol: a, endRow: o, endCol: c }),
|
|
742
|
+
y(this, U, { startRow: i, startCol: a, endRow: o, endCol: c }), C.log("π¦ [CellSelection.setRange] Final Range ->", t(this, U)), this.render();
|
|
744
743
|
}
|
|
745
744
|
};
|
|
746
745
|
N = new WeakMap(), U = new WeakMap(), X = new WeakSet(), qt = /* @__PURE__ */ h(function(s) {
|
|
@@ -752,7 +751,7 @@ N = new WeakMap(), U = new WeakMap(), X = new WeakSet(), qt = /* @__PURE__ */ h(
|
|
|
752
751
|
}, "#getMatrixRow"), xs = /* @__PURE__ */ h(function() {
|
|
753
752
|
const s = t(this, N).querySelector(".ng-container-top");
|
|
754
753
|
if (!s) {
|
|
755
|
-
|
|
754
|
+
C.log("β [CellSelection] .ng-container-top not found!");
|
|
756
755
|
return;
|
|
757
756
|
}
|
|
758
757
|
s.addEventListener("mousedown", (e) => {
|
|
@@ -765,7 +764,7 @@ N = new WeakMap(), U = new WeakMap(), X = new WeakSet(), qt = /* @__PURE__ */ h(
|
|
|
765
764
|
t(this, N).style.userSelect = "", t(this, N).style.webkitUserSelect = "";
|
|
766
765
|
return;
|
|
767
766
|
}
|
|
768
|
-
|
|
767
|
+
C.log(`π±οΈ [MouseDown Success] startRow: ${i}, startCol: ${o}`), t(this, N).navigation.currentCell = n;
|
|
769
768
|
let a = i, c = o;
|
|
770
769
|
const l = /* @__PURE__ */ h((f) => {
|
|
771
770
|
const b = document.elementFromPoint(f.clientX, f.clientY);
|
|
@@ -784,7 +783,7 @@ N = new WeakMap(), U = new WeakMap(), X = new WeakSet(), qt = /* @__PURE__ */ h(
|
|
|
784
783
|
const p = u.closest("tr"), { matrixRow: x } = V(this, X, qt).call(this, p), w = parseInt(u.dataset.col, 10);
|
|
785
784
|
x < 0 || a === x && c === w || (a = x, c = w, this.setRange(i, o, x, w));
|
|
786
785
|
}, "onMouseMove"), g = /* @__PURE__ */ h(() => {
|
|
787
|
-
|
|
786
|
+
C.log("π±οΈ [MouseUp] Drag ended."), t(this, N).style.userSelect = "", t(this, N).style.webkitUserSelect = "", document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", g);
|
|
788
787
|
}, "onMouseUp");
|
|
789
788
|
document.addEventListener("mousemove", l), document.addEventListener("mouseup", g);
|
|
790
789
|
});
|
|
@@ -876,7 +875,7 @@ const rs = class rs {
|
|
|
876
875
|
}
|
|
877
876
|
return null;
|
|
878
877
|
}, "#getNearElement"));
|
|
879
|
-
y(this, F, s), V(this, pt, ws).call(this),
|
|
878
|
+
y(this, F, s), V(this, pt, ws).call(this), C.log("π― [CellNavigation] Initialized");
|
|
880
879
|
}
|
|
881
880
|
get currentCell() {
|
|
882
881
|
return t(this, lt);
|
|
@@ -963,10 +962,10 @@ const Ct = class Ct extends HTMLElement {
|
|
|
963
962
|
d(this, zt);
|
|
964
963
|
d(this, Bt);
|
|
965
964
|
E(this, "invalidate", /* @__PURE__ */ h(() => {
|
|
966
|
-
|
|
965
|
+
C.log("sheet.invalidate()"), t(this, dt).refresh();
|
|
967
966
|
}, "invalidate"));
|
|
968
967
|
E(this, "generate", /* @__PURE__ */ h((e) => {
|
|
969
|
-
if (
|
|
968
|
+
if (C.log("sheet.generate()"), !e) return;
|
|
970
969
|
y(this, ht, Le.compile(e)), t(this, he).call(this), t(this, de).call(this);
|
|
971
970
|
const n = this.querySelector(".ng-container-body .ng-part-header"), r = this.querySelector(".ng-container-body .ng-part-footer"), i = this.querySelector(".ng-nodata-overlay");
|
|
972
971
|
n && i && (i.style.top = `${n.offsetHeight}px`), r && i && (i.style.bottom = `${r.offsetHeight}px`), t(this, dt).initialize(), setTimeout(() => {
|
|
@@ -1241,7 +1240,7 @@ const Ct = class Ct extends HTMLElement {
|
|
|
1241
1240
|
return t(this, Bt);
|
|
1242
1241
|
}
|
|
1243
1242
|
disconnectedCallback() {
|
|
1244
|
-
this.innerHTML = "",
|
|
1243
|
+
this.innerHTML = "", C.log("NineTableSheet destroyed.");
|
|
1245
1244
|
}
|
|
1246
1245
|
};
|
|
1247
1246
|
ce = new WeakMap(), ht = new WeakMap(), dt = new WeakMap(), zt = new WeakMap(), Bt = new WeakMap(), he = new WeakMap(), de = new WeakMap(), xt = new WeakMap(), fe = new WeakMap(), ue = new WeakMap(), h(Ct, "NineTableSheet"), E(Ct, "SCROLLBAR_SIZE", 16);
|
|
@@ -1664,11 +1663,11 @@ const cs = class cs {
|
|
|
1664
1663
|
}), y(this, H, Array.from(s, ([e, n]) => ({ name: e, type: n }))), y(this, H, t(this, H).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, H).sort((e, n) => e.name.length < n.name.length ? 1 : -1);
|
|
1665
1664
|
}, "#adjust"));
|
|
1666
1665
|
d(this, ve, /* @__PURE__ */ h(() => {
|
|
1667
|
-
y(this, H, []),
|
|
1666
|
+
y(this, H, []), C.log(t(this, Rt).querySelectorAll("table"));
|
|
1668
1667
|
const s = Array.from(t(this, Rt).querySelectorAll("table"));
|
|
1669
1668
|
if (!(!s || s.length === 0)) {
|
|
1670
1669
|
for (const e of s)
|
|
1671
|
-
|
|
1670
|
+
C.log(e), $("[data-bind]", e).each((n, r) => {
|
|
1672
1671
|
const i = r.dataset.bind, o = r.getAttribute("data-type") || "string";
|
|
1673
1672
|
i && t(this, H).push({ name: i, type: o });
|
|
1674
1673
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((n) => {
|
|
@@ -1727,7 +1726,7 @@ const hs = class hs extends HTMLElement {
|
|
|
1727
1726
|
d(this, gt);
|
|
1728
1727
|
d(this, Se);
|
|
1729
1728
|
d(this, Re, /* @__PURE__ */ h(() => {
|
|
1730
|
-
this.fields = new We(this), y(this, Se, new Ne(this)),
|
|
1729
|
+
this.fields = new We(this), y(this, Se, new Ne(this)), C.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1731
1730
|
}, "#init"));
|
|
1732
1731
|
this.attachShadow({ mode: "open" }), y(this, gt, new De(this));
|
|
1733
1732
|
}
|
|
@@ -1735,7 +1734,7 @@ const hs = class hs extends HTMLElement {
|
|
|
1735
1734
|
t(this, Re).call(this);
|
|
1736
1735
|
}
|
|
1737
1736
|
disconnectedCallback() {
|
|
1738
|
-
|
|
1737
|
+
C.log("NineTable disconnected.");
|
|
1739
1738
|
}
|
|
1740
1739
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1741
1740
|
get data() {
|