@ninebone/table 0.0.313 β 0.0.315
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 +269 -259
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +12 -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, N, P, dt, B, 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, N);
|
|
34
35
|
h(this, P);
|
|
35
|
-
h(this, B);
|
|
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, P, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), t(this,
|
|
41
|
+
})), t(this, P).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, B, /* @__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, N));
|
|
79
|
+
const r = parseInt(t(this, y).thumb.style.left || 0, 10);
|
|
80
|
+
t(this, B).call(this, r + o), g(this, D, setInterval(() => {
|
|
81
|
+
clearInterval(t(this, D)), g(this, N, setInterval(() => {
|
|
82
|
+
const n = parseInt(t(this, y).thumb.style.left || 0, 10);
|
|
83
|
+
t(this, B).call(this, n + o) || clearInterval(t(this, N));
|
|
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, N));
|
|
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, B).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, B).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, P) && t(this, P).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(), N = new WeakMap(), P = new WeakMap(), dt = new WeakMap(), B = 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
|
-
const
|
|
248
|
-
if (f > 0 &&
|
|
249
|
-
const z = u / f *
|
|
247
|
+
const k = m.scrollHeight - b;
|
|
248
|
+
if (f > 0 && k > 0) {
|
|
249
|
+
const z = u / f * k;
|
|
250
250
|
e.scrollTop = t(this, st) + z;
|
|
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;
|
|
@@ -410,8 +410,8 @@ bt = new WeakMap(), K = new WeakMap(), c(H, "TableCompiler"), h(H, bt, /* @__PUR
|
|
|
410
410
|
}
|
|
411
411
|
const b = u.rowSpan || 1, m = u.colSpan || 1;
|
|
412
412
|
for (let E = 0; E < b; E++)
|
|
413
|
-
for (let
|
|
414
|
-
d + E < r && f +
|
|
413
|
+
for (let k = 0; k < m; k++)
|
|
414
|
+
d + E < r && f + k < n && (l[d + E][f + k] = E === 0 && k === 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,
|
|
564
|
-
const b = s + Math.floor(u /
|
|
565
|
-
f.style.display = "", t(this,
|
|
563
|
+
var E, k, z, 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) ?? ((z = (k = t(this, p).dataManager) == null ? void 0 : k.rawRecords) == null ? void 0 : z[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,39 +585,39 @@ const Kt = class Kt {
|
|
|
585
585
|
return ((e = t(this, _).get(i)) == null ? void 0 : e.length) || 1;
|
|
586
586
|
}
|
|
587
587
|
};
|
|
588
|
-
|
|
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
589
|
let Ot = Kt;
|
|
590
|
-
var Z, G,
|
|
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
|
-
e && (g(this, Z, Wt.compile(e)), t(this, Z).style.display = "table", t(this,
|
|
620
|
+
e && (g(this, Z, Wt.compile(e)), t(this, Z).style.display = "table", t(this, vt).call(this), t(this, wt).call(this), t(this, G).initialize(), setTimeout(() => {
|
|
621
621
|
var s;
|
|
622
622
|
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
623
623
|
}, 0));
|
|
@@ -626,14 +626,18 @@ const et = class et extends HTMLElement {
|
|
|
626
626
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
627
627
|
*/
|
|
628
628
|
h(this, St, /* @__PURE__ */ c((e, s) => {
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
}), n
|
|
629
|
+
const o = e.cloneNode(!0), r = o.querySelector("tbody");
|
|
630
|
+
if (r) {
|
|
631
|
+
const n = document.createElement("tbody");
|
|
632
|
+
n.className = "ng-fixed-tbody", r.className = "ng-scroll-tbody", r.before(n);
|
|
633
|
+
}
|
|
634
|
+
return s === "left" ? o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((n) => {
|
|
635
|
+
n.getAttribute("fixed") !== "left" && n.remove();
|
|
636
|
+
}) : s === "right" ? o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((n) => {
|
|
637
|
+
n.getAttribute("fixed") !== "right" && n.remove();
|
|
638
|
+
}) : o.querySelectorAll("[fixed=left], [fixed=right]").forEach((n) => {
|
|
639
|
+
n.remove();
|
|
640
|
+
}), o;
|
|
637
641
|
}, "#createSplitTable"));
|
|
638
642
|
w(this, "getRowHeight", /* @__PURE__ */ c(() => t(this, G).getRowHeight(), "getRowHeight"));
|
|
639
643
|
w(this, "scrollToX", /* @__PURE__ */ c((e) => {
|
|
@@ -684,6 +688,12 @@ const et = class et extends HTMLElement {
|
|
|
684
688
|
border-right: 1px solid #e5e7eb;
|
|
685
689
|
flex-shrink: 0;
|
|
686
690
|
}
|
|
691
|
+
|
|
692
|
+
nine-table-sheet thead {
|
|
693
|
+
position: sticky;
|
|
694
|
+
top: 0;
|
|
695
|
+
}
|
|
696
|
+
|
|
687
697
|
|
|
688
698
|
nine-table-sheet .ng-container-body {
|
|
689
699
|
display: flex;
|
|
@@ -793,31 +803,31 @@ const et = class et extends HTMLElement {
|
|
|
793
803
|
this.innerHTML = "", tt.log("NineTableSheet destroyed.");
|
|
794
804
|
}
|
|
795
805
|
};
|
|
796
|
-
Z = new WeakMap(), G = new WeakMap(),
|
|
806
|
+
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);
|
|
797
807
|
let ht = et;
|
|
798
808
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ht);
|
|
799
|
-
var
|
|
809
|
+
var Tt, lt;
|
|
800
810
|
const jt = class jt extends HTMLElement {
|
|
801
811
|
constructor() {
|
|
802
812
|
super();
|
|
803
|
-
h(this,
|
|
813
|
+
h(this, Tt, /* @__PURE__ */ c(() => {
|
|
804
814
|
var e;
|
|
805
815
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
806
|
-
var
|
|
807
|
-
const
|
|
808
|
-
t(this, lt).call(this, r,
|
|
816
|
+
var n;
|
|
817
|
+
const o = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((n = s.target.closest(".nine-tab-item")) == null ? void 0 : n.dataset.index, 10);
|
|
818
|
+
t(this, lt).call(this, r, o);
|
|
809
819
|
}), t(this, lt).call(this, 0, !1);
|
|
810
820
|
}, "#init"));
|
|
811
821
|
h(this, lt, /* @__PURE__ */ c((e, s = !1) => {
|
|
812
|
-
const
|
|
822
|
+
const o = /* @__PURE__ */ c(() => {
|
|
813
823
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
814
824
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((m) => m.style.setProperty("display", "none"));
|
|
815
825
|
const b = f.filter((m) => m.classList.contains("active"));
|
|
816
826
|
b.length < 2 || b.forEach((m) => {
|
|
817
|
-
const E = parseInt(m.getAttribute("data-index"), 10),
|
|
818
|
-
|
|
827
|
+
const E = parseInt(m.getAttribute("data-index"), 10), k = this.querySelector(`nine-splitter[data-split-index="${E}"]`), z = f[E + 1];
|
|
828
|
+
k && z && z.classList.contains("active") && k.style.setProperty("display", "flex");
|
|
819
829
|
});
|
|
820
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"),
|
|
830
|
+
}, "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");
|
|
821
831
|
if (!l[e]) return;
|
|
822
832
|
if (!s)
|
|
823
833
|
l.forEach((f, u) => {
|
|
@@ -831,45 +841,45 @@ const jt = class jt extends HTMLElement {
|
|
|
831
841
|
if (f.classList.contains("active") && u.length <= 1)
|
|
832
842
|
return;
|
|
833
843
|
f.classList.toggle("active");
|
|
834
|
-
const b =
|
|
844
|
+
const b = n.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
835
845
|
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
836
846
|
}
|
|
837
|
-
const d =
|
|
847
|
+
const d = n.querySelectorAll("nine-table-sheet.active");
|
|
838
848
|
d == null || d.forEach((f) => {
|
|
839
849
|
f.style.flex = d.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
840
|
-
}),
|
|
850
|
+
}), o();
|
|
841
851
|
}, "#switchSheet"));
|
|
842
852
|
}
|
|
843
853
|
connectedCallback() {
|
|
844
|
-
t(this,
|
|
854
|
+
t(this, Tt).call(this);
|
|
845
855
|
}
|
|
846
856
|
};
|
|
847
|
-
|
|
857
|
+
Tt = new WeakMap(), lt = new WeakMap(), c(jt, "NineTableSheets");
|
|
848
858
|
let zt = jt;
|
|
849
859
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", zt);
|
|
850
|
-
var
|
|
860
|
+
var T, kt, ct, qt;
|
|
851
861
|
const Ft = class Ft {
|
|
852
862
|
constructor(i) {
|
|
853
|
-
h(this,
|
|
854
|
-
h(this,
|
|
855
|
-
t(this,
|
|
863
|
+
h(this, T);
|
|
864
|
+
h(this, kt, /* @__PURE__ */ c(() => {
|
|
865
|
+
t(this, qt).call(this), new ResizeObserver((i) => {
|
|
856
866
|
for (let e of i)
|
|
857
|
-
t(this,
|
|
858
|
-
}).observe(t(this,
|
|
867
|
+
t(this, T).getAttribute("auto-height") === "true" && t(this, ct).call(this);
|
|
868
|
+
}).observe(t(this, T));
|
|
859
869
|
}, "#init"));
|
|
860
870
|
h(this, ct, /* @__PURE__ */ c(() => {
|
|
861
871
|
var a, d;
|
|
862
|
-
const i = Array.from(t(this,
|
|
872
|
+
const i = Array.from(t(this, T).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
863
873
|
if (i.length === 0) return;
|
|
864
|
-
const e = parseInt(t(this,
|
|
865
|
-
t(this,
|
|
874
|
+
const e = parseInt(t(this, T).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), o = (a = t(this, T).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : a.getBoundingClientRect().height, r = (d = t(this, T).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : d.getBoundingClientRect().height, n = ht.SCROLLBAR_SIZE, l = e * s + o + r + n;
|
|
875
|
+
t(this, T).style.height = `${l}px`;
|
|
866
876
|
}, "#applyAutoHeight"));
|
|
867
|
-
h(this,
|
|
868
|
-
const e = Array.from(t(this,
|
|
869
|
-
const u = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`, b = d <
|
|
877
|
+
h(this, qt, /* @__PURE__ */ c(() => {
|
|
878
|
+
const e = Array.from(t(this, T).children).filter((a) => a.tagName === "TABLE"), s = t(this, T).getAttribute("auto-height") === "true", o = e.length, r = e.map((a, d) => {
|
|
879
|
+
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>` : "";
|
|
870
880
|
return u + b;
|
|
871
|
-
}).join(""),
|
|
872
|
-
t(this,
|
|
881
|
+
}).join(""), n = e.map((a, d) => `<div class="nine-tab-item ${d === 0 ? "active" : ""}" data-index="${d}">Sheet ${d + 1}</div>`).join("");
|
|
882
|
+
t(this, T).shadowRoot.innerHTML = `
|
|
873
883
|
<style>
|
|
874
884
|
:host {
|
|
875
885
|
display: flex;
|
|
@@ -960,7 +970,7 @@ const Ft = class Ft {
|
|
|
960
970
|
<nine-table-sheets>
|
|
961
971
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
962
972
|
<nine-table-sheets-footer>
|
|
963
|
-
<div class="nine-tab-bar">${
|
|
973
|
+
<div class="nine-tab-bar">${n}</div>
|
|
964
974
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
965
975
|
</nine-table-sheets-footer>
|
|
966
976
|
</nine-table-sheets>
|
|
@@ -968,17 +978,17 @@ const Ft = class Ft {
|
|
|
968
978
|
</nine-table-body>
|
|
969
979
|
<nine-table-footer></nine-table-footer>
|
|
970
980
|
`;
|
|
971
|
-
const l = t(this,
|
|
981
|
+
const l = t(this, T).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
972
982
|
l == null || l.forEach((a, d) => {
|
|
973
983
|
e[d] && setTimeout(() => {
|
|
974
984
|
a.generate(e[d]), s && t(this, ct).call(this);
|
|
975
985
|
});
|
|
976
986
|
});
|
|
977
987
|
}, "#render"));
|
|
978
|
-
g(this,
|
|
988
|
+
g(this, T, i), t(this, kt).call(this);
|
|
979
989
|
}
|
|
980
990
|
};
|
|
981
|
-
|
|
991
|
+
T = new WeakMap(), kt = new WeakMap(), ct = new WeakMap(), qt = new WeakMap(), c(Ft, "LayoutManager");
|
|
982
992
|
let Dt = Ft;
|
|
983
993
|
var W, X;
|
|
984
994
|
const Zt = class Zt {
|
|
@@ -992,33 +1002,33 @@ const Zt = class Zt {
|
|
|
992
1002
|
return t(this, X);
|
|
993
1003
|
}
|
|
994
1004
|
set at(i) {
|
|
995
|
-
var s,
|
|
1005
|
+
var s, o;
|
|
996
1006
|
g(this, X, parseInt(i, 10));
|
|
997
|
-
const e = ((
|
|
1007
|
+
const e = ((o = (s = t(this, W).owner).querySelector) == null ? void 0 : o.call(s, ".ng-container-body")) || t(this, W).owner.body;
|
|
998
1008
|
e && !e.querySelector(`tbody.bindable tr[data-row="${t(this, X)}"]`) && setTimeout(() => {
|
|
999
|
-
var r,
|
|
1000
|
-
(
|
|
1009
|
+
var r, n;
|
|
1010
|
+
(n = (r = t(this, W).owner).scrollTo_V1) == null || n.call(r, t(this, X));
|
|
1001
1011
|
});
|
|
1002
1012
|
}
|
|
1003
1013
|
};
|
|
1004
1014
|
W = new WeakMap(), X = new WeakMap(), c(Zt, "ngRow");
|
|
1005
|
-
let
|
|
1006
|
-
var
|
|
1015
|
+
let Nt = Zt;
|
|
1016
|
+
var q, v, A, J, At, O, Lt, at, Ht, Ct, Q;
|
|
1007
1017
|
const L = class L {
|
|
1008
1018
|
constructor(i, e) {
|
|
1009
|
-
h(this,
|
|
1010
|
-
h(this,
|
|
1011
|
-
h(this,
|
|
1019
|
+
h(this, q);
|
|
1020
|
+
h(this, v);
|
|
1021
|
+
h(this, A, []);
|
|
1012
1022
|
h(this, J, []);
|
|
1013
|
-
h(this,
|
|
1023
|
+
h(this, At, 0);
|
|
1014
1024
|
h(this, O, []);
|
|
1015
1025
|
h(this, Lt, /* @__PURE__ */ c(() => {
|
|
1016
1026
|
g(this, O, []);
|
|
1017
|
-
const i = t(this,
|
|
1027
|
+
const i = t(this, q).template || [];
|
|
1018
1028
|
Array.from(i).forEach((e) => {
|
|
1019
1029
|
var s;
|
|
1020
1030
|
t(this, O).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1021
|
-
}), (t(this,
|
|
1031
|
+
}), (t(this, v).rawRecords || []).forEach((e) => {
|
|
1022
1032
|
e.__ng || (e.__ng = t(this, at).call(this)), e.__ng.height = t(this, O).slice();
|
|
1023
1033
|
});
|
|
1024
1034
|
}, "#initialize"));
|
|
@@ -1035,21 +1045,21 @@ const L = class L {
|
|
|
1035
1045
|
_: [0, 0, 0, 0, L.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, O).slice(), -1, {}, {}]
|
|
1036
1046
|
}), "#getDefaultMeta"));
|
|
1037
1047
|
w(this, "reset", /* @__PURE__ */ c(() => {
|
|
1038
|
-
g(this,
|
|
1048
|
+
g(this, A, []), g(this, J, []);
|
|
1039
1049
|
}, "reset"));
|
|
1040
1050
|
w(this, "clear", /* @__PURE__ */ c(() => {
|
|
1041
1051
|
var i;
|
|
1042
|
-
t(this,
|
|
1052
|
+
t(this, v).rawRecords = [], g(this, A, []), g(this, J, []), (i = t(this, v).viewRecords) != null && i.reset && t(this, v).viewRecords.reset();
|
|
1043
1053
|
}, "clear"));
|
|
1044
1054
|
h(this, Ht, /* @__PURE__ */ c((i) => {
|
|
1045
|
-
var
|
|
1055
|
+
var o;
|
|
1046
1056
|
Array.isArray(i) || (i = [i]);
|
|
1047
|
-
const e = typeof ((
|
|
1057
|
+
const e = typeof ((o = t(this, q).fields) == null ? void 0 : o.get) == "function" ? t(this, q).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1048
1058
|
return i.forEach((r) => {
|
|
1049
|
-
const
|
|
1059
|
+
const n = { v: [] };
|
|
1050
1060
|
e.forEach((l) => {
|
|
1051
|
-
|
|
1052
|
-
}), s.push(
|
|
1061
|
+
n.v.push(r[l] !== void 0 && r[l] !== null ? r[l] : "");
|
|
1062
|
+
}), s.push(n);
|
|
1053
1063
|
}), s;
|
|
1054
1064
|
}, "#json2Array"));
|
|
1055
1065
|
h(this, Ct, /* @__PURE__ */ c((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
@@ -1059,52 +1069,52 @@ const L = class L {
|
|
|
1059
1069
|
var r;
|
|
1060
1070
|
i === void 0 && (i = {});
|
|
1061
1071
|
const s = t(this, Ht).call(this, i);
|
|
1062
|
-
t(this,
|
|
1063
|
-
const
|
|
1064
|
-
return e || s.forEach((
|
|
1065
|
-
const a = t(this,
|
|
1072
|
+
t(this, v).rawRecords = t(this, v).rawRecords.concat(t(this, Ct).call(this, s)), this.resetRecords();
|
|
1073
|
+
const o = this.count() - 1;
|
|
1074
|
+
return e || s.forEach((n, l) => {
|
|
1075
|
+
const a = t(this, v).rawRecords[o - l];
|
|
1066
1076
|
a && (a.__ng.rowState = L.ROW_STATE.EMPTY);
|
|
1067
|
-
}), (r = t(this,
|
|
1077
|
+
}), (r = t(this, v).viewRecords) != null && r.reset && t(this, v).viewRecords.reset(), o;
|
|
1068
1078
|
}, "add"));
|
|
1069
1079
|
w(this, "delete", /* @__PURE__ */ c((i) => {
|
|
1070
1080
|
var s;
|
|
1071
1081
|
let e = [];
|
|
1072
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this,
|
|
1073
|
-
if (t(this,
|
|
1074
|
-
const r = t(this,
|
|
1075
|
-
t(this,
|
|
1076
|
-
|
|
1082
|
+
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) => {
|
|
1083
|
+
if (t(this, A)[o]) {
|
|
1084
|
+
const r = t(this, A)[o].__ng.rowid;
|
|
1085
|
+
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) => {
|
|
1086
|
+
n.__ng.rowid === r && (n.__ng.deleted = !0, n.__ng.rowState = L.ROW_STATE.DELETE);
|
|
1077
1087
|
});
|
|
1078
1088
|
}
|
|
1079
|
-
}), this.resetRecords(), (s = t(this,
|
|
1089
|
+
}), this.resetRecords(), (s = t(this, v).viewRecords) != null && s.reset && t(this, v).viewRecords.reset();
|
|
1080
1090
|
}, "delete"));
|
|
1081
1091
|
w(this, "setValue", /* @__PURE__ */ c((i, e, s) => {
|
|
1082
1092
|
var a;
|
|
1083
1093
|
i = parseInt(i, 10);
|
|
1084
|
-
const r = (typeof ((a = t(this,
|
|
1094
|
+
const r = (typeof ((a = t(this, q).fields) == null ? void 0 : a.get) == "function" ? t(this, q).fields.get() : []).indexOf(e);
|
|
1085
1095
|
if (r < 0) return;
|
|
1086
|
-
const
|
|
1087
|
-
if (!
|
|
1088
|
-
const l =
|
|
1089
|
-
l !== s &&
|
|
1096
|
+
const n = this.getValidData()[i];
|
|
1097
|
+
if (!n) return;
|
|
1098
|
+
const l = n.v[r];
|
|
1099
|
+
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);
|
|
1090
1100
|
}, "setValue"));
|
|
1091
1101
|
w(this, "resetRecords", /* @__PURE__ */ c(() => {
|
|
1092
|
-
g(this, J, t(this,
|
|
1102
|
+
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) => {
|
|
1093
1103
|
i.__ng.rowidx = e;
|
|
1094
|
-
}), t(this,
|
|
1104
|
+
}), t(this, A).forEach((i, e) => {
|
|
1095
1105
|
i.__ng.i = e;
|
|
1096
1106
|
});
|
|
1097
1107
|
}, "resetRecords"));
|
|
1098
|
-
w(this, "getValidData", /* @__PURE__ */ c(() => (t(this,
|
|
1108
|
+
w(this, "getValidData", /* @__PURE__ */ c(() => (t(this, A).length === 0 && t(this, v).rawRecords.length > 0 && this.resetRecords(), t(this, A)), "getValidData"));
|
|
1099
1109
|
h(this, Q, /* @__PURE__ */ c((i) => {
|
|
1100
1110
|
var s;
|
|
1101
1111
|
if (!i) return i;
|
|
1102
|
-
const e = typeof ((s = t(this,
|
|
1103
|
-
return Array.isArray(i) ? i.filter((
|
|
1112
|
+
const e = typeof ((s = t(this, q).fields) == null ? void 0 : s.get) == "function" ? t(this, q).fields.get() : [];
|
|
1113
|
+
return Array.isArray(i) ? i.filter((o) => !o.__ng.deleted).map((o) => {
|
|
1104
1114
|
const r = {};
|
|
1105
|
-
return e.forEach((
|
|
1106
|
-
r[
|
|
1107
|
-
}), r.__ng =
|
|
1115
|
+
return e.forEach((n, l) => {
|
|
1116
|
+
r[n] = o.v ? o.v[l] : o[n];
|
|
1117
|
+
}), r.__ng = o.__ng, r;
|
|
1108
1118
|
}) : i;
|
|
1109
1119
|
}, "#conv2"));
|
|
1110
1120
|
w(this, "count", /* @__PURE__ */ c(() => this.getValidData().length, "count"));
|
|
@@ -1114,32 +1124,32 @@ const L = class L {
|
|
|
1114
1124
|
if (!s || s.length <= 0) return;
|
|
1115
1125
|
if (i == null) return t(this, Q).call(this, s);
|
|
1116
1126
|
if (i < 0 || i >= s.length) return null;
|
|
1117
|
-
const
|
|
1127
|
+
const o = typeof ((r = t(this, q).fields) == null ? void 0 : r.get) == "function" ? t(this, q).fields.get() : [];
|
|
1118
1128
|
if (e != null) {
|
|
1119
|
-
const
|
|
1120
|
-
return
|
|
1129
|
+
const n = o.indexOf(e);
|
|
1130
|
+
return n >= 0 ? s[i].v[n] : null;
|
|
1121
1131
|
}
|
|
1122
1132
|
return t(this, Q).call(this, s[i]);
|
|
1123
1133
|
}, "get"));
|
|
1124
|
-
g(this,
|
|
1134
|
+
g(this, q, i), g(this, v, e), t(this, Lt).call(this);
|
|
1125
1135
|
}
|
|
1126
1136
|
get source() {
|
|
1127
|
-
return t(this, Q).call(this, t(this,
|
|
1137
|
+
return t(this, Q).call(this, t(this, v).rawRecords);
|
|
1128
1138
|
}
|
|
1129
1139
|
set source(i) {
|
|
1130
1140
|
this.clear(), this.add(i, !1);
|
|
1131
1141
|
}
|
|
1132
1142
|
get nextId() {
|
|
1133
|
-
return ++se(this,
|
|
1143
|
+
return ++se(this, At)._;
|
|
1134
1144
|
}
|
|
1135
1145
|
get length() {
|
|
1136
|
-
return t(this,
|
|
1146
|
+
return t(this, A).length;
|
|
1137
1147
|
}
|
|
1138
1148
|
getRowCount() {
|
|
1139
1149
|
return this.length;
|
|
1140
1150
|
}
|
|
1141
1151
|
};
|
|
1142
|
-
|
|
1152
|
+
q = new WeakMap(), v = new WeakMap(), A = new WeakMap(), J = new WeakMap(), At = new WeakMap(), O = new WeakMap(), Lt = new WeakMap(), at = new WeakMap(), Ht = new WeakMap(), Ct = new WeakMap(), Q = new WeakMap(), c(L, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1143
1153
|
w(L, "ROW_STATE", {
|
|
1144
1154
|
EMPTY: "EMPTY",
|
|
1145
1155
|
NORMAL: "NORMAL",
|
|
@@ -1147,28 +1157,28 @@ w(L, "ROW_STATE", {
|
|
|
1147
1157
|
UPDATE: "UPDATE",
|
|
1148
1158
|
DELETE: "DELETE"
|
|
1149
1159
|
});
|
|
1150
|
-
let
|
|
1160
|
+
let Pt = L;
|
|
1151
1161
|
const Gt = class Gt {
|
|
1152
1162
|
constructor(i) {
|
|
1153
|
-
this.owner = i, this.row = new
|
|
1163
|
+
this.owner = i, this.row = new Nt(this), this.data = new Pt(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1154
1164
|
var e;
|
|
1155
1165
|
(e = this.owner.view) != null && e.redraw && this.owner.view.redraw();
|
|
1156
1166
|
}, this.setDataSource = (e) => {
|
|
1157
1167
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1158
1168
|
}, this.getRowState = (e) => {
|
|
1159
|
-
var
|
|
1169
|
+
var o, r;
|
|
1160
1170
|
const s = parseInt(e, 10);
|
|
1161
1171
|
if (!(s >= this.data.count()))
|
|
1162
|
-
return (r = (
|
|
1172
|
+
return (r = (o = this.data.getValidData()[s]) == null ? void 0 : o.__ng) == null ? void 0 : r.rowState;
|
|
1163
1173
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (e) => {
|
|
1164
1174
|
this.row.at = e;
|
|
1165
|
-
}, 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,
|
|
1166
|
-
e = parseInt(e, 10), this.data.setValue(e, s,
|
|
1175
|
+
}, 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) => {
|
|
1176
|
+
e = parseInt(e, 10), this.data.setValue(e, s, o);
|
|
1167
1177
|
}, this.setDataSource([]);
|
|
1168
1178
|
}
|
|
1169
1179
|
};
|
|
1170
1180
|
c(Gt, "ngDataManager");
|
|
1171
|
-
let
|
|
1181
|
+
let Bt = Gt;
|
|
1172
1182
|
var U, _t;
|
|
1173
1183
|
const Jt = class Jt extends HTMLElement {
|
|
1174
1184
|
constructor() {
|
|
@@ -1176,7 +1186,7 @@ const Jt = class Jt extends HTMLElement {
|
|
|
1176
1186
|
//#created = false;
|
|
1177
1187
|
h(this, U);
|
|
1178
1188
|
h(this, _t);
|
|
1179
|
-
this.attachShadow({ mode: "open" }), g(this, U, new
|
|
1189
|
+
this.attachShadow({ mode: "open" }), g(this, U, new Bt(this));
|
|
1180
1190
|
}
|
|
1181
1191
|
connectedCallback() {
|
|
1182
1192
|
g(this, _t, new Dt(this)), tt.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|