@ninebone/table 0.0.92 → 0.0.94

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