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