@ninebone/table 0.0.213 β 0.0.215
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 +49 -49
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +4 -4
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -22,13 +22,13 @@ const Te = class Te extends ze.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(Te, "Trace");
|
|
24
24
|
let pe = Te;
|
|
25
|
-
const
|
|
26
|
-
var L,
|
|
25
|
+
const Z = new pe();
|
|
26
|
+
var L, $, y, B, D, N, te, P, ie;
|
|
27
27
|
const Ae = class Ae extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
u(this, L);
|
|
31
|
-
u(this,
|
|
31
|
+
u(this, $, !1);
|
|
32
32
|
u(this, y);
|
|
33
33
|
u(this, B);
|
|
34
34
|
u(this, D);
|
|
@@ -41,7 +41,7 @@ const Ae = class Ae extends HTMLElement {
|
|
|
41
41
|
})), e(this, N).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
x(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!e(this, L) || !e(this, y) || e(this,
|
|
44
|
+
if (Z.log("nine-table-hscrollbar: refresh()"), Z.log(e(this, L), e(this, y), e(this, $)), !e(this, L) || !e(this, y) || e(this, $)) return;
|
|
45
45
|
const t = e(this, y).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
47
|
const n = e(this, y).track, r = e(this, y).thumb, o = e(this, L).querySelector(".ng-container-bottom"), c = t.clientWidth, h = s.scrollWidth;
|
|
@@ -106,13 +106,13 @@ const Ae = class Ae extends HTMLElement {
|
|
|
106
106
|
e(this, P).call(this, n.clientX - r.left - o / 2);
|
|
107
107
|
}), e(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
|
-
n.stopPropagation(), n.preventDefault(), p(this,
|
|
109
|
+
n.stopPropagation(), n.preventDefault(), p(this, $, !0), this.shiftX = n.clientX - e(this, y).thumb.getBoundingClientRect().left;
|
|
110
110
|
const r = /* @__PURE__ */ a((c) => {
|
|
111
|
-
if (!e(this,
|
|
111
|
+
if (!e(this, $)) return;
|
|
112
112
|
const h = e(this, y).track.getBoundingClientRect();
|
|
113
113
|
e(this, P).call(this, c.clientX - h.left - this.shiftX);
|
|
114
114
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
115
|
-
p(this,
|
|
115
|
+
p(this, $, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
116
116
|
}, "onMouseUp");
|
|
117
117
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
118
118
|
});
|
|
@@ -203,16 +203,16 @@ const Ae = class Ae extends HTMLElement {
|
|
|
203
203
|
e(this, N) && e(this, N).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
L = new WeakMap(),
|
|
206
|
+
L = new WeakMap(), $ = new WeakMap(), y = new WeakMap(), B = new WeakMap(), D = new WeakMap(), N = new WeakMap(), te = new WeakMap(), P = new WeakMap(), ie = new WeakMap(), a(Ae, "NineTableHScrollBar");
|
|
207
207
|
let ye = Ae;
|
|
208
208
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ye);
|
|
209
|
-
var V, C, E,
|
|
209
|
+
var V, C, E, W, M, H, se, ne;
|
|
210
210
|
const qe = class qe {
|
|
211
211
|
constructor(i) {
|
|
212
212
|
u(this, V);
|
|
213
213
|
u(this, C, []);
|
|
214
214
|
u(this, E, null);
|
|
215
|
-
u(this,
|
|
215
|
+
u(this, W, null);
|
|
216
216
|
u(this, M, 0);
|
|
217
217
|
u(this, H, 0);
|
|
218
218
|
x(this, "getRowHeight", /* @__PURE__ */ a(() => e(this, E), "getRowHeight"));
|
|
@@ -223,7 +223,7 @@ const qe = class qe {
|
|
|
223
223
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
224
224
|
*/
|
|
225
225
|
u(this, ne, /* @__PURE__ */ a(() => {
|
|
226
|
-
!e(this, V) || !(e(this, V) instanceof HTMLElement) || (p(this,
|
|
226
|
+
!e(this, V) || !(e(this, V) instanceof HTMLElement) || (p(this, W, new ResizeObserver((i) => {
|
|
227
227
|
for (const t of i) {
|
|
228
228
|
const s = t.target;
|
|
229
229
|
if (!s.classList.contains("active"))
|
|
@@ -237,14 +237,14 @@ const qe = class qe {
|
|
|
237
237
|
const d = Math.max(r - o, 100);
|
|
238
238
|
if (e(this, M) !== d && (p(this, M, d), e(this, E) !== null)) {
|
|
239
239
|
const f = Math.ceil(e(this, M) / e(this, E));
|
|
240
|
-
p(this, H, f + 20),
|
|
240
|
+
p(this, H, f + 20), Z.log(`[RowManager] Resized. Height: ${e(this, M)}px | Target Rows: ${e(this, H)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((g) => {
|
|
241
241
|
const b = s.querySelector(g);
|
|
242
242
|
b && b.querySelector("tbody") && this.renderRows(b);
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
})), e(this,
|
|
247
|
+
})), e(this, W).observe(e(this, V)));
|
|
248
248
|
}, "#initResizeObserver"));
|
|
249
249
|
x(this, "initTemplate", /* @__PURE__ */ a((i) => {
|
|
250
250
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
@@ -306,7 +306,7 @@ const qe = class qe {
|
|
|
306
306
|
s ? s.before(n) : t.appendChild(n), console.log(`[RowManager] Rendered ${r} sets into DOM.`);
|
|
307
307
|
}, "renderRows"));
|
|
308
308
|
x(this, "destroy", /* @__PURE__ */ a(() => {
|
|
309
|
-
e(this,
|
|
309
|
+
e(this, W) && (e(this, W).disconnect(), p(this, W, null));
|
|
310
310
|
}, "destroy"));
|
|
311
311
|
p(this, V, i), e(this, se).call(this);
|
|
312
312
|
}
|
|
@@ -314,10 +314,10 @@ const qe = class qe {
|
|
|
314
314
|
return e(this, C).length || 1;
|
|
315
315
|
}
|
|
316
316
|
};
|
|
317
|
-
V = new WeakMap(), C = new WeakMap(), E = new WeakMap(),
|
|
317
|
+
V = new WeakMap(), C = new WeakMap(), E = new WeakMap(), W = new WeakMap(), M = new WeakMap(), H = new WeakMap(), se = new WeakMap(), ne = new WeakMap(), a(qe, "RowManager");
|
|
318
318
|
let me = qe;
|
|
319
319
|
var I, X, re, oe;
|
|
320
|
-
const
|
|
320
|
+
const j = class j extends HTMLElement {
|
|
321
321
|
constructor() {
|
|
322
322
|
super();
|
|
323
323
|
u(this, I, null);
|
|
@@ -422,7 +422,7 @@ const Z = class Z extends HTMLElement {
|
|
|
422
422
|
}).observe(this, { attributes: !0 });
|
|
423
423
|
}, "#init"));
|
|
424
424
|
u(this, oe, /* @__PURE__ */ a(() => {
|
|
425
|
-
const t =
|
|
425
|
+
const t = j.SCROLLBAR_SIZE;
|
|
426
426
|
this.innerHTML = `
|
|
427
427
|
<style>
|
|
428
428
|
nine-table-sheet {
|
|
@@ -544,13 +544,13 @@ const Z = class Z extends HTMLElement {
|
|
|
544
544
|
e(this, re).call(this);
|
|
545
545
|
}
|
|
546
546
|
disconnectedCallback() {
|
|
547
|
-
this.innerHTML = "",
|
|
547
|
+
this.innerHTML = "", Z.log("NineTableSheet destroyed.");
|
|
548
548
|
}
|
|
549
549
|
};
|
|
550
|
-
I = new WeakMap(), X = new WeakMap(), re = new WeakMap(), oe = new WeakMap(), a(
|
|
551
|
-
let ee =
|
|
550
|
+
I = new WeakMap(), X = new WeakMap(), re = new WeakMap(), oe = new WeakMap(), a(j, "NineTableSheet"), x(j, "SCROLLBAR_SIZE", 16);
|
|
551
|
+
let ee = j;
|
|
552
552
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ee);
|
|
553
|
-
var le,
|
|
553
|
+
var le, G;
|
|
554
554
|
const ke = class ke extends HTMLElement {
|
|
555
555
|
constructor() {
|
|
556
556
|
super();
|
|
@@ -559,10 +559,10 @@ const ke = class ke extends HTMLElement {
|
|
|
559
559
|
(t = this.querySelector(".nine-tab-bar")) == null || t.addEventListener("click", (s) => {
|
|
560
560
|
var o;
|
|
561
561
|
const n = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((o = s.target.closest(".nine-tab-item")) == null ? void 0 : o.dataset.index, 10);
|
|
562
|
-
e(this,
|
|
563
|
-
}), e(this,
|
|
562
|
+
e(this, G).call(this, r, n);
|
|
563
|
+
}), e(this, G).call(this, 0, !1);
|
|
564
564
|
}, "#init"));
|
|
565
|
-
u(this,
|
|
565
|
+
u(this, G, /* @__PURE__ */ a((t, s = !1) => {
|
|
566
566
|
const n = /* @__PURE__ */ a(() => {
|
|
567
567
|
const d = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
568
568
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((b) => b.style.setProperty("display", "none"));
|
|
@@ -598,20 +598,20 @@ const ke = class ke extends HTMLElement {
|
|
|
598
598
|
e(this, le).call(this);
|
|
599
599
|
}
|
|
600
600
|
};
|
|
601
|
-
le = new WeakMap(),
|
|
601
|
+
le = new WeakMap(), G = new WeakMap(), a(ke, "NineTableSheets");
|
|
602
602
|
let we = ke;
|
|
603
603
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", we);
|
|
604
|
-
var S, ae,
|
|
604
|
+
var S, ae, J, ce;
|
|
605
605
|
const Le = class Le {
|
|
606
606
|
constructor(i) {
|
|
607
607
|
u(this, S);
|
|
608
608
|
u(this, ae, /* @__PURE__ */ a(() => {
|
|
609
609
|
e(this, ce).call(this), new ResizeObserver((i) => {
|
|
610
610
|
for (let t of i)
|
|
611
|
-
e(this, S).getAttribute("auto-height") === "true" && e(this,
|
|
611
|
+
e(this, S).getAttribute("auto-height") === "true" && e(this, J).call(this);
|
|
612
612
|
}).observe(e(this, S));
|
|
613
613
|
}, "#init"));
|
|
614
|
-
u(this,
|
|
614
|
+
u(this, J, /* @__PURE__ */ a(() => {
|
|
615
615
|
var h, l;
|
|
616
616
|
const i = Array.from(e(this, S).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
617
617
|
if (i.length === 0) return;
|
|
@@ -725,22 +725,22 @@ const Le = class Le {
|
|
|
725
725
|
const c = e(this, S).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
726
726
|
c == null || c.forEach((h, l) => {
|
|
727
727
|
t[l] && setTimeout(() => {
|
|
728
|
-
h.generate(t[l]), s && e(this,
|
|
728
|
+
h.generate(t[l]), s && e(this, J).call(this);
|
|
729
729
|
});
|
|
730
730
|
});
|
|
731
731
|
}, "#render"));
|
|
732
732
|
p(this, S, i), e(this, ae).call(this);
|
|
733
733
|
}
|
|
734
734
|
};
|
|
735
|
-
S = new WeakMap(), ae = new WeakMap(),
|
|
735
|
+
S = new WeakMap(), ae = new WeakMap(), J = new WeakMap(), ce = new WeakMap(), a(Le, "LayoutManager");
|
|
736
736
|
let ve = Le;
|
|
737
|
-
var
|
|
737
|
+
var O, F;
|
|
738
738
|
const Ce = class Ce {
|
|
739
739
|
constructor(i) {
|
|
740
|
-
u(this,
|
|
740
|
+
u(this, O);
|
|
741
741
|
u(this, F, -1);
|
|
742
|
-
x(this, "count", /* @__PURE__ */ a(() => e(this,
|
|
743
|
-
p(this,
|
|
742
|
+
x(this, "count", /* @__PURE__ */ a(() => e(this, O).rawRecords.length, "count"));
|
|
743
|
+
p(this, O, i);
|
|
744
744
|
}
|
|
745
745
|
get at() {
|
|
746
746
|
return e(this, F);
|
|
@@ -748,16 +748,16 @@ const Ce = class Ce {
|
|
|
748
748
|
set at(i) {
|
|
749
749
|
var s, n;
|
|
750
750
|
p(this, F, parseInt(i, 10));
|
|
751
|
-
const t = ((n = (s = e(this,
|
|
751
|
+
const t = ((n = (s = e(this, O).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || e(this, O).owner.body;
|
|
752
752
|
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, F)}"]`) && setTimeout(() => {
|
|
753
753
|
var r, o;
|
|
754
|
-
(o = (r = e(this,
|
|
754
|
+
(o = (r = e(this, O).owner).scrollTo_V1) == null || o.call(r, e(this, F));
|
|
755
755
|
});
|
|
756
756
|
}
|
|
757
757
|
};
|
|
758
|
-
|
|
758
|
+
O = new WeakMap(), F = new WeakMap(), a(Ce, "ngRow");
|
|
759
759
|
let xe = Ce;
|
|
760
|
-
var A, v, q, U, he,
|
|
760
|
+
var A, v, q, U, he, z, de, Q, fe, ue, K;
|
|
761
761
|
const k = class k {
|
|
762
762
|
constructor(i, t) {
|
|
763
763
|
u(this, A);
|
|
@@ -765,28 +765,28 @@ const k = class k {
|
|
|
765
765
|
u(this, q, []);
|
|
766
766
|
u(this, U, []);
|
|
767
767
|
u(this, he, 0);
|
|
768
|
-
u(this,
|
|
768
|
+
u(this, z, []);
|
|
769
769
|
u(this, de, /* @__PURE__ */ a(() => {
|
|
770
|
-
p(this,
|
|
770
|
+
p(this, z, []);
|
|
771
771
|
const i = e(this, A).template || [];
|
|
772
772
|
Array.from(i).forEach((t) => {
|
|
773
773
|
var s;
|
|
774
|
-
e(this,
|
|
774
|
+
e(this, z).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
775
775
|
}), (e(this, v).rawRecords || []).forEach((t) => {
|
|
776
|
-
t.__ng || (t.__ng = e(this,
|
|
776
|
+
t.__ng || (t.__ng = e(this, Q).call(this)), t.__ng.height = e(this, z).slice();
|
|
777
777
|
});
|
|
778
778
|
}, "#initialize"));
|
|
779
779
|
x(this, "set", /* @__PURE__ */ a((i) => {
|
|
780
780
|
this.clear(), this.add(i, !1);
|
|
781
781
|
}, "set"));
|
|
782
|
-
u(this,
|
|
782
|
+
u(this, Q, /* @__PURE__ */ a(() => ({
|
|
783
783
|
rowState: k.ROW_STATE.EMPTY,
|
|
784
784
|
deleted: !1,
|
|
785
785
|
filtered: !1,
|
|
786
|
-
height: e(this,
|
|
786
|
+
height: e(this, z).slice(),
|
|
787
787
|
o: {},
|
|
788
788
|
c: {},
|
|
789
|
-
_: [0, 0, 0, 0, k.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this,
|
|
789
|
+
_: [0, 0, 0, 0, k.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, z).slice(), -1, {}, {}]
|
|
790
790
|
}), "#getDefaultMeta"));
|
|
791
791
|
x(this, "reset", /* @__PURE__ */ a(() => {
|
|
792
792
|
p(this, q, []), p(this, U, []);
|
|
@@ -807,7 +807,7 @@ const k = class k {
|
|
|
807
807
|
}), s;
|
|
808
808
|
}, "#json2Array"));
|
|
809
809
|
u(this, ue, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
810
|
-
t.__ng = e(this,
|
|
810
|
+
t.__ng = e(this, Q).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = k.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
811
811
|
}), i), "#defaultInsert"));
|
|
812
812
|
x(this, "add", /* @__PURE__ */ a((i, t = !0) => {
|
|
813
813
|
var r;
|
|
@@ -893,7 +893,7 @@ const k = class k {
|
|
|
893
893
|
return this.length;
|
|
894
894
|
}
|
|
895
895
|
};
|
|
896
|
-
A = new WeakMap(), v = new WeakMap(), q = new WeakMap(), U = new WeakMap(), he = new WeakMap(),
|
|
896
|
+
A = new WeakMap(), v = new WeakMap(), q = new WeakMap(), U = new WeakMap(), he = new WeakMap(), z = new WeakMap(), de = new WeakMap(), Q = new WeakMap(), fe = new WeakMap(), ue = new WeakMap(), K = new WeakMap(), a(k, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
897
897
|
x(k, "ROW_STATE", {
|
|
898
898
|
EMPTY: "EMPTY",
|
|
899
899
|
NORMAL: "NORMAL",
|
|
@@ -933,10 +933,10 @@ const Me = class Me extends HTMLElement {
|
|
|
933
933
|
this.attachShadow({ mode: "open" }), p(this, Y, new Se(this));
|
|
934
934
|
}
|
|
935
935
|
connectedCallback() {
|
|
936
|
-
p(this, ge, new ve(this)),
|
|
936
|
+
p(this, ge, new ve(this)), Z.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
937
937
|
}
|
|
938
938
|
disconnectedCallback() {
|
|
939
|
-
|
|
939
|
+
Z.log("NineTable disconnected.");
|
|
940
940
|
}
|
|
941
941
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
942
942
|
get data() {
|