@ninebone/table 0.0.81 → 0.0.82

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