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