@ninebone/table 0.0.417 → 0.0.419
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 +295 -297
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +5 -5
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -5,10 +5,10 @@ var me = (x) => {
|
|
|
5
5
|
var we = (x, i, e) => i in x ? pe(x, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : x[i] = e;
|
|
6
6
|
var a = (x, i) => pe(x, "name", { value: i, configurable: !0 });
|
|
7
7
|
var v = (x, i, e) => we(x, typeof i != "symbol" ? i + "" : i, e), xe = (x, i, e) => i.has(x) || me("Cannot " + e);
|
|
8
|
-
var t = (x, i, e) => (xe(x, i, "read from private field"), e ? e.call(x) : i.get(x)),
|
|
8
|
+
var t = (x, i, e) => (xe(x, i, "read from private field"), e ? e.call(x) : i.get(x)), c = (x, i, e) => i.has(x) ? me("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(x) : i.set(x, e), g = (x, i, e, s) => (xe(x, i, "write to private field"), s ? s.call(x, e) : i.set(x, e), e);
|
|
9
9
|
var ve = (x, i, e, s) => ({
|
|
10
|
-
set _(
|
|
11
|
-
g(x, i,
|
|
10
|
+
set _(n) {
|
|
11
|
+
g(x, i, n, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
14
|
return t(x, i, s);
|
|
@@ -27,13 +27,13 @@ var _, O, p, V, Y, X, Et, U, Rt;
|
|
|
27
27
|
const le = class le extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
c(this, _);
|
|
31
|
+
c(this, O, !1);
|
|
32
|
+
c(this, p);
|
|
33
|
+
c(this, V);
|
|
34
|
+
c(this, Y);
|
|
35
|
+
c(this, X);
|
|
36
|
+
c(this, Et, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!t(this, _)) return;
|
|
38
38
|
const e = t(this, _).querySelector(".ng-container-body");
|
|
39
39
|
e && (g(this, X, new ResizeObserver(() => {
|
|
@@ -44,70 +44,70 @@ const le = class le extends HTMLElement {
|
|
|
44
44
|
if (!t(this, _) || !t(this, p) || t(this, O)) return;
|
|
45
45
|
const e = t(this, p).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const
|
|
47
|
+
const n = t(this, p).track, r = t(this, p).thumb, o = t(this, _).querySelector(".ng-container-bottom"), l = e.clientWidth, d = s.scrollWidth;
|
|
48
48
|
if (l !== 0 && d > l)
|
|
49
|
-
|
|
49
|
+
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
51
|
-
|
|
51
|
+
o && (o.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const f = Math.max(Math.min(
|
|
54
|
+
const h = n.clientWidth;
|
|
55
|
+
if (h <= 0) return;
|
|
56
|
+
const f = Math.max(Math.min(h * (l / d), h), 20);
|
|
57
57
|
r.style.width = `${f}px`;
|
|
58
58
|
const u = e.scrollLeft, b = d - l;
|
|
59
59
|
let y = 0;
|
|
60
|
-
b > 0 && (y = parseInt(u / b * (
|
|
61
|
-
const m =
|
|
60
|
+
b > 0 && (y = parseInt(u / b * (h - f), 10)), y < 0 && (y = 0);
|
|
61
|
+
const m = h - f;
|
|
62
62
|
y > m && (y = m), r.style.left = `${y}px`, T.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
|
|
64
|
+
c(this, U, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
66
|
-
const s = t(this, p).container,
|
|
67
|
-
if (!
|
|
68
|
-
const r = t(this, p).track.getBoundingClientRect(),
|
|
66
|
+
const s = t(this, p).container, n = s.querySelector("table");
|
|
67
|
+
if (!n) return !1;
|
|
68
|
+
const r = t(this, p).track.getBoundingClientRect(), o = t(this, p).thumb.clientWidth;
|
|
69
69
|
let l = e;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
|
-
const d = r.width -
|
|
71
|
+
const d = r.width - o;
|
|
72
72
|
l > d && (l = d), l = parseInt(l, 10), t(this, p).thumb.style.left = `${l}px`, t(this, p).left.disabled = l === 0, t(this, p).right.disabled = l >= d - 1;
|
|
73
|
-
const
|
|
73
|
+
const h = s.clientWidth, u = n.scrollWidth - h;
|
|
74
74
|
return d > 0 && u > 0 && (s.scrollLeft = l / d * u), l > 0 && l < d - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
|
-
|
|
77
|
-
const e = /* @__PURE__ */ a((
|
|
76
|
+
c(this, Rt, /* @__PURE__ */ a(() => {
|
|
77
|
+
const e = /* @__PURE__ */ a((n) => {
|
|
78
78
|
clearInterval(t(this, V)), clearInterval(t(this, Y));
|
|
79
79
|
const r = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
80
|
-
t(this, U).call(this, r +
|
|
80
|
+
t(this, U).call(this, r + n), g(this, V, setInterval(() => {
|
|
81
81
|
clearInterval(t(this, V)), g(this, Y, setInterval(() => {
|
|
82
|
-
const
|
|
83
|
-
t(this, U).call(this,
|
|
82
|
+
const o = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
83
|
+
t(this, U).call(this, o + n) || clearInterval(t(this, Y));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
87
87
|
clearInterval(t(this, V)), clearInterval(t(this, Y));
|
|
88
88
|
}, "clearTimer");
|
|
89
|
-
["mouseup", "mouseleave", "touchend"].forEach((
|
|
90
|
-
t(this, p).left.addEventListener(
|
|
91
|
-
}), t(this, p).left.addEventListener("mousedown", (
|
|
92
|
-
|
|
93
|
-
}), t(this, p).right.addEventListener("mousedown", (
|
|
94
|
-
|
|
95
|
-
}), t(this, p).left.addEventListener("touchstart", () => e(-20)), t(this, p).right.addEventListener("touchstart", () => e(20)), t(this, p).track.addEventListener("mousedown", (
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
const r = t(this, p).track.getBoundingClientRect(),
|
|
99
|
-
t(this, U).call(this,
|
|
100
|
-
}), t(this, p).thumb.addEventListener("mousedown", (
|
|
101
|
-
if (
|
|
102
|
-
|
|
89
|
+
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
90
|
+
t(this, p).left.addEventListener(n, s), t(this, p).right.addEventListener(n, s), t(this, p).track.addEventListener(n, s);
|
|
91
|
+
}), t(this, p).left.addEventListener("mousedown", (n) => {
|
|
92
|
+
n.button === 0 && e(-20);
|
|
93
|
+
}), t(this, p).right.addEventListener("mousedown", (n) => {
|
|
94
|
+
n.button === 0 && e(20);
|
|
95
|
+
}), t(this, p).left.addEventListener("touchstart", () => e(-20)), t(this, p).right.addEventListener("touchstart", () => e(20)), t(this, p).track.addEventListener("mousedown", (n) => {
|
|
96
|
+
if (n.button !== 0) return;
|
|
97
|
+
n.preventDefault();
|
|
98
|
+
const r = t(this, p).track.getBoundingClientRect(), o = t(this, p).thumb.clientWidth;
|
|
99
|
+
t(this, U).call(this, n.clientX - r.left - o / 2);
|
|
100
|
+
}), t(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
101
|
+
if (n.button !== 0) return;
|
|
102
|
+
n.stopPropagation(), n.preventDefault(), g(this, O, !0), this.shiftX = n.clientX - t(this, p).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ a((l) => {
|
|
104
104
|
if (!t(this, O)) return;
|
|
105
105
|
const d = t(this, p).track.getBoundingClientRect();
|
|
106
106
|
t(this, U).call(this, l.clientX - d.left - this.shiftX);
|
|
107
|
-
}, "onMouseMove"),
|
|
108
|
-
g(this, O, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup",
|
|
107
|
+
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
108
|
+
g(this, O, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup",
|
|
110
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
111
111
|
});
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
@@ -205,46 +205,46 @@ var F, Q, z, S, ht, dt, At;
|
|
|
205
205
|
const ae = class ae extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
208
|
+
c(this, F);
|
|
209
|
+
c(this, Q);
|
|
210
|
+
c(this, z, !1);
|
|
211
|
+
c(this, S);
|
|
212
|
+
c(this, ht, 0);
|
|
213
|
+
c(this, dt, 0);
|
|
214
214
|
/**
|
|
215
215
|
* 🎯 스크롤바 위치 및 썸브 크기 갱신
|
|
216
216
|
*/
|
|
217
217
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
218
218
|
T.log("refresh", t(this, z)), T.log("refresh2");
|
|
219
|
-
const e = t(this, S).container, s = t(this, S).track,
|
|
220
|
-
if (
|
|
221
|
-
|
|
219
|
+
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, l = (t(this, F).data.get() || []).length, d = t(this, Q).getRowHeight(), h = l * d;
|
|
220
|
+
if (h <= r) {
|
|
221
|
+
n.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
222
222
|
return;
|
|
223
223
|
} else
|
|
224
|
-
|
|
224
|
+
n.style.display = "block";
|
|
225
225
|
const f = s.clientHeight;
|
|
226
226
|
if (f <= 0) return;
|
|
227
|
-
const u = Math.max(Math.min(f * (r /
|
|
228
|
-
|
|
229
|
-
const b = e.scrollTop, y = Math.max(
|
|
227
|
+
const u = Math.max(Math.min(f * (r / h), f), 20);
|
|
228
|
+
n.style.height = `${u}px`;
|
|
229
|
+
const b = e.scrollTop, y = Math.max(h - r, 1);
|
|
230
230
|
let m = 0;
|
|
231
231
|
y > 0 && (m = b / y * (f - u));
|
|
232
232
|
const R = f - u;
|
|
233
|
-
m < 0 && (m = 0), m > R && (m = R),
|
|
233
|
+
m < 0 && (m = 0), m > R && (m = R), n.style.top = `${m}px`, T.log("currentScrollTop", b), T.log("maxScrollTop", y), T.log("trackHeight", f), T.log("thumbHeight", u), t(this, S).top.disabled = b <= 0, t(this, S).bottom.disabled = b >= y - 1;
|
|
234
234
|
}, "refresh"));
|
|
235
|
-
|
|
235
|
+
c(this, At, /* @__PURE__ */ a(() => {
|
|
236
236
|
const e = t(this, S).container, s = /* @__PURE__ */ a(() => {
|
|
237
|
-
const r = (t(this, F).data.get() || []).length,
|
|
238
|
-
return r *
|
|
237
|
+
const r = (t(this, F).data.get() || []).length, o = t(this, Q).getRowHeight();
|
|
238
|
+
return r * o;
|
|
239
239
|
}, "getContentHeight");
|
|
240
240
|
e.addEventListener("scroll", () => {
|
|
241
241
|
t(this, z) || this.refresh();
|
|
242
|
-
}), t(this, S).thumb.addEventListener("mousedown", (
|
|
243
|
-
if (
|
|
244
|
-
|
|
242
|
+
}), t(this, S).thumb.addEventListener("mousedown", (n) => {
|
|
243
|
+
if (n.button !== 0) return;
|
|
244
|
+
n.stopPropagation(), n.preventDefault(), g(this, z, !0), g(this, ht, n.clientY), g(this, dt, e.scrollTop);
|
|
245
245
|
const r = /* @__PURE__ */ a((l) => {
|
|
246
246
|
if (!t(this, z)) return;
|
|
247
|
-
const d = t(this, S).track.getBoundingClientRect(),
|
|
247
|
+
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h, b = l.clientY - t(this, ht), y = e.clientHeight, m = s(), R = Math.max(m - y, 1);
|
|
248
248
|
if (u > 0 && R > 0) {
|
|
249
249
|
const J = b / u * R;
|
|
250
250
|
let at = t(this, dt) + J;
|
|
@@ -252,15 +252,15 @@ const ae = class ae extends HTMLElement {
|
|
|
252
252
|
at < 0 && (at = 0), at > ye && (at = ye), e.scrollTop = at;
|
|
253
253
|
}
|
|
254
254
|
this.refresh();
|
|
255
|
-
}, "onMouseMove"),
|
|
256
|
-
g(this, z, !1), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup",
|
|
255
|
+
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
256
|
+
g(this, z, !1), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
257
257
|
}, "onMouseUp");
|
|
258
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup",
|
|
259
|
-
}), t(this, S).track.addEventListener("mousedown", (
|
|
260
|
-
if (
|
|
261
|
-
const r = t(this, S).track.getBoundingClientRect(),
|
|
262
|
-
if (
|
|
263
|
-
const y = Math.max(0, Math.min(1, l /
|
|
258
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
259
|
+
}), t(this, S).track.addEventListener("mousedown", (n) => {
|
|
260
|
+
if (n.button !== 0 || n.target === t(this, S).thumb) return;
|
|
261
|
+
const r = t(this, S).track.getBoundingClientRect(), o = t(this, S).thumb.clientHeight, l = n.clientY - r.top - o / 2, h = r.height - o, f = e.clientHeight, u = s(), b = Math.max(u - f, 1);
|
|
262
|
+
if (h > 0 && b > 0) {
|
|
263
|
+
const y = Math.max(0, Math.min(1, l / h));
|
|
264
264
|
e.scrollTop = y * b;
|
|
265
265
|
}
|
|
266
266
|
this.refresh();
|
|
@@ -369,59 +369,59 @@ const M = class M {
|
|
|
369
369
|
* 🎯 단일 원본 테이블을 받아 기본 구조 보정 및 2차원 격자 인덱스 사전 부여 완료된 마스터 테이블 반환
|
|
370
370
|
*/
|
|
371
371
|
static compile(i) {
|
|
372
|
-
var
|
|
372
|
+
var n, r, o, l;
|
|
373
373
|
if (!i) return null;
|
|
374
374
|
const e = i.cloneNode(!0);
|
|
375
|
-
return t(
|
|
375
|
+
return t(n = M, Tt).call(n, e), t(r = M, tt).call(r, e, "thead"), t(o = M, tt).call(o, e, "tbody"), t(l = M, tt).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((d, h) => {
|
|
376
376
|
const f = d.getAttribute("fixed");
|
|
377
|
-
f && e.querySelectorAll(`thead [data-col="${
|
|
377
|
+
f && e.querySelectorAll(`thead [data-col="${h}"], tbody [data-col="${h}"], tfoot [data-col="${h}"]`).forEach((u) => {
|
|
378
378
|
u.setAttribute("fixed", f);
|
|
379
379
|
});
|
|
380
380
|
}), e;
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
|
-
Tt = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"),
|
|
383
|
+
Tt = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, Tt, /* @__PURE__ */ a((i) => {
|
|
384
384
|
if (!i.querySelector("colgroup")) {
|
|
385
|
-
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1,
|
|
386
|
-
for (let
|
|
385
|
+
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
386
|
+
for (let o = 0; o < s; o++) {
|
|
387
387
|
const l = document.createElement("col");
|
|
388
|
-
l.setAttribute("width", r),
|
|
388
|
+
l.setAttribute("width", r), n.appendChild(l);
|
|
389
389
|
}
|
|
390
|
-
i.prepend(
|
|
390
|
+
i.prepend(n);
|
|
391
391
|
}
|
|
392
392
|
if (!i.querySelector("thead")) {
|
|
393
393
|
const e = document.createElement("thead"), s = i.querySelector("colgroup");
|
|
394
394
|
s ? s.after(e) : i.prepend(e);
|
|
395
395
|
}
|
|
396
396
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
397
|
-
}, "#ensureTableStructure")),
|
|
398
|
-
const s = Array.from(i.querySelectorAll(e + " tr")),
|
|
399
|
-
if (r === 0 ||
|
|
400
|
-
let
|
|
401
|
-
|
|
402
|
-
|
|
397
|
+
}, "#ensureTableStructure")), c(M, tt, /* @__PURE__ */ a((i, e) => {
|
|
398
|
+
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
399
|
+
if (r === 0 || n.length === 0) return;
|
|
400
|
+
let o = 0;
|
|
401
|
+
n.forEach((d) => {
|
|
402
|
+
o += d.colSpan || 1;
|
|
403
403
|
});
|
|
404
|
-
const l = Array.from(Array(r), () => Array(
|
|
404
|
+
const l = Array.from(Array(r), () => Array(o).fill(null));
|
|
405
405
|
s.forEach((d) => {
|
|
406
|
-
const
|
|
406
|
+
const h = d.sectionRowIndex;
|
|
407
407
|
let f = 0;
|
|
408
408
|
Array.from(d.querySelectorAll("th,td")).forEach((u) => {
|
|
409
|
-
for (let m = 0; m < l[
|
|
410
|
-
if (l[
|
|
409
|
+
for (let m = 0; m < l[h].length; m++)
|
|
410
|
+
if (l[h][m] === null) {
|
|
411
411
|
f = m;
|
|
412
412
|
break;
|
|
413
413
|
}
|
|
414
414
|
const b = u.rowSpan || 1, y = u.colSpan || 1;
|
|
415
415
|
for (let m = 0; m < b; m++)
|
|
416
416
|
for (let R = 0; R < y; R++)
|
|
417
|
-
|
|
417
|
+
h + m < r && f + R < o && (l[h + m][f + R] = m === 0 && R === 0 ? "1" : "0");
|
|
418
418
|
});
|
|
419
419
|
}), s.forEach((d) => {
|
|
420
|
-
const
|
|
420
|
+
const h = d.sectionRowIndex;
|
|
421
421
|
Array.from(d.querySelectorAll("th,td")).forEach((f) => {
|
|
422
|
-
for (let u = 0; u < l[
|
|
423
|
-
if (l[
|
|
424
|
-
f.dataset.col = u, l[
|
|
422
|
+
for (let u = 0; u < l[h].length; u++)
|
|
423
|
+
if (l[h][u] === "1") {
|
|
424
|
+
f.dataset.col = u, l[h][u] = "0";
|
|
425
425
|
break;
|
|
426
426
|
}
|
|
427
427
|
});
|
|
@@ -431,59 +431,59 @@ let Gt = M;
|
|
|
431
431
|
var I, w, W, q, D, j, B, et, qt, kt, Lt, ft, ut, Ht, Ct, gt, $t, it, bt;
|
|
432
432
|
const ce = class ce {
|
|
433
433
|
constructor(i) {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
434
|
+
c(this, I);
|
|
435
|
+
c(this, w);
|
|
436
|
+
c(this, W, /* @__PURE__ */ new Map());
|
|
437
|
+
c(this, q, null);
|
|
438
|
+
c(this, D, null);
|
|
439
|
+
c(this, j, 0);
|
|
440
|
+
c(this, B, 40);
|
|
441
|
+
c(this, et, !1);
|
|
442
|
+
c(this, qt, 3);
|
|
443
443
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
444
444
|
var e;
|
|
445
445
|
const i = t(this, w).querySelector(".ng-container-body");
|
|
446
446
|
i && (t(this, ft).call(this), t(this, it).call(this, i.scrollTop), (e = t(this, w).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
447
447
|
}, "refresh"));
|
|
448
448
|
v(this, "initialize", /* @__PURE__ */ a(() => {
|
|
449
|
-
g(this, q, null), t(this, W).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
450
|
-
const r = t(this, w).querySelector(
|
|
449
|
+
g(this, q, null), t(this, W).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
450
|
+
const r = t(this, w).querySelector(n);
|
|
451
451
|
if (!r) return;
|
|
452
|
-
const
|
|
453
|
-
if (!
|
|
454
|
-
const l =
|
|
452
|
+
const o = r.querySelector("table");
|
|
453
|
+
if (!o) return;
|
|
454
|
+
const l = o.querySelector("tbody.bindable-tbody");
|
|
455
455
|
if (!l) return;
|
|
456
|
-
const
|
|
457
|
-
t(this, W).set(
|
|
456
|
+
const h = Array.from(l.querySelectorAll("tr")).map((f) => f.cloneNode(!0));
|
|
457
|
+
t(this, W).set(n, h);
|
|
458
458
|
});
|
|
459
459
|
const i = t(this, w).querySelector(".ng-container-body"), e = t(this, w).querySelector(".ng-container-left"), s = t(this, w).querySelector(".ng-container-right");
|
|
460
460
|
if (i) {
|
|
461
461
|
t(this, Lt).call(this, i), t(this, gt).call(this), t(this, ft).call(this), t(this, it).call(this, i.scrollTop);
|
|
462
|
-
let
|
|
463
|
-
const r = /* @__PURE__ */ a((
|
|
462
|
+
let n = i.scrollTop;
|
|
463
|
+
const r = /* @__PURE__ */ a((o) => {
|
|
464
464
|
var l;
|
|
465
|
-
e && e.scrollTop !==
|
|
465
|
+
e && e.scrollTop !== o && (e.scrollTop = o), s && s.scrollTop !== o && (s.scrollTop = o), t(this, it).call(this, o), (l = t(this, w).querySelector("nine-table-vscrollbar")) == null || l.refresh();
|
|
466
466
|
}, "syncScroll");
|
|
467
467
|
i.addEventListener("scroll", () => {
|
|
468
|
-
const
|
|
469
|
-
|
|
468
|
+
const o = i.scrollTop;
|
|
469
|
+
n !== o && (n = o, r(o));
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
472
|
}, "initialize"));
|
|
473
|
-
|
|
473
|
+
c(this, kt, /* @__PURE__ */ a((i, e) => {
|
|
474
474
|
const s = t(this, W).get(e);
|
|
475
475
|
if (!s || s.length === 0) return;
|
|
476
|
-
const
|
|
477
|
-
if (!
|
|
478
|
-
|
|
479
|
-
const r =
|
|
476
|
+
const n = i.querySelector("tbody.bindable-tbody");
|
|
477
|
+
if (!n) return;
|
|
478
|
+
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
479
|
+
const r = n.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
480
480
|
for (let l = 0; l < t(this, B); l++)
|
|
481
481
|
s.forEach((d) => {
|
|
482
|
-
|
|
482
|
+
o.appendChild(d.cloneNode(!0));
|
|
483
483
|
});
|
|
484
|
-
r ? r.before(
|
|
484
|
+
r ? r.before(o) : n.appendChild(o);
|
|
485
485
|
}, "#renderRows"));
|
|
486
|
-
|
|
486
|
+
c(this, Lt, /* @__PURE__ */ a((i) => {
|
|
487
487
|
if (t(this, q) !== null && t(this, q) > 0)
|
|
488
488
|
return t(this, q);
|
|
489
489
|
const e = t(this, W).get(".ng-container-body");
|
|
@@ -491,78 +491,78 @@ const ce = class ce {
|
|
|
491
491
|
const s = i.querySelector("tbody.bindable-tbody") || i.querySelector("tbody.bindable-tbody:last-of-type");
|
|
492
492
|
if (!s) return 24;
|
|
493
493
|
s.querySelectorAll("tr:not(.nodata)").forEach((b) => b.remove());
|
|
494
|
-
const
|
|
494
|
+
const n = s.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
495
495
|
e.forEach((b) => {
|
|
496
496
|
r.appendChild(b.cloneNode(!0));
|
|
497
|
-
}),
|
|
498
|
-
const
|
|
499
|
-
(l === "none" || window.getComputedStyle(
|
|
497
|
+
}), n ? n.before(r) : s.appendChild(r);
|
|
498
|
+
const o = t(this, w), l = o.style.display, d = o.style.visibility, h = o.style.position;
|
|
499
|
+
(l === "none" || window.getComputedStyle(o).display === "none") && (o.style.display = "block", o.style.visibility = "hidden", o.style.position = "absolute");
|
|
500
500
|
let f = 0;
|
|
501
501
|
const u = s.querySelectorAll("tr:not(.nodata)");
|
|
502
502
|
return u.forEach((b) => {
|
|
503
503
|
f += b.offsetHeight || b.getBoundingClientRect().height;
|
|
504
|
-
}), u.forEach((b) => b.remove()),
|
|
504
|
+
}), u.forEach((b) => b.remove()), o.style.display = l, o.style.visibility = d, o.style.position = h, g(this, q, f > 0 ? f : 24), t(this, ut).call(this), t(this, q);
|
|
505
505
|
}, "#measureAndCacheHeight"));
|
|
506
|
-
|
|
506
|
+
c(this, ft, /* @__PURE__ */ a(() => {
|
|
507
507
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
508
|
-
const s = (t(this, I).data.get() || []).length,
|
|
509
|
-
T.log(`[VirtualHeight] totalCount: ${s}, rowHeight: ${
|
|
510
|
-
const l = t(this, w).querySelector(
|
|
508
|
+
const s = (t(this, I).data.get() || []).length, n = t(this, q) || 24, r = s * n;
|
|
509
|
+
T.log(`[VirtualHeight] totalCount: ${s}, rowHeight: ${n}, totalVirtualHeight: ${r}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
510
|
+
const l = t(this, w).querySelector(o), d = l == null ? void 0 : l.querySelector("table");
|
|
511
511
|
d && (d.style.height = `${r}px`);
|
|
512
512
|
});
|
|
513
513
|
}, "#updateVirtualScrollHeight"));
|
|
514
|
-
|
|
514
|
+
c(this, ut, /* @__PURE__ */ a(() => {
|
|
515
515
|
if ((t(this, I).data.get() || []).length, t(this, j) > 0 && t(this, q) > 0) {
|
|
516
516
|
const e = Math.ceil(t(this, j) / t(this, q));
|
|
517
517
|
g(this, B, e + t(this, qt)), T.log("visibleRows:", e, "cachedRowCount:", t(this, B));
|
|
518
518
|
}
|
|
519
519
|
}, "#updateRowCount"));
|
|
520
|
-
|
|
521
|
-
var d,
|
|
520
|
+
c(this, Ht, /* @__PURE__ */ a(() => {
|
|
521
|
+
var d, h, f;
|
|
522
522
|
const i = t(this, w).querySelector(".ng-container-left table"), e = t(this, w).querySelector(".ng-container-body table"), s = t(this, w).querySelector(".ng-container-right table");
|
|
523
523
|
if (!e) return;
|
|
524
|
-
const
|
|
524
|
+
const n = i ? Array.from(i.querySelectorAll("tr")) : [], r = Array.from(e.querySelectorAll("tr")), o = s ? Array.from(s.querySelectorAll("tr")) : [], l = Math.max(n.length, r.length, o.length);
|
|
525
525
|
for (let u = 0; u < l; u++) {
|
|
526
526
|
const b = [
|
|
527
|
-
((d =
|
|
528
|
-
((
|
|
529
|
-
((f =
|
|
527
|
+
((d = n[u]) == null ? void 0 : d.getBoundingClientRect().height) || 0,
|
|
528
|
+
((h = r[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
529
|
+
((f = o[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
530
530
|
], y = Math.max(...b);
|
|
531
|
-
y > 0 && (
|
|
531
|
+
y > 0 && (n[u] && (n[u].style.height = `${y}px`), r[u] && (r[u].style.height = `${y}px`), o[u] && (o[u].style.height = `${y}px`));
|
|
532
532
|
}
|
|
533
533
|
}, "#syncRowHeights"));
|
|
534
|
-
|
|
534
|
+
c(this, Ct, /* @__PURE__ */ a(() => {
|
|
535
535
|
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (g(this, D, new ResizeObserver((i) => {
|
|
536
536
|
for (const e of i) {
|
|
537
537
|
const s = e.target;
|
|
538
538
|
if (!s.classList.contains("active")) continue;
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
539
|
+
const n = e.contentRect.height;
|
|
540
|
+
if (n > 0) {
|
|
541
541
|
let r = 0;
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
const l = Math.max(
|
|
542
|
+
const o = s.querySelector("thead");
|
|
543
|
+
o && (r += o.offsetHeight || o.getBoundingClientRect().height);
|
|
544
|
+
const l = Math.max(n - r, 100);
|
|
545
545
|
t(this, j) !== l && (g(this, j, l), t(this, ut).call(this), t(this, q) !== null && t(this, gt).call(this));
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
})), t(this, D).observe(t(this, w)));
|
|
549
549
|
}, "#initResizeObserver"));
|
|
550
|
-
|
|
550
|
+
c(this, gt, /* @__PURE__ */ a(() => {
|
|
551
551
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
552
552
|
const e = t(this, w).querySelector(i);
|
|
553
553
|
e && e.querySelector("tbody.bindable-tbody") && t(this, kt).call(this, e, i);
|
|
554
554
|
}), t(this, Ht).call(this);
|
|
555
555
|
}, "#renderAllContainers"));
|
|
556
|
-
|
|
556
|
+
c(this, $t, /* @__PURE__ */ a((i) => {
|
|
557
557
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
558
|
-
var
|
|
558
|
+
var h;
|
|
559
559
|
const s = t(this, w).querySelector(e);
|
|
560
560
|
if (!s) return;
|
|
561
|
-
const
|
|
562
|
-
if (!
|
|
563
|
-
const r = Array.from(
|
|
561
|
+
const n = s.querySelector("tbody.bindable-tbody");
|
|
562
|
+
if (!n) return;
|
|
563
|
+
const r = Array.from(n.querySelectorAll("tr:not(.nodata)")), o = ((h = t(this, W).get(e)) == null ? void 0 : h.length) || 1, d = (t(this, I).data.get() || []).length;
|
|
564
564
|
r.forEach((f, u) => {
|
|
565
|
-
const b = i + Math.floor(u /
|
|
565
|
+
const b = i + Math.floor(u / o);
|
|
566
566
|
if (b >= d) {
|
|
567
567
|
f.style.display = "none";
|
|
568
568
|
return;
|
|
@@ -572,19 +572,19 @@ const ce = class ce {
|
|
|
572
572
|
});
|
|
573
573
|
});
|
|
574
574
|
}, "#adjustBufferRows"));
|
|
575
|
-
|
|
575
|
+
c(this, it, /* @__PURE__ */ a((i) => {
|
|
576
576
|
var d;
|
|
577
577
|
const e = t(this, q);
|
|
578
578
|
if (!e || e <= 0) return;
|
|
579
|
-
const
|
|
580
|
-
T.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, B)}, targetDataIndex range: ${r} ~ ${l} (Total: ${
|
|
581
|
-
const f = t(this, w).querySelector(
|
|
579
|
+
const n = (t(this, I).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, W).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this, B);
|
|
580
|
+
T.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, B)}, targetDataIndex range: ${r} ~ ${l} (Total: ${n})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
581
|
+
const f = t(this, w).querySelector(h);
|
|
582
582
|
if (!f) return;
|
|
583
583
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
584
584
|
if (!u) return;
|
|
585
585
|
Array.from(u.querySelectorAll("tr:not(.nodata)")).forEach((y, m) => {
|
|
586
|
-
const R = r + Math.floor(m /
|
|
587
|
-
if (R >=
|
|
586
|
+
const R = r + Math.floor(m / o);
|
|
587
|
+
if (R >= n) {
|
|
588
588
|
y.style.display = "none";
|
|
589
589
|
return;
|
|
590
590
|
}
|
|
@@ -595,10 +595,10 @@ const ce = class ce {
|
|
|
595
595
|
t(this, $t).call(this, r), g(this, et, !1);
|
|
596
596
|
}, 0));
|
|
597
597
|
}, "#handleScroll"));
|
|
598
|
-
|
|
599
|
-
i.dataset.row = s, Array.from(i.cells).forEach((
|
|
600
|
-
const
|
|
601
|
-
|
|
598
|
+
c(this, bt, /* @__PURE__ */ a((i, e, s) => {
|
|
599
|
+
i.dataset.row = s, Array.from(i.cells).forEach((n, r) => {
|
|
600
|
+
const o = n.dataset.bind;
|
|
601
|
+
o && e && e[o] !== void 0 ? n.textContent = e[o] : n.textContent = e ? e[Object.keys(e)[r]] ?? `R${s}C${r}` : `행 ${s + 1}`, n.dataset.row = s;
|
|
602
602
|
});
|
|
603
603
|
}, "#bindRowData"));
|
|
604
604
|
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
@@ -620,74 +620,72 @@ var yt, st, N, Mt, _t, It, Wt, Ot;
|
|
|
620
620
|
const ct = class ct extends HTMLElement {
|
|
621
621
|
constructor() {
|
|
622
622
|
super();
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
623
|
+
c(this, yt);
|
|
624
|
+
c(this, st, null);
|
|
625
|
+
c(this, N);
|
|
626
626
|
/**
|
|
627
627
|
* data.set, add, delete
|
|
628
628
|
* filter, sorting : 고려대상
|
|
629
629
|
*/
|
|
630
630
|
v(this, "invalidate", /* @__PURE__ */ a(() => {
|
|
631
|
-
|
|
631
|
+
var o, l;
|
|
632
|
+
const s = (((l = (o = t(this, yt)) == null ? void 0 : o.data) == null ? void 0 : l.get()) || []).length, n = t(this, N).getRowHeight() || 24, r = s * n;
|
|
633
|
+
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((d) => {
|
|
634
|
+
const h = this.querySelector(d), f = h == null ? void 0 : h.querySelector("table");
|
|
635
|
+
T.log("==============="), T.log(f, r), f && (f.style.height = `${r}px`, f.style.minHeight = `${r}px`);
|
|
636
|
+
}), t(this, N).refresh();
|
|
632
637
|
}, "invalidate"));
|
|
633
|
-
|
|
638
|
+
c(this, Mt, /* @__PURE__ */ a(() => {
|
|
634
639
|
[
|
|
635
640
|
{ selector: ".ng-container-body", type: null },
|
|
636
641
|
{ selector: ".ng-container-left", type: "left" },
|
|
637
642
|
{ selector: ".ng-container-right", type: "right" }
|
|
638
|
-
].forEach(({ selector: s, type:
|
|
643
|
+
].forEach(({ selector: s, type: n }) => {
|
|
639
644
|
const r = this.querySelector(s);
|
|
640
645
|
if (!r) return;
|
|
641
|
-
const
|
|
642
|
-
r.innerHTML = "", r.appendChild(
|
|
646
|
+
const o = t(this, It).call(this, t(this, st), n);
|
|
647
|
+
r.innerHTML = "", r.appendChild(o);
|
|
643
648
|
});
|
|
644
649
|
}, "#renderSplitContainers"));
|
|
645
|
-
|
|
650
|
+
c(this, _t, /* @__PURE__ */ a(() => {
|
|
646
651
|
["left", "right"].forEach((e) => {
|
|
647
|
-
const s = this.querySelector(`.ng-container-${e}`),
|
|
648
|
-
if (!s || !
|
|
652
|
+
const s = this.querySelector(`.ng-container-${e}`), n = s == null ? void 0 : s.querySelector("table");
|
|
653
|
+
if (!s || !n) return;
|
|
649
654
|
let r = 0;
|
|
650
|
-
|
|
651
|
-
const l = parseInt(
|
|
655
|
+
n.querySelectorAll("col").forEach((o) => {
|
|
656
|
+
const l = parseInt(o.getAttribute("width"), 10);
|
|
652
657
|
isNaN(r) || (r += l);
|
|
653
658
|
}), s.style.flex = `0 0 ${r}px`, s.style.width = `${r}px`;
|
|
654
659
|
});
|
|
655
660
|
}, "#updateContainerWidths"));
|
|
656
661
|
v(this, "generate", /* @__PURE__ */ a((e) => {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
this.querySelectorAll("tbody.fixed-tbody").forEach((u) => {
|
|
663
|
-
u.style.top = `${c}px`;
|
|
662
|
+
e && (g(this, st, Gt.compile(e)), t(this, st).style.display = "table", t(this, Mt).call(this), t(this, _t).call(this), requestAnimationFrame(() => {
|
|
663
|
+
var n;
|
|
664
|
+
const s = (n = this.querySelector("thead")) == null ? void 0 : n.getBoundingClientRect().height;
|
|
665
|
+
this.querySelectorAll("tbody.fixed-tbody").forEach((r) => {
|
|
666
|
+
r.style.top = `${s}px`;
|
|
664
667
|
});
|
|
665
|
-
}), t(this, N).initialize()
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
T.log("=====================::::"), T.log(u, n), u && (u.style.height = `${n}px`, u.style.minHeight = `${n}px`);
|
|
670
|
-
}), setTimeout(() => {
|
|
671
|
-
var c;
|
|
672
|
-
(c = this.querySelector("nine-table-hscrollbar")) == null || c.refresh();
|
|
673
|
-
}, 0);
|
|
668
|
+
}), t(this, N).initialize(), setTimeout(() => {
|
|
669
|
+
var s;
|
|
670
|
+
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
671
|
+
}, 0));
|
|
674
672
|
}, "generate"));
|
|
675
673
|
/**
|
|
676
674
|
* 🎯 마스터 테이블을 기반으로 특정 fixed 타입 영역만 남기는 분할 헬퍼
|
|
677
675
|
*/
|
|
678
|
-
|
|
679
|
-
const
|
|
676
|
+
c(this, It, /* @__PURE__ */ a((e, s) => {
|
|
677
|
+
const n = e.cloneNode(!0), r = n.querySelector("tbody");
|
|
680
678
|
if (r) {
|
|
681
|
-
const
|
|
682
|
-
|
|
679
|
+
const o = document.createElement("tbody");
|
|
680
|
+
o.className = "fixed-tbody", r.className = "bindable-tbody", r.before(o);
|
|
683
681
|
}
|
|
684
|
-
return s === "left" ?
|
|
685
|
-
|
|
686
|
-
}) : s === "right" ?
|
|
687
|
-
|
|
688
|
-
}) :
|
|
689
|
-
|
|
690
|
-
}),
|
|
682
|
+
return s === "left" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((o) => {
|
|
683
|
+
o.getAttribute("fixed") !== "left" && o.remove();
|
|
684
|
+
}) : s === "right" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((o) => {
|
|
685
|
+
o.getAttribute("fixed") !== "right" && o.remove();
|
|
686
|
+
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((o) => {
|
|
687
|
+
o.remove();
|
|
688
|
+
}), n;
|
|
691
689
|
}, "#createSplitTable"));
|
|
692
690
|
v(this, "getRowHeight", /* @__PURE__ */ a(() => t(this, N).getRowHeight(), "getRowHeight"));
|
|
693
691
|
v(this, "scrollToX", /* @__PURE__ */ a((e) => {
|
|
@@ -698,10 +696,10 @@ const ct = class ct extends HTMLElement {
|
|
|
698
696
|
const s = this.querySelector(".ng-container-body");
|
|
699
697
|
s && (s.scrollTop = e);
|
|
700
698
|
}, "scrollToY"));
|
|
701
|
-
|
|
699
|
+
c(this, Wt, /* @__PURE__ */ a(() => {
|
|
702
700
|
t(this, Ot).call(this);
|
|
703
701
|
}, "#init"));
|
|
704
|
-
|
|
702
|
+
c(this, Ot, /* @__PURE__ */ a(() => {
|
|
705
703
|
const e = ct.SCROLLBAR_SIZE;
|
|
706
704
|
this.innerHTML = `
|
|
707
705
|
<style>
|
|
@@ -864,16 +862,16 @@ var zt, pt;
|
|
|
864
862
|
const he = class he extends HTMLElement {
|
|
865
863
|
constructor() {
|
|
866
864
|
super();
|
|
867
|
-
|
|
865
|
+
c(this, zt, /* @__PURE__ */ a(() => {
|
|
868
866
|
var e;
|
|
869
867
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
870
|
-
var
|
|
871
|
-
const
|
|
872
|
-
t(this, pt).call(this, r,
|
|
868
|
+
var o;
|
|
869
|
+
const n = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((o = s.target.closest(".nine-tab-item")) == null ? void 0 : o.dataset.index, 10);
|
|
870
|
+
t(this, pt).call(this, r, n);
|
|
873
871
|
}), t(this, pt).call(this, 0, !1);
|
|
874
872
|
}, "#init"));
|
|
875
|
-
|
|
876
|
-
const
|
|
873
|
+
c(this, pt, /* @__PURE__ */ a((e, s = !1) => {
|
|
874
|
+
const n = /* @__PURE__ */ a(() => {
|
|
877
875
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
878
876
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((y) => y.style.setProperty("display", "none"));
|
|
879
877
|
const b = f.filter((y) => y.classList.contains("active"));
|
|
@@ -881,7 +879,7 @@ const he = class he extends HTMLElement {
|
|
|
881
879
|
const m = parseInt(y.getAttribute("data-index"), 10), R = this.querySelector(`nine-splitter[data-split-index="${m}"]`), J = f[m + 1];
|
|
882
880
|
R && J && J.classList.contains("active") && R.style.setProperty("display", "flex");
|
|
883
881
|
});
|
|
884
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"),
|
|
882
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), d = o.querySelectorAll("nine-table-sheet");
|
|
885
883
|
if (!l[e]) return;
|
|
886
884
|
if (!s)
|
|
887
885
|
l.forEach((f, u) => {
|
|
@@ -895,13 +893,13 @@ const he = class he extends HTMLElement {
|
|
|
895
893
|
if (f.classList.contains("active") && u.length <= 1)
|
|
896
894
|
return;
|
|
897
895
|
f.classList.toggle("active");
|
|
898
|
-
const b =
|
|
896
|
+
const b = o.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
899
897
|
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
900
898
|
}
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
f.style.flex =
|
|
904
|
-
}),
|
|
899
|
+
const h = o.querySelectorAll("nine-table-sheet.active");
|
|
900
|
+
h == null || h.forEach((f) => {
|
|
901
|
+
f.style.flex = h.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
902
|
+
}), n();
|
|
905
903
|
}, "#switchSheet"));
|
|
906
904
|
}
|
|
907
905
|
connectedCallback() {
|
|
@@ -914,25 +912,25 @@ customElements.get("nine-table-sheets") || customElements.define("nine-table-she
|
|
|
914
912
|
var k, Dt, mt, Bt;
|
|
915
913
|
const de = class de {
|
|
916
914
|
constructor(i) {
|
|
917
|
-
|
|
918
|
-
|
|
915
|
+
c(this, k);
|
|
916
|
+
c(this, Dt, /* @__PURE__ */ a(() => {
|
|
919
917
|
t(this, Bt).call(this), new ResizeObserver((i) => {
|
|
920
918
|
for (let e of i)
|
|
921
919
|
t(this, k).getAttribute("auto-height") === "true" && t(this, mt).call(this);
|
|
922
920
|
}).observe(t(this, k));
|
|
923
921
|
}, "#init"));
|
|
924
|
-
|
|
925
|
-
var d,
|
|
922
|
+
c(this, mt, /* @__PURE__ */ a(() => {
|
|
923
|
+
var d, h;
|
|
926
924
|
const i = Array.from(t(this, k).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
927
925
|
if (i.length === 0) return;
|
|
928
|
-
const e = parseInt(t(this, k).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())),
|
|
926
|
+
const e = parseInt(t(this, k).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), n = (d = t(this, k).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : d.getBoundingClientRect().height, r = (h = t(this, k).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : h.getBoundingClientRect().height, o = St.SCROLLBAR_SIZE, l = e * s + n + r + o;
|
|
929
927
|
t(this, k).style.height = `${l}px`;
|
|
930
928
|
}, "#applyAutoHeight"));
|
|
931
|
-
|
|
932
|
-
const e = Array.from(t(this, k).children).filter((d) => d.tagName === "TABLE"), s = t(this, k).getAttribute("auto-height") === "true",
|
|
933
|
-
const u = `<nine-table-sheet class="${
|
|
929
|
+
c(this, Bt, /* @__PURE__ */ a(() => {
|
|
930
|
+
const e = Array.from(t(this, k).children).filter((d) => d.tagName === "TABLE"), s = t(this, k).getAttribute("auto-height") === "true", n = e.length, r = e.map((d, h) => {
|
|
931
|
+
const u = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, b = h < n - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
934
932
|
return u + b;
|
|
935
|
-
}).join(""),
|
|
933
|
+
}).join(""), o = e.map((d, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
936
934
|
t(this, k).shadowRoot.innerHTML = `
|
|
937
935
|
<style>
|
|
938
936
|
:host {
|
|
@@ -1016,7 +1014,7 @@ const de = class de {
|
|
|
1016
1014
|
<nine-table-sheets>
|
|
1017
1015
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
1018
1016
|
<nine-table-sheets-footer>
|
|
1019
|
-
<div class="nine-tab-bar">${
|
|
1017
|
+
<div class="nine-tab-bar">${o}</div>
|
|
1020
1018
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
1021
1019
|
</nine-table-sheets-footer>
|
|
1022
1020
|
</nine-table-sheets>
|
|
@@ -1025,9 +1023,9 @@ const de = class de {
|
|
|
1025
1023
|
<nine-table-footer></nine-table-footer>
|
|
1026
1024
|
`;
|
|
1027
1025
|
const l = t(this, k).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1028
|
-
l == null || l.forEach((d,
|
|
1029
|
-
e[
|
|
1030
|
-
d.generate(e[
|
|
1026
|
+
l == null || l.forEach((d, h) => {
|
|
1027
|
+
e[h] && setTimeout(() => {
|
|
1028
|
+
d.generate(e[h]), s && t(this, mt).call(this);
|
|
1031
1029
|
});
|
|
1032
1030
|
});
|
|
1033
1031
|
}, "#render"));
|
|
@@ -1039,8 +1037,8 @@ let te = de;
|
|
|
1039
1037
|
var xt, nt;
|
|
1040
1038
|
const fe = class fe {
|
|
1041
1039
|
constructor(i) {
|
|
1042
|
-
|
|
1043
|
-
|
|
1040
|
+
c(this, xt);
|
|
1041
|
+
c(this, nt, -1);
|
|
1044
1042
|
v(this, "count", /* @__PURE__ */ a(() => t(this, xt).rawRecords.length, "count"));
|
|
1045
1043
|
g(this, xt, i);
|
|
1046
1044
|
}
|
|
@@ -1057,13 +1055,13 @@ let ee = fe;
|
|
|
1057
1055
|
var L, E, H, ot, Nt, P, Pt, K, vt, Vt, Yt, rt;
|
|
1058
1056
|
const C = class C {
|
|
1059
1057
|
constructor(i, e) {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1058
|
+
c(this, L);
|
|
1059
|
+
c(this, E);
|
|
1060
|
+
c(this, H, []);
|
|
1061
|
+
c(this, ot, []);
|
|
1062
|
+
c(this, Nt, 0);
|
|
1063
|
+
c(this, P, []);
|
|
1064
|
+
c(this, Pt, /* @__PURE__ */ a(() => {
|
|
1067
1065
|
g(this, P, []);
|
|
1068
1066
|
const i = t(this, L).template || [];
|
|
1069
1067
|
Array.from(i).forEach((e) => {
|
|
@@ -1073,7 +1071,7 @@ const C = class C {
|
|
|
1073
1071
|
e.__ng || (e.__ng = t(this, vt).call(this)), e.__ng.height = t(this, P).slice();
|
|
1074
1072
|
});
|
|
1075
1073
|
}, "#initialize"));
|
|
1076
|
-
|
|
1074
|
+
c(this, K, /* @__PURE__ */ a(() => {
|
|
1077
1075
|
t(this, L).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1078
1076
|
i.invalidate();
|
|
1079
1077
|
});
|
|
@@ -1084,17 +1082,17 @@ const C = class C {
|
|
|
1084
1082
|
if (!s || s.length <= 0) return;
|
|
1085
1083
|
if (i == null) return t(this, rt).call(this, s);
|
|
1086
1084
|
if (i < 0 || i >= s.length) return null;
|
|
1087
|
-
const
|
|
1085
|
+
const n = typeof ((r = t(this, L).fields) == null ? void 0 : r.get) == "function" ? t(this, L).fields.get() : [];
|
|
1088
1086
|
if (e != null) {
|
|
1089
|
-
const
|
|
1090
|
-
return
|
|
1087
|
+
const o = n.indexOf(e);
|
|
1088
|
+
return o >= 0 ? s[i].v[o] : null;
|
|
1091
1089
|
}
|
|
1092
1090
|
return t(this, rt).call(this, s[i]);
|
|
1093
1091
|
}, "get"));
|
|
1094
1092
|
v(this, "set", /* @__PURE__ */ a((i) => {
|
|
1095
1093
|
this.clear(), this.add(i, !1), t(this, K).call(this);
|
|
1096
1094
|
}, "set"));
|
|
1097
|
-
|
|
1095
|
+
c(this, vt, /* @__PURE__ */ a(() => ({
|
|
1098
1096
|
rowState: C.ROW_STATE.EMPTY,
|
|
1099
1097
|
deleted: !1,
|
|
1100
1098
|
filtered: !1,
|
|
@@ -1110,37 +1108,37 @@ const C = class C {
|
|
|
1110
1108
|
var i;
|
|
1111
1109
|
t(this, E).rawRecords = [], g(this, H, []), g(this, ot, []), (i = t(this, E).viewRecords) != null && i.reset && t(this, E).viewRecords.reset();
|
|
1112
1110
|
}, "clear"));
|
|
1113
|
-
|
|
1114
|
-
var
|
|
1111
|
+
c(this, Vt, /* @__PURE__ */ a((i) => {
|
|
1112
|
+
var n;
|
|
1115
1113
|
Array.isArray(i) || (i = [i]);
|
|
1116
|
-
const e = typeof ((
|
|
1114
|
+
const e = typeof ((n = t(this, L).fields) == null ? void 0 : n.get) == "function" ? t(this, L).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1117
1115
|
return i.forEach((r) => {
|
|
1118
|
-
const
|
|
1116
|
+
const o = { v: [] };
|
|
1119
1117
|
e.forEach((l) => {
|
|
1120
|
-
|
|
1121
|
-
}), s.push(
|
|
1118
|
+
o.v.push(r[l] !== void 0 && r[l] !== null ? r[l] : "");
|
|
1119
|
+
}), s.push(o);
|
|
1122
1120
|
}), s;
|
|
1123
1121
|
}, "#json2Array"));
|
|
1124
|
-
|
|
1122
|
+
c(this, Yt, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1125
1123
|
e.__ng = t(this, vt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = C.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1126
1124
|
}), i), "#defaultInsert"));
|
|
1127
1125
|
v(this, "add", /* @__PURE__ */ a((i, e = !0) => {
|
|
1128
1126
|
i === void 0 && (i = {});
|
|
1129
1127
|
const s = t(this, Vt).call(this, i);
|
|
1130
1128
|
t(this, E).rawRecords = t(this, E).rawRecords.concat(t(this, Yt).call(this, s)), this.resetRecords();
|
|
1131
|
-
const
|
|
1132
|
-
return e || s.forEach((r,
|
|
1133
|
-
const l = t(this, E).rawRecords[
|
|
1129
|
+
const n = this.count() - 1;
|
|
1130
|
+
return e || s.forEach((r, o) => {
|
|
1131
|
+
const l = t(this, E).rawRecords[n - o];
|
|
1134
1132
|
l && (l.__ng.rowState = C.ROW_STATE.EMPTY);
|
|
1135
|
-
}), t(this, K).call(this),
|
|
1133
|
+
}), t(this, K).call(this), n;
|
|
1136
1134
|
}, "add"));
|
|
1137
1135
|
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
1138
1136
|
let e = [];
|
|
1139
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s,
|
|
1137
|
+
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s, n) => n - s).forEach((s) => {
|
|
1140
1138
|
if (t(this, H)[s]) {
|
|
1141
|
-
const
|
|
1142
|
-
t(this, H)[s].__ng.rowState === C.ROW_STATE.INSERT ? t(this, E).rawRecords = t(this, E).rawRecords.filter((r) => r.__ng.rowid !==
|
|
1143
|
-
r.__ng.rowid ===
|
|
1139
|
+
const n = t(this, H)[s].__ng.rowid;
|
|
1140
|
+
t(this, H)[s].__ng.rowState === C.ROW_STATE.INSERT ? t(this, E).rawRecords = t(this, E).rawRecords.filter((r) => r.__ng.rowid !== n) : t(this, E).rawRecords.forEach((r) => {
|
|
1141
|
+
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState = C.ROW_STATE.DELETE);
|
|
1144
1142
|
});
|
|
1145
1143
|
}
|
|
1146
1144
|
}), this.resetRecords(), t(this, K).call(this);
|
|
@@ -1150,10 +1148,10 @@ const C = class C {
|
|
|
1150
1148
|
i = parseInt(i, 10);
|
|
1151
1149
|
const r = (typeof ((d = t(this, L).fields) == null ? void 0 : d.get) == "function" ? t(this, L).fields.get() : []).indexOf(e);
|
|
1152
1150
|
if (r < 0) return;
|
|
1153
|
-
const
|
|
1154
|
-
if (!
|
|
1155
|
-
const l =
|
|
1156
|
-
l !== s &&
|
|
1151
|
+
const o = this.getValidData()[i];
|
|
1152
|
+
if (!o) return;
|
|
1153
|
+
const l = o.v[r];
|
|
1154
|
+
l !== s && o.__ng.rowState !== C.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = l), o.__ng.rowState = C.ROW_STATE.UPDATE), o.v[r] = s;
|
|
1157
1155
|
}, "setValue"));
|
|
1158
1156
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1159
1157
|
g(this, ot, t(this, E).rawRecords.filter((i) => !i.__ng.deleted)), g(this, H, t(this, E).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, E).rawRecords.forEach((i, e) => {
|
|
@@ -1163,13 +1161,13 @@ const C = class C {
|
|
|
1163
1161
|
});
|
|
1164
1162
|
}, "resetRecords"));
|
|
1165
1163
|
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this, H).length === 0 && t(this, E).rawRecords.length > 0 && this.resetRecords(), t(this, H)), "getValidData"));
|
|
1166
|
-
|
|
1167
|
-
var
|
|
1164
|
+
c(this, rt, /* @__PURE__ */ a((i) => {
|
|
1165
|
+
var o;
|
|
1168
1166
|
if (!i) return i;
|
|
1169
|
-
const e = !Array.isArray(i), s = e ? [i] : i,
|
|
1167
|
+
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this, L).fields) == null ? void 0 : o.get) == "function" ? t(this, L).fields.get() : [], r = s.filter((l) => !l.__ng.deleted).map((l) => {
|
|
1170
1168
|
const d = {};
|
|
1171
|
-
return
|
|
1172
|
-
d[
|
|
1169
|
+
return n.forEach((h, f) => {
|
|
1170
|
+
d[h] = l.v ? l.v[f] : l[h];
|
|
1173
1171
|
}), d.__ng = l.__ng, d;
|
|
1174
1172
|
});
|
|
1175
1173
|
return e ? r[0] : r;
|
|
@@ -1205,21 +1203,21 @@ let ie = C;
|
|
|
1205
1203
|
var Z;
|
|
1206
1204
|
const ue = class ue {
|
|
1207
1205
|
constructor(i) {
|
|
1208
|
-
|
|
1206
|
+
c(this, Z);
|
|
1209
1207
|
g(this, Z, i), this.row = new ee(this), this.data = new ie(t(this, Z), this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1210
1208
|
var e;
|
|
1211
1209
|
(e = t(this, Z).view) != null && e.redraw && t(this, Z).view.redraw();
|
|
1212
1210
|
}, this.setDataSource = (e) => {
|
|
1213
1211
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1214
1212
|
}, this.getRowState = (e) => {
|
|
1215
|
-
var
|
|
1213
|
+
var n, r;
|
|
1216
1214
|
const s = parseInt(e, 10);
|
|
1217
1215
|
if (!(s >= this.data.count()))
|
|
1218
|
-
return (r = (
|
|
1216
|
+
return (r = (n = this.data.getValidData()[s]) == null ? void 0 : n.__ng) == null ? void 0 : r.rowState;
|
|
1219
1217
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (e) => {
|
|
1220
1218
|
this.row.at = e;
|
|
1221
|
-
}, 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,
|
|
1222
|
-
e = parseInt(e, 10), this.data.setValue(e, s,
|
|
1219
|
+
}, this.scrollTo_V1 = (e) => (e < 0 && (e = 0), e >= this.rawRecords.length && (e = this.rawRecords.length - 1), this.viewRecords.rawIndex = e, this.viewRecords.reset && this.viewRecords.reset(), !(e <= 0 || e >= this.rawRecords.length - 1)), this.getColumn = (e, s) => this.data.get(e, s), this.setColumn = (e, s, n) => {
|
|
1220
|
+
e = parseInt(e, 10), this.data.setValue(e, s, n);
|
|
1223
1221
|
}, this.setDataSource([]);
|
|
1224
1222
|
}
|
|
1225
1223
|
};
|
|
@@ -1229,44 +1227,44 @@ var lt, A, wt, Xt;
|
|
|
1229
1227
|
const ge = class ge {
|
|
1230
1228
|
// 🎯 이제 { name: string, type: string } 객체들의 배열로 관리합니다.
|
|
1231
1229
|
constructor(i) {
|
|
1232
|
-
|
|
1233
|
-
|
|
1230
|
+
c(this, lt);
|
|
1231
|
+
c(this, A, []);
|
|
1234
1232
|
v(this, "add", /* @__PURE__ */ a((i, e = "string") => {
|
|
1235
1233
|
i.forEach((s) => {
|
|
1236
|
-
t(this, A).some((
|
|
1234
|
+
t(this, A).some((n) => n.name === s) || t(this, A).push({ name: s, type: e });
|
|
1237
1235
|
}), t(this, wt).call(this);
|
|
1238
1236
|
}, "add"));
|
|
1239
|
-
|
|
1237
|
+
c(this, wt, /* @__PURE__ */ a(() => {
|
|
1240
1238
|
const i = /* @__PURE__ */ new Map();
|
|
1241
1239
|
t(this, A).forEach((e) => {
|
|
1242
1240
|
i.set(e.name, e.type);
|
|
1243
1241
|
}), g(this, A, Array.from(i, ([e, s]) => ({ name: e, type: s }))), g(this, A, t(this, A).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, A).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1244
1242
|
}, "#adjust"));
|
|
1245
|
-
|
|
1243
|
+
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1246
1244
|
g(this, A, []), T.log(t(this, lt).querySelectorAll("table"));
|
|
1247
1245
|
const i = Array.from(t(this, lt).querySelectorAll("table"));
|
|
1248
1246
|
if (!(!i || i.length === 0)) {
|
|
1249
1247
|
for (const e of i)
|
|
1250
|
-
T.log(e), $("[data-bind]", e).each((s,
|
|
1251
|
-
const r =
|
|
1252
|
-
r && t(this, A).push({ name: r, type:
|
|
1248
|
+
T.log(e), $("[data-bind]", e).each((s, n) => {
|
|
1249
|
+
const r = n.dataset.bind, o = n.getAttribute("data-type") || "string";
|
|
1250
|
+
r && t(this, A).push({ name: r, type: o });
|
|
1253
1251
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
1254
|
-
$(`[${s}]`, e).each((
|
|
1255
|
-
var
|
|
1256
|
-
if (
|
|
1257
|
-
const l =
|
|
1252
|
+
$(`[${s}]`, e).each((n, r) => {
|
|
1253
|
+
var o = r.getAttribute(s);
|
|
1254
|
+
if (o.indexOf("data.") < 0) {
|
|
1255
|
+
const l = o.search(/[(]/g);
|
|
1258
1256
|
if (l > 0)
|
|
1259
1257
|
try {
|
|
1260
|
-
|
|
1258
|
+
o = String(window[o.substring(0, l).trim()]);
|
|
1261
1259
|
} catch {
|
|
1262
|
-
|
|
1260
|
+
o = "";
|
|
1263
1261
|
}
|
|
1264
1262
|
}
|
|
1265
|
-
|
|
1263
|
+
o.split("data.").forEach((l) => {
|
|
1266
1264
|
if (l.trim() != "") {
|
|
1267
1265
|
const d = l.search(/[^_A-Za-z0-9]/g);
|
|
1268
|
-
let
|
|
1269
|
-
d >= 0 ?
|
|
1266
|
+
let h = "";
|
|
1267
|
+
d >= 0 ? h = l.substring(0, d) : o.startsWith("data.") && (h = l.replace("data.", "")), h && t(this, A).push({ name: h, type: "string" });
|
|
1270
1268
|
}
|
|
1271
1269
|
});
|
|
1272
1270
|
});
|
|
@@ -1303,9 +1301,9 @@ const be = class be extends HTMLElement {
|
|
|
1303
1301
|
constructor() {
|
|
1304
1302
|
super();
|
|
1305
1303
|
//#created = false;
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1304
|
+
c(this, G);
|
|
1305
|
+
c(this, Ut);
|
|
1306
|
+
c(this, Ft, /* @__PURE__ */ a(() => {
|
|
1309
1307
|
this.fields = new ne(this), g(this, Ut, new te(this)), T.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1310
1308
|
}, "#init"));
|
|
1311
1309
|
this.attachShadow({ mode: "open" }), g(this, G, new se(this));
|