@ninebone/table 0.0.73 → 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 -417
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +11 -19
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,353 +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
|
|
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
|
-
|
|
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
|
-
h(this, b);
|
|
25
|
-
h(this, S);
|
|
26
|
-
h(this, R);
|
|
27
|
-
h(this, Q);
|
|
28
|
-
h(this, U, 0);
|
|
29
|
-
I(this, "refresh", /* @__PURE__ */ l(() => {
|
|
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 y = o ? o.getBoundingClientRect().height : 0, a = Math.max(Math.min(n * (e.clientHeight - y) / (32 * u), n), 16);
|
|
42
|
-
s[0].dataset.height = a, s.css({ height: a });
|
|
43
|
-
const p = n - t(this, N).call(this);
|
|
44
|
-
if (p <= 0) return;
|
|
45
|
-
let r = 0;
|
|
46
|
-
const d = e.scrollHeight - e.clientHeight;
|
|
47
|
-
d > 0 && (r = parseInt(e.scrollTop / d * p, 10), r > n - i && (r = n - i), 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 >= d;
|
|
48
|
-
}, "refresh"));
|
|
49
|
-
I(this, "delayScroll", /* @__PURE__ */ l((e, s, o, n) => {
|
|
50
|
-
clearInterval(t(this, S)), clearInterval(t(this, R));
|
|
51
|
-
const i = t(this, w).querySelector(".ng-container-body");
|
|
52
|
-
i && (i.scrollTop += e * 32), g(this, S, setInterval(() => {
|
|
53
|
-
clearInterval(t(this, S)), g(this, R, setInterval(() => {
|
|
54
|
-
i && (i.scrollTop += e * 32, n && n.call());
|
|
55
|
-
}, o));
|
|
56
|
-
}, s));
|
|
57
|
-
}, "delayScroll"));
|
|
58
|
-
I(this, "stopScroll", /* @__PURE__ */ l(() => {
|
|
59
|
-
clearInterval(t(this, S)), clearInterval(t(this, R));
|
|
60
|
-
}, "stopScroll"));
|
|
61
|
-
h(this, V, /* @__PURE__ */ l(() => {
|
|
62
|
-
const e = /* @__PURE__ */ l((o) => {
|
|
63
|
-
clearInterval(t(this, S)), clearInterval(t(this, R));
|
|
64
|
-
const n = t(this, w).querySelector(".ng-container-body");
|
|
65
|
-
n && (n.scrollTop += o * 32), g(this, S, setInterval(() => {
|
|
66
|
-
clearInterval(t(this, S)), g(this, R, setInterval(() => {
|
|
67
|
-
n && (n.scrollTop += o * 32);
|
|
68
|
-
}, 10));
|
|
69
|
-
}, 500));
|
|
70
|
-
}, "delayScrollAction");
|
|
71
|
-
$(t(this, b).top).on("mousedown", (o) => {
|
|
72
|
-
o.buttons != 1 || o.altKey || o.ctrlKey || o.shiftKey || e(-1);
|
|
73
|
-
}), $(t(this, b).bottom).on("mousedown", (o) => {
|
|
74
|
-
o.buttons != 1 || o.altKey || o.ctrlKey || o.shiftKey || e(1);
|
|
75
|
-
}), $(t(this, b).top).on("touchstart", (o) => {
|
|
76
|
-
e(-1);
|
|
77
|
-
}), $(t(this, b).bottom).on("touchstart", (o) => {
|
|
78
|
-
e(1);
|
|
79
|
-
});
|
|
80
|
-
const s = /* @__PURE__ */ l(() => {
|
|
81
|
-
clearInterval(t(this, S)), clearInterval(t(this, R));
|
|
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 = 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) => {
|
|
84
|
-
t(this, M) && g(this, M, !1), document.removeEventListener("mousemove", t(this, B));
|
|
85
|
-
}), document.addEventListener("touchend", (o) => {
|
|
86
|
-
g(this, M, !1), document.removeEventListener("touchmove", t(this, D));
|
|
87
|
-
});
|
|
88
|
-
}, "#init"));
|
|
89
|
-
h(this, tt, /* @__PURE__ */ l((e) => {
|
|
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);
|
|
91
|
-
}, "#track_onTouchStart"));
|
|
92
|
-
h(this, z, /* @__PURE__ */ l((e) => {
|
|
93
|
-
if (t(this, M) || e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftKey) return;
|
|
94
|
-
e.preventDefault();
|
|
95
|
-
var s = t(this, b).thumb.getBoundingClientRect();
|
|
96
|
-
const o = t(this, w).querySelector(".ng-container-body");
|
|
97
|
-
if (!o) return;
|
|
98
|
-
const n = o.clientHeight, i = e.clientY > s.y ? n : -n;
|
|
99
|
-
o.scrollTop += i, clearInterval(t(this, S)), clearInterval(t(this, R)), g(this, S, setInterval(() => {
|
|
100
|
-
clearInterval(t(this, S)), g(this, R, setInterval(() => {
|
|
101
|
-
var u = t(this, b).thumb.getBoundingClientRect();
|
|
102
|
-
e.clientY > u.y && e.clientY < u.y + u.height ? clearInterval(t(this, R)) : o.scrollTop += e.clientY > u.y ? n : -n;
|
|
103
|
-
}, 10));
|
|
104
|
-
}, 500));
|
|
105
|
-
}, "#track_onMouseDown"));
|
|
106
|
-
h(this, et, /* @__PURE__ */ l((e) => {
|
|
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));
|
|
108
|
-
}, "#thumb_onTouchStart"));
|
|
109
|
-
h(this, D, /* @__PURE__ */ l((e) => {
|
|
110
|
-
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, B).call(this, e);
|
|
111
|
-
}, "#thumb_onTouchMove"));
|
|
112
|
-
h(this, _, /* @__PURE__ */ l((e) => {
|
|
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));
|
|
114
|
-
}, "#thumb_onMouseDown"));
|
|
115
|
-
h(this, B, /* @__PURE__ */ l((e) => {
|
|
116
|
-
if (!t(this, M)) return;
|
|
117
|
-
e.preventDefault();
|
|
118
|
-
const s = this.trackHeight, o = t(this, N).call(this);
|
|
119
|
-
var n = e.clientY - this.shiftY;
|
|
120
|
-
n < 0 && (n = 0), n + o > s && (n = parseInt(s - o)), t(this, b).thumb.style.top = n + "px";
|
|
121
|
-
const i = t(this, w).querySelector(".ng-container-body");
|
|
122
|
-
if (!i) return;
|
|
123
|
-
const u = i.scrollHeight - i.clientHeight, y = s - o;
|
|
124
|
-
y > 0 && u > 0 && (i.scrollTop = n / y * u);
|
|
125
|
-
}, "#thumb_onMouseMove"));
|
|
126
|
-
h(this, N, /* @__PURE__ */ l(() => parseInt(t(this, b).thumb.dataset.height || 30, 10), "#getThumbHeight"));
|
|
127
|
-
}
|
|
128
|
-
connectedCallback() {
|
|
129
|
-
g(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(), g(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, V).call(this));
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
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");
|
|
142
|
-
let bt = xt;
|
|
143
|
-
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", bt);
|
|
144
|
-
var T, A, f, k, C, ot, nt, st, it, W, lt, O, j, K, F;
|
|
145
|
-
const wt = class wt extends HTMLElement {
|
|
146
|
-
constructor() {
|
|
147
|
-
super();
|
|
148
|
-
h(this, T);
|
|
149
|
-
h(this, A);
|
|
150
|
-
h(this, f);
|
|
151
|
-
h(this, k);
|
|
152
|
-
h(this, C);
|
|
153
|
-
h(this, ot);
|
|
154
|
-
h(this, nt, 0);
|
|
155
|
-
I(this, "refresh", /* @__PURE__ */ l(() => {
|
|
156
|
-
if (!t(this, T)) return;
|
|
157
|
-
const e = t(this, T).querySelector(".ng-container-body");
|
|
158
|
-
if (!e) return;
|
|
159
|
-
const s = $(t(this, f).thumb, this.shadowRoot), o = e.querySelector("table > thead");
|
|
160
|
-
t(this, T).getRowCount;
|
|
161
|
-
const n = $(t(this, f).track).height(), i = $(t(this, f).thumb).height(), u = t(this, T).getRowCount ? t(this, T).getRowCount() : 0;
|
|
162
|
-
if (u <= 10) {
|
|
163
|
-
$(this).hide();
|
|
164
|
-
return;
|
|
165
|
-
} else
|
|
166
|
-
$(this).show();
|
|
167
|
-
const y = o ? o.getBoundingClientRect().height : 0, a = Math.max(Math.min(n * (e.clientHeight - y) / (32 * u), n), 16);
|
|
168
|
-
s[0].dataset.height = a, s.css({ height: a });
|
|
169
|
-
const p = n - t(this, F).call(this);
|
|
170
|
-
if (p <= 0) return;
|
|
171
|
-
let r = 0;
|
|
172
|
-
const d = e.scrollHeight - e.clientHeight;
|
|
173
|
-
d > 0 && (r = parseInt(e.scrollTop / d * p, 10), r > n - i && (r = n - i), r < 0 && (r = 0)), t(this, f).thumb.style.top = r + "px", t(this, f).top.disabled = e.scrollTop <= 0, t(this, f).bottom.disabled = e.scrollTop >= d;
|
|
174
|
-
}, "refresh"));
|
|
175
|
-
I(this, "delayScroll", /* @__PURE__ */ l((e, s, o, n) => {
|
|
176
|
-
clearInterval(t(this, k)), clearInterval(t(this, C));
|
|
177
|
-
const i = t(this, T).querySelector(".ng-container-body");
|
|
178
|
-
i && (i.scrollTop += e * 32), g(this, k, setInterval(() => {
|
|
179
|
-
clearInterval(t(this, k)), g(this, C, setInterval(() => {
|
|
180
|
-
i && (i.scrollTop += e * 32, n && n.call());
|
|
181
|
-
}, o));
|
|
182
|
-
}, s));
|
|
183
|
-
}, "delayScroll"));
|
|
184
|
-
I(this, "stopScroll", /* @__PURE__ */ l(() => {
|
|
185
|
-
clearInterval(t(this, k)), clearInterval(t(this, C));
|
|
186
|
-
}, "stopScroll"));
|
|
187
|
-
h(this, st, /* @__PURE__ */ l(() => {
|
|
188
|
-
const e = /* @__PURE__ */ l((o) => {
|
|
189
|
-
clearInterval(t(this, k)), clearInterval(t(this, C));
|
|
190
|
-
const n = t(this, T).querySelector(".ng-container-body");
|
|
191
|
-
n && (n.scrollTop += o * 32), g(this, k, setInterval(() => {
|
|
192
|
-
clearInterval(t(this, k)), g(this, C, setInterval(() => {
|
|
193
|
-
n && (n.scrollTop += o * 32);
|
|
194
|
-
}, 10));
|
|
195
|
-
}, 500));
|
|
196
|
-
}, "delayScrollAction");
|
|
197
|
-
$(t(this, f).top).on("mousedown", (o) => {
|
|
198
|
-
o.buttons != 1 || o.altKey || o.ctrlKey || o.shiftKey || e(-1);
|
|
199
|
-
}), $(t(this, f).bottom).on("mousedown", (o) => {
|
|
200
|
-
o.buttons != 1 || o.altKey || o.ctrlKey || o.shiftKey || e(1);
|
|
201
|
-
}), $(t(this, f).top).on("touchstart", (o) => {
|
|
202
|
-
e(-1);
|
|
203
|
-
}), $(t(this, f).bottom).on("touchstart", (o) => {
|
|
204
|
-
e(1);
|
|
205
|
-
});
|
|
206
|
-
const s = /* @__PURE__ */ l(() => {
|
|
207
|
-
clearInterval(t(this, k)), clearInterval(t(this, C));
|
|
208
|
-
}, "clearTimer");
|
|
209
|
-
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) => {
|
|
210
|
-
t(this, A) && g(this, A, !1), document.removeEventListener("mousemove", t(this, K));
|
|
211
|
-
}), document.addEventListener("touchend", (o) => {
|
|
212
|
-
g(this, A, !1), document.removeEventListener("touchmove", t(this, O));
|
|
213
|
-
});
|
|
214
|
-
}, "#init"));
|
|
215
|
-
h(this, it, /* @__PURE__ */ l((e) => {
|
|
216
|
-
e.target.getBoundingClientRect(), e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, W).call(this, e);
|
|
217
|
-
}, "#track_onTouchStart"));
|
|
218
|
-
h(this, W, /* @__PURE__ */ l((e) => {
|
|
219
|
-
if (t(this, A) || e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftKey) return;
|
|
220
|
-
e.preventDefault();
|
|
221
|
-
var s = t(this, f).thumb.getBoundingClientRect();
|
|
222
|
-
const o = t(this, T).querySelector(".ng-container-body");
|
|
223
|
-
if (!o) return;
|
|
224
|
-
const n = o.clientHeight, i = e.clientY > s.y ? n : -n;
|
|
225
|
-
o.scrollTop += i, clearInterval(t(this, k)), clearInterval(t(this, C)), g(this, k, setInterval(() => {
|
|
226
|
-
clearInterval(t(this, k)), g(this, C, setInterval(() => {
|
|
227
|
-
var u = t(this, f).thumb.getBoundingClientRect();
|
|
228
|
-
e.clientY > u.y && e.clientY < u.y + u.height ? clearInterval(t(this, C)) : o.scrollTop += e.clientY > u.y ? n : -n;
|
|
229
|
-
}, 10));
|
|
230
|
-
}, 500));
|
|
231
|
-
}, "#track_onMouseDown"));
|
|
232
|
-
h(this, lt, /* @__PURE__ */ l((e) => {
|
|
233
|
-
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));
|
|
234
|
-
}, "#thumb_onTouchStart"));
|
|
235
|
-
h(this, O, /* @__PURE__ */ l((e) => {
|
|
236
|
-
e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY, e.buttons = 1, t(this, K).call(this, e);
|
|
237
|
-
}, "#thumb_onTouchMove"));
|
|
238
|
-
h(this, j, /* @__PURE__ */ l((e) => {
|
|
239
|
-
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));
|
|
240
|
-
}, "#thumb_onMouseDown"));
|
|
241
|
-
h(this, K, /* @__PURE__ */ l((e) => {
|
|
242
|
-
if (!t(this, A)) return;
|
|
243
|
-
e.preventDefault();
|
|
244
|
-
const s = this.trackHeight, o = t(this, F).call(this);
|
|
245
|
-
var n = e.clientY - this.shiftY;
|
|
246
|
-
n < 0 && (n = 0), n + o > s && (n = parseInt(s - o)), t(this, f).thumb.style.top = n + "px";
|
|
247
|
-
const i = t(this, T).querySelector(".ng-container-body");
|
|
248
|
-
if (!i) return;
|
|
249
|
-
const u = i.scrollHeight - i.clientHeight, y = s - o;
|
|
250
|
-
y > 0 && u > 0 && (i.scrollTop = n / y * u);
|
|
251
|
-
}, "#thumb_onMouseMove"));
|
|
252
|
-
h(this, F, /* @__PURE__ */ l(() => parseInt(t(this, f).thumb.dataset.height || 30, 10), "#getThumbHeight"));
|
|
253
|
-
}
|
|
254
|
-
connectedCallback() {
|
|
255
|
-
g(this, T, this.getRootNode().host), t(this, T) && (this.shadowRoot.innerHTML = `
|
|
256
|
-
<button class='ng-scroll-top' disabled><div class='ng-scroll-icon'></div></button>
|
|
257
|
-
<div class='ng-scroll-track'> <div class='ng-scroll-thumb'></div> </div>
|
|
258
|
-
<button class='ng-scroll-bottom'><div class='ng-scroll-icon'></div></button>
|
|
259
|
-
`, super.connectedCallback(), g(this, f, {
|
|
260
|
-
track: this.shadowRoot.querySelector(".ng-scroll-track"),
|
|
261
|
-
thumb: this.shadowRoot.querySelector(".ng-scroll-thumb"),
|
|
262
|
-
top: this.shadowRoot.querySelector(".ng-scroll-top"),
|
|
263
|
-
bottom: this.shadowRoot.querySelector(".ng-scroll-bottom")
|
|
264
|
-
}), t(this, st).call(this));
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
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");
|
|
268
|
-
let ft = wt;
|
|
269
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ft);
|
|
270
|
-
var Y, rt;
|
|
271
|
-
const X = class X extends HTMLElement {
|
|
272
|
-
constructor() {
|
|
273
|
-
super();
|
|
274
|
-
h(this, Y, null);
|
|
275
|
-
I(this, "init", /* @__PURE__ */ l((e) => {
|
|
276
|
-
if (!e) return;
|
|
277
|
-
const s = /* @__PURE__ */ l((a) => {
|
|
278
|
-
const p = /* @__PURE__ */ l((d) => {
|
|
279
|
-
if (d.querySelector("colgroup")) return;
|
|
280
|
-
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);
|
|
281
|
-
for (let H = 0; H < q; H++) {
|
|
282
|
-
const ut = document.createElement("col");
|
|
283
|
-
ut.setAttribute("width", E), x.appendChild(ut);
|
|
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);
|
|
284
32
|
}
|
|
285
|
-
|
|
286
|
-
}, "ensureColgroup"),
|
|
287
|
-
if (
|
|
288
|
-
const
|
|
289
|
-
|
|
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);
|
|
290
38
|
}, "ensureThead");
|
|
291
|
-
return
|
|
292
|
-
}, "initializeTable"),
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
const
|
|
296
|
-
return
|
|
297
|
-
const
|
|
298
|
-
(
|
|
299
|
-
}),
|
|
300
|
-
|
|
301
|
-
const
|
|
302
|
-
|
|
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();
|
|
303
51
|
});
|
|
304
|
-
}),
|
|
52
|
+
}), i;
|
|
305
53
|
}, "filterTableByFixed");
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
|
|
54
|
+
if (d) {
|
|
55
|
+
const n = p(a(this, S), null, !0);
|
|
56
|
+
d.innerHTML = "", d.appendChild(n);
|
|
309
57
|
}
|
|
310
|
-
if (
|
|
311
|
-
const
|
|
312
|
-
let
|
|
313
|
-
|
|
314
|
-
const
|
|
315
|
-
isNaN(
|
|
316
|
-
}),
|
|
317
|
-
const
|
|
318
|
-
|
|
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`;
|
|
319
67
|
}
|
|
320
|
-
if (
|
|
321
|
-
const
|
|
322
|
-
let
|
|
323
|
-
|
|
324
|
-
const
|
|
325
|
-
isNaN(
|
|
326
|
-
}),
|
|
327
|
-
const
|
|
328
|
-
|
|
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`;
|
|
329
77
|
}
|
|
330
|
-
if (
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
const
|
|
334
|
-
|
|
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);
|
|
335
83
|
});
|
|
336
84
|
}
|
|
337
|
-
|
|
85
|
+
$.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
338
86
|
}, "init"));
|
|
339
|
-
|
|
87
|
+
q(this, "getRowCount", /* @__PURE__ */ h(() => a(this, S) ? a(this, S).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
340
88
|
// 🎯 외부 스크롤바 및 컨트롤러 연동용 메서드
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
|
|
89
|
+
q(this, "scrollToX", /* @__PURE__ */ h((e) => {
|
|
90
|
+
const l = this.querySelector(".ng-container-body");
|
|
91
|
+
l && (l.scrollLeft = e);
|
|
344
92
|
}, "scrollToX"));
|
|
345
|
-
|
|
346
|
-
const
|
|
347
|
-
|
|
93
|
+
q(this, "scrollToY", /* @__PURE__ */ h((e) => {
|
|
94
|
+
const l = this.querySelector(".ng-container-body");
|
|
95
|
+
l && (l.scrollTop = e);
|
|
348
96
|
}, "scrollToY"));
|
|
349
|
-
|
|
350
|
-
const e =
|
|
97
|
+
w(this, R, /* @__PURE__ */ h(() => {
|
|
98
|
+
const e = k.SCROLLBAR_SIZE;
|
|
351
99
|
this.innerHTML = `
|
|
352
100
|
<style>
|
|
353
101
|
nine-table-sheet {
|
|
@@ -462,109 +210,109 @@ const X = class X extends HTMLElement {
|
|
|
462
210
|
}, "#render"));
|
|
463
211
|
}
|
|
464
212
|
connectedCallback() {
|
|
465
|
-
|
|
213
|
+
a(this, R).call(this);
|
|
466
214
|
}
|
|
467
215
|
disconnectedCallback() {
|
|
468
|
-
this.innerHTML = "",
|
|
216
|
+
this.innerHTML = "", $.log("NineTableSheet destroyed.");
|
|
469
217
|
}
|
|
470
218
|
};
|
|
471
|
-
|
|
472
|
-
let
|
|
473
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
474
|
-
var
|
|
475
|
-
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 {
|
|
476
224
|
constructor() {
|
|
477
225
|
super();
|
|
478
|
-
|
|
226
|
+
w(this, T, /* @__PURE__ */ h(() => {
|
|
479
227
|
const e = this.querySelector(".nine-tab-bar");
|
|
480
|
-
e && (e.addEventListener("click", (
|
|
481
|
-
const
|
|
482
|
-
if (!
|
|
483
|
-
const
|
|
484
|
-
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);
|
|
485
233
|
}), this.switchSheet(0, !1));
|
|
486
234
|
}, "#init"));
|
|
487
|
-
|
|
488
|
-
const
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
const
|
|
492
|
-
|
|
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");
|
|
493
241
|
});
|
|
494
|
-
}, "updateSplitters"),
|
|
495
|
-
if (!
|
|
496
|
-
if (!
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
}),
|
|
502
|
-
|
|
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);
|
|
503
251
|
});
|
|
504
252
|
else {
|
|
505
|
-
const
|
|
506
|
-
if (
|
|
253
|
+
const o = f[e], i = g.querySelectorAll(".nine-tab-item.active");
|
|
254
|
+
if (o.classList.contains("active") && i.length <= 1)
|
|
507
255
|
return;
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
|
|
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 = ""));
|
|
511
259
|
}
|
|
512
|
-
const
|
|
513
|
-
if (
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
(!
|
|
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`);
|
|
517
265
|
});
|
|
518
266
|
} else
|
|
519
|
-
|
|
520
|
-
|
|
267
|
+
n.forEach((o) => {
|
|
268
|
+
o.style.flex = "1 1 100%";
|
|
521
269
|
});
|
|
522
|
-
|
|
523
|
-
const
|
|
524
|
-
if (
|
|
525
|
-
const
|
|
526
|
-
|
|
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());
|
|
527
275
|
}
|
|
528
276
|
}, "switchSheet"));
|
|
529
277
|
}
|
|
530
278
|
connectedCallback() {
|
|
531
|
-
|
|
279
|
+
a(this, T).call(this);
|
|
532
280
|
}
|
|
533
281
|
};
|
|
534
|
-
|
|
535
|
-
let
|
|
536
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
537
|
-
var
|
|
538
|
-
const
|
|
539
|
-
constructor(
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
for (let
|
|
546
|
-
|
|
547
|
-
})),
|
|
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));
|
|
548
296
|
}, "#observeResize"));
|
|
549
|
-
|
|
550
|
-
var
|
|
551
|
-
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");
|
|
552
300
|
if (!e) return;
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
const
|
|
556
|
-
|
|
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");
|
|
557
305
|
}, "#applyAutoHeight"));
|
|
558
|
-
|
|
559
|
-
const
|
|
560
|
-
|
|
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 = `
|
|
561
309
|
<style>
|
|
562
310
|
:host {
|
|
563
311
|
display: flex;
|
|
564
312
|
flex-direction: column;
|
|
565
313
|
position: relative;
|
|
566
314
|
overflow: hidden;
|
|
567
|
-
height: ${
|
|
315
|
+
height: ${u ? "auto" : "100%"};
|
|
568
316
|
background: #fff;
|
|
569
317
|
}
|
|
570
318
|
nine-table-header { height: 40px; display: block; flex-shrink: 0; border-bottom: 1px solid #e5e7eb; background: #fff; }
|
|
@@ -645,9 +393,9 @@ const Tt = class Tt {
|
|
|
645
393
|
<nine-table-body>
|
|
646
394
|
<nine-table-summary></nine-table-summary>
|
|
647
395
|
<nine-table-sheets>
|
|
648
|
-
<nine-table-sheets-body>${
|
|
396
|
+
<nine-table-sheets-body>${g}</nine-table-sheets-body>
|
|
649
397
|
<nine-table-sheets-footer>
|
|
650
|
-
<div class="nine-tab-bar">${
|
|
398
|
+
<div class="nine-tab-bar">${d}</div>
|
|
651
399
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
652
400
|
</nine-table-sheets-footer>
|
|
653
401
|
</nine-table-sheets>
|
|
@@ -655,33 +403,33 @@ const Tt = class Tt {
|
|
|
655
403
|
</nine-table-body>
|
|
656
404
|
<nine-table-footer></nine-table-footer>
|
|
657
405
|
`;
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
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);
|
|
662
410
|
});
|
|
663
411
|
});
|
|
664
412
|
}, "#render"));
|
|
665
|
-
|
|
413
|
+
E(this, v, t), a(this, M).call(this), a(this, H).call(this);
|
|
666
414
|
}
|
|
667
415
|
};
|
|
668
|
-
|
|
669
|
-
let
|
|
670
|
-
var
|
|
671
|
-
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 {
|
|
672
420
|
constructor() {
|
|
673
421
|
super();
|
|
674
|
-
|
|
422
|
+
w(this, L, !1);
|
|
675
423
|
this.attachShadow({ mode: "open" });
|
|
676
424
|
}
|
|
677
425
|
connectedCallback() {
|
|
678
|
-
|
|
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 } })));
|
|
679
427
|
}
|
|
680
428
|
disconnectedCallback() {
|
|
681
|
-
|
|
429
|
+
$.log("NineTable disconnected.");
|
|
682
430
|
}
|
|
683
431
|
};
|
|
684
|
-
|
|
685
|
-
let
|
|
686
|
-
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);
|
|
687
435
|
//# sourceMappingURL=nine-table.js.map
|