@ninebone/table 0.0.74 → 0.0.75
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 +165 -442
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +11 -71
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,378 +1,101 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var Z = (r) => {
|
|
3
|
+
throw TypeError(r);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var h = (
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
import { trace as
|
|
10
|
-
const
|
|
5
|
+
var D = (r, t, e) => t in r ? P(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
6
|
+
var h = (r, t) => P(r, "name", { value: t, configurable: !0 });
|
|
7
|
+
var q = (r, t, e) => D(r, typeof t != "symbol" ? t + "" : t, e), X = (r, t, e) => t.has(r) || Z("Cannot " + e);
|
|
8
|
+
var a = (r, t, e) => (X(r, t, "read from private field"), e ? e.call(r) : t.get(r)), w = (r, t, e) => t.has(r) ? Z("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), E = (r, t, e, l) => (X(r, t, "write to private field"), l ? l.call(r, e) : t.set(r, e), e);
|
|
9
|
+
import { trace as G } from "@ninebone/util";
|
|
10
|
+
const j = class j extends G.constructor {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(), this.init("nine-table", "green");
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
h(
|
|
16
|
-
let
|
|
17
|
-
const
|
|
18
|
-
var
|
|
19
|
-
const
|
|
15
|
+
h(j, "Trace");
|
|
16
|
+
let I = j;
|
|
17
|
+
const $ = new I();
|
|
18
|
+
var S, R;
|
|
19
|
+
const k = class k extends HTMLElement {
|
|
20
20
|
constructor() {
|
|
21
21
|
super();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
f(this, b);
|
|
25
|
-
f(this, S);
|
|
26
|
-
f(this, C);
|
|
27
|
-
f(this, _);
|
|
28
|
-
f(this, G, 0);
|
|
29
|
-
T(this, "refresh", /* @__PURE__ */ h(() => {
|
|
30
|
-
if (!t(this, w)) return;
|
|
31
|
-
const e = t(this, w).querySelector(".ng-container-body");
|
|
22
|
+
w(this, S, null);
|
|
23
|
+
q(this, "init", /* @__PURE__ */ h((e) => {
|
|
32
24
|
if (!e) return;
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
$(this).show();
|
|
41
|
-
const p = i ? i.getBoundingClientRect().height : 0, l = Math.max(Math.min(n * (e.clientHeight - p) / (32 * s), n), 16);
|
|
42
|
-
o[0].dataset.height = l, o.css({ height: l });
|
|
43
|
-
const m = n - t(this, D).call(this);
|
|
44
|
-
if (m <= 0) return;
|
|
45
|
-
let r = 0;
|
|
46
|
-
const u = e.scrollHeight - e.clientHeight;
|
|
47
|
-
u > 0 && (r = parseInt(e.scrollTop / u * m, 10), r > n - c && (r = n - c), r < 0 && (r = 0)), t(this, b).thumb.style.top = r + "px", t(this, b).top.disabled = e.scrollTop <= 0, t(this, b).bottom.disabled = e.scrollTop >= u;
|
|
48
|
-
}, "refresh"));
|
|
49
|
-
T(this, "delayScroll", /* @__PURE__ */ h((e, o, i, n) => {
|
|
50
|
-
clearInterval(t(this, S)), clearInterval(t(this, C));
|
|
51
|
-
const c = t(this, w).querySelector(".ng-container-body");
|
|
52
|
-
c && (c.scrollTop += e * 32), y(this, S, setInterval(() => {
|
|
53
|
-
clearInterval(t(this, S)), y(this, C, setInterval(() => {
|
|
54
|
-
c && (c.scrollTop += e * 32, n && n.call());
|
|
55
|
-
}, i));
|
|
56
|
-
}, o));
|
|
57
|
-
}, "delayScroll"));
|
|
58
|
-
T(this, "stopScroll", /* @__PURE__ */ h(() => {
|
|
59
|
-
clearInterval(t(this, S)), clearInterval(t(this, C));
|
|
60
|
-
}, "stopScroll"));
|
|
61
|
-
f(this, J, /* @__PURE__ */ h(() => {
|
|
62
|
-
const e = /* @__PURE__ */ h((i) => {
|
|
63
|
-
clearInterval(t(this, S)), clearInterval(t(this, C));
|
|
64
|
-
const n = t(this, w).querySelector(".ng-container-body");
|
|
65
|
-
n && (n.scrollTop += i * 32), y(this, S, setInterval(() => {
|
|
66
|
-
clearInterval(t(this, S)), y(this, C, setInterval(() => {
|
|
67
|
-
n && (n.scrollTop += i * 32);
|
|
68
|
-
}, 10));
|
|
69
|
-
}, 500));
|
|
70
|
-
}, "delayScrollAction");
|
|
71
|
-
$(t(this, b).top).on("mousedown", (i) => {
|
|
72
|
-
i.buttons != 1 || i.altKey || i.ctrlKey || i.shiftKey || e(-1);
|
|
73
|
-
}), $(t(this, b).bottom).on("mousedown", (i) => {
|
|
74
|
-
i.buttons != 1 || i.altKey || i.ctrlKey || i.shiftKey || e(1);
|
|
75
|
-
}), $(t(this, b).top).on("touchstart", (i) => {
|
|
76
|
-
e(-1);
|
|
77
|
-
}), $(t(this, b).bottom).on("touchstart", (i) => {
|
|
78
|
-
e(1);
|
|
79
|
-
});
|
|
80
|
-
const o = /* @__PURE__ */ h(() => {
|
|
81
|
-
clearInterval(t(this, S)), clearInterval(t(this, C));
|
|
82
|
-
}, "clearTimer");
|
|
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 = o, $(t(this, b).track).on("mousedown", t(this, X)), $(t(this, b).track).on("touchstart", t(this, Q)), $(t(this, b).thumb).on("mousedown", t(this, N)), $(t(this, b).thumb).on("touchstart", t(this, U)), document.addEventListener("mouseup", (i) => {
|
|
84
|
-
t(this, H) && y(this, H, !1), document.removeEventListener("mousemove", t(this, Y));
|
|
85
|
-
}), document.addEventListener("touchend", (i) => {
|
|
86
|
-
y(this, H, !1), document.removeEventListener("touchmove", t(this, K));
|
|
87
|
-
});
|
|
88
|
-
}, "#init"));
|
|
89
|
-
f(this, Q, /* @__PURE__ */ h((e) => {
|
|
90
|
-
e.target.getBoundingClientRect(), e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, X).call(this, e);
|
|
91
|
-
}, "#track_onTouchStart"));
|
|
92
|
-
f(this, X, /* @__PURE__ */ h((e) => {
|
|
93
|
-
if (t(this, H) || e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftKey) return;
|
|
94
|
-
e.preventDefault();
|
|
95
|
-
var o = t(this, b).thumb.getBoundingClientRect();
|
|
96
|
-
const i = t(this, w).querySelector(".ng-container-body");
|
|
97
|
-
if (!i) return;
|
|
98
|
-
const n = i.clientHeight, c = e.clientY > o.y ? n : -n;
|
|
99
|
-
i.scrollTop += c, clearInterval(t(this, S)), clearInterval(t(this, C)), y(this, S, setInterval(() => {
|
|
100
|
-
clearInterval(t(this, S)), y(this, C, setInterval(() => {
|
|
101
|
-
var s = t(this, b).thumb.getBoundingClientRect();
|
|
102
|
-
e.clientY > s.y && e.clientY < s.y + s.height ? clearInterval(t(this, C)) : i.scrollTop += e.clientY > s.y ? n : -n;
|
|
103
|
-
}, 10));
|
|
104
|
-
}, 500));
|
|
105
|
-
}, "#track_onMouseDown"));
|
|
106
|
-
f(this, U, /* @__PURE__ */ h((e) => {
|
|
107
|
-
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, N).call(this, e), document.addEventListener("touchmove", t(this, K));
|
|
108
|
-
}, "#thumb_onTouchStart"));
|
|
109
|
-
f(this, K, /* @__PURE__ */ h((e) => {
|
|
110
|
-
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, Y).call(this, e);
|
|
111
|
-
}, "#thumb_onTouchMove"));
|
|
112
|
-
f(this, N, /* @__PURE__ */ h((e) => {
|
|
113
|
-
y(this, G, e.clientY), y(this, H, !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(), y(this, _, !0), document.addEventListener("mousemove", t(this, Y));
|
|
114
|
-
}, "#thumb_onMouseDown"));
|
|
115
|
-
f(this, Y, /* @__PURE__ */ h((e) => {
|
|
116
|
-
if (!t(this, H)) return;
|
|
117
|
-
e.preventDefault();
|
|
118
|
-
const o = this.trackHeight, i = t(this, D).call(this);
|
|
119
|
-
var n = e.clientY - this.shiftY;
|
|
120
|
-
n < 0 && (n = 0), n + i > o && (n = parseInt(o - i)), t(this, b).thumb.style.top = n + "px";
|
|
121
|
-
const c = t(this, w).querySelector(".ng-container-body");
|
|
122
|
-
if (!c) return;
|
|
123
|
-
const s = c.scrollHeight - c.clientHeight, p = o - i;
|
|
124
|
-
p > 0 && s > 0 && (c.scrollTop = n / p * s);
|
|
125
|
-
}, "#thumb_onMouseMove"));
|
|
126
|
-
f(this, D, /* @__PURE__ */ h(() => parseInt(t(this, b).thumb.dataset.height || 30, 10), "#getThumbHeight"));
|
|
127
|
-
}
|
|
128
|
-
connectedCallback() {
|
|
129
|
-
y(this, w, this.getRootNode().host), t(this, w) && (this.shadowRoot.innerHTML = `
|
|
130
|
-
<button class='ng-scroll-top' disabled><div class='ng-scroll-icon'></div></button>
|
|
131
|
-
<div class='ng-scroll-track'> <div class='ng-scroll-thumb'></div> </div>
|
|
132
|
-
<button class='ng-scroll-bottom'><div class='ng-scroll-icon'></div></button>
|
|
133
|
-
`, super.connectedCallback(), y(this, b, {
|
|
134
|
-
track: this.shadowRoot.querySelector(".ng-scroll-track"),
|
|
135
|
-
thumb: this.shadowRoot.querySelector(".ng-scroll-thumb"),
|
|
136
|
-
top: this.shadowRoot.querySelector(".ng-scroll-top"),
|
|
137
|
-
bottom: this.shadowRoot.querySelector(".ng-scroll-bottom")
|
|
138
|
-
}), t(this, J).call(this));
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
w = new WeakMap(), H = new WeakMap(), b = new WeakMap(), S = new WeakMap(), C = new WeakMap(), _ = new WeakMap(), G = new WeakMap(), J = new WeakMap(), Q = new WeakMap(), X = new WeakMap(), U = new WeakMap(), K = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), D = new WeakMap(), h(bt, "NineTableVScrollBar");
|
|
142
|
-
let lt = bt;
|
|
143
|
-
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", lt);
|
|
144
|
-
var R, W, d, A, M, B, V, j;
|
|
145
|
-
const ft = class ft extends HTMLElement {
|
|
146
|
-
constructor() {
|
|
147
|
-
super();
|
|
148
|
-
f(this, R);
|
|
149
|
-
f(this, W);
|
|
150
|
-
f(this, d);
|
|
151
|
-
f(this, A);
|
|
152
|
-
f(this, M);
|
|
153
|
-
T(this, "refresh", /* @__PURE__ */ h(() => {
|
|
154
|
-
if (!t(this, R)) return;
|
|
155
|
-
const e = t(this, R).querySelector(".ng-container-body");
|
|
156
|
-
if (!e) return;
|
|
157
|
-
const o = e.querySelector("table");
|
|
158
|
-
if (!o) return;
|
|
159
|
-
const i = $(t(this, d).track, this), n = $(t(this, d).thumb, this), c = t(this, R).querySelector(".ng-container-bottom");
|
|
160
|
-
if (e.clientWidth !== 0 && o.scrollWidth > e.clientWidth)
|
|
161
|
-
$(c).show();
|
|
162
|
-
else {
|
|
163
|
-
$(c).hide();
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const s = i.width();
|
|
167
|
-
if (s <= 0) return;
|
|
168
|
-
const p = Math.max(Math.min(s * (e.clientWidth / o.scrollWidth), s), 20);
|
|
169
|
-
n.width(p);
|
|
170
|
-
const l = o.scrollWidth - e.clientWidth, m = s - p;
|
|
171
|
-
let r = 0;
|
|
172
|
-
l > 0 && (r = parseInt(e.scrollLeft / l * m, 10)), r < 0 && (r = 0), r > m && (r = m), n.css({ left: r }), t(this, d).left.disabled = e.scrollLeft <= 0, t(this, d).right.disabled = e.scrollLeft >= l;
|
|
173
|
-
}, "refresh"));
|
|
174
|
-
f(this, B, /* @__PURE__ */ h((e) => {
|
|
175
|
-
if (!t(this, d)) return;
|
|
176
|
-
const o = t(this, R).querySelector(".ng-container-body"), i = o.querySelector("table");
|
|
177
|
-
if (!i) return;
|
|
178
|
-
const n = t(this, d).track.getBoundingClientRect(), c = t(this, d).thumb.getBoundingClientRect();
|
|
179
|
-
let s = e;
|
|
180
|
-
s < 0 && (s = 0), s + c.width > n.width && (s = n.width - c.width), s = parseInt(s, 10), t(this, d).thumb.style.left = s + "px";
|
|
181
|
-
const p = i.scrollWidth - o.clientWidth, l = n.width - c.width;
|
|
182
|
-
return l > 0 && p > 0 && (o.scrollLeft = s / l * p), t(this, d).left.disabled = s <= 0, t(this, d).right.disabled = s >= l, s > 0 && s < l;
|
|
183
|
-
}, "#thumbMoveTo"));
|
|
184
|
-
f(this, V, /* @__PURE__ */ h(() => {
|
|
185
|
-
const e = t(this, R).querySelector(".ng-container-body");
|
|
186
|
-
e && e.addEventListener("scroll", () => {
|
|
187
|
-
this.refresh();
|
|
188
|
-
});
|
|
189
|
-
const o = /* @__PURE__ */ h((n) => {
|
|
190
|
-
clearInterval(t(this, A)), clearInterval(t(this, M));
|
|
191
|
-
const c = t(this, d).track.getBoundingClientRect(), s = t(this, d).thumb.getBoundingClientRect();
|
|
192
|
-
t(this, B).call(this, s.x - c.x + n), y(this, A, setInterval(() => {
|
|
193
|
-
clearInterval(t(this, A)), y(this, M, setInterval(() => {
|
|
194
|
-
const p = t(this, d).track.getBoundingClientRect(), l = t(this, d).thumb.getBoundingClientRect();
|
|
195
|
-
t(this, B).call(this, l.x - p.x + n) || clearInterval(t(this, M));
|
|
196
|
-
}, 10));
|
|
197
|
-
}, 500));
|
|
198
|
-
}, "delayScroll"), i = /* @__PURE__ */ h(() => {
|
|
199
|
-
clearInterval(t(this, A)), clearInterval(t(this, M));
|
|
200
|
-
}, "clearTimer");
|
|
201
|
-
t(this, d).left.ontouchend = t(this, d).right.ontouchend = t(this, d).track.ontouchend = t(this, d).left.onmouseup = t(this, d).left.onmouseleave = t(this, d).right.onmouseup = t(this, d).right.onmouseleave = t(this, d).track.onmouseup = t(this, d).track.onmouseleave = i, $(t(this, d).left).on("mousedown", (n) => {
|
|
202
|
-
n.buttons == 1 && o(-10);
|
|
203
|
-
}), $(t(this, d).right).on("mousedown", (n) => {
|
|
204
|
-
n.buttons == 1 && o(10);
|
|
205
|
-
}), $(t(this, d).left).on("touchstart", (n) => {
|
|
206
|
-
o(-10);
|
|
207
|
-
}), $(t(this, d).right).on("touchstart", (n) => {
|
|
208
|
-
o(10);
|
|
209
|
-
}), $(t(this, d).track).on("mousedown", (n) => {
|
|
210
|
-
if (n.buttons != 1) return;
|
|
211
|
-
n.preventDefault();
|
|
212
|
-
const c = t(this, d).track.getBoundingClientRect(), s = t(this, d).thumb.getBoundingClientRect().width;
|
|
213
|
-
t(this, B).call(this, n.clientX - c.left - s / 2);
|
|
214
|
-
}), $(t(this, d).thumb).on("mousedown", (n) => {
|
|
215
|
-
y(this, W, !0), this.shiftX = n.clientX - t(this, d).thumb.getBoundingClientRect().left, document.addEventListener("mousemove", t(this, j));
|
|
216
|
-
}), document.addEventListener("mouseup", () => {
|
|
217
|
-
y(this, W, !1), i(), document.removeEventListener("mousemove", t(this, j));
|
|
218
|
-
});
|
|
219
|
-
}, "#init"));
|
|
220
|
-
f(this, j, /* @__PURE__ */ h((e) => {
|
|
221
|
-
if (!t(this, W)) return;
|
|
222
|
-
const o = t(this, d).track.getBoundingClientRect();
|
|
223
|
-
t(this, B).call(this, e.clientX - o.left - this.shiftX);
|
|
224
|
-
}, "#thumb_onMouseMove"));
|
|
225
|
-
}
|
|
226
|
-
connectedCallback() {
|
|
227
|
-
y(this, R, this.getRootNode().host), t(this, R) && (this.innerHTML = `
|
|
228
|
-
<style>
|
|
229
|
-
nine-table-hscrollbar {
|
|
230
|
-
display: flex;
|
|
231
|
-
flex-direction: row;
|
|
232
|
-
width: 100%;
|
|
233
|
-
height: 100%;
|
|
234
|
-
background: #f9fafb;
|
|
235
|
-
box-sizing: border-box;
|
|
236
|
-
user-select: none;
|
|
237
|
-
}
|
|
238
|
-
nine-table-hscrollbar button {
|
|
239
|
-
width: 16px;
|
|
240
|
-
height: 100%;
|
|
241
|
-
background: #f3f4f6;
|
|
242
|
-
border: none;
|
|
243
|
-
cursor: pointer;
|
|
244
|
-
display: flex;
|
|
245
|
-
align-items: center;
|
|
246
|
-
justify-content: center;
|
|
247
|
-
padding: 0;
|
|
248
|
-
}
|
|
249
|
-
nine-table-hscrollbar button:disabled {
|
|
250
|
-
opacity: 0.4;
|
|
251
|
-
cursor: default;
|
|
252
|
-
}
|
|
253
|
-
nine-table-hscrollbar .ng-scroll-icon {
|
|
254
|
-
width: 6px;
|
|
255
|
-
height: 6px;
|
|
256
|
-
border-top: 2px solid #6b7280;
|
|
257
|
-
border-right: 2px solid #6b7280;
|
|
258
|
-
}
|
|
259
|
-
nine-table-hscrollbar .ng-scroll-left .ng-scroll-icon { transform: rotate(-135deg); }
|
|
260
|
-
nine-table-hscrollbar .ng-scroll-right .ng-scroll-icon { transform: rotate(45deg); }
|
|
261
|
-
nine-table-hscrollbar .ng-scroll-track {
|
|
262
|
-
flex: 1;
|
|
263
|
-
height: 100%;
|
|
264
|
-
position: relative;
|
|
265
|
-
background: #f3f4f6;
|
|
266
|
-
overflow: hidden;
|
|
267
|
-
}
|
|
268
|
-
nine-table-hscrollbar .ng-scroll-thumb {
|
|
269
|
-
position: absolute;
|
|
270
|
-
top: 2px;
|
|
271
|
-
bottom: 2px;
|
|
272
|
-
background: #d1d5db;
|
|
273
|
-
border-radius: 4px;
|
|
274
|
-
cursor: pointer;
|
|
275
|
-
}
|
|
276
|
-
nine-table-hscrollbar .ng-scroll-thumb:hover {
|
|
277
|
-
background: #9ca3af;
|
|
278
|
-
}
|
|
279
|
-
</style>
|
|
280
|
-
<button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
|
|
281
|
-
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
282
|
-
<button class='ng-scroll-right'><div class='ng-scroll-icon'></div></button>
|
|
283
|
-
`, y(this, d, {
|
|
284
|
-
container: t(this, R).querySelector(".ng-container-body"),
|
|
285
|
-
track: this.querySelector(".ng-scroll-track"),
|
|
286
|
-
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
287
|
-
left: this.querySelector(".ng-scroll-left"),
|
|
288
|
-
right: this.querySelector(".ng-scroll-right")
|
|
289
|
-
}), t(this, V).call(this), setTimeout(() => this.refresh(), 0));
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
R = new WeakMap(), W = new WeakMap(), d = new WeakMap(), A = new WeakMap(), M = new WeakMap(), B = new WeakMap(), V = new WeakMap(), j = new WeakMap(), h(ft, "NineTableHScrollBar");
|
|
293
|
-
let rt = ft;
|
|
294
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", rt);
|
|
295
|
-
var I, tt;
|
|
296
|
-
const z = class z extends HTMLElement {
|
|
297
|
-
constructor() {
|
|
298
|
-
super();
|
|
299
|
-
f(this, I, null);
|
|
300
|
-
T(this, "init", /* @__PURE__ */ h((e) => {
|
|
301
|
-
if (!e) return;
|
|
302
|
-
const o = /* @__PURE__ */ h((l) => {
|
|
303
|
-
const m = /* @__PURE__ */ h((u) => {
|
|
304
|
-
if (u.querySelector("colgroup")) return;
|
|
305
|
-
const g = u.querySelector("tbody tr") || u.querySelector("tr"), k = g ? g.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), L = Math.max(Math.floor((u.clientWidth || 600) / k), 100);
|
|
306
|
-
for (let q = 0; q < k; q++) {
|
|
307
|
-
const it = document.createElement("col");
|
|
308
|
-
it.setAttribute("width", L), x.appendChild(it);
|
|
25
|
+
const l = /* @__PURE__ */ h((n) => {
|
|
26
|
+
const c = /* @__PURE__ */ h((i) => {
|
|
27
|
+
if (i.querySelector("colgroup")) return;
|
|
28
|
+
const s = i.querySelector("tbody tr") || i.querySelector("tr"), y = s ? s.querySelectorAll("th, td").length : 1, b = document.createElement("colgroup"), m = Math.max(Math.floor((i.clientWidth || 600) / y), 100);
|
|
29
|
+
for (let x = 0; x < y; x++) {
|
|
30
|
+
const z = document.createElement("col");
|
|
31
|
+
z.setAttribute("width", m), b.appendChild(z);
|
|
309
32
|
}
|
|
310
|
-
|
|
311
|
-
}, "ensureColgroup"),
|
|
312
|
-
if (
|
|
313
|
-
const
|
|
314
|
-
|
|
33
|
+
i.prepend(b);
|
|
34
|
+
}, "ensureColgroup"), o = /* @__PURE__ */ h((i) => {
|
|
35
|
+
if (i.querySelector("thead")) return;
|
|
36
|
+
const s = document.createElement("thead"), y = i.querySelector("colgroup");
|
|
37
|
+
y ? y.after(s) : i.prepend(s);
|
|
315
38
|
}, "ensureThead");
|
|
316
|
-
return
|
|
317
|
-
}, "initializeTable"),
|
|
318
|
-
|
|
319
|
-
const
|
|
320
|
-
const
|
|
321
|
-
return
|
|
322
|
-
const
|
|
323
|
-
(
|
|
324
|
-
}),
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
|
|
39
|
+
return c(n), o(n), n.classList.add("nine-table-element"), n;
|
|
40
|
+
}, "initializeTable"), u = e.cloneNode(!0);
|
|
41
|
+
E(this, S, l(u)), a(this, S).style.display = "table";
|
|
42
|
+
const g = this.querySelector(".ng-container-left"), d = this.querySelector(".ng-container-body"), f = this.querySelector(".ng-container-right"), p = /* @__PURE__ */ h((n, c, o = !1) => {
|
|
43
|
+
const i = n.cloneNode(!0), s = Array.from(i.querySelectorAll("colgroup col")), y = [];
|
|
44
|
+
return s.forEach((b, m) => {
|
|
45
|
+
const x = b.getAttribute("fixed");
|
|
46
|
+
(o ? !x || x === "" : x === c) || y.push(m);
|
|
47
|
+
}), y.reverse().forEach((b) => {
|
|
48
|
+
s[b] && s[b].remove(), i.querySelectorAll("tr").forEach((m) => {
|
|
49
|
+
const x = m.querySelectorAll("th, td");
|
|
50
|
+
x[b] && x[b].remove();
|
|
328
51
|
});
|
|
329
|
-
}),
|
|
52
|
+
}), i;
|
|
330
53
|
}, "filterTableByFixed");
|
|
331
|
-
if (
|
|
332
|
-
const
|
|
333
|
-
|
|
54
|
+
if (d) {
|
|
55
|
+
const n = p(a(this, S), null, !0);
|
|
56
|
+
d.innerHTML = "", d.appendChild(n);
|
|
334
57
|
}
|
|
335
|
-
if (
|
|
336
|
-
const
|
|
337
|
-
let
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
isNaN(
|
|
341
|
-
}),
|
|
342
|
-
const
|
|
343
|
-
|
|
58
|
+
if (g) {
|
|
59
|
+
const n = p(a(this, S), "left", !1);
|
|
60
|
+
let c = 0;
|
|
61
|
+
n.querySelectorAll("col").forEach((i) => {
|
|
62
|
+
const s = parseInt(i.getAttribute("width"), 10);
|
|
63
|
+
isNaN(s) || (c += s);
|
|
64
|
+
}), g.innerHTML = "", g.appendChild(n);
|
|
65
|
+
const o = c > 0 ? c : 0;
|
|
66
|
+
g.style.flex = `0 0 ${o}px`, g.style.width = `${o}px`;
|
|
344
67
|
}
|
|
345
|
-
if (
|
|
346
|
-
const
|
|
347
|
-
let
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
isNaN(
|
|
351
|
-
}),
|
|
352
|
-
const
|
|
353
|
-
|
|
68
|
+
if (f) {
|
|
69
|
+
const n = p(a(this, S), "right", !1);
|
|
70
|
+
let c = 0;
|
|
71
|
+
n.querySelectorAll("col").forEach((i) => {
|
|
72
|
+
const s = parseInt(i.getAttribute("width"), 10);
|
|
73
|
+
isNaN(s) || (c += s);
|
|
74
|
+
}), f.innerHTML = "", f.appendChild(n);
|
|
75
|
+
const o = c > 0 ? c : 0;
|
|
76
|
+
f.style.flex = `0 0 ${o}px`, f.style.width = `${o}px`;
|
|
354
77
|
}
|
|
355
|
-
if (
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
|
|
78
|
+
if (d) {
|
|
79
|
+
const n = this.getRowCount();
|
|
80
|
+
d.style.overflowY = n > 10 ? "auto" : "hidden", d.addEventListener("scroll", () => {
|
|
81
|
+
const c = d.scrollLeft, o = this.querySelector("nine-table-hscrollbar");
|
|
82
|
+
o && typeof o.syncThumb == "function" && o.syncThumb(c);
|
|
360
83
|
});
|
|
361
84
|
}
|
|
362
|
-
|
|
85
|
+
$.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
363
86
|
}, "init"));
|
|
364
|
-
|
|
87
|
+
q(this, "getRowCount", /* @__PURE__ */ h(() => a(this, S) ? a(this, S).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
365
88
|
// 🎯 외부 스크롤바 및 컨트롤러 연동용 메서드
|
|
366
|
-
|
|
367
|
-
const
|
|
368
|
-
|
|
89
|
+
q(this, "scrollToX", /* @__PURE__ */ h((e) => {
|
|
90
|
+
const l = this.querySelector(".ng-container-body");
|
|
91
|
+
l && (l.scrollLeft = e);
|
|
369
92
|
}, "scrollToX"));
|
|
370
|
-
|
|
371
|
-
const
|
|
372
|
-
|
|
93
|
+
q(this, "scrollToY", /* @__PURE__ */ h((e) => {
|
|
94
|
+
const l = this.querySelector(".ng-container-body");
|
|
95
|
+
l && (l.scrollTop = e);
|
|
373
96
|
}, "scrollToY"));
|
|
374
|
-
|
|
375
|
-
const e =
|
|
97
|
+
w(this, R, /* @__PURE__ */ h(() => {
|
|
98
|
+
const e = k.SCROLLBAR_SIZE;
|
|
376
99
|
this.innerHTML = `
|
|
377
100
|
<style>
|
|
378
101
|
nine-table-sheet {
|
|
@@ -487,109 +210,109 @@ const z = class z extends HTMLElement {
|
|
|
487
210
|
}, "#render"));
|
|
488
211
|
}
|
|
489
212
|
connectedCallback() {
|
|
490
|
-
|
|
213
|
+
a(this, R).call(this);
|
|
491
214
|
}
|
|
492
215
|
disconnectedCallback() {
|
|
493
|
-
this.innerHTML = "",
|
|
216
|
+
this.innerHTML = "", $.log("NineTableSheet destroyed.");
|
|
494
217
|
}
|
|
495
218
|
};
|
|
496
|
-
|
|
497
|
-
let
|
|
498
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
499
|
-
var
|
|
500
|
-
const
|
|
219
|
+
S = new WeakMap(), R = new WeakMap(), h(k, "NineTableSheet"), q(k, "SCROLLBAR_SIZE", 16);
|
|
220
|
+
let B = k;
|
|
221
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", B);
|
|
222
|
+
var T;
|
|
223
|
+
const K = class K extends HTMLElement {
|
|
501
224
|
constructor() {
|
|
502
225
|
super();
|
|
503
|
-
|
|
226
|
+
w(this, T, /* @__PURE__ */ h(() => {
|
|
504
227
|
const e = this.querySelector(".nine-tab-bar");
|
|
505
|
-
e && (e.addEventListener("click", (
|
|
506
|
-
const
|
|
507
|
-
if (!
|
|
508
|
-
const
|
|
509
|
-
this.switchSheet(
|
|
228
|
+
e && (e.addEventListener("click", (l) => {
|
|
229
|
+
const u = l.target.closest(".nine-tab-item");
|
|
230
|
+
if (!u) return;
|
|
231
|
+
const g = l.ctrlKey || l.metaKey || l.shiftKey, d = parseInt(u.dataset.index, 10);
|
|
232
|
+
this.switchSheet(d, g);
|
|
510
233
|
}), this.switchSheet(0, !1));
|
|
511
234
|
}, "#init"));
|
|
512
|
-
|
|
513
|
-
const
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
|
|
235
|
+
q(this, "switchSheet", /* @__PURE__ */ h((e, l = !1) => {
|
|
236
|
+
const u = /* @__PURE__ */ h(() => {
|
|
237
|
+
const o = this.querySelector("nine-table-sheets-body");
|
|
238
|
+
o.querySelectorAll("nine-splitter").forEach((s) => {
|
|
239
|
+
const y = parseInt(s.dataset.splitIndex, 10), b = o.querySelector(`nine-table-sheet[data-index="${y - 1}"]`), m = o.querySelector(`nine-table-sheet[data-index="${y}"]`);
|
|
240
|
+
b && m && b.classList.contains("active") && m.classList.contains("active") ? s.classList.add("active") : s.classList.remove("active");
|
|
518
241
|
});
|
|
519
|
-
}, "updateSplitters"),
|
|
520
|
-
if (!
|
|
521
|
-
if (!
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
}), p.forEach((
|
|
527
|
-
|
|
242
|
+
}, "updateSplitters"), g = this.querySelector(".nine-tab-bar"), d = this.querySelector("nine-table-sheets-body"), f = g.querySelectorAll(".nine-tab-item"), p = d.querySelectorAll("nine-table-sheet");
|
|
243
|
+
if (!f[e]) return;
|
|
244
|
+
if (!l)
|
|
245
|
+
f.forEach((o, i) => {
|
|
246
|
+
o.classList.toggle("active", i === e);
|
|
247
|
+
const s = d.querySelector(`nine-table-sheet[data-index="${i}"]`);
|
|
248
|
+
s && (s.style.flex = "");
|
|
249
|
+
}), p.forEach((o, i) => {
|
|
250
|
+
o.classList.toggle("active", i === e);
|
|
528
251
|
});
|
|
529
252
|
else {
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
253
|
+
const o = f[e], i = g.querySelectorAll(".nine-tab-item.active");
|
|
254
|
+
if (o.classList.contains("active") && i.length <= 1)
|
|
532
255
|
return;
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
|
|
256
|
+
o.classList.toggle("active");
|
|
257
|
+
const s = d.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
258
|
+
s && (s.classList.toggle("active"), s.classList.contains("active") || (s.style.flex = ""));
|
|
536
259
|
}
|
|
537
|
-
const
|
|
538
|
-
if (
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
(!
|
|
260
|
+
const n = Array.from(d.querySelectorAll("nine-table-sheet.active"));
|
|
261
|
+
if (n.length > 1) {
|
|
262
|
+
const o = 1 / n.length;
|
|
263
|
+
n.forEach((i) => {
|
|
264
|
+
(!i.style.flex || i.style.flex === "1 1 100%") && (i.style.flex = `${o} ${o} 0px`);
|
|
542
265
|
});
|
|
543
266
|
} else
|
|
544
|
-
|
|
545
|
-
|
|
267
|
+
n.forEach((o) => {
|
|
268
|
+
o.style.flex = "1 1 100%";
|
|
546
269
|
});
|
|
547
|
-
|
|
548
|
-
const
|
|
549
|
-
if (
|
|
550
|
-
const
|
|
551
|
-
|
|
270
|
+
u();
|
|
271
|
+
const c = d.querySelector("nine-table-sheet.active");
|
|
272
|
+
if (c && typeof c.getRowCount == "function") {
|
|
273
|
+
const o = this.querySelector("#row-count");
|
|
274
|
+
o && (o.textContent = c.getRowCount().toLocaleString());
|
|
552
275
|
}
|
|
553
276
|
}, "switchSheet"));
|
|
554
277
|
}
|
|
555
278
|
connectedCallback() {
|
|
556
|
-
|
|
279
|
+
a(this, T).call(this);
|
|
557
280
|
}
|
|
558
281
|
};
|
|
559
|
-
|
|
560
|
-
let
|
|
561
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
562
|
-
var
|
|
563
|
-
const
|
|
564
|
-
constructor(
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
for (let
|
|
571
|
-
|
|
572
|
-
})),
|
|
282
|
+
T = new WeakMap(), h(K, "NineTableSheets");
|
|
283
|
+
let N = K;
|
|
284
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", N);
|
|
285
|
+
var v, C, H, A, M;
|
|
286
|
+
const Y = class Y {
|
|
287
|
+
constructor(t) {
|
|
288
|
+
w(this, v);
|
|
289
|
+
w(this, C, null);
|
|
290
|
+
w(this, H, /* @__PURE__ */ h(() => {
|
|
291
|
+
const t = a(this, v).host;
|
|
292
|
+
t && (E(this, C, new ResizeObserver((e) => {
|
|
293
|
+
for (let l of e)
|
|
294
|
+
t.getAttribute("auto-height") === "true" && a(this, A).call(this, t);
|
|
295
|
+
})), a(this, C).observe(t));
|
|
573
296
|
}, "#observeResize"));
|
|
574
|
-
|
|
575
|
-
var
|
|
576
|
-
const e = (
|
|
297
|
+
w(this, A, /* @__PURE__ */ h((t) => {
|
|
298
|
+
var m, x;
|
|
299
|
+
const e = (m = t.shadowRoot) == null ? void 0 : m.querySelector("nine-table-sheet.active");
|
|
577
300
|
if (!e) return;
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
const
|
|
581
|
-
|
|
301
|
+
const l = ((x = e.getRowCount) == null ? void 0 : x.call(e)) || 0, u = parseInt(t.getAttribute("max-display-row"), 10) || 10, g = Math.min(l, u), d = e.querySelector("tbody tr") || e.querySelector("tr"), f = d ? d.getBoundingClientRect().height : 32, p = a(this, v).querySelector("nine-table-header"), n = a(this, v).querySelector("nine-table-sheets-footer"), c = p ? p.getBoundingClientRect().height : 40, o = n ? n.getBoundingClientRect().height : 32, s = c + o + 16, y = g * f + s;
|
|
302
|
+
t.style.height = `${y}px`, t.style.maxHeight = `${u * f + s}px`;
|
|
303
|
+
const b = a(this, v).querySelector("nine-table-sheets-body");
|
|
304
|
+
b && (b.style.overflowY = l > u ? "auto" : "hidden");
|
|
582
305
|
}, "#applyAutoHeight"));
|
|
583
|
-
|
|
584
|
-
const
|
|
585
|
-
|
|
306
|
+
w(this, M, /* @__PURE__ */ h(() => {
|
|
307
|
+
const t = a(this, v).host, l = Array.from(t.children).filter((p) => p.tagName === "TABLE"), u = t.getAttribute("auto-height") === "true", g = l.map((p, n) => `<nine-table-sheet class="${n === 0 ? "active" : ""}" data-index="${n}"></nine-table-sheet>`).join(""), d = l.map((p, n) => `<div class="nine-tab-item ${n === 0 ? "active" : ""}" data-index="${n}">Sheet ${n + 1}</div>`).join("");
|
|
308
|
+
a(this, v).innerHTML = `
|
|
586
309
|
<style>
|
|
587
310
|
:host {
|
|
588
311
|
display: flex;
|
|
589
312
|
flex-direction: column;
|
|
590
313
|
position: relative;
|
|
591
314
|
overflow: hidden;
|
|
592
|
-
height: ${
|
|
315
|
+
height: ${u ? "auto" : "100%"};
|
|
593
316
|
background: #fff;
|
|
594
317
|
}
|
|
595
318
|
nine-table-header { height: 40px; display: block; flex-shrink: 0; border-bottom: 1px solid #e5e7eb; background: #fff; }
|
|
@@ -670,9 +393,9 @@ const mt = class mt {
|
|
|
670
393
|
<nine-table-body>
|
|
671
394
|
<nine-table-summary></nine-table-summary>
|
|
672
395
|
<nine-table-sheets>
|
|
673
|
-
<nine-table-sheets-body>${
|
|
396
|
+
<nine-table-sheets-body>${g}</nine-table-sheets-body>
|
|
674
397
|
<nine-table-sheets-footer>
|
|
675
|
-
<div class="nine-tab-bar">${
|
|
398
|
+
<div class="nine-tab-bar">${d}</div>
|
|
676
399
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
677
400
|
</nine-table-sheets-footer>
|
|
678
401
|
</nine-table-sheets>
|
|
@@ -680,33 +403,33 @@ const mt = class mt {
|
|
|
680
403
|
</nine-table-body>
|
|
681
404
|
<nine-table-footer></nine-table-footer>
|
|
682
405
|
`;
|
|
683
|
-
const
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
p.init(
|
|
406
|
+
const f = a(this, v).querySelectorAll("nine-table-sheet");
|
|
407
|
+
f == null || f.forEach((p, n) => {
|
|
408
|
+
l[n] && setTimeout(() => {
|
|
409
|
+
p.init(l[n]), u && a(this, A).call(this, t);
|
|
687
410
|
});
|
|
688
411
|
});
|
|
689
412
|
}, "#render"));
|
|
690
|
-
|
|
413
|
+
E(this, v, t), a(this, M).call(this), a(this, H).call(this);
|
|
691
414
|
}
|
|
692
415
|
};
|
|
693
|
-
|
|
694
|
-
let
|
|
695
|
-
var
|
|
696
|
-
const
|
|
416
|
+
v = new WeakMap(), C = new WeakMap(), H = new WeakMap(), A = new WeakMap(), M = new WeakMap(), h(Y, "LayoutManager");
|
|
417
|
+
let W = Y;
|
|
418
|
+
var L;
|
|
419
|
+
const F = class F extends HTMLElement {
|
|
697
420
|
constructor() {
|
|
698
421
|
super();
|
|
699
|
-
|
|
422
|
+
w(this, L, !1);
|
|
700
423
|
this.attachShadow({ mode: "open" });
|
|
701
424
|
}
|
|
702
425
|
connectedCallback() {
|
|
703
|
-
|
|
426
|
+
a(this, L) || (this.layoutManager = new W(this.shadowRoot), E(this, L, !0), $.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } })));
|
|
704
427
|
}
|
|
705
428
|
disconnectedCallback() {
|
|
706
|
-
|
|
429
|
+
$.log("NineTable disconnected.");
|
|
707
430
|
}
|
|
708
431
|
};
|
|
709
|
-
|
|
710
|
-
let
|
|
711
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
432
|
+
L = new WeakMap(), h(F, "NineTable");
|
|
433
|
+
let O = F;
|
|
434
|
+
customElements.get("nine-table") || customElements.define("nine-table", O);
|
|
712
435
|
//# sourceMappingURL=nine-table.js.map
|