@ninebone/table 0.0.75 → 0.0.77

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,101 +1,252 @@
1
- var P = Object.defineProperty;
2
- var Z = (r) => {
3
- throw TypeError(r);
1
+ var te = Object.defineProperty;
2
+ var ne = (b) => {
3
+ throw TypeError(b);
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 h = (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), E = (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 oe = (b, i, t) => i in b ? te(b, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : b[i] = t;
6
+ var f = (b, i) => te(b, "name", { value: i, configurable: !0 });
7
+ var L = (b, i, t) => oe(b, typeof i != "symbol" ? i + "" : i, t), ie = (b, i, t) => i.has(b) || ne("Cannot " + t);
8
+ var e = (b, i, t) => (ie(b, i, "read from private field"), t ? t.call(b) : i.get(b)), y = (b, i, t) => i.has(b) ? ne("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(b) : i.set(b, t), S = (b, i, t, o) => (ie(b, i, "write to private field"), o ? o.call(b, t) : i.set(b, t), t);
9
+ import { trace as se } from "@ninebone/util";
10
+ const Q = class Q extends se.constructor {
11
11
  constructor() {
12
12
  super(), this.init("nine-table", "green");
13
13
  }
14
14
  };
15
- h(j, "Trace");
16
- let I = j;
17
- const $ = new I();
18
- var S, R;
19
- const k = class k extends HTMLElement {
15
+ f(Q, "Trace");
16
+ let F = Q;
17
+ const z = new F();
18
+ var k, T, r, E, R, A, N, I;
19
+ const U = class U extends HTMLElement {
20
20
  constructor() {
21
21
  super();
22
- w(this, S, null);
23
- q(this, "init", /* @__PURE__ */ h((e) => {
24
- if (!e) return;
25
- const l = /* @__PURE__ */ h((n) => {
26
- const c = /* @__PURE__ */ h((i) => {
27
- if (i.querySelector("colgroup")) return;
28
- const s = i.querySelector("tbody tr") || i.querySelector("tr"), y = s ? s.querySelectorAll("th, td").length : 1, b = document.createElement("colgroup"), m = Math.max(Math.floor((i.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);
22
+ y(this, k);
23
+ y(this, T);
24
+ y(this, r);
25
+ y(this, E);
26
+ y(this, R);
27
+ L(this, "refresh", /* @__PURE__ */ f(() => {
28
+ if (!e(this, k)) return;
29
+ const t = e(this, k).querySelector(".ng-container-body");
30
+ if (!t) return;
31
+ const o = t.querySelector("table");
32
+ if (!o) return;
33
+ const g = $(e(this, r).track, this), c = $(e(this, r).thumb, this), a = e(this, k).querySelector(".ng-container-bottom");
34
+ if (t.clientWidth !== 0 && o.scrollWidth > t.clientWidth)
35
+ $(a).show();
36
+ else {
37
+ $(a).hide();
38
+ return;
39
+ }
40
+ const l = g.width();
41
+ if (l <= 0) return;
42
+ const p = Math.max(Math.min(l * (t.clientWidth / o.scrollWidth), l), 20);
43
+ c.width(p);
44
+ const n = o.scrollWidth - t.clientWidth, u = l - p;
45
+ let s = 0;
46
+ n > 0 && (s = parseInt(t.scrollLeft / n * u, 10)), s < 0 && (s = 0), s > u && (s = u), c.css({ left: s }), e(this, r).left.disabled = t.scrollLeft <= 0, e(this, r).right.disabled = t.scrollLeft >= n;
47
+ }, "refresh"));
48
+ y(this, A, /* @__PURE__ */ f((t) => {
49
+ if (!e(this, r)) return;
50
+ const o = e(this, k).querySelector(".ng-container-body"), g = o.querySelector("table");
51
+ if (!g) return;
52
+ const c = e(this, r).track.getBoundingClientRect(), a = e(this, r).thumb.getBoundingClientRect();
53
+ let l = t;
54
+ l < 0 && (l = 0), l + a.width > c.width && (l = c.width - a.width), l = parseInt(l, 10), e(this, r).thumb.style.left = l + "px";
55
+ const p = g.scrollWidth - o.clientWidth, n = c.width - a.width;
56
+ return n > 0 && p > 0 && (o.scrollLeft = l / n * p), e(this, r).left.disabled = l <= 0, e(this, r).right.disabled = l >= n, l > 0 && l < n;
57
+ }, "#thumbMoveTo"));
58
+ y(this, N, /* @__PURE__ */ f(() => {
59
+ const t = e(this, k).querySelector(".ng-container-body");
60
+ t && t.addEventListener("scroll", () => {
61
+ this.refresh();
62
+ });
63
+ const o = /* @__PURE__ */ f((c) => {
64
+ clearInterval(e(this, E)), clearInterval(e(this, R));
65
+ const a = e(this, r).track.getBoundingClientRect(), l = e(this, r).thumb.getBoundingClientRect();
66
+ e(this, A).call(this, l.x - a.x + c), S(this, E, setInterval(() => {
67
+ clearInterval(e(this, E)), S(this, R, setInterval(() => {
68
+ const p = e(this, r).track.getBoundingClientRect(), n = e(this, r).thumb.getBoundingClientRect();
69
+ e(this, A).call(this, n.x - p.x + c) || clearInterval(e(this, R));
70
+ }, 10));
71
+ }, 500));
72
+ }, "delayScroll"), g = /* @__PURE__ */ f(() => {
73
+ clearInterval(e(this, E)), clearInterval(e(this, R));
74
+ }, "clearTimer");
75
+ e(this, r).left.ontouchend = e(this, r).right.ontouchend = e(this, r).track.ontouchend = e(this, r).left.onmouseup = e(this, r).left.onmouseleave = e(this, r).right.onmouseup = e(this, r).right.onmouseleave = e(this, r).track.onmouseup = e(this, r).track.onmouseleave = g, $(e(this, r).left).on("mousedown", (c) => {
76
+ c.buttons == 1 && o(-10);
77
+ }), $(e(this, r).right).on("mousedown", (c) => {
78
+ c.buttons == 1 && o(10);
79
+ }), $(e(this, r).left).on("touchstart", (c) => {
80
+ o(-10);
81
+ }), $(e(this, r).right).on("touchstart", (c) => {
82
+ o(10);
83
+ }), $(e(this, r).track).on("mousedown", (c) => {
84
+ if (c.buttons != 1) return;
85
+ c.preventDefault();
86
+ const a = e(this, r).track.getBoundingClientRect(), l = e(this, r).thumb.getBoundingClientRect().width;
87
+ e(this, A).call(this, c.clientX - a.left - l / 2);
88
+ }), $(e(this, r).thumb).on("mousedown", (c) => {
89
+ S(this, T, !0), this.shiftX = c.clientX - e(this, r).thumb.getBoundingClientRect().left, document.addEventListener("mousemove", e(this, I));
90
+ }), document.addEventListener("mouseup", () => {
91
+ S(this, T, !1), g(), document.removeEventListener("mousemove", e(this, I));
92
+ });
93
+ }, "#init"));
94
+ y(this, I, /* @__PURE__ */ f((t) => {
95
+ if (!e(this, T)) return;
96
+ const o = e(this, r).track.getBoundingClientRect();
97
+ e(this, A).call(this, t.clientX - o.left - this.shiftX);
98
+ }, "#thumb_onMouseMove"));
99
+ }
100
+ connectedCallback() {
101
+ S(this, k, this.getRootNode().host), e(this, k) && (this.innerHTML = `
102
+ <style>
103
+ nine-table-hscrollbar {
104
+ display: flex;
105
+ flex-direction: row;
106
+ width: 100%;
107
+ height: 100%;
108
+ background: #f9fafb;
109
+ box-sizing: border-box;
110
+ user-select: none;
111
+ }
112
+ nine-table-hscrollbar button {
113
+ width: 16px;
114
+ height: 100%;
115
+ background: #f3f4f6;
116
+ border: none;
117
+ cursor: pointer;
118
+ display: flex;
119
+ align-items: center;
120
+ justify-content: center;
121
+ padding: 0;
122
+ }
123
+ nine-table-hscrollbar button:disabled {
124
+ opacity: 0.4;
125
+ cursor: default;
126
+ }
127
+ nine-table-hscrollbar .ng-scroll-icon {
128
+ width: 6px;
129
+ height: 6px;
130
+ border-top: 2px solid #6b7280;
131
+ border-right: 2px solid #6b7280;
132
+ }
133
+ nine-table-hscrollbar .ng-scroll-left .ng-scroll-icon { transform: rotate(-135deg); }
134
+ nine-table-hscrollbar .ng-scroll-right .ng-scroll-icon { transform: rotate(45deg); }
135
+ nine-table-hscrollbar .ng-scroll-track {
136
+ flex: 1;
137
+ height: 100%;
138
+ position: relative;
139
+ background: #f3f4f6;
140
+ overflow: hidden;
141
+ }
142
+ nine-table-hscrollbar .ng-scroll-thumb {
143
+ position: absolute;
144
+ top: 2px;
145
+ bottom: 2px;
146
+ background: #d1d5db;
147
+ border-radius: 4px;
148
+ cursor: pointer;
149
+ }
150
+ nine-table-hscrollbar .ng-scroll-thumb:hover {
151
+ background: #9ca3af;
152
+ }
153
+ </style>
154
+ <button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
155
+ <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
156
+ <button class='ng-scroll-right'><div class='ng-scroll-icon'></div></button>
157
+ `, S(this, r, {
158
+ container: e(this, k).querySelector(".ng-container-body"),
159
+ track: this.querySelector(".ng-scroll-track"),
160
+ thumb: this.querySelector(".ng-scroll-thumb"),
161
+ left: this.querySelector(".ng-scroll-left"),
162
+ right: this.querySelector(".ng-scroll-right")
163
+ }), e(this, N).call(this), setTimeout(() => this.refresh(), 0));
164
+ }
165
+ };
166
+ k = new WeakMap(), T = new WeakMap(), r = new WeakMap(), E = new WeakMap(), R = new WeakMap(), A = new WeakMap(), N = new WeakMap(), I = new WeakMap(), f(U, "NineTableHScrollBar");
167
+ let P = U;
168
+ customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", P);
169
+ var C, X;
170
+ const B = class B extends HTMLElement {
171
+ constructor() {
172
+ super();
173
+ y(this, C, null);
174
+ L(this, "init", /* @__PURE__ */ f((t) => {
175
+ if (!t) return;
176
+ const o = /* @__PURE__ */ f((n) => {
177
+ const u = /* @__PURE__ */ f((h) => {
178
+ if (h.querySelector("colgroup")) return;
179
+ const d = h.querySelector("tbody tr") || h.querySelector("tr"), x = d ? d.querySelectorAll("th, td").length : 1, m = document.createElement("colgroup"), w = Math.max(Math.floor((h.clientWidth || 600) / x), 100);
180
+ for (let v = 0; v < x; v++) {
181
+ const Y = document.createElement("col");
182
+ Y.setAttribute("width", w), m.appendChild(Y);
32
183
  }
33
- i.prepend(b);
34
- }, "ensureColgroup"), o = /* @__PURE__ */ h((i) => {
35
- if (i.querySelector("thead")) return;
36
- const s = document.createElement("thead"), y = i.querySelector("colgroup");
37
- y ? y.after(s) : i.prepend(s);
184
+ h.prepend(m);
185
+ }, "ensureColgroup"), s = /* @__PURE__ */ f((h) => {
186
+ if (h.querySelector("thead")) return;
187
+ const d = document.createElement("thead"), x = h.querySelector("colgroup");
188
+ x ? x.after(d) : h.prepend(d);
38
189
  }, "ensureThead");
39
- return c(n), o(n), n.classList.add("nine-table-element"), n;
40
- }, "initializeTable"), u = e.cloneNode(!0);
41
- E(this, S, l(u)), a(this, S).style.display = "table";
42
- const g = this.querySelector(".ng-container-left"), d = this.querySelector(".ng-container-body"), f = this.querySelector(".ng-container-right"), p = /* @__PURE__ */ h((n, c, o = !1) => {
43
- const i = n.cloneNode(!0), s = Array.from(i.querySelectorAll("colgroup col")), y = [];
44
- return s.forEach((b, m) => {
45
- const x = b.getAttribute("fixed");
46
- (o ? !x || x === "" : x === c) || y.push(m);
47
- }), y.reverse().forEach((b) => {
48
- s[b] && s[b].remove(), i.querySelectorAll("tr").forEach((m) => {
49
- const x = m.querySelectorAll("th, td");
50
- x[b] && x[b].remove();
190
+ return u(n), s(n), n.classList.add("nine-table-element"), n;
191
+ }, "initializeTable"), g = t.cloneNode(!0);
192
+ S(this, C, o(g)), e(this, C).style.display = "table";
193
+ const c = this.querySelector(".ng-container-left"), a = this.querySelector(".ng-container-body"), l = this.querySelector(".ng-container-right"), p = /* @__PURE__ */ f((n, u, s = !1) => {
194
+ const h = n.cloneNode(!0), d = Array.from(h.querySelectorAll("colgroup col")), x = [];
195
+ return d.forEach((m, w) => {
196
+ const v = m.getAttribute("fixed");
197
+ (s ? !v || v === "" : v === u) || x.push(w);
198
+ }), x.reverse().forEach((m) => {
199
+ d[m] && d[m].remove(), h.querySelectorAll("tr").forEach((w) => {
200
+ const v = w.querySelectorAll("th, td");
201
+ v[m] && v[m].remove();
51
202
  });
52
- }), i;
203
+ }), h;
53
204
  }, "filterTableByFixed");
54
- if (d) {
55
- const n = p(a(this, S), null, !0);
56
- d.innerHTML = "", d.appendChild(n);
205
+ if (a) {
206
+ const n = p(e(this, C), null, !0);
207
+ a.innerHTML = "", a.appendChild(n);
57
208
  }
58
- if (g) {
59
- const n = p(a(this, S), "left", !1);
60
- let c = 0;
61
- n.querySelectorAll("col").forEach((i) => {
62
- const s = parseInt(i.getAttribute("width"), 10);
63
- isNaN(s) || (c += s);
64
- }), g.innerHTML = "", g.appendChild(n);
65
- const o = c > 0 ? c : 0;
66
- g.style.flex = `0 0 ${o}px`, g.style.width = `${o}px`;
209
+ if (c) {
210
+ const n = p(e(this, C), "left", !1);
211
+ let u = 0;
212
+ n.querySelectorAll("col").forEach((h) => {
213
+ const d = parseInt(h.getAttribute("width"), 10);
214
+ isNaN(d) || (u += d);
215
+ }), c.innerHTML = "", c.appendChild(n);
216
+ const s = u > 0 ? u : 0;
217
+ c.style.flex = `0 0 ${s}px`, c.style.width = `${s}px`;
67
218
  }
68
- if (f) {
69
- const n = p(a(this, S), "right", !1);
70
- let c = 0;
71
- n.querySelectorAll("col").forEach((i) => {
72
- const s = parseInt(i.getAttribute("width"), 10);
73
- isNaN(s) || (c += s);
74
- }), f.innerHTML = "", f.appendChild(n);
75
- const o = c > 0 ? c : 0;
76
- f.style.flex = `0 0 ${o}px`, f.style.width = `${o}px`;
219
+ if (l) {
220
+ const n = p(e(this, C), "right", !1);
221
+ let u = 0;
222
+ n.querySelectorAll("col").forEach((h) => {
223
+ const d = parseInt(h.getAttribute("width"), 10);
224
+ isNaN(d) || (u += d);
225
+ }), l.innerHTML = "", l.appendChild(n);
226
+ const s = u > 0 ? u : 0;
227
+ l.style.flex = `0 0 ${s}px`, l.style.width = `${s}px`;
77
228
  }
78
- if (d) {
229
+ if (a) {
79
230
  const n = this.getRowCount();
80
- d.style.overflowY = n > 10 ? "auto" : "hidden", d.addEventListener("scroll", () => {
81
- const c = d.scrollLeft, o = this.querySelector("nine-table-hscrollbar");
82
- o && typeof o.syncThumb == "function" && o.syncThumb(c);
231
+ a.style.overflowY = n > 10 ? "auto" : "hidden", a.addEventListener("scroll", () => {
232
+ const u = a.scrollLeft, s = this.querySelector("nine-table-hscrollbar");
233
+ s && typeof s.syncThumb == "function" && s.syncThumb(u);
83
234
  });
84
235
  }
85
- $.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
236
+ z.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
86
237
  }, "init"));
87
- q(this, "getRowCount", /* @__PURE__ */ h(() => a(this, S) ? a(this, S).querySelectorAll("tbody tr").length : 0, "getRowCount"));
238
+ L(this, "getRowCount", /* @__PURE__ */ f(() => e(this, C) ? e(this, C).querySelectorAll("tbody tr").length : 0, "getRowCount"));
88
239
  // 🎯 외부 스크롤바 및 컨트롤러 연동용 메서드
89
- q(this, "scrollToX", /* @__PURE__ */ h((e) => {
90
- const l = this.querySelector(".ng-container-body");
91
- l && (l.scrollLeft = e);
240
+ L(this, "scrollToX", /* @__PURE__ */ f((t) => {
241
+ const o = this.querySelector(".ng-container-body");
242
+ o && (o.scrollLeft = t);
92
243
  }, "scrollToX"));
93
- q(this, "scrollToY", /* @__PURE__ */ h((e) => {
94
- const l = this.querySelector(".ng-container-body");
95
- l && (l.scrollTop = e);
244
+ L(this, "scrollToY", /* @__PURE__ */ f((t) => {
245
+ const o = this.querySelector(".ng-container-body");
246
+ o && (o.scrollTop = t);
96
247
  }, "scrollToY"));
97
- w(this, R, /* @__PURE__ */ h(() => {
98
- const e = k.SCROLLBAR_SIZE;
248
+ y(this, X, /* @__PURE__ */ f(() => {
249
+ const t = B.SCROLLBAR_SIZE;
99
250
  this.innerHTML = `
100
251
  <style>
101
252
  nine-table-sheet {
@@ -114,7 +265,7 @@ const k = class k extends HTMLElement {
114
265
  flex-direction: row;
115
266
  flex: 1 1 auto;
116
267
  width: 100%;
117
- height: calc(100% - ${e}px);
268
+ height: calc(100% - ${t}px);
118
269
  overflow: hidden;
119
270
  position: relative;
120
271
  }
@@ -150,8 +301,8 @@ const k = class k extends HTMLElement {
150
301
  nine-table-sheet .ng-container-bottom {
151
302
  display: flex;
152
303
  flex-direction: row;
153
- height: ${e}px;
154
- min-height: ${e}px;
304
+ height: ${t}px;
305
+ min-height: ${t}px;
155
306
  flex-shrink: 0;
156
307
  background: #f9fafb;
157
308
  border-top: 1px solid #e5e7eb;
@@ -165,8 +316,8 @@ const k = class k extends HTMLElement {
165
316
  }
166
317
 
167
318
  nine-table-sheet .ng-scroll-edge {
168
- width: ${e}px;
169
- min-width: ${e}px;
319
+ width: ${t}px;
320
+ min-width: ${t}px;
170
321
  height: 100%;
171
322
  flex-shrink: 0;
172
323
  background: #f3f4f6;
@@ -210,109 +361,109 @@ const k = class k extends HTMLElement {
210
361
  }, "#render"));
211
362
  }
212
363
  connectedCallback() {
213
- a(this, R).call(this);
364
+ e(this, X).call(this);
214
365
  }
215
366
  disconnectedCallback() {
216
- this.innerHTML = "", $.log("NineTableSheet destroyed.");
367
+ this.innerHTML = "", z.log("NineTableSheet destroyed.");
217
368
  }
218
369
  };
219
- S = new WeakMap(), R = new WeakMap(), h(k, "NineTableSheet"), q(k, "SCROLLBAR_SIZE", 16);
220
- let B = k;
221
- customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", B);
222
- var T;
223
- const K = class K extends HTMLElement {
370
+ C = new WeakMap(), X = new WeakMap(), f(B, "NineTableSheet"), L(B, "SCROLLBAR_SIZE", 16);
371
+ let Z = B;
372
+ customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", Z);
373
+ var j;
374
+ const V = class V extends HTMLElement {
224
375
  constructor() {
225
376
  super();
226
- w(this, T, /* @__PURE__ */ h(() => {
227
- const e = this.querySelector(".nine-tab-bar");
228
- e && (e.addEventListener("click", (l) => {
229
- const u = l.target.closest(".nine-tab-item");
230
- if (!u) return;
231
- const g = l.ctrlKey || l.metaKey || l.shiftKey, d = parseInt(u.dataset.index, 10);
232
- this.switchSheet(d, g);
377
+ y(this, j, /* @__PURE__ */ f(() => {
378
+ const t = this.querySelector(".nine-tab-bar");
379
+ t && (t.addEventListener("click", (o) => {
380
+ const g = o.target.closest(".nine-tab-item");
381
+ if (!g) return;
382
+ const c = o.ctrlKey || o.metaKey || o.shiftKey, a = parseInt(g.dataset.index, 10);
383
+ this.switchSheet(a, c);
233
384
  }), this.switchSheet(0, !1));
234
385
  }, "#init"));
235
- q(this, "switchSheet", /* @__PURE__ */ h((e, l = !1) => {
236
- const u = /* @__PURE__ */ h(() => {
237
- const o = this.querySelector("nine-table-sheets-body");
238
- o.querySelectorAll("nine-splitter").forEach((s) => {
239
- const y = parseInt(s.dataset.splitIndex, 10), b = o.querySelector(`nine-table-sheet[data-index="${y - 1}"]`), m = o.querySelector(`nine-table-sheet[data-index="${y}"]`);
240
- b && m && b.classList.contains("active") && m.classList.contains("active") ? s.classList.add("active") : s.classList.remove("active");
386
+ L(this, "switchSheet", /* @__PURE__ */ f((t, o = !1) => {
387
+ const g = /* @__PURE__ */ f(() => {
388
+ const s = this.querySelector("nine-table-sheets-body");
389
+ s.querySelectorAll("nine-splitter").forEach((d) => {
390
+ const x = parseInt(d.dataset.splitIndex, 10), m = s.querySelector(`nine-table-sheet[data-index="${x - 1}"]`), w = s.querySelector(`nine-table-sheet[data-index="${x}"]`);
391
+ m && w && m.classList.contains("active") && w.classList.contains("active") ? d.classList.add("active") : d.classList.remove("active");
241
392
  });
242
- }, "updateSplitters"), g = this.querySelector(".nine-tab-bar"), d = this.querySelector("nine-table-sheets-body"), f = g.querySelectorAll(".nine-tab-item"), p = d.querySelectorAll("nine-table-sheet");
243
- if (!f[e]) return;
244
- if (!l)
245
- f.forEach((o, i) => {
246
- o.classList.toggle("active", i === e);
247
- const s = d.querySelector(`nine-table-sheet[data-index="${i}"]`);
248
- s && (s.style.flex = "");
249
- }), p.forEach((o, i) => {
250
- o.classList.toggle("active", i === e);
393
+ }, "updateSplitters"), c = this.querySelector(".nine-tab-bar"), a = this.querySelector("nine-table-sheets-body"), l = c.querySelectorAll(".nine-tab-item"), p = a.querySelectorAll("nine-table-sheet");
394
+ if (!l[t]) return;
395
+ if (!o)
396
+ l.forEach((s, h) => {
397
+ s.classList.toggle("active", h === t);
398
+ const d = a.querySelector(`nine-table-sheet[data-index="${h}"]`);
399
+ d && (d.style.flex = "");
400
+ }), p.forEach((s, h) => {
401
+ s.classList.toggle("active", h === t);
251
402
  });
252
403
  else {
253
- const o = f[e], i = g.querySelectorAll(".nine-tab-item.active");
254
- if (o.classList.contains("active") && i.length <= 1)
404
+ const s = l[t], h = c.querySelectorAll(".nine-tab-item.active");
405
+ if (s.classList.contains("active") && h.length <= 1)
255
406
  return;
256
- o.classList.toggle("active");
257
- const s = d.querySelector(`nine-table-sheet[data-index="${e}"]`);
258
- s && (s.classList.toggle("active"), s.classList.contains("active") || (s.style.flex = ""));
407
+ s.classList.toggle("active");
408
+ const d = a.querySelector(`nine-table-sheet[data-index="${t}"]`);
409
+ d && (d.classList.toggle("active"), d.classList.contains("active") || (d.style.flex = ""));
259
410
  }
260
- const n = Array.from(d.querySelectorAll("nine-table-sheet.active"));
411
+ const n = Array.from(a.querySelectorAll("nine-table-sheet.active"));
261
412
  if (n.length > 1) {
262
- const o = 1 / n.length;
263
- n.forEach((i) => {
264
- (!i.style.flex || i.style.flex === "1 1 100%") && (i.style.flex = `${o} ${o} 0px`);
413
+ const s = 1 / n.length;
414
+ n.forEach((h) => {
415
+ (!h.style.flex || h.style.flex === "1 1 100%") && (h.style.flex = `${s} ${s} 0px`);
265
416
  });
266
417
  } else
267
- n.forEach((o) => {
268
- o.style.flex = "1 1 100%";
418
+ n.forEach((s) => {
419
+ s.style.flex = "1 1 100%";
269
420
  });
270
- u();
271
- const c = d.querySelector("nine-table-sheet.active");
272
- if (c && typeof c.getRowCount == "function") {
273
- const o = this.querySelector("#row-count");
274
- o && (o.textContent = c.getRowCount().toLocaleString());
421
+ g();
422
+ const u = a.querySelector("nine-table-sheet.active");
423
+ if (u && typeof u.getRowCount == "function") {
424
+ const s = this.querySelector("#row-count");
425
+ s && (s.textContent = u.getRowCount().toLocaleString());
275
426
  }
276
427
  }, "switchSheet"));
277
428
  }
278
429
  connectedCallback() {
279
- a(this, T).call(this);
430
+ e(this, j).call(this);
280
431
  }
281
432
  };
282
- T = new WeakMap(), h(K, "NineTableSheets");
283
- let N = K;
284
- customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", N);
285
- var v, C, H, A, M;
286
- const Y = class Y {
287
- constructor(t) {
288
- w(this, v);
289
- w(this, C, null);
290
- w(this, H, /* @__PURE__ */ h(() => {
291
- const t = a(this, v).host;
292
- t && (E(this, C, new ResizeObserver((e) => {
293
- for (let l of e)
294
- t.getAttribute("auto-height") === "true" && a(this, A).call(this, t);
295
- })), a(this, C).observe(t));
433
+ j = new WeakMap(), f(V, "NineTableSheets");
434
+ let D = V;
435
+ customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", D);
436
+ var q, H, O, M, K;
437
+ const _ = class _ {
438
+ constructor(i) {
439
+ y(this, q);
440
+ y(this, H, null);
441
+ y(this, O, /* @__PURE__ */ f(() => {
442
+ const i = e(this, q).host;
443
+ i && (S(this, H, new ResizeObserver((t) => {
444
+ for (let o of t)
445
+ i.getAttribute("auto-height") === "true" && e(this, M).call(this, i);
446
+ })), e(this, H).observe(i));
296
447
  }, "#observeResize"));
297
- w(this, A, /* @__PURE__ */ h((t) => {
298
- var m, x;
299
- const e = (m = t.shadowRoot) == null ? void 0 : m.querySelector("nine-table-sheet.active");
300
- if (!e) return;
301
- 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), d = e.querySelector("tbody tr") || e.querySelector("tr"), f = d ? d.getBoundingClientRect().height : 32, p = a(this, v).querySelector("nine-table-header"), n = a(this, v).querySelector("nine-table-sheets-footer"), c = p ? p.getBoundingClientRect().height : 40, o = n ? n.getBoundingClientRect().height : 32, s = c + o + 16, y = g * f + s;
302
- t.style.height = `${y}px`, t.style.maxHeight = `${u * f + s}px`;
303
- const b = a(this, v).querySelector("nine-table-sheets-body");
304
- b && (b.style.overflowY = l > u ? "auto" : "hidden");
448
+ y(this, M, /* @__PURE__ */ f((i) => {
449
+ var w, v;
450
+ const t = (w = i.shadowRoot) == null ? void 0 : w.querySelector("nine-table-sheet.active");
451
+ if (!t) return;
452
+ const o = ((v = t.getRowCount) == null ? void 0 : v.call(t)) || 0, g = parseInt(i.getAttribute("max-display-row"), 10) || 10, c = Math.min(o, g), a = t.querySelector("tbody tr") || t.querySelector("tr"), l = a ? a.getBoundingClientRect().height : 32, p = e(this, q).querySelector("nine-table-header"), n = e(this, q).querySelector("nine-table-sheets-footer"), u = p ? p.getBoundingClientRect().height : 40, s = n ? n.getBoundingClientRect().height : 32, d = u + s + 16, x = c * l + d;
453
+ i.style.height = `${x}px`, i.style.maxHeight = `${g * l + d}px`;
454
+ const m = e(this, q).querySelector("nine-table-sheets-body");
455
+ m && (m.style.overflowY = o > g ? "auto" : "hidden");
305
456
  }, "#applyAutoHeight"));
306
- w(this, M, /* @__PURE__ */ h(() => {
307
- 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(""), d = l.map((p, n) => `<div class="nine-tab-item ${n === 0 ? "active" : ""}" data-index="${n}">Sheet ${n + 1}</div>`).join("");
308
- a(this, v).innerHTML = `
457
+ y(this, K, /* @__PURE__ */ f(() => {
458
+ const i = e(this, q).host, o = Array.from(i.children).filter((p) => p.tagName === "TABLE"), g = i.getAttribute("auto-height") === "true", c = o.map((p, n) => `<nine-table-sheet class="${n === 0 ? "active" : ""}" data-index="${n}"></nine-table-sheet>`).join(""), a = o.map((p, n) => `<div class="nine-tab-item ${n === 0 ? "active" : ""}" data-index="${n}">Sheet ${n + 1}</div>`).join("");
459
+ e(this, q).innerHTML = `
309
460
  <style>
310
461
  :host {
311
462
  display: flex;
312
463
  flex-direction: column;
313
464
  position: relative;
314
465
  overflow: hidden;
315
- height: ${u ? "auto" : "100%"};
466
+ height: ${g ? "auto" : "100%"};
316
467
  background: #fff;
317
468
  }
318
469
  nine-table-header { height: 40px; display: block; flex-shrink: 0; border-bottom: 1px solid #e5e7eb; background: #fff; }
@@ -393,9 +544,9 @@ const Y = class Y {
393
544
  <nine-table-body>
394
545
  <nine-table-summary></nine-table-summary>
395
546
  <nine-table-sheets>
396
- <nine-table-sheets-body>${g}</nine-table-sheets-body>
547
+ <nine-table-sheets-body>${c}</nine-table-sheets-body>
397
548
  <nine-table-sheets-footer>
398
- <div class="nine-tab-bar">${d}</div>
549
+ <div class="nine-tab-bar">${a}</div>
399
550
  <div class="sheets-counter">Total : <span id="row-count">0</span></div>
400
551
  </nine-table-sheets-footer>
401
552
  </nine-table-sheets>
@@ -403,33 +554,33 @@ const Y = class Y {
403
554
  </nine-table-body>
404
555
  <nine-table-footer></nine-table-footer>
405
556
  `;
406
- const f = a(this, v).querySelectorAll("nine-table-sheet");
407
- f == null || f.forEach((p, n) => {
408
- l[n] && setTimeout(() => {
409
- p.init(l[n]), u && a(this, A).call(this, t);
557
+ const l = e(this, q).querySelectorAll("nine-table-sheet");
558
+ l == null || l.forEach((p, n) => {
559
+ o[n] && setTimeout(() => {
560
+ p.init(o[n]), g && e(this, M).call(this, i);
410
561
  });
411
562
  });
412
563
  }, "#render"));
413
- E(this, v, t), a(this, M).call(this), a(this, H).call(this);
564
+ S(this, q, i), e(this, K).call(this), e(this, O).call(this);
414
565
  }
415
566
  };
416
- v = new WeakMap(), C = new WeakMap(), H = new WeakMap(), A = new WeakMap(), M = new WeakMap(), h(Y, "LayoutManager");
417
- let W = Y;
418
- var L;
419
- const F = class F extends HTMLElement {
567
+ q = new WeakMap(), H = new WeakMap(), O = new WeakMap(), M = new WeakMap(), K = new WeakMap(), f(_, "LayoutManager");
568
+ let G = _;
569
+ var W;
570
+ const ee = class ee extends HTMLElement {
420
571
  constructor() {
421
572
  super();
422
- w(this, L, !1);
573
+ y(this, W, !1);
423
574
  this.attachShadow({ mode: "open" });
424
575
  }
425
576
  connectedCallback() {
426
- a(this, L) || (this.layoutManager = new W(this.shadowRoot), E(this, L, !0), $.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } })));
577
+ e(this, W) || (this.layoutManager = new G(this.shadowRoot), S(this, W, !0), z.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } })));
427
578
  }
428
579
  disconnectedCallback() {
429
- $.log("NineTable disconnected.");
580
+ z.log("NineTable disconnected.");
430
581
  }
431
582
  };
432
- L = new WeakMap(), h(F, "NineTable");
433
- let O = F;
434
- customElements.get("nine-table") || customElements.define("nine-table", O);
583
+ W = new WeakMap(), f(ee, "NineTable");
584
+ let J = ee;
585
+ customElements.get("nine-table") || customElements.define("nine-table", J);
435
586
  //# sourceMappingURL=nine-table.js.map