@ninebone/table 0.0.67 → 0.0.70
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 +420 -163
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +19 -11
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,98 +1,101 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var qt = Object.defineProperty;
|
|
2
|
+
var It = (v) => {
|
|
3
|
+
throw TypeError(v);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
import { trace as
|
|
10
|
-
const
|
|
5
|
+
var Ht = (v, c, e) => c in v ? qt(v, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : v[c] = e;
|
|
6
|
+
var l = (v, c) => qt(v, "name", { value: c, configurable: !0 });
|
|
7
|
+
var I = (v, c, e) => Ht(v, typeof c != "symbol" ? c + "" : c, e), $t = (v, c, e) => c.has(v) || It("Cannot " + e);
|
|
8
|
+
var t = (v, c, e) => ($t(v, c, "read from private field"), e ? e.call(v) : c.get(v)), h = (v, c, e) => c.has(v) ? It("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(v) : c.set(v, e), g = (v, c, e, s) => ($t(v, c, "write to private field"), s ? s.call(v, e) : c.set(v, e), e);
|
|
9
|
+
import { trace as Rt } from "@ninebone/util";
|
|
10
|
+
const vt = class vt extends Rt.constructor {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(), this.init("nine-table", "green");
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
let
|
|
17
|
-
const
|
|
18
|
-
var
|
|
19
|
-
const
|
|
15
|
+
l(vt, "Trace");
|
|
16
|
+
let dt = vt;
|
|
17
|
+
const J = new dt();
|
|
18
|
+
var Y, Q;
|
|
19
|
+
const X = class X extends HTMLElement {
|
|
20
20
|
constructor() {
|
|
21
21
|
super();
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
h(this, Y, null);
|
|
23
|
+
I(this, "init", /* @__PURE__ */ l((e) => {
|
|
24
24
|
if (!e) return;
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
for (let
|
|
30
|
-
const
|
|
31
|
-
|
|
25
|
+
const s = /* @__PURE__ */ l((a) => {
|
|
26
|
+
const p = /* @__PURE__ */ l((d) => {
|
|
27
|
+
if (d.querySelector("colgroup")) return;
|
|
28
|
+
const m = d.querySelector("tbody tr") || d.querySelector("tr"), q = m ? m.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), E = Math.max(Math.floor((d.clientWidth || 600) / q), 100);
|
|
29
|
+
for (let H = 0; H < q; H++) {
|
|
30
|
+
const ut = document.createElement("col");
|
|
31
|
+
ut.setAttribute("width", E), x.appendChild(ut);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
}, "ensureColgroup"),
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
|
|
33
|
+
d.prepend(x);
|
|
34
|
+
}, "ensureColgroup"), r = /* @__PURE__ */ l((d) => {
|
|
35
|
+
if (d.querySelector("thead")) return;
|
|
36
|
+
const m = document.createElement("thead"), q = d.querySelector("colgroup");
|
|
37
|
+
q ? q.after(m) : d.prepend(m);
|
|
38
38
|
}, "ensureThead");
|
|
39
|
-
return
|
|
40
|
-
}, "initializeTable"),
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
return
|
|
45
|
-
const
|
|
46
|
-
(
|
|
47
|
-
}),
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
x
|
|
39
|
+
return p(a), r(a), a.classList.add("nine-table-element"), a;
|
|
40
|
+
}, "initializeTable"), o = e.cloneNode(!0);
|
|
41
|
+
g(this, Y, s(o)), t(this, Y).style.display = "table";
|
|
42
|
+
const n = this.querySelector(".ng-container-left"), i = this.querySelector(".ng-container-body"), u = this.querySelector(".ng-container-right"), y = /* @__PURE__ */ l((a, p, r = !1) => {
|
|
43
|
+
const d = a.cloneNode(!0), m = Array.from(d.querySelectorAll("colgroup col")), q = [];
|
|
44
|
+
return m.forEach((x, E) => {
|
|
45
|
+
const H = x.getAttribute("fixed");
|
|
46
|
+
(r ? !H || H === "" : H === p) || q.push(E);
|
|
47
|
+
}), q.reverse().forEach((x) => {
|
|
48
|
+
m[x] && m[x].remove(), d.querySelectorAll("tr").forEach((E) => {
|
|
49
|
+
const H = E.querySelectorAll("th, td");
|
|
50
|
+
H[x] && H[x].remove();
|
|
51
51
|
});
|
|
52
|
-
}),
|
|
52
|
+
}), d;
|
|
53
53
|
}, "filterTableByFixed");
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
|
|
54
|
+
if (i) {
|
|
55
|
+
const a = y(t(this, Y), null, !0);
|
|
56
|
+
i.innerHTML = "", i.appendChild(a);
|
|
57
57
|
}
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
let
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
isNaN(
|
|
64
|
-
}),
|
|
65
|
-
const
|
|
66
|
-
|
|
58
|
+
if (n) {
|
|
59
|
+
const a = y(t(this, Y), "left", !1);
|
|
60
|
+
let p = 0;
|
|
61
|
+
a.querySelectorAll("col").forEach((d) => {
|
|
62
|
+
const m = parseInt(d.getAttribute("width"), 10);
|
|
63
|
+
isNaN(m) || (p += m);
|
|
64
|
+
}), n.innerHTML = "", n.appendChild(a);
|
|
65
|
+
const r = p > 0 ? p : 0;
|
|
66
|
+
n.style.flex = `0 0 ${r}px`, n.style.width = `${r}px`;
|
|
67
67
|
}
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
isNaN(
|
|
74
|
-
}),
|
|
75
|
-
const
|
|
76
|
-
|
|
68
|
+
if (u) {
|
|
69
|
+
const a = y(t(this, Y), "right", !1);
|
|
70
|
+
let p = 0;
|
|
71
|
+
a.querySelectorAll("col").forEach((d) => {
|
|
72
|
+
const m = parseInt(d.getAttribute("width"), 10);
|
|
73
|
+
isNaN(m) || (p += m);
|
|
74
|
+
}), u.innerHTML = "", u.appendChild(a);
|
|
75
|
+
const r = p > 0 ? p : 0;
|
|
76
|
+
u.style.flex = `0 0 ${r}px`, u.style.width = `${r}px`;
|
|
77
77
|
}
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
|
|
78
|
+
if (i) {
|
|
79
|
+
const a = this.getRowCount();
|
|
80
|
+
i.style.overflowY = a > 10 ? "auto" : "hidden", i.addEventListener("scroll", () => {
|
|
81
|
+
const p = i.scrollLeft, r = this.querySelector("nine-table-hscrollbar");
|
|
82
|
+
r && typeof r.syncThumb == "function" && r.syncThumb(p);
|
|
83
|
+
});
|
|
81
84
|
}
|
|
82
|
-
|
|
85
|
+
J.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
83
86
|
}, "init"));
|
|
84
|
-
|
|
87
|
+
I(this, "getRowCount", /* @__PURE__ */ l(() => t(this, Y) ? t(this, Y).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
85
88
|
// 🎯 외부 스크롤바 및 컨트롤러 연동용 메서드
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
+
I(this, "scrollToX", /* @__PURE__ */ l((e) => {
|
|
90
|
+
const s = this.querySelector(".ng-container-body");
|
|
91
|
+
s && (s.scrollLeft = e);
|
|
89
92
|
}, "scrollToX"));
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
+
I(this, "scrollToY", /* @__PURE__ */ l((e) => {
|
|
94
|
+
const s = this.querySelector(".ng-container-body");
|
|
95
|
+
s && (s.scrollTop = e);
|
|
93
96
|
}, "scrollToY"));
|
|
94
|
-
|
|
95
|
-
const e =
|
|
97
|
+
h(this, Q, /* @__PURE__ */ l(() => {
|
|
98
|
+
const e = X.SCROLLBAR_SIZE;
|
|
96
99
|
this.innerHTML = `
|
|
97
100
|
<style>
|
|
98
101
|
nine-table-sheet {
|
|
@@ -207,109 +210,363 @@ const E = class E extends HTMLElement {
|
|
|
207
210
|
}, "#render"));
|
|
208
211
|
}
|
|
209
212
|
connectedCallback() {
|
|
210
|
-
|
|
213
|
+
t(this, Q).call(this);
|
|
211
214
|
}
|
|
212
215
|
disconnectedCallback() {
|
|
213
|
-
this.innerHTML = "",
|
|
216
|
+
this.innerHTML = "", J.log("NineTableSheet destroyed.");
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
Y = new WeakMap(), Q = new WeakMap(), l(X, "NineTableSheet"), I(X, "SCROLLBAR_SIZE", 16);
|
|
220
|
+
let bt = X;
|
|
221
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", bt);
|
|
222
|
+
var w, M, b, S, R, U, V, tt, et, z, ot, D, _, B, N;
|
|
223
|
+
const xt = class xt extends HTMLElement {
|
|
224
|
+
constructor() {
|
|
225
|
+
super();
|
|
226
|
+
h(this, w);
|
|
227
|
+
h(this, M);
|
|
228
|
+
h(this, b);
|
|
229
|
+
h(this, S);
|
|
230
|
+
h(this, R);
|
|
231
|
+
h(this, U);
|
|
232
|
+
h(this, V, 0);
|
|
233
|
+
I(this, "refresh", /* @__PURE__ */ l(() => {
|
|
234
|
+
if (!t(this, w)) return;
|
|
235
|
+
const e = t(this, w).querySelector(".ng-container-body");
|
|
236
|
+
if (!e) return;
|
|
237
|
+
const s = $(t(this, b).thumb, this.shadowRoot), o = e.querySelector("table > thead");
|
|
238
|
+
t(this, w).getRowCount;
|
|
239
|
+
const n = $(t(this, b).track).height(), i = $(t(this, b).thumb).height(), u = t(this, w).getRowCount ? t(this, w).getRowCount() : 0;
|
|
240
|
+
if (u <= 10) {
|
|
241
|
+
$(this).hide();
|
|
242
|
+
return;
|
|
243
|
+
} else
|
|
244
|
+
$(this).show();
|
|
245
|
+
const y = o ? o.getBoundingClientRect().height : 0, a = Math.max(Math.min(n * (e.clientHeight - y) / (32 * u), n), 16);
|
|
246
|
+
s[0].dataset.height = a, s.css({ height: a });
|
|
247
|
+
const p = n - t(this, N).call(this);
|
|
248
|
+
if (p <= 0) return;
|
|
249
|
+
let r = 0;
|
|
250
|
+
const d = e.scrollHeight - e.clientHeight;
|
|
251
|
+
d > 0 && (r = parseInt(e.scrollTop / d * p, 10), r > n - i && (r = n - i), r < 0 && (r = 0)), t(this, b).thumb.style.top = r + "px", t(this, b).top.disabled = e.scrollTop <= 0, t(this, b).bottom.disabled = e.scrollTop >= d;
|
|
252
|
+
}, "refresh"));
|
|
253
|
+
I(this, "delayScroll", /* @__PURE__ */ l((e, s, o, n) => {
|
|
254
|
+
clearInterval(t(this, S)), clearInterval(t(this, R));
|
|
255
|
+
const i = t(this, w).querySelector(".ng-container-body");
|
|
256
|
+
i && (i.scrollTop += e * 32), g(this, S, setInterval(() => {
|
|
257
|
+
clearInterval(t(this, S)), g(this, R, setInterval(() => {
|
|
258
|
+
i && (i.scrollTop += e * 32, n && n.call());
|
|
259
|
+
}, o));
|
|
260
|
+
}, s));
|
|
261
|
+
}, "delayScroll"));
|
|
262
|
+
I(this, "stopScroll", /* @__PURE__ */ l(() => {
|
|
263
|
+
clearInterval(t(this, S)), clearInterval(t(this, R));
|
|
264
|
+
}, "stopScroll"));
|
|
265
|
+
h(this, tt, /* @__PURE__ */ l(() => {
|
|
266
|
+
const e = /* @__PURE__ */ l((o) => {
|
|
267
|
+
clearInterval(t(this, S)), clearInterval(t(this, R));
|
|
268
|
+
const n = t(this, w).querySelector(".ng-container-body");
|
|
269
|
+
n && (n.scrollTop += o * 32), g(this, S, setInterval(() => {
|
|
270
|
+
clearInterval(t(this, S)), g(this, R, setInterval(() => {
|
|
271
|
+
n && (n.scrollTop += o * 32);
|
|
272
|
+
}, 10));
|
|
273
|
+
}, 500));
|
|
274
|
+
}, "delayScrollAction");
|
|
275
|
+
$(t(this, b).top).on("mousedown", (o) => {
|
|
276
|
+
o.buttons != 1 || o.altKey || o.ctrlKey || o.shiftKey || e(-1);
|
|
277
|
+
}), $(t(this, b).bottom).on("mousedown", (o) => {
|
|
278
|
+
o.buttons != 1 || o.altKey || o.ctrlKey || o.shiftKey || e(1);
|
|
279
|
+
}), $(t(this, b).top).on("touchstart", (o) => {
|
|
280
|
+
e(-1);
|
|
281
|
+
}), $(t(this, b).bottom).on("touchstart", (o) => {
|
|
282
|
+
e(1);
|
|
283
|
+
});
|
|
284
|
+
const s = /* @__PURE__ */ l(() => {
|
|
285
|
+
clearInterval(t(this, S)), clearInterval(t(this, R));
|
|
286
|
+
}, "clearTimer");
|
|
287
|
+
t(this, b).top.ontouchend = t(this, b).bottom.ontouchend = t(this, b).track.ontouchend = t(this, b).top.onmouseup = t(this, b).top.onmouseleave = t(this, b).bottom.onmouseup = t(this, b).bottom.onmouseleave = t(this, b).track.onmouseup = t(this, b).track.onmouseleave = s, $(t(this, b).track).on("mousedown", t(this, z)), $(t(this, b).track).on("touchstart", t(this, et)), $(t(this, b).thumb).on("mousedown", t(this, _)), $(t(this, b).thumb).on("touchstart", t(this, ot)), document.addEventListener("mouseup", (o) => {
|
|
288
|
+
t(this, M) && g(this, M, !1), document.removeEventListener("mousemove", t(this, B));
|
|
289
|
+
}), document.addEventListener("touchend", (o) => {
|
|
290
|
+
g(this, M, !1), document.removeEventListener("touchmove", t(this, D));
|
|
291
|
+
});
|
|
292
|
+
}, "#init"));
|
|
293
|
+
h(this, et, /* @__PURE__ */ l((e) => {
|
|
294
|
+
e.target.getBoundingClientRect(), e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, z).call(this, e);
|
|
295
|
+
}, "#track_onTouchStart"));
|
|
296
|
+
h(this, z, /* @__PURE__ */ l((e) => {
|
|
297
|
+
if (t(this, M) || e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftKey) return;
|
|
298
|
+
e.preventDefault();
|
|
299
|
+
var s = t(this, b).thumb.getBoundingClientRect();
|
|
300
|
+
const o = t(this, w).querySelector(".ng-container-body");
|
|
301
|
+
if (!o) return;
|
|
302
|
+
const n = o.clientHeight, i = e.clientY > s.y ? n : -n;
|
|
303
|
+
o.scrollTop += i, clearInterval(t(this, S)), clearInterval(t(this, R)), g(this, S, setInterval(() => {
|
|
304
|
+
clearInterval(t(this, S)), g(this, R, setInterval(() => {
|
|
305
|
+
var u = t(this, b).thumb.getBoundingClientRect();
|
|
306
|
+
e.clientY > u.y && e.clientY < u.y + u.height ? clearInterval(t(this, R)) : o.scrollTop += e.clientY > u.y ? n : -n;
|
|
307
|
+
}, 10));
|
|
308
|
+
}, 500));
|
|
309
|
+
}, "#track_onMouseDown"));
|
|
310
|
+
h(this, ot, /* @__PURE__ */ l((e) => {
|
|
311
|
+
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, _).call(this, e), document.addEventListener("touchmove", t(this, D));
|
|
312
|
+
}, "#thumb_onTouchStart"));
|
|
313
|
+
h(this, D, /* @__PURE__ */ l((e) => {
|
|
314
|
+
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, B).call(this, e);
|
|
315
|
+
}, "#thumb_onTouchMove"));
|
|
316
|
+
h(this, _, /* @__PURE__ */ l((e) => {
|
|
317
|
+
g(this, V, e.clientY), g(this, M, !0), this.shiftY = e.offsetY + t(this, b).track.getBoundingClientRect().y, this.trackHeight = $(t(this, b).track).height(), this.thumbHeight = $(t(this, b).thumb).height(), g(this, U, !0), document.addEventListener("mousemove", t(this, B));
|
|
318
|
+
}, "#thumb_onMouseDown"));
|
|
319
|
+
h(this, B, /* @__PURE__ */ l((e) => {
|
|
320
|
+
if (!t(this, M)) return;
|
|
321
|
+
e.preventDefault();
|
|
322
|
+
const s = this.trackHeight, o = t(this, N).call(this);
|
|
323
|
+
var n = e.clientY - this.shiftY;
|
|
324
|
+
n < 0 && (n = 0), n + o > s && (n = parseInt(s - o)), t(this, b).thumb.style.top = n + "px";
|
|
325
|
+
const i = t(this, w).querySelector(".ng-container-body");
|
|
326
|
+
if (!i) return;
|
|
327
|
+
const u = i.scrollHeight - i.clientHeight, y = s - o;
|
|
328
|
+
y > 0 && u > 0 && (i.scrollTop = n / y * u);
|
|
329
|
+
}, "#thumb_onMouseMove"));
|
|
330
|
+
h(this, N, /* @__PURE__ */ l(() => parseInt(t(this, b).thumb.dataset.height || 30, 10), "#getThumbHeight"));
|
|
331
|
+
this.applyBaseStyle();
|
|
332
|
+
}
|
|
333
|
+
connectedCallback() {
|
|
334
|
+
g(this, w, this.getRootNode().host), t(this, w) && (this.shadowRoot.innerHTML = `
|
|
335
|
+
<button class='ng-scroll-top' disabled><div class='ng-scroll-icon'></div></button>
|
|
336
|
+
<div class='ng-scroll-track'> <div class='ng-scroll-thumb'></div> </div>
|
|
337
|
+
<button class='ng-scroll-bottom'><div class='ng-scroll-icon'></div></button>
|
|
338
|
+
`, super.connectedCallback(), g(this, b, {
|
|
339
|
+
track: this.shadowRoot.querySelector(".ng-scroll-track"),
|
|
340
|
+
thumb: this.shadowRoot.querySelector(".ng-scroll-thumb"),
|
|
341
|
+
top: this.shadowRoot.querySelector(".ng-scroll-top"),
|
|
342
|
+
bottom: this.shadowRoot.querySelector(".ng-scroll-bottom")
|
|
343
|
+
}), t(this, tt).call(this));
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
w = new WeakMap(), M = new WeakMap(), b = new WeakMap(), S = new WeakMap(), R = new WeakMap(), U = new WeakMap(), V = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), z = new WeakMap(), ot = new WeakMap(), D = new WeakMap(), _ = new WeakMap(), B = new WeakMap(), N = new WeakMap(), l(xt, "NineTableVScrollBar");
|
|
347
|
+
let ft = xt;
|
|
348
|
+
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", ft);
|
|
349
|
+
var T, A, f, k, C, nt, st, it, lt, W, rt, O, j, K, F;
|
|
350
|
+
const wt = class wt extends HTMLElement {
|
|
351
|
+
constructor() {
|
|
352
|
+
super();
|
|
353
|
+
h(this, T);
|
|
354
|
+
h(this, A);
|
|
355
|
+
h(this, f);
|
|
356
|
+
h(this, k);
|
|
357
|
+
h(this, C);
|
|
358
|
+
h(this, nt);
|
|
359
|
+
h(this, st, 0);
|
|
360
|
+
I(this, "refresh", /* @__PURE__ */ l(() => {
|
|
361
|
+
if (!t(this, T)) return;
|
|
362
|
+
const e = t(this, T).querySelector(".ng-container-body");
|
|
363
|
+
if (!e) return;
|
|
364
|
+
const s = $(t(this, f).thumb, this.shadowRoot), o = e.querySelector("table > thead");
|
|
365
|
+
t(this, T).getRowCount;
|
|
366
|
+
const n = $(t(this, f).track).height(), i = $(t(this, f).thumb).height(), u = t(this, T).getRowCount ? t(this, T).getRowCount() : 0;
|
|
367
|
+
if (u <= 10) {
|
|
368
|
+
$(this).hide();
|
|
369
|
+
return;
|
|
370
|
+
} else
|
|
371
|
+
$(this).show();
|
|
372
|
+
const y = o ? o.getBoundingClientRect().height : 0, a = Math.max(Math.min(n * (e.clientHeight - y) / (32 * u), n), 16);
|
|
373
|
+
s[0].dataset.height = a, s.css({ height: a });
|
|
374
|
+
const p = n - t(this, F).call(this);
|
|
375
|
+
if (p <= 0) return;
|
|
376
|
+
let r = 0;
|
|
377
|
+
const d = e.scrollHeight - e.clientHeight;
|
|
378
|
+
d > 0 && (r = parseInt(e.scrollTop / d * p, 10), r > n - i && (r = n - i), r < 0 && (r = 0)), t(this, f).thumb.style.top = r + "px", t(this, f).top.disabled = e.scrollTop <= 0, t(this, f).bottom.disabled = e.scrollTop >= d;
|
|
379
|
+
}, "refresh"));
|
|
380
|
+
I(this, "delayScroll", /* @__PURE__ */ l((e, s, o, n) => {
|
|
381
|
+
clearInterval(t(this, k)), clearInterval(t(this, C));
|
|
382
|
+
const i = t(this, T).querySelector(".ng-container-body");
|
|
383
|
+
i && (i.scrollTop += e * 32), g(this, k, setInterval(() => {
|
|
384
|
+
clearInterval(t(this, k)), g(this, C, setInterval(() => {
|
|
385
|
+
i && (i.scrollTop += e * 32, n && n.call());
|
|
386
|
+
}, o));
|
|
387
|
+
}, s));
|
|
388
|
+
}, "delayScroll"));
|
|
389
|
+
I(this, "stopScroll", /* @__PURE__ */ l(() => {
|
|
390
|
+
clearInterval(t(this, k)), clearInterval(t(this, C));
|
|
391
|
+
}, "stopScroll"));
|
|
392
|
+
h(this, it, /* @__PURE__ */ l(() => {
|
|
393
|
+
const e = /* @__PURE__ */ l((o) => {
|
|
394
|
+
clearInterval(t(this, k)), clearInterval(t(this, C));
|
|
395
|
+
const n = t(this, T).querySelector(".ng-container-body");
|
|
396
|
+
n && (n.scrollTop += o * 32), g(this, k, setInterval(() => {
|
|
397
|
+
clearInterval(t(this, k)), g(this, C, setInterval(() => {
|
|
398
|
+
n && (n.scrollTop += o * 32);
|
|
399
|
+
}, 10));
|
|
400
|
+
}, 500));
|
|
401
|
+
}, "delayScrollAction");
|
|
402
|
+
$(t(this, f).top).on("mousedown", (o) => {
|
|
403
|
+
o.buttons != 1 || o.altKey || o.ctrlKey || o.shiftKey || e(-1);
|
|
404
|
+
}), $(t(this, f).bottom).on("mousedown", (o) => {
|
|
405
|
+
o.buttons != 1 || o.altKey || o.ctrlKey || o.shiftKey || e(1);
|
|
406
|
+
}), $(t(this, f).top).on("touchstart", (o) => {
|
|
407
|
+
e(-1);
|
|
408
|
+
}), $(t(this, f).bottom).on("touchstart", (o) => {
|
|
409
|
+
e(1);
|
|
410
|
+
});
|
|
411
|
+
const s = /* @__PURE__ */ l(() => {
|
|
412
|
+
clearInterval(t(this, k)), clearInterval(t(this, C));
|
|
413
|
+
}, "clearTimer");
|
|
414
|
+
t(this, f).top.ontouchend = t(this, f).bottom.ontouchend = t(this, f).track.ontouchend = t(this, f).top.onmouseup = t(this, f).top.onmouseleave = t(this, f).bottom.onmouseup = t(this, f).bottom.onmouseleave = t(this, f).track.onmouseup = t(this, f).track.onmouseleave = s, $(t(this, f).track).on("mousedown", t(this, W)), $(t(this, f).track).on("touchstart", t(this, lt)), $(t(this, f).thumb).on("mousedown", t(this, j)), $(t(this, f).thumb).on("touchstart", t(this, rt)), document.addEventListener("mouseup", (o) => {
|
|
415
|
+
t(this, A) && g(this, A, !1), document.removeEventListener("mousemove", t(this, K));
|
|
416
|
+
}), document.addEventListener("touchend", (o) => {
|
|
417
|
+
g(this, A, !1), document.removeEventListener("touchmove", t(this, O));
|
|
418
|
+
});
|
|
419
|
+
}, "#init"));
|
|
420
|
+
h(this, lt, /* @__PURE__ */ l((e) => {
|
|
421
|
+
e.target.getBoundingClientRect(), e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, W).call(this, e);
|
|
422
|
+
}, "#track_onTouchStart"));
|
|
423
|
+
h(this, W, /* @__PURE__ */ l((e) => {
|
|
424
|
+
if (t(this, A) || e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftKey) return;
|
|
425
|
+
e.preventDefault();
|
|
426
|
+
var s = t(this, f).thumb.getBoundingClientRect();
|
|
427
|
+
const o = t(this, T).querySelector(".ng-container-body");
|
|
428
|
+
if (!o) return;
|
|
429
|
+
const n = o.clientHeight, i = e.clientY > s.y ? n : -n;
|
|
430
|
+
o.scrollTop += i, clearInterval(t(this, k)), clearInterval(t(this, C)), g(this, k, setInterval(() => {
|
|
431
|
+
clearInterval(t(this, k)), g(this, C, setInterval(() => {
|
|
432
|
+
var u = t(this, f).thumb.getBoundingClientRect();
|
|
433
|
+
e.clientY > u.y && e.clientY < u.y + u.height ? clearInterval(t(this, C)) : o.scrollTop += e.clientY > u.y ? n : -n;
|
|
434
|
+
}, 10));
|
|
435
|
+
}, 500));
|
|
436
|
+
}, "#track_onMouseDown"));
|
|
437
|
+
h(this, rt, /* @__PURE__ */ l((e) => {
|
|
438
|
+
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, j).call(this, e), document.addEventListener("touchmove", t(this, O));
|
|
439
|
+
}, "#thumb_onTouchStart"));
|
|
440
|
+
h(this, O, /* @__PURE__ */ l((e) => {
|
|
441
|
+
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, K).call(this, e);
|
|
442
|
+
}, "#thumb_onTouchMove"));
|
|
443
|
+
h(this, j, /* @__PURE__ */ l((e) => {
|
|
444
|
+
g(this, st, e.clientY), g(this, A, !0), this.shiftY = e.offsetY + t(this, f).track.getBoundingClientRect().y, this.trackHeight = $(t(this, f).track).height(), this.thumbHeight = $(t(this, f).thumb).height(), g(this, nt, !0), document.addEventListener("mousemove", t(this, K));
|
|
445
|
+
}, "#thumb_onMouseDown"));
|
|
446
|
+
h(this, K, /* @__PURE__ */ l((e) => {
|
|
447
|
+
if (!t(this, A)) return;
|
|
448
|
+
e.preventDefault();
|
|
449
|
+
const s = this.trackHeight, o = t(this, F).call(this);
|
|
450
|
+
var n = e.clientY - this.shiftY;
|
|
451
|
+
n < 0 && (n = 0), n + o > s && (n = parseInt(s - o)), t(this, f).thumb.style.top = n + "px";
|
|
452
|
+
const i = t(this, T).querySelector(".ng-container-body");
|
|
453
|
+
if (!i) return;
|
|
454
|
+
const u = i.scrollHeight - i.clientHeight, y = s - o;
|
|
455
|
+
y > 0 && u > 0 && (i.scrollTop = n / y * u);
|
|
456
|
+
}, "#thumb_onMouseMove"));
|
|
457
|
+
h(this, F, /* @__PURE__ */ l(() => parseInt(t(this, f).thumb.dataset.height || 30, 10), "#getThumbHeight"));
|
|
458
|
+
this.applyBaseStyle();
|
|
459
|
+
}
|
|
460
|
+
connectedCallback() {
|
|
461
|
+
g(this, T, this.getRootNode().host), t(this, T) && (this.shadowRoot.innerHTML = `
|
|
462
|
+
<button class='ng-scroll-top' disabled><div class='ng-scroll-icon'></div></button>
|
|
463
|
+
<div class='ng-scroll-track'> <div class='ng-scroll-thumb'></div> </div>
|
|
464
|
+
<button class='ng-scroll-bottom'><div class='ng-scroll-icon'></div></button>
|
|
465
|
+
`, super.connectedCallback(), g(this, f, {
|
|
466
|
+
track: this.shadowRoot.querySelector(".ng-scroll-track"),
|
|
467
|
+
thumb: this.shadowRoot.querySelector(".ng-scroll-thumb"),
|
|
468
|
+
top: this.shadowRoot.querySelector(".ng-scroll-top"),
|
|
469
|
+
bottom: this.shadowRoot.querySelector(".ng-scroll-bottom")
|
|
470
|
+
}), t(this, it).call(this));
|
|
214
471
|
}
|
|
215
472
|
};
|
|
216
|
-
|
|
217
|
-
let
|
|
218
|
-
customElements.get("nine-table-
|
|
219
|
-
var
|
|
220
|
-
const
|
|
473
|
+
T = new WeakMap(), A = new WeakMap(), f = new WeakMap(), k = new WeakMap(), C = new WeakMap(), nt = new WeakMap(), st = new WeakMap(), it = new WeakMap(), lt = new WeakMap(), W = new WeakMap(), rt = new WeakMap(), O = new WeakMap(), j = new WeakMap(), K = new WeakMap(), F = new WeakMap(), l(wt, "NineTableHScrollBar");
|
|
474
|
+
let gt = wt;
|
|
475
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", gt);
|
|
476
|
+
var ct;
|
|
477
|
+
const St = class St extends HTMLElement {
|
|
221
478
|
constructor() {
|
|
222
479
|
super();
|
|
223
|
-
|
|
480
|
+
h(this, ct, /* @__PURE__ */ l(() => {
|
|
224
481
|
const e = this.querySelector(".nine-tab-bar");
|
|
225
|
-
e && (e.addEventListener("click", (
|
|
226
|
-
const
|
|
227
|
-
if (!
|
|
228
|
-
const
|
|
229
|
-
this.switchSheet(
|
|
482
|
+
e && (e.addEventListener("click", (s) => {
|
|
483
|
+
const o = s.target.closest(".nine-tab-item");
|
|
484
|
+
if (!o) return;
|
|
485
|
+
const n = s.ctrlKey || s.metaKey || s.shiftKey, i = parseInt(o.dataset.index, 10);
|
|
486
|
+
this.switchSheet(i, n);
|
|
230
487
|
}), this.switchSheet(0, !1));
|
|
231
488
|
}, "#init"));
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
|
|
489
|
+
I(this, "switchSheet", /* @__PURE__ */ l((e, s = !1) => {
|
|
490
|
+
const o = /* @__PURE__ */ l(() => {
|
|
491
|
+
const r = this.querySelector("nine-table-sheets-body");
|
|
492
|
+
r.querySelectorAll("nine-splitter").forEach((m) => {
|
|
493
|
+
const q = parseInt(m.dataset.splitIndex, 10), x = r.querySelector(`nine-table-sheet[data-index="${q - 1}"]`), E = r.querySelector(`nine-table-sheet[data-index="${q}"]`);
|
|
494
|
+
x && E && x.classList.contains("active") && E.classList.contains("active") ? m.classList.add("active") : m.classList.remove("active");
|
|
238
495
|
});
|
|
239
|
-
}, "updateSplitters"),
|
|
240
|
-
if (!
|
|
241
|
-
if (!
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
}),
|
|
247
|
-
|
|
496
|
+
}, "updateSplitters"), n = this.querySelector(".nine-tab-bar"), i = this.querySelector("nine-table-sheets-body"), u = n.querySelectorAll(".nine-tab-item"), y = i.querySelectorAll("nine-table-sheet");
|
|
497
|
+
if (!u[e]) return;
|
|
498
|
+
if (!s)
|
|
499
|
+
u.forEach((r, d) => {
|
|
500
|
+
r.classList.toggle("active", d === e);
|
|
501
|
+
const m = i.querySelector(`nine-table-sheet[data-index="${d}"]`);
|
|
502
|
+
m && (m.style.flex = "");
|
|
503
|
+
}), y.forEach((r, d) => {
|
|
504
|
+
r.classList.toggle("active", d === e);
|
|
248
505
|
});
|
|
249
506
|
else {
|
|
250
|
-
const
|
|
251
|
-
if (
|
|
507
|
+
const r = u[e], d = n.querySelectorAll(".nine-tab-item.active");
|
|
508
|
+
if (r.classList.contains("active") && d.length <= 1)
|
|
252
509
|
return;
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
|
|
510
|
+
r.classList.toggle("active");
|
|
511
|
+
const m = i.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
512
|
+
m && (m.classList.toggle("active"), m.classList.contains("active") || (m.style.flex = ""));
|
|
256
513
|
}
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
(!
|
|
514
|
+
const a = Array.from(i.querySelectorAll("nine-table-sheet.active"));
|
|
515
|
+
if (a.length > 1) {
|
|
516
|
+
const r = 1 / a.length;
|
|
517
|
+
a.forEach((d) => {
|
|
518
|
+
(!d.style.flex || d.style.flex === "1 1 100%") && (d.style.flex = `${r} ${r} 0px`);
|
|
262
519
|
});
|
|
263
520
|
} else
|
|
264
|
-
|
|
265
|
-
|
|
521
|
+
a.forEach((r) => {
|
|
522
|
+
r.style.flex = "1 1 100%";
|
|
266
523
|
});
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
if (
|
|
270
|
-
const
|
|
271
|
-
|
|
524
|
+
o();
|
|
525
|
+
const p = i.querySelector("nine-table-sheet.active");
|
|
526
|
+
if (p && typeof p.getRowCount == "function") {
|
|
527
|
+
const r = this.querySelector("#row-count");
|
|
528
|
+
r && (r.textContent = p.getRowCount().toLocaleString());
|
|
272
529
|
}
|
|
273
530
|
}, "switchSheet"));
|
|
274
531
|
}
|
|
275
532
|
connectedCallback() {
|
|
276
|
-
|
|
533
|
+
t(this, ct).call(this);
|
|
277
534
|
}
|
|
278
535
|
};
|
|
279
|
-
|
|
280
|
-
let
|
|
281
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
282
|
-
var
|
|
283
|
-
const
|
|
284
|
-
constructor(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
for (let
|
|
291
|
-
|
|
292
|
-
})),
|
|
536
|
+
ct = new WeakMap(), l(St, "NineTableSheets");
|
|
537
|
+
let mt = St;
|
|
538
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", mt);
|
|
539
|
+
var L, P, at, Z, ht;
|
|
540
|
+
const Tt = class Tt {
|
|
541
|
+
constructor(c) {
|
|
542
|
+
h(this, L);
|
|
543
|
+
h(this, P, null);
|
|
544
|
+
h(this, at, /* @__PURE__ */ l(() => {
|
|
545
|
+
const c = t(this, L).host;
|
|
546
|
+
c && (g(this, P, new ResizeObserver((e) => {
|
|
547
|
+
for (let s of e)
|
|
548
|
+
c.getAttribute("auto-height") === "true" && t(this, Z).call(this, c);
|
|
549
|
+
})), t(this, P).observe(c));
|
|
293
550
|
}, "#observeResize"));
|
|
294
|
-
|
|
295
|
-
var
|
|
296
|
-
const e = (
|
|
551
|
+
h(this, Z, /* @__PURE__ */ l((c) => {
|
|
552
|
+
var E, H;
|
|
553
|
+
const e = (E = c.shadowRoot) == null ? void 0 : E.querySelector("nine-table-sheet.active");
|
|
297
554
|
if (!e) return;
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
const
|
|
301
|
-
|
|
555
|
+
const s = ((H = e.getRowCount) == null ? void 0 : H.call(e)) || 0, o = parseInt(c.getAttribute("max-display-row"), 10) || 10, n = Math.min(s, o), i = e.querySelector("tbody tr") || e.querySelector("tr"), u = i ? i.getBoundingClientRect().height : 32, y = t(this, L).querySelector("nine-table-header"), a = t(this, L).querySelector("nine-table-sheets-footer"), p = y ? y.getBoundingClientRect().height : 40, r = a ? a.getBoundingClientRect().height : 32, m = p + r + 16, q = n * u + m;
|
|
556
|
+
c.style.height = `${q}px`, c.style.maxHeight = `${o * u + m}px`;
|
|
557
|
+
const x = t(this, L).querySelector("nine-table-sheets-body");
|
|
558
|
+
x && (x.style.overflowY = s > o ? "auto" : "hidden");
|
|
302
559
|
}, "#applyAutoHeight"));
|
|
303
|
-
|
|
304
|
-
const
|
|
305
|
-
|
|
560
|
+
h(this, ht, /* @__PURE__ */ l(() => {
|
|
561
|
+
const c = t(this, L).host, s = Array.from(c.children).filter((y) => y.tagName === "TABLE"), o = c.getAttribute("auto-height") === "true", n = s.map((y, a) => `<nine-table-sheet class="${a === 0 ? "active" : ""}" data-index="${a}"></nine-table-sheet>`).join(""), i = s.map((y, a) => `<div class="nine-tab-item ${a === 0 ? "active" : ""}" data-index="${a}">Sheet ${a + 1}</div>`).join("");
|
|
562
|
+
t(this, L).innerHTML = `
|
|
306
563
|
<style>
|
|
307
564
|
:host {
|
|
308
565
|
display: flex;
|
|
309
566
|
flex-direction: column;
|
|
310
567
|
position: relative;
|
|
311
568
|
overflow: hidden;
|
|
312
|
-
height: ${
|
|
569
|
+
height: ${o ? "auto" : "100%"};
|
|
313
570
|
background: #fff;
|
|
314
571
|
}
|
|
315
572
|
nine-table-header { height: 40px; display: block; flex-shrink: 0; border-bottom: 1px solid #e5e7eb; background: #fff; }
|
|
@@ -390,9 +647,9 @@ const Y = class Y {
|
|
|
390
647
|
<nine-table-body>
|
|
391
648
|
<nine-table-summary></nine-table-summary>
|
|
392
649
|
<nine-table-sheets>
|
|
393
|
-
<nine-table-sheets-body>${
|
|
650
|
+
<nine-table-sheets-body>${n}</nine-table-sheets-body>
|
|
394
651
|
<nine-table-sheets-footer>
|
|
395
|
-
<div class="nine-tab-bar">${
|
|
652
|
+
<div class="nine-tab-bar">${i}</div>
|
|
396
653
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
397
654
|
</nine-table-sheets-footer>
|
|
398
655
|
</nine-table-sheets>
|
|
@@ -400,33 +657,33 @@ const Y = class Y {
|
|
|
400
657
|
</nine-table-body>
|
|
401
658
|
<nine-table-footer></nine-table-footer>
|
|
402
659
|
`;
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
660
|
+
const u = t(this, L).querySelectorAll("nine-table-sheet");
|
|
661
|
+
u == null || u.forEach((y, a) => {
|
|
662
|
+
s[a] && setTimeout(() => {
|
|
663
|
+
y.init(s[a]), o && t(this, Z).call(this, c);
|
|
407
664
|
});
|
|
408
665
|
});
|
|
409
666
|
}, "#render"));
|
|
410
|
-
|
|
667
|
+
g(this, L, c), t(this, ht).call(this), t(this, at).call(this);
|
|
411
668
|
}
|
|
412
669
|
};
|
|
413
|
-
|
|
414
|
-
let
|
|
415
|
-
var
|
|
416
|
-
const
|
|
670
|
+
L = new WeakMap(), P = new WeakMap(), at = new WeakMap(), Z = new WeakMap(), ht = new WeakMap(), l(Tt, "LayoutManager");
|
|
671
|
+
let pt = Tt;
|
|
672
|
+
var G;
|
|
673
|
+
const kt = class kt extends HTMLElement {
|
|
417
674
|
constructor() {
|
|
418
675
|
super();
|
|
419
|
-
|
|
676
|
+
h(this, G, !1);
|
|
420
677
|
this.attachShadow({ mode: "open" });
|
|
421
678
|
}
|
|
422
679
|
connectedCallback() {
|
|
423
|
-
|
|
680
|
+
t(this, G) || (this.layoutManager = new pt(this.shadowRoot), g(this, G, !0), J.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } })));
|
|
424
681
|
}
|
|
425
682
|
disconnectedCallback() {
|
|
426
|
-
|
|
683
|
+
J.log("NineTable disconnected.");
|
|
427
684
|
}
|
|
428
685
|
};
|
|
429
|
-
|
|
430
|
-
let
|
|
431
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
686
|
+
G = new WeakMap(), l(kt, "NineTable");
|
|
687
|
+
let yt = kt;
|
|
688
|
+
customElements.get("nine-table") || customElements.define("nine-table", yt);
|
|
432
689
|
//# sourceMappingURL=nine-table.js.map
|