@ninebone/table 0.0.314 β 0.0.316
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 +274 -257
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +13 -6
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var te = Object.defineProperty;
|
|
2
|
-
var ee = (
|
|
3
|
-
throw TypeError(
|
|
2
|
+
var ee = (x) => {
|
|
3
|
+
throw TypeError(x);
|
|
4
4
|
};
|
|
5
|
-
var ne = (
|
|
6
|
-
var c = (
|
|
7
|
-
var w = (
|
|
8
|
-
var t = (
|
|
9
|
-
var se = (
|
|
10
|
-
set _(
|
|
11
|
-
g(
|
|
5
|
+
var ne = (x, i, e) => i in x ? te(x, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : x[i] = e;
|
|
6
|
+
var c = (x, i) => te(x, "name", { value: i, configurable: !0 });
|
|
7
|
+
var w = (x, i, e) => ne(x, typeof i != "symbol" ? i + "" : i, e), ie = (x, i, e) => i.has(x) || ee("Cannot " + e);
|
|
8
|
+
var t = (x, i, e) => (ie(x, i, "read from private field"), e ? e.call(x) : i.get(x)), h = (x, i, e) => i.has(x) ? ee("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(x) : i.set(x, e), g = (x, i, e, s) => (ie(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 _(o) {
|
|
11
|
+
g(x, i, o, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return t(
|
|
14
|
+
return t(x, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
import { trace as oe } from "@ninebone/util";
|
|
@@ -23,35 +23,35 @@ const Vt = class Vt extends oe.constructor {
|
|
|
23
23
|
c(Vt, "Trace");
|
|
24
24
|
let Mt = Vt;
|
|
25
25
|
const tt = new Mt();
|
|
26
|
-
var C, M,
|
|
26
|
+
var C, M, y, D, B, N, dt, P, ft;
|
|
27
27
|
const Xt = class Xt extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
h(this, C);
|
|
31
31
|
h(this, M, !1);
|
|
32
|
-
h(this,
|
|
32
|
+
h(this, y);
|
|
33
33
|
h(this, D);
|
|
34
|
-
h(this, P);
|
|
35
34
|
h(this, B);
|
|
35
|
+
h(this, N);
|
|
36
36
|
h(this, dt, /* @__PURE__ */ c(() => {
|
|
37
37
|
if (!t(this, C)) return;
|
|
38
38
|
const e = t(this, C).querySelector(".ng-container-body");
|
|
39
|
-
e && (g(this,
|
|
39
|
+
e && (g(this, N, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), t(this,
|
|
41
|
+
})), t(this, N).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
w(this, "refresh", /* @__PURE__ */ c(() => {
|
|
44
|
-
if (!t(this, C) || !t(this,
|
|
45
|
-
const e = t(this,
|
|
44
|
+
if (!t(this, C) || !t(this, y) || t(this, M)) return;
|
|
45
|
+
const e = t(this, y).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const
|
|
47
|
+
const o = t(this, y).track, r = t(this, y).thumb, n = t(this, C).querySelector(".ng-container-bottom"), l = e.clientWidth, a = s.scrollWidth;
|
|
48
48
|
if (l !== 0 && a > l)
|
|
49
|
-
|
|
49
|
+
n && (n.style.display = "flex");
|
|
50
50
|
else {
|
|
51
|
-
|
|
51
|
+
n && (n.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const d =
|
|
54
|
+
const d = o.clientWidth;
|
|
55
55
|
if (d <= 0) return;
|
|
56
56
|
const f = Math.max(Math.min(d * (l / a), d), 20);
|
|
57
57
|
r.style.width = `${f}px`;
|
|
@@ -59,55 +59,55 @@ const Xt = class Xt extends HTMLElement {
|
|
|
59
59
|
let m = 0;
|
|
60
60
|
b > 0 && (m = parseInt(u / b * (d - f), 10)), m < 0 && (m = 0);
|
|
61
61
|
const E = d - f;
|
|
62
|
-
m > E && (m = E), r.style.left = `${m}px`, tt.log(m), t(this,
|
|
62
|
+
m > E && (m = E), r.style.left = `${m}px`, tt.log(m), t(this, y).left.disabled = m === 0, t(this, y).right.disabled = m >= E - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
h(this,
|
|
65
|
-
if (!t(this,
|
|
66
|
-
const s = t(this,
|
|
67
|
-
if (!
|
|
68
|
-
const r = t(this,
|
|
64
|
+
h(this, P, /* @__PURE__ */ c((e) => {
|
|
65
|
+
if (!t(this, y)) return !1;
|
|
66
|
+
const s = t(this, y).container, o = s.querySelector("table");
|
|
67
|
+
if (!o) return !1;
|
|
68
|
+
const r = t(this, y).track.getBoundingClientRect(), n = t(this, y).thumb.clientWidth;
|
|
69
69
|
let l = e;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
|
-
const a = r.width -
|
|
72
|
-
l > a && (l = a), l = parseInt(l, 10), t(this,
|
|
73
|
-
const d = s.clientWidth, u =
|
|
71
|
+
const a = r.width - n;
|
|
72
|
+
l > a && (l = a), l = parseInt(l, 10), t(this, y).thumb.style.left = `${l}px`, t(this, y).left.disabled = l === 0, t(this, y).right.disabled = l >= a - 1;
|
|
73
|
+
const d = s.clientWidth, u = o.scrollWidth - d;
|
|
74
74
|
return a > 0 && u > 0 && (s.scrollLeft = l / a * u), l > 0 && l < a - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
h(this, ft, /* @__PURE__ */ c(() => {
|
|
77
|
-
const e = /* @__PURE__ */ c((
|
|
78
|
-
clearInterval(t(this, D)), clearInterval(t(this,
|
|
79
|
-
const r = parseInt(t(this,
|
|
80
|
-
t(this,
|
|
81
|
-
clearInterval(t(this, D)), g(this,
|
|
82
|
-
const
|
|
83
|
-
t(this,
|
|
77
|
+
const e = /* @__PURE__ */ c((o) => {
|
|
78
|
+
clearInterval(t(this, D)), clearInterval(t(this, B));
|
|
79
|
+
const r = parseInt(t(this, y).thumb.style.left || 0, 10);
|
|
80
|
+
t(this, P).call(this, r + o), g(this, D, setInterval(() => {
|
|
81
|
+
clearInterval(t(this, D)), g(this, B, setInterval(() => {
|
|
82
|
+
const n = parseInt(t(this, y).thumb.style.left || 0, 10);
|
|
83
|
+
t(this, P).call(this, n + o) || clearInterval(t(this, B));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ c(() => {
|
|
87
|
-
clearInterval(t(this, D)), clearInterval(t(this,
|
|
87
|
+
clearInterval(t(this, D)), clearInterval(t(this, B));
|
|
88
88
|
}, "clearTimer");
|
|
89
|
-
["mouseup", "mouseleave", "touchend"].forEach((
|
|
90
|
-
t(this,
|
|
91
|
-
}), t(this,
|
|
92
|
-
|
|
93
|
-
}), t(this,
|
|
94
|
-
|
|
95
|
-
}), t(this,
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
const r = t(this,
|
|
99
|
-
t(this,
|
|
100
|
-
}), t(this,
|
|
101
|
-
if (
|
|
102
|
-
|
|
89
|
+
["mouseup", "mouseleave", "touchend"].forEach((o) => {
|
|
90
|
+
t(this, y).left.addEventListener(o, s), t(this, y).right.addEventListener(o, s), t(this, y).track.addEventListener(o, s);
|
|
91
|
+
}), t(this, y).left.addEventListener("mousedown", (o) => {
|
|
92
|
+
o.button === 0 && e(-20);
|
|
93
|
+
}), t(this, y).right.addEventListener("mousedown", (o) => {
|
|
94
|
+
o.button === 0 && e(20);
|
|
95
|
+
}), t(this, y).left.addEventListener("touchstart", () => e(-20)), t(this, y).right.addEventListener("touchstart", () => e(20)), t(this, y).track.addEventListener("mousedown", (o) => {
|
|
96
|
+
if (o.button !== 0) return;
|
|
97
|
+
o.preventDefault();
|
|
98
|
+
const r = t(this, y).track.getBoundingClientRect(), n = t(this, y).thumb.clientWidth;
|
|
99
|
+
t(this, P).call(this, o.clientX - r.left - n / 2);
|
|
100
|
+
}), t(this, y).thumb.addEventListener("mousedown", (o) => {
|
|
101
|
+
if (o.button !== 0) return;
|
|
102
|
+
o.stopPropagation(), o.preventDefault(), g(this, M, !0), this.shiftX = o.clientX - t(this, y).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ c((l) => {
|
|
104
104
|
if (!t(this, M)) return;
|
|
105
|
-
const a = t(this,
|
|
106
|
-
t(this,
|
|
107
|
-
}, "onMouseMove"),
|
|
108
|
-
g(this, M, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup",
|
|
105
|
+
const a = t(this, y).track.getBoundingClientRect();
|
|
106
|
+
t(this, P).call(this, l.clientX - a.left - this.shiftX);
|
|
107
|
+
}, "onMouseMove"), n = /* @__PURE__ */ c(() => {
|
|
108
|
+
g(this, M, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", n), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup",
|
|
110
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", n);
|
|
111
111
|
});
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
@@ -182,7 +182,7 @@ const Xt = class Xt extends HTMLElement {
|
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
g(this,
|
|
185
|
+
g(this, y, {
|
|
186
186
|
container: s,
|
|
187
187
|
track: this.querySelector(".ng-scroll-track"),
|
|
188
188
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
@@ -195,10 +195,10 @@ const Xt = class Xt extends HTMLElement {
|
|
|
195
195
|
e();
|
|
196
196
|
}
|
|
197
197
|
disconnectedCallback() {
|
|
198
|
-
t(this,
|
|
198
|
+
t(this, N) && t(this, N).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
C = new WeakMap(), M = new WeakMap(),
|
|
201
|
+
C = new WeakMap(), M = new WeakMap(), y = new WeakMap(), D = new WeakMap(), B = new WeakMap(), N = new WeakMap(), dt = new WeakMap(), P = new WeakMap(), ft = new WeakMap(), c(Xt, "NineTableHScrollBar");
|
|
202
202
|
let It = Xt;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", It);
|
|
204
204
|
var Y, I, S, it, st, ut;
|
|
@@ -217,17 +217,17 @@ const Ut = class Ut extends HTMLElement {
|
|
|
217
217
|
if (!t(this, Y) || !t(this, S) || t(this, I)) return;
|
|
218
218
|
const e = t(this, S).container, s = e.querySelector("table");
|
|
219
219
|
if (!s) return;
|
|
220
|
-
const
|
|
221
|
-
if (l <=
|
|
220
|
+
const o = t(this, S).track, r = t(this, S).thumb, n = e.clientHeight, l = s.scrollHeight;
|
|
221
|
+
if (l <= n) {
|
|
222
222
|
r.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
223
223
|
return;
|
|
224
224
|
} else
|
|
225
225
|
r.style.display = "block";
|
|
226
|
-
const a =
|
|
226
|
+
const a = o.clientHeight;
|
|
227
227
|
if (a <= 0) return;
|
|
228
|
-
const d = Math.max(Math.min(a * (
|
|
228
|
+
const d = Math.max(Math.min(a * (n / l), a), 20);
|
|
229
229
|
r.style.height = `${d}px`;
|
|
230
|
-
const f = e.scrollTop, u = l -
|
|
230
|
+
const f = e.scrollTop, u = l - n;
|
|
231
231
|
let b = 0;
|
|
232
232
|
u > 0 && (b = f / u * (a - d));
|
|
233
233
|
const m = a - d;
|
|
@@ -240,25 +240,25 @@ const Ut = class Ut extends HTMLElement {
|
|
|
240
240
|
}), t(this, S).thumb.addEventListener("mousedown", (s) => {
|
|
241
241
|
if (s.button !== 0) return;
|
|
242
242
|
s.stopPropagation(), s.preventDefault(), g(this, I, !0), g(this, it, s.clientY), g(this, st, e.scrollTop);
|
|
243
|
-
const
|
|
243
|
+
const o = /* @__PURE__ */ c((n) => {
|
|
244
244
|
if (!t(this, I)) return;
|
|
245
|
-
const l = t(this, S).track.getBoundingClientRect(), a = t(this, S).thumb.clientHeight, f = l.height - a, u =
|
|
245
|
+
const l = t(this, S).track.getBoundingClientRect(), a = t(this, S).thumb.clientHeight, f = l.height - a, u = n.clientY - t(this, it), b = e.clientHeight, m = e.querySelector("table");
|
|
246
246
|
tt.log(m), tt.log(m.scrollHeight);
|
|
247
247
|
const T = m.scrollHeight - b;
|
|
248
248
|
if (f > 0 && T > 0) {
|
|
249
|
-
const
|
|
250
|
-
e.scrollTop = t(this, st) +
|
|
249
|
+
const O = u / f * T;
|
|
250
|
+
e.scrollTop = t(this, st) + O;
|
|
251
251
|
}
|
|
252
252
|
this.refresh();
|
|
253
253
|
}, "onMouseMove"), r = /* @__PURE__ */ c(() => {
|
|
254
|
-
g(this, I, !1), document.removeEventListener("mousemove",
|
|
254
|
+
g(this, I, !1), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
255
255
|
}, "onMouseUp");
|
|
256
|
-
document.addEventListener("mousemove",
|
|
256
|
+
document.addEventListener("mousemove", o), document.addEventListener("mouseup", r);
|
|
257
257
|
}), t(this, S).track.addEventListener("mousedown", (s) => {
|
|
258
258
|
if (s.button !== 0 || s.target === t(this, S).thumb) return;
|
|
259
|
-
const
|
|
259
|
+
const o = t(this, S).track.getBoundingClientRect(), r = t(this, S).thumb.clientHeight, n = s.clientY - o.top - r / 2, a = o.height - r, d = e.clientHeight, u = e.querySelector("table").scrollHeight - d;
|
|
260
260
|
if (a > 0 && u > 0) {
|
|
261
|
-
const b = Math.max(0, Math.min(1,
|
|
261
|
+
const b = Math.max(0, Math.min(1, n / a));
|
|
262
262
|
e.scrollTop = b * u;
|
|
263
263
|
}
|
|
264
264
|
this.refresh();
|
|
@@ -366,10 +366,10 @@ const H = class H {
|
|
|
366
366
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
367
367
|
*/
|
|
368
368
|
static compile(i) {
|
|
369
|
-
var
|
|
369
|
+
var o, r, n, l;
|
|
370
370
|
if (!i) return null;
|
|
371
371
|
const e = i.cloneNode(!0);
|
|
372
|
-
return t(
|
|
372
|
+
return t(o = H, bt).call(o, e), t(r = H, K).call(r, e, "thead"), t(n = H, K).call(n, e, "tbody"), t(l = H, K).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((a, d) => {
|
|
373
373
|
const f = a.getAttribute("fixed");
|
|
374
374
|
f && e.querySelectorAll(`thead [data-col="${d}"], tbody [data-col="${d}"], tfoot [data-col="${d}"]`).forEach((u) => {
|
|
375
375
|
u.setAttribute("fixed", f);
|
|
@@ -379,12 +379,12 @@ const H = class H {
|
|
|
379
379
|
};
|
|
380
380
|
bt = new WeakMap(), K = new WeakMap(), c(H, "TableCompiler"), h(H, bt, /* @__PURE__ */ c((i) => {
|
|
381
381
|
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
|
|
382
|
+
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, o = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
383
|
+
for (let n = 0; n < s; n++) {
|
|
384
384
|
const l = document.createElement("col");
|
|
385
|
-
l.setAttribute("width", r),
|
|
385
|
+
l.setAttribute("width", r), o.appendChild(l);
|
|
386
386
|
}
|
|
387
|
-
i.prepend(
|
|
387
|
+
i.prepend(o);
|
|
388
388
|
}
|
|
389
389
|
if (!i.querySelector("thead")) {
|
|
390
390
|
const e = document.createElement("thead"), s = i.querySelector("colgroup");
|
|
@@ -392,13 +392,13 @@ bt = new WeakMap(), K = new WeakMap(), c(H, "TableCompiler"), h(H, bt, /* @__PUR
|
|
|
392
392
|
}
|
|
393
393
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
394
394
|
}, "#ensureTableStructure")), h(H, K, /* @__PURE__ */ c((i, e) => {
|
|
395
|
-
const s = Array.from(i.querySelectorAll(e + " tr")),
|
|
396
|
-
if (r === 0 ||
|
|
397
|
-
let
|
|
398
|
-
|
|
399
|
-
|
|
395
|
+
const s = Array.from(i.querySelectorAll(e + " tr")), o = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
396
|
+
if (r === 0 || o.length === 0) return;
|
|
397
|
+
let n = 0;
|
|
398
|
+
o.forEach((a) => {
|
|
399
|
+
n += a.colSpan || 1;
|
|
400
400
|
});
|
|
401
|
-
const l = Array.from(Array(r), () => Array(
|
|
401
|
+
const l = Array.from(Array(r), () => Array(n).fill(null));
|
|
402
402
|
s.forEach((a) => {
|
|
403
403
|
const d = a.sectionRowIndex;
|
|
404
404
|
let f = 0;
|
|
@@ -411,7 +411,7 @@ bt = new WeakMap(), K = new WeakMap(), c(H, "TableCompiler"), h(H, bt, /* @__PUR
|
|
|
411
411
|
const b = u.rowSpan || 1, m = u.colSpan || 1;
|
|
412
412
|
for (let E = 0; E < b; E++)
|
|
413
413
|
for (let T = 0; T < m; T++)
|
|
414
|
-
d + E < r && f + T <
|
|
414
|
+
d + E < r && f + T < n && (l[d + E][f + T] = E === 0 && T === 0 ? "1" : "0");
|
|
415
415
|
});
|
|
416
416
|
}), s.forEach((a) => {
|
|
417
417
|
const d = a.sectionRowIndex;
|
|
@@ -425,10 +425,10 @@ bt = new WeakMap(), K = new WeakMap(), c(H, "TableCompiler"), h(H, bt, /* @__PUR
|
|
|
425
425
|
});
|
|
426
426
|
}, "#resetColIndex"));
|
|
427
427
|
let Wt = H;
|
|
428
|
-
var
|
|
428
|
+
var p, _, R, $, V, j, gt, yt, nt, ot, pt, mt, rt, F, xt;
|
|
429
429
|
const Kt = class Kt {
|
|
430
430
|
constructor(i) {
|
|
431
|
-
h(this,
|
|
431
|
+
h(this, p);
|
|
432
432
|
h(this, _, /* @__PURE__ */ new Map());
|
|
433
433
|
h(this, R, null);
|
|
434
434
|
h(this, $, null);
|
|
@@ -436,48 +436,48 @@ const Kt = class Kt {
|
|
|
436
436
|
h(this, j, 40);
|
|
437
437
|
w(this, "refresh", /* @__PURE__ */ c(() => {
|
|
438
438
|
var e;
|
|
439
|
-
const i = t(this,
|
|
440
|
-
i && (t(this, nt).call(this), t(this, F).call(this, i.scrollTop), (e = t(this,
|
|
439
|
+
const i = t(this, p).querySelector(".ng-container-body");
|
|
440
|
+
i && (t(this, nt).call(this), t(this, F).call(this, i.scrollTop), (e = t(this, p).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
441
441
|
}, "refresh"));
|
|
442
442
|
w(this, "initialize", /* @__PURE__ */ c(() => {
|
|
443
|
-
g(this, R, null), t(this, _).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
444
|
-
const r = t(this,
|
|
443
|
+
g(this, R, null), t(this, _).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
444
|
+
const r = t(this, p).querySelector(o);
|
|
445
445
|
if (!r) return;
|
|
446
|
-
const
|
|
447
|
-
if (!
|
|
448
|
-
const l =
|
|
446
|
+
const n = r.querySelector("table");
|
|
447
|
+
if (!n) return;
|
|
448
|
+
const l = n.querySelector("tbody");
|
|
449
449
|
if (!l) return;
|
|
450
450
|
const d = Array.from(l.querySelectorAll("tr")).map((f) => f.cloneNode(!0));
|
|
451
|
-
t(this, _).set(
|
|
451
|
+
t(this, _).set(o, d);
|
|
452
452
|
});
|
|
453
|
-
const i = t(this,
|
|
453
|
+
const i = t(this, p).querySelector(".ng-container-body"), e = t(this, p).querySelector(".ng-container-left"), s = t(this, p).querySelector(".ng-container-right");
|
|
454
454
|
if (i) {
|
|
455
|
-
t(this,
|
|
456
|
-
let
|
|
457
|
-
const r = /* @__PURE__ */ c((
|
|
455
|
+
t(this, yt).call(this, i), t(this, rt).call(this), t(this, nt).call(this), t(this, F).call(this, i.scrollTop);
|
|
456
|
+
let o = i.scrollTop;
|
|
457
|
+
const r = /* @__PURE__ */ c((n) => {
|
|
458
458
|
var l;
|
|
459
|
-
e && e.scrollTop !==
|
|
459
|
+
e && e.scrollTop !== n && (e.scrollTop = n), s && s.scrollTop !== n && (s.scrollTop = n), t(this, F).call(this, n), (l = t(this, p).querySelector("nine-table-vscrollbar")) == null || l.refresh();
|
|
460
460
|
}, "syncScroll");
|
|
461
461
|
i.addEventListener("scroll", () => {
|
|
462
|
-
const
|
|
463
|
-
|
|
462
|
+
const n = i.scrollTop;
|
|
463
|
+
o !== n && (o = n, r(n));
|
|
464
464
|
});
|
|
465
465
|
}
|
|
466
466
|
}, "initialize"));
|
|
467
467
|
h(this, gt, /* @__PURE__ */ c((i, e) => {
|
|
468
468
|
const s = t(this, _).get(e);
|
|
469
469
|
if (!s || s.length === 0) return;
|
|
470
|
-
const
|
|
471
|
-
if (!
|
|
472
|
-
|
|
473
|
-
const r =
|
|
470
|
+
const o = i.querySelector("tbody");
|
|
471
|
+
if (!o) return;
|
|
472
|
+
o.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
473
|
+
const r = o.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
474
474
|
for (let l = 0; l < t(this, j); l++)
|
|
475
475
|
s.forEach((a) => {
|
|
476
|
-
|
|
476
|
+
n.appendChild(a.cloneNode(!0));
|
|
477
477
|
});
|
|
478
|
-
r ? r.before(
|
|
478
|
+
r ? r.before(n) : o.appendChild(n);
|
|
479
479
|
}, "#renderRows"));
|
|
480
|
-
h(this,
|
|
480
|
+
h(this, yt, /* @__PURE__ */ c((i) => {
|
|
481
481
|
if (t(this, R) !== null && t(this, R) > 0)
|
|
482
482
|
return t(this, R);
|
|
483
483
|
const e = t(this, _).get(".ng-container-body");
|
|
@@ -485,25 +485,25 @@ const Kt = class Kt {
|
|
|
485
485
|
const s = i.querySelector("tbody");
|
|
486
486
|
if (!s) return 24;
|
|
487
487
|
s.querySelectorAll("tr:not(.nodata)").forEach((b) => b.remove());
|
|
488
|
-
const
|
|
488
|
+
const o = s.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
489
489
|
e.forEach((b) => {
|
|
490
490
|
r.appendChild(b.cloneNode(!0));
|
|
491
|
-
}),
|
|
492
|
-
const
|
|
493
|
-
(l === "none" || window.getComputedStyle(
|
|
491
|
+
}), o ? o.before(r) : s.appendChild(r);
|
|
492
|
+
const n = t(this, p), l = n.style.display, a = n.style.visibility, d = n.style.position;
|
|
493
|
+
(l === "none" || window.getComputedStyle(n).display === "none") && (n.style.display = "block", n.style.visibility = "hidden", n.style.position = "absolute");
|
|
494
494
|
let f = 0;
|
|
495
495
|
const u = s.querySelectorAll("tr:not(.nodata)");
|
|
496
496
|
return u.forEach((b) => {
|
|
497
497
|
f += b.offsetHeight || b.getBoundingClientRect().height;
|
|
498
|
-
}), u.forEach((b) => b.remove()),
|
|
498
|
+
}), u.forEach((b) => b.remove()), n.style.display = l, n.style.visibility = a, n.style.position = d, g(this, R, f > 0 ? f : 24), t(this, ot).call(this), t(this, R);
|
|
499
499
|
}, "#measureAndCacheHeight"));
|
|
500
500
|
h(this, nt, /* @__PURE__ */ c(() => {
|
|
501
|
-
var r,
|
|
502
|
-
if (!t(this,
|
|
503
|
-
const e = (typeof ((r = t(this,
|
|
501
|
+
var r, n, l, a;
|
|
502
|
+
if (!t(this, p).querySelector(".ng-container-body")) return;
|
|
503
|
+
const e = (typeof ((r = t(this, p).data) == null ? void 0 : r.count) == "function" ? t(this, p).data.count() : null) ?? ((l = (n = t(this, p).dataManager) == null ? void 0 : n.rawRecords) == null ? void 0 : l.length) ?? ((a = t(this, p).data) == null ? void 0 : a.length) ?? 100, s = t(this, R) || 24, o = e * s;
|
|
504
504
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((d) => {
|
|
505
|
-
const f = t(this,
|
|
506
|
-
u && (u.style.height = `${
|
|
505
|
+
const f = t(this, p).querySelector(d), u = f == null ? void 0 : f.querySelector("table");
|
|
506
|
+
u && (u.style.height = `${o}px`);
|
|
507
507
|
});
|
|
508
508
|
}, "#updateVirtualScrollHeight"));
|
|
509
509
|
h(this, ot, /* @__PURE__ */ c(() => {
|
|
@@ -513,69 +513,69 @@ const Kt = class Kt {
|
|
|
513
513
|
} else
|
|
514
514
|
g(this, j, 40);
|
|
515
515
|
}, "#updateRowCount"));
|
|
516
|
-
h(this,
|
|
516
|
+
h(this, pt, /* @__PURE__ */ c(() => {
|
|
517
517
|
var a, d, f;
|
|
518
|
-
const i = t(this,
|
|
518
|
+
const i = t(this, p).querySelector(".ng-container-left table"), e = t(this, p).querySelector(".ng-container-body table"), s = t(this, p).querySelector(".ng-container-right table");
|
|
519
519
|
if (!e) return;
|
|
520
|
-
const
|
|
520
|
+
const o = i ? Array.from(i.querySelectorAll("tr")) : [], r = Array.from(e.querySelectorAll("tr")), n = s ? Array.from(s.querySelectorAll("tr")) : [], l = Math.max(o.length, r.length, n.length);
|
|
521
521
|
for (let u = 0; u < l; u++) {
|
|
522
522
|
const b = [
|
|
523
|
-
((a =
|
|
523
|
+
((a = o[u]) == null ? void 0 : a.getBoundingClientRect().height) || 0,
|
|
524
524
|
((d = r[u]) == null ? void 0 : d.getBoundingClientRect().height) || 0,
|
|
525
|
-
((f =
|
|
525
|
+
((f = n[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
526
526
|
], m = Math.max(...b);
|
|
527
|
-
m > 0 && (
|
|
527
|
+
m > 0 && (o[u] && (o[u].style.height = `${m}px`), r[u] && (r[u].style.height = `${m}px`), n[u] && (n[u].style.height = `${m}px`));
|
|
528
528
|
}
|
|
529
529
|
}, "#syncRowHeights"));
|
|
530
530
|
h(this, mt, /* @__PURE__ */ c(() => {
|
|
531
|
-
!t(this,
|
|
531
|
+
!t(this, p) || !(t(this, p) instanceof HTMLElement) || (g(this, $, new ResizeObserver((i) => {
|
|
532
532
|
for (const e of i) {
|
|
533
533
|
const s = e.target;
|
|
534
534
|
if (!s.classList.contains("active")) continue;
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
535
|
+
const o = e.contentRect.height;
|
|
536
|
+
if (o > 0) {
|
|
537
537
|
let r = 0;
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
const l = Math.max(
|
|
538
|
+
const n = s.querySelector("thead");
|
|
539
|
+
n && (r += n.offsetHeight || n.getBoundingClientRect().height);
|
|
540
|
+
const l = Math.max(o - r, 100);
|
|
541
541
|
t(this, V) !== l && (g(this, V, l), t(this, ot).call(this), t(this, R) !== null && t(this, rt).call(this));
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
})), t(this, $).observe(t(this,
|
|
544
|
+
})), t(this, $).observe(t(this, p)));
|
|
545
545
|
}, "#initResizeObserver"));
|
|
546
546
|
h(this, rt, /* @__PURE__ */ c(() => {
|
|
547
547
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
548
|
-
const e = t(this,
|
|
548
|
+
const e = t(this, p).querySelector(i);
|
|
549
549
|
e && e.querySelector("tbody") && t(this, gt).call(this, e, i);
|
|
550
|
-
}), t(this,
|
|
550
|
+
}), t(this, pt).call(this);
|
|
551
551
|
}, "#renderAllContainers"));
|
|
552
552
|
h(this, F, /* @__PURE__ */ c((i) => {
|
|
553
553
|
var r;
|
|
554
554
|
const e = t(this, R);
|
|
555
555
|
if (!e || e <= 0) return;
|
|
556
|
-
const s = Math.max(0, Math.floor(i / e)),
|
|
557
|
-
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
558
|
-
const l = t(this,
|
|
556
|
+
const s = Math.max(0, Math.floor(i / e)), o = ((r = t(this, _).get(".ng-container-body")) == null ? void 0 : r.length) || 1;
|
|
557
|
+
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
558
|
+
const l = t(this, p).querySelector(n);
|
|
559
559
|
if (!l) return;
|
|
560
560
|
const a = l.querySelector("tbody");
|
|
561
561
|
if (!a) return;
|
|
562
562
|
Array.from(a.querySelectorAll("tr:not(.nodata)")).forEach((f, u) => {
|
|
563
|
-
var E, T,
|
|
564
|
-
const b = s + Math.floor(u /
|
|
565
|
-
f.style.display = "", t(this,
|
|
563
|
+
var E, T, O, Qt;
|
|
564
|
+
const b = s + Math.floor(u / o), m = (typeof t(this, p).getData == "function" ? t(this, p).getData(b) : null) ?? (typeof ((E = t(this, p).data) == null ? void 0 : E.get) == "function" ? t(this, p).data.get(b) : null) ?? ((O = (T = t(this, p).dataManager) == null ? void 0 : T.rawRecords) == null ? void 0 : O[b]) ?? ((Qt = t(this, p).data) == null ? void 0 : Qt[b]) ?? { _index: b };
|
|
565
|
+
f.style.display = "", t(this, xt).call(this, f, m, b);
|
|
566
566
|
});
|
|
567
567
|
});
|
|
568
568
|
}, "#handleScroll"));
|
|
569
|
-
h(this,
|
|
570
|
-
i.dataset.row = s, Array.from(i.cells).forEach((
|
|
571
|
-
const
|
|
572
|
-
|
|
569
|
+
h(this, xt, /* @__PURE__ */ c((i, e, s) => {
|
|
570
|
+
i.dataset.row = s, Array.from(i.cells).forEach((o, r) => {
|
|
571
|
+
const n = o.dataset.bind;
|
|
572
|
+
n && e && e[n] !== void 0 ? o.textContent = e[n] : o.textContent = e ? e[Object.keys(e)[r]] ?? `R${s}C${r}` : `ν ${s + 1}`, o.dataset.row = s;
|
|
573
573
|
});
|
|
574
574
|
}, "#bindRowData"));
|
|
575
575
|
w(this, "destroy", /* @__PURE__ */ c(() => {
|
|
576
576
|
t(this, $) && (t(this, $).disconnect(), g(this, $, null));
|
|
577
577
|
}, "destroy"));
|
|
578
|
-
g(this,
|
|
578
|
+
g(this, p, i), t(this, mt).call(this);
|
|
579
579
|
}
|
|
580
580
|
getRowHeight() {
|
|
581
581
|
return t(this, R);
|
|
@@ -585,55 +585,65 @@ const Kt = class Kt {
|
|
|
585
585
|
return ((e = t(this, _).get(i)) == null ? void 0 : e.length) || 1;
|
|
586
586
|
}
|
|
587
587
|
};
|
|
588
|
-
|
|
589
|
-
let
|
|
590
|
-
var Z, G,
|
|
588
|
+
p = new WeakMap(), _ = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), V = new WeakMap(), j = new WeakMap(), gt = new WeakMap(), yt = new WeakMap(), nt = new WeakMap(), ot = new WeakMap(), pt = new WeakMap(), mt = new WeakMap(), rt = new WeakMap(), F = new WeakMap(), xt = new WeakMap(), c(Kt, "RowManager");
|
|
589
|
+
let zt = Kt;
|
|
590
|
+
var Z, G, vt, wt, St, Et, Rt;
|
|
591
591
|
const et = class et extends HTMLElement {
|
|
592
592
|
constructor() {
|
|
593
593
|
super();
|
|
594
594
|
h(this, Z, null);
|
|
595
595
|
h(this, G);
|
|
596
|
-
h(this,
|
|
596
|
+
h(this, vt, /* @__PURE__ */ c(() => {
|
|
597
597
|
[
|
|
598
598
|
{ selector: ".ng-container-body", type: null },
|
|
599
599
|
{ selector: ".ng-container-left", type: "left" },
|
|
600
600
|
{ selector: ".ng-container-right", type: "right" }
|
|
601
|
-
].forEach(({ selector: s, type:
|
|
601
|
+
].forEach(({ selector: s, type: o }) => {
|
|
602
602
|
const r = this.querySelector(s);
|
|
603
603
|
if (!r) return;
|
|
604
|
-
const
|
|
605
|
-
r.innerHTML = "", r.appendChild(
|
|
604
|
+
const n = t(this, St).call(this, t(this, Z), o);
|
|
605
|
+
r.innerHTML = "", r.appendChild(n);
|
|
606
606
|
});
|
|
607
607
|
}, "#renderSplitContainers"));
|
|
608
608
|
h(this, wt, /* @__PURE__ */ c(() => {
|
|
609
609
|
["left", "right"].forEach((e) => {
|
|
610
|
-
const s = this.querySelector(`.ng-container-${e}`),
|
|
611
|
-
if (!s || !
|
|
610
|
+
const s = this.querySelector(`.ng-container-${e}`), o = s == null ? void 0 : s.querySelector("table");
|
|
611
|
+
if (!s || !o) return;
|
|
612
612
|
let r = 0;
|
|
613
|
-
|
|
614
|
-
const l = parseInt(
|
|
613
|
+
o.querySelectorAll("col").forEach((n) => {
|
|
614
|
+
const l = parseInt(n.getAttribute("width"), 10);
|
|
615
615
|
isNaN(r) || (r += l);
|
|
616
616
|
}), s.style.flex = `0 0 ${r}px`, s.style.width = `${r}px`;
|
|
617
617
|
});
|
|
618
618
|
}, "#updateContainerWidths"));
|
|
619
619
|
w(this, "generate", /* @__PURE__ */ c((e) => {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
620
|
+
var o;
|
|
621
|
+
if (!e) return;
|
|
622
|
+
g(this, Z, Wt.compile(e)), t(this, Z).style.display = "table", t(this, vt).call(this), t(this, wt).call(this);
|
|
623
|
+
const s = ((o = this.querySelector("thead")) == null ? void 0 : o.getBoundingClientRect().height) || 30;
|
|
624
|
+
this.querySelectorAll("tbody.fixed-tbody").forEach((r) => {
|
|
625
|
+
r.style.top = `${s}px`;
|
|
626
|
+
}), t(this, G).initialize(), setTimeout(() => {
|
|
627
|
+
var r;
|
|
628
|
+
(r = this.querySelector("nine-table-hscrollbar")) == null || r.refresh();
|
|
629
|
+
}, 0);
|
|
624
630
|
}, "generate"));
|
|
625
631
|
/**
|
|
626
632
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
627
633
|
*/
|
|
628
634
|
h(this, St, /* @__PURE__ */ c((e, s) => {
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
}), n
|
|
635
|
+
const o = e.cloneNode(!0), r = o.querySelector("tbody");
|
|
636
|
+
if (r) {
|
|
637
|
+
const n = document.createElement("tbody");
|
|
638
|
+
n.className = "fixed-tbody", r.className = "bindable-tbody", r.before(n);
|
|
639
|
+
}
|
|
640
|
+
return s === "left" ? o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((n) => {
|
|
641
|
+
n.getAttribute("fixed") !== "left" && n.remove();
|
|
642
|
+
}) : s === "right" ? o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((n) => {
|
|
643
|
+
n.getAttribute("fixed") !== "right" && n.remove();
|
|
644
|
+
}) : o.querySelectorAll("[fixed=left], [fixed=right]").forEach((n) => {
|
|
645
|
+
n.remove();
|
|
646
|
+
}), o;
|
|
637
647
|
}, "#createSplitTable"));
|
|
638
648
|
w(this, "getRowHeight", /* @__PURE__ */ c(() => t(this, G).getRowHeight(), "getRowHeight"));
|
|
639
649
|
w(this, "scrollToX", /* @__PURE__ */ c((e) => {
|
|
@@ -689,6 +699,13 @@ const et = class et extends HTMLElement {
|
|
|
689
699
|
position: sticky;
|
|
690
700
|
top: 0;
|
|
691
701
|
}
|
|
702
|
+
nine-table-sheet tbody.fixed-tbody {
|
|
703
|
+
position: sticky;
|
|
704
|
+
--top: 25px; /* ν€λ(thead)μ λμ΄λ§νΌ top κ°μ μ£Όκ±°λ ν€λ λ°λ‘ λ°μ μ€λλ‘ μ€μ */
|
|
705
|
+
z-index: 4;
|
|
706
|
+
background-color: red;
|
|
707
|
+
height: 100px;
|
|
708
|
+
}
|
|
692
709
|
|
|
693
710
|
|
|
694
711
|
nine-table-sheet .ng-container-body {
|
|
@@ -790,7 +807,7 @@ const et = class et extends HTMLElement {
|
|
|
790
807
|
</div>
|
|
791
808
|
`;
|
|
792
809
|
}, "#render"));
|
|
793
|
-
g(this, G, new
|
|
810
|
+
g(this, G, new zt(this));
|
|
794
811
|
}
|
|
795
812
|
connectedCallback() {
|
|
796
813
|
t(this, Et).call(this);
|
|
@@ -799,7 +816,7 @@ const et = class et extends HTMLElement {
|
|
|
799
816
|
this.innerHTML = "", tt.log("NineTableSheet destroyed.");
|
|
800
817
|
}
|
|
801
818
|
};
|
|
802
|
-
Z = new WeakMap(), G = new WeakMap(),
|
|
819
|
+
Z = new WeakMap(), G = new WeakMap(), vt = new WeakMap(), wt = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), Rt = new WeakMap(), c(et, "NineTableSheet"), w(et, "SCROLLBAR_SIZE", 16);
|
|
803
820
|
let ht = et;
|
|
804
821
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ht);
|
|
805
822
|
var kt, lt;
|
|
@@ -809,21 +826,21 @@ const jt = class jt extends HTMLElement {
|
|
|
809
826
|
h(this, kt, /* @__PURE__ */ c(() => {
|
|
810
827
|
var e;
|
|
811
828
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
812
|
-
var
|
|
813
|
-
const
|
|
814
|
-
t(this, lt).call(this, r,
|
|
829
|
+
var n;
|
|
830
|
+
const o = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((n = s.target.closest(".nine-tab-item")) == null ? void 0 : n.dataset.index, 10);
|
|
831
|
+
t(this, lt).call(this, r, o);
|
|
815
832
|
}), t(this, lt).call(this, 0, !1);
|
|
816
833
|
}, "#init"));
|
|
817
834
|
h(this, lt, /* @__PURE__ */ c((e, s = !1) => {
|
|
818
|
-
const
|
|
835
|
+
const o = /* @__PURE__ */ c(() => {
|
|
819
836
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
820
837
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((m) => m.style.setProperty("display", "none"));
|
|
821
838
|
const b = f.filter((m) => m.classList.contains("active"));
|
|
822
839
|
b.length < 2 || b.forEach((m) => {
|
|
823
|
-
const E = parseInt(m.getAttribute("data-index"), 10), T = this.querySelector(`nine-splitter[data-split-index="${E}"]`),
|
|
824
|
-
T &&
|
|
840
|
+
const E = parseInt(m.getAttribute("data-index"), 10), T = this.querySelector(`nine-splitter[data-split-index="${E}"]`), O = f[E + 1];
|
|
841
|
+
T && O && O.classList.contains("active") && T.style.setProperty("display", "flex");
|
|
825
842
|
});
|
|
826
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"),
|
|
843
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), n = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), a = n.querySelectorAll("nine-table-sheet");
|
|
827
844
|
if (!l[e]) return;
|
|
828
845
|
if (!s)
|
|
829
846
|
l.forEach((f, u) => {
|
|
@@ -837,13 +854,13 @@ const jt = class jt extends HTMLElement {
|
|
|
837
854
|
if (f.classList.contains("active") && u.length <= 1)
|
|
838
855
|
return;
|
|
839
856
|
f.classList.toggle("active");
|
|
840
|
-
const b =
|
|
857
|
+
const b = n.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
841
858
|
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
842
859
|
}
|
|
843
|
-
const d =
|
|
860
|
+
const d = n.querySelectorAll("nine-table-sheet.active");
|
|
844
861
|
d == null || d.forEach((f) => {
|
|
845
862
|
f.style.flex = d.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
846
|
-
}),
|
|
863
|
+
}), o();
|
|
847
864
|
}, "#switchSheet"));
|
|
848
865
|
}
|
|
849
866
|
connectedCallback() {
|
|
@@ -851,14 +868,14 @@ const jt = class jt extends HTMLElement {
|
|
|
851
868
|
}
|
|
852
869
|
};
|
|
853
870
|
kt = new WeakMap(), lt = new WeakMap(), c(jt, "NineTableSheets");
|
|
854
|
-
let
|
|
855
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
856
|
-
var k, Tt, ct,
|
|
871
|
+
let Ot = jt;
|
|
872
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Ot);
|
|
873
|
+
var k, Tt, ct, qt;
|
|
857
874
|
const Ft = class Ft {
|
|
858
875
|
constructor(i) {
|
|
859
876
|
h(this, k);
|
|
860
877
|
h(this, Tt, /* @__PURE__ */ c(() => {
|
|
861
|
-
t(this,
|
|
878
|
+
t(this, qt).call(this), new ResizeObserver((i) => {
|
|
862
879
|
for (let e of i)
|
|
863
880
|
t(this, k).getAttribute("auto-height") === "true" && t(this, ct).call(this);
|
|
864
881
|
}).observe(t(this, k));
|
|
@@ -867,14 +884,14 @@ const Ft = class Ft {
|
|
|
867
884
|
var a, d;
|
|
868
885
|
const i = Array.from(t(this, k).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
869
886
|
if (i.length === 0) return;
|
|
870
|
-
const e = parseInt(t(this, k).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())),
|
|
887
|
+
const e = parseInt(t(this, k).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), o = (a = t(this, k).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : a.getBoundingClientRect().height, r = (d = t(this, k).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : d.getBoundingClientRect().height, n = ht.SCROLLBAR_SIZE, l = e * s + o + r + n;
|
|
871
888
|
t(this, k).style.height = `${l}px`;
|
|
872
889
|
}, "#applyAutoHeight"));
|
|
873
|
-
h(this,
|
|
874
|
-
const e = Array.from(t(this, k).children).filter((a) => a.tagName === "TABLE"), s = t(this, k).getAttribute("auto-height") === "true",
|
|
875
|
-
const u = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`, b = d <
|
|
890
|
+
h(this, qt, /* @__PURE__ */ c(() => {
|
|
891
|
+
const e = Array.from(t(this, k).children).filter((a) => a.tagName === "TABLE"), s = t(this, k).getAttribute("auto-height") === "true", o = e.length, r = e.map((a, d) => {
|
|
892
|
+
const u = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`, b = d < o - 1 ? `<nine-splitter class="h" data-split-index="${d}"></nine-splitter>` : "";
|
|
876
893
|
return u + b;
|
|
877
|
-
}).join(""),
|
|
894
|
+
}).join(""), n = e.map((a, d) => `<div class="nine-tab-item ${d === 0 ? "active" : ""}" data-index="${d}">Sheet ${d + 1}</div>`).join("");
|
|
878
895
|
t(this, k).shadowRoot.innerHTML = `
|
|
879
896
|
<style>
|
|
880
897
|
:host {
|
|
@@ -966,7 +983,7 @@ const Ft = class Ft {
|
|
|
966
983
|
<nine-table-sheets>
|
|
967
984
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
968
985
|
<nine-table-sheets-footer>
|
|
969
|
-
<div class="nine-tab-bar">${
|
|
986
|
+
<div class="nine-tab-bar">${n}</div>
|
|
970
987
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
971
988
|
</nine-table-sheets-footer>
|
|
972
989
|
</nine-table-sheets>
|
|
@@ -984,7 +1001,7 @@ const Ft = class Ft {
|
|
|
984
1001
|
g(this, k, i), t(this, Tt).call(this);
|
|
985
1002
|
}
|
|
986
1003
|
};
|
|
987
|
-
k = new WeakMap(), Tt = new WeakMap(), ct = new WeakMap(),
|
|
1004
|
+
k = new WeakMap(), Tt = new WeakMap(), ct = new WeakMap(), qt = new WeakMap(), c(Ft, "LayoutManager");
|
|
988
1005
|
let Dt = Ft;
|
|
989
1006
|
var W, X;
|
|
990
1007
|
const Zt = class Zt {
|
|
@@ -998,34 +1015,34 @@ const Zt = class Zt {
|
|
|
998
1015
|
return t(this, X);
|
|
999
1016
|
}
|
|
1000
1017
|
set at(i) {
|
|
1001
|
-
var s,
|
|
1018
|
+
var s, o;
|
|
1002
1019
|
g(this, X, parseInt(i, 10));
|
|
1003
|
-
const e = ((
|
|
1020
|
+
const e = ((o = (s = t(this, W).owner).querySelector) == null ? void 0 : o.call(s, ".ng-container-body")) || t(this, W).owner.body;
|
|
1004
1021
|
e && !e.querySelector(`tbody.bindable tr[data-row="${t(this, X)}"]`) && setTimeout(() => {
|
|
1005
|
-
var r,
|
|
1006
|
-
(
|
|
1022
|
+
var r, n;
|
|
1023
|
+
(n = (r = t(this, W).owner).scrollTo_V1) == null || n.call(r, t(this, X));
|
|
1007
1024
|
});
|
|
1008
1025
|
}
|
|
1009
1026
|
};
|
|
1010
1027
|
W = new WeakMap(), X = new WeakMap(), c(Zt, "ngRow");
|
|
1011
|
-
let
|
|
1012
|
-
var
|
|
1028
|
+
let Bt = Zt;
|
|
1029
|
+
var q, v, A, J, At, z, Lt, at, Ht, Ct, Q;
|
|
1013
1030
|
const L = class L {
|
|
1014
1031
|
constructor(i, e) {
|
|
1015
|
-
h(this,
|
|
1016
|
-
h(this,
|
|
1017
|
-
h(this,
|
|
1032
|
+
h(this, q);
|
|
1033
|
+
h(this, v);
|
|
1034
|
+
h(this, A, []);
|
|
1018
1035
|
h(this, J, []);
|
|
1019
|
-
h(this,
|
|
1020
|
-
h(this,
|
|
1036
|
+
h(this, At, 0);
|
|
1037
|
+
h(this, z, []);
|
|
1021
1038
|
h(this, Lt, /* @__PURE__ */ c(() => {
|
|
1022
|
-
g(this,
|
|
1023
|
-
const i = t(this,
|
|
1039
|
+
g(this, z, []);
|
|
1040
|
+
const i = t(this, q).template || [];
|
|
1024
1041
|
Array.from(i).forEach((e) => {
|
|
1025
1042
|
var s;
|
|
1026
|
-
t(this,
|
|
1027
|
-
}), (t(this,
|
|
1028
|
-
e.__ng || (e.__ng = t(this, at).call(this)), e.__ng.height = t(this,
|
|
1043
|
+
t(this, z).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1044
|
+
}), (t(this, v).rawRecords || []).forEach((e) => {
|
|
1045
|
+
e.__ng || (e.__ng = t(this, at).call(this)), e.__ng.height = t(this, z).slice();
|
|
1029
1046
|
});
|
|
1030
1047
|
}, "#initialize"));
|
|
1031
1048
|
w(this, "set", /* @__PURE__ */ c((i) => {
|
|
@@ -1035,27 +1052,27 @@ const L = class L {
|
|
|
1035
1052
|
rowState: L.ROW_STATE.EMPTY,
|
|
1036
1053
|
deleted: !1,
|
|
1037
1054
|
filtered: !1,
|
|
1038
|
-
height: t(this,
|
|
1055
|
+
height: t(this, z).slice(),
|
|
1039
1056
|
o: {},
|
|
1040
1057
|
c: {},
|
|
1041
|
-
_: [0, 0, 0, 0, L.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this,
|
|
1058
|
+
_: [0, 0, 0, 0, L.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, z).slice(), -1, {}, {}]
|
|
1042
1059
|
}), "#getDefaultMeta"));
|
|
1043
1060
|
w(this, "reset", /* @__PURE__ */ c(() => {
|
|
1044
|
-
g(this,
|
|
1061
|
+
g(this, A, []), g(this, J, []);
|
|
1045
1062
|
}, "reset"));
|
|
1046
1063
|
w(this, "clear", /* @__PURE__ */ c(() => {
|
|
1047
1064
|
var i;
|
|
1048
|
-
t(this,
|
|
1065
|
+
t(this, v).rawRecords = [], g(this, A, []), g(this, J, []), (i = t(this, v).viewRecords) != null && i.reset && t(this, v).viewRecords.reset();
|
|
1049
1066
|
}, "clear"));
|
|
1050
1067
|
h(this, Ht, /* @__PURE__ */ c((i) => {
|
|
1051
|
-
var
|
|
1068
|
+
var o;
|
|
1052
1069
|
Array.isArray(i) || (i = [i]);
|
|
1053
|
-
const e = typeof ((
|
|
1070
|
+
const e = typeof ((o = t(this, q).fields) == null ? void 0 : o.get) == "function" ? t(this, q).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1054
1071
|
return i.forEach((r) => {
|
|
1055
|
-
const
|
|
1072
|
+
const n = { v: [] };
|
|
1056
1073
|
e.forEach((l) => {
|
|
1057
|
-
|
|
1058
|
-
}), s.push(
|
|
1074
|
+
n.v.push(r[l] !== void 0 && r[l] !== null ? r[l] : "");
|
|
1075
|
+
}), s.push(n);
|
|
1059
1076
|
}), s;
|
|
1060
1077
|
}, "#json2Array"));
|
|
1061
1078
|
h(this, Ct, /* @__PURE__ */ c((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
@@ -1065,52 +1082,52 @@ const L = class L {
|
|
|
1065
1082
|
var r;
|
|
1066
1083
|
i === void 0 && (i = {});
|
|
1067
1084
|
const s = t(this, Ht).call(this, i);
|
|
1068
|
-
t(this,
|
|
1069
|
-
const
|
|
1070
|
-
return e || s.forEach((
|
|
1071
|
-
const a = t(this,
|
|
1085
|
+
t(this, v).rawRecords = t(this, v).rawRecords.concat(t(this, Ct).call(this, s)), this.resetRecords();
|
|
1086
|
+
const o = this.count() - 1;
|
|
1087
|
+
return e || s.forEach((n, l) => {
|
|
1088
|
+
const a = t(this, v).rawRecords[o - l];
|
|
1072
1089
|
a && (a.__ng.rowState = L.ROW_STATE.EMPTY);
|
|
1073
|
-
}), (r = t(this,
|
|
1090
|
+
}), (r = t(this, v).viewRecords) != null && r.reset && t(this, v).viewRecords.reset(), o;
|
|
1074
1091
|
}, "add"));
|
|
1075
1092
|
w(this, "delete", /* @__PURE__ */ c((i) => {
|
|
1076
1093
|
var s;
|
|
1077
1094
|
let e = [];
|
|
1078
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this,
|
|
1079
|
-
if (t(this,
|
|
1080
|
-
const r = t(this,
|
|
1081
|
-
t(this,
|
|
1082
|
-
|
|
1095
|
+
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, v).owner.row.at] : e = [parseInt(i, 10)], e.sort((o, r) => r - o).forEach((o) => {
|
|
1096
|
+
if (t(this, A)[o]) {
|
|
1097
|
+
const r = t(this, A)[o].__ng.rowid;
|
|
1098
|
+
t(this, A)[o].__ng.rowState === L.ROW_STATE.INSERT ? t(this, v).rawRecords = t(this, v).rawRecords.filter((n) => n.__ng.rowid !== r) : t(this, v).rawRecords.forEach((n) => {
|
|
1099
|
+
n.__ng.rowid === r && (n.__ng.deleted = !0, n.__ng.rowState = L.ROW_STATE.DELETE);
|
|
1083
1100
|
});
|
|
1084
1101
|
}
|
|
1085
|
-
}), this.resetRecords(), (s = t(this,
|
|
1102
|
+
}), this.resetRecords(), (s = t(this, v).viewRecords) != null && s.reset && t(this, v).viewRecords.reset();
|
|
1086
1103
|
}, "delete"));
|
|
1087
1104
|
w(this, "setValue", /* @__PURE__ */ c((i, e, s) => {
|
|
1088
1105
|
var a;
|
|
1089
1106
|
i = parseInt(i, 10);
|
|
1090
|
-
const r = (typeof ((a = t(this,
|
|
1107
|
+
const r = (typeof ((a = t(this, q).fields) == null ? void 0 : a.get) == "function" ? t(this, q).fields.get() : []).indexOf(e);
|
|
1091
1108
|
if (r < 0) return;
|
|
1092
|
-
const
|
|
1093
|
-
if (!
|
|
1094
|
-
const l =
|
|
1095
|
-
l !== s &&
|
|
1109
|
+
const n = this.getValidData()[i];
|
|
1110
|
+
if (!n) return;
|
|
1111
|
+
const l = n.v[r];
|
|
1112
|
+
l !== s && n.__ng.rowState !== L.ROW_STATE.INSERT && (n.__ng.o.hasOwnProperty(e) || (n.__ng.o[e] = l), n.__ng.rowState = L.ROW_STATE.UPDATE), n.v[r] = s, t(this, v).owner.refreshData && t(this, v).owner.refreshData(i);
|
|
1096
1113
|
}, "setValue"));
|
|
1097
1114
|
w(this, "resetRecords", /* @__PURE__ */ c(() => {
|
|
1098
|
-
g(this, J, t(this,
|
|
1115
|
+
g(this, J, t(this, v).rawRecords.filter((i) => !i.__ng.deleted)), g(this, A, t(this, v).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, v).rawRecords.forEach((i, e) => {
|
|
1099
1116
|
i.__ng.rowidx = e;
|
|
1100
|
-
}), t(this,
|
|
1117
|
+
}), t(this, A).forEach((i, e) => {
|
|
1101
1118
|
i.__ng.i = e;
|
|
1102
1119
|
});
|
|
1103
1120
|
}, "resetRecords"));
|
|
1104
|
-
w(this, "getValidData", /* @__PURE__ */ c(() => (t(this,
|
|
1121
|
+
w(this, "getValidData", /* @__PURE__ */ c(() => (t(this, A).length === 0 && t(this, v).rawRecords.length > 0 && this.resetRecords(), t(this, A)), "getValidData"));
|
|
1105
1122
|
h(this, Q, /* @__PURE__ */ c((i) => {
|
|
1106
1123
|
var s;
|
|
1107
1124
|
if (!i) return i;
|
|
1108
|
-
const e = typeof ((s = t(this,
|
|
1109
|
-
return Array.isArray(i) ? i.filter((
|
|
1125
|
+
const e = typeof ((s = t(this, q).fields) == null ? void 0 : s.get) == "function" ? t(this, q).fields.get() : [];
|
|
1126
|
+
return Array.isArray(i) ? i.filter((o) => !o.__ng.deleted).map((o) => {
|
|
1110
1127
|
const r = {};
|
|
1111
|
-
return e.forEach((
|
|
1112
|
-
r[
|
|
1113
|
-
}), r.__ng =
|
|
1128
|
+
return e.forEach((n, l) => {
|
|
1129
|
+
r[n] = o.v ? o.v[l] : o[n];
|
|
1130
|
+
}), r.__ng = o.__ng, r;
|
|
1114
1131
|
}) : i;
|
|
1115
1132
|
}, "#conv2"));
|
|
1116
1133
|
w(this, "count", /* @__PURE__ */ c(() => this.getValidData().length, "count"));
|
|
@@ -1120,32 +1137,32 @@ const L = class L {
|
|
|
1120
1137
|
if (!s || s.length <= 0) return;
|
|
1121
1138
|
if (i == null) return t(this, Q).call(this, s);
|
|
1122
1139
|
if (i < 0 || i >= s.length) return null;
|
|
1123
|
-
const
|
|
1140
|
+
const o = typeof ((r = t(this, q).fields) == null ? void 0 : r.get) == "function" ? t(this, q).fields.get() : [];
|
|
1124
1141
|
if (e != null) {
|
|
1125
|
-
const
|
|
1126
|
-
return
|
|
1142
|
+
const n = o.indexOf(e);
|
|
1143
|
+
return n >= 0 ? s[i].v[n] : null;
|
|
1127
1144
|
}
|
|
1128
1145
|
return t(this, Q).call(this, s[i]);
|
|
1129
1146
|
}, "get"));
|
|
1130
|
-
g(this,
|
|
1147
|
+
g(this, q, i), g(this, v, e), t(this, Lt).call(this);
|
|
1131
1148
|
}
|
|
1132
1149
|
get source() {
|
|
1133
|
-
return t(this, Q).call(this, t(this,
|
|
1150
|
+
return t(this, Q).call(this, t(this, v).rawRecords);
|
|
1134
1151
|
}
|
|
1135
1152
|
set source(i) {
|
|
1136
1153
|
this.clear(), this.add(i, !1);
|
|
1137
1154
|
}
|
|
1138
1155
|
get nextId() {
|
|
1139
|
-
return ++se(this,
|
|
1156
|
+
return ++se(this, At)._;
|
|
1140
1157
|
}
|
|
1141
1158
|
get length() {
|
|
1142
|
-
return t(this,
|
|
1159
|
+
return t(this, A).length;
|
|
1143
1160
|
}
|
|
1144
1161
|
getRowCount() {
|
|
1145
1162
|
return this.length;
|
|
1146
1163
|
}
|
|
1147
1164
|
};
|
|
1148
|
-
|
|
1165
|
+
q = new WeakMap(), v = new WeakMap(), A = new WeakMap(), J = new WeakMap(), At = new WeakMap(), z = new WeakMap(), Lt = new WeakMap(), at = new WeakMap(), Ht = new WeakMap(), Ct = new WeakMap(), Q = new WeakMap(), c(L, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1149
1166
|
w(L, "ROW_STATE", {
|
|
1150
1167
|
EMPTY: "EMPTY",
|
|
1151
1168
|
NORMAL: "NORMAL",
|
|
@@ -1153,28 +1170,28 @@ w(L, "ROW_STATE", {
|
|
|
1153
1170
|
UPDATE: "UPDATE",
|
|
1154
1171
|
DELETE: "DELETE"
|
|
1155
1172
|
});
|
|
1156
|
-
let
|
|
1173
|
+
let Nt = L;
|
|
1157
1174
|
const Gt = class Gt {
|
|
1158
1175
|
constructor(i) {
|
|
1159
|
-
this.owner = i, this.row = new
|
|
1176
|
+
this.owner = i, this.row = new Bt(this), this.data = new Nt(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1160
1177
|
var e;
|
|
1161
1178
|
(e = this.owner.view) != null && e.redraw && this.owner.view.redraw();
|
|
1162
1179
|
}, this.setDataSource = (e) => {
|
|
1163
1180
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1164
1181
|
}, this.getRowState = (e) => {
|
|
1165
|
-
var
|
|
1182
|
+
var o, r;
|
|
1166
1183
|
const s = parseInt(e, 10);
|
|
1167
1184
|
if (!(s >= this.data.count()))
|
|
1168
|
-
return (r = (
|
|
1185
|
+
return (r = (o = this.data.getValidData()[s]) == null ? void 0 : o.__ng) == null ? void 0 : r.rowState;
|
|
1169
1186
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (e) => {
|
|
1170
1187
|
this.row.at = e;
|
|
1171
|
-
}, 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,
|
|
1172
|
-
e = parseInt(e, 10), this.data.setValue(e, s,
|
|
1188
|
+
}, 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, o) => {
|
|
1189
|
+
e = parseInt(e, 10), this.data.setValue(e, s, o);
|
|
1173
1190
|
}, this.setDataSource([]);
|
|
1174
1191
|
}
|
|
1175
1192
|
};
|
|
1176
1193
|
c(Gt, "ngDataManager");
|
|
1177
|
-
let
|
|
1194
|
+
let Pt = Gt;
|
|
1178
1195
|
var U, _t;
|
|
1179
1196
|
const Jt = class Jt extends HTMLElement {
|
|
1180
1197
|
constructor() {
|
|
@@ -1182,7 +1199,7 @@ const Jt = class Jt extends HTMLElement {
|
|
|
1182
1199
|
//#created = false;
|
|
1183
1200
|
h(this, U);
|
|
1184
1201
|
h(this, _t);
|
|
1185
|
-
this.attachShadow({ mode: "open" }), g(this, U, new
|
|
1202
|
+
this.attachShadow({ mode: "open" }), g(this, U, new Pt(this));
|
|
1186
1203
|
}
|
|
1187
1204
|
connectedCallback() {
|
|
1188
1205
|
g(this, _t, new Dt(this)), tt.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|