@ninebone/table 0.0.298 β 0.0.300
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 +47 -47
- 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
|
@@ -23,28 +23,28 @@ const Vt = class Vt extends ne.constructor {
|
|
|
23
23
|
a(Vt, "Trace");
|
|
24
24
|
let Mt = Vt;
|
|
25
25
|
const _ = new Mt();
|
|
26
|
-
var
|
|
26
|
+
var C, I, p, D, P, B, ct, N, ht;
|
|
27
27
|
const Yt = class Yt extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
h(this,
|
|
30
|
+
h(this, C);
|
|
31
31
|
h(this, I, !1);
|
|
32
32
|
h(this, p);
|
|
33
33
|
h(this, D);
|
|
34
34
|
h(this, P);
|
|
35
35
|
h(this, B);
|
|
36
36
|
h(this, ct, /* @__PURE__ */ a(() => {
|
|
37
|
-
if (!t(this,
|
|
38
|
-
const e = t(this,
|
|
37
|
+
if (!t(this, C)) return;
|
|
38
|
+
const e = t(this, C).querySelector(".ng-container-body");
|
|
39
39
|
e && (b(this, B, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), t(this, B).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
S(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!t(this,
|
|
44
|
+
if (!t(this, C) || !t(this, p) || t(this, I)) return;
|
|
45
45
|
const e = t(this, p).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = t(this, p).track, o = t(this, p).thumb, r = t(this,
|
|
47
|
+
const n = t(this, p).track, o = t(this, p).thumb, r = t(this, C).querySelector(".ng-container-bottom"), l = e.clientWidth, c = s.scrollWidth;
|
|
48
48
|
if (l !== 0 && c > l)
|
|
49
49
|
r && (r.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -112,7 +112,7 @@ const Yt = class Yt extends HTMLElement {
|
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (b(this,
|
|
115
|
+
if (b(this, C, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, C)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -177,7 +177,7 @@ const Yt = class Yt extends HTMLElement {
|
|
|
177
177
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
178
178
|
`;
|
|
179
179
|
const e = /* @__PURE__ */ a(() => {
|
|
180
|
-
const s = t(this,
|
|
180
|
+
const s = t(this, C).querySelector(".ng-container-body");
|
|
181
181
|
if (!s) {
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
@@ -198,18 +198,18 @@ const Yt = class Yt extends HTMLElement {
|
|
|
198
198
|
t(this, B) && t(this, B).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
201
|
+
C = new WeakMap(), I = new WeakMap(), p = new WeakMap(), D = new WeakMap(), P = new WeakMap(), B = new WeakMap(), ct = new WeakMap(), N = new WeakMap(), ht = new WeakMap(), a(Yt, "NineTableHScrollBar");
|
|
202
202
|
let _t = Yt;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", _t);
|
|
204
|
-
var V, $, E,
|
|
204
|
+
var V, $, E, tt, et, dt;
|
|
205
205
|
const Xt = class Xt extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
208
|
h(this, V);
|
|
209
209
|
h(this, $, !1);
|
|
210
210
|
h(this, E);
|
|
211
|
-
h(this, Q, 0);
|
|
212
211
|
h(this, tt, 0);
|
|
212
|
+
h(this, et, 0);
|
|
213
213
|
/**
|
|
214
214
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
215
215
|
*/
|
|
@@ -239,13 +239,13 @@ const Xt = class Xt extends HTMLElement {
|
|
|
239
239
|
t(this, $) || this.refresh();
|
|
240
240
|
}), t(this, E).thumb.addEventListener("mousedown", (s) => {
|
|
241
241
|
if (s.button !== 0) return;
|
|
242
|
-
s.stopPropagation(), s.preventDefault(), b(this, $, !0), b(this,
|
|
242
|
+
s.stopPropagation(), s.preventDefault(), b(this, $, !0), b(this, tt, s.clientY), b(this, et, e.scrollTop);
|
|
243
243
|
const n = /* @__PURE__ */ a((r) => {
|
|
244
244
|
if (!t(this, $)) return;
|
|
245
|
-
const l = t(this, E).track.getBoundingClientRect(), c = t(this, E).thumb.clientHeight, u = l.height - c, f = r.clientY - t(this,
|
|
245
|
+
const l = t(this, E).track.getBoundingClientRect(), c = t(this, E).thumb.clientHeight, u = l.height - c, f = r.clientY - t(this, tt), g = e.clientHeight, w = table.scrollHeight - g;
|
|
246
246
|
if (u > 0 && w > 0) {
|
|
247
247
|
const L = f / u * w;
|
|
248
|
-
e.scrollTop = t(this,
|
|
248
|
+
e.scrollTop = t(this, et) + L;
|
|
249
249
|
}
|
|
250
250
|
this.refresh();
|
|
251
251
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
@@ -349,33 +349,33 @@ const Xt = class Xt extends HTMLElement {
|
|
|
349
349
|
e();
|
|
350
350
|
}
|
|
351
351
|
};
|
|
352
|
-
V = new WeakMap(), $ = new WeakMap(), E = new WeakMap(),
|
|
352
|
+
V = new WeakMap(), $ = new WeakMap(), E = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), dt = new WeakMap(), a(Xt, "NineTableVScrollBar");
|
|
353
353
|
let It = Xt;
|
|
354
354
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", It);
|
|
355
|
-
var ft,
|
|
356
|
-
const
|
|
355
|
+
var ft, F;
|
|
356
|
+
const H = class H {
|
|
357
357
|
/**
|
|
358
358
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
359
359
|
*/
|
|
360
360
|
static compileAll(i) {
|
|
361
|
-
return Array.isArray(i) ? i.map((e) =>
|
|
361
|
+
return Array.isArray(i) ? i.map((e) => H.compile(e)) : [];
|
|
362
362
|
}
|
|
363
363
|
/**
|
|
364
364
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
365
365
|
*/
|
|
366
366
|
static compile(i) {
|
|
367
|
-
var n, o, r;
|
|
367
|
+
var n, o, r, l;
|
|
368
368
|
if (!i) return null;
|
|
369
369
|
const e = i.cloneNode(!0);
|
|
370
|
-
return t(n =
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
|
|
370
|
+
return t(n = H, ft).call(n, e), t(o = H, F).call(o, e, "thead"), t(r = H, F).call(r, e, "tbody"), t(l = H, F).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((c, d) => {
|
|
371
|
+
const u = c.getAttribute("fixed");
|
|
372
|
+
u && e.querySelectorAll(`thead [data-col="${d}"], tbody [data-col="${d}"], tfoot [data-col="${d}"]`).forEach((f) => {
|
|
373
|
+
f.setAttribute("fixed", u);
|
|
374
374
|
});
|
|
375
375
|
}), e;
|
|
376
376
|
}
|
|
377
377
|
};
|
|
378
|
-
ft = new WeakMap(),
|
|
378
|
+
ft = new WeakMap(), F = new WeakMap(), a(H, "TableCompiler"), h(H, ft, /* @__PURE__ */ a((i) => {
|
|
379
379
|
if (!i.querySelector("colgroup")) {
|
|
380
380
|
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"), o = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
381
381
|
for (let r = 0; r < s; r++) {
|
|
@@ -389,7 +389,7 @@ ft = new WeakMap(), et = new WeakMap(), a(C, "TableCompiler"), h(C, ft, /* @__PU
|
|
|
389
389
|
s ? s.after(e) : i.prepend(e);
|
|
390
390
|
}
|
|
391
391
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
392
|
-
}, "#ensureTableStructure")), h(
|
|
392
|
+
}, "#ensureTableStructure")), h(H, F, /* @__PURE__ */ a((i, e) => {
|
|
393
393
|
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), o = s.length;
|
|
394
394
|
if (o === 0 || n.length === 0) return;
|
|
395
395
|
let r = 0;
|
|
@@ -422,7 +422,7 @@ ft = new WeakMap(), et = new WeakMap(), a(C, "TableCompiler"), h(C, ft, /* @__PU
|
|
|
422
422
|
});
|
|
423
423
|
});
|
|
424
424
|
}, "#resetColIndex"));
|
|
425
|
-
let $t =
|
|
425
|
+
let $t = H;
|
|
426
426
|
var x, M, R, W, Y, X, ut, gt, bt, it, pt, yt, st, nt, mt;
|
|
427
427
|
const Ut = class Ut {
|
|
428
428
|
constructor(i) {
|
|
@@ -610,12 +610,12 @@ const Ut = class Ut {
|
|
|
610
610
|
};
|
|
611
611
|
x = new WeakMap(), M = new WeakMap(), R = new WeakMap(), W = new WeakMap(), Y = new WeakMap(), X = new WeakMap(), ut = new WeakMap(), gt = new WeakMap(), bt = new WeakMap(), it = new WeakMap(), pt = new WeakMap(), yt = new WeakMap(), st = new WeakMap(), nt = new WeakMap(), mt = new WeakMap(), a(Ut, "RowManager");
|
|
612
612
|
let Wt = Ut;
|
|
613
|
-
var
|
|
614
|
-
const
|
|
613
|
+
var Z, j, xt, vt, wt, St, Et;
|
|
614
|
+
const Q = class Q extends HTMLElement {
|
|
615
615
|
constructor() {
|
|
616
616
|
super();
|
|
617
|
-
h(this,
|
|
618
|
-
h(this,
|
|
617
|
+
h(this, Z, null);
|
|
618
|
+
h(this, j);
|
|
619
619
|
h(this, xt, /* @__PURE__ */ a(() => {
|
|
620
620
|
[
|
|
621
621
|
{ selector: ".ng-container-body", type: null },
|
|
@@ -624,7 +624,7 @@ const J = class J extends HTMLElement {
|
|
|
624
624
|
].forEach(({ selector: s, type: n }) => {
|
|
625
625
|
const o = this.querySelector(s);
|
|
626
626
|
if (!o) return;
|
|
627
|
-
const r = t(this, wt).call(this, t(this,
|
|
627
|
+
const r = t(this, wt).call(this, t(this, Z), n);
|
|
628
628
|
o.innerHTML = "", o.appendChild(r);
|
|
629
629
|
});
|
|
630
630
|
}, "#renderSplitContainers"));
|
|
@@ -640,7 +640,7 @@ const J = class J extends HTMLElement {
|
|
|
640
640
|
});
|
|
641
641
|
}, "#updateContainerWidths"));
|
|
642
642
|
S(this, "generate", /* @__PURE__ */ a((e) => {
|
|
643
|
-
e && (b(this,
|
|
643
|
+
e && (b(this, Z, $t.compile(e)), t(this, Z).style.display = "table", t(this, xt).call(this), t(this, vt).call(this), t(this, j).initialize(), setTimeout(() => {
|
|
644
644
|
var s;
|
|
645
645
|
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
646
646
|
}, 0));
|
|
@@ -658,7 +658,7 @@ const J = class J extends HTMLElement {
|
|
|
658
658
|
o.remove();
|
|
659
659
|
}), n;
|
|
660
660
|
}, "#createSplitTable"));
|
|
661
|
-
S(this, "getRowHeight", /* @__PURE__ */ a(() => t(this,
|
|
661
|
+
S(this, "getRowHeight", /* @__PURE__ */ a(() => t(this, j).getRowHeight(), "getRowHeight"));
|
|
662
662
|
S(this, "scrollToX", /* @__PURE__ */ a((e) => {
|
|
663
663
|
const s = this.querySelector(".ng-container-body");
|
|
664
664
|
s && (s.scrollLeft = e);
|
|
@@ -671,7 +671,7 @@ const J = class J extends HTMLElement {
|
|
|
671
671
|
t(this, Et).call(this);
|
|
672
672
|
}, "#init"));
|
|
673
673
|
h(this, Et, /* @__PURE__ */ a(() => {
|
|
674
|
-
const e =
|
|
674
|
+
const e = Q.SCROLLBAR_SIZE;
|
|
675
675
|
this.innerHTML = `
|
|
676
676
|
<style>
|
|
677
677
|
nine-table-sheet {
|
|
@@ -807,7 +807,7 @@ const J = class J extends HTMLElement {
|
|
|
807
807
|
</div>
|
|
808
808
|
`;
|
|
809
809
|
}, "#render"));
|
|
810
|
-
b(this,
|
|
810
|
+
b(this, j, new Wt(this));
|
|
811
811
|
}
|
|
812
812
|
connectedCallback() {
|
|
813
813
|
t(this, St).call(this);
|
|
@@ -816,8 +816,8 @@ const J = class J extends HTMLElement {
|
|
|
816
816
|
this.innerHTML = "", _.log("NineTableSheet destroyed.");
|
|
817
817
|
}
|
|
818
818
|
};
|
|
819
|
-
|
|
820
|
-
let at =
|
|
819
|
+
Z = new WeakMap(), j = new WeakMap(), xt = new WeakMap(), vt = new WeakMap(), wt = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), a(Q, "NineTableSheet"), S(Q, "SCROLLBAR_SIZE", 16);
|
|
820
|
+
let at = Q;
|
|
821
821
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", at);
|
|
822
822
|
var Rt, ot;
|
|
823
823
|
const Kt = class Kt extends HTMLElement {
|
|
@@ -1026,13 +1026,13 @@ const Zt = class Zt {
|
|
|
1026
1026
|
};
|
|
1027
1027
|
z = new WeakMap(), U = new WeakMap(), a(Zt, "ngRow");
|
|
1028
1028
|
let Dt = Zt;
|
|
1029
|
-
var k, v, A,
|
|
1029
|
+
var k, v, A, G, At, O, qt, lt, Lt, Ht, J;
|
|
1030
1030
|
const q = class q {
|
|
1031
1031
|
constructor(i, e) {
|
|
1032
1032
|
h(this, k);
|
|
1033
1033
|
h(this, v);
|
|
1034
1034
|
h(this, A, []);
|
|
1035
|
-
h(this,
|
|
1035
|
+
h(this, G, []);
|
|
1036
1036
|
h(this, At, 0);
|
|
1037
1037
|
h(this, O, []);
|
|
1038
1038
|
h(this, qt, /* @__PURE__ */ a(() => {
|
|
@@ -1058,11 +1058,11 @@ const q = class q {
|
|
|
1058
1058
|
_: [0, 0, 0, 0, q.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, O).slice(), -1, {}, {}]
|
|
1059
1059
|
}), "#getDefaultMeta"));
|
|
1060
1060
|
S(this, "reset", /* @__PURE__ */ a(() => {
|
|
1061
|
-
b(this, A, []), b(this,
|
|
1061
|
+
b(this, A, []), b(this, G, []);
|
|
1062
1062
|
}, "reset"));
|
|
1063
1063
|
S(this, "clear", /* @__PURE__ */ a(() => {
|
|
1064
1064
|
var i;
|
|
1065
|
-
t(this, v).rawRecords = [], b(this, A, []), b(this,
|
|
1065
|
+
t(this, v).rawRecords = [], b(this, A, []), b(this, G, []), (i = t(this, v).viewRecords) != null && i.reset && t(this, v).viewRecords.reset();
|
|
1066
1066
|
}, "clear"));
|
|
1067
1067
|
h(this, Lt, /* @__PURE__ */ a((i) => {
|
|
1068
1068
|
var n;
|
|
@@ -1112,14 +1112,14 @@ const q = class q {
|
|
|
1112
1112
|
l !== s && r.__ng.rowState !== q.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(e) || (r.__ng.o[e] = l), r.__ng.rowState = q.ROW_STATE.UPDATE), r.v[o] = s, t(this, v).owner.refreshData && t(this, v).owner.refreshData(i);
|
|
1113
1113
|
}, "setValue"));
|
|
1114
1114
|
S(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1115
|
-
b(this,
|
|
1115
|
+
b(this, G, t(this, v).rawRecords.filter((i) => !i.__ng.deleted)), b(this, A, t(this, v).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, v).rawRecords.forEach((i, e) => {
|
|
1116
1116
|
i.__ng.rowidx = e;
|
|
1117
1117
|
}), t(this, A).forEach((i, e) => {
|
|
1118
1118
|
i.__ng.i = e;
|
|
1119
1119
|
});
|
|
1120
1120
|
}, "resetRecords"));
|
|
1121
1121
|
S(this, "getValidData", /* @__PURE__ */ a(() => (t(this, A).length === 0 && t(this, v).rawRecords.length > 0 && this.resetRecords(), t(this, A)), "getValidData"));
|
|
1122
|
-
h(this,
|
|
1122
|
+
h(this, J, /* @__PURE__ */ a((i) => {
|
|
1123
1123
|
var s;
|
|
1124
1124
|
if (!i) return i;
|
|
1125
1125
|
const e = typeof ((s = t(this, k).fields) == null ? void 0 : s.get) == "function" ? t(this, k).fields.get() : [];
|
|
@@ -1135,19 +1135,19 @@ const q = class q {
|
|
|
1135
1135
|
var o;
|
|
1136
1136
|
const s = this.getValidData();
|
|
1137
1137
|
if (!s || s.length <= 0) return;
|
|
1138
|
-
if (i == null) return t(this,
|
|
1138
|
+
if (i == null) return t(this, J).call(this, s);
|
|
1139
1139
|
if (i < 0 || i >= s.length) return null;
|
|
1140
1140
|
const n = typeof ((o = t(this, k).fields) == null ? void 0 : o.get) == "function" ? t(this, k).fields.get() : [];
|
|
1141
1141
|
if (e != null) {
|
|
1142
1142
|
const r = n.indexOf(e);
|
|
1143
1143
|
return r >= 0 ? s[i].v[r] : null;
|
|
1144
1144
|
}
|
|
1145
|
-
return t(this,
|
|
1145
|
+
return t(this, J).call(this, s[i]);
|
|
1146
1146
|
}, "get"));
|
|
1147
1147
|
b(this, k, i), b(this, v, e), t(this, qt).call(this);
|
|
1148
1148
|
}
|
|
1149
1149
|
get source() {
|
|
1150
|
-
return t(this,
|
|
1150
|
+
return t(this, J).call(this, t(this, v).rawRecords);
|
|
1151
1151
|
}
|
|
1152
1152
|
set source(i) {
|
|
1153
1153
|
this.clear(), this.add(i, !1);
|
|
@@ -1162,7 +1162,7 @@ const q = class q {
|
|
|
1162
1162
|
return this.length;
|
|
1163
1163
|
}
|
|
1164
1164
|
};
|
|
1165
|
-
k = new WeakMap(), v = new WeakMap(), A = new WeakMap(),
|
|
1165
|
+
k = new WeakMap(), v = new WeakMap(), A = new WeakMap(), G = new WeakMap(), At = new WeakMap(), O = new WeakMap(), qt = new WeakMap(), lt = new WeakMap(), Lt = new WeakMap(), Ht = new WeakMap(), J = new WeakMap(), a(q, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1166
1166
|
S(q, "ROW_STATE", {
|
|
1167
1167
|
EMPTY: "EMPTY",
|
|
1168
1168
|
NORMAL: "NORMAL",
|