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