@ninebone/table 0.0.76 → 0.0.78

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,254 @@
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 s = g.width();
41
+ if (s <= 0) return;
42
+ const p = Math.max(Math.min(s * (t.clientWidth / o.scrollWidth), s), 20);
43
+ c.width(p);
44
+ const n = o.scrollWidth - t.clientWidth, u = s - p;
45
+ let l = 0;
46
+ n > 0 && (l = parseInt(t.scrollLeft / n * u, 10)), l < 0 && (l = 0), l > u && (l = u), c.css({ left: l }), 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 s = t;
54
+ s < 0 && (s = 0), s + a.width > c.width && (s = c.width - a.width), s = parseInt(s, 10), e(this, r).thumb.style.left = s + "px";
55
+ const p = g.scrollWidth - o.clientWidth, n = c.width - a.width;
56
+ return n > 0 && p > 0 && (o.scrollLeft = s / n * p), e(this, r).left.disabled = s <= 0, e(this, r).right.disabled = s >= n, s > 0 && s < 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(), s = e(this, r).thumb.getBoundingClientRect();
66
+ e(this, A).call(this, s.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(), s = e(this, r).thumb.getBoundingClientRect().width;
87
+ e(this, A).call(this, c.clientX - a.left - s / 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"), l = /* @__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), l(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"), s = this.querySelector(".ng-container-right"), p = /* @__PURE__ */ f((n, u, l = !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
+ (l ? !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 l = u > 0 ? u : 0;
217
+ c.style.flex = `0 0 ${l}px`, c.style.width = `${l}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 (s) {
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
+ }), s.innerHTML = "", s.appendChild(n);
226
+ const l = u > 0 ? u : 0;
227
+ s.style.flex = `0 0 ${l}px`, s.style.width = `${l}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 = this.querySelector("nine-table-hscrollbar");
233
+ u && typeof u.refresh == "function" && u.refresh();
83
234
  });
84
235
  }
85
- $.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
236
+ setTimeout(() => {
237
+ const n = this.querySelector("nine-table-hscrollbar");
238
+ n && typeof n.refresh == "function" && n.refresh();
239
+ }, 0), z.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
86
240
  }, "init"));
