@ninebone/table 0.0.70 โ 0.0.72
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 +228 -228
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +10 -10
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -15,211 +15,7 @@ const vt = class vt extends Rt.constructor {
|
|
|
15
15
|
l(vt, "Trace");
|
|
16
16
|
let dt = vt;
|
|
17
17
|
const J = new dt();
|
|
18
|
-
var
|
|
19
|
-
const X = class X extends HTMLElement {
|
|
20
|
-
constructor() {
|
|
21
|
-
super();
|
|
22
|
-
h(this, Y, null);
|
|
23
|
-
I(this, "init", /* @__PURE__ */ l((e) => {
|
|
24
|
-
if (!e) return;
|
|
25
|
-
const s = /* @__PURE__ */ l((a) => {
|
|
26
|
-
const p = /* @__PURE__ */ l((d) => {
|
|
27
|
-
if (d.querySelector("colgroup")) return;
|
|
28
|
-
const m = d.querySelector("tbody tr") || d.querySelector("tr"), q = m ? m.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), E = Math.max(Math.floor((d.clientWidth || 600) / q), 100);
|
|
29
|
-
for (let H = 0; H < q; H++) {
|
|
30
|
-
const ut = document.createElement("col");
|
|
31
|
-
ut.setAttribute("width", E), x.appendChild(ut);
|
|
32
|
-
}
|
|
33
|
-
d.prepend(x);
|
|
34
|
-
}, "ensureColgroup"), r = /* @__PURE__ */ l((d) => {
|
|
35
|
-
if (d.querySelector("thead")) return;
|
|
36
|
-
const m = document.createElement("thead"), q = d.querySelector("colgroup");
|
|
37
|
-
q ? q.after(m) : d.prepend(m);
|
|
38
|
-
}, "ensureThead");
|
|
39
|
-
return p(a), r(a), a.classList.add("nine-table-element"), a;
|
|
40
|
-
}, "initializeTable"), o = e.cloneNode(!0);
|
|
41
|
-
g(this, Y, s(o)), t(this, Y).style.display = "table";
|
|
42
|
-
const n = this.querySelector(".ng-container-left"), i = this.querySelector(".ng-container-body"), u = this.querySelector(".ng-container-right"), y = /* @__PURE__ */ l((a, p, r = !1) => {
|
|
43
|
-
const d = a.cloneNode(!0), m = Array.from(d.querySelectorAll("colgroup col")), q = [];
|
|
44
|
-
return m.forEach((x, E) => {
|
|
45
|
-
const H = x.getAttribute("fixed");
|
|
46
|
-
(r ? !H || H === "" : H === p) || q.push(E);
|
|
47
|
-
}), q.reverse().forEach((x) => {
|
|
48
|
-
m[x] && m[x].remove(), d.querySelectorAll("tr").forEach((E) => {
|
|
49
|
-
const H = E.querySelectorAll("th, td");
|
|
50
|
-
H[x] && H[x].remove();
|
|
51
|
-
});
|
|
52
|
-
}), d;
|
|
53
|
-
}, "filterTableByFixed");
|
|
54
|
-
if (i) {
|
|
55
|
-
const a = y(t(this, Y), null, !0);
|
|
56
|
-
i.innerHTML = "", i.appendChild(a);
|
|
57
|
-
}
|
|
58
|
-
if (n) {
|
|
59
|
-
const a = y(t(this, Y), "left", !1);
|
|
60
|
-
let p = 0;
|
|
61
|
-
a.querySelectorAll("col").forEach((d) => {
|
|
62
|
-
const m = parseInt(d.getAttribute("width"), 10);
|
|
63
|
-
isNaN(m) || (p += m);
|
|
64
|
-
}), n.innerHTML = "", n.appendChild(a);
|
|
65
|
-
const r = p > 0 ? p : 0;
|
|
66
|
-
n.style.flex = `0 0 ${r}px`, n.style.width = `${r}px`;
|
|
67
|
-
}
|
|
68
|
-
if (u) {
|
|
69
|
-
const a = y(t(this, Y), "right", !1);
|
|
70
|
-
let p = 0;
|
|
71
|
-
a.querySelectorAll("col").forEach((d) => {
|
|
72
|
-
const m = parseInt(d.getAttribute("width"), 10);
|
|
73
|
-
isNaN(m) || (p += m);
|
|
74
|
-
}), u.innerHTML = "", u.appendChild(a);
|
|
75
|
-
const r = p > 0 ? p : 0;
|
|
76
|
-
u.style.flex = `0 0 ${r}px`, u.style.width = `${r}px`;
|
|
77
|
-
}
|
|
78
|
-
if (i) {
|
|
79
|
-
const a = this.getRowCount();
|
|
80
|
-
i.style.overflowY = a > 10 ? "auto" : "hidden", i.addEventListener("scroll", () => {
|
|
81
|
-
const p = i.scrollLeft, r = this.querySelector("nine-table-hscrollbar");
|
|
82
|
-
r && typeof r.syncThumb == "function" && r.syncThumb(p);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
J.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
86
|
-
}, "init"));
|
|
87
|
-
I(this, "getRowCount", /* @__PURE__ */ l(() => t(this, Y) ? t(this, Y).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
88
|
-
// ๐ฏ ์ธ๋ถ ์คํฌ๋กค๋ฐ ๋ฐ ์ปจํธ๋กค๋ฌ ์ฐ๋์ฉ ๋ฉ์๋
|
|
89
|
-
I(this, "scrollToX", /* @__PURE__ */ l((e) => {
|
|
90
|
-
const s = this.querySelector(".ng-container-body");
|
|
91
|
-
s && (s.scrollLeft = e);
|
|
92
|
-
}, "scrollToX"));
|
|
93
|
-
I(this, "scrollToY", /* @__PURE__ */ l((e) => {
|
|
94
|
-
const s = this.querySelector(".ng-container-body");
|
|
95
|
-
s && (s.scrollTop = e);
|
|
96
|
-
}, "scrollToY"));
|
|
97
|
-
h(this, Q, /* @__PURE__ */ l(() => {
|
|
98
|
-
const e = X.SCROLLBAR_SIZE;
|
|
99
|
-
this.innerHTML = `
|
|
100
|
-
<style>
|
|
101
|
-
nine-table-sheet {
|
|
102
|
-
display: flex;
|
|
103
|
-
flex-direction: column;
|
|
104
|
-
width: 100%;
|
|
105
|
-
height: 100%;
|
|
106
|
-
position: relative;
|
|
107
|
-
box-sizing: border-box;
|
|
108
|
-
background: #ffffff;
|
|
109
|
-
overflow: hidden;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
nine-table-sheet .ng-container-top {
|
|
113
|
-
display: flex;
|
|
114
|
-
flex-direction: row;
|
|
115
|
-
flex: 1 1 auto;
|
|
116
|
-
width: 100%;
|
|
117
|
-
height: calc(100% - ${e}px);
|
|
118
|
-
overflow: hidden;
|
|
119
|
-
position: relative;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
nine-table-sheet .ng-container-left {
|
|
123
|
-
display: flex;
|
|
124
|
-
flex-direction: column;
|
|
125
|
-
overflow: hidden;
|
|
126
|
-
background: #ffffff;
|
|
127
|
-
border-right: 1px solid #e5e7eb;
|
|
128
|
-
flex-shrink: 0;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
nine-table-sheet .ng-container-body {
|
|
132
|
-
display: flex;
|
|
133
|
-
flex-direction: column;
|
|
134
|
-
flex: 1;
|
|
135
|
-
overflow-x: auto;
|
|
136
|
-
overflow-y: auto;
|
|
137
|
-
background: #ffffff;
|
|
138
|
-
position: relative;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
nine-table-sheet .ng-container-right {
|
|
142
|
-
display: flex;
|
|
143
|
-
flex-direction: column;
|
|
144
|
-
overflow: hidden;
|
|
145
|
-
background: #ffffff;
|
|
146
|
-
border-left: 1px solid #e5e7eb;
|
|
147
|
-
flex-shrink: 0;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
nine-table-sheet .ng-container-bottom {
|
|
151
|
-
display: flex;
|
|
152
|
-
flex-direction: row;
|
|
153
|
-
height: ${e}px;
|
|
154
|
-
min-height: ${e}px;
|
|
155
|
-
flex-shrink: 0;
|
|
156
|
-
background: #f9fafb;
|
|
157
|
-
border-top: 1px solid #e5e7eb;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
nine-table-sheet nine-table-hscrollbar {
|
|
161
|
-
flex: 1;
|
|
162
|
-
height: 100%;
|
|
163
|
-
overflow: hidden;
|
|
164
|
-
display: block;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
nine-table-sheet .ng-scroll-edge {
|
|
168
|
-
width: ${e}px;
|
|
169
|
-
min-width: ${e}px;
|
|
170
|
-
height: 100%;
|
|
171
|
-
flex-shrink: 0;
|
|
172
|
-
background: #f3f4f6;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
nine-table-sheet table {
|
|
176
|
-
border-collapse: collapse;
|
|
177
|
-
width: 100%;
|
|
178
|
-
table-layout: fixed;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
nine-table-sheet th, nine-table-sheet td {
|
|
182
|
-
box-sizing: border-box;
|
|
183
|
-
overflow: hidden;
|
|
184
|
-
white-space: nowrap;
|
|
185
|
-
text-overflow: ellipsis;
|
|
186
|
-
padding: 6px 8px;
|
|
187
|
-
border: 1px solid #e5e7eb;
|
|
188
|
-
font-size: 12px;
|
|
189
|
-
color: #111827;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
nine-table-sheet th {
|
|
193
|
-
background-color: #f9fafb;
|
|
194
|
-
font-weight: 600;
|
|
195
|
-
text-align: left;
|
|
196
|
-
}
|
|
197
|
-
</style>
|
|
198
|
-
|
|
199
|
-
<div class='ng-container-top'>
|
|
200
|
-
<div class='ng-container-left'></div>
|
|
201
|
-
<div class='ng-container-body'></div>
|
|
202
|
-
<div class='ng-container-right'></div>
|
|
203
|
-
<nine-table-vscrollbar></nine-table-vscrollbar>
|
|
204
|
-
</div>
|
|
205
|
-
<div class='ng-container-bottom'>
|
|
206
|
-
<nine-table-hscrollbar></nine-table-hscrollbar>
|
|
207
|
-
<div class='ng-scroll-edge'></div>
|
|
208
|
-
</div>
|
|
209
|
-
`;
|
|
210
|
-
}, "#render"));
|
|
211
|
-
}
|
|
212
|
-
connectedCallback() {
|
|
213
|
-
t(this, Q).call(this);
|
|
214
|
-
}
|
|
215
|
-
disconnectedCallback() {
|
|
216
|
-
this.innerHTML = "", J.log("NineTableSheet destroyed.");
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
Y = new WeakMap(), Q = new WeakMap(), l(X, "NineTableSheet"), I(X, "SCROLLBAR_SIZE", 16);
|
|
220
|
-
let bt = X;
|
|
221
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", bt);
|
|
222
|
-
var w, M, b, S, R, U, V, tt, et, z, ot, D, _, B, N;
|
|
18
|
+
var w, M, b, S, R, Q, U, V, tt, z, et, D, _, B, N;
|
|
223
19
|
const xt = class xt extends HTMLElement {
|
|
224
20
|
constructor() {
|
|
225
21
|
super();
|
|
@@ -228,8 +24,8 @@ const xt = class xt extends HTMLElement {
|
|
|
228
24
|
h(this, b);
|
|
229
25
|
h(this, S);
|
|
230
26
|
h(this, R);
|
|
231
|
-
h(this,
|
|
232
|
-
h(this,
|
|
27
|
+
h(this, Q);
|
|
28
|
+
h(this, U, 0);
|
|
233
29
|
I(this, "refresh", /* @__PURE__ */ l(() => {
|
|
234
30
|
if (!t(this, w)) return;
|
|
235
31
|
const e = t(this, w).querySelector(".ng-container-body");
|
|
@@ -262,7 +58,7 @@ const xt = class xt extends HTMLElement {
|
|
|
262
58
|
I(this, "stopScroll", /* @__PURE__ */ l(() => {
|
|
263
59
|
clearInterval(t(this, S)), clearInterval(t(this, R));
|
|
264
60
|
}, "stopScroll"));
|
|
265
|
-
h(this,
|
|
61
|
+
h(this, V, /* @__PURE__ */ l(() => {
|
|
266
62
|
const e = /* @__PURE__ */ l((o) => {
|
|
267
63
|
clearInterval(t(this, S)), clearInterval(t(this, R));
|
|
268
64
|
const n = t(this, w).querySelector(".ng-container-body");
|
|
@@ -284,13 +80,13 @@ const xt = class xt extends HTMLElement {
|
|
|
284
80
|
const s = /* @__PURE__ */ l(() => {
|
|
285
81
|
clearInterval(t(this, S)), clearInterval(t(this, R));
|
|
286
82
|
}, "clearTimer");
|
|
287
|
-
t(this, b).top.ontouchend = t(this, b).bottom.ontouchend = t(this, b).track.ontouchend = t(this, b).top.onmouseup = t(this, b).top.onmouseleave = t(this, b).bottom.onmouseup = t(this, b).bottom.onmouseleave = t(this, b).track.onmouseup = t(this, b).track.onmouseleave = s, $(t(this, b).track).on("mousedown", t(this, z)), $(t(this, b).track).on("touchstart", t(this,
|
|
83
|
+
t(this, b).top.ontouchend = t(this, b).bottom.ontouchend = t(this, b).track.ontouchend = t(this, b).top.onmouseup = t(this, b).top.onmouseleave = t(this, b).bottom.onmouseup = t(this, b).bottom.onmouseleave = t(this, b).track.onmouseup = t(this, b).track.onmouseleave = s, $(t(this, b).track).on("mousedown", t(this, z)), $(t(this, b).track).on("touchstart", t(this, tt)), $(t(this, b).thumb).on("mousedown", t(this, _)), $(t(this, b).thumb).on("touchstart", t(this, et)), document.addEventListener("mouseup", (o) => {
|
|
288
84
|
t(this, M) && g(this, M, !1), document.removeEventListener("mousemove", t(this, B));
|
|
289
85
|
}), document.addEventListener("touchend", (o) => {
|
|
290
86
|
g(this, M, !1), document.removeEventListener("touchmove", t(this, D));
|
|
291
87
|
});
|
|
292
88
|
}, "#init"));
|
|
293
|
-
h(this,
|
|
89
|
+
h(this, tt, /* @__PURE__ */ l((e) => {
|
|
294
90
|
e.target.getBoundingClientRect(), e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, z).call(this, e);
|
|
295
91
|
}, "#track_onTouchStart"));
|
|
296
92
|
h(this, z, /* @__PURE__ */ l((e) => {
|
|
@@ -307,14 +103,14 @@ const xt = class xt extends HTMLElement {
|
|
|
307
103
|
}, 10));
|
|
308
104
|
}, 500));
|
|
309
105
|
}, "#track_onMouseDown"));
|
|
310
|
-
h(this,
|
|
106
|
+
h(this, et, /* @__PURE__ */ l((e) => {
|
|
311
107
|
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, _).call(this, e), document.addEventListener("touchmove", t(this, D));
|
|
312
108
|
}, "#thumb_onTouchStart"));
|
|
313
109
|
h(this, D, /* @__PURE__ */ l((e) => {
|
|
314
110
|
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, B).call(this, e);
|
|
315
111
|
}, "#thumb_onTouchMove"));
|
|
316
112
|
h(this, _, /* @__PURE__ */ l((e) => {
|
|
317
|
-
g(this,
|
|
113
|
+
g(this, U, e.clientY), g(this, M, !0), this.shiftY = e.offsetY + t(this, b).track.getBoundingClientRect().y, this.trackHeight = $(t(this, b).track).height(), this.thumbHeight = $(t(this, b).thumb).height(), g(this, Q, !0), document.addEventListener("mousemove", t(this, B));
|
|
318
114
|
}, "#thumb_onMouseDown"));
|
|
319
115
|
h(this, B, /* @__PURE__ */ l((e) => {
|
|
320
116
|
if (!t(this, M)) return;
|
|
@@ -340,13 +136,13 @@ const xt = class xt extends HTMLElement {
|
|
|
340
136
|
thumb: this.shadowRoot.querySelector(".ng-scroll-thumb"),
|
|
341
137
|
top: this.shadowRoot.querySelector(".ng-scroll-top"),
|
|
342
138
|
bottom: this.shadowRoot.querySelector(".ng-scroll-bottom")
|
|
343
|
-
}), t(this,
|
|
139
|
+
}), t(this, V).call(this));
|
|
344
140
|
}
|
|
345
141
|
};
|
|
346
|
-
w = new WeakMap(), M = new WeakMap(), b = new WeakMap(), S = new WeakMap(), R = new WeakMap(),
|
|
347
|
-
let
|
|
348
|
-
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar",
|
|
349
|
-
var T, A, f, k, C, nt, st, it,
|
|
142
|
+
w = new WeakMap(), M = new WeakMap(), b = new WeakMap(), S = new WeakMap(), R = new WeakMap(), Q = new WeakMap(), U = new WeakMap(), V = new WeakMap(), tt = new WeakMap(), z = new WeakMap(), et = new WeakMap(), D = new WeakMap(), _ = new WeakMap(), B = new WeakMap(), N = new WeakMap(), l(xt, "NineTableVScrollBar");
|
|
143
|
+
let bt = xt;
|
|
144
|
+
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", bt);
|
|
145
|
+
var T, A, f, k, C, ot, nt, st, it, W, lt, O, j, K, F;
|
|
350
146
|
const wt = class wt extends HTMLElement {
|
|
351
147
|
constructor() {
|
|
352
148
|
super();
|
|
@@ -355,8 +151,8 @@ const wt = class wt extends HTMLElement {
|
|
|
355
151
|
h(this, f);
|
|
356
152
|
h(this, k);
|
|
357
153
|
h(this, C);
|
|
358
|
-
h(this,
|
|
359
|
-
h(this,
|
|
154
|
+
h(this, ot);
|
|
155
|
+
h(this, nt, 0);
|
|
360
156
|
I(this, "refresh", /* @__PURE__ */ l(() => {
|
|
361
157
|
if (!t(this, T)) return;
|
|
362
158
|
const e = t(this, T).querySelector(".ng-container-body");
|
|
@@ -389,7 +185,7 @@ const wt = class wt extends HTMLElement {
|
|
|
389
185
|
I(this, "stopScroll", /* @__PURE__ */ l(() => {
|
|
390
186
|
clearInterval(t(this, k)), clearInterval(t(this, C));
|
|
391
187
|
}, "stopScroll"));
|
|
392
|
-
h(this,
|
|
188
|
+
h(this, st, /* @__PURE__ */ l(() => {
|
|
393
189
|
const e = /* @__PURE__ */ l((o) => {
|
|
394
190
|
clearInterval(t(this, k)), clearInterval(t(this, C));
|
|
395
191
|
const n = t(this, T).querySelector(".ng-container-body");
|
|
@@ -411,13 +207,13 @@ const wt = class wt extends HTMLElement {
|
|
|
411
207
|
const s = /* @__PURE__ */ l(() => {
|
|
412
208
|
clearInterval(t(this, k)), clearInterval(t(this, C));
|
|
413
209
|
}, "clearTimer");
|
|
414
|
-
t(this, f).top.ontouchend = t(this, f).bottom.ontouchend = t(this, f).track.ontouchend = t(this, f).top.onmouseup = t(this, f).top.onmouseleave = t(this, f).bottom.onmouseup = t(this, f).bottom.onmouseleave = t(this, f).track.onmouseup = t(this, f).track.onmouseleave = s, $(t(this, f).track).on("mousedown", t(this, W)), $(t(this, f).track).on("touchstart", t(this,
|
|
210
|
+
t(this, f).top.ontouchend = t(this, f).bottom.ontouchend = t(this, f).track.ontouchend = t(this, f).top.onmouseup = t(this, f).top.onmouseleave = t(this, f).bottom.onmouseup = t(this, f).bottom.onmouseleave = t(this, f).track.onmouseup = t(this, f).track.onmouseleave = s, $(t(this, f).track).on("mousedown", t(this, W)), $(t(this, f).track).on("touchstart", t(this, it)), $(t(this, f).thumb).on("mousedown", t(this, j)), $(t(this, f).thumb).on("touchstart", t(this, lt)), document.addEventListener("mouseup", (o) => {
|
|
415
211
|
t(this, A) && g(this, A, !1), document.removeEventListener("mousemove", t(this, K));
|
|
416
212
|
}), document.addEventListener("touchend", (o) => {
|
|
417
213
|
g(this, A, !1), document.removeEventListener("touchmove", t(this, O));
|
|
418
214
|
});
|
|
419
215
|
}, "#init"));
|
|
420
|
-
h(this,
|
|
216
|
+
h(this, it, /* @__PURE__ */ l((e) => {
|
|
421
217
|
e.target.getBoundingClientRect(), e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, W).call(this, e);
|
|
422
218
|
}, "#track_onTouchStart"));
|
|
423
219
|
h(this, W, /* @__PURE__ */ l((e) => {
|
|
@@ -434,14 +230,14 @@ const wt = class wt extends HTMLElement {
|
|
|
434
230
|
}, 10));
|
|
435
231
|
}, 500));
|
|
436
232
|
}, "#track_onMouseDown"));
|
|
437
|
-
h(this,
|
|
233
|
+
h(this, lt, /* @__PURE__ */ l((e) => {
|
|
438
234
|
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, j).call(this, e), document.addEventListener("touchmove", t(this, O));
|
|
439
235
|
}, "#thumb_onTouchStart"));
|
|
440
236
|
h(this, O, /* @__PURE__ */ l((e) => {
|
|
441
237
|
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, K).call(this, e);
|
|
442
238
|
}, "#thumb_onTouchMove"));
|
|
443
239
|
h(this, j, /* @__PURE__ */ l((e) => {
|
|
444
|
-
g(this,
|
|
240
|
+
g(this, nt, e.clientY), g(this, A, !0), this.shiftY = e.offsetY + t(this, f).track.getBoundingClientRect().y, this.trackHeight = $(t(this, f).track).height(), this.thumbHeight = $(t(this, f).thumb).height(), g(this, ot, !0), document.addEventListener("mousemove", t(this, K));
|
|
445
241
|
}, "#thumb_onMouseDown"));
|
|
446
242
|
h(this, K, /* @__PURE__ */ l((e) => {
|
|
447
243
|
if (!t(this, A)) return;
|
|
@@ -467,12 +263,216 @@ const wt = class wt extends HTMLElement {
|
|
|
467
263
|
thumb: this.shadowRoot.querySelector(".ng-scroll-thumb"),
|
|
468
264
|
top: this.shadowRoot.querySelector(".ng-scroll-top"),
|
|
469
265
|
bottom: this.shadowRoot.querySelector(".ng-scroll-bottom")
|
|
470
|
-
}), t(this,
|
|
266
|
+
}), t(this, st).call(this));
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
T = new WeakMap(), A = new WeakMap(), f = new WeakMap(), k = new WeakMap(), C = new WeakMap(), ot = new WeakMap(), nt = new WeakMap(), st = new WeakMap(), it = new WeakMap(), W = new WeakMap(), lt = new WeakMap(), O = new WeakMap(), j = new WeakMap(), K = new WeakMap(), F = new WeakMap(), l(wt, "NineTableHScrollBar");
|
|
270
|
+
let ft = wt;
|
|
271
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ft);
|
|
272
|
+
var Y, rt;
|
|
273
|
+
const X = class X extends HTMLElement {
|
|
274
|
+
constructor() {
|
|
275
|
+
super();
|
|
276
|
+
h(this, Y, null);
|
|
277
|
+
I(this, "init", /* @__PURE__ */ l((e) => {
|
|
278
|
+
if (!e) return;
|
|
279
|
+
const s = /* @__PURE__ */ l((a) => {
|
|
280
|
+
const p = /* @__PURE__ */ l((d) => {
|
|
281
|
+
if (d.querySelector("colgroup")) return;
|
|
282
|
+
const m = d.querySelector("tbody tr") || d.querySelector("tr"), q = m ? m.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), E = Math.max(Math.floor((d.clientWidth || 600) / q), 100);
|
|
283
|
+
for (let H = 0; H < q; H++) {
|
|
284
|
+
const ut = document.createElement("col");
|
|
285
|
+
ut.setAttribute("width", E), x.appendChild(ut);
|
|
286
|
+
}
|
|
287
|
+
d.prepend(x);
|
|
288
|
+
}, "ensureColgroup"), r = /* @__PURE__ */ l((d) => {
|
|
289
|
+
if (d.querySelector("thead")) return;
|
|
290
|
+
const m = document.createElement("thead"), q = d.querySelector("colgroup");
|
|
291
|
+
q ? q.after(m) : d.prepend(m);
|
|
292
|
+
}, "ensureThead");
|
|
293
|
+
return p(a), r(a), a.classList.add("nine-table-element"), a;
|
|
294
|
+
}, "initializeTable"), o = e.cloneNode(!0);
|
|
295
|
+
g(this, Y, s(o)), t(this, Y).style.display = "table";
|
|
296
|
+
const n = this.querySelector(".ng-container-left"), i = this.querySelector(".ng-container-body"), u = this.querySelector(".ng-container-right"), y = /* @__PURE__ */ l((a, p, r = !1) => {
|
|
297
|
+
const d = a.cloneNode(!0), m = Array.from(d.querySelectorAll("colgroup col")), q = [];
|
|
298
|
+
return m.forEach((x, E) => {
|
|
299
|
+
const H = x.getAttribute("fixed");
|
|
300
|
+
(r ? !H || H === "" : H === p) || q.push(E);
|
|
301
|
+
}), q.reverse().forEach((x) => {
|
|
302
|
+
m[x] && m[x].remove(), d.querySelectorAll("tr").forEach((E) => {
|
|
303
|
+
const H = E.querySelectorAll("th, td");
|
|
304
|
+
H[x] && H[x].remove();
|
|
305
|
+
});
|
|
306
|
+
}), d;
|
|
307
|
+
}, "filterTableByFixed");
|
|
308
|
+
if (i) {
|
|
309
|
+
const a = y(t(this, Y), null, !0);
|
|
310
|
+
i.innerHTML = "", i.appendChild(a);
|
|
311
|
+
}
|
|
312
|
+
if (n) {
|
|
313
|
+
const a = y(t(this, Y), "left", !1);
|
|
314
|
+
let p = 0;
|
|
315
|
+
a.querySelectorAll("col").forEach((d) => {
|
|
316
|
+
const m = parseInt(d.getAttribute("width"), 10);
|
|
317
|
+
isNaN(m) || (p += m);
|
|
318
|
+
}), n.innerHTML = "", n.appendChild(a);
|
|
319
|
+
const r = p > 0 ? p : 0;
|
|
320
|
+
n.style.flex = `0 0 ${r}px`, n.style.width = `${r}px`;
|
|
321
|
+
}
|
|
322
|
+
if (u) {
|
|
323
|
+
const a = y(t(this, Y), "right", !1);
|
|
324
|
+
let p = 0;
|
|
325
|
+
a.querySelectorAll("col").forEach((d) => {
|
|
326
|
+
const m = parseInt(d.getAttribute("width"), 10);
|
|
327
|
+
isNaN(m) || (p += m);
|
|
328
|
+
}), u.innerHTML = "", u.appendChild(a);
|
|
329
|
+
const r = p > 0 ? p : 0;
|
|
330
|
+
u.style.flex = `0 0 ${r}px`, u.style.width = `${r}px`;
|
|
331
|
+
}
|
|
332
|
+
if (i) {
|
|
333
|
+
const a = this.getRowCount();
|
|
334
|
+
i.style.overflowY = a > 10 ? "auto" : "hidden", i.addEventListener("scroll", () => {
|
|
335
|
+
const p = i.scrollLeft, r = this.querySelector("nine-table-hscrollbar");
|
|
336
|
+
r && typeof r.syncThumb == "function" && r.syncThumb(p);
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
J.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
340
|
+
}, "init"));
|
|
341
|
+
I(this, "getRowCount", /* @__PURE__ */ l(() => t(this, Y) ? t(this, Y).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
342
|
+
// ๐ฏ ์ธ๋ถ ์คํฌ๋กค๋ฐ ๋ฐ ์ปจํธ๋กค๋ฌ ์ฐ๋์ฉ ๋ฉ์๋
|
|
343
|
+
I(this, "scrollToX", /* @__PURE__ */ l((e) => {
|
|
344
|
+
const s = this.querySelector(".ng-container-body");
|
|
345
|
+
s && (s.scrollLeft = e);
|
|
346
|
+
}, "scrollToX"));
|
|
347
|
+
I(this, "scrollToY", /* @__PURE__ */ l((e) => {
|
|
348
|
+
const s = this.querySelector(".ng-container-body");
|
|
349
|
+
s && (s.scrollTop = e);
|
|
350
|
+
}, "scrollToY"));
|
|
351
|
+
h(this, rt, /* @__PURE__ */ l(() => {
|
|
352
|
+
const e = X.SCROLLBAR_SIZE;
|
|
353
|
+
this.innerHTML = `
|
|
354
|
+
<style>
|
|
355
|
+
nine-table-sheet {
|
|
356
|
+
display: flex;
|
|
357
|
+
flex-direction: column;
|
|
358
|
+
width: 100%;
|
|
359
|
+
height: 100%;
|
|
360
|
+
position: relative;
|
|
361
|
+
box-sizing: border-box;
|
|
362
|
+
background: #ffffff;
|
|
363
|
+
overflow: hidden;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
nine-table-sheet .ng-container-top {
|
|
367
|
+
display: flex;
|
|
368
|
+
flex-direction: row;
|
|
369
|
+
flex: 1 1 auto;
|
|
370
|
+
width: 100%;
|
|
371
|
+
height: calc(100% - ${e}px);
|
|
372
|
+
overflow: hidden;
|
|
373
|
+
position: relative;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
nine-table-sheet .ng-container-left {
|
|
377
|
+
display: flex;
|
|
378
|
+
flex-direction: column;
|
|
379
|
+
overflow: hidden;
|
|
380
|
+
background: #ffffff;
|
|
381
|
+
border-right: 1px solid #e5e7eb;
|
|
382
|
+
flex-shrink: 0;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
nine-table-sheet .ng-container-body {
|
|
386
|
+
display: flex;
|
|
387
|
+
flex-direction: column;
|
|
388
|
+
flex: 1;
|
|
389
|
+
overflow-x: auto;
|
|
390
|
+
overflow-y: auto;
|
|
391
|
+
background: #ffffff;
|
|
392
|
+
position: relative;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
nine-table-sheet .ng-container-right {
|
|
396
|
+
display: flex;
|
|
397
|
+
flex-direction: column;
|
|
398
|
+
overflow: hidden;
|
|
399
|
+
background: #ffffff;
|
|
400
|
+
border-left: 1px solid #e5e7eb;
|
|
401
|
+
flex-shrink: 0;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
nine-table-sheet .ng-container-bottom {
|
|
405
|
+
display: flex;
|
|
406
|
+
flex-direction: row;
|
|
407
|
+
height: ${e}px;
|
|
408
|
+
min-height: ${e}px;
|
|
409
|
+
flex-shrink: 0;
|
|
410
|
+
background: #f9fafb;
|
|
411
|
+
border-top: 1px solid #e5e7eb;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
nine-table-sheet nine-table-hscrollbar {
|
|
415
|
+
flex: 1;
|
|
416
|
+
height: 100%;
|
|
417
|
+
overflow: hidden;
|
|
418
|
+
display: block;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
nine-table-sheet .ng-scroll-edge {
|
|
422
|
+
width: ${e}px;
|
|
423
|
+
min-width: ${e}px;
|
|
424
|
+
height: 100%;
|
|
425
|
+
flex-shrink: 0;
|
|
426
|
+
background: #f3f4f6;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
nine-table-sheet table {
|
|
430
|
+
border-collapse: collapse;
|
|
431
|
+
width: 100%;
|
|
432
|
+
table-layout: fixed;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
nine-table-sheet th, nine-table-sheet td {
|
|
436
|
+
box-sizing: border-box;
|
|
437
|
+
overflow: hidden;
|
|
438
|
+
white-space: nowrap;
|
|
439
|
+
text-overflow: ellipsis;
|
|
440
|
+
padding: 6px 8px;
|
|
441
|
+
border: 1px solid #e5e7eb;
|
|
442
|
+
font-size: 12px;
|
|
443
|
+
color: #111827;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
nine-table-sheet th {
|
|
447
|
+
background-color: #f9fafb;
|
|
448
|
+
font-weight: 600;
|
|
449
|
+
text-align: left;
|
|
450
|
+
}
|
|
451
|
+
</style>
|
|
452
|
+
|
|
453
|
+
<div class='ng-container-top'>
|
|
454
|
+
<div class='ng-container-left'></div>
|
|
455
|
+
<div class='ng-container-body'></div>
|
|
456
|
+
<div class='ng-container-right'></div>
|
|
457
|
+
<nine-table-vscrollbar></nine-table-vscrollbar>
|
|
458
|
+
</div>
|
|
459
|
+
<div class='ng-container-bottom'>
|
|
460
|
+
<nine-table-hscrollbar></nine-table-hscrollbar>
|
|
461
|
+
<div class='ng-scroll-edge'></div>
|
|
462
|
+
</div>
|
|
463
|
+
`;
|
|
464
|
+
}, "#render"));
|
|
465
|
+
}
|
|
466
|
+
connectedCallback() {
|
|
467
|
+
t(this, rt).call(this);
|
|
468
|
+
}
|
|
469
|
+
disconnectedCallback() {
|
|
470
|
+
this.innerHTML = "", J.log("NineTableSheet destroyed.");
|
|
471
471
|
}
|
|
472
472
|
};
|
|
473
|
-
|
|
474
|
-
let gt =
|
|
475
|
-
customElements.get("nine-table-
|
|
473
|
+
Y = new WeakMap(), rt = new WeakMap(), l(X, "NineTableSheet"), I(X, "SCROLLBAR_SIZE", 16);
|
|
474
|
+
let gt = X;
|
|
475
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", gt);
|
|
476
476
|
var ct;
|
|
477
477
|
const St = class St extends HTMLElement {
|
|
478
478
|
constructor() {
|