@ninebone/table 0.0.307 β 0.0.309
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 +126 -124
- 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
|
@@ -22,7 +22,7 @@ const Vt = class Vt extends re.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(Vt, "Trace");
|
|
24
24
|
let $t = Vt;
|
|
25
|
-
const
|
|
25
|
+
const A = new $t();
|
|
26
26
|
var M, _, y, P, B, N, dt, Y, ft;
|
|
27
27
|
const Xt = class Xt extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -44,22 +44,22 @@ const Xt = class Xt extends HTMLElement {
|
|
|
44
44
|
if (!t(this, M) || !t(this, y) || t(this, _)) return;
|
|
45
45
|
const e = t(this, y).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = t(this, y).track, o = t(this, y).thumb, r = t(this, M).querySelector(".ng-container-bottom"), l = e.clientWidth,
|
|
48
|
-
if (l !== 0 &&
|
|
47
|
+
const n = t(this, y).track, o = t(this, y).thumb, r = t(this, M).querySelector(".ng-container-bottom"), l = e.clientWidth, c = s.scrollWidth;
|
|
48
|
+
if (l !== 0 && c > l)
|
|
49
49
|
r && (r.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
r && (r.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const u = Math.max(Math.min(
|
|
54
|
+
const h = n.clientWidth;
|
|
55
|
+
if (h <= 0) return;
|
|
56
|
+
const u = Math.max(Math.min(h * (l / c), h), 20);
|
|
57
57
|
o.style.width = `${u}px`;
|
|
58
|
-
const f = e.scrollLeft, g =
|
|
58
|
+
const f = e.scrollLeft, g = c - l;
|
|
59
59
|
let p = 0;
|
|
60
|
-
g > 0 && (p = parseInt(f / g * (
|
|
61
|
-
const E =
|
|
62
|
-
p > E && (p = E), o.style.left = `${p}px`,
|
|
60
|
+
g > 0 && (p = parseInt(f / g * (h - u), 10)), p < 0 && (p = 0);
|
|
61
|
+
const E = h - u;
|
|
62
|
+
p > E && (p = E), o.style.left = `${p}px`, A.log(p), t(this, y).left.disabled = p === 0, t(this, y).right.disabled = p >= E - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
d(this, Y, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, y)) return !1;
|
|
@@ -68,10 +68,10 @@ const Xt = class Xt extends HTMLElement {
|
|
|
68
68
|
const o = t(this, y).track.getBoundingClientRect(), r = t(this, y).thumb.clientWidth;
|
|
69
69
|
let l = e;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
|
-
const
|
|
72
|
-
l >
|
|
73
|
-
const
|
|
74
|
-
return
|
|
71
|
+
const c = o.width - r;
|
|
72
|
+
l > c && (l = c), 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 >= c - 1;
|
|
73
|
+
const h = s.clientWidth, f = n.scrollWidth - h;
|
|
74
|
+
return c > 0 && f > 0 && (s.scrollLeft = l / c * f), l > 0 && l < c - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
d(this, ft, /* @__PURE__ */ a(() => {
|
|
77
77
|
const e = /* @__PURE__ */ a((n) => {
|
|
@@ -102,8 +102,8 @@ const Xt = class Xt extends HTMLElement {
|
|
|
102
102
|
n.stopPropagation(), n.preventDefault(), b(this, _, !0), this.shiftX = n.clientX - t(this, y).thumb.getBoundingClientRect().left;
|
|
103
103
|
const o = /* @__PURE__ */ a((l) => {
|
|
104
104
|
if (!t(this, _)) return;
|
|
105
|
-
const
|
|
106
|
-
t(this, Y).call(this, l.clientX -
|
|
105
|
+
const c = t(this, y).track.getBoundingClientRect();
|
|
106
|
+
t(this, Y).call(this, l.clientX - c.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), r = /* @__PURE__ */ a(() => {
|
|
108
108
|
b(this, _, !1), s(), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
@@ -223,41 +223,43 @@ const Ut = class Ut extends HTMLElement {
|
|
|
223
223
|
return;
|
|
224
224
|
} else
|
|
225
225
|
o.style.display = "block";
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
const
|
|
229
|
-
o.style.height = `${
|
|
226
|
+
const c = n.clientHeight;
|
|
227
|
+
if (c <= 0) return;
|
|
228
|
+
const h = Math.max(Math.min(c * (r / l), c), 20);
|
|
229
|
+
o.style.height = `${h}px`;
|
|
230
230
|
const u = e.scrollTop, f = l - r;
|
|
231
231
|
let g = 0;
|
|
232
|
-
f > 0 && (g = u / f * (
|
|
233
|
-
const p =
|
|
232
|
+
f > 0 && (g = u / f * (c - h));
|
|
233
|
+
const p = c - h;
|
|
234
234
|
g < 0 && (g = 0), g > p && (g = p), o.style.top = `${g}px`, t(this, S).top.disabled = u <= 0, t(this, S).bottom.disabled = u >= f - 1;
|
|
235
235
|
}, "refresh"));
|
|
236
236
|
d(this, ut, /* @__PURE__ */ a(() => {
|
|
237
|
-
const e = t(this, S).container
|
|
237
|
+
const e = t(this, S).container;
|
|
238
238
|
e.addEventListener("scroll", () => {
|
|
239
239
|
t(this, I) || this.refresh();
|
|
240
|
-
}), t(this, S).thumb.addEventListener("mousedown", (
|
|
241
|
-
if (
|
|
242
|
-
|
|
243
|
-
const
|
|
240
|
+
}), t(this, S).thumb.addEventListener("mousedown", (s) => {
|
|
241
|
+
if (s.button !== 0) return;
|
|
242
|
+
s.stopPropagation(), s.preventDefault(), b(this, I, !0), b(this, it, s.clientY), b(this, st, e.scrollTop);
|
|
243
|
+
const n = /* @__PURE__ */ a((r) => {
|
|
244
244
|
if (!t(this, I)) return;
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
245
|
+
const l = t(this, S).track.getBoundingClientRect(), c = t(this, S).thumb.clientHeight, u = l.height - c, f = r.clientY - t(this, it), g = e.clientHeight, p = e.querySelector("table");
|
|
246
|
+
A.log(p), A.log(p.scrollHeight);
|
|
247
|
+
const k = p.scrollHeight - g;
|
|
248
|
+
if (u > 0 && k > 0) {
|
|
249
|
+
const D = f / u * k;
|
|
248
250
|
e.scrollTop = t(this, st) + D;
|
|
249
251
|
}
|
|
250
252
|
this.refresh();
|
|
251
|
-
}, "onMouseMove"),
|
|
252
|
-
b(this, I, !1), document.removeEventListener("mousemove",
|
|
253
|
+
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
254
|
+
b(this, I, !1), document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", o), this.refresh();
|
|
253
255
|
}, "onMouseUp");
|
|
254
|
-
document.addEventListener("mousemove",
|
|
255
|
-
}), t(this, S).track.addEventListener("mousedown", (
|
|
256
|
-
if (
|
|
257
|
-
const
|
|
258
|
-
if (c > 0 &&
|
|
259
|
-
const
|
|
260
|
-
e.scrollTop =
|
|
256
|
+
document.addEventListener("mousemove", n), document.addEventListener("mouseup", o);
|
|
257
|
+
}), t(this, S).track.addEventListener("mousedown", (s) => {
|
|
258
|
+
if (s.button !== 0 || s.target === t(this, S).thumb) return;
|
|
259
|
+
const n = t(this, S).track.getBoundingClientRect(), o = t(this, S).thumb.clientHeight, r = s.clientY - n.top - o / 2, c = n.height - o, h = e.clientHeight, f = e.querySelector("table").scrollHeight - h;
|
|
260
|
+
if (c > 0 && f > 0) {
|
|
261
|
+
const g = Math.max(0, Math.min(1, r / c));
|
|
262
|
+
e.scrollTop = g * f;
|
|
261
263
|
}
|
|
262
264
|
this.refresh();
|
|
263
265
|
}), t(this, S).top.addEventListener("click", () => {
|
|
@@ -367,9 +369,9 @@ const C = class C {
|
|
|
367
369
|
var n, o, r, l;
|
|
368
370
|
if (!i) return null;
|
|
369
371
|
const e = i.cloneNode(!0);
|
|
370
|
-
return t(n = C, gt).call(n, e), t(o = C, F).call(o, e, "thead"), t(r = C, F).call(r, e, "tbody"), t(l = C, F).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((
|
|
371
|
-
const u =
|
|
372
|
-
u && e.querySelectorAll(`thead [data-col="${
|
|
372
|
+
return t(n = C, gt).call(n, e), t(o = C, F).call(o, e, "thead"), t(r = C, F).call(r, e, "tbody"), t(l = C, F).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((c, h) => {
|
|
373
|
+
const u = c.getAttribute("fixed");
|
|
374
|
+
u && e.querySelectorAll(`thead [data-col="${h}"], tbody [data-col="${h}"], tfoot [data-col="${h}"]`).forEach((f) => {
|
|
373
375
|
f.setAttribute("fixed", u);
|
|
374
376
|
});
|
|
375
377
|
}), e;
|
|
@@ -393,30 +395,30 @@ gt = new WeakMap(), F = new WeakMap(), a(C, "TableCompiler"), d(C, gt, /* @__PUR
|
|
|
393
395
|
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), o = s.length;
|
|
394
396
|
if (o === 0 || n.length === 0) return;
|
|
395
397
|
let r = 0;
|
|
396
|
-
n.forEach((
|
|
397
|
-
r +=
|
|
398
|
+
n.forEach((c) => {
|
|
399
|
+
r += c.colSpan || 1;
|
|
398
400
|
});
|
|
399
401
|
const l = Array.from(Array(o), () => Array(r).fill(null));
|
|
400
|
-
s.forEach((
|
|
401
|
-
const
|
|
402
|
+
s.forEach((c) => {
|
|
403
|
+
const h = c.sectionRowIndex;
|
|
402
404
|
let u = 0;
|
|
403
|
-
Array.from(
|
|
404
|
-
for (let E = 0; E < l[
|
|
405
|
-
if (l[
|
|
405
|
+
Array.from(c.querySelectorAll("th,td")).forEach((f) => {
|
|
406
|
+
for (let E = 0; E < l[h].length; E++)
|
|
407
|
+
if (l[h][E] === null) {
|
|
406
408
|
u = E;
|
|
407
409
|
break;
|
|
408
410
|
}
|
|
409
411
|
const g = f.rowSpan || 1, p = f.colSpan || 1;
|
|
410
412
|
for (let E = 0; E < g; E++)
|
|
411
413
|
for (let k = 0; k < p; k++)
|
|
412
|
-
|
|
414
|
+
h + E < o && u + k < r && (l[h + E][u + k] = E === 0 && k === 0 ? "1" : "0");
|
|
413
415
|
});
|
|
414
|
-
}), s.forEach((
|
|
415
|
-
const
|
|
416
|
-
Array.from(
|
|
417
|
-
for (let f = 0; f < l[
|
|
418
|
-
if (l[
|
|
419
|
-
u.dataset.col = f, l[
|
|
416
|
+
}), s.forEach((c) => {
|
|
417
|
+
const h = c.sectionRowIndex;
|
|
418
|
+
Array.from(c.querySelectorAll("th,td")).forEach((u) => {
|
|
419
|
+
for (let f = 0; f < l[h].length; f++)
|
|
420
|
+
if (l[h][f] === "1") {
|
|
421
|
+
u.dataset.col = f, l[h][f] = "0";
|
|
420
422
|
break;
|
|
421
423
|
}
|
|
422
424
|
});
|
|
@@ -453,7 +455,7 @@ const Kt = class Kt {
|
|
|
453
455
|
if (!n) return;
|
|
454
456
|
const o = n.querySelector("tbody");
|
|
455
457
|
if (!o) return;
|
|
456
|
-
const l = Array.from(o.querySelectorAll("tr")).map((
|
|
458
|
+
const l = Array.from(o.querySelectorAll("tr")).map((c) => c.cloneNode(!0));
|
|
457
459
|
t(this, $).set(e, l);
|
|
458
460
|
});
|
|
459
461
|
const i = t(this, m).querySelector(".ng-container-body");
|
|
@@ -463,7 +465,7 @@ const Kt = class Kt {
|
|
|
463
465
|
i.addEventListener("scroll", () => {
|
|
464
466
|
var n;
|
|
465
467
|
const s = i.scrollTop;
|
|
466
|
-
|
|
468
|
+
A.log(e, s), e !== s && (e = s, t(this, Z).call(this, s)), (n = t(this, m).querySelector("nine-table-vscrollbar")) == null || n.refresh();
|
|
467
469
|
});
|
|
468
470
|
}
|
|
469
471
|
}, "initialize"));
|
|
@@ -475,8 +477,8 @@ const Kt = class Kt {
|
|
|
475
477
|
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
476
478
|
const o = n.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
477
479
|
for (let l = 0; l < t(this, U); l++)
|
|
478
|
-
s.forEach((
|
|
479
|
-
r.appendChild(
|
|
480
|
+
s.forEach((c) => {
|
|
481
|
+
r.appendChild(c.cloneNode(!0));
|
|
480
482
|
});
|
|
481
483
|
o ? o.before(r) : n.appendChild(r);
|
|
482
484
|
}, "#renderRows"));
|
|
@@ -495,13 +497,13 @@ const Kt = class Kt {
|
|
|
495
497
|
e.forEach((g) => {
|
|
496
498
|
o.appendChild(g.cloneNode(!0));
|
|
497
499
|
}), n ? n.before(o) : s.appendChild(o);
|
|
498
|
-
const r = t(this, m), l = r.style.display,
|
|
500
|
+
const r = t(this, m), l = r.style.display, c = r.style.visibility, h = r.style.position;
|
|
499
501
|
(l === "none" || window.getComputedStyle(r).display === "none") && (r.style.display = "block", r.style.visibility = "hidden", r.style.position = "absolute");
|
|
500
502
|
let u = 0;
|
|
501
503
|
const f = s.querySelectorAll("tr:not(.nodata)");
|
|
502
504
|
return f.forEach((g) => {
|
|
503
505
|
u += g.offsetHeight || g.getBoundingClientRect().height;
|
|
504
|
-
}), f.forEach((g) => g.remove()), r.style.display = l, r.style.visibility =
|
|
506
|
+
}), f.forEach((g) => g.remove()), r.style.display = l, r.style.visibility = c, r.style.position = h, b(this, R, u > 0 ? u : 24), t(this, ot).call(this), A.log(`[RowManager] Height Cached: ${t(this, R)}px | RowCount: ${t(this, U)}`), t(this, R);
|
|
505
507
|
}, "#measureAndCacheHeight"));
|
|
506
508
|
/**
|
|
507
509
|
* π― μ 체 λ°μ΄ν° κ°μ κΈ°λ°μΌλ‘ κ°μ μ€ν¬λ‘€ λμ΄ μ€μ
|
|
@@ -510,12 +512,12 @@ const Kt = class Kt {
|
|
|
510
512
|
* π― μ 체 λ°μ΄ν° κ°μ κΈ°λ°μΌλ‘ κ°μ μ€ν¬λ‘€ λμ΄ μ€μ
|
|
511
513
|
*/
|
|
512
514
|
d(this, nt, /* @__PURE__ */ a(() => {
|
|
513
|
-
var o, r, l,
|
|
515
|
+
var o, r, l, c;
|
|
514
516
|
if (!t(this, m).querySelector(".ng-container-body")) return;
|
|
515
|
-
const e = (typeof ((o = t(this, m).data) == null ? void 0 : o.count) == "function" ? t(this, m).data.count() : null) ?? ((l = (r = t(this, m).dataManager) == null ? void 0 : r.rawRecords) == null ? void 0 : l.length) ?? ((
|
|
516
|
-
|
|
517
|
-
const u = t(this, m).querySelector(
|
|
518
|
-
f ? (f.style.height = `${n}px`,
|
|
517
|
+
const e = (typeof ((o = t(this, m).data) == null ? void 0 : o.count) == "function" ? t(this, m).data.count() : null) ?? ((l = (r = t(this, m).dataManager) == null ? void 0 : r.rawRecords) == null ? void 0 : l.length) ?? ((c = t(this, m).data) == null ? void 0 : c.length) ?? 0, s = t(this, R) || 24, n = e * s;
|
|
518
|
+
A.log(`[RowManager] TotalCount: ${e} | RowHeight: ${s}px | TotalVirtualHeight: ${n}px`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
519
|
+
const u = t(this, m).querySelector(h), f = u == null ? void 0 : u.querySelector("table");
|
|
520
|
+
f ? (f.style.height = `${n}px`, A.log(`[RowManager] Applied height to ${h} table:`, f.style.height)) : A.log(`[RowManager] Table not found for selector: ${h}`);
|
|
519
521
|
});
|
|
520
522
|
}, "#updateVirtualScrollHeight"));
|
|
521
523
|
d(this, ot, /* @__PURE__ */ a(() => {
|
|
@@ -526,14 +528,14 @@ const Kt = class Kt {
|
|
|
526
528
|
b(this, U, 40);
|
|
527
529
|
}, "#updateRowCount"));
|
|
528
530
|
d(this, yt, /* @__PURE__ */ a(() => {
|
|
529
|
-
var
|
|
531
|
+
var c, h, u;
|
|
530
532
|
const i = t(this, m).querySelector(".ng-container-left table"), e = t(this, m).querySelector(".ng-container-body table"), s = t(this, m).querySelector(".ng-container-right table");
|
|
531
533
|
if (!e) return;
|
|
532
534
|
const n = i ? Array.from(i.querySelectorAll("tr")) : [], o = Array.from(e.querySelectorAll("tr")), r = s ? Array.from(s.querySelectorAll("tr")) : [], l = Math.max(n.length, o.length, r.length);
|
|
533
535
|
for (let f = 0; f < l; f++) {
|
|
534
536
|
const g = [
|
|
535
|
-
((
|
|
536
|
-
((
|
|
537
|
+
((c = n[f]) == null ? void 0 : c.getBoundingClientRect().height) || 0,
|
|
538
|
+
((h = o[f]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
537
539
|
((u = r[f]) == null ? void 0 : u.getBoundingClientRect().height) || 0
|
|
538
540
|
], p = Math.max(...g);
|
|
539
541
|
p > 0 && (n[f] && (n[f].style.height = `${p}px`), o[f] && (o[f].style.height = `${p}px`), r[f] && (r[f].style.height = `${p}px`));
|
|
@@ -580,21 +582,21 @@ const Kt = class Kt {
|
|
|
580
582
|
var r;
|
|
581
583
|
const e = t(this, R);
|
|
582
584
|
if (!e || e <= 0) {
|
|
583
|
-
|
|
585
|
+
A.log("[RowManager] #handleScroll Aborted: rowHeight is invalid", e);
|
|
584
586
|
return;
|
|
585
587
|
}
|
|
586
588
|
const s = Math.max(0, Math.floor(i / e)), n = i % e;
|
|
587
|
-
|
|
589
|
+
A.log(`[RowManager] ScrollTop: ${i} | StartIndex: ${s} | OffsetY: ${n}px`);
|
|
588
590
|
const o = ((r = t(this, $).get(".ng-container-body")) == null ? void 0 : r.length) || 1;
|
|
589
591
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((l) => {
|
|
590
|
-
const
|
|
591
|
-
if (!
|
|
592
|
-
const
|
|
593
|
-
if (!
|
|
594
|
-
|
|
592
|
+
const c = t(this, m).querySelector(l);
|
|
593
|
+
if (!c) return;
|
|
594
|
+
const h = c.querySelector("tbody");
|
|
595
|
+
if (!h) {
|
|
596
|
+
A.log(`[RowManager] tbody not found for selector: ${l}`);
|
|
595
597
|
return;
|
|
596
598
|
}
|
|
597
|
-
window.getComputedStyle(
|
|
599
|
+
window.getComputedStyle(h).position === "static" && (h.style.position = "relative"), h.style.transform = `translateY(-${n}px)`, h.style.willChange = "transform", Array.from(h.querySelectorAll("tr:not(.nodata)")).forEach((f, g) => {
|
|
598
600
|
var k, D, Qt, te;
|
|
599
601
|
const p = s + Math.floor(g / o), E = (typeof t(this, m).getData == "function" ? t(this, m).getData(p) : null) ?? (typeof ((k = t(this, m).data) == null ? void 0 : k.get) == "function" ? t(this, m).data.get(p) : null) ?? ((Qt = (D = t(this, m).dataManager) == null ? void 0 : D.rawRecords) == null ? void 0 : Qt[p]) ?? ((te = t(this, m).data) == null ? void 0 : te[p]) ?? null;
|
|
600
602
|
E ? (f.style.display = "", t(this, xt).call(this, f, E, p)) : f.style.display = "none";
|
|
@@ -828,7 +830,7 @@ const et = class et extends HTMLElement {
|
|
|
828
830
|
t(this, Et).call(this);
|
|
829
831
|
}
|
|
830
832
|
disconnectedCallback() {
|
|
831
|
-
this.innerHTML = "",
|
|
833
|
+
this.innerHTML = "", A.log("NineTableSheet destroyed.");
|
|
832
834
|
}
|
|
833
835
|
};
|
|
834
836
|
G = new WeakMap(), J = new WeakMap(), vt = new WeakMap(), wt = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), Rt = new WeakMap(), a(et, "NineTableSheet"), w(et, "SCROLLBAR_SIZE", 16);
|
|
@@ -855,12 +857,12 @@ const jt = class jt extends HTMLElement {
|
|
|
855
857
|
const E = parseInt(p.getAttribute("data-index"), 10), k = this.querySelector(`nine-splitter[data-split-index="${E}"]`), D = u[E + 1];
|
|
856
858
|
k && D && D.classList.contains("active") && k.style.setProperty("display", "flex");
|
|
857
859
|
});
|
|
858
|
-
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"),
|
|
860
|
+
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"), c = r.querySelectorAll("nine-table-sheet");
|
|
859
861
|
if (!l[e]) return;
|
|
860
862
|
if (!s)
|
|
861
863
|
l.forEach((u, f) => {
|
|
862
864
|
u.classList.toggle("active", f === e);
|
|
863
|
-
}),
|
|
865
|
+
}), c.forEach((u, f) => {
|
|
864
866
|
const g = f === e;
|
|
865
867
|
u.classList.toggle("active", g), u.style.flex = g ? "1 1 100%" : "";
|
|
866
868
|
});
|
|
@@ -872,9 +874,9 @@ const jt = class jt extends HTMLElement {
|
|
|
872
874
|
const g = r.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
873
875
|
g && (g.classList.toggle("active"), g.classList.contains("active") || (g.style.flex = ""));
|
|
874
876
|
}
|
|
875
|
-
const
|
|
876
|
-
|
|
877
|
-
u.style.flex =
|
|
877
|
+
const h = r.querySelectorAll("nine-table-sheet.active");
|
|
878
|
+
h == null || h.forEach((u) => {
|
|
879
|
+
u.style.flex = h.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
878
880
|
}), n();
|
|
879
881
|
}, "#switchSheet"));
|
|
880
882
|
}
|
|
@@ -896,17 +898,17 @@ const Ft = class Ft {
|
|
|
896
898
|
}).observe(t(this, T));
|
|
897
899
|
}, "#init"));
|
|
898
900
|
d(this, at, /* @__PURE__ */ a(() => {
|
|
899
|
-
var
|
|
901
|
+
var c, h;
|
|
900
902
|
const i = Array.from(t(this, T).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
901
903
|
if (i.length === 0) return;
|
|
902
|
-
const e = parseInt(t(this, T).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((u) => u.getRowHeight())), n = (
|
|
904
|
+
const e = parseInt(t(this, T).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((u) => u.getRowHeight())), n = (c = t(this, T).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : c.getBoundingClientRect().height, o = (h = t(this, T).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : h.getBoundingClientRect().height, r = ht.SCROLLBAR_SIZE, l = e * s + n + o + r;
|
|
903
905
|
t(this, T).style.height = `${l}px`;
|
|
904
906
|
}, "#applyAutoHeight"));
|
|
905
907
|
d(this, At, /* @__PURE__ */ a(() => {
|
|
906
|
-
const e = Array.from(t(this, T).children).filter((
|
|
907
|
-
const f = `<nine-table-sheet class="${
|
|
908
|
+
const e = Array.from(t(this, T).children).filter((c) => c.tagName === "TABLE"), s = t(this, T).getAttribute("auto-height") === "true", n = e.length, o = e.map((c, h) => {
|
|
909
|
+
const f = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, g = h < n - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
908
910
|
return f + g;
|
|
909
|
-
}).join(""), r = e.map((
|
|
911
|
+
}).join(""), r = e.map((c, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
910
912
|
t(this, T).shadowRoot.innerHTML = `
|
|
911
913
|
<style>
|
|
912
914
|
:host {
|
|
@@ -1007,9 +1009,9 @@ const Ft = class Ft {
|
|
|
1007
1009
|
<nine-table-footer></nine-table-footer>
|
|
1008
1010
|
`;
|
|
1009
1011
|
const l = t(this, T).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1010
|
-
l == null || l.forEach((
|
|
1011
|
-
e[
|
|
1012
|
-
|
|
1012
|
+
l == null || l.forEach((c, h) => {
|
|
1013
|
+
e[h] && setTimeout(() => {
|
|
1014
|
+
c.generate(e[h]), s && t(this, at).call(this);
|
|
1013
1015
|
});
|
|
1014
1016
|
});
|
|
1015
1017
|
}, "#render"));
|
|
@@ -1041,18 +1043,18 @@ const Zt = class Zt {
|
|
|
1041
1043
|
};
|
|
1042
1044
|
O = new WeakMap(), K = new WeakMap(), a(Zt, "ngRow");
|
|
1043
1045
|
let Pt = Zt;
|
|
1044
|
-
var
|
|
1045
|
-
const
|
|
1046
|
+
var q, v, L, Q, qt, z, Lt, ct, Ht, Ct, tt;
|
|
1047
|
+
const H = class H {
|
|
1046
1048
|
constructor(i, e) {
|
|
1047
|
-
d(this,
|
|
1049
|
+
d(this, q);
|
|
1048
1050
|
d(this, v);
|
|
1049
|
-
d(this,
|
|
1051
|
+
d(this, L, []);
|
|
1050
1052
|
d(this, Q, []);
|
|
1051
1053
|
d(this, qt, 0);
|
|
1052
1054
|
d(this, z, []);
|
|
1053
1055
|
d(this, Lt, /* @__PURE__ */ a(() => {
|
|
1054
1056
|
b(this, z, []);
|
|
1055
|
-
const i = t(this,
|
|
1057
|
+
const i = t(this, q).template || [];
|
|
1056
1058
|
Array.from(i).forEach((e) => {
|
|
1057
1059
|
var s;
|
|
1058
1060
|
t(this, z).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
@@ -1064,25 +1066,25 @@ const L = class L {
|
|
|
1064
1066
|
this.clear(), this.add(i, !1);
|
|
1065
1067
|
}, "set"));
|
|
1066
1068
|
d(this, ct, /* @__PURE__ */ a(() => ({
|
|
1067
|
-
rowState:
|
|
1069
|
+
rowState: H.ROW_STATE.EMPTY,
|
|
1068
1070
|
deleted: !1,
|
|
1069
1071
|
filtered: !1,
|
|
1070
1072
|
height: t(this, z).slice(),
|
|
1071
1073
|
o: {},
|
|
1072
1074
|
c: {},
|
|
1073
|
-
_: [0, 0, 0, 0,
|
|
1075
|
+
_: [0, 0, 0, 0, H.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, z).slice(), -1, {}, {}]
|
|
1074
1076
|
}), "#getDefaultMeta"));
|
|
1075
1077
|
w(this, "reset", /* @__PURE__ */ a(() => {
|
|
1076
|
-
b(this,
|
|
1078
|
+
b(this, L, []), b(this, Q, []);
|
|
1077
1079
|
}, "reset"));
|
|
1078
1080
|
w(this, "clear", /* @__PURE__ */ a(() => {
|
|
1079
1081
|
var i;
|
|
1080
|
-
t(this, v).rawRecords = [], b(this,
|
|
1082
|
+
t(this, v).rawRecords = [], b(this, L, []), b(this, Q, []), (i = t(this, v).viewRecords) != null && i.reset && t(this, v).viewRecords.reset();
|
|
1081
1083
|
}, "clear"));
|
|
1082
1084
|
d(this, Ht, /* @__PURE__ */ a((i) => {
|
|
1083
1085
|
var n;
|
|
1084
1086
|
Array.isArray(i) || (i = [i]);
|
|
1085
|
-
const e = typeof ((n = t(this,
|
|
1087
|
+
const e = typeof ((n = t(this, q).fields) == null ? void 0 : n.get) == "function" ? t(this, q).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1086
1088
|
return i.forEach((o) => {
|
|
1087
1089
|
const r = { v: [] };
|
|
1088
1090
|
e.forEach((l) => {
|
|
@@ -1091,7 +1093,7 @@ const L = class L {
|
|
|
1091
1093
|
}), s;
|
|
1092
1094
|
}, "#json2Array"));
|
|
1093
1095
|
d(this, Ct, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1094
|
-
e.__ng = t(this, ct).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState =
|
|
1096
|
+
e.__ng = t(this, ct).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = H.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1095
1097
|
}), i), "#defaultInsert"));
|
|
1096
1098
|
w(this, "add", /* @__PURE__ */ a((i, e = !0) => {
|
|
1097
1099
|
var o;
|
|
@@ -1100,44 +1102,44 @@ const L = class L {
|
|
|
1100
1102
|
t(this, v).rawRecords = t(this, v).rawRecords.concat(t(this, Ct).call(this, s)), this.resetRecords();
|
|
1101
1103
|
const n = this.count() - 1;
|
|
1102
1104
|
return e || s.forEach((r, l) => {
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1105
|
+
const c = t(this, v).rawRecords[n - l];
|
|
1106
|
+
c && (c.__ng.rowState = H.ROW_STATE.EMPTY);
|
|
1105
1107
|
}), (o = t(this, v).viewRecords) != null && o.reset && t(this, v).viewRecords.reset(), n;
|
|
1106
1108
|
}, "add"));
|
|
1107
1109
|
w(this, "delete", /* @__PURE__ */ a((i) => {
|
|
1108
1110
|
var s;
|
|
1109
1111
|
let e = [];
|
|
1110
1112
|
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, v).owner.row.at] : e = [parseInt(i, 10)], e.sort((n, o) => o - n).forEach((n) => {
|
|
1111
|
-
if (t(this,
|
|
1112
|
-
const o = t(this,
|
|
1113
|
-
t(this,
|
|
1114
|
-
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState =
|
|
1113
|
+
if (t(this, L)[n]) {
|
|
1114
|
+
const o = t(this, L)[n].__ng.rowid;
|
|
1115
|
+
t(this, L)[n].__ng.rowState === H.ROW_STATE.INSERT ? t(this, v).rawRecords = t(this, v).rawRecords.filter((r) => r.__ng.rowid !== o) : t(this, v).rawRecords.forEach((r) => {
|
|
1116
|
+
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = H.ROW_STATE.DELETE);
|
|
1115
1117
|
});
|
|
1116
1118
|
}
|
|
1117
1119
|
}), this.resetRecords(), (s = t(this, v).viewRecords) != null && s.reset && t(this, v).viewRecords.reset();
|
|
1118
1120
|
}, "delete"));
|
|
1119
1121
|
w(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
|
|
1120
|
-
var
|
|
1122
|
+
var c;
|
|
1121
1123
|
i = parseInt(i, 10);
|
|
1122
|
-
const o = (typeof ((
|
|
1124
|
+
const o = (typeof ((c = t(this, q).fields) == null ? void 0 : c.get) == "function" ? t(this, q).fields.get() : []).indexOf(e);
|
|
1123
1125
|
if (o < 0) return;
|
|
1124
1126
|
const r = this.getValidData()[i];
|
|
1125
1127
|
if (!r) return;
|
|
1126
1128
|
const l = r.v[o];
|
|
1127
|
-
l !== s && r.__ng.rowState !==
|
|
1129
|
+
l !== s && r.__ng.rowState !== H.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(e) || (r.__ng.o[e] = l), r.__ng.rowState = H.ROW_STATE.UPDATE), r.v[o] = s, t(this, v).owner.refreshData && t(this, v).owner.refreshData(i);
|
|
1128
1130
|
}, "setValue"));
|
|
1129
1131
|
w(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1130
|
-
b(this, Q, t(this, v).rawRecords.filter((i) => !i.__ng.deleted)), b(this,
|
|
1132
|
+
b(this, Q, t(this, v).rawRecords.filter((i) => !i.__ng.deleted)), b(this, L, t(this, v).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, v).rawRecords.forEach((i, e) => {
|
|
1131
1133
|
i.__ng.rowidx = e;
|
|
1132
|
-
}), t(this,
|
|
1134
|
+
}), t(this, L).forEach((i, e) => {
|
|
1133
1135
|
i.__ng.i = e;
|
|
1134
1136
|
});
|
|
1135
1137
|
}, "resetRecords"));
|
|
1136
|
-
w(this, "getValidData", /* @__PURE__ */ a(() => (t(this,
|
|
1138
|
+
w(this, "getValidData", /* @__PURE__ */ a(() => (t(this, L).length === 0 && t(this, v).rawRecords.length > 0 && this.resetRecords(), t(this, L)), "getValidData"));
|
|
1137
1139
|
d(this, tt, /* @__PURE__ */ a((i) => {
|
|
1138
1140
|
var s;
|
|
1139
1141
|
if (!i) return i;
|
|
1140
|
-
const e = typeof ((s = t(this,
|
|
1142
|
+
const e = typeof ((s = t(this, q).fields) == null ? void 0 : s.get) == "function" ? t(this, q).fields.get() : [];
|
|
1141
1143
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
1142
1144
|
const o = {};
|
|
1143
1145
|
return e.forEach((r, l) => {
|
|
@@ -1152,14 +1154,14 @@ const L = class L {
|
|
|
1152
1154
|
if (!s || s.length <= 0) return;
|
|
1153
1155
|
if (i == null) return t(this, tt).call(this, s);
|
|
1154
1156
|
if (i < 0 || i >= s.length) return null;
|
|
1155
|
-
const n = typeof ((o = t(this,
|
|
1157
|
+
const n = typeof ((o = t(this, q).fields) == null ? void 0 : o.get) == "function" ? t(this, q).fields.get() : [];
|
|
1156
1158
|
if (e != null) {
|
|
1157
1159
|
const r = n.indexOf(e);
|
|
1158
1160
|
return r >= 0 ? s[i].v[r] : null;
|
|
1159
1161
|
}
|
|
1160
1162
|
return t(this, tt).call(this, s[i]);
|
|
1161
1163
|
}, "get"));
|
|
1162
|
-
b(this,
|
|
1164
|
+
b(this, q, i), b(this, v, e), t(this, Lt).call(this);
|
|
1163
1165
|
}
|
|
1164
1166
|
get source() {
|
|
1165
1167
|
return t(this, tt).call(this, t(this, v).rawRecords);
|
|
@@ -1171,21 +1173,21 @@ const L = class L {
|
|
|
1171
1173
|
return ++ne(this, qt)._;
|
|
1172
1174
|
}
|
|
1173
1175
|
get length() {
|
|
1174
|
-
return t(this,
|
|
1176
|
+
return t(this, L).length;
|
|
1175
1177
|
}
|
|
1176
1178
|
getRowCount() {
|
|
1177
1179
|
return this.length;
|
|
1178
1180
|
}
|
|
1179
1181
|
};
|
|
1180
|
-
|
|
1181
|
-
w(
|
|
1182
|
+
q = new WeakMap(), v = new WeakMap(), L = new WeakMap(), Q = new WeakMap(), qt = new WeakMap(), z = new WeakMap(), Lt = new WeakMap(), ct = new WeakMap(), Ht = new WeakMap(), Ct = new WeakMap(), tt = new WeakMap(), a(H, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1183
|
+
w(H, "ROW_STATE", {
|
|
1182
1184
|
EMPTY: "EMPTY",
|
|
1183
1185
|
NORMAL: "NORMAL",
|
|
1184
1186
|
INSERT: "INSERT",
|
|
1185
1187
|
UPDATE: "UPDATE",
|
|
1186
1188
|
DELETE: "DELETE"
|
|
1187
1189
|
});
|
|
1188
|
-
let Bt =
|
|
1190
|
+
let Bt = H;
|
|
1189
1191
|
const Gt = class Gt {
|
|
1190
1192
|
constructor(i) {
|
|
1191
1193
|
this.owner = i, this.row = new Pt(this), this.data = new Bt(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
@@ -1217,10 +1219,10 @@ const Jt = class Jt extends HTMLElement {
|
|
|
1217
1219
|
this.attachShadow({ mode: "open" }), b(this, j, new Nt(this));
|
|
1218
1220
|
}
|
|
1219
1221
|
connectedCallback() {
|
|
1220
|
-
b(this, Mt, new Dt(this)),
|
|
1222
|
+
b(this, Mt, new Dt(this)), A.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1221
1223
|
}
|
|
1222
1224
|
disconnectedCallback() {
|
|
1223
|
-
|
|
1225
|
+
A.log("NineTable disconnected.");
|
|
1224
1226
|
}
|
|
1225
1227
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1226
1228
|
get data() {
|