@ninebone/table 0.0.96 → 0.0.98

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.
@@ -2,121 +2,112 @@ var te = Object.defineProperty;
2
2
  var ne = (p) => {
3
3
  throw TypeError(p);
4
4
  };
5
- var oe = (p, i, t) => i in p ? te(p, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[i] = t;
6
- var u = (p, i) => te(p, "name", { value: i, configurable: !0 });
7
- var C = (p, i, t) => oe(p, typeof i != "symbol" ? i + "" : i, t), ie = (p, i, t) => i.has(p) || ne("Cannot " + t);
8
- var e = (p, i, t) => (ie(p, i, "read from private field"), t ? t.call(p) : i.get(p)), y = (p, i, t) => i.has(p) ? ne("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(p) : i.set(p, t), S = (p, i, t, r) => (ie(p, i, "write to private field"), r ? r.call(p, t) : i.set(p, t), t);
9
- import { trace as se } from "@ninebone/util";
10
- const J = class J extends se.constructor {
5
+ var se = (p, i, t) => i in p ? te(p, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[i] = t;
6
+ var b = (p, i) => te(p, "name", { value: i, configurable: !0 });
7
+ var L = (p, i, t) => se(p, typeof i != "symbol" ? i + "" : i, t), ie = (p, i, t) => i.has(p) || ne("Cannot " + t);
8
+ var e = (p, i, t) => (ie(p, i, "read from private field"), t ? t.call(p) : i.get(p)), y = (p, i, t) => i.has(p) ? ne("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(p) : i.set(p, t), w = (p, i, t, s) => (ie(p, i, "write to private field"), s ? s.call(p, t) : i.set(p, t), t);
9
+ import { trace as oe } from "@ninebone/util";
10
+ const J = class J extends oe.constructor {
11
11
  constructor() {
12
12
  super(), this.init("nine-table", "green");
13
13
  }
14
14
  };
15
- u(J, "Trace");
16
- let P = J;
17
- const x = new P();
18
- var k, B, h, R, A, T, z, $, N;
15
+ b(J, "Trace");
16
+ let Y = J;
17
+ const z = new Y();
18
+ var k, C, f, A, R, $, B, T, N;
19
19
  const Q = class Q extends HTMLElement {
20
20
  constructor() {
21
21
  super();
22
22
  y(this, k);
23
- y(this, B, !1);
24
- y(this, h);
25
- y(this, R);
23
+ y(this, C, !1);
24
+ y(this, f);
26
25
  y(this, A);
27
- y(this, T);
28
- y(this, z, /* @__PURE__ */ u(() => {
26
+ y(this, R);
27
+ y(this, $);
28
+ y(this, B, /* @__PURE__ */ b(() => {
29
29
  if (!e(this, k)) return;
30
30
  const t = e(this, k).querySelector(".ng-container-body");
31
- t && (S(this, T, new ResizeObserver(() => {
31
+ t && (w(this, $, new ResizeObserver(() => {
32
32
  this.refresh();
33
- })), e(this, T).observe(t));
33
+ })), e(this, $).observe(t));
34
34
  }, "#observeResize"));
35
- C(this, "refresh", /* @__PURE__ */ u(() => {
36
- if (x.log("refresh() 호출됨"), !e(this, k) || !e(this, h)) {
37
- x.log("refresh() 중단: owner 또는 elements가 없음");
38
- return;
39
- }
40
- const t = e(this, h).container, r = t.querySelector("table");
41
- if (!r) {
42
- x.log("refresh() 중단: table 요소를 찾을 수 없음");
43
- return;
44
- }
45
- const o = e(this, h).track, g = e(this, h).thumb, d = e(this, k).querySelector(".ng-container-bottom"), a = t.clientWidth, b = r.scrollWidth;
46
- if (x.log("refresh 체크 -> bodyWidth:", a, "tableWidth:", b), a !== 0 && b > a)
47
- d && (d.style.display = "flex");
35
+ L(this, "refresh", /* @__PURE__ */ b(() => {
36
+ if (!e(this, k) || !e(this, f) || e(this, C)) return;
37
+ const t = e(this, f).container, s = t.querySelector("table");
38
+ if (!s) return;
39
+ const o = e(this, f).track, g = e(this, f).thumb, h = e(this, k).querySelector(".ng-container-bottom"), c = t.clientWidth, u = s.scrollWidth;
40
+ if (c !== 0 && u > c)
41
+ h && (h.style.display = "flex");
48
42
  else {
49
- x.log("refresh: 테이블 너비가 컨테이너보다 작거나 같음 (스크롤바 숨김)"), d && (d.style.display = "none");
43
+ h && (h.style.display = "none");
50
44
  return;
51
45
  }
52
46
  const n = o.clientWidth;
53
47
  if (n <= 0) return;
54
- const f = Math.max(Math.min(n * (a / b), n), 20);
55
- g.style.width = `${f}px`;
56
- const s = parseInt(r.style.left || 0, 10);
57
- let l = parseInt(Math.abs(s) * n / b, 10);
58
- l < 0 && (l = 0);
59
- const c = n - f;
60
- l > c && (l = c), g.style.left = `${l}px`, e(this, h).left.disabled = l === 0, e(this, h).right.disabled = l >= c - 1;
48
+ const d = Math.max(Math.min(n * (c / u), n), 20);
49
+ g.style.width = `${d}px`;
50
+ const l = parseInt(s.style.left || 0, 10);
51
+ let r = parseInt(Math.abs(l) * n / u, 10);
52
+ r < 0 && (r = 0);
53
+ const a = n - d;
54
+ r > a && (r = a), g.style.left = `${r}px`, e(this, f).left.disabled = r === 0, e(this, f).right.disabled = r >= a - 1;
61
55
  }, "refresh"));
62
- y(this, $, /* @__PURE__ */ u((t) => {
63
- if (!e(this, h)) return !1;
64
- const r = e(this, h).container, o = r.querySelector("table");
56
+ y(this, T, /* @__PURE__ */ b((t) => {
57
+ if (!e(this, f)) return !1;
58
+ const s = e(this, f).container, o = s.querySelector("table");
65
59
  if (!o) return !1;
66
- const g = e(this, h).track.getBoundingClientRect(), d = e(this, h).thumb.clientWidth;
67
- let a = t;
68
- a < 0 && (a = 0);
69
- const b = g.width - d;
70
- a > b && (a = b), a = parseInt(a, 10), e(this, h).thumb.style.left = `${a}px`, e(this, h).left.disabled = a === 0, e(this, h).right.disabled = a >= b - 1;
71
- const n = r.clientWidth, f = o.scrollWidth;
72
- let s = b > 0 ? -a * (f - n) / b : 0;
73
- return -s > f - n && (s = -(f - n)), -s + 5 > f - n && (s = -(f - n)), n >= f && (s = 0), e(this, k).querySelectorAll(".ng-container-left table, .ng-container-body table, .ng-container-right table").forEach((c) => {
74
- c.style.left = `${s}px`;
75
- }), a > 0 && a < b - 1;
60
+ const g = e(this, f).track.getBoundingClientRect(), h = e(this, f).thumb.clientWidth;
61
+ let c = t;
62
+ c < 0 && (c = 0);
63
+ const u = g.width - h;
64
+ c > u && (c = u), c = parseInt(c, 10), e(this, f).thumb.style.left = `${c}px`, e(this, f).left.disabled = c === 0, e(this, f).right.disabled = c >= u - 1;
65
+ const n = s.clientWidth, d = o.scrollWidth;
66
+ let l = u > 0 ? -c * (d - n) / u : 0;
67
+ return -l > d - n && (l = -(d - n)), -l + 5 > d - n && (l = -(d - n)), n >= d && (l = 0), e(this, k).querySelectorAll(".ng-container-left table, .ng-container-body table, .ng-container-right table").forEach((a) => {
68
+ a.style.left = `${l}px`;
69
+ }), c > 0 && c < u - 1;
76
70
  }, "#thumbMoveTo"));
77
- y(this, N, /* @__PURE__ */ u(() => {
78
- const t = /* @__PURE__ */ u((o) => {
79
- clearInterval(e(this, R)), clearInterval(e(this, A));
80
- const g = e(this, h).track.getBoundingClientRect(), d = e(this, h).thumb.getBoundingClientRect();
81
- e(this, $).call(this, d.x - g.x + o), S(this, R, setInterval(() => {
82
- clearInterval(e(this, R)), S(this, A, setInterval(() => {
83
- const a = e(this, h).track.getBoundingClientRect(), b = e(this, h).thumb.getBoundingClientRect();
84
- e(this, $).call(this, b.x - a.x + o) || clearInterval(e(this, A));
85
- }, 10));
71
+ y(this, N, /* @__PURE__ */ b(() => {
72
+ const t = /* @__PURE__ */ b((o) => {
73
+ clearInterval(e(this, A)), clearInterval(e(this, R));
74
+ const g = parseInt(e(this, f).thumb.style.left || 0, 10);
75
+ e(this, T).call(this, g + o), w(this, A, setInterval(() => {
76
+ clearInterval(e(this, A)), w(this, R, setInterval(() => {
77
+ const h = parseInt(e(this, f).thumb.style.left || 0, 10);
78
+ e(this, T).call(this, h + o) || clearInterval(e(this, R));
79
+ }, 50));
86
80
  }, 500));
87
- }, "delayScroll"), r = /* @__PURE__ */ u(() => {
88
- clearInterval(e(this, R)), clearInterval(e(this, A));
81
+ }, "delayScroll"), s = /* @__PURE__ */ b(() => {
82
+ clearInterval(e(this, A)), clearInterval(e(this, R));
89
83
  }, "clearTimer");
90
84
  ["mouseup", "mouseleave", "touchend"].forEach((o) => {
91
- e(this, h).left.addEventListener(o, r), e(this, h).right.addEventListener(o, r), e(this, h).track.addEventListener(o, r);
92
- }), e(this, h).left.addEventListener("mousedown", (o) => {
93
- o.button === 0 && t(-10);
94
- }), e(this, h).right.addEventListener("mousedown", (o) => {
95
- o.button === 0 && t(10);
96
- }), e(this, h).left.addEventListener("touchstart", () => t(-10)), e(this, h).right.addEventListener("touchstart", () => t(10)), e(this, h).track.addEventListener("mousedown", (o) => {
85
+ e(this, f).left.addEventListener(o, s), e(this, f).right.addEventListener(o, s), e(this, f).track.addEventListener(o, s);
86
+ }), e(this, f).left.addEventListener("mousedown", (o) => {
87
+ o.button === 0 && t(-20);
88
+ }), e(this, f).right.addEventListener("mousedown", (o) => {
89
+ o.button === 0 && t(20);
90
+ }), e(this, f).left.addEventListener("touchstart", () => t(-20)), e(this, f).right.addEventListener("touchstart", () => t(20)), e(this, f).track.addEventListener("mousedown", (o) => {
97
91
  if (o.button !== 0) return;
98
92
  o.preventDefault();
99
- const g = e(this, h).track.getBoundingClientRect(), d = e(this, h).thumb.clientWidth;
100
- e(this, $).call(this, o.clientX - g.left - d / 2);
101
- }), e(this, h).thumb.addEventListener("mousedown", (o) => {
93
+ const g = e(this, f).track.getBoundingClientRect(), h = e(this, f).thumb.clientWidth;
94
+ e(this, T).call(this, o.clientX - g.left - h / 2);
95
+ }), e(this, f).thumb.addEventListener("mousedown", (o) => {
102
96
  if (o.button !== 0) return;
103
- o.stopPropagation(), o.preventDefault(), S(this, B, !0), this.shiftX = o.clientX - e(this, h).thumb.getBoundingClientRect().left;
104
- const g = /* @__PURE__ */ u((a) => {
105
- if (!e(this, B)) return;
106
- const b = e(this, h).track.getBoundingClientRect();
107
- e(this, $).call(this, a.clientX - b.left - this.shiftX);
108
- }, "onMouseMove"), d = /* @__PURE__ */ u(() => {
109
- S(this, B, !1), r(), document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", d), this.refresh();
97
+ o.stopPropagation(), o.preventDefault(), w(this, C, !0), this.shiftX = o.clientX - e(this, f).thumb.getBoundingClientRect().left;
98
+ const g = /* @__PURE__ */ b((c) => {
99
+ if (!e(this, C)) return;
100
+ const u = e(this, f).track.getBoundingClientRect();
101
+ e(this, T).call(this, c.clientX - u.left - this.shiftX);
102
+ }, "onMouseMove"), h = /* @__PURE__ */ b(() => {
103
+ w(this, C, !1), s(), document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", h), this.refresh();
110
104
  }, "onMouseUp");
111
- document.addEventListener("mousemove", g), document.addEventListener("mouseup", d);
105
+ document.addEventListener("mousemove", g), document.addEventListener("mouseup", h);
112
106
  });
113
107
  }, "#init"));
114
108
  }
115
109
  connectedCallback() {
116
- if (x.log("NineTableHScrollBar connectedCallback 진입"), S(this, k, this.getRootNode().host), !e(this, k)) {
117
- x.log("NineTableHScrollBar: #owner(host)를 찾을 수 없음");
118
- return;
119
- }
110
+ if (w(this, k, this.closest("nine-table-sheet") || this.getRootNode().host), !e(this, k)) return;
120
111
  this.innerHTML = `
121
112
  <style>
122
113
  nine-table-hscrollbar {
@@ -179,112 +170,113 @@ const Q = class Q extends HTMLElement {
179
170
  <button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
180
171
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
181
172
  <button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
182
- `, requestAnimationFrame(() => {
183
- x.log(e(this, k));
184
- const t = e(this, k).querySelector(".ng-container-body");
185
- if (!t) {
186
- x.log("NineTableHScrollBar: .ng-container-body 요소를 찾지 못함");
173
+ `;
174
+ const t = /* @__PURE__ */ b(() => {
175
+ const s = e(this, k).querySelector(".ng-container-body");
176
+ if (!s) {
177
+ setTimeout(t, 10);
187
178
  return;
188
179
  }
189
- S(this, h, {
190
- container: t,
180
+ w(this, f, {
181
+ container: s,
191
182
  track: this.querySelector(".ng-scroll-track"),
192
183
  thumb: this.querySelector(".ng-scroll-thumb"),
193
184
  left: this.querySelector(".ng-scroll-left"),
194
185
  right: this.querySelector(".ng-scroll-right")
195
- }), x.log("NineTableHScrollBar elements 바인딩 완료:", e(this, h)), e(this, N).call(this), e(this, z).call(this), this.refresh();
196
- });
186
+ }), e(this, N).call(this), e(this, B).call(this), this.refresh();
187
+ }, "initWhenReady");
188
+ t();
197
189
  }
198
190
  disconnectedCallback() {
199
- e(this, T) && e(this, T).disconnect();
191
+ e(this, $) && e(this, $).disconnect();
200
192
  }
201
193
  };
202
- k = new WeakMap(), B = new WeakMap(), h = new WeakMap(), R = new WeakMap(), A = new WeakMap(), T = new WeakMap(), z = new WeakMap(), $ = new WeakMap(), N = new WeakMap(), u(Q, "NineTableHScrollBar");
203
- let Y = Q;
204
- customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Y);
205
- var L, X;
206
- const H = class H extends HTMLElement {
194
+ k = new WeakMap(), C = new WeakMap(), f = new WeakMap(), A = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), B = new WeakMap(), T = new WeakMap(), N = new WeakMap(), b(Q, "NineTableHScrollBar");
195
+ let D = Q;
196
+ customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", D);
197
+ var q, X;
198
+ const I = class I extends HTMLElement {
207
199
  constructor() {
208
200
  super();
209
- y(this, L, null);
210
- C(this, "init", /* @__PURE__ */ u((t) => {
201
+ y(this, q, null);
202
+ L(this, "init", /* @__PURE__ */ b((t) => {
211
203
  if (!t) return;
212
- const r = /* @__PURE__ */ u((n) => {
213
- const f = /* @__PURE__ */ u((l) => {
214
- if (l.querySelector("colgroup")) return;
215
- const c = l.querySelector("tbody tr") || l.querySelector("tr"), v = c ? c.querySelectorAll("th, td").length : 1, m = document.createElement("colgroup"), q = Math.max(Math.floor((l.clientWidth || 600) / v), 100);
216
- for (let w = 0; w < v; w++) {
217
- const K = document.createElement("col");
218
- K.setAttribute("width", q), m.appendChild(K);
204
+ const s = /* @__PURE__ */ b((n) => {
205
+ const d = /* @__PURE__ */ b((r) => {
206
+ if (r.querySelector("colgroup")) return;
207
+ const a = r.querySelector("tbody tr") || r.querySelector("tr"), x = a ? a.querySelectorAll("th, td").length : 1, m = document.createElement("colgroup"), S = Math.max(Math.floor((r.clientWidth || 600) / x), 100);
208
+ for (let v = 0; v < x; v++) {
209
+ const P = document.createElement("col");
210
+ P.setAttribute("width", S), m.appendChild(P);
219
211
  }
220
- l.prepend(m);
221
- }, "ensureColgroup"), s = /* @__PURE__ */ u((l) => {
222
- if (l.querySelector("thead")) return;
223
- const c = document.createElement("thead"), v = l.querySelector("colgroup");
224
- v ? v.after(c) : l.prepend(c);
212
+ r.prepend(m);
213
+ }, "ensureColgroup"), l = /* @__PURE__ */ b((r) => {
214
+ if (r.querySelector("thead")) return;
215
+ const a = document.createElement("thead"), x = r.querySelector("colgroup");
216
+ x ? x.after(a) : r.prepend(a);
225
217
  }, "ensureThead");
226
- return f(n), s(n), n.classList.add("nine-table-element"), n;
218
+ return d(n), l(n), n.classList.add("nine-table-element"), n;
227
219
  }, "initializeTable"), o = t.cloneNode(!0);
228
- S(this, L, r(o)), e(this, L).style.display = "table";
229
- const g = this.querySelector(".ng-container-left"), d = this.querySelector(".ng-container-body"), a = this.querySelector(".ng-container-right"), b = /* @__PURE__ */ u((n, f, s = !1) => {
230
- const l = n.cloneNode(!0), c = Array.from(l.querySelectorAll("colgroup col")), v = [];
231
- return c.forEach((m, q) => {
232
- const w = m.getAttribute("fixed");
233
- (s ? !w || w === "" : w === f) || v.push(q);
234
- }), v.reverse().forEach((m) => {
235
- c[m] && c[m].remove(), l.querySelectorAll("tr").forEach((q) => {
236
- const w = q.querySelectorAll("th, td");
237
- w[m] && w[m].remove();
220
+ w(this, q, s(o)), e(this, q).style.display = "table";
221
+ const g = this.querySelector(".ng-container-left"), h = this.querySelector(".ng-container-body"), c = this.querySelector(".ng-container-right"), u = /* @__PURE__ */ b((n, d, l = !1) => {
222
+ const r = n.cloneNode(!0), a = Array.from(r.querySelectorAll("colgroup col")), x = [];
223
+ return a.forEach((m, S) => {
224
+ const v = m.getAttribute("fixed");
225
+ (l ? !v || v === "" : v === d) || x.push(S);
226
+ }), x.reverse().forEach((m) => {
227
+ a[m] && a[m].remove(), r.querySelectorAll("tr").forEach((S) => {
228
+ const v = S.querySelectorAll("th, td");
229
+ v[m] && v[m].remove();
238
230
  });
239
- }), l;
231
+ }), r;
240
232
  }, "filterTableByFixed");
241
- if (d) {
242
- const n = b(e(this, L), null, !0);
243
- d.innerHTML = "", d.appendChild(n);
233
+ if (h) {
234
+ const n = u(e(this, q), null, !0);
235
+ h.innerHTML = "", h.appendChild(n);
244
236
  }
245
237
  if (g) {
246
- const n = b(e(this, L), "left", !1);
247
- let f = 0;
248
- n.querySelectorAll("col").forEach((l) => {
249
- const c = parseInt(l.getAttribute("width"), 10);
250
- isNaN(c) || (f += c);
238
+ const n = u(e(this, q), "left", !1);
239
+ let d = 0;
240
+ n.querySelectorAll("col").forEach((r) => {
241
+ const a = parseInt(r.getAttribute("width"), 10);
242
+ isNaN(a) || (d += a);
251
243
  }), g.innerHTML = "", g.appendChild(n);
252
- const s = f > 0 ? f : 0;
253
- g.style.flex = `0 0 ${s}px`, g.style.width = `${s}px`;
244
+ const l = d > 0 ? d : 0;
245
+ g.style.flex = `0 0 ${l}px`, g.style.width = `${l}px`;
254
246
  }
255
- if (a) {
256
- const n = b(e(this, L), "right", !1);
257
- let f = 0;
258
- n.querySelectorAll("col").forEach((l) => {
259
- const c = parseInt(l.getAttribute("width"), 10);
260
- isNaN(c) || (f += c);
261
- }), a.innerHTML = "", a.appendChild(n);
262
- const s = f > 0 ? f : 0;
263
- a.style.flex = `0 0 ${s}px`, a.style.width = `${s}px`;
247
+ if (c) {
248
+ const n = u(e(this, q), "right", !1);
249
+ let d = 0;
250
+ n.querySelectorAll("col").forEach((r) => {
251
+ const a = parseInt(r.getAttribute("width"), 10);
252
+ isNaN(a) || (d += a);
253
+ }), c.innerHTML = "", c.appendChild(n);
254
+ const l = d > 0 ? d : 0;
255
+ c.style.flex = `0 0 ${l}px`, c.style.width = `${l}px`;
264
256
  }
265
- if (d) {
257
+ if (h) {
266
258
  const n = this.getRowCount();
267
- d.style.overflowY = n > 10 ? "auto" : "hidden", d.addEventListener("scroll", () => {
268
- const f = this.querySelector("nine-table-hscrollbar");
269
- f && typeof f.refresh == "function" && f.refresh();
259
+ h.style.overflowY = n > 10 ? "auto" : "hidden", h.addEventListener("scroll", () => {
260
+ const d = this.querySelector("nine-table-hscrollbar");
261
+ d && typeof d.refresh == "function" && d.refresh();
270
262
  });
271
263
  }
272
264
  setTimeout(() => {
273
265
  const n = this.querySelector("nine-table-hscrollbar");
274
266
  n && typeof n.refresh == "function" && n.refresh();
275
- }, 0), x.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
267
+ }, 0), z.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
276
268
  }, "init"));
277
- C(this, "getRowCount", /* @__PURE__ */ u(() => e(this, L) ? e(this, L).querySelectorAll("tbody tr").length : 0, "getRowCount"));
278
- C(this, "scrollToX", /* @__PURE__ */ u((t) => {
279
- const r = this.querySelector(".ng-container-body");
280
- r && (r.scrollLeft = t);
269
+ L(this, "getRowCount", /* @__PURE__ */ b(() => e(this, q) ? e(this, q).querySelectorAll("tbody tr").length : 0, "getRowCount"));
270
+ L(this, "scrollToX", /* @__PURE__ */ b((t) => {
271
+ const s = this.querySelector(".ng-container-body");
272
+ s && (s.scrollLeft = t);
281
273
  }, "scrollToX"));
282
- C(this, "scrollToY", /* @__PURE__ */ u((t) => {
283
- const r = this.querySelector(".ng-container-body");
284
- r && (r.scrollTop = t);
274
+ L(this, "scrollToY", /* @__PURE__ */ b((t) => {
275
+ const s = this.querySelector(".ng-container-body");
276
+ s && (s.scrollTop = t);
285
277
  }, "scrollToY"));
286
- y(this, X, /* @__PURE__ */ u(() => {
287
- const t = H.SCROLLBAR_SIZE;
278
+ y(this, X, /* @__PURE__ */ b(() => {
279
+ const t = I.SCROLLBAR_SIZE;
288
280
  this.innerHTML = `
289
281
  <style>
290
282
  nine-table-sheet {
@@ -404,65 +396,65 @@ const H = class H extends HTMLElement {
404
396
  e(this, X).call(this);
405
397
  }
406
398
  disconnectedCallback() {
407
- this.innerHTML = "", x.log("NineTableSheet destroyed.");
399
+ this.innerHTML = "", z.log("NineTableSheet destroyed.");
408
400
  }
409
401
  };
410
- L = new WeakMap(), X = new WeakMap(), u(H, "NineTableSheet"), C(H, "SCROLLBAR_SIZE", 16);
411
- let D = H;
412
- customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", D);
402
+ q = new WeakMap(), X = new WeakMap(), b(I, "NineTableSheet"), L(I, "SCROLLBAR_SIZE", 16);
403
+ let F = I;
404
+ customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", F);
413
405
  var O;
414
406
  const V = class V extends HTMLElement {
415
407
  constructor() {
416
408
  super();
417
- y(this, O, /* @__PURE__ */ u(() => {
409
+ y(this, O, /* @__PURE__ */ b(() => {
418
410
  const t = this.querySelector(".nine-tab-bar");
419
- t && (t.addEventListener("click", (r) => {
420
- const o = r.target.closest(".nine-tab-item");
411
+ t && (t.addEventListener("click", (s) => {
412
+ const o = s.target.closest(".nine-tab-item");
421
413
  if (!o) return;
422
- const g = r.ctrlKey || r.metaKey || r.shiftKey, d = parseInt(o.dataset.index, 10);
423
- this.switchSheet(d, g);
414
+ const g = s.ctrlKey || s.metaKey || s.shiftKey, h = parseInt(o.dataset.index, 10);
415
+ this.switchSheet(h, g);
424
416
  }), this.switchSheet(0, !1));
425
417
  }, "#init"));
426
- C(this, "switchSheet", /* @__PURE__ */ u((t, r = !1) => {
427
- const o = /* @__PURE__ */ u(() => {
428
- const s = this.querySelector("nine-table-sheets-body");
429
- s.querySelectorAll("nine-splitter").forEach((c) => {
430
- const v = parseInt(c.dataset.splitIndex, 10), m = s.querySelector(`nine-table-sheet[data-index="${v - 1}"]`), q = s.querySelector(`nine-table-sheet[data-index="${v}"]`);
431
- m && q && m.classList.contains("active") && q.classList.contains("active") ? c.classList.add("active") : c.classList.remove("active");
418
+ L(this, "switchSheet", /* @__PURE__ */ b((t, s = !1) => {
419
+ const o = /* @__PURE__ */ b(() => {
420
+ const l = this.querySelector("nine-table-sheets-body");
421
+ l.querySelectorAll("nine-splitter").forEach((a) => {
422
+ const x = parseInt(a.dataset.splitIndex, 10), m = l.querySelector(`nine-table-sheet[data-index="${x - 1}"]`), S = l.querySelector(`nine-table-sheet[data-index="${x}"]`);
423
+ m && S && m.classList.contains("active") && S.classList.contains("active") ? a.classList.add("active") : a.classList.remove("active");
432
424
  });
433
- }, "updateSplitters"), g = this.querySelector(".nine-tab-bar"), d = this.querySelector("nine-table-sheets-body"), a = g.querySelectorAll(".nine-tab-item"), b = d.querySelectorAll("nine-table-sheet");
434
- if (!a[t]) return;
435
- if (!r)
436
- a.forEach((s, l) => {
437
- s.classList.toggle("active", l === t);
438
- const c = d.querySelector(`nine-table-sheet[data-index="${l}"]`);
439
- c && (c.style.flex = "");
440
- }), b.forEach((s, l) => {
441
- s.classList.toggle("active", l === t);
425
+ }, "updateSplitters"), g = this.querySelector(".nine-tab-bar"), h = this.querySelector("nine-table-sheets-body"), c = g.querySelectorAll(".nine-tab-item"), u = h.querySelectorAll("nine-table-sheet");
426
+ if (!c[t]) return;
427
+ if (!s)
428
+ c.forEach((l, r) => {
429
+ l.classList.toggle("active", r === t);
430
+ const a = h.querySelector(`nine-table-sheet[data-index="${r}"]`);
431
+ a && (a.style.flex = "");
432
+ }), u.forEach((l, r) => {
433
+ l.classList.toggle("active", r === t);
442
434
  });
443
435
  else {
444
- const s = a[t], l = g.querySelectorAll(".nine-tab-item.active");
445
- if (s.classList.contains("active") && l.length <= 1)
436
+ const l = c[t], r = g.querySelectorAll(".nine-tab-item.active");
437
+ if (l.classList.contains("active") && r.length <= 1)
446
438
  return;
447
- s.classList.toggle("active");
448
- const c = d.querySelector(`nine-table-sheet[data-index="${t}"]`);
449
- c && (c.classList.toggle("active"), c.classList.contains("active") || (c.style.flex = ""));
439
+ l.classList.toggle("active");
440
+ const a = h.querySelector(`nine-table-sheet[data-index="${t}"]`);
441
+ a && (a.classList.toggle("active"), a.classList.contains("active") || (a.style.flex = ""));
450
442
  }
451
- const n = Array.from(d.querySelectorAll("nine-table-sheet.active"));
443
+ const n = Array.from(h.querySelectorAll("nine-table-sheet.active"));
452
444
  if (n.length > 1) {
453
- const s = 1 / n.length;
454
- n.forEach((l) => {
455
- (!l.style.flex || l.style.flex === "1 1 100%") && (l.style.flex = `${s} ${s} 0px`);
445
+ const l = 1 / n.length;
446
+ n.forEach((r) => {
447
+ (!r.style.flex || r.style.flex === "1 1 100%") && (r.style.flex = `${l} ${l} 0px`);
456
448
  });
457
449
  } else
458
- n.forEach((s) => {
459
- s.style.flex = "1 1 100%";
450
+ n.forEach((l) => {
451
+ l.style.flex = "1 1 100%";
460
452
  });
461
453
  o();
462
- const f = d.querySelector("nine-table-sheet.active");
463
- if (f && typeof f.getRowCount == "function") {
464
- const s = this.querySelector("#row-count");
465
- s && (s.textContent = f.getRowCount().toLocaleString());
454
+ const d = h.querySelector("nine-table-sheet.active");
455
+ if (d && typeof d.getRowCount == "function") {
456
+ const l = this.querySelector("#row-count");
457
+ l && (l.textContent = d.getRowCount().toLocaleString());
466
458
  }
467
459
  }, "switchSheet"));
468
460
  }
@@ -470,32 +462,32 @@ const V = class V extends HTMLElement {
470
462
  e(this, O).call(this);
471
463
  }
472
464
  };
473
- O = new WeakMap(), u(V, "NineTableSheets");
465
+ O = new WeakMap(), b(V, "NineTableSheets");
474
466
  let Z = V;
475
467
  customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Z);
476
- var E, I, j, M, F;
468
+ var E, M, j, H, K;
477
469
  const _ = class _ {
478
470
  constructor(i) {
479
471
  y(this, E);
480
- y(this, I, null);
481
- y(this, j, /* @__PURE__ */ u(() => {
472
+ y(this, M, null);
473
+ y(this, j, /* @__PURE__ */ b(() => {
482
474
  const i = e(this, E).host;
483
- i && (S(this, I, new ResizeObserver((t) => {
484
- for (let r of t)
485
- i.getAttribute("auto-height") === "true" && e(this, M).call(this, i);
486
- })), e(this, I).observe(i));
475
+ i && (w(this, M, new ResizeObserver((t) => {
476
+ for (let s of t)
477
+ i.getAttribute("auto-height") === "true" && e(this, H).call(this, i);
478
+ })), e(this, M).observe(i));
487
479
  }, "#observeResize"));
488
- y(this, M, /* @__PURE__ */ u((i) => {
489
- var q, w;
490
- const t = (q = i.shadowRoot) == null ? void 0 : q.querySelector("nine-table-sheet.active");
480
+ y(this, H, /* @__PURE__ */ b((i) => {
481
+ var S, v;
482
+ const t = (S = i.shadowRoot) == null ? void 0 : S.querySelector("nine-table-sheet.active");
491
483
  if (!t) return;
492
- const r = ((w = t.getRowCount) == null ? void 0 : w.call(t)) || 0, o = parseInt(i.getAttribute("max-display-row"), 10) || 10, g = Math.min(r, o), d = t.querySelector("tbody tr") || t.querySelector("tr"), a = d ? d.getBoundingClientRect().height : 32, b = e(this, E).querySelector("nine-table-header"), n = e(this, E).querySelector("nine-table-sheets-footer"), f = b ? b.getBoundingClientRect().height : 40, s = n ? n.getBoundingClientRect().height : 32, c = f + s + 16, v = g * a + c;
493
- i.style.height = `${v}px`, i.style.maxHeight = `${o * a + c}px`;
484
+ const s = ((v = t.getRowCount) == null ? void 0 : v.call(t)) || 0, o = parseInt(i.getAttribute("max-display-row"), 10) || 10, g = Math.min(s, o), h = t.querySelector("tbody tr") || t.querySelector("tr"), c = h ? h.getBoundingClientRect().height : 32, u = e(this, E).querySelector("nine-table-header"), n = e(this, E).querySelector("nine-table-sheets-footer"), d = u ? u.getBoundingClientRect().height : 40, l = n ? n.getBoundingClientRect().height : 32, a = d + l + 16, x = g * c + a;
485
+ i.style.height = `${x}px`, i.style.maxHeight = `${o * c + a}px`;
494
486
  const m = e(this, E).querySelector("nine-table-sheets-body");
495
- m && (m.style.overflowY = r > o ? "auto" : "hidden");
487
+ m && (m.style.overflowY = s > o ? "auto" : "hidden");
496
488
  }, "#applyAutoHeight"));
497
- y(this, F, /* @__PURE__ */ u(() => {
498
- const i = e(this, E).host, r = Array.from(i.children).filter((b) => b.tagName === "TABLE"), o = i.getAttribute("auto-height") === "true", g = r.map((b, n) => `<nine-table-sheet class="${n === 0 ? "active" : ""}" data-index="${n}"></nine-table-sheet>`).join(""), d = r.map((b, n) => `<div class="nine-tab-item ${n === 0 ? "active" : ""}" data-index="${n}">Sheet ${n + 1}</div>`).join("");
489
+ y(this, K, /* @__PURE__ */ b(() => {
490
+ const i = e(this, E).host, s = Array.from(i.children).filter((u) => u.tagName === "TABLE"), o = i.getAttribute("auto-height") === "true", g = s.map((u, n) => `<nine-table-sheet class="${n === 0 ? "active" : ""}" data-index="${n}"></nine-table-sheet>`).join(""), h = s.map((u, n) => `<div class="nine-tab-item ${n === 0 ? "active" : ""}" data-index="${n}">Sheet ${n + 1}</div>`).join("");
499
491
  e(this, E).innerHTML = `
500
492
  <style>
501
493
  :host {
@@ -586,7 +578,7 @@ const _ = class _ {
586
578
  <nine-table-sheets>
587
579
  <nine-table-sheets-body>${g}</nine-table-sheets-body>
588
580
  <nine-table-sheets-footer>
589
- <div class="nine-tab-bar">${d}</div>
581
+ <div class="nine-tab-bar">${h}</div>
590
582
  <div class="sheets-counter">Total : <span id="row-count">0</span></div>
591
583
  </nine-table-sheets-footer>
592
584
  </nine-table-sheets>
@@ -594,17 +586,17 @@ const _ = class _ {
594
586
  </nine-table-body>
595
587
  <nine-table-footer></nine-table-footer>
596
588
  `;
597
- const a = e(this, E).querySelectorAll("nine-table-sheet");
598
- a == null || a.forEach((b, n) => {
599
- r[n] && setTimeout(() => {
600
- b.init(r[n]), o && e(this, M).call(this, i);
589
+ const c = e(this, E).querySelectorAll("nine-table-sheet");
590
+ c == null || c.forEach((u, n) => {
591
+ s[n] && setTimeout(() => {
592
+ u.init(s[n]), o && e(this, H).call(this, i);
601
593
  });
602
594
  });
603
595
  }, "#render"));
604
- S(this, E, i), e(this, F).call(this), e(this, j).call(this);
596
+ w(this, E, i), e(this, K).call(this), e(this, j).call(this);
605
597
  }
606
598
  };
607
- E = new WeakMap(), I = new WeakMap(), j = new WeakMap(), M = new WeakMap(), F = new WeakMap(), u(_, "LayoutManager");
599
+ E = new WeakMap(), M = new WeakMap(), j = new WeakMap(), H = new WeakMap(), K = new WeakMap(), b(_, "LayoutManager");
608
600
  let U = _;
609
601
  var W;
610
602
  const ee = class ee extends HTMLElement {
@@ -614,13 +606,13 @@ const ee = class ee extends HTMLElement {
614
606
  this.attachShadow({ mode: "open" });
615
607
  }
616
608
  connectedCallback() {
617
- e(this, W) || (this.layoutManager = new U(this.shadowRoot), S(this, W, !0), x.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } })));
609
+ e(this, W) || (this.layoutManager = new U(this.shadowRoot), w(this, W, !0), z.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } })));
618
610
  }
619
611
  disconnectedCallback() {
620
- x.log("NineTable disconnected.");
612
+ z.log("NineTable disconnected.");
621
613
  }
622
614
  };
623
- W = new WeakMap(), u(ee, "NineTable");
615
+ W = new WeakMap(), b(ee, "NineTable");
624
616
  let G = ee;
625
617
  customElements.get("nine-table") || customElements.define("nine-table", G);
626
618
  //# sourceMappingURL=nine-table.js.map