87
- q(this, "getRowCount", /* @__PURE__ */ h(() => a(this, S) ? a(this, S).querySelectorAll("tbody tr").length : 0, "getRowCount"));
88
- // 🎯 외부 스크롤바 컨트롤러 연동용 메서드
89
- q(this, "scrollToX", /* @__PURE__ */ h((e) => {
90
- const l = this.querySelector(".ng-container-body");
91
- l && (l.scrollLeft = e);
241
+ L(this, "getRowCount", /* @__PURE__ */ f(() => e(this, C) ? e(this, C).querySelectorAll("tbody tr").length : 0, "getRowCount"));
242
+ L(this, "scrollToX", /* @__PURE__ */ f((t) => {
243
+ const o = this.querySelector(".ng-container-body");
244
+ o && (o.scrollLeft = t);
92
245
  }, "scrollToX"));
93
- q(this, "scrollToY", /* @__PURE__ */ h((e) => {
94
- const l = this.querySelector(".ng-container-body");
95
- l && (l.scrollTop = e);
246
+ L(this, "scrollToY", /* @__PURE__ */ f((t) => {
247
+ const o = this.querySelector(".ng-container-body");
248
+ o && (o.scrollTop = t);
96
249
  }, "scrollToY"));
97
- w(this, R, /* @__PURE__ */ h(() => {
98
- const e = k.SCROLLBAR_SIZE;
250
+ y(this, X, /* @__PURE__ */ f(() => {
251
+ const t = B.SCROLLBAR_SIZE;
99
252
  this.innerHTML = `
100
253
  <style>
101
254
  nine-table-sheet {
@@ -114,7 +267,7 @@ const k = class k extends HTMLElement {
114
267
  flex-direction: row;
115
268
  flex: 1 1 auto;
116
269
  width: 100%;
117
- height: calc(100% - ${e}px);
270
+ height: calc(100% - ${t}px);
118
271
  overflow: hidden;
119
272
  position: relative;
120
273
  }
@@ -128,11 +281,12 @@ const k = class k extends HTMLElement {
128
281
  flex-shrink: 0;
129
282
  }
130
283
 
284
+ /* 🎯 컨테이너 자체 스크롤바 생성을 막고 외부 커스텀 스크롤바 제어에 의존 */
131
285
  nine-table-sheet .ng-container-body {
132
286
  display: flex;
133
287
  flex-direction: column;
134
288
  flex: 1;
135
- overflow-x: auto;
289
+ overflow-x: hidden;
136
290
  overflow-y: auto;
137
291
  background: #ffffff;
138
292
  position: relative;
@@ -150,8 +304,8 @@ const k = class k extends HTMLElement {
150
304
  nine-table-sheet .ng-container-bottom {
151
305
  display: flex;
152
306
  flex-direction: row;
153
- height: ${e}px;
154
- min-height: ${e}px;
307
+ height: ${t}px;
308
+ min-height: ${t}px;
155
309
  flex-shrink: 0;
156
310
  background: #f9fafb;
157
311
  border-top: 1px solid #e5e7eb;
@@ -165,8 +319,8 @@ const k = class k extends HTMLElement {
165
319
  }
166
320
 
167
321
  nine-table-sheet .ng-scroll-edge {
168
- width: ${e}px;
169
- min-width: ${e}px;
322
+ width: ${t}px;
323
+ min-width: ${t}px;
170
324
  height: 100%;
171
325
  flex-shrink: 0;
172
326
  background: #f3f4f6;
@@ -210,109 +364,109 @@ const k = class k extends HTMLElement {
210
364
  }, "#render"));
211
365
  }
212
366
  connectedCallback() {
213
- a(this, R).call(this);
367
+ e(this, X).call(this);
214
368
  }
215
369
  disconnectedCallback() {
216
- this.innerHTML = "", $.log("NineTableSheet destroyed.");
370
+ this.innerHTML = "", z.log("NineTableSheet destroyed.");
217
371
  }
218
372
  };
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 {
373
+ C = new WeakMap(), X = new WeakMap(), f(B, "NineTableSheet"), L(B, "SCROLLBAR_SIZE", 16);
374
+ let Z = B;
375
+ customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", Z);
376
+ var j;
377
+ const V = class V extends HTMLElement {
224
378
  constructor() {
225
379
  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);
380
+ y(this, j, /* @__PURE__ */ f(() => {
381
+ const t = this.querySelector(".nine-tab-bar");
382
+ t && (t.addEventListener("click", (o) => {
383
+ const g = o.target.closest(".nine-tab-item");
384
+ if (!g) return;
385
+ const c = o.ctrlKey || o.metaKey || o.shiftKey, a = parseInt(g.dataset.index, 10);
386
+ this.switchSheet(a, c);
233
387
  }), this.switchSheet(0, !1));
234
388
  }, "#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");
389
+ L(this, "switchSheet", /* @__PURE__ */ f((t, o = !1) => {
390
+ const g = /* @__PURE__ */ f(() => {
391
+ const l = this.querySelector("nine-table-sheets-body");
392
+ l.querySelectorAll("nine-splitter").forEach((d) => {
393
+ const x = parseInt(d.dataset.splitIndex, 10), m = l.querySelector(`nine-table-sheet[data-index="${x - 1}"]`), w = l.querySelector(`nine-table-sheet[data-index="${x}"]`);
394
+ m && w && m.classList.contains("active") && w.classList.contains("active") ? d.classList.add("active") : d.classList.remove("active");
241
395
  });
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);
396
+ }, "updateSplitters"), c = this.querySelector(".nine-tab-bar"), a = this.querySelector("nine-table-sheets-body"), s = c.querySelectorAll(".nine-tab-item"), p = a.querySelectorAll("nine-table-sheet");
397
+ if (!s[t]) return;
398
+ if (!o)
399
+ s.forEach((l, h) => {
400
+ l.classList.toggle("active", h === t);
401
+ const d = a.querySelector(`nine-table-sheet[data-index="${h}"]`);
402
+ d && (d.style.flex = "");
403
+ }), p.forEach((l, h) => {
404
+ l.classList.toggle("active", h === t);
251
405
  });
252
406
  else {
253
- const o = f[e], i = g.querySelectorAll(".nine-tab-item.active");
254
- if (o.classList.contains("active") && i.length <= 1)
407
+ const l = s[t], h = c.querySelectorAll(".nine-tab-item.active");
408
+ if (l.classList.contains("active") && h.length <= 1)
255
409
  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 = ""));
410
+ l.classList.toggle("active");
411
+ const d = a.querySelector(`nine-table-sheet[data-index="${t}"]`);
412
+ d && (d.classList.toggle("active"), d.classList.contains("active") || (d.style.flex = ""));
259
413
  }
260
- const n = Array.from(d.querySelectorAll("nine-table-sheet.active"));
414
+ const n = Array.from(a.querySelectorAll("nine-table-sheet.active"));
261
415
  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`);
416
+ const l = 1 / n.length;
417
+ n.forEach((h) => {
418
+ (!h.style.flex || h.style.flex === "1 1 100%") && (h.style.flex = `${l} ${l} 0px`);
265
419
  });
266
420
  } else
267
- n.forEach((o) => {
268
- o.style.flex = "1 1 100%";
421
+ n.forEach((l) => {
422
+ l.style.flex = "1 1 100%";
269
423
  });
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());
424
+ g();
425
+ const u = a.querySelector("nine-table-sheet.active");
426
+ if (u && typeof u.getRowCount == "function") {
427
+ const l = this.querySelector("#row-count");
428
+ l && (l.textContent = u.getRowCount().toLocaleString());
275
429
  }
276
430
  }, "switchSheet"));
277
431
  }
278
432
  connectedCallback() {
279
- a(this, T).call(this);
433
+ e(this, j).call(this);
280
434
  }
281
435
  };
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));
436
+ j = new WeakMap(), f(V, "NineTableSheets");
437
+ let D = V;
438
+ customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", D);
439
+ var q, H, O, M, K;
440
+ const _ = class _ {
441
+ constructor(i) {
442
+ y(this, q);
443
+ y(this, H, null);
444
+ y(this, O, /* @__PURE__ */ f(() => {
445
+ const i = e(this, q).host;
446
+ i && (S(this, H, new ResizeObserver((t) => {
447
+ for (let o of t)
448
+ i.getAttribute("auto-height") === "true" && e(this, M).call(this, i);
449
+ })), e(this, H).observe(i));
296
450
  }, "#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");
451
+ y(this, M, /* @__PURE__ */ f((i) => {
452
+ var w, v;
453
+ const t = (w = i.shadowRoot) == null ? void 0 : w.querySelector("nine-table-sheet.active");
454
+ if (!t) return;
455
+ 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"), s = 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, l = n ? n.getBoundingClientRect().height : 32, d = u + l + 16, x = c * s + d;
456
+ i.style.height = `${x}px`, i.style.maxHeight = `${g * s + d}px`;
457
+ const m = e(this, q).querySelector("nine-table-sheets-body");
458
+ m && (m.style.overflowY = o > g ? "auto" : "hidden");
305
459
  }, "#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 = `
460
+ y(this, K, /* @__PURE__ */ f(() => {
461
+ 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("");
462
+ e(this, q).innerHTML = `
309
463
  <style>
310
464
  :host {
311
465
  display: flex;
312
466
  flex-direction: column;
313
467
  position: relative;
314
468
  overflow: hidden;
315
- height: ${u ? "auto" : "100%"};
469
+ height: ${g ? "auto" : "100%"};
316
470
  background: #fff;
317
471
  }
318
472
  nine-table-header { height: 40px; display: block; flex-shrink: 0; border-bottom: 1px solid #e5e7eb; background: #fff; }
@@ -393,9 +547,9 @@ const Y = class Y {
393
547
  <nine-table-body>
394
548
  <nine-table-summary></nine-table-summary>
395
549
  <nine-table-sheets>
396
- <nine-table-sheets-body>${g}</nine-table-sheets-body>
550
+ <nine-table-sheets-body>${c}</nine-table-sheets-body>
397
551
  <nine-table-sheets-footer>
398
- <div class="nine-tab-bar">${d}</div>
552
+ <div class="nine-tab-bar">${a}</div>
399
553
  <div class="sheets-counter">Total : <span id="row-count">0</span></div>
400
554
  </nine-table-sheets-footer>
401
555
  </nine-table-sheets>
@@ -403,33 +557,33 @@ const Y = class Y {
403
557
  </nine-table-body>
404
558
  <nine-table-footer></nine-table-footer>
405
559
  `;
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);
560
+ const s = e(this, q).querySelectorAll("nine-table-sheet");
561
+ s == null || s.forEach((p, n) => {
562
+ o[n] && setTimeout(() => {
563
+ p.init(o[n]), g && e(this, M).call(this, i);
410
564
  });
411
565
  });
412
566
  }, "#render"));
413
- E(this, v, t), a(this, M).call(this), a(this, H).call(this);
567
+ S(this, q, i), e(this, K).call(this), e(this, O).call(this);
414
568
  }
415
569
  };
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 {
570
+ q = new WeakMap(), H = new WeakMap(), O = new WeakMap(), M = new WeakMap(), K = new WeakMap(), f(_, "LayoutManager");
571
+ let G = _;
572
+ var W;
573
+ const ee = class ee extends HTMLElement {
420
574
  constructor() {
421
575
  super();
422
- w(this, L, !1);
576
+ y(this, W, !1);
423
577
  this.attachShadow({ mode: "open" });
424
578
  }
425
579
  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 } })));
580
+ 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
581
  }
428
582
  disconnectedCallback() {
429
- $.log("NineTable disconnected.");
583
+ z.log("NineTable disconnected.");
430
584
  }
431
585
  };
432
- L = new WeakMap(), h(F, "NineTable");
433
- let O = F;
434
- customElements.get("nine-table") || customElements.define("nine-table", O);
586
+ W = new WeakMap(), f(ee, "NineTable");
587
+ let J = ee;
588
+ customElements.get("nine-table") || customElements.define("nine-table", J);
435
589
  //# sourceMappingURL=nine-table.js.map