@ninebone/table 0.0.753 β 0.0.754
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 -35
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +3 -3
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -23,12 +23,12 @@ const Xe = class Xe extends ms.constructor {
|
|
|
23
23
|
h(Xe, "Trace");
|
|
24
24
|
let we = Xe;
|
|
25
25
|
const S = new we();
|
|
26
|
-
var B,
|
|
26
|
+
var B, K, A, tt, et, st, Vt, nt, Ut;
|
|
27
27
|
const Ke = class Ke extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
d(this, B);
|
|
31
|
-
d(this,
|
|
31
|
+
d(this, K, !1);
|
|
32
32
|
d(this, A);
|
|
33
33
|
d(this, tt);
|
|
34
34
|
d(this, et);
|
|
@@ -41,7 +41,7 @@ const Ke = class Ke extends HTMLElement {
|
|
|
41
41
|
})), t(this, st).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
E(this, "refresh", /* @__PURE__ */ h(() => {
|
|
44
|
-
if (!t(this, B) || !t(this, A) || t(this,
|
|
44
|
+
if (!t(this, B) || !t(this, A) || t(this, K)) return;
|
|
45
45
|
const e = t(this, A).container, n = e.querySelector("table");
|
|
46
46
|
if (!n) return;
|
|
47
47
|
const r = t(this, A).track, o = t(this, A).thumb, i = t(this, B).querySelector(".ng-container-bottom"), a = e.clientWidth, c = n.scrollWidth;
|
|
@@ -99,13 +99,13 @@ const Ke = class Ke extends HTMLElement {
|
|
|
99
99
|
t(this, nt).call(this, r.clientX - o.left - i / 2);
|
|
100
100
|
}), t(this, A).thumb.addEventListener("mousedown", (r) => {
|
|
101
101
|
if (r.button !== 0) return;
|
|
102
|
-
r.stopPropagation(), r.preventDefault(), p(this,
|
|
102
|
+
r.stopPropagation(), r.preventDefault(), p(this, K, !0), this.shiftX = r.clientX - t(this, A).thumb.getBoundingClientRect().left;
|
|
103
103
|
const o = /* @__PURE__ */ h((a) => {
|
|
104
|
-
if (!t(this,
|
|
104
|
+
if (!t(this, K)) return;
|
|
105
105
|
const c = t(this, A).track.getBoundingClientRect();
|
|
106
106
|
t(this, nt).call(this, a.clientX - c.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), i = /* @__PURE__ */ h(() => {
|
|
108
|
-
p(this,
|
|
108
|
+
p(this, K, !1), n(), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", i), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
110
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", i);
|
|
111
111
|
});
|
|
@@ -189,7 +189,7 @@ const Ke = class Ke extends HTMLElement {
|
|
|
189
189
|
left: this.querySelector(".ng-scroll-left"),
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), n.addEventListener("scroll", () => {
|
|
192
|
-
t(this,
|
|
192
|
+
t(this, K) || this.refresh();
|
|
193
193
|
}), t(this, Ut).call(this), t(this, Vt).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
@@ -198,7 +198,7 @@ const Ke = class Ke extends HTMLElement {
|
|
|
198
198
|
t(this, st) && t(this, st).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
B = new WeakMap(),
|
|
201
|
+
B = new WeakMap(), K = new WeakMap(), A = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), st = new WeakMap(), Vt = new WeakMap(), nt = new WeakMap(), Ut = new WeakMap(), h(Ke, "NineTableHScrollBar");
|
|
202
202
|
let Se = Ke;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Se);
|
|
204
204
|
var rt, ot, bt, C, Tt, Ct, Xt;
|
|
@@ -353,7 +353,7 @@ const Ge = class Ge extends HTMLElement {
|
|
|
353
353
|
rt = new WeakMap(), ot = new WeakMap(), bt = new WeakMap(), C = new WeakMap(), Tt = new WeakMap(), Ct = new WeakMap(), Xt = new WeakMap(), h(Ge, "NineTableVScrollBar");
|
|
354
354
|
let Re = Ge;
|
|
355
355
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", Re);
|
|
356
|
-
var j, R, it, P, D,
|
|
356
|
+
var j, R, it, P, D, G, at, kt, ze, We, Kt, Gt, Lt, It, Ht, Zt, Jt, Mt, Be, pt, $t, Qt;
|
|
357
357
|
const Ze = class Ze {
|
|
358
358
|
constructor(s) {
|
|
359
359
|
d(this, j);
|
|
@@ -361,7 +361,7 @@ const Ze = class Ze {
|
|
|
361
361
|
d(this, it);
|
|
362
362
|
d(this, P, /* @__PURE__ */ new Map());
|
|
363
363
|
d(this, D, null);
|
|
364
|
-
d(this,
|
|
364
|
+
d(this, G, null);
|
|
365
365
|
d(this, at, 0);
|
|
366
366
|
d(this, kt, 40);
|
|
367
367
|
d(this, ze, !1);
|
|
@@ -491,7 +491,7 @@ const Ze = class Ze {
|
|
|
491
491
|
}
|
|
492
492
|
}, "#syncRowHeights"));
|
|
493
493
|
d(this, Jt, /* @__PURE__ */ h(() => {
|
|
494
|
-
!t(this, R) || !(t(this, R) instanceof HTMLElement) || (p(this,
|
|
494
|
+
!t(this, R) || !(t(this, R) instanceof HTMLElement) || (p(this, G, new ResizeObserver((s) => {
|
|
495
495
|
for (const e of s) {
|
|
496
496
|
const n = e.target;
|
|
497
497
|
if (!n.classList.contains("active")) continue;
|
|
@@ -504,7 +504,7 @@ const Ze = class Ze {
|
|
|
504
504
|
t(this, at) !== c && (p(this, at, c), t(this, Ht).call(this), t(this, D) !== null && (t(this, Mt).call(this), this.refresh()));
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
})), t(this,
|
|
507
|
+
})), t(this, G).observe(t(this, R)));
|
|
508
508
|
}, "#initResizeObserver"));
|
|
509
509
|
d(this, Mt, /* @__PURE__ */ h(() => {
|
|
510
510
|
S.log("rowManager.#renderAllContainers"), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((s) => {
|
|
@@ -598,7 +598,7 @@ const Ze = class Ze {
|
|
|
598
598
|
}
|
|
599
599
|
}, "#syncHeaderHeights"));
|
|
600
600
|
E(this, "destroy", /* @__PURE__ */ h(() => {
|
|
601
|
-
t(this,
|
|
601
|
+
t(this, G) && (t(this, G).disconnect(), p(this, G, null));
|
|
602
602
|
}, "destroy"));
|
|
603
603
|
p(this, j, s.getRootNode().host), p(this, R, s), t(this, Jt).call(this);
|
|
604
604
|
}
|
|
@@ -610,7 +610,7 @@ const Ze = class Ze {
|
|
|
610
610
|
return ((e = t(this, P).get(s)) == null ? void 0 : e.length) || 1;
|
|
611
611
|
}
|
|
612
612
|
};
|
|
613
|
-
j = new WeakMap(), R = new WeakMap(), it = new WeakMap(), P = new WeakMap(), D = new WeakMap(),
|
|
613
|
+
j = new WeakMap(), R = new WeakMap(), it = new WeakMap(), P = new WeakMap(), D = new WeakMap(), G = new WeakMap(), at = new WeakMap(), kt = new WeakMap(), ze = new WeakMap(), We = new WeakMap(), Kt = new WeakMap(), Gt = new WeakMap(), Lt = new WeakMap(), It = new WeakMap(), Ht = new WeakMap(), Zt = new WeakMap(), Jt = new WeakMap(), Mt = new WeakMap(), Be = new WeakMap(), pt = new WeakMap(), $t = new WeakMap(), Qt = new WeakMap(), h(Ze, "RowManager");
|
|
614
614
|
let Ae = Ze;
|
|
615
615
|
const te = class te {
|
|
616
616
|
/**
|
|
@@ -693,10 +693,10 @@ const te = class te {
|
|
|
693
693
|
};
|
|
694
694
|
h(te, "TableCompiler");
|
|
695
695
|
let Ee = te;
|
|
696
|
-
var _, Y,
|
|
696
|
+
var _, Y, U, At, bs;
|
|
697
697
|
const Je = class Je {
|
|
698
698
|
constructor(s) {
|
|
699
|
-
d(this,
|
|
699
|
+
d(this, U);
|
|
700
700
|
d(this, _);
|
|
701
701
|
d(this, Y, { startRow: -1, startCol: -1, endRow: -1, endCol: -1 });
|
|
702
702
|
E(this, "render", /* @__PURE__ */ h(() => {
|
|
@@ -716,7 +716,7 @@ const Je = class Je {
|
|
|
716
716
|
let i = 0;
|
|
717
717
|
o.forEach((a) => {
|
|
718
718
|
a.querySelectorAll("tbody tr").forEach((c) => {
|
|
719
|
-
const { matrixRow: l } = Q(this,
|
|
719
|
+
const { matrixRow: l } = Q(this, U, At).call(this, c);
|
|
720
720
|
l < 0 || c.querySelectorAll("td, th").forEach((f) => {
|
|
721
721
|
const u = parseInt(f.dataset.col, 10);
|
|
722
722
|
if (isNaN(u)) return;
|
|
@@ -726,7 +726,7 @@ const Je = class Je {
|
|
|
726
726
|
});
|
|
727
727
|
}), S.log(`β¨ [CellSelection.render] Total rendered cells marked: ${i}`);
|
|
728
728
|
}, "render"));
|
|
729
|
-
p(this, _, s), Q(this,
|
|
729
|
+
p(this, _, s), Q(this, U, bs).call(this), t(this, _).querySelectorAll(
|
|
730
730
|
".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"
|
|
731
731
|
).forEach((n) => {
|
|
732
732
|
n.addEventListener("scroll", () => {
|
|
@@ -745,14 +745,14 @@ const Je = class Je {
|
|
|
745
745
|
f = !1, u++, l.forEach((b) => {
|
|
746
746
|
b.querySelectorAll("tbody tr").forEach((g) => {
|
|
747
747
|
if (g.classList.contains("nodata")) return;
|
|
748
|
-
const { matrixRow: y } = Q(this,
|
|
748
|
+
const { matrixRow: y } = Q(this, U, At).call(this, g);
|
|
749
749
|
y < 0 || g.querySelectorAll("td, th").forEach((v) => {
|
|
750
750
|
const w = parseInt(v.dataset.col, 10);
|
|
751
751
|
if (isNaN(w)) return;
|
|
752
752
|
const m = parseInt(v.rowSpan || 1, 10), I = parseInt(v.colSpan || 1, 10), T = y + m - 1, H = w + I - 1;
|
|
753
753
|
if (T >= o && y <= i && H >= a && w <= c) {
|
|
754
|
-
const
|
|
755
|
-
(
|
|
754
|
+
const X = Math.min(o, y), cs = Math.max(i, T), hs = Math.min(a, w), ds = Math.max(c, H);
|
|
755
|
+
(X !== o || cs !== i || hs !== a || ds !== c) && (o = X, i = cs, a = hs, c = ds, f = !0);
|
|
756
756
|
}
|
|
757
757
|
});
|
|
758
758
|
});
|
|
@@ -760,7 +760,7 @@ const Je = class Je {
|
|
|
760
760
|
p(this, Y, { startRow: o, startCol: a, endRow: i, endCol: c }), S.log("π¦ [CellSelection.setRange] Final Range ->", t(this, Y)), this.render();
|
|
761
761
|
}
|
|
762
762
|
};
|
|
763
|
-
_ = new WeakMap(), Y = new WeakMap(),
|
|
763
|
+
_ = new WeakMap(), Y = new WeakMap(), U = new WeakSet(), At = /* @__PURE__ */ h(function(s) {
|
|
764
764
|
if (!s || s.classList.contains("nodata")) return { dataRow: -1, subRowIndex: -1, matrixRow: -1 };
|
|
765
765
|
const e = parseInt(s.dataset.row, 10);
|
|
766
766
|
if (isNaN(e)) return { dataRow: -1, subRowIndex: -1, matrixRow: -1 };
|
|
@@ -777,7 +777,7 @@ _ = new WeakMap(), Y = new WeakMap(), V = new WeakSet(), At = /* @__PURE__ */ h(
|
|
|
777
777
|
const n = e.target.closest("td, th");
|
|
778
778
|
if (!n || n.dataset.row === void 0 || n.dataset.col === void 0 || n.closest("tr").classList.contains("nodata")) return;
|
|
779
779
|
t(this, _).style.userSelect = "none", t(this, _).style.webkitUserSelect = "none";
|
|
780
|
-
const r = n.closest("tr"), { matrixRow: o } = Q(this,
|
|
780
|
+
const r = n.closest("tr"), { matrixRow: o } = Q(this, U, At).call(this, r), i = parseInt(n.dataset.col, 10);
|
|
781
781
|
if (o < 0) {
|
|
782
782
|
t(this, _).style.userSelect = "", t(this, _).style.webkitUserSelect = "";
|
|
783
783
|
return;
|
|
@@ -797,7 +797,7 @@ _ = new WeakMap(), Y = new WeakMap(), V = new WeakSet(), At = /* @__PURE__ */ h(
|
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
799
|
if (!u || u.dataset.row === void 0 || u.dataset.col === void 0 || u.closest("tr").classList.contains("nodata")) return;
|
|
800
|
-
const b = u.closest("tr"), { matrixRow: g } = Q(this,
|
|
800
|
+
const b = u.closest("tr"), { matrixRow: g } = Q(this, U, At).call(this, b), y = parseInt(u.dataset.col, 10);
|
|
801
801
|
g < 0 || this.setRange(o, i, g, y);
|
|
802
802
|
}, "onMouseMove"), c = /* @__PURE__ */ h(() => {
|
|
803
803
|
S.log("π±οΈ [MouseUp] Drag ended."), t(this, _).style.userSelect = "", t(this, _).style.webkitUserSelect = "", document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", c);
|
|
@@ -806,17 +806,17 @@ _ = new WeakMap(), Y = new WeakMap(), V = new WeakSet(), At = /* @__PURE__ */ h(
|
|
|
806
806
|
});
|
|
807
807
|
}, "#initEvents"), h(Je, "CellSelection");
|
|
808
808
|
let qe = Je;
|
|
809
|
-
var
|
|
809
|
+
var V, lt, ee, se, _t, ne, ps;
|
|
810
810
|
const Qe = class Qe {
|
|
811
811
|
// π― ν€λ³΄λ λ€λΉκ²μ΄μ
μ€ μ€ν¬λ‘€ ν λ°©μ§ νλκ·Έ
|
|
812
812
|
constructor(s) {
|
|
813
813
|
d(this, ne);
|
|
814
|
-
d(this,
|
|
814
|
+
d(this, V);
|
|
815
815
|
d(this, lt, null);
|
|
816
816
|
d(this, ee, -1);
|
|
817
817
|
d(this, se, -1);
|
|
818
818
|
d(this, _t, !1);
|
|
819
|
-
p(this,
|
|
819
|
+
p(this, V, s), Q(this, ne, ps).call(this), S.log("π― [CellNavigation] Initialized");
|
|
820
820
|
}
|
|
821
821
|
get currentCell() {
|
|
822
822
|
return t(this, lt);
|
|
@@ -830,7 +830,7 @@ const Qe = class Qe {
|
|
|
830
830
|
const r = s.closest("tr"), o = r == null ? void 0 : r.closest("tbody");
|
|
831
831
|
if (o) {
|
|
832
832
|
const a = Array.from(o.querySelectorAll("tr:not(.nodata)")).filter((u) => parseInt(u.dataset.row, 10) === e), c = a.length > 0 ? a.length : 1, l = a.indexOf(r), f = e * c + (l >= 0 ? l : 0);
|
|
833
|
-
p(this, _t, !0), t(this,
|
|
833
|
+
p(this, _t, !0), S.log("====================", f, n, f, n), t(this, V).selection.setRange(f, n, f, n), setTimeout(() => {
|
|
834
834
|
p(this, _t, !1);
|
|
835
835
|
}, 0);
|
|
836
836
|
}
|
|
@@ -839,7 +839,7 @@ const Qe = class Qe {
|
|
|
839
839
|
moveCell(s) {
|
|
840
840
|
var I, T, H, F;
|
|
841
841
|
if (!t(this, lt)) return;
|
|
842
|
-
const e = t(this, lt), n = e.closest("tr"), r = parseInt(e.dataset.row, 10), o = parseInt(e.dataset.col, 10), i = n == null ? void 0 : n.closest("tbody"), c = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((
|
|
842
|
+
const e = t(this, lt), n = e.closest("tr"), r = parseInt(e.dataset.row, 10), o = parseInt(e.dataset.col, 10), i = n == null ? void 0 : n.closest("tbody"), c = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((X) => parseInt(X.dataset.row, 10) === r), l = c.length > 0 ? c.length : 1, f = c.indexOf(n);
|
|
843
843
|
let u = r, b = f, g = o;
|
|
844
844
|
switch (s.code) {
|
|
845
845
|
case "Tab":
|
|
@@ -859,18 +859,21 @@ const Qe = class Qe {
|
|
|
859
859
|
break;
|
|
860
860
|
}
|
|
861
861
|
let y = null;
|
|
862
|
-
const m = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((
|
|
862
|
+
const m = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((X) => parseInt(X.dataset.row, 10) === u)[b];
|
|
863
863
|
if (m && (y = m.querySelector(`[data-col="${g}"]`)), y)
|
|
864
864
|
this.currentCell = y;
|
|
865
865
|
else if (u !== r && u >= 0) {
|
|
866
|
-
const
|
|
867
|
-
(F = (H = t(this,
|
|
866
|
+
const X = ((T = (I = t(this, V)).getRowHeight) == null ? void 0 : T.call(I)) || 40;
|
|
867
|
+
(F = (H = t(this, V)).scrollToY) == null || F.call(H, u * X);
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
870
|
};
|
|
871
|
-
|
|
872
|
-
t(this,
|
|
873
|
-
|
|
871
|
+
V = new WeakMap(), lt = new WeakMap(), ee = new WeakMap(), se = new WeakMap(), _t = new WeakMap(), ne = new WeakSet(), ps = /* @__PURE__ */ h(function() {
|
|
872
|
+
t(this, V).addEventListener("mousedown", (s) => {
|
|
873
|
+
const e = s.target.closest("td, th");
|
|
874
|
+
!e || e.dataset.row === void 0 || e.dataset.col === void 0 || (this.currentCell = e);
|
|
875
|
+
}), t(this, V).addEventListener("keydown", (s) => {
|
|
876
|
+
["Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(s.code) && this.moveCell(s);
|
|
874
877
|
});
|
|
875
878
|
}, "#initEvents"), h(Qe, "CellNavigation");
|
|
876
879
|
let Te = Qe;
|