@ninebone/table 0.0.409 β 0.0.410
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 +52 -53
- 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
|
@@ -23,25 +23,25 @@ const re = class re extends Se.constructor {
|
|
|
23
23
|
a(re, "Trace");
|
|
24
24
|
let jt = re;
|
|
25
25
|
const H = new jt();
|
|
26
|
-
var _,
|
|
26
|
+
var _, O, p, P, V, Y, St, X, Et;
|
|
27
27
|
const le = class le extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
c(this, _);
|
|
31
|
-
c(this,
|
|
31
|
+
c(this, O, !1);
|
|
32
32
|
c(this, p);
|
|
33
|
+
c(this, P);
|
|
33
34
|
c(this, V);
|
|
34
35
|
c(this, Y);
|
|
35
|
-
c(this, X);
|
|
36
36
|
c(this, St, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!t(this, _)) return;
|
|
38
38
|
const e = t(this, _).querySelector(".ng-container-body");
|
|
39
|
-
e && (g(this,
|
|
39
|
+
e && (g(this, Y, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), t(this,
|
|
41
|
+
})), t(this, Y).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!t(this, _) || !t(this, p) || t(this,
|
|
44
|
+
if (!t(this, _) || !t(this, p) || t(this, O)) return;
|
|
45
45
|
const e = t(this, p).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
47
|
const n = t(this, p).track, r = t(this, p).thumb, o = t(this, _).querySelector(".ng-container-bottom"), l = e.clientWidth, d = s.scrollWidth;
|
|
@@ -61,7 +61,7 @@ const le = class le extends HTMLElement {
|
|
|
61
61
|
const m = h - f;
|
|
62
62
|
y > m && (y = m), r.style.left = `${y}px`, H.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
c(this,
|
|
64
|
+
c(this, X, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
66
66
|
const s = t(this, p).container, n = s.querySelector("table");
|
|
67
67
|
if (!n) return !1;
|
|
@@ -75,16 +75,16 @@ const le = class le extends HTMLElement {
|
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
c(this, Et, /* @__PURE__ */ a(() => {
|
|
77
77
|
const e = /* @__PURE__ */ a((n) => {
|
|
78
|
-
clearInterval(t(this,
|
|
78
|
+
clearInterval(t(this, P)), clearInterval(t(this, V));
|
|
79
79
|
const r = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
80
|
-
t(this,
|
|
81
|
-
clearInterval(t(this,
|
|
80
|
+
t(this, X).call(this, r + n), g(this, P, setInterval(() => {
|
|
81
|
+
clearInterval(t(this, P)), g(this, V, setInterval(() => {
|
|
82
82
|
const o = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
83
|
-
t(this,
|
|
83
|
+
t(this, X).call(this, o + n) || clearInterval(t(this, V));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
87
|
-
clearInterval(t(this,
|
|
87
|
+
clearInterval(t(this, P)), clearInterval(t(this, V));
|
|
88
88
|
}, "clearTimer");
|
|
89
89
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
90
90
|
t(this, p).left.addEventListener(n, s), t(this, p).right.addEventListener(n, s), t(this, p).track.addEventListener(n, s);
|
|
@@ -96,16 +96,16 @@ const le = class le extends HTMLElement {
|
|
|
96
96
|
if (n.button !== 0) return;
|
|
97
97
|
n.preventDefault();
|
|
98
98
|
const r = t(this, p).track.getBoundingClientRect(), o = t(this, p).thumb.clientWidth;
|
|
99
|
-
t(this,
|
|
99
|
+
t(this, X).call(this, n.clientX - r.left - o / 2);
|
|
100
100
|
}), t(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
101
101
|
if (n.button !== 0) return;
|
|
102
|
-
n.stopPropagation(), n.preventDefault(), g(this,
|
|
102
|
+
n.stopPropagation(), n.preventDefault(), g(this, O, !0), this.shiftX = n.clientX - t(this, p).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ a((l) => {
|
|
104
|
-
if (!t(this,
|
|
104
|
+
if (!t(this, O)) return;
|
|
105
105
|
const d = t(this, p).track.getBoundingClientRect();
|
|
106
|
-
t(this,
|
|
106
|
+
t(this, X).call(this, l.clientX - d.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
108
|
-
g(this,
|
|
108
|
+
g(this, O, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
110
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
111
111
|
});
|
|
@@ -189,25 +189,25 @@ const le = class le extends HTMLElement {
|
|
|
189
189
|
left: this.querySelector(".ng-scroll-left"),
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), s.addEventListener("scroll", () => {
|
|
192
|
-
t(this,
|
|
192
|
+
t(this, O) || this.refresh();
|
|
193
193
|
}), t(this, Et).call(this), t(this, St).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
196
196
|
}
|
|
197
197
|
disconnectedCallback() {
|
|
198
|
-
t(this,
|
|
198
|
+
t(this, Y) && t(this, Y).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
_ = new WeakMap(),
|
|
201
|
+
_ = new WeakMap(), O = new WeakMap(), p = new WeakMap(), P = new WeakMap(), V = new WeakMap(), Y = new WeakMap(), St = new WeakMap(), X = new WeakMap(), Et = new WeakMap(), a(le, "NineTableHScrollBar");
|
|
202
202
|
let Kt = le;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Kt);
|
|
204
|
-
var
|
|
204
|
+
var U, Q, z, S, ht, dt, Rt;
|
|
205
205
|
const ae = class ae extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
|
-
c(this,
|
|
208
|
+
c(this, U);
|
|
209
209
|
c(this, Q);
|
|
210
|
-
c(this,
|
|
210
|
+
c(this, z, !1);
|
|
211
211
|
c(this, S);
|
|
212
212
|
c(this, ht, 0);
|
|
213
213
|
c(this, dt, 0);
|
|
@@ -215,9 +215,8 @@ const ae = class ae extends HTMLElement {
|
|
|
215
215
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
216
216
|
*/
|
|
217
217
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, l = (t(this, D).data.get() || []).length, d = t(this, Q).getRowHeight(), h = l * d;
|
|
218
|
+
H.log("refresh", t(this, z)), H.log("refresh2");
|
|
219
|
+
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, l = (t(this, U).data.get() || []).length, d = t(this, Q).getRowHeight(), h = l * d;
|
|
221
220
|
if (h <= r) {
|
|
222
221
|
n.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
223
222
|
return;
|
|
@@ -235,16 +234,16 @@ const ae = class ae extends HTMLElement {
|
|
|
235
234
|
}, "refresh"));
|
|
236
235
|
c(this, Rt, /* @__PURE__ */ a(() => {
|
|
237
236
|
const e = t(this, S).container, s = /* @__PURE__ */ a(() => {
|
|
238
|
-
const r = (t(this,
|
|
237
|
+
const r = (t(this, U).data.get() || []).length, o = t(this, Q).getRowHeight();
|
|
239
238
|
return r * o;
|
|
240
239
|
}, "getContentHeight");
|
|
241
240
|
e.addEventListener("scroll", () => {
|
|
242
|
-
t(this,
|
|
241
|
+
t(this, z) || this.refresh();
|
|
243
242
|
}), t(this, S).thumb.addEventListener("mousedown", (n) => {
|
|
244
243
|
if (n.button !== 0) return;
|
|
245
|
-
n.stopPropagation(), n.preventDefault(), g(this,
|
|
244
|
+
n.stopPropagation(), n.preventDefault(), g(this, z, !0), g(this, ht, n.clientY), g(this, dt, e.scrollTop);
|
|
246
245
|
const r = /* @__PURE__ */ a((l) => {
|
|
247
|
-
if (!t(this,
|
|
246
|
+
if (!t(this, z)) return;
|
|
248
247
|
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h, b = l.clientY - t(this, ht), y = e.clientHeight, m = s(), R = Math.max(m - y, 1);
|
|
249
248
|
if (u > 0 && R > 0) {
|
|
250
249
|
const J = b / u * R;
|
|
@@ -254,7 +253,7 @@ const ae = class ae extends HTMLElement {
|
|
|
254
253
|
}
|
|
255
254
|
this.refresh();
|
|
256
255
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
257
|
-
g(this,
|
|
256
|
+
g(this, z, !1), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
258
257
|
}, "onMouseUp");
|
|
259
258
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
260
259
|
}), t(this, S).track.addEventListener("mousedown", (n) => {
|
|
@@ -273,7 +272,7 @@ const ae = class ae extends HTMLElement {
|
|
|
273
272
|
}, "#init"));
|
|
274
273
|
}
|
|
275
274
|
connectedCallback() {
|
|
276
|
-
g(this,
|
|
275
|
+
g(this, U, this.getRootNode().host), g(this, Q, this.closest("nine-table-sheet")), this.innerHTML = `
|
|
277
276
|
<style>
|
|
278
277
|
nine-table-vscrollbar {
|
|
279
278
|
display: flex;
|
|
@@ -339,7 +338,7 @@ const ae = class ae extends HTMLElement {
|
|
|
339
338
|
<button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
|
|
340
339
|
`;
|
|
341
340
|
const e = /* @__PURE__ */ a(() => {
|
|
342
|
-
const s = t(this,
|
|
341
|
+
const s = t(this, U).shadowRoot.querySelector(".ng-container-body");
|
|
343
342
|
if (!s) {
|
|
344
343
|
setTimeout(e, 10);
|
|
345
344
|
return;
|
|
@@ -355,7 +354,7 @@ const ae = class ae extends HTMLElement {
|
|
|
355
354
|
e();
|
|
356
355
|
}
|
|
357
356
|
};
|
|
358
|
-
|
|
357
|
+
U = new WeakMap(), Q = new WeakMap(), z = new WeakMap(), S = new WeakMap(), ht = new WeakMap(), dt = new WeakMap(), Rt = new WeakMap(), a(ae, "NineTableVScrollBar");
|
|
359
358
|
let Zt = ae;
|
|
360
359
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", Zt);
|
|
361
360
|
var At, tt;
|
|
@@ -429,16 +428,16 @@ At = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, At, /* @__PU
|
|
|
429
428
|
});
|
|
430
429
|
}, "#resetColIndex"));
|
|
431
430
|
let Gt = M;
|
|
432
|
-
var I, w, W, T,
|
|
431
|
+
var I, w, W, T, D, F, B, et, Tt, qt, kt, ft, ut, Lt, Ht, gt, Ct, it, bt;
|
|
433
432
|
const ce = class ce {
|
|
434
433
|
constructor(i) {
|
|
435
434
|
c(this, I);
|
|
436
435
|
c(this, w);
|
|
437
436
|
c(this, W, /* @__PURE__ */ new Map());
|
|
438
437
|
c(this, T, null);
|
|
439
|
-
c(this,
|
|
438
|
+
c(this, D, null);
|
|
440
439
|
c(this, F, 0);
|
|
441
|
-
c(this,
|
|
440
|
+
c(this, B, 40);
|
|
442
441
|
c(this, et, !1);
|
|
443
442
|
c(this, Tt, 3);
|
|
444
443
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
@@ -478,7 +477,7 @@ const ce = class ce {
|
|
|
478
477
|
if (!n) return;
|
|
479
478
|
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
480
479
|
const r = n.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
481
|
-
for (let l = 0; l < t(this,
|
|
480
|
+
for (let l = 0; l < t(this, B); l++)
|
|
482
481
|
s.forEach((d) => {
|
|
483
482
|
o.appendChild(d.cloneNode(!0));
|
|
484
483
|
});
|
|
@@ -515,7 +514,7 @@ const ce = class ce {
|
|
|
515
514
|
c(this, ut, /* @__PURE__ */ a(() => {
|
|
516
515
|
if ((t(this, I).data.get() || []).length, t(this, F) > 0 && t(this, T) > 0) {
|
|
517
516
|
const e = Math.ceil(t(this, F) / t(this, T));
|
|
518
|
-
g(this,
|
|
517
|
+
g(this, B, e + t(this, Tt)), H.log("visibleRows:", e, "cachedRowCount:", t(this, B));
|
|
519
518
|
}
|
|
520
519
|
}, "#updateRowCount"));
|
|
521
520
|
c(this, Lt, /* @__PURE__ */ a(() => {
|
|
@@ -533,7 +532,7 @@ const ce = class ce {
|
|
|
533
532
|
}
|
|
534
533
|
}, "#syncRowHeights"));
|
|
535
534
|
c(this, Ht, /* @__PURE__ */ a(() => {
|
|
536
|
-
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (g(this,
|
|
535
|
+
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (g(this, D, new ResizeObserver((i) => {
|
|
537
536
|
for (const e of i) {
|
|
538
537
|
const s = e.target;
|
|
539
538
|
if (!s.classList.contains("active")) continue;
|
|
@@ -546,7 +545,7 @@ const ce = class ce {
|
|
|
546
545
|
t(this, F) !== l && (g(this, F, l), t(this, ut).call(this), t(this, T) !== null && t(this, gt).call(this));
|
|
547
546
|
}
|
|
548
547
|
}
|
|
549
|
-
})), t(this,
|
|
548
|
+
})), t(this, D).observe(t(this, w)));
|
|
550
549
|
}, "#initResizeObserver"));
|
|
551
550
|
c(this, gt, /* @__PURE__ */ a(() => {
|
|
552
551
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
@@ -577,8 +576,8 @@ const ce = class ce {
|
|
|
577
576
|
var d;
|
|
578
577
|
const e = t(this, T);
|
|
579
578
|
if (!e || e <= 0) return;
|
|
580
|
-
const n = (t(this, I).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, W).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this,
|
|
581
|
-
H.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this,
|
|
579
|
+
const n = (t(this, I).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, W).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this, B);
|
|
580
|
+
H.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, B)}, targetDataIndex range: ${r} ~ ${l} (Total: ${n})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
582
581
|
const f = t(this, w).querySelector(h);
|
|
583
582
|
if (!f) return;
|
|
584
583
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
@@ -603,7 +602,7 @@ const ce = class ce {
|
|
|
603
602
|
});
|
|
604
603
|
}, "#bindRowData"));
|
|
605
604
|
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
606
|
-
t(this,
|
|
605
|
+
t(this, D) && (t(this, D).disconnect(), g(this, D, null));
|
|
607
606
|
}, "destroy"));
|
|
608
607
|
g(this, I, i.getRootNode().host), g(this, w, i), t(this, Ht).call(this);
|
|
609
608
|
}
|
|
@@ -615,7 +614,7 @@ const ce = class ce {
|
|
|
615
614
|
return ((e = t(this, W).get(i)) == null ? void 0 : e.length) || 1;
|
|
616
615
|
}
|
|
617
616
|
};
|
|
618
|
-
I = new WeakMap(), w = new WeakMap(), W = new WeakMap(), T = new WeakMap(),
|
|
617
|
+
I = new WeakMap(), w = new WeakMap(), W = new WeakMap(), T = new WeakMap(), D = new WeakMap(), F = new WeakMap(), B = new WeakMap(), et = new WeakMap(), Tt = new WeakMap(), qt = new WeakMap(), kt = new WeakMap(), ft = new WeakMap(), ut = new WeakMap(), Lt = new WeakMap(), Ht = new WeakMap(), gt = new WeakMap(), Ct = new WeakMap(), it = new WeakMap(), bt = new WeakMap(), a(ce, "RowManager");
|
|
619
618
|
let Jt = ce;
|
|
620
619
|
var Mt, st, j, _t, $t, It, Wt, Ot;
|
|
621
620
|
const ct = class ct extends HTMLElement {
|
|
@@ -1048,7 +1047,7 @@ const fe = class fe {
|
|
|
1048
1047
|
};
|
|
1049
1048
|
mt = new WeakMap(), nt = new WeakMap(), a(fe, "ngRow");
|
|
1050
1049
|
let ee = fe;
|
|
1051
|
-
var k, E, L, ot, Nt,
|
|
1050
|
+
var k, E, L, ot, Nt, N, Pt, K, xt, Vt, Yt, rt;
|
|
1052
1051
|
const C = class C {
|
|
1053
1052
|
constructor(i, e) {
|
|
1054
1053
|
c(this, k);
|
|
@@ -1056,15 +1055,15 @@ const C = class C {
|
|
|
1056
1055
|
c(this, L, []);
|
|
1057
1056
|
c(this, ot, []);
|
|
1058
1057
|
c(this, Nt, 0);
|
|
1059
|
-
c(this,
|
|
1058
|
+
c(this, N, []);
|
|
1060
1059
|
c(this, Pt, /* @__PURE__ */ a(() => {
|
|
1061
|
-
g(this,
|
|
1060
|
+
g(this, N, []);
|
|
1062
1061
|
const i = t(this, k).template || [];
|
|
1063
1062
|
Array.from(i).forEach((e) => {
|
|
1064
1063
|
var s;
|
|
1065
|
-
t(this,
|
|
1064
|
+
t(this, N).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1066
1065
|
}), (t(this, E).rawRecords || []).forEach((e) => {
|
|
1067
|
-
e.__ng || (e.__ng = t(this, xt).call(this)), e.__ng.height = t(this,
|
|
1066
|
+
e.__ng || (e.__ng = t(this, xt).call(this)), e.__ng.height = t(this, N).slice();
|
|
1068
1067
|
});
|
|
1069
1068
|
}, "#initialize"));
|
|
1070
1069
|
c(this, K, /* @__PURE__ */ a(() => {
|
|
@@ -1092,10 +1091,10 @@ const C = class C {
|
|
|
1092
1091
|
rowState: C.ROW_STATE.EMPTY,
|
|
1093
1092
|
deleted: !1,
|
|
1094
1093
|
filtered: !1,
|
|
1095
|
-
height: t(this,
|
|
1094
|
+
height: t(this, N).slice(),
|
|
1096
1095
|
o: {},
|
|
1097
1096
|
c: {},
|
|
1098
|
-
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this,
|
|
1097
|
+
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, N).slice(), -1, {}, {}]
|
|
1099
1098
|
}), "#getDefaultMeta"));
|
|
1100
1099
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
1101
1100
|
g(this, L, []), g(this, ot, []), t(this, K).call(this);
|
|
@@ -1187,7 +1186,7 @@ const C = class C {
|
|
|
1187
1186
|
return this.length;
|
|
1188
1187
|
}
|
|
1189
1188
|
};
|
|
1190
|
-
k = new WeakMap(), E = new WeakMap(), L = new WeakMap(), ot = new WeakMap(), Nt = new WeakMap(),
|
|
1189
|
+
k = new WeakMap(), E = new WeakMap(), L = new WeakMap(), ot = new WeakMap(), Nt = new WeakMap(), N = new WeakMap(), Pt = new WeakMap(), K = new WeakMap(), xt = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), rt = new WeakMap(), a(C, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1191
1190
|
v(C, "ROW_STATE", {
|
|
1192
1191
|
EMPTY: "EMPTY",
|
|
1193
1192
|
NORMAL: "NORMAL",
|