@ninebone/table 0.0.379 β 0.0.382
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 +442 -441
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +6 -6
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var xe = Object.defineProperty;
|
|
2
|
+
var ve = (x) => {
|
|
3
|
+
throw TypeError(x);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var a = (
|
|
7
|
-
var
|
|
8
|
-
var t = (
|
|
9
|
-
var
|
|
10
|
-
set _(
|
|
11
|
-
|
|
5
|
+
var Ee = (x, i, e) => i in x ? xe(x, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : x[i] = e;
|
|
6
|
+
var a = (x, i) => xe(x, "name", { value: i, configurable: !0 });
|
|
7
|
+
var v = (x, i, e) => Ee(x, typeof i != "symbol" ? i + "" : i, e), we = (x, i, e) => i.has(x) || ve("Cannot " + e);
|
|
8
|
+
var t = (x, i, e) => (we(x, i, "read from private field"), e ? e.call(x) : i.get(x)), c = (x, i, e) => i.has(x) ? ve("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(x) : i.set(x, e), g = (x, i, e, s) => (we(x, i, "write to private field"), s ? s.call(x, e) : i.set(x, e), e);
|
|
9
|
+
var Se = (x, i, e, s) => ({
|
|
10
|
+
set _(n) {
|
|
11
|
+
g(x, i, n, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return t(
|
|
14
|
+
return t(x, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
import { trace as
|
|
18
|
-
const ne = class ne extends
|
|
17
|
+
import { trace as Re } from "@ninebone/util";
|
|
18
|
+
const ne = class ne extends Re.constructor {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
a(ne, "Trace");
|
|
24
24
|
let Ut = ne;
|
|
25
|
-
const
|
|
26
|
-
var I,
|
|
25
|
+
const z = new Ut();
|
|
26
|
+
var I, D, p, Y, X, U, vt, F, wt;
|
|
27
27
|
const oe = class oe extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
c(this, I);
|
|
31
|
-
c(this,
|
|
31
|
+
c(this, D, !1);
|
|
32
32
|
c(this, p);
|
|
33
|
-
c(this, P);
|
|
34
|
-
c(this, V);
|
|
35
33
|
c(this, Y);
|
|
34
|
+
c(this, X);
|
|
35
|
+
c(this, U);
|
|
36
36
|
c(this, vt, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!t(this, I)) return;
|
|
38
38
|
const e = t(this, I).querySelector(".ng-container-body");
|
|
39
|
-
e && (
|
|
39
|
+
e && (g(this, U, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), t(this,
|
|
41
|
+
})), t(this, U).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
|
-
|
|
44
|
-
if (!t(this, I) || !t(this, p) || t(this,
|
|
43
|
+
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
+
if (!t(this, I) || !t(this, p) || t(this, D)) return;
|
|
45
45
|
const e = t(this, p).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const
|
|
48
|
-
if (l !== 0 &&
|
|
49
|
-
|
|
47
|
+
const n = t(this, p).track, r = t(this, p).thumb, o = t(this, I).querySelector(".ng-container-bottom"), l = e.clientWidth, d = s.scrollWidth;
|
|
48
|
+
if (l !== 0 && d > l)
|
|
49
|
+
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
51
|
-
|
|
51
|
+
o && (o.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const f = Math.max(Math.min(
|
|
54
|
+
const h = n.clientWidth;
|
|
55
|
+
if (h <= 0) return;
|
|
56
|
+
const f = Math.max(Math.min(h * (l / d), h), 20);
|
|
57
57
|
r.style.width = `${f}px`;
|
|
58
|
-
const u = e.scrollLeft,
|
|
58
|
+
const u = e.scrollLeft, b = d - l;
|
|
59
59
|
let y = 0;
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
y >
|
|
60
|
+
b > 0 && (y = parseInt(u / b * (h - f), 10)), y < 0 && (y = 0);
|
|
61
|
+
const m = h - f;
|
|
62
|
+
y > m && (y = m), r.style.left = `${y}px`, z.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
c(this,
|
|
64
|
+
c(this, F, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
66
|
-
const s = t(this, p).container,
|
|
67
|
-
if (!
|
|
68
|
-
const r = t(this, p).track.getBoundingClientRect(),
|
|
66
|
+
const s = t(this, p).container, n = s.querySelector("table");
|
|
67
|
+
if (!n) return !1;
|
|
68
|
+
const r = t(this, p).track.getBoundingClientRect(), o = t(this, p).thumb.clientWidth;
|
|
69
69
|
let l = e;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
|
-
const
|
|
72
|
-
l >
|
|
73
|
-
const
|
|
74
|
-
return
|
|
71
|
+
const d = r.width - o;
|
|
72
|
+
l > d && (l = d), l = parseInt(l, 10), t(this, p).thumb.style.left = `${l}px`, t(this, p).left.disabled = l === 0, t(this, p).right.disabled = l >= d - 1;
|
|
73
|
+
const h = s.clientWidth, u = n.scrollWidth - h;
|
|
74
|
+
return d > 0 && u > 0 && (s.scrollLeft = l / d * u), l > 0 && l < d - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
c(this, wt, /* @__PURE__ */ a(() => {
|
|
77
|
-
const e = /* @__PURE__ */ a((
|
|
78
|
-
clearInterval(t(this,
|
|
77
|
+
const e = /* @__PURE__ */ a((n) => {
|
|
78
|
+
clearInterval(t(this, Y)), clearInterval(t(this, X));
|
|
79
79
|
const r = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
80
|
-
t(this,
|
|
81
|
-
clearInterval(t(this,
|
|
82
|
-
const
|
|
83
|
-
t(this,
|
|
80
|
+
t(this, F).call(this, r + n), g(this, Y, setInterval(() => {
|
|
81
|
+
clearInterval(t(this, Y)), g(this, X, setInterval(() => {
|
|
82
|
+
const o = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
83
|
+
t(this, F).call(this, o + n) || clearInterval(t(this, X));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
87
|
-
clearInterval(t(this,
|
|
87
|
+
clearInterval(t(this, Y)), clearInterval(t(this, X));
|
|
88
88
|
}, "clearTimer");
|
|
89
|
-
["mouseup", "mouseleave", "touchend"].forEach((
|
|
90
|
-
t(this, p).left.addEventListener(
|
|
91
|
-
}), t(this, p).left.addEventListener("mousedown", (
|
|
92
|
-
|
|
93
|
-
}), t(this, p).right.addEventListener("mousedown", (
|
|
94
|
-
|
|
95
|
-
}), t(this, p).left.addEventListener("touchstart", () => e(-20)), t(this, p).right.addEventListener("touchstart", () => e(20)), t(this, p).track.addEventListener("mousedown", (
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
const r = t(this, p).track.getBoundingClientRect(),
|
|
99
|
-
t(this,
|
|
100
|
-
}), t(this, p).thumb.addEventListener("mousedown", (
|
|
101
|
-
if (
|
|
102
|
-
|
|
89
|
+
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
90
|
+
t(this, p).left.addEventListener(n, s), t(this, p).right.addEventListener(n, s), t(this, p).track.addEventListener(n, s);
|
|
91
|
+
}), t(this, p).left.addEventListener("mousedown", (n) => {
|
|
92
|
+
n.button === 0 && e(-20);
|
|
93
|
+
}), t(this, p).right.addEventListener("mousedown", (n) => {
|
|
94
|
+
n.button === 0 && e(20);
|
|
95
|
+
}), t(this, p).left.addEventListener("touchstart", () => e(-20)), t(this, p).right.addEventListener("touchstart", () => e(20)), t(this, p).track.addEventListener("mousedown", (n) => {
|
|
96
|
+
if (n.button !== 0) return;
|
|
97
|
+
n.preventDefault();
|
|
98
|
+
const r = t(this, p).track.getBoundingClientRect(), o = t(this, p).thumb.clientWidth;
|
|
99
|
+
t(this, F).call(this, n.clientX - r.left - o / 2);
|
|
100
|
+
}), t(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
101
|
+
if (n.button !== 0) return;
|
|
102
|
+
n.stopPropagation(), n.preventDefault(), g(this, D, !0), this.shiftX = n.clientX - t(this, p).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ a((l) => {
|
|
104
|
-
if (!t(this,
|
|
105
|
-
const
|
|
106
|
-
t(this,
|
|
107
|
-
}, "onMouseMove"),
|
|
108
|
-
|
|
104
|
+
if (!t(this, D)) return;
|
|
105
|
+
const d = t(this, p).track.getBoundingClientRect();
|
|
106
|
+
t(this, F).call(this, l.clientX - d.left - this.shiftX);
|
|
107
|
+
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
108
|
+
g(this, D, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup",
|
|
110
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
111
111
|
});
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (
|
|
115
|
+
if (g(this, I, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, I)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -182,95 +182,96 @@ const oe = class oe extends HTMLElement {
|
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
|
|
185
|
+
g(this, p, {
|
|
186
186
|
container: s,
|
|
187
187
|
track: this.querySelector(".ng-scroll-track"),
|
|
188
188
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
189
189
|
left: this.querySelector(".ng-scroll-left"),
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), s.addEventListener("scroll", () => {
|
|
192
|
-
t(this,
|
|
192
|
+
t(this, D) || this.refresh();
|
|
193
193
|
}), t(this, wt).call(this), t(this, vt).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
196
196
|
}
|
|
197
197
|
disconnectedCallback() {
|
|
198
|
-
t(this,
|
|
198
|
+
t(this, U) && t(this, U).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
I = new WeakMap(),
|
|
201
|
+
I = new WeakMap(), D = new WeakMap(), p = new WeakMap(), Y = new WeakMap(), X = new WeakMap(), U = new WeakMap(), vt = new WeakMap(), F = new WeakMap(), wt = new WeakMap(), a(oe, "NineTableHScrollBar");
|
|
202
202
|
let Ft = oe;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Ft);
|
|
204
|
-
var
|
|
204
|
+
var L, B, S, at, ct, St;
|
|
205
205
|
const re = class re extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
|
-
c(this,
|
|
209
|
-
c(this,
|
|
210
|
-
c(this,
|
|
208
|
+
c(this, L);
|
|
209
|
+
c(this, B, !1);
|
|
210
|
+
c(this, S);
|
|
211
211
|
c(this, at, 0);
|
|
212
212
|
c(this, ct, 0);
|
|
213
213
|
/**
|
|
214
214
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
215
215
|
*/
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
r.style.display = "none", t(this, w).top.disabled = !0, t(this, w).bottom.disabled = !0;
|
|
216
|
+
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
217
|
+
var O, ge, be, ye, pe, me;
|
|
218
|
+
if (!t(this, L) || !t(this, S) || t(this, B)) return;
|
|
219
|
+
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, o = ((ge = (O = t(this, L).host) == null ? void 0 : O.data) == null ? void 0 : ge.get()) || ((ye = (be = t(this, L)._host) == null ? void 0 : be.data) == null ? void 0 : ye.get()) || [], l = o.length > 0 ? o.length : 61, d = ((me = (pe = t(this, L)).getRowHeight) == null ? void 0 : me.call(pe)) || 85, h = l * d;
|
|
220
|
+
if (h <= r) {
|
|
221
|
+
n.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
223
222
|
return;
|
|
224
223
|
} else
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
let
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
|
|
224
|
+
n.style.display = "block";
|
|
225
|
+
const f = s.clientHeight;
|
|
226
|
+
if (f <= 0) return;
|
|
227
|
+
const u = Math.max(Math.min(f * (r / h), f), 20);
|
|
228
|
+
n.style.height = `${u}px`;
|
|
229
|
+
const b = e.scrollTop, y = h - r;
|
|
230
|
+
let m = 0;
|
|
231
|
+
y > 0 && (m = b / y * (f - u));
|
|
232
|
+
const R = f - u;
|
|
233
|
+
m < 0 && (m = 0), m > R && (m = R), n.style.top = `${m}px`, t(this, S).top.disabled = b <= 0, t(this, S).bottom.disabled = b >= y - 1;
|
|
235
234
|
}, "refresh"));
|
|
236
235
|
c(this, St, /* @__PURE__ */ a(() => {
|
|
237
|
-
const e = t(this,
|
|
236
|
+
const e = t(this, S).container, s = /* @__PURE__ */ a(() => {
|
|
237
|
+
var l, d, h, f, u, b;
|
|
238
|
+
const n = ((d = (l = t(this, L).host) == null ? void 0 : l.data) == null ? void 0 : d.get()) || ((f = (h = t(this, L)._host) == null ? void 0 : h.data) == null ? void 0 : f.get()) || [], r = n.length > 0 ? n.length : 61, o = ((b = (u = t(this, L)).getRowHeight) == null ? void 0 : b.call(u)) || 85;
|
|
239
|
+
return r * o;
|
|
240
|
+
}, "getContentHeight");
|
|
238
241
|
e.addEventListener("scroll", () => {
|
|
239
|
-
t(this,
|
|
240
|
-
}), t(this,
|
|
241
|
-
if (
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
if (!t(this,
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
const J = u / f * A;
|
|
250
|
-
e.scrollTop = t(this, ct) + J;
|
|
242
|
+
t(this, B) || this.refresh();
|
|
243
|
+
}), t(this, S).thumb.addEventListener("mousedown", (n) => {
|
|
244
|
+
if (n.button !== 0) return;
|
|
245
|
+
n.stopPropagation(), n.preventDefault(), g(this, B, !0), g(this, at, n.clientY), g(this, ct, e.scrollTop);
|
|
246
|
+
const r = /* @__PURE__ */ a((l) => {
|
|
247
|
+
if (!t(this, B)) return;
|
|
248
|
+
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h, b = l.clientY - t(this, at), y = e.clientHeight, R = s() - y;
|
|
249
|
+
if (u > 0 && R > 0) {
|
|
250
|
+
const O = b / u * R;
|
|
251
|
+
e.scrollTop = t(this, ct) + O;
|
|
251
252
|
}
|
|
252
253
|
this.refresh();
|
|
253
|
-
}, "onMouseMove"),
|
|
254
|
-
|
|
254
|
+
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
255
|
+
g(this, B, !1), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
255
256
|
}, "onMouseUp");
|
|
256
|
-
document.addEventListener("mousemove",
|
|
257
|
-
}), t(this,
|
|
258
|
-
if (
|
|
259
|
-
const
|
|
260
|
-
if (h > 0 &&
|
|
261
|
-
const
|
|
262
|
-
e.scrollTop =
|
|
257
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
258
|
+
}), t(this, S).track.addEventListener("mousedown", (n) => {
|
|
259
|
+
if (n.button !== 0 || n.target === t(this, S).thumb) return;
|
|
260
|
+
const r = t(this, S).track.getBoundingClientRect(), o = t(this, S).thumb.clientHeight, l = n.clientY - r.top - o / 2, h = r.height - o, f = e.clientHeight, b = s() - f;
|
|
261
|
+
if (h > 0 && b > 0) {
|
|
262
|
+
const y = Math.max(0, Math.min(1, l / h));
|
|
263
|
+
e.scrollTop = y * b;
|
|
263
264
|
}
|
|
264
265
|
this.refresh();
|
|
265
|
-
}), t(this,
|
|
266
|
+
}), t(this, S).top.addEventListener("click", () => {
|
|
266
267
|
e.scrollTop -= 40;
|
|
267
|
-
}), t(this,
|
|
268
|
+
}), t(this, S).bottom.addEventListener("click", () => {
|
|
268
269
|
e.scrollTop += 40;
|
|
269
270
|
});
|
|
270
271
|
}, "#init"));
|
|
271
272
|
}
|
|
272
273
|
connectedCallback() {
|
|
273
|
-
if (
|
|
274
|
+
if (g(this, L, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, L)) return;
|
|
274
275
|
this.innerHTML = `
|
|
275
276
|
<style>
|
|
276
277
|
nine-table-vscrollbar {
|
|
@@ -335,12 +336,12 @@ const re = class re extends HTMLElement {
|
|
|
335
336
|
<button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
|
|
336
337
|
`;
|
|
337
338
|
const e = /* @__PURE__ */ a(() => {
|
|
338
|
-
const s = t(this,
|
|
339
|
+
const s = t(this, L).querySelector(".ng-container-body");
|
|
339
340
|
if (!s) {
|
|
340
341
|
setTimeout(e, 10);
|
|
341
342
|
return;
|
|
342
343
|
}
|
|
343
|
-
|
|
344
|
+
g(this, S, {
|
|
344
345
|
container: s,
|
|
345
346
|
track: this.querySelector(".ng-scroll-track"),
|
|
346
347
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
@@ -351,7 +352,7 @@ const re = class re extends HTMLElement {
|
|
|
351
352
|
e();
|
|
352
353
|
}
|
|
353
354
|
};
|
|
354
|
-
|
|
355
|
+
L = new WeakMap(), B = new WeakMap(), S = new WeakMap(), at = new WeakMap(), ct = new WeakMap(), St = new WeakMap(), a(re, "NineTableVScrollBar");
|
|
355
356
|
let jt = re;
|
|
356
357
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", jt);
|
|
357
358
|
var Et, Q;
|
|
@@ -366,12 +367,12 @@ const _ = class _ {
|
|
|
366
367
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
367
368
|
*/
|
|
368
369
|
static compile(i) {
|
|
369
|
-
var
|
|
370
|
+
var n, r, o, l;
|
|
370
371
|
if (!i) return null;
|
|
371
372
|
const e = i.cloneNode(!0);
|
|
372
|
-
return t(
|
|
373
|
-
const f =
|
|
374
|
-
f && e.querySelectorAll(`thead [data-col="${
|
|
373
|
+
return t(n = _, Et).call(n, e), t(r = _, Q).call(r, e, "thead"), t(o = _, Q).call(o, e, "tbody"), t(l = _, Q).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((d, h) => {
|
|
374
|
+
const f = d.getAttribute("fixed");
|
|
375
|
+
f && e.querySelectorAll(`thead [data-col="${h}"], tbody [data-col="${h}"], tfoot [data-col="${h}"]`).forEach((u) => {
|
|
375
376
|
u.setAttribute("fixed", f);
|
|
376
377
|
});
|
|
377
378
|
}), e;
|
|
@@ -379,12 +380,12 @@ const _ = class _ {
|
|
|
379
380
|
};
|
|
380
381
|
Et = new WeakMap(), Q = new WeakMap(), a(_, "TableCompiler"), c(_, Et, /* @__PURE__ */ a((i) => {
|
|
381
382
|
if (!i.querySelector("colgroup")) {
|
|
382
|
-
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1,
|
|
383
|
-
for (let
|
|
383
|
+
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
384
|
+
for (let o = 0; o < s; o++) {
|
|
384
385
|
const l = document.createElement("col");
|
|
385
|
-
l.setAttribute("width", r),
|
|
386
|
+
l.setAttribute("width", r), n.appendChild(l);
|
|
386
387
|
}
|
|
387
|
-
i.prepend(
|
|
388
|
+
i.prepend(n);
|
|
388
389
|
}
|
|
389
390
|
if (!i.querySelector("thead")) {
|
|
390
391
|
const e = document.createElement("thead"), s = i.querySelector("colgroup");
|
|
@@ -392,272 +393,272 @@ Et = new WeakMap(), Q = new WeakMap(), a(_, "TableCompiler"), c(_, Et, /* @__PUR
|
|
|
392
393
|
}
|
|
393
394
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
394
395
|
}, "#ensureTableStructure")), c(_, Q, /* @__PURE__ */ a((i, e) => {
|
|
395
|
-
const s = Array.from(i.querySelectorAll(e + " tr")),
|
|
396
|
-
if (r === 0 ||
|
|
397
|
-
let
|
|
398
|
-
|
|
399
|
-
|
|
396
|
+
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
397
|
+
if (r === 0 || n.length === 0) return;
|
|
398
|
+
let o = 0;
|
|
399
|
+
n.forEach((d) => {
|
|
400
|
+
o += d.colSpan || 1;
|
|
400
401
|
});
|
|
401
|
-
const l = Array.from(Array(r), () => Array(
|
|
402
|
-
s.forEach((
|
|
403
|
-
const
|
|
402
|
+
const l = Array.from(Array(r), () => Array(o).fill(null));
|
|
403
|
+
s.forEach((d) => {
|
|
404
|
+
const h = d.sectionRowIndex;
|
|
404
405
|
let f = 0;
|
|
405
|
-
Array.from(
|
|
406
|
-
for (let
|
|
407
|
-
if (l[
|
|
408
|
-
f =
|
|
406
|
+
Array.from(d.querySelectorAll("th,td")).forEach((u) => {
|
|
407
|
+
for (let m = 0; m < l[h].length; m++)
|
|
408
|
+
if (l[h][m] === null) {
|
|
409
|
+
f = m;
|
|
409
410
|
break;
|
|
410
411
|
}
|
|
411
|
-
const
|
|
412
|
-
for (let
|
|
413
|
-
for (let
|
|
414
|
-
|
|
412
|
+
const b = u.rowSpan || 1, y = u.colSpan || 1;
|
|
413
|
+
for (let m = 0; m < b; m++)
|
|
414
|
+
for (let R = 0; R < y; R++)
|
|
415
|
+
h + m < r && f + R < o && (l[h + m][f + R] = m === 0 && R === 0 ? "1" : "0");
|
|
415
416
|
});
|
|
416
|
-
}), s.forEach((
|
|
417
|
-
const
|
|
418
|
-
Array.from(
|
|
419
|
-
for (let u = 0; u < l[
|
|
420
|
-
if (l[
|
|
421
|
-
f.dataset.col = u, l[
|
|
417
|
+
}), s.forEach((d) => {
|
|
418
|
+
const h = d.sectionRowIndex;
|
|
419
|
+
Array.from(d.querySelectorAll("th,td")).forEach((f) => {
|
|
420
|
+
for (let u = 0; u < l[h].length; u++)
|
|
421
|
+
if (l[h][u] === "1") {
|
|
422
|
+
f.dataset.col = u, l[h][u] = "0";
|
|
422
423
|
break;
|
|
423
424
|
}
|
|
424
425
|
});
|
|
425
426
|
});
|
|
426
427
|
}, "#resetColIndex"));
|
|
427
428
|
let Kt = _;
|
|
428
|
-
var M,
|
|
429
|
+
var M, w, W, T, N, j, P, tt, Rt, At, Tt, ht, dt, qt, kt, ft, Lt, et, ut;
|
|
429
430
|
const le = class le {
|
|
430
431
|
constructor(i) {
|
|
431
432
|
c(this, M);
|
|
432
|
-
c(this,
|
|
433
|
+
c(this, w);
|
|
433
434
|
c(this, W, /* @__PURE__ */ new Map());
|
|
434
|
-
c(this,
|
|
435
|
-
c(this,
|
|
436
|
-
c(this,
|
|
437
|
-
c(this,
|
|
435
|
+
c(this, T, null);
|
|
436
|
+
c(this, N, null);
|
|
437
|
+
c(this, j, 0);
|
|
438
|
+
c(this, P, 40);
|
|
438
439
|
c(this, tt, !1);
|
|
439
440
|
c(this, Rt, 3);
|
|
440
|
-
|
|
441
|
+
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
441
442
|
var e;
|
|
442
|
-
const i = t(this,
|
|
443
|
-
i && (t(this, ht).call(this), t(this, et).call(this, i.scrollTop), (e = t(this,
|
|
443
|
+
const i = t(this, w).querySelector(".ng-container-body");
|
|
444
|
+
i && (t(this, ht).call(this), t(this, et).call(this, i.scrollTop), (e = t(this, w).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
444
445
|
}, "refresh"));
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
const r = t(this,
|
|
446
|
+
v(this, "initialize", /* @__PURE__ */ a(() => {
|
|
447
|
+
g(this, T, null), t(this, W).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
448
|
+
const r = t(this, w).querySelector(n);
|
|
448
449
|
if (!r) return;
|
|
449
|
-
const
|
|
450
|
-
if (!
|
|
451
|
-
const l =
|
|
450
|
+
const o = r.querySelector("table");
|
|
451
|
+
if (!o) return;
|
|
452
|
+
const l = o.querySelector("tbody.bindable-tbody");
|
|
452
453
|
if (!l) return;
|
|
453
|
-
const
|
|
454
|
-
t(this, W).set(
|
|
454
|
+
const h = Array.from(l.querySelectorAll("tr")).map((f) => f.cloneNode(!0));
|
|
455
|
+
t(this, W).set(n, h);
|
|
455
456
|
});
|
|
456
|
-
const i = t(this,
|
|
457
|
+
const i = t(this, w).querySelector(".ng-container-body"), e = t(this, w).querySelector(".ng-container-left"), s = t(this, w).querySelector(".ng-container-right");
|
|
457
458
|
if (i) {
|
|
458
|
-
t(this,
|
|
459
|
-
let
|
|
460
|
-
const r = /* @__PURE__ */ a((
|
|
459
|
+
t(this, Tt).call(this, i), t(this, ft).call(this), t(this, ht).call(this), t(this, et).call(this, i.scrollTop);
|
|
460
|
+
let n = i.scrollTop;
|
|
461
|
+
const r = /* @__PURE__ */ a((o) => {
|
|
461
462
|
var l;
|
|
462
|
-
e && e.scrollTop !==
|
|
463
|
+
e && e.scrollTop !== o && (e.scrollTop = o), s && s.scrollTop !== o && (s.scrollTop = o), t(this, et).call(this, o), (l = t(this, w).querySelector("nine-table-vscrollbar")) == null || l.refresh();
|
|
463
464
|
}, "syncScroll");
|
|
464
465
|
i.addEventListener("scroll", () => {
|
|
465
|
-
const
|
|
466
|
-
|
|
466
|
+
const o = i.scrollTop;
|
|
467
|
+
n !== o && (n = o, r(o));
|
|
467
468
|
});
|
|
468
469
|
}
|
|
469
470
|
}, "initialize"));
|
|
470
471
|
c(this, At, /* @__PURE__ */ a((i, e) => {
|
|
471
472
|
const s = t(this, W).get(e);
|
|
472
473
|
if (!s || s.length === 0) return;
|
|
473
|
-
const
|
|
474
|
-
if (!
|
|
475
|
-
|
|
476
|
-
const r =
|
|
477
|
-
for (let l = 0; l < t(this,
|
|
478
|
-
s.forEach((
|
|
479
|
-
|
|
474
|
+
const n = i.querySelector("tbody.bindable-tbody");
|
|
475
|
+
if (!n) return;
|
|
476
|
+
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
477
|
+
const r = n.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
478
|
+
for (let l = 0; l < t(this, P); l++)
|
|
479
|
+
s.forEach((d) => {
|
|
480
|
+
o.appendChild(d.cloneNode(!0));
|
|
480
481
|
});
|
|
481
|
-
r ? r.before(
|
|
482
|
+
r ? r.before(o) : n.appendChild(o);
|
|
482
483
|
}, "#renderRows"));
|
|
483
|
-
c(this,
|
|
484
|
-
if (t(this,
|
|
485
|
-
return t(this,
|
|
484
|
+
c(this, Tt, /* @__PURE__ */ a((i) => {
|
|
485
|
+
if (t(this, T) !== null && t(this, T) > 0)
|
|
486
|
+
return t(this, T);
|
|
486
487
|
const e = t(this, W).get(".ng-container-body");
|
|
487
488
|
if (!e || e.length === 0) return 24;
|
|
488
489
|
const s = i.querySelector("tbody.bindable-tbody") || i.querySelector("tbody.bindable-tbody:last-of-type");
|
|
489
490
|
if (!s) return 24;
|
|
490
|
-
s.querySelectorAll("tr:not(.nodata)").forEach((
|
|
491
|
-
const
|
|
492
|
-
e.forEach((
|
|
493
|
-
r.appendChild(
|
|
494
|
-
}),
|
|
495
|
-
const
|
|
496
|
-
(l === "none" || window.getComputedStyle(
|
|
491
|
+
s.querySelectorAll("tr:not(.nodata)").forEach((b) => b.remove());
|
|
492
|
+
const n = s.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
493
|
+
e.forEach((b) => {
|
|
494
|
+
r.appendChild(b.cloneNode(!0));
|
|
495
|
+
}), n ? n.before(r) : s.appendChild(r);
|
|
496
|
+
const o = t(this, w), l = o.style.display, d = o.style.visibility, h = o.style.position;
|
|
497
|
+
(l === "none" || window.getComputedStyle(o).display === "none") && (o.style.display = "block", o.style.visibility = "hidden", o.style.position = "absolute");
|
|
497
498
|
let f = 0;
|
|
498
499
|
const u = s.querySelectorAll("tr:not(.nodata)");
|
|
499
|
-
return u.forEach((
|
|
500
|
-
f +=
|
|
501
|
-
}), u.forEach((
|
|
500
|
+
return u.forEach((b) => {
|
|
501
|
+
f += b.offsetHeight || b.getBoundingClientRect().height;
|
|
502
|
+
}), u.forEach((b) => b.remove()), o.style.display = l, o.style.visibility = d, o.style.position = h, g(this, T, f > 0 ? f : 24), t(this, dt).call(this), t(this, T);
|
|
502
503
|
}, "#measureAndCacheHeight"));
|
|
503
504
|
c(this, ht, /* @__PURE__ */ a(() => {
|
|
504
|
-
if (!t(this,
|
|
505
|
-
const s = (t(this, M).data.get() || []).length,
|
|
506
|
-
|
|
507
|
-
const l = t(this,
|
|
508
|
-
|
|
505
|
+
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
506
|
+
const s = (t(this, M).data.get() || []).length, n = t(this, T) || 24, r = s * n;
|
|
507
|
+
z.log(`[VirtualHeight] totalCount: ${s}, rowHeight: ${n}, totalVirtualHeight: ${r}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
508
|
+
const l = t(this, w).querySelector(o), d = l == null ? void 0 : l.querySelector("table");
|
|
509
|
+
d && (d.style.height = `${r}px`);
|
|
509
510
|
});
|
|
510
511
|
}, "#updateVirtualScrollHeight"));
|
|
511
512
|
c(this, dt, /* @__PURE__ */ a(() => {
|
|
512
|
-
if ((t(this, M).data.get() || []).length, t(this,
|
|
513
|
-
const e = Math.ceil(t(this,
|
|
514
|
-
|
|
513
|
+
if ((t(this, M).data.get() || []).length, t(this, j) > 0 && t(this, T) > 0) {
|
|
514
|
+
const e = Math.ceil(t(this, j) / t(this, T));
|
|
515
|
+
g(this, P, e + t(this, Rt)), z.log("visibleRows:", e, "cachedRowCount:", t(this, P));
|
|
515
516
|
}
|
|
516
517
|
}, "#updateRowCount"));
|
|
517
|
-
c(this,
|
|
518
|
-
var
|
|
519
|
-
const i = t(this,
|
|
518
|
+
c(this, qt, /* @__PURE__ */ a(() => {
|
|
519
|
+
var d, h, f;
|
|
520
|
+
const i = t(this, w).querySelector(".ng-container-left table"), e = t(this, w).querySelector(".ng-container-body table"), s = t(this, w).querySelector(".ng-container-right table");
|
|
520
521
|
if (!e) return;
|
|
521
|
-
const
|
|
522
|
+
const n = i ? Array.from(i.querySelectorAll("tr")) : [], r = Array.from(e.querySelectorAll("tr")), o = s ? Array.from(s.querySelectorAll("tr")) : [], l = Math.max(n.length, r.length, o.length);
|
|
522
523
|
for (let u = 0; u < l; u++) {
|
|
523
|
-
const
|
|
524
|
-
((
|
|
525
|
-
((
|
|
526
|
-
((f =
|
|
527
|
-
], y = Math.max(...
|
|
528
|
-
y > 0 && (
|
|
524
|
+
const b = [
|
|
525
|
+
((d = n[u]) == null ? void 0 : d.getBoundingClientRect().height) || 0,
|
|
526
|
+
((h = r[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
527
|
+
((f = o[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
528
|
+
], y = Math.max(...b);
|
|
529
|
+
y > 0 && (n[u] && (n[u].style.height = `${y}px`), r[u] && (r[u].style.height = `${y}px`), o[u] && (o[u].style.height = `${y}px`));
|
|
529
530
|
}
|
|
530
531
|
}, "#syncRowHeights"));
|
|
531
532
|
c(this, kt, /* @__PURE__ */ a(() => {
|
|
532
|
-
!t(this,
|
|
533
|
+
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (g(this, N, new ResizeObserver((i) => {
|
|
533
534
|
for (const e of i) {
|
|
534
535
|
const s = e.target;
|
|
535
536
|
if (!s.classList.contains("active")) continue;
|
|
536
|
-
const
|
|
537
|
-
if (
|
|
537
|
+
const n = e.contentRect.height;
|
|
538
|
+
if (n > 0) {
|
|
538
539
|
let r = 0;
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
const l = Math.max(
|
|
542
|
-
t(this,
|
|
540
|
+
const o = s.querySelector("thead");
|
|
541
|
+
o && (r += o.offsetHeight || o.getBoundingClientRect().height);
|
|
542
|
+
const l = Math.max(n - r, 100);
|
|
543
|
+
t(this, j) !== l && (g(this, j, l), t(this, dt).call(this), t(this, T) !== null && t(this, ft).call(this));
|
|
543
544
|
}
|
|
544
545
|
}
|
|
545
|
-
})), t(this,
|
|
546
|
+
})), t(this, N).observe(t(this, w)));
|
|
546
547
|
}, "#initResizeObserver"));
|
|
547
548
|
c(this, ft, /* @__PURE__ */ a(() => {
|
|
548
549
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
549
|
-
const e = t(this,
|
|
550
|
+
const e = t(this, w).querySelector(i);
|
|
550
551
|
e && e.querySelector("tbody.bindable-tbody") && t(this, At).call(this, e, i);
|
|
551
|
-
}), t(this,
|
|
552
|
+
}), t(this, qt).call(this);
|
|
552
553
|
}, "#renderAllContainers"));
|
|
553
554
|
c(this, Lt, /* @__PURE__ */ a((i) => {
|
|
554
555
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
555
|
-
var
|
|
556
|
-
const s = t(this,
|
|
556
|
+
var h;
|
|
557
|
+
const s = t(this, w).querySelector(e);
|
|
557
558
|
if (!s) return;
|
|
558
|
-
const
|
|
559
|
-
if (!
|
|
560
|
-
const r = Array.from(
|
|
559
|
+
const n = s.querySelector("tbody.bindable-tbody");
|
|
560
|
+
if (!n) return;
|
|
561
|
+
const r = Array.from(n.querySelectorAll("tr:not(.nodata)")), o = ((h = t(this, W).get(e)) == null ? void 0 : h.length) || 1, d = (t(this, M).data.get() || []).length;
|
|
561
562
|
r.forEach((f, u) => {
|
|
562
|
-
const
|
|
563
|
-
if (
|
|
563
|
+
const b = i + Math.floor(u / o);
|
|
564
|
+
if (b >= d) {
|
|
564
565
|
f.style.display = "none";
|
|
565
566
|
return;
|
|
566
567
|
}
|
|
567
|
-
const y = t(this, M).data.get(
|
|
568
|
-
f.style.display = "", t(this, ut).call(this, f, y,
|
|
568
|
+
const y = t(this, M).data.get(b);
|
|
569
|
+
f.style.display = "", t(this, ut).call(this, f, y, b);
|
|
569
570
|
});
|
|
570
571
|
});
|
|
571
572
|
}, "#adjustBufferRows"));
|
|
572
573
|
c(this, et, /* @__PURE__ */ a((i) => {
|
|
573
|
-
var
|
|
574
|
-
const e = t(this,
|
|
574
|
+
var d;
|
|
575
|
+
const e = t(this, T);
|
|
575
576
|
if (!e || e <= 0) return;
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
const f = t(this,
|
|
577
|
+
const n = (t(this, M).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, W).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this, P);
|
|
578
|
+
z.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, P)}, targetDataIndex range: ${r} ~ ${l} (Total: ${n})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
579
|
+
const f = t(this, w).querySelector(h);
|
|
579
580
|
if (!f) return;
|
|
580
581
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
581
582
|
if (!u) return;
|
|
582
|
-
Array.from(u.querySelectorAll("tr:not(.nodata)")).forEach((y,
|
|
583
|
-
const
|
|
584
|
-
if (
|
|
583
|
+
Array.from(u.querySelectorAll("tr:not(.nodata)")).forEach((y, m) => {
|
|
584
|
+
const R = r + Math.floor(m / o);
|
|
585
|
+
if (R >= n) {
|
|
585
586
|
y.style.display = "none";
|
|
586
587
|
return;
|
|
587
588
|
}
|
|
588
|
-
const
|
|
589
|
-
y.style.display = "", t(this, ut).call(this, y,
|
|
589
|
+
const O = t(this, M).data.get(R);
|
|
590
|
+
y.style.display = "", t(this, ut).call(this, y, O, R);
|
|
590
591
|
});
|
|
591
|
-
}), t(this, tt) || (
|
|
592
|
-
t(this, Lt).call(this, r),
|
|
592
|
+
}), t(this, tt) || (g(this, tt, !0), setTimeout(() => {
|
|
593
|
+
t(this, Lt).call(this, r), g(this, tt, !1);
|
|
593
594
|
}, 0));
|
|
594
595
|
}, "#handleScroll"));
|
|
595
596
|
c(this, ut, /* @__PURE__ */ a((i, e, s) => {
|
|
596
|
-
i.dataset.row = s, Array.from(i.cells).forEach((
|
|
597
|
-
const
|
|
598
|
-
|
|
597
|
+
i.dataset.row = s, Array.from(i.cells).forEach((n, r) => {
|
|
598
|
+
const o = n.dataset.bind;
|
|
599
|
+
o && e && e[o] !== void 0 ? n.textContent = e[o] : n.textContent = e ? e[Object.keys(e)[r]] ?? `R${s}C${r}` : `ν ${s + 1}`, n.dataset.row = s;
|
|
599
600
|
});
|
|
600
601
|
}, "#bindRowData"));
|
|
601
|
-
|
|
602
|
-
t(this,
|
|
602
|
+
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
603
|
+
t(this, N) && (t(this, N).disconnect(), g(this, N, null));
|
|
603
604
|
}, "destroy"));
|
|
604
|
-
|
|
605
|
+
g(this, M, i.getRootNode().host), g(this, w, i), t(this, kt).call(this);
|
|
605
606
|
}
|
|
606
607
|
getRowHeight() {
|
|
607
|
-
return t(this,
|
|
608
|
+
return t(this, T);
|
|
608
609
|
}
|
|
609
610
|
templateLength(i = ".ng-container-body") {
|
|
610
611
|
var e;
|
|
611
612
|
return ((e = t(this, W).get(i)) == null ? void 0 : e.length) || 1;
|
|
612
613
|
}
|
|
613
614
|
};
|
|
614
|
-
M = new WeakMap(),
|
|
615
|
+
M = new WeakMap(), w = new WeakMap(), W = new WeakMap(), T = new WeakMap(), N = new WeakMap(), j = new WeakMap(), P = new WeakMap(), tt = new WeakMap(), Rt = new WeakMap(), At = new WeakMap(), Tt = new WeakMap(), ht = new WeakMap(), dt = new WeakMap(), qt = new WeakMap(), kt = new WeakMap(), ft = new WeakMap(), Lt = new WeakMap(), et = new WeakMap(), ut = new WeakMap(), a(le, "RowManager");
|
|
615
616
|
let Zt = le;
|
|
616
|
-
var Ht, it,
|
|
617
|
+
var Ht, it, K, Ct, _t, $t, It, Mt;
|
|
617
618
|
const lt = class lt extends HTMLElement {
|
|
618
619
|
constructor() {
|
|
619
620
|
super();
|
|
620
621
|
c(this, Ht);
|
|
621
622
|
c(this, it, null);
|
|
622
|
-
c(this,
|
|
623
|
+
c(this, K);
|
|
623
624
|
/**
|
|
624
625
|
* data.set, add, delete
|
|
625
626
|
* filter, sorting : κ³ λ €λμ
|
|
626
627
|
*/
|
|
627
|
-
|
|
628
|
-
t(this,
|
|
628
|
+
v(this, "invalidate", /* @__PURE__ */ a(() => {
|
|
629
|
+
t(this, K).refresh();
|
|
629
630
|
}, "invalidate"));
|
|
630
631
|
c(this, Ct, /* @__PURE__ */ a(() => {
|
|
631
632
|
[
|
|
632
633
|
{ selector: ".ng-container-body", type: null },
|
|
633
634
|
{ selector: ".ng-container-left", type: "left" },
|
|
634
635
|
{ selector: ".ng-container-right", type: "right" }
|
|
635
|
-
].forEach(({ selector: s, type:
|
|
636
|
+
].forEach(({ selector: s, type: n }) => {
|
|
636
637
|
const r = this.querySelector(s);
|
|
637
638
|
if (!r) return;
|
|
638
|
-
const
|
|
639
|
-
r.innerHTML = "", r.appendChild(
|
|
639
|
+
const o = t(this, $t).call(this, t(this, it), n);
|
|
640
|
+
r.innerHTML = "", r.appendChild(o);
|
|
640
641
|
});
|
|
641
642
|
}, "#renderSplitContainers"));
|
|
642
643
|
c(this, _t, /* @__PURE__ */ a(() => {
|
|
643
644
|
["left", "right"].forEach((e) => {
|
|
644
|
-
const s = this.querySelector(`.ng-container-${e}`),
|
|
645
|
-
if (!s || !
|
|
645
|
+
const s = this.querySelector(`.ng-container-${e}`), n = s == null ? void 0 : s.querySelector("table");
|
|
646
|
+
if (!s || !n) return;
|
|
646
647
|
let r = 0;
|
|
647
|
-
|
|
648
|
-
const l = parseInt(
|
|
648
|
+
n.querySelectorAll("col").forEach((o) => {
|
|
649
|
+
const l = parseInt(o.getAttribute("width"), 10);
|
|
649
650
|
isNaN(r) || (r += l);
|
|
650
651
|
}), s.style.flex = `0 0 ${r}px`, s.style.width = `${r}px`;
|
|
651
652
|
});
|
|
652
653
|
}, "#updateContainerWidths"));
|
|
653
|
-
|
|
654
|
-
e && (
|
|
655
|
-
var
|
|
656
|
-
const s = (
|
|
654
|
+
v(this, "generate", /* @__PURE__ */ a((e) => {
|
|
655
|
+
e && (g(this, it, Kt.compile(e)), t(this, it).style.display = "table", t(this, Ct).call(this), t(this, _t).call(this), requestAnimationFrame(() => {
|
|
656
|
+
var n;
|
|
657
|
+
const s = (n = this.querySelector("thead")) == null ? void 0 : n.getBoundingClientRect().height;
|
|
657
658
|
this.querySelectorAll("tbody.fixed-tbody").forEach((r) => {
|
|
658
659
|
r.style.top = `${s}px`;
|
|
659
660
|
});
|
|
660
|
-
}), t(this,
|
|
661
|
+
}), t(this, K).initialize(), setTimeout(() => {
|
|
661
662
|
var s;
|
|
662
663
|
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
663
664
|
}, 0));
|
|
@@ -666,25 +667,25 @@ const lt = class lt extends HTMLElement {
|
|
|
666
667
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
667
668
|
*/
|
|
668
669
|
c(this, $t, /* @__PURE__ */ a((e, s) => {
|
|
669
|
-
const
|
|
670
|
+
const n = e.cloneNode(!0), r = n.querySelector("tbody");
|
|
670
671
|
if (r) {
|
|
671
|
-
const
|
|
672
|
-
|
|
672
|
+
const o = document.createElement("tbody");
|
|
673
|
+
o.className = "fixed-tbody", r.className = "bindable-tbody", r.before(o);
|
|
673
674
|
}
|
|
674
|
-
return s === "left" ?
|
|
675
|
-
|
|
676
|
-
}) : s === "right" ?
|
|
677
|
-
|
|
678
|
-
}) :
|
|
679
|
-
|
|
680
|
-
}),
|
|
675
|
+
return s === "left" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((o) => {
|
|
676
|
+
o.getAttribute("fixed") !== "left" && o.remove();
|
|
677
|
+
}) : s === "right" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((o) => {
|
|
678
|
+
o.getAttribute("fixed") !== "right" && o.remove();
|
|
679
|
+
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((o) => {
|
|
680
|
+
o.remove();
|
|
681
|
+
}), n;
|
|
681
682
|
}, "#createSplitTable"));
|
|
682
|
-
|
|
683
|
-
|
|
683
|
+
v(this, "getRowHeight", /* @__PURE__ */ a(() => t(this, K).getRowHeight(), "getRowHeight"));
|
|
684
|
+
v(this, "scrollToX", /* @__PURE__ */ a((e) => {
|
|
684
685
|
const s = this.querySelector(".ng-container-body");
|
|
685
686
|
s && (s.scrollLeft = e);
|
|
686
687
|
}, "scrollToX"));
|
|
687
|
-
|
|
688
|
+
v(this, "scrollToY", /* @__PURE__ */ a((e) => {
|
|
688
689
|
const s = this.querySelector(".ng-container-body");
|
|
689
690
|
s && (s.scrollTop = e);
|
|
690
691
|
}, "scrollToY"));
|
|
@@ -838,92 +839,92 @@ const lt = class lt extends HTMLElement {
|
|
|
838
839
|
</div>
|
|
839
840
|
`;
|
|
840
841
|
}, "#render"));
|
|
841
|
-
|
|
842
|
+
g(this, K, new Zt(this)), g(this, Ht, this.getRootNode().host);
|
|
842
843
|
}
|
|
843
844
|
connectedCallback() {
|
|
844
845
|
t(this, It).call(this);
|
|
845
846
|
}
|
|
846
847
|
disconnectedCallback() {
|
|
847
|
-
this.innerHTML = "",
|
|
848
|
+
this.innerHTML = "", z.log("NineTableSheet destroyed.");
|
|
848
849
|
}
|
|
849
850
|
};
|
|
850
|
-
Ht = new WeakMap(), it = new WeakMap(),
|
|
851
|
+
Ht = new WeakMap(), it = new WeakMap(), K = new WeakMap(), Ct = new WeakMap(), _t = new WeakMap(), $t = new WeakMap(), It = new WeakMap(), Mt = new WeakMap(), a(lt, "NineTableSheet"), v(lt, "SCROLLBAR_SIZE", 16);
|
|
851
852
|
let xt = lt;
|
|
852
853
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", xt);
|
|
853
|
-
var Wt,
|
|
854
|
+
var Wt, gt;
|
|
854
855
|
const ae = class ae extends HTMLElement {
|
|
855
856
|
constructor() {
|
|
856
857
|
super();
|
|
857
858
|
c(this, Wt, /* @__PURE__ */ a(() => {
|
|
858
859
|
var e;
|
|
859
860
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
860
|
-
var
|
|
861
|
-
const
|
|
862
|
-
t(this,
|
|
863
|
-
}), t(this,
|
|
861
|
+
var o;
|
|
862
|
+
const n = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((o = s.target.closest(".nine-tab-item")) == null ? void 0 : o.dataset.index, 10);
|
|
863
|
+
t(this, gt).call(this, r, n);
|
|
864
|
+
}), t(this, gt).call(this, 0, !1);
|
|
864
865
|
}, "#init"));
|
|
865
|
-
c(this,
|
|
866
|
-
const
|
|
866
|
+
c(this, gt, /* @__PURE__ */ a((e, s = !1) => {
|
|
867
|
+
const n = /* @__PURE__ */ a(() => {
|
|
867
868
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
868
869
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((y) => y.style.setProperty("display", "none"));
|
|
869
|
-
const
|
|
870
|
-
|
|
871
|
-
const
|
|
872
|
-
|
|
870
|
+
const b = f.filter((y) => y.classList.contains("active"));
|
|
871
|
+
b.length < 2 || b.forEach((y) => {
|
|
872
|
+
const m = parseInt(y.getAttribute("data-index"), 10), R = this.querySelector(`nine-splitter[data-split-index="${m}"]`), O = f[m + 1];
|
|
873
|
+
R && O && O.classList.contains("active") && R.style.setProperty("display", "flex");
|
|
873
874
|
});
|
|
874
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"),
|
|
875
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), d = o.querySelectorAll("nine-table-sheet");
|
|
875
876
|
if (!l[e]) return;
|
|
876
877
|
if (!s)
|
|
877
878
|
l.forEach((f, u) => {
|
|
878
879
|
f.classList.toggle("active", u === e);
|
|
879
|
-
}),
|
|
880
|
-
const
|
|
881
|
-
f.classList.toggle("active",
|
|
880
|
+
}), d.forEach((f, u) => {
|
|
881
|
+
const b = u === e;
|
|
882
|
+
f.classList.toggle("active", b), f.style.flex = b ? "1 1 100%" : "";
|
|
882
883
|
});
|
|
883
884
|
else {
|
|
884
885
|
const f = l[e], u = r.querySelectorAll(".nine-tab-item.active");
|
|
885
886
|
if (f.classList.contains("active") && u.length <= 1)
|
|
886
887
|
return;
|
|
887
888
|
f.classList.toggle("active");
|
|
888
|
-
const
|
|
889
|
-
|
|
889
|
+
const b = o.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
890
|
+
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
890
891
|
}
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
f.style.flex =
|
|
894
|
-
}),
|
|
892
|
+
const h = o.querySelectorAll("nine-table-sheet.active");
|
|
893
|
+
h == null || h.forEach((f) => {
|
|
894
|
+
f.style.flex = h.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
895
|
+
}), n();
|
|
895
896
|
}, "#switchSheet"));
|
|
896
897
|
}
|
|
897
898
|
connectedCallback() {
|
|
898
899
|
t(this, Wt).call(this);
|
|
899
900
|
}
|
|
900
901
|
};
|
|
901
|
-
Wt = new WeakMap(),
|
|
902
|
+
Wt = new WeakMap(), gt = new WeakMap(), a(ae, "NineTableSheets");
|
|
902
903
|
let Gt = ae;
|
|
903
904
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Gt);
|
|
904
|
-
var
|
|
905
|
+
var q, Ot, bt, zt;
|
|
905
906
|
const ce = class ce {
|
|
906
907
|
constructor(i) {
|
|
907
|
-
c(this,
|
|
908
|
+
c(this, q);
|
|
908
909
|
c(this, Ot, /* @__PURE__ */ a(() => {
|
|
909
910
|
t(this, zt).call(this), new ResizeObserver((i) => {
|
|
910
911
|
for (let e of i)
|
|
911
|
-
t(this,
|
|
912
|
-
}).observe(t(this,
|
|
912
|
+
t(this, q).getAttribute("auto-height") === "true" && t(this, bt).call(this);
|
|
913
|
+
}).observe(t(this, q));
|
|
913
914
|
}, "#init"));
|
|
914
|
-
c(this,
|
|
915
|
-
var
|
|
916
|
-
const i = Array.from(t(this,
|
|
915
|
+
c(this, bt, /* @__PURE__ */ a(() => {
|
|
916
|
+
var d, h;
|
|
917
|
+
const i = Array.from(t(this, q).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
917
918
|
if (i.length === 0) return;
|
|
918
|
-
const e = parseInt(t(this,
|
|
919
|
-
t(this,
|
|
919
|
+
const e = parseInt(t(this, q).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), n = (d = t(this, q).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : d.getBoundingClientRect().height, r = (h = t(this, q).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : h.getBoundingClientRect().height, o = xt.SCROLLBAR_SIZE, l = e * s + n + r + o;
|
|
920
|
+
t(this, q).style.height = `${l}px`;
|
|
920
921
|
}, "#applyAutoHeight"));
|
|
921
922
|
c(this, zt, /* @__PURE__ */ a(() => {
|
|
922
|
-
const e = Array.from(t(this,
|
|
923
|
-
const u = `<nine-table-sheet class="${
|
|
924
|
-
return u +
|
|
925
|
-
}).join(""),
|
|
926
|
-
t(this,
|
|
923
|
+
const e = Array.from(t(this, q).children).filter((d) => d.tagName === "TABLE"), s = t(this, q).getAttribute("auto-height") === "true", n = e.length, r = e.map((d, h) => {
|
|
924
|
+
const u = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, b = h < n - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
925
|
+
return u + b;
|
|
926
|
+
}).join(""), o = e.map((d, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
927
|
+
t(this, q).shadowRoot.innerHTML = `
|
|
927
928
|
<style>
|
|
928
929
|
:host {
|
|
929
930
|
display: flex;
|
|
@@ -1006,7 +1007,7 @@ const ce = class ce {
|
|
|
1006
1007
|
<nine-table-sheets>
|
|
1007
1008
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
1008
1009
|
<nine-table-sheets-footer>
|
|
1009
|
-
<div class="nine-tab-bar">${
|
|
1010
|
+
<div class="nine-tab-bar">${o}</div>
|
|
1010
1011
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
1011
1012
|
</nine-table-sheets-footer>
|
|
1012
1013
|
</nine-table-sheets>
|
|
@@ -1014,158 +1015,158 @@ const ce = class ce {
|
|
|
1014
1015
|
</nine-table-body>
|
|
1015
1016
|
<nine-table-footer></nine-table-footer>
|
|
1016
1017
|
`;
|
|
1017
|
-
const l = t(this,
|
|
1018
|
-
l == null || l.forEach((
|
|
1019
|
-
e[
|
|
1020
|
-
|
|
1018
|
+
const l = t(this, q).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1019
|
+
l == null || l.forEach((d, h) => {
|
|
1020
|
+
e[h] && setTimeout(() => {
|
|
1021
|
+
d.generate(e[h]), s && t(this, bt).call(this);
|
|
1021
1022
|
});
|
|
1022
1023
|
});
|
|
1023
1024
|
}, "#render"));
|
|
1024
|
-
|
|
1025
|
+
g(this, q, i), t(this, Ot).call(this);
|
|
1025
1026
|
}
|
|
1026
1027
|
};
|
|
1027
|
-
|
|
1028
|
+
q = new WeakMap(), Ot = new WeakMap(), bt = new WeakMap(), zt = new WeakMap(), a(ce, "LayoutManager");
|
|
1028
1029
|
let Jt = ce;
|
|
1029
1030
|
var yt, st;
|
|
1030
1031
|
const he = class he {
|
|
1031
1032
|
constructor(i) {
|
|
1032
1033
|
c(this, yt);
|
|
1033
1034
|
c(this, st, -1);
|
|
1034
|
-
|
|
1035
|
-
|
|
1035
|
+
v(this, "count", /* @__PURE__ */ a(() => t(this, yt).rawRecords.length, "count"));
|
|
1036
|
+
g(this, yt, i);
|
|
1036
1037
|
}
|
|
1037
1038
|
get at() {
|
|
1038
1039
|
return t(this, st);
|
|
1039
1040
|
}
|
|
1040
1041
|
set at(i) {
|
|
1041
|
-
|
|
1042
|
+
g(this, st, parseInt(i, 10)), body && !body.querySelector(`tbody.bindable tr[data-row="${t(this, st)}"]`) && setTimeout(() => {
|
|
1042
1043
|
});
|
|
1043
1044
|
}
|
|
1044
1045
|
};
|
|
1045
1046
|
yt = new WeakMap(), st = new WeakMap(), a(he, "ngRow");
|
|
1046
1047
|
let Qt = he;
|
|
1047
|
-
var k, E,
|
|
1048
|
-
const
|
|
1048
|
+
var k, E, H, nt, Dt, V, Bt, Z, pt, Nt, Pt, ot;
|
|
1049
|
+
const C = class C {
|
|
1049
1050
|
constructor(i, e) {
|
|
1050
1051
|
c(this, k);
|
|
1051
1052
|
c(this, E);
|
|
1052
|
-
c(this,
|
|
1053
|
+
c(this, H, []);
|
|
1053
1054
|
c(this, nt, []);
|
|
1054
1055
|
c(this, Dt, 0);
|
|
1055
|
-
c(this,
|
|
1056
|
+
c(this, V, []);
|
|
1056
1057
|
c(this, Bt, /* @__PURE__ */ a(() => {
|
|
1057
|
-
|
|
1058
|
+
g(this, V, []);
|
|
1058
1059
|
const i = t(this, k).template || [];
|
|
1059
1060
|
Array.from(i).forEach((e) => {
|
|
1060
1061
|
var s;
|
|
1061
|
-
t(this,
|
|
1062
|
+
t(this, V).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1062
1063
|
}), (t(this, E).rawRecords || []).forEach((e) => {
|
|
1063
|
-
e.__ng || (e.__ng = t(this, pt).call(this)), e.__ng.height = t(this,
|
|
1064
|
+
e.__ng || (e.__ng = t(this, pt).call(this)), e.__ng.height = t(this, V).slice();
|
|
1064
1065
|
});
|
|
1065
1066
|
}, "#initialize"));
|
|
1066
|
-
c(this,
|
|
1067
|
+
c(this, Z, /* @__PURE__ */ a(() => {
|
|
1067
1068
|
t(this, k).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1068
1069
|
i.invalidate();
|
|
1069
1070
|
});
|
|
1070
1071
|
}, "#invalidate"));
|
|
1071
|
-
|
|
1072
|
+
v(this, "get", /* @__PURE__ */ a((i, e) => {
|
|
1072
1073
|
var r;
|
|
1073
1074
|
const s = this.getValidData();
|
|
1074
1075
|
if (!s || s.length <= 0) return;
|
|
1075
1076
|
if (i == null) return t(this, ot).call(this, s);
|
|
1076
1077
|
if (i < 0 || i >= s.length) return null;
|
|
1077
|
-
const
|
|
1078
|
+
const n = typeof ((r = t(this, k).fields) == null ? void 0 : r.get) == "function" ? t(this, k).fields.get() : [];
|
|
1078
1079
|
if (e != null) {
|
|
1079
|
-
const
|
|
1080
|
-
return
|
|
1080
|
+
const o = n.indexOf(e);
|
|
1081
|
+
return o >= 0 ? s[i].v[o] : null;
|
|
1081
1082
|
}
|
|
1082
1083
|
return t(this, ot).call(this, s[i]);
|
|
1083
1084
|
}, "get"));
|
|
1084
|
-
|
|
1085
|
-
this.clear(), this.add(i, !1), t(this,
|
|
1085
|
+
v(this, "set", /* @__PURE__ */ a((i) => {
|
|
1086
|
+
this.clear(), this.add(i, !1), t(this, Z).call(this);
|
|
1086
1087
|
}, "set"));
|
|
1087
1088
|
c(this, pt, /* @__PURE__ */ a(() => ({
|
|
1088
|
-
rowState:
|
|
1089
|
+
rowState: C.ROW_STATE.EMPTY,
|
|
1089
1090
|
deleted: !1,
|
|
1090
1091
|
filtered: !1,
|
|
1091
|
-
height: t(this,
|
|
1092
|
+
height: t(this, V).slice(),
|
|
1092
1093
|
o: {},
|
|
1093
1094
|
c: {},
|
|
1094
|
-
_: [0, 0, 0, 0,
|
|
1095
|
+
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, V).slice(), -1, {}, {}]
|
|
1095
1096
|
}), "#getDefaultMeta"));
|
|
1096
|
-
|
|
1097
|
-
|
|
1097
|
+
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
1098
|
+
g(this, H, []), g(this, nt, []), t(this, Z).call(this);
|
|
1098
1099
|
}, "reset"));
|
|
1099
|
-
|
|
1100
|
+
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
1100
1101
|
var i;
|
|
1101
|
-
t(this, E).rawRecords = [],
|
|
1102
|
+
t(this, E).rawRecords = [], g(this, H, []), g(this, nt, []), (i = t(this, E).viewRecords) != null && i.reset && t(this, E).viewRecords.reset();
|
|
1102
1103
|
}, "clear"));
|
|
1103
1104
|
c(this, Nt, /* @__PURE__ */ a((i) => {
|
|
1104
|
-
var
|
|
1105
|
+
var n;
|
|
1105
1106
|
Array.isArray(i) || (i = [i]);
|
|
1106
|
-
const e = typeof ((
|
|
1107
|
+
const e = typeof ((n = t(this, k).fields) == null ? void 0 : n.get) == "function" ? t(this, k).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1107
1108
|
return i.forEach((r) => {
|
|
1108
|
-
const
|
|
1109
|
+
const o = { v: [] };
|
|
1109
1110
|
e.forEach((l) => {
|
|
1110
|
-
|
|
1111
|
-
}), s.push(
|
|
1111
|
+
o.v.push(r[l] !== void 0 && r[l] !== null ? r[l] : "");
|
|
1112
|
+
}), s.push(o);
|
|
1112
1113
|
}), s;
|
|
1113
1114
|
}, "#json2Array"));
|
|
1114
1115
|
c(this, Pt, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1115
|
-
e.__ng = t(this, pt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState =
|
|
1116
|
+
e.__ng = t(this, pt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = C.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1116
1117
|
}), i), "#defaultInsert"));
|
|
1117
|
-
|
|
1118
|
+
v(this, "add", /* @__PURE__ */ a((i, e = !0) => {
|
|
1118
1119
|
i === void 0 && (i = {});
|
|
1119
1120
|
const s = t(this, Nt).call(this, i);
|
|
1120
1121
|
t(this, E).rawRecords = t(this, E).rawRecords.concat(t(this, Pt).call(this, s)), this.resetRecords();
|
|
1121
|
-
const
|
|
1122
|
-
return e || s.forEach((r,
|
|
1123
|
-
const l = t(this, E).rawRecords[
|
|
1124
|
-
l && (l.__ng.rowState =
|
|
1125
|
-
}), t(this,
|
|
1122
|
+
const n = this.count() - 1;
|
|
1123
|
+
return e || s.forEach((r, o) => {
|
|
1124
|
+
const l = t(this, E).rawRecords[n - o];
|
|
1125
|
+
l && (l.__ng.rowState = C.ROW_STATE.EMPTY);
|
|
1126
|
+
}), t(this, Z).call(this), n;
|
|
1126
1127
|
}, "add"));
|
|
1127
|
-
|
|
1128
|
+
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
1128
1129
|
let e = [];
|
|
1129
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s,
|
|
1130
|
-
if (t(this,
|
|
1131
|
-
const
|
|
1132
|
-
t(this,
|
|
1133
|
-
r.__ng.rowid ===
|
|
1130
|
+
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s, n) => n - s).forEach((s) => {
|
|
1131
|
+
if (t(this, H)[s]) {
|
|
1132
|
+
const n = t(this, H)[s].__ng.rowid;
|
|
1133
|
+
t(this, H)[s].__ng.rowState === C.ROW_STATE.INSERT ? t(this, E).rawRecords = t(this, E).rawRecords.filter((r) => r.__ng.rowid !== n) : t(this, E).rawRecords.forEach((r) => {
|
|
1134
|
+
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState = C.ROW_STATE.DELETE);
|
|
1134
1135
|
});
|
|
1135
1136
|
}
|
|
1136
|
-
}), this.resetRecords(), t(this,
|
|
1137
|
+
}), this.resetRecords(), t(this, Z).call(this);
|
|
1137
1138
|
}, "delete"));
|
|
1138
|
-
|
|
1139
|
-
var
|
|
1139
|
+
v(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
|
|
1140
|
+
var d;
|
|
1140
1141
|
i = parseInt(i, 10);
|
|
1141
|
-
const r = (typeof ((
|
|
1142
|
+
const r = (typeof ((d = t(this, k).fields) == null ? void 0 : d.get) == "function" ? t(this, k).fields.get() : []).indexOf(e);
|
|
1142
1143
|
if (r < 0) return;
|
|
1143
|
-
const
|
|
1144
|
-
if (!
|
|
1145
|
-
const l =
|
|
1146
|
-
l !== s &&
|
|
1144
|
+
const o = this.getValidData()[i];
|
|
1145
|
+
if (!o) return;
|
|
1146
|
+
const l = o.v[r];
|
|
1147
|
+
l !== s && o.__ng.rowState !== C.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = l), o.__ng.rowState = C.ROW_STATE.UPDATE), o.v[r] = s;
|
|
1147
1148
|
}, "setValue"));
|
|
1148
|
-
|
|
1149
|
-
|
|
1149
|
+
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1150
|
+
g(this, nt, t(this, E).rawRecords.filter((i) => !i.__ng.deleted)), g(this, H, t(this, E).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, E).rawRecords.forEach((i, e) => {
|
|
1150
1151
|
i.__ng.rowidx = e;
|
|
1151
|
-
}), t(this,
|
|
1152
|
+
}), t(this, H).forEach((i, e) => {
|
|
1152
1153
|
i.__ng.i = e;
|
|
1153
1154
|
});
|
|
1154
1155
|
}, "resetRecords"));
|
|
1155
|
-
|
|
1156
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this, H).length === 0 && t(this, E).rawRecords.length > 0 && this.resetRecords(), t(this, H)), "getValidData"));
|
|
1156
1157
|
c(this, ot, /* @__PURE__ */ a((i) => {
|
|
1157
|
-
var
|
|
1158
|
+
var o;
|
|
1158
1159
|
if (!i) return i;
|
|
1159
|
-
const e = !Array.isArray(i), s = e ? [i] : i,
|
|
1160
|
-
const
|
|
1161
|
-
return
|
|
1162
|
-
h
|
|
1163
|
-
}),
|
|
1160
|
+
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this, k).fields) == null ? void 0 : o.get) == "function" ? t(this, k).fields.get() : [], r = s.filter((l) => !l.__ng.deleted).map((l) => {
|
|
1161
|
+
const d = {};
|
|
1162
|
+
return n.forEach((h, f) => {
|
|
1163
|
+
d[h] = l.v ? l.v[f] : l[h];
|
|
1164
|
+
}), d.__ng = l.__ng, d;
|
|
1164
1165
|
});
|
|
1165
1166
|
return e ? r[0] : r;
|
|
1166
1167
|
}, "#conv"));
|
|
1167
|
-
|
|
1168
|
-
|
|
1168
|
+
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
1169
|
+
g(this, k, i), g(this, E, e), t(this, Bt).call(this);
|
|
1169
1170
|
}
|
|
1170
1171
|
get source() {
|
|
1171
1172
|
return t(this, ot).call(this, t(this, E).rawRecords);
|
|
@@ -1174,89 +1175,89 @@ const H = class H {
|
|
|
1174
1175
|
this.clear(), this.add(i, !1);
|
|
1175
1176
|
}
|
|
1176
1177
|
get nextId() {
|
|
1177
|
-
return ++
|
|
1178
|
+
return ++Se(this, Dt)._;
|
|
1178
1179
|
}
|
|
1179
1180
|
get length() {
|
|
1180
|
-
return t(this,
|
|
1181
|
+
return t(this, H).length;
|
|
1181
1182
|
}
|
|
1182
1183
|
getRowCount() {
|
|
1183
1184
|
return this.length;
|
|
1184
1185
|
}
|
|
1185
1186
|
};
|
|
1186
|
-
k = new WeakMap(), E = new WeakMap(),
|
|
1187
|
-
|
|
1187
|
+
k = new WeakMap(), E = new WeakMap(), H = new WeakMap(), nt = new WeakMap(), Dt = new WeakMap(), V = new WeakMap(), Bt = new WeakMap(), Z = new WeakMap(), pt = new WeakMap(), Nt = new WeakMap(), Pt = new WeakMap(), ot = new WeakMap(), a(C, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1188
|
+
v(C, "ROW_STATE", {
|
|
1188
1189
|
EMPTY: "EMPTY",
|
|
1189
1190
|
NORMAL: "NORMAL",
|
|
1190
1191
|
INSERT: "INSERT",
|
|
1191
1192
|
UPDATE: "UPDATE",
|
|
1192
1193
|
DELETE: "DELETE"
|
|
1193
1194
|
});
|
|
1194
|
-
let te =
|
|
1195
|
-
var
|
|
1195
|
+
let te = C;
|
|
1196
|
+
var G;
|
|
1196
1197
|
const de = class de {
|
|
1197
1198
|
constructor(i) {
|
|
1198
|
-
c(this,
|
|
1199
|
-
|
|
1199
|
+
c(this, G);
|
|
1200
|
+
g(this, G, i), this.row = new Qt(this), this.data = new te(t(this, G), this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1200
1201
|
var e;
|
|
1201
|
-
(e = t(this,
|
|
1202
|
+
(e = t(this, G).view) != null && e.redraw && t(this, G).view.redraw();
|
|
1202
1203
|
}, this.setDataSource = (e) => {
|
|
1203
1204
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1204
1205
|
}, this.getRowState = (e) => {
|
|
1205
|
-
var
|
|
1206
|
+
var n, r;
|
|
1206
1207
|
const s = parseInt(e, 10);
|
|
1207
1208
|
if (!(s >= this.data.count()))
|
|
1208
|
-
return (r = (
|
|
1209
|
+
return (r = (n = this.data.getValidData()[s]) == null ? void 0 : n.__ng) == null ? void 0 : r.rowState;
|
|
1209
1210
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (e) => {
|
|
1210
1211
|
this.row.at = e;
|
|
1211
|
-
}, this.scrollTo_V1 = (e) => (e < 0 && (e = 0), e >= this.rawRecords.length && (e = this.rawRecords.length - 1), this.viewRecords.rawIndex = e, this.viewRecords.reset && this.viewRecords.reset(), !(e <= 0 || e >= this.rawRecords.length - 1)), this.getColumn = (e, s) => this.data.get(e, s), this.setColumn = (e, s,
|
|
1212
|
-
e = parseInt(e, 10), this.data.setValue(e, s,
|
|
1212
|
+
}, this.scrollTo_V1 = (e) => (e < 0 && (e = 0), e >= this.rawRecords.length && (e = this.rawRecords.length - 1), this.viewRecords.rawIndex = e, this.viewRecords.reset && this.viewRecords.reset(), !(e <= 0 || e >= this.rawRecords.length - 1)), this.getColumn = (e, s) => this.data.get(e, s), this.setColumn = (e, s, n) => {
|
|
1213
|
+
e = parseInt(e, 10), this.data.setValue(e, s, n);
|
|
1213
1214
|
}, this.setDataSource([]);
|
|
1214
1215
|
}
|
|
1215
1216
|
};
|
|
1216
|
-
|
|
1217
|
+
G = new WeakMap(), a(de, "ngDataManager");
|
|
1217
1218
|
let ee = de;
|
|
1218
|
-
var rt,
|
|
1219
|
+
var rt, A, mt, Vt;
|
|
1219
1220
|
const fe = class fe {
|
|
1220
1221
|
// π― μ΄μ { name: string, type: string } κ°μ²΄λ€μ λ°°μ΄λ‘ κ΄λ¦¬ν©λλ€.
|
|
1221
1222
|
constructor(i) {
|
|
1222
1223
|
c(this, rt);
|
|
1223
|
-
c(this,
|
|
1224
|
-
|
|
1224
|
+
c(this, A, []);
|
|
1225
|
+
v(this, "add", /* @__PURE__ */ a((i, e = "string") => {
|
|
1225
1226
|
i.forEach((s) => {
|
|
1226
|
-
t(this,
|
|
1227
|
+
t(this, A).some((n) => n.name === s) || t(this, A).push({ name: s, type: e });
|
|
1227
1228
|
}), t(this, mt).call(this);
|
|
1228
1229
|
}, "add"));
|
|
1229
1230
|
c(this, mt, /* @__PURE__ */ a(() => {
|
|
1230
1231
|
const i = /* @__PURE__ */ new Map();
|
|
1231
|
-
t(this,
|
|
1232
|
+
t(this, A).forEach((e) => {
|
|
1232
1233
|
i.set(e.name, e.type);
|
|
1233
|
-
}),
|
|
1234
|
+
}), g(this, A, Array.from(i, ([e, s]) => ({ name: e, type: s }))), g(this, A, t(this, A).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, A).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1234
1235
|
}, "#adjust"));
|
|
1235
1236
|
c(this, Vt, /* @__PURE__ */ a(() => {
|
|
1236
|
-
|
|
1237
|
+
g(this, A, []), z.log(t(this, rt).querySelectorAll("table"));
|
|
1237
1238
|
const i = Array.from(t(this, rt).querySelectorAll("table"));
|
|
1238
1239
|
if (!(!i || i.length === 0)) {
|
|
1239
1240
|
for (const e of i)
|
|
1240
|
-
|
|
1241
|
-
const r =
|
|
1242
|
-
r && t(this,
|
|
1241
|
+
z.log(e), $("[data-bind]", e).each((s, n) => {
|
|
1242
|
+
const r = n.dataset.bind, o = n.getAttribute("data-type") || "string";
|
|
1243
|
+
r && t(this, A).push({ name: r, type: o });
|
|
1243
1244
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
1244
|
-
$(`[${s}]`, e).each((
|
|
1245
|
-
var
|
|
1246
|
-
if (
|
|
1247
|
-
const l =
|
|
1245
|
+
$(`[${s}]`, e).each((n, r) => {
|
|
1246
|
+
var o = r.getAttribute(s);
|
|
1247
|
+
if (o.indexOf("data.") < 0) {
|
|
1248
|
+
const l = o.search(/[(]/g);
|
|
1248
1249
|
if (l > 0)
|
|
1249
1250
|
try {
|
|
1250
|
-
|
|
1251
|
+
o = String(window[o.substring(0, l).trim()]);
|
|
1251
1252
|
} catch {
|
|
1252
|
-
|
|
1253
|
+
o = "";
|
|
1253
1254
|
}
|
|
1254
1255
|
}
|
|
1255
|
-
|
|
1256
|
+
o.split("data.").forEach((l) => {
|
|
1256
1257
|
if (l.trim() != "") {
|
|
1257
|
-
const
|
|
1258
|
-
let
|
|
1259
|
-
|
|
1258
|
+
const d = l.search(/[^_A-Za-z0-9]/g);
|
|
1259
|
+
let h = "";
|
|
1260
|
+
d >= 0 ? h = l.substring(0, d) : o.startsWith("data.") && (h = l.replace("data.", "")), h && t(this, A).push({ name: h, type: "string" });
|
|
1260
1261
|
}
|
|
1261
1262
|
});
|
|
1262
1263
|
});
|
|
@@ -1264,62 +1265,62 @@ const fe = class fe {
|
|
|
1264
1265
|
t(this, mt).call(this);
|
|
1265
1266
|
}
|
|
1266
1267
|
}, "#init"));
|
|
1267
|
-
|
|
1268
|
+
g(this, rt, i), t(this, Vt).call(this);
|
|
1268
1269
|
}
|
|
1269
1270
|
// π― κΈ°μ‘΄μ νλ μ΄λ¦λ§ μ°λ κ³³λ€κ³Όμ νΈνμ μν΄ μ΄λ¦ λ°°μ΄λ§ 리ν΄νλ λ©μλ μ μ§
|
|
1270
1271
|
get() {
|
|
1271
|
-
return t(this,
|
|
1272
|
+
return t(this, A).map((i) => i.name);
|
|
1272
1273
|
}
|
|
1273
1274
|
// π― λ΄λΆ κ°μ²΄ ν΅μ§Έλ‘ μ»κΈ°
|
|
1274
1275
|
getFields() {
|
|
1275
|
-
return t(this,
|
|
1276
|
+
return t(this, A);
|
|
1276
1277
|
}
|
|
1277
1278
|
// π― νΉμ νλμ λ°μ΄ν° νμ
μ‘°ν
|
|
1278
1279
|
getType(i) {
|
|
1279
|
-
const e = t(this,
|
|
1280
|
+
const e = t(this, A).find((s) => s.name === i);
|
|
1280
1281
|
return e ? e.type : "string";
|
|
1281
1282
|
}
|
|
1282
1283
|
indexOf(i) {
|
|
1283
|
-
return t(this,
|
|
1284
|
+
return t(this, A).findIndex((e) => e.name === i);
|
|
1284
1285
|
}
|
|
1285
1286
|
includes(i) {
|
|
1286
|
-
return t(this,
|
|
1287
|
+
return t(this, A).some((e) => e.name === i);
|
|
1287
1288
|
}
|
|
1288
1289
|
};
|
|
1289
|
-
rt = new WeakMap(),
|
|
1290
|
+
rt = new WeakMap(), A = new WeakMap(), mt = new WeakMap(), Vt = new WeakMap(), a(fe, "ngFields");
|
|
1290
1291
|
let ie = fe;
|
|
1291
|
-
var
|
|
1292
|
+
var J, Yt, Xt;
|
|
1292
1293
|
const ue = class ue extends HTMLElement {
|
|
1293
1294
|
constructor() {
|
|
1294
1295
|
super();
|
|
1295
1296
|
//#created = false;
|
|
1296
|
-
c(this,
|
|
1297
|
+
c(this, J);
|
|
1297
1298
|
c(this, Yt);
|
|
1298
1299
|
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1299
|
-
this.fields = new ie(this),
|
|
1300
|
+
this.fields = new ie(this), g(this, Yt, new Jt(this)), z.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1300
1301
|
}, "#init"));
|
|
1301
|
-
this.attachShadow({ mode: "open" }),
|
|
1302
|
+
this.attachShadow({ mode: "open" }), g(this, J, new ee(this));
|
|
1302
1303
|
}
|
|
1303
1304
|
connectedCallback() {
|
|
1304
1305
|
t(this, Xt).call(this);
|
|
1305
1306
|
}
|
|
1306
1307
|
disconnectedCallback() {
|
|
1307
|
-
|
|
1308
|
+
z.log("NineTable disconnected.");
|
|
1308
1309
|
}
|
|
1309
1310
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1310
1311
|
get data() {
|
|
1311
|
-
return t(this,
|
|
1312
|
+
return t(this, J).data;
|
|
1312
1313
|
}
|
|
1313
1314
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
1314
1315
|
get row() {
|
|
1315
|
-
return t(this,
|
|
1316
|
+
return t(this, J).row;
|
|
1316
1317
|
}
|
|
1317
1318
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
1318
1319
|
get dataManager() {
|
|
1319
|
-
return t(this,
|
|
1320
|
+
return t(this, J);
|
|
1320
1321
|
}
|
|
1321
1322
|
};
|
|
1322
|
-
|
|
1323
|
+
J = new WeakMap(), Yt = new WeakMap(), Xt = new WeakMap(), a(ue, "NineTable");
|
|
1323
1324
|
let se = ue;
|
|
1324
1325
|
customElements.get("nine-table") || customElements.define("nine-table", se);
|
|
1325
1326
|
//# sourceMappingURL=nine-table.js.map
|