@ninebone/table 0.0.68 → 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.
@@ -1,98 +1,101 @@
1
- var P = Object.defineProperty;
2
- var Z = (r) => {
3
- throw TypeError(r);
1
+ var qt = Object.defineProperty;
2
+ var It = (v) => {
3
+ throw TypeError(v);
4
4
  };
5
- var D = (r, t, e) => t in r ? P(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
6
- var c = (r, t) => P(r, "name", { value: t, configurable: !0 });
7
- var q = (r, t, e) => D(r, typeof t != "symbol" ? t + "" : t, e), X = (r, t, e) => t.has(r) || Z("Cannot " + e);
8
- var a = (r, t, e) => (X(r, t, "read from private field"), e ? e.call(r) : t.get(r)), w = (r, t, e) => t.has(r) ? Z("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), k = (r, t, e, l) => (X(r, t, "write to private field"), l ? l.call(r, e) : t.set(r, e), e);
9
- import { trace as G } from "@ninebone/util";
10
- const j = class j extends G.constructor {
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
- c(j, "Trace");
16
- let I = j;
17
- const $ = new I();
18
- var S, R;
19
- const E = class E extends HTMLElement {
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
- w(this, S, null);
23
- q(this, "init", /* @__PURE__ */ c((e) => {
22
+ h(this, Y, null);
23
+ I(this, "init", /* @__PURE__ */ l((e) => {
24
24
  if (!e) return;
25
- const l = /* @__PURE__ */ c((n) => {
26
- const d = /* @__PURE__ */ c((o) => {
27
- if (o.querySelector("colgroup")) return;
28
- const s = o.querySelector("tbody tr") || o.querySelector("tr"), y = s ? s.querySelectorAll("th, td").length : 1, b = document.createElement("colgroup"), m = Math.max(Math.floor((o.clientWidth || 600) / y), 100);
29
- for (let x = 0; x < y; x++) {
30
- const z = document.createElement("col");
31
- z.setAttribute("width", m), b.appendChild(z);
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
- o.prepend(b);
34
- }, "ensureColgroup"), i = /* @__PURE__ */ c((o) => {
35
- if (o.querySelector("thead")) return;
36
- const s = document.createElement("thead"), y = o.querySelector("colgroup");
37
- y ? y.after(s) : o.prepend(s);
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 d(n), i(n), n.classList.add("nine-table-element"), n;
40
- }, "initializeTable"), u = e.cloneNode(!0);
41
- k(this, S, l(u)), a(this, S).style.display = "table";
42
- const g = this.querySelector(".ng-container-left"), h = this.querySelector(".ng-container-body"), f = this.querySelector(".ng-container-right"), p = /* @__PURE__ */ c((n, d, i = !1) => {
43
- const o = n.cloneNode(!0), s = Array.from(o.querySelectorAll("colgroup col")), y = [];
44
- return s.forEach((b, m) => {
45
- const x = b.getAttribute("fixed");
46
- (i ? !x || x === "" : x === d) || y.push(m);
47
- }), y.reverse().forEach((b) => {
48
- s[b] && s[b].remove(), o.querySelectorAll("tr").forEach((m) => {
49
- const x = m.querySelectorAll("th, td");
50
- x[b] && x[b].remove();
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
- }), o;
52
+ }), d;
53
53
  }, "filterTableByFixed");
54
- if (h) {
55
- const n = p(a(this, S), null, !0);
56
- h.innerHTML = "", h.appendChild(n);
54
+ if (i) {
55
+ const a = y(t(this, Y), null, !0);
56
+ i.innerHTML = "", i.appendChild(a);
57
57
  }
58
- if (g) {
59
- const n = p(a(this, S), "left", !1);
60
- let d = 0;
61
- n.querySelectorAll("col").forEach((o) => {
62
- const s = parseInt(o.getAttribute("width"), 10);
63
- isNaN(s) || (d += s);
64
- }), g.innerHTML = "", g.appendChild(n);
65
- const i = d > 0 ? d : 0;
66
- g.style.flex = `0 0 ${i}px`, g.style.width = `${i}px`;
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 (f) {
69
- const n = p(a(this, S), "right", !1);
70
- let d = 0;
71
- n.querySelectorAll("col").forEach((o) => {
72
- const s = parseInt(o.getAttribute("width"), 10);
73
- isNaN(s) || (d += s);
74
- }), f.innerHTML = "", f.appendChild(n);
75
- const i = d > 0 ? d : 0;
76
- f.style.flex = `0 0 ${i}px`, f.style.width = `${i}px`;
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 (h) {
79
- const n = this.getRowCount();
80
- h.style.overflowY = n > 10 ? "auto" : "hidden";
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
- $.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
85
+ J.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
83
86
  }, "init"));
84
- q(this, "getRowCount", /* @__PURE__ */ c(() => a(this, S) ? a(this, S).querySelectorAll("tbody tr").length : 0, "getRowCount"));
87
+ I(this, "getRowCount", /* @__PURE__ */ l(() => t(this, Y) ? t(this, Y).querySelectorAll("tbody tr").length : 0, "getRowCount"));
85
88
  // 🎯 외부 스크롤바 및 컨트롤러 연동용 메서드
86
- q(this, "scrollToX", /* @__PURE__ */ c((e) => {
87
- const l = this.querySelector(".ng-container-body");
88
- l && (l.scrollLeft = e);
89
+ I(this, "scrollToX", /* @__PURE__ */ l((e) => {
90
+ const s = this.querySelector(".ng-container-body");
91
+ s && (s.scrollLeft = e);
89
92
  }, "scrollToX"));
90
- q(this, "scrollToY", /* @__PURE__ */ c((e) => {
91
- const l = this.querySelector(".ng-container-body");
92
- l && (l.scrollTop = e);
93
+ I(this, "scrollToY", /* @__PURE__ */ l((e) => {
94
+ const s = this.querySelector(".ng-container-body");
95
+ s && (s.scrollTop = e);
93
96
  }, "scrollToY"));
94
- w(this, R, /* @__PURE__ */ c(() => {
95
- const e = E.SCROLLBAR_SIZE;
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
- a(this, R).call(this);
213
+ t(this, Q).call(this);
211
214
  }
212
215
  disconnectedCallback() {
213
- this.innerHTML = "", $.log("NineTableSheet destroyed.");
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
- S = new WeakMap(), R = new WeakMap(), c(E, "NineTableSheet"), q(E, "SCROLLBAR_SIZE", 16);
217
- let B = E;
218
- customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", B);
219
- var H;
220
- const K = class K extends HTMLElement {
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
- w(this, H, /* @__PURE__ */ c(() => {
480
+ h(this, ct, /* @__PURE__ */ l(() => {
224
481
  const e = this.querySelector(".nine-tab-bar");
225
- e && (e.addEventListener("click", (l) => {
226
- const u = l.target.closest(".nine-tab-item");
227
- if (!u) return;
228
- const g = l.ctrlKey || l.metaKey || l.shiftKey, h = parseInt(u.dataset.index, 10);
229
- this.switchSheet(h, g);
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
- q(this, "switchSheet", /* @__PURE__ */ c((e, l = !1) => {
233
- const u = /* @__PURE__ */ c(() => {
234
- const i = this.querySelector("nine-table-sheets-body");
235
- i.querySelectorAll("nine-splitter").forEach((s) => {
236
- const y = parseInt(s.dataset.splitIndex, 10), b = i.querySelector(`nine-table-sheet[data-index="${y - 1}"]`), m = i.querySelector(`nine-table-sheet[data-index="${y}"]`);
237
- b && m && b.classList.contains("active") && m.classList.contains("active") ? s.classList.add("active") : s.classList.remove("active");
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"), g = this.querySelector(".nine-tab-bar"), h = this.querySelector("nine-table-sheets-body"), f = g.querySelectorAll(".nine-tab-item"), p = h.querySelectorAll("nine-table-sheet");
240
- if (!f[e]) return;
241
- if (!l)
242
- f.forEach((i, o) => {
243
- i.classList.toggle("active", o === e);
244
- const s = h.querySelector(`nine-table-sheet[data-index="${o}"]`);
245
- s && (s.style.flex = "");
246
- }), p.forEach((i, o) => {
247
- i.classList.toggle("active", o === e);
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 i = f[e], o = g.querySelectorAll(".nine-tab-item.active");
251
- if (i.classList.contains("active") && o.length <= 1)
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
- i.classList.toggle("active");
254
- const s = h.querySelector(`nine-table-sheet[data-index="${e}"]`);
255
- s && (s.classList.toggle("active"), s.classList.contains("active") || (s.style.flex = ""));
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 n = Array.from(h.querySelectorAll("nine-table-sheet.active"));
258
- if (n.length > 1) {
259
- const i = 1 / n.length;
260
- n.forEach((o) => {
261
- (!o.style.flex || o.style.flex === "1 1 100%") && (o.style.flex = `${i} ${i} 0px`);
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
- n.forEach((i) => {
265
- i.style.flex = "1 1 100%";
521
+ a.forEach((r) => {
522
+ r.style.flex = "1 1 100%";
266
523
  });
267
- u();
268
- const d = h.querySelector("nine-table-sheet.active");
269
- if (d && typeof d.getRowCount == "function") {
270
- const i = this.querySelector("#row-count");
271
- i && (i.textContent = d.getRowCount().toLocaleString());
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
- a(this, H).call(this);
533
+ t(this, ct).call(this);
277
534
  }
278
535
  };
279
- H = new WeakMap(), c(K, "NineTableSheets");
280
- let N = K;
281
- customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", N);
282
- var v, C, T, A, M;
283
- const Y = class Y {
284
- constructor(t) {
285
- w(this, v);
286
- w(this, C, null);
287
- w(this, T, /* @__PURE__ */ c(() => {
288
- const t = a(this, v).host;
289
- t && (k(this, C, new ResizeObserver((e) => {
290
- for (let l of e)
291
- t.getAttribute("auto-height") === "true" && a(this, A).call(this, t);
292
- })), a(this, C).observe(t));
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
- w(this, A, /* @__PURE__ */ c((t) => {
295
- var m, x;
296
- const e = (m = t.shadowRoot) == null ? void 0 : m.querySelector("nine-table-sheet.active");
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 l = ((x = e.getRowCount) == null ? void 0 : x.call(e)) || 0, u = parseInt(t.getAttribute("max-display-row"), 10) || 10, g = Math.min(l, u), h = e.querySelector("tbody tr") || e.querySelector("tr"), f = h ? h.getBoundingClientRect().height : 32, p = a(this, v).querySelector("nine-table-header"), n = a(this, v).querySelector("nine-table-sheets-footer"), d = p ? p.getBoundingClientRect().height : 40, i = n ? n.getBoundingClientRect().height : 32, s = d + i + 16, y = g * f + s;
299
- t.style.height = `${y}px`, t.style.maxHeight = `${u * f + s}px`;
300
- const b = a(this, v).querySelector("nine-table-sheets-body");
301
- b && (b.style.overflowY = l > u ? "auto" : "hidden");
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
- w(this, M, /* @__PURE__ */ c(() => {
304
- const t = a(this, v).host, l = Array.from(t.children).filter((p) => p.tagName === "TABLE"), u = t.getAttribute("auto-height") === "true", g = l.map((p, n) => `<nine-table-sheet class="${n === 0 ? "active" : ""}" data-index="${n}"></nine-table-sheet>`).join(""), h = l.map((p, n) => `<div class="nine-tab-item ${n === 0 ? "active" : ""}" data-index="${n}">Sheet ${n + 1}</div>`).join("");
305
- a(this, v).innerHTML = `
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: ${u ? "auto" : "100%"};
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>${g}</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">${h}</div>
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 f = a(this, v).querySelectorAll("nine-table-sheet");
404
- f == null || f.forEach((p, n) => {
405
- l[n] && setTimeout(() => {
406
- p.init(l[n]), u && a(this, A).call(this, t);
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
- k(this, v, t), a(this, M).call(this), a(this, T).call(this);
667
+ g(this, L, c), t(this, ht).call(this), t(this, at).call(this);
411
668
  }
412
669
  };
413
- v = new WeakMap(), C = new WeakMap(), T = new WeakMap(), A = new WeakMap(), M = new WeakMap(), c(Y, "LayoutManager");
414
- let W = Y;
415
- var L;
416
- const F = class F extends HTMLElement {
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
- w(this, L, !1);
676
+ h(this, G, !1);
420
677
  this.attachShadow({ mode: "open" });
421
678
  }
422
679
  connectedCallback() {
423
- a(this, L) || (this.layoutManager = new W(this.shadowRoot), k(this, L, !0), $.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } })));
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
- $.log("NineTable disconnected.");
683
+ J.log("NineTable disconnected.");
427
684
  }
428
685
  };
429
- L = new WeakMap(), c(F, "NineTable");
430
- let O = F;
431
- customElements.get("nine-table") || customElements.define("nine-table", O);
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