@ninebone/table 0.0.85 → 0.0.87

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,105 @@
1
- var ee = Object.defineProperty;
2
- var te = (p) => {
1
+ var _ = Object.defineProperty;
2
+ var ee = (p) => {
3
3
  throw TypeError(p);
4
4
  };
5
- var ie = (p, i, t) => i in p ? ee(p, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[i] = t;
6
- var b = (p, i) => ee(p, "name", { value: i, configurable: !0 });
7
- var C = (p, i, t) => ie(p, typeof i != "symbol" ? i + "" : i, t), ne = (p, i, t) => i.has(p) || te("Cannot " + t);
8
- var e = (p, i, t) => (ne(p, i, "read from private field"), t ? t.call(p) : i.get(p)), y = (p, i, t) => i.has(p) ? te("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(p) : i.set(p, t), S = (p, i, t, o) => (ne(p, i, "write to private field"), o ? o.call(p, t) : i.set(p, t), t);
9
- import { trace as oe } from "@ninebone/util";
10
- const G = class G extends oe.constructor {
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 {
11
11
  constructor() {
12
12
  super(), this.init("nine-table", "green");
13
13
  }
14
14
  };
15
- b(G, "Trace");
16
- let K = G;
17
- const W = new K();
18
- var E, B, c, L, R, A, z;
19
- const J = class J extends HTMLElement {
15
+ b(U, "Trace");
16
+ let F = U;
17
+ const H = new F();
18
+ var q, $, d, C, A, R, W;
19
+ const G = class G extends HTMLElement {
20
20
  constructor() {
21
21
  super();
22
- y(this, E);
23
- y(this, B);
24
- y(this, c);
25
- y(this, L);
26
- y(this, R);
27
- C(this, "refresh", /* @__PURE__ */ b(() => {
28
- if (!e(this, E) || !e(this, c)) return;
29
- const t = e(this, c).container, o = t.querySelector("table");
30
- if (!o) return;
31
- const r = $(e(this, c).track, this), d = $(e(this, c).thumb, this), h = e(this, E).querySelector(".ng-container-bottom");
32
- if (t.clientWidth !== 0 && o.scrollWidth > t.clientWidth)
33
- $(h).show();
22
+ y(this, q);
23
+ y(this, $, !1);
24
+ y(this, d);
25
+ y(this, C);
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");
34
34
  else {
35
- $(h).hide();
35
+ h && (h.style.display = "none");
36
36
  return;
37
37
  }
38
- const s = r.width();
39
- if (s <= 0) return;
40
- const g = Math.min(s * t.clientWidth / o.scrollWidth, s);
41
- d.width(Math.max(g, 20));
42
- const n = parseInt($(o).css("left") || 0, 10);
43
- let l = parseInt(Math.abs(n) * s / o.scrollWidth, 10);
38
+ const n = o.clientWidth;
39
+ if (n <= 0) return;
40
+ const f = Math.max(Math.min(n * (a / g), n), 20);
41
+ u.style.width = `${f}px`;
42
+ const s = parseInt(r.style.left || 0, 10);
43
+ let l = parseInt(Math.abs(s) * n / g, 10);
44
44
  l < 0 && (l = 0);
45
- const a = r.width() - d.width();
46
- l > a && (l = a), d.css({ left: l }), e(this, c).left.disabled = l == 0, e(this, c).right.disabled = l >= a;
45
+ const c = n - f;
46
+ l > c && (l = c), u.style.left = `${l}px`, e(this, d).left.disabled = l === 0, e(this, d).right.disabled = l >= c;
47
47
  }, "refresh"));
48
- y(this, A, /* @__PURE__ */ b((t) => {
49
- if (!e(this, c)) return !1;
50
- const o = e(this, c).container, r = o.querySelector("table");
51
- if (!r) return !1;
52
- const d = e(this, c).track.getBoundingClientRect(), h = e(this, c).thumb.getBoundingClientRect();
53
- let s = t;
54
- s < 0 && (s = 0), s + h.width > d.width && (s = d.width - h.width), s = parseInt(s, 10), e(this, c).thumb.style.left = s + "px";
55
- const g = o.clientWidth, n = r.scrollWidth;
56
- let l = -s * (n - g) / (d.width - h.width);
57
- -l > n - g && (l = -(n - g)), -l + 5 > n - g && (l = -(n - g)), g >= n && (l = 0), $(r).css({ left: l });
58
- const a = d.width - h.width;
59
- return e(this, c).left.disabled = s == 0, e(this, c).right.disabled = s >= a, s > 0 && s < a;
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");
51
+ if (!o) return !1;
52
+ const u = e(this, d).track.getBoundingClientRect(), h = e(this, d).thumb.clientWidth;
53
+ 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, e(this, d).right.disabled = a >= g;
57
+ const n = r.clientWidth, f = o.scrollWidth;
58
+ let s = -a * (f - n) / g;
59
+ 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) => {
60
+ c.style.left = `${s}px`;
61
+ }), a > 0 && a < g;
60
62
  }, "#thumbMoveTo"));
61
- y(this, z, /* @__PURE__ */ b(() => {
62
- const t = /* @__PURE__ */ b((r) => {
63
- clearInterval(e(this, L)), clearInterval(e(this, R));
64
- const d = e(this, c).track.getBoundingClientRect(), h = e(this, c).thumb.getBoundingClientRect();
65
- e(this, A).call(this, h.x - d.x + r), S(this, L, setInterval(() => {
66
- clearInterval(e(this, L)), S(this, R, setInterval(() => {
67
- const s = e(this, c).track.getBoundingClientRect(), g = e(this, c).thumb.getBoundingClientRect();
68
- e(this, A).call(this, g.x - s.x + r) || clearInterval(e(this, R));
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));
69
71
  }, 10));
70
72
  }, 500));
71
- }, "delayScroll"), o = /* @__PURE__ */ b(() => {
72
- clearInterval(e(this, L)), clearInterval(e(this, R));
73
+ }, "delayScroll"), r = /* @__PURE__ */ b(() => {
74
+ clearInterval(e(this, C)), clearInterval(e(this, A));
73
75
  }, "clearTimer");
74
- e(this, c).left.onmouseup = e(this, c).left.onmouseleave = e(this, c).right.onmouseup = e(this, c).right.onmouseleave = e(this, c).track.onmouseup = e(this, c).track.onmouseleave = o, $(e(this, c).left).on("mousedown", (r) => {
75
- r.buttons == 1 && t(-10);
76
- }), $(e(this, c).right).on("mousedown", (r) => {
77
- r.buttons == 1 && t(10);
78
- }), $(e(this, c).track).on("mousedown", (r) => {
79
- if (r.buttons != 1) return;
80
- r.preventDefault();
81
- const d = e(this, c).track.getBoundingClientRect(), h = e(this, c).thumb.getBoundingClientRect().width;
82
- e(this, A).call(this, r.clientX - d.left - h / 2);
83
- }), $(e(this, c).thumb).on("mousedown", (r) => {
84
- if (r.buttons != 1) return;
85
- r.stopPropagation(), r.preventDefault(), S(this, B, !0), this.shiftX = r.clientX - e(this, c).thumb.getBoundingClientRect().left;
86
- const d = /* @__PURE__ */ b((s) => {
87
- if (!e(this, B)) return;
88
- const g = e(this, c).track.getBoundingClientRect();
89
- e(this, A).call(this, s.clientX - g.left - this.shiftX);
76
+ ["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) => {
79
+ o.button === 0 && t(-10);
80
+ }), e(this, d).right.addEventListener("mousedown", (o) => {
81
+ 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) => {
83
+ if (o.button !== 0) return;
84
+ 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) => {
88
+ if (o.button !== 0) return;
89
+ o.stopPropagation(), o.preventDefault(), S(this, $, !0), this.shiftX = o.clientX - e(this, d).thumb.getBoundingClientRect().left;
90
+ const u = /* @__PURE__ */ b((a) => {
91
+ if (!e(this, $)) return;
92
+ const g = e(this, d).track.getBoundingClientRect();
93
+ e(this, R).call(this, a.clientX - g.left - this.shiftX);
90
94
  }, "onMouseMove"), h = /* @__PURE__ */ b(() => {
91
- S(this, B, !1), o(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", h), this.refresh();
95
+ S(this, $, !1), r(), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", h), this.refresh();
92
96
  }, "onMouseUp");
93
- document.addEventListener("mousemove", d), document.addEventListener("mouseup", h);
97
+ document.addEventListener("mousemove", u), document.addEventListener("mouseup", h);
94
98
  });
95
99
  }, "#init"));
96
100
  }
97
101
  connectedCallback() {
98
- S(this, E, this.getRootNode().host), e(this, E) && (this.innerHTML = `
102
+ S(this, q, this.getRootNode().host), e(this, q) && (this.innerHTML = `
99
103
  <style>
100
104
  nine-table-hscrollbar {
101
105
  display: flex;
@@ -156,104 +160,104 @@ const J = class J extends HTMLElement {
156
160
  </style>
157
161
  <button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
158
162
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
159
- <button class='ng-scroll-right'><div class='ng-scroll-icon'></div></button>
163
+ <button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
160
164
  `, requestAnimationFrame(() => {
161
- const t = e(this, E).querySelector(".ng-container-body");
162
- t && (S(this, c, {
165
+ const t = e(this, q).querySelector(".ng-container-body");
166
+ t && (S(this, d, {
163
167
  container: t,
164
168
  track: this.querySelector(".ng-scroll-track"),
165
169
  thumb: this.querySelector(".ng-scroll-thumb"),
166
170
  left: this.querySelector(".ng-scroll-left"),
167
171
  right: this.querySelector(".ng-scroll-right")
168
- }), e(this, z).call(this), this.refresh());
172
+ }), e(this, W).call(this), this.refresh());
169
173
  }));
170
174
  }
171
175
  };
172
- E = new WeakMap(), B = new WeakMap(), c = new WeakMap(), L = new WeakMap(), R = new WeakMap(), A = new WeakMap(), z = new WeakMap(), b(J, "NineTableHScrollBar");
173
- let P = J;
174
- customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", P);
175
- var q, N;
176
+ q = new WeakMap(), $ = 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;
176
180
  const T = class T extends HTMLElement {
177
181
  constructor() {
178
182
  super();
179
- y(this, q, null);
180
- C(this, "init", /* @__PURE__ */ b((t) => {
183
+ y(this, E, null);
184
+ L(this, "init", /* @__PURE__ */ b((t) => {
181
185
  if (!t) return;
182
- const o = /* @__PURE__ */ b((n) => {
183
- const l = /* @__PURE__ */ b((f) => {
184
- if (f.querySelector("colgroup")) return;
185
- const u = f.querySelector("tbody tr") || f.querySelector("tr"), x = u ? u.querySelectorAll("th, td").length : 1, m = document.createElement("colgroup"), w = Math.max(Math.floor((f.clientWidth || 600) / x), 100);
186
+ const r = /* @__PURE__ */ b((n) => {
187
+ const f = /* @__PURE__ */ b((l) => {
188
+ if (l.querySelector("colgroup")) return;
189
+ const c = l.querySelector("tbody tr") || l.querySelector("tr"), x = c ? c.querySelectorAll("th, td").length : 1, m = document.createElement("colgroup"), w = Math.max(Math.floor((l.clientWidth || 600) / x), 100);
186
190
  for (let v = 0; v < x; v++) {
187
- const F = document.createElement("col");
188
- F.setAttribute("width", w), m.appendChild(F);
191
+ const O = document.createElement("col");
192
+ O.setAttribute("width", w), m.appendChild(O);
189
193
  }
190
- f.prepend(m);
191
- }, "ensureColgroup"), a = /* @__PURE__ */ b((f) => {
192
- if (f.querySelector("thead")) return;
193
- const u = document.createElement("thead"), x = f.querySelector("colgroup");
194
- x ? x.after(u) : f.prepend(u);
194
+ l.prepend(m);
195
+ }, "ensureColgroup"), s = /* @__PURE__ */ b((l) => {
196
+ if (l.querySelector("thead")) return;
197
+ const c = document.createElement("thead"), x = l.querySelector("colgroup");
198
+ x ? x.after(c) : l.prepend(c);
195
199
  }, "ensureThead");
196
- return l(n), a(n), n.classList.add("nine-table-element"), n;
197
- }, "initializeTable"), r = t.cloneNode(!0);
198
- S(this, q, o(r)), e(this, q).style.display = "table";
199
- const d = this.querySelector(".ng-container-left"), h = this.querySelector(".ng-container-body"), s = this.querySelector(".ng-container-right"), g = /* @__PURE__ */ b((n, l, a = !1) => {
200
- const f = n.cloneNode(!0), u = Array.from(f.querySelectorAll("colgroup col")), x = [];
201
- return u.forEach((m, w) => {
200
+ return f(n), s(n), n.classList.add("nine-table-element"), n;
201
+ }, "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, s = !1) => {
204
+ const l = n.cloneNode(!0), c = Array.from(l.querySelectorAll("colgroup col")), x = [];
205
+ return c.forEach((m, w) => {
202
206
  const v = m.getAttribute("fixed");
203
- (a ? !v || v === "" : v === l) || x.push(w);
207
+ (s ? !v || v === "" : v === f) || x.push(w);
204
208
  }), x.reverse().forEach((m) => {
205
- u[m] && u[m].remove(), f.querySelectorAll("tr").forEach((w) => {
209
+ c[m] && c[m].remove(), l.querySelectorAll("tr").forEach((w) => {
206
210
  const v = w.querySelectorAll("th, td");
207
211
  v[m] && v[m].remove();
208
212
  });
209
- }), f;
213
+ }), l;
210
214
  }, "filterTableByFixed");
211
215
  if (h) {
212
- const n = g(e(this, q), null, !0);
216
+ const n = g(e(this, E), null, !0);
213
217
  h.innerHTML = "", h.appendChild(n);
214
218
  }
215
- if (d) {
216
- const n = g(e(this, q), "left", !1);
217
- let l = 0;
218
- n.querySelectorAll("col").forEach((f) => {
219
- const u = parseInt(f.getAttribute("width"), 10);
220
- isNaN(u) || (l += u);
221
- }), d.innerHTML = "", d.appendChild(n);
222
- const a = l > 0 ? l : 0;
223
- d.style.flex = `0 0 ${a}px`, d.style.width = `${a}px`;
219
+ if (u) {
220
+ const n = g(e(this, E), "left", !1);
221
+ let f = 0;
222
+ n.querySelectorAll("col").forEach((l) => {
223
+ const c = parseInt(l.getAttribute("width"), 10);
224
+ isNaN(c) || (f += c);
225
+ }), u.innerHTML = "", u.appendChild(n);
226
+ const s = f > 0 ? f : 0;
227
+ u.style.flex = `0 0 ${s}px`, u.style.width = `${s}px`;
224
228
  }
225
- if (s) {
226
- const n = g(e(this, q), "right", !1);
227
- let l = 0;
228
- n.querySelectorAll("col").forEach((f) => {
229
- const u = parseInt(f.getAttribute("width"), 10);
230
- isNaN(u) || (l += u);
231
- }), s.innerHTML = "", s.appendChild(n);
232
- const a = l > 0 ? l : 0;
233
- s.style.flex = `0 0 ${a}px`, s.style.width = `${a}px`;
229
+ if (a) {
230
+ const n = g(e(this, E), "right", !1);
231
+ let f = 0;
232
+ n.querySelectorAll("col").forEach((l) => {
233
+ const c = parseInt(l.getAttribute("width"), 10);
234
+ isNaN(c) || (f += c);
235
+ }), a.innerHTML = "", a.appendChild(n);
236
+ const s = f > 0 ? f : 0;
237
+ a.style.flex = `0 0 ${s}px`, a.style.width = `${s}px`;
234
238
  }
235
239
  if (h) {
236
240
  const n = this.getRowCount();
237
241
  h.style.overflowY = n > 10 ? "auto" : "hidden", h.addEventListener("scroll", () => {
238
- const l = this.querySelector("nine-table-hscrollbar");
239
- l && typeof l.refresh == "function" && l.refresh();
242
+ const f = this.querySelector("nine-table-hscrollbar");
243
+ f && typeof f.refresh == "function" && f.refresh();
240
244
  });
241
245
  }
242
246
  setTimeout(() => {
243
247
  const n = this.querySelector("nine-table-hscrollbar");
244
248
  n && typeof n.refresh == "function" && n.refresh();
245
- }, 0), W.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
249
+ }, 0), H.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
246
250
  }, "init"));
247
- C(this, "getRowCount", /* @__PURE__ */ b(() => e(this, q) ? e(this, q).querySelectorAll("tbody tr").length : 0, "getRowCount"));
248
- C(this, "scrollToX", /* @__PURE__ */ b((t) => {
249
- const o = this.querySelector(".ng-container-body");
250
- o && (o.scrollLeft = t);
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) => {
253
+ const r = this.querySelector(".ng-container-body");
254
+ r && (r.scrollLeft = t);
251
255
  }, "scrollToX"));
252
- C(this, "scrollToY", /* @__PURE__ */ b((t) => {
253
- const o = this.querySelector(".ng-container-body");
254
- o && (o.scrollTop = t);
256
+ L(this, "scrollToY", /* @__PURE__ */ b((t) => {
257
+ const r = this.querySelector(".ng-container-body");
258
+ r && (r.scrollTop = t);
255
259
  }, "scrollToY"));
256
- y(this, N, /* @__PURE__ */ b(() => {
260
+ y(this, z, /* @__PURE__ */ b(() => {
257
261
  const t = T.SCROLLBAR_SIZE;
258
262
  this.innerHTML = `
259
263
  <style>
@@ -371,87 +375,87 @@ const T = class T extends HTMLElement {
371
375
  }, "#render"));
372
376
  }
373
377
  connectedCallback() {
374
- e(this, N).call(this);
378
+ e(this, z).call(this);
375
379
  }
376
380
  disconnectedCallback() {
377
- this.innerHTML = "", W.log("NineTableSheet destroyed.");
381
+ this.innerHTML = "", H.log("NineTableSheet destroyed.");
378
382
  }
379
383
  };
380
- q = new WeakMap(), N = new WeakMap(), b(T, "NineTableSheet"), C(T, "SCROLLBAR_SIZE", 16);
381
- let Y = T;
382
- customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", Y);
383
- var X;
384
- const Q = class Q extends HTMLElement {
384
+ E = new WeakMap(), z = new WeakMap(), b(T, "NineTableSheet"), L(T, "SCROLLBAR_SIZE", 16);
385
+ let P = T;
386
+ customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", P);
387
+ var N;
388
+ const J = class J extends HTMLElement {
385
389
  constructor() {
386
390
  super();
387
- y(this, X, /* @__PURE__ */ b(() => {
391
+ y(this, N, /* @__PURE__ */ b(() => {
388
392
  const t = this.querySelector(".nine-tab-bar");
389
- t && (t.addEventListener("click", (o) => {
390
- const r = o.target.closest(".nine-tab-item");
391
- if (!r) return;
392
- const d = o.ctrlKey || o.metaKey || o.shiftKey, h = parseInt(r.dataset.index, 10);
393
- this.switchSheet(h, d);
393
+ t && (t.addEventListener("click", (r) => {
394
+ const o = r.target.closest(".nine-tab-item");
395
+ if (!o) return;
396
+ const u = r.ctrlKey || r.metaKey || r.shiftKey, h = parseInt(o.dataset.index, 10);
397
+ this.switchSheet(h, u);
394
398
  }), this.switchSheet(0, !1));
395
399
  }, "#init"));
396
- C(this, "switchSheet", /* @__PURE__ */ b((t, o = !1) => {
397
- const r = /* @__PURE__ */ b(() => {
398
- const a = this.querySelector("nine-table-sheets-body");
399
- a.querySelectorAll("nine-splitter").forEach((u) => {
400
- const x = parseInt(u.dataset.splitIndex, 10), m = a.querySelector(`nine-table-sheet[data-index="${x - 1}"]`), w = a.querySelector(`nine-table-sheet[data-index="${x}"]`);
401
- m && w && m.classList.contains("active") && w.classList.contains("active") ? u.classList.add("active") : u.classList.remove("active");
400
+ L(this, "switchSheet", /* @__PURE__ */ b((t, r = !1) => {
401
+ const o = /* @__PURE__ */ b(() => {
402
+ const s = this.querySelector("nine-table-sheets-body");
403
+ s.querySelectorAll("nine-splitter").forEach((c) => {
404
+ const x = parseInt(c.dataset.splitIndex, 10), m = s.querySelector(`nine-table-sheet[data-index="${x - 1}"]`), w = s.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");
402
406
  });
403
- }, "updateSplitters"), d = this.querySelector(".nine-tab-bar"), h = this.querySelector("nine-table-sheets-body"), s = d.querySelectorAll(".nine-tab-item"), g = h.querySelectorAll("nine-table-sheet");
404
- if (!s[t]) return;
405
- if (!o)
406
- s.forEach((a, f) => {
407
- a.classList.toggle("active", f === t);
408
- const u = h.querySelector(`nine-table-sheet[data-index="${f}"]`);
409
- u && (u.style.flex = "");
410
- }), g.forEach((a, f) => {
411
- a.classList.toggle("active", f === t);
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");
408
+ if (!a[t]) return;
409
+ if (!r)
410
+ a.forEach((s, l) => {
411
+ s.classList.toggle("active", l === t);
412
+ const c = h.querySelector(`nine-table-sheet[data-index="${l}"]`);
413
+ c && (c.style.flex = "");
414
+ }), g.forEach((s, l) => {
415
+ s.classList.toggle("active", l === t);
412
416
  });
413
417
  else {
414
- const a = s[t], f = d.querySelectorAll(".nine-tab-item.active");
415
- if (a.classList.contains("active") && f.length <= 1)
418
+ const s = a[t], l = u.querySelectorAll(".nine-tab-item.active");
419
+ if (s.classList.contains("active") && l.length <= 1)
416
420
  return;
417
- a.classList.toggle("active");
418
- const u = h.querySelector(`nine-table-sheet[data-index="${t}"]`);
419
- u && (u.classList.toggle("active"), u.classList.contains("active") || (u.style.flex = ""));
421
+ s.classList.toggle("active");
422
+ const c = h.querySelector(`nine-table-sheet[data-index="${t}"]`);
423
+ c && (c.classList.toggle("active"), c.classList.contains("active") || (c.style.flex = ""));
420
424
  }
421
425
  const n = Array.from(h.querySelectorAll("nine-table-sheet.active"));
422
426
  if (n.length > 1) {
423
- const a = 1 / n.length;
424
- n.forEach((f) => {
425
- (!f.style.flex || f.style.flex === "1 1 100%") && (f.style.flex = `${a} ${a} 0px`);
427
+ const s = 1 / n.length;
428
+ n.forEach((l) => {
429
+ (!l.style.flex || l.style.flex === "1 1 100%") && (l.style.flex = `${s} ${s} 0px`);
426
430
  });
427
431
  } else
428
- n.forEach((a) => {
429
- a.style.flex = "1 1 100%";
432
+ n.forEach((s) => {
433
+ s.style.flex = "1 1 100%";
430
434
  });
431
- r();
432
- const l = h.querySelector("nine-table-sheet.active");
433
- if (l && typeof l.getRowCount == "function") {
434
- const a = this.querySelector("#row-count");
435
- a && (a.textContent = l.getRowCount().toLocaleString());
435
+ o();
436
+ const f = h.querySelector("nine-table-sheet.active");
437
+ if (f && typeof f.getRowCount == "function") {
438
+ const s = this.querySelector("#row-count");
439
+ s && (s.textContent = f.getRowCount().toLocaleString());
436
440
  }
437
441
  }, "switchSheet"));
438
442
  }
439
443
  connectedCallback() {
440
- e(this, X).call(this);
444
+ e(this, N).call(this);
441
445
  }
442
446
  };
443
- X = new WeakMap(), b(Q, "NineTableSheets");
444
- let D = Q;
445
- customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", D);
446
- var k, I, j, M, O;
447
- const V = class V {
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, I, X, M, j;
451
+ const Q = class Q {
448
452
  constructor(i) {
449
453
  y(this, k);
450
454
  y(this, I, null);
451
- y(this, j, /* @__PURE__ */ b(() => {
455
+ y(this, X, /* @__PURE__ */ b(() => {
452
456
  const i = e(this, k).host;
453
457
  i && (S(this, I, new ResizeObserver((t) => {
454
- for (let o of t)
458
+ for (let r of t)
455
459
  i.getAttribute("auto-height") === "true" && e(this, M).call(this, i);
456
460
  })), e(this, I).observe(i));
457
461
  }, "#observeResize"));
@@ -459,13 +463,13 @@ const V = class V {
459
463
  var w, v;
460
464
  const t = (w = i.shadowRoot) == null ? void 0 : w.querySelector("nine-table-sheet.active");
461
465
  if (!t) return;
462
- const o = ((v = t.getRowCount) == null ? void 0 : v.call(t)) || 0, r = parseInt(i.getAttribute("max-display-row"), 10) || 10, d = Math.min(o, r), h = t.querySelector("tbody tr") || t.querySelector("tr"), s = h ? h.getBoundingClientRect().height : 32, g = e(this, k).querySelector("nine-table-header"), n = e(this, k).querySelector("nine-table-sheets-footer"), l = g ? g.getBoundingClientRect().height : 40, a = n ? n.getBoundingClientRect().height : 32, u = l + a + 16, x = d * s + u;
463
- i.style.height = `${x}px`, i.style.maxHeight = `${r * s + u}px`;
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, s = n ? n.getBoundingClientRect().height : 32, c = f + s + 16, x = u * a + c;
467
+ i.style.height = `${x}px`, i.style.maxHeight = `${o * a + c}px`;
464
468
  const m = e(this, k).querySelector("nine-table-sheets-body");
465
- m && (m.style.overflowY = o > r ? "auto" : "hidden");
469
+ m && (m.style.overflowY = r > o ? "auto" : "hidden");
466
470
  }, "#applyAutoHeight"));
467
- y(this, O, /* @__PURE__ */ b(() => {
468
- const i = e(this, k).host, o = Array.from(i.children).filter((g) => g.tagName === "TABLE"), r = i.getAttribute("auto-height") === "true", d = o.map((g, n) => `<nine-table-sheet class="${n === 0 ? "active" : ""}" data-index="${n}"></nine-table-sheet>`).join(""), h = o.map((g, n) => `<div class="nine-tab-item ${n === 0 ? "active" : ""}" data-index="${n}">Sheet ${n + 1}</div>`).join("");
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("");
469
473
  e(this, k).innerHTML = `
470
474
  <style>
471
475
  :host {
@@ -473,7 +477,7 @@ const V = class V {
473
477
  flex-direction: column;
474
478
  position: relative;
475
479
  overflow: hidden;
476
- height: ${r ? "auto" : "100%"};
480
+ height: ${o ? "auto" : "100%"};
477
481
  background: #fff;
478
482
  }
479
483
  nine-table-header { height: 40px; display: block; flex-shrink: 0; border-bottom: 1px solid #e5e7eb; background: #fff; }
@@ -554,7 +558,7 @@ const V = class V {
554
558
  <nine-table-body>
555
559
  <nine-table-summary></nine-table-summary>
556
560
  <nine-table-sheets>
557
- <nine-table-sheets-body>${d}</nine-table-sheets-body>
561
+ <nine-table-sheets-body>${u}</nine-table-sheets-body>
558
562
  <nine-table-sheets-footer>
559
563
  <div class="nine-tab-bar">${h}</div>
560
564
  <div class="sheets-counter">Total : <span id="row-count">0</span></div>
@@ -564,33 +568,33 @@ const V = class V {
564
568
  </nine-table-body>
565
569
  <nine-table-footer></nine-table-footer>
566
570
  `;
567
- const s = e(this, k).querySelectorAll("nine-table-sheet");
568
- s == null || s.forEach((g, n) => {
569
- o[n] && setTimeout(() => {
570
- g.init(o[n]), r && e(this, M).call(this, i);
571
+ const a = e(this, k).querySelectorAll("nine-table-sheet");
572
+ a == null || a.forEach((g, n) => {
573
+ r[n] && setTimeout(() => {
574
+ g.init(r[n]), o && e(this, M).call(this, i);
571
575
  });
572
576
  });
573
577
  }, "#render"));
574
- S(this, k, i), e(this, O).call(this), e(this, j).call(this);
578
+ S(this, k, i), e(this, j).call(this), e(this, X).call(this);
575
579
  }
576
580
  };
577
- k = new WeakMap(), I = new WeakMap(), j = new WeakMap(), M = new WeakMap(), O = new WeakMap(), b(V, "LayoutManager");
578
- let Z = V;
579
- var H;
580
- const _ = class _ extends HTMLElement {
581
+ k = new WeakMap(), I = new WeakMap(), X = new WeakMap(), M = new WeakMap(), j = new WeakMap(), b(Q, "LayoutManager");
582
+ let D = Q;
583
+ var B;
584
+ const V = class V extends HTMLElement {
581
585
  constructor() {
582
586
  super();
583
- y(this, H, !1);
587
+ y(this, B, !1);
584
588
  this.attachShadow({ mode: "open" });
585
589
  }
586
590
  connectedCallback() {
587
- e(this, H) || (this.layoutManager = new Z(this.shadowRoot), S(this, H, !0), W.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } })));
591
+ e(this, B) || (this.layoutManager = new D(this.shadowRoot), S(this, B, !0), H.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } })));
588
592
  }
589
593
  disconnectedCallback() {
590
- W.log("NineTable disconnected.");
594
+ H.log("NineTable disconnected.");
591
595
  }
592
596
  };
593
- H = new WeakMap(), b(_, "NineTable");
594
- let U = _;
595
- customElements.get("nine-table") || customElements.define("nine-table", U);
597
+ B = new WeakMap(), b(V, "NineTable");
598
+ let Z = V;
599
+ customElements.get("nine-table") || customElements.define("nine-table", Z);
596
600
  //# sourceMappingURL=nine-table.js.map