@ninebone/table 0.0.295 β 0.0.297
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 +80 -72
- 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
|
@@ -23,7 +23,7 @@ const Vt = class Vt extends ne.constructor {
|
|
|
23
23
|
c(Vt, "Trace");
|
|
24
24
|
let Mt = Vt;
|
|
25
25
|
const _ = new Mt();
|
|
26
|
-
var H, I, p, D, P, B,
|
|
26
|
+
var H, I, p, D, P, B, at, N, ht;
|
|
27
27
|
const Yt = class Yt extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
@@ -33,7 +33,7 @@ const Yt = class Yt extends HTMLElement {
|
|
|
33
33
|
h(this, D);
|
|
34
34
|
h(this, P);
|
|
35
35
|
h(this, B);
|
|
36
|
-
h(this,
|
|
36
|
+
h(this, at, /* @__PURE__ */ c(() => {
|
|
37
37
|
if (!t(this, H)) return;
|
|
38
38
|
const e = t(this, H).querySelector(".ng-container-body");
|
|
39
39
|
e && (b(this, B, new ResizeObserver(() => {
|
|
@@ -73,7 +73,7 @@ const Yt = class Yt extends HTMLElement {
|
|
|
73
73
|
const d = s.clientWidth, f = n.scrollWidth - d;
|
|
74
74
|
return a > 0 && f > 0 && (s.scrollLeft = l / a * f), l > 0 && l < a - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
|
-
h(this,
|
|
76
|
+
h(this, ht, /* @__PURE__ */ c(() => {
|
|
77
77
|
const e = /* @__PURE__ */ c((n) => {
|
|
78
78
|
clearInterval(t(this, D)), clearInterval(t(this, P));
|
|
79
79
|
const o = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
@@ -190,7 +190,7 @@ const Yt = class Yt extends HTMLElement {
|
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), s.addEventListener("scroll", () => {
|
|
192
192
|
t(this, I) || this.refresh();
|
|
193
|
-
}), t(this,
|
|
193
|
+
}), t(this, ht).call(this), t(this, at).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
196
196
|
}
|
|
@@ -198,10 +198,10 @@ const Yt = class Yt extends HTMLElement {
|
|
|
198
198
|
t(this, B) && t(this, B).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
H = new WeakMap(), I = new WeakMap(), p = new WeakMap(), D = new WeakMap(), P = new WeakMap(), B = new WeakMap(),
|
|
201
|
+
H = new WeakMap(), I = new WeakMap(), p = new WeakMap(), D = new WeakMap(), P = new WeakMap(), B = new WeakMap(), at = new WeakMap(), N = new WeakMap(), ht = new WeakMap(), c(Yt, "NineTableHScrollBar");
|
|
202
202
|
let _t = Yt;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", _t);
|
|
204
|
-
var V, $, E, Q, tt,
|
|
204
|
+
var V, $, E, Q, tt, dt;
|
|
205
205
|
const Xt = class Xt extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
@@ -233,7 +233,7 @@ const Xt = class Xt extends HTMLElement {
|
|
|
233
233
|
const y = a - d;
|
|
234
234
|
g < 0 && (g = 0), g > y && (g = y), o.style.top = `${g}px`, t(this, E).top.disabled = u <= 0, t(this, E).bottom.disabled = u >= f - 1;
|
|
235
235
|
}, "refresh"));
|
|
236
|
-
h(this,
|
|
236
|
+
h(this, dt, /* @__PURE__ */ c(() => {
|
|
237
237
|
const e = t(this, E).container;
|
|
238
238
|
e.addEventListener("scroll", () => {
|
|
239
239
|
t(this, $) || this.refresh();
|
|
@@ -344,15 +344,15 @@ const Xt = class Xt extends HTMLElement {
|
|
|
344
344
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
345
345
|
top: this.querySelector(".ng-scroll-top"),
|
|
346
346
|
bottom: this.querySelector(".ng-scroll-bottom")
|
|
347
|
-
}), t(this,
|
|
347
|
+
}), t(this, dt).call(this), this.refresh();
|
|
348
348
|
}, "initWhenReady");
|
|
349
349
|
e();
|
|
350
350
|
}
|
|
351
351
|
};
|
|
352
|
-
V = new WeakMap(), $ = new WeakMap(), E = new WeakMap(), Q = new WeakMap(), tt = new WeakMap(),
|
|
352
|
+
V = new WeakMap(), $ = new WeakMap(), E = new WeakMap(), Q = new WeakMap(), tt = new WeakMap(), dt = new WeakMap(), c(Xt, "NineTableVScrollBar");
|
|
353
353
|
let It = Xt;
|
|
354
354
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", It);
|
|
355
|
-
var
|
|
355
|
+
var ft, et;
|
|
356
356
|
const C = class C {
|
|
357
357
|
/**
|
|
358
358
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
@@ -367,7 +367,7 @@ const C = class C {
|
|
|
367
367
|
var n, o, r;
|
|
368
368
|
if (!i) return null;
|
|
369
369
|
const e = i.cloneNode(!0);
|
|
370
|
-
return t(n = C,
|
|
370
|
+
return t(n = C, ft).call(n, e), t(o = C, et).call(o, e, "thead"), t(r = C, et).call(r, e, "tbody"), Array.from(e.querySelectorAll("colgroup col")).forEach((l, a) => {
|
|
371
371
|
const d = l.getAttribute("fixed");
|
|
372
372
|
d && e.querySelectorAll(`[data-col="${a}"]`).forEach((u) => {
|
|
373
373
|
u.setAttribute("fixed", d);
|
|
@@ -375,7 +375,7 @@ const C = class C {
|
|
|
375
375
|
}), e;
|
|
376
376
|
}
|
|
377
377
|
};
|
|
378
|
-
|
|
378
|
+
ft = new WeakMap(), et = new WeakMap(), c(C, "TableCompiler"), h(C, ft, /* @__PURE__ */ c((i) => {
|
|
379
379
|
if (!i.querySelector("colgroup")) {
|
|
380
380
|
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"), o = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
381
381
|
for (let r = 0; r < s; r++) {
|
|
@@ -423,23 +423,31 @@ dt = new WeakMap(), et = new WeakMap(), c(C, "TableCompiler"), h(C, dt, /* @__PU
|
|
|
423
423
|
});
|
|
424
424
|
}, "#resetColIndex"));
|
|
425
425
|
let $t = C;
|
|
426
|
-
var
|
|
426
|
+
var x, M, R, W, Y, X, ut, gt, bt, it, pt, yt, st, nt, mt;
|
|
427
427
|
const Ut = class Ut {
|
|
428
428
|
constructor(i) {
|
|
429
|
-
h(this,
|
|
429
|
+
h(this, x);
|
|
430
430
|
h(this, M, /* @__PURE__ */ new Map());
|
|
431
431
|
// κ° μ»¨ν
μ΄λλ³ λ
립λ ν
νλ¦Ώ TR κ΄λ¦¬
|
|
432
432
|
h(this, R, null);
|
|
433
433
|
h(this, W, null);
|
|
434
434
|
h(this, Y, 0);
|
|
435
435
|
h(this, X, 40);
|
|
436
|
+
/**
|
|
437
|
+
* π― μΈλΆμμ λ°μ΄ν°κ° λ‘λλκ±°λ λ³κ²½λ ν κ°μ λμ΄μ λ·°λ₯Ό μ¬κ°±μ νλ νΌλΈλ¦ λ©μλ
|
|
438
|
+
*/
|
|
439
|
+
S(this, "refresh", /* @__PURE__ */ c(() => {
|
|
440
|
+
var e;
|
|
441
|
+
const i = t(this, x).querySelector(".ng-container-body");
|
|
442
|
+
i && (t(this, bt).call(this), t(this, nt).call(this, i.scrollTop), (e = t(this, x).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
443
|
+
}, "refresh"));
|
|
436
444
|
/**
|
|
437
445
|
* π― NineTableSheetμμ λ§μ€ν° ν
μ΄λΈμ μ λ¬λ°μ κ° μμλ³ ν
μ΄λΈ μμ± λ° ν
νλ¦Ώ μΆμΆ μΌμν
|
|
438
446
|
*/
|
|
439
447
|
// [RowManager.js μμ λ΄μ© λ°μ·]
|
|
440
448
|
S(this, "initialize", /* @__PURE__ */ c(() => {
|
|
441
449
|
b(this, R, null), t(this, M).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
442
|
-
const s = t(this,
|
|
450
|
+
const s = t(this, x).querySelector(e);
|
|
443
451
|
if (!s) return;
|
|
444
452
|
const n = s.querySelector("table");
|
|
445
453
|
if (!n) return;
|
|
@@ -448,18 +456,18 @@ const Ut = class Ut {
|
|
|
448
456
|
const l = Array.from(o.querySelectorAll("tr")).map((a) => a.cloneNode(!0));
|
|
449
457
|
t(this, M).set(e, l);
|
|
450
458
|
});
|
|
451
|
-
const i = t(this,
|
|
459
|
+
const i = t(this, x).querySelector(".ng-container-body");
|
|
452
460
|
if (i) {
|
|
453
|
-
t(this,
|
|
461
|
+
t(this, gt).call(this, i), t(this, st).call(this);
|
|
454
462
|
let e = i.scrollTop;
|
|
455
463
|
i.addEventListener("scroll", () => {
|
|
456
464
|
var n;
|
|
457
465
|
const s = i.scrollTop;
|
|
458
|
-
_.log(e, s), e !== s && (e = s, t(this,
|
|
466
|
+
_.log(e, s), e !== s && (e = s, t(this, nt).call(this, s)), (n = t(this, x).querySelector("nine-table-vscrollbar")) == null || n.refresh();
|
|
459
467
|
});
|
|
460
468
|
}
|
|
461
469
|
}, "initialize"));
|
|
462
|
-
h(this,
|
|
470
|
+
h(this, ut, /* @__PURE__ */ c((i, e) => {
|
|
463
471
|
const s = t(this, M).get(e);
|
|
464
472
|
if (!s || s.length === 0) return;
|
|
465
473
|
const n = i.querySelector("tbody");
|
|
@@ -475,7 +483,7 @@ const Ut = class Ut {
|
|
|
475
483
|
/**
|
|
476
484
|
* π― ν
νλ¦Ώ TRλ€μ μ΄ λμ΄λ₯Ό μΈ‘μ νκ³ μΊμ±
|
|
477
485
|
*/
|
|
478
|
-
h(this,
|
|
486
|
+
h(this, gt, /* @__PURE__ */ c((i) => {
|
|
479
487
|
if (t(this, R) !== null && t(this, R) > 0)
|
|
480
488
|
return t(this, R);
|
|
481
489
|
const e = t(this, M).get(".ng-container-body");
|
|
@@ -487,7 +495,7 @@ const Ut = class Ut {
|
|
|
487
495
|
e.forEach((g) => {
|
|
488
496
|
o.appendChild(g.cloneNode(!0));
|
|
489
497
|
}), n ? n.before(o) : s.appendChild(o);
|
|
490
|
-
const r = t(this,
|
|
498
|
+
const r = t(this, x), l = r.style.display, a = r.style.visibility, d = r.style.position;
|
|
491
499
|
(l === "none" || window.getComputedStyle(r).display === "none") && (r.style.display = "block", r.style.visibility = "hidden", r.style.position = "absolute");
|
|
492
500
|
let u = 0;
|
|
493
501
|
const f = s.querySelectorAll("tr:not(.nodata)");
|
|
@@ -501,12 +509,12 @@ const Ut = class Ut {
|
|
|
501
509
|
/**
|
|
502
510
|
* π― μ 체 λ°μ΄ν° κ°μ κΈ°λ°μΌλ‘ κ°μ μ€ν¬λ‘€ λμ΄ μ€μ
|
|
503
511
|
*/
|
|
504
|
-
h(this,
|
|
512
|
+
h(this, bt, /* @__PURE__ */ c(() => {
|
|
505
513
|
var o, r, l, a;
|
|
506
|
-
if (!t(this,
|
|
507
|
-
const e = (typeof ((o = t(this,
|
|
514
|
+
if (!t(this, x).querySelector(".ng-container-body")) return;
|
|
515
|
+
const e = (typeof ((o = t(this, x).data) == null ? void 0 : o.count) == "function" ? t(this, x).data.count() : null) ?? ((l = (r = t(this, x).dataManager) == null ? void 0 : r.rawRecords) == null ? void 0 : l.length) ?? ((a = t(this, x).data) == null ? void 0 : a.length) ?? 0, s = t(this, R) || 24, n = e * s;
|
|
508
516
|
_.log(`[RowManager] TotalCount: ${e} | RowHeight: ${s}px | TotalVirtualHeight: ${n}px`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((d) => {
|
|
509
|
-
const u = t(this,
|
|
517
|
+
const u = t(this, x).querySelector(d), f = u == null ? void 0 : u.querySelector("table");
|
|
510
518
|
f ? (f.style.height = `${n}px`, _.log(`[RowManager] Applied height to ${d} table:`, f.style.height)) : _.log(`[RowManager] Table not found for selector: ${d}`);
|
|
511
519
|
});
|
|
512
520
|
}, "#updateVirtualScrollHeight"));
|
|
@@ -517,9 +525,9 @@ const Ut = class Ut {
|
|
|
517
525
|
} else
|
|
518
526
|
b(this, X, 40);
|
|
519
527
|
}, "#updateRowCount"));
|
|
520
|
-
h(this,
|
|
528
|
+
h(this, pt, /* @__PURE__ */ c(() => {
|
|
521
529
|
var a, d, u;
|
|
522
|
-
const i = t(this,
|
|
530
|
+
const i = t(this, x).querySelector(".ng-container-left table"), e = t(this, x).querySelector(".ng-container-body table"), s = t(this, x).querySelector(".ng-container-right table");
|
|
523
531
|
if (!e) return;
|
|
524
532
|
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);
|
|
525
533
|
for (let f = 0; f < l; f++) {
|
|
@@ -534,8 +542,8 @@ const Ut = class Ut {
|
|
|
534
542
|
/**
|
|
535
543
|
* π― ResizeObserver μ€μ : μνΈ ν¬κΈ° λ³κ²½ μ ν κ°μ μ¬μ°μ λ° μ¬λ λλ§
|
|
536
544
|
*/
|
|
537
|
-
h(this,
|
|
538
|
-
!t(this,
|
|
545
|
+
h(this, yt, /* @__PURE__ */ c(() => {
|
|
546
|
+
!t(this, x) || !(t(this, x) instanceof HTMLElement) || (b(this, W, new ResizeObserver((i) => {
|
|
539
547
|
for (const e of i) {
|
|
540
548
|
const s = e.target;
|
|
541
549
|
if (!s.classList.contains("active")) continue;
|
|
@@ -548,32 +556,32 @@ const Ut = class Ut {
|
|
|
548
556
|
t(this, Y) !== l && (b(this, Y, l), t(this, it).call(this), t(this, R) !== null && t(this, st).call(this));
|
|
549
557
|
}
|
|
550
558
|
}
|
|
551
|
-
})), t(this, W).observe(t(this,
|
|
559
|
+
})), t(this, W).observe(t(this, x)));
|
|
552
560
|
}, "#initResizeObserver"));
|
|
553
561
|
/**
|
|
554
562
|
* π― λ°λ λ° μ’μ° κ³ μ 컨ν
μ΄λ μ 체μ κ°κ°μ λ§λ ν
νλ¦Ώ ν λΌλ μ£Όμ
|
|
555
563
|
*/
|
|
556
564
|
h(this, st, /* @__PURE__ */ c(() => {
|
|
557
565
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
558
|
-
const e = t(this,
|
|
559
|
-
e && e.querySelector("tbody") && t(this,
|
|
560
|
-
}), t(this,
|
|
566
|
+
const e = t(this, x).querySelector(i);
|
|
567
|
+
e && e.querySelector("tbody") && t(this, ut).call(this, e, i);
|
|
568
|
+
}), t(this, pt).call(this);
|
|
561
569
|
}, "#renderAllContainers"));
|
|
562
570
|
/**
|
|
563
571
|
* π― μ€ν¬λ‘€ μμΉμ λ°λ₯Έ λ°μ΄ν° λ°μΈλ© κ°±μ
|
|
564
572
|
*/
|
|
565
|
-
h(this,
|
|
573
|
+
h(this, nt, /* @__PURE__ */ c((i) => {
|
|
566
574
|
var r;
|
|
567
575
|
const e = t(this, R);
|
|
568
576
|
if (!e || e <= 0) return;
|
|
569
577
|
const s = ((r = t(this, M).get(".ng-container-body")) == null ? void 0 : r.length) || 1, n = Math.floor(i / e), o = Math.max(0, n);
|
|
570
578
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((l) => {
|
|
571
|
-
const a = t(this,
|
|
579
|
+
const a = t(this, x).querySelector(l);
|
|
572
580
|
if (!a) return;
|
|
573
581
|
const d = a.querySelector("tbody");
|
|
574
582
|
if (!d) return;
|
|
575
583
|
Array.from(d.querySelectorAll("tr:not(.nodata)")).forEach((f, g) => {
|
|
576
|
-
const y = o + Math.floor(g / s), w = t(this,
|
|
584
|
+
const y = o + Math.floor(g / s), w = t(this, x).getData ? t(this, x).getData(y) : null;
|
|
577
585
|
w ? (f.style.display = "", t(this, mt).call(this, f, w, y)) : f.style.display = "none";
|
|
578
586
|
});
|
|
579
587
|
});
|
|
@@ -590,7 +598,7 @@ const Ut = class Ut {
|
|
|
590
598
|
S(this, "destroy", /* @__PURE__ */ c(() => {
|
|
591
599
|
t(this, W) && (t(this, W).disconnect(), b(this, W, null));
|
|
592
600
|
}, "destroy"));
|
|
593
|
-
b(this,
|
|
601
|
+
b(this, x, i), t(this, yt).call(this);
|
|
594
602
|
}
|
|
595
603
|
getRowHeight() {
|
|
596
604
|
return t(this, R);
|
|
@@ -600,7 +608,7 @@ const Ut = class Ut {
|
|
|
600
608
|
return ((e = t(this, M).get(i)) == null ? void 0 : e.length) || 1;
|
|
601
609
|
}
|
|
602
610
|
};
|
|
603
|
-
|
|
611
|
+
x = new WeakMap(), M = new WeakMap(), R = new WeakMap(), W = new WeakMap(), Y = new WeakMap(), X = new WeakMap(), ut = new WeakMap(), gt = new WeakMap(), bt = new WeakMap(), it = new WeakMap(), pt = new WeakMap(), yt = new WeakMap(), st = new WeakMap(), nt = new WeakMap(), mt = new WeakMap(), c(Ut, "RowManager");
|
|
604
612
|
let Wt = Ut;
|
|
605
613
|
var F, Z, xt, vt, wt, St, Et;
|
|
606
614
|
const J = class J extends HTMLElement {
|
|
@@ -642,9 +650,9 @@ const J = class J extends HTMLElement {
|
|
|
642
650
|
*/
|
|
643
651
|
h(this, wt, /* @__PURE__ */ c((e, s) => {
|
|
644
652
|
const n = e.cloneNode(!0);
|
|
645
|
-
return s === "left" ? n.querySelectorAll("col, th, td").forEach((o) => {
|
|
653
|
+
return s === "left" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((o) => {
|
|
646
654
|
o.getAttribute("fixed") !== "left" && o.remove();
|
|
647
|
-
}) : s === "right" ? n.querySelectorAll("col, th, td").forEach((o) => {
|
|
655
|
+
}) : s === "right" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((o) => {
|
|
648
656
|
o.getAttribute("fixed") !== "right" && o.remove();
|
|
649
657
|
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((o) => {
|
|
650
658
|
o.remove();
|
|
@@ -796,9 +804,9 @@ const J = class J extends HTMLElement {
|
|
|
796
804
|
}
|
|
797
805
|
};
|
|
798
806
|
F = new WeakMap(), Z = new WeakMap(), xt = new WeakMap(), vt = new WeakMap(), wt = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), c(J, "NineTableSheet"), S(J, "SCROLLBAR_SIZE", 16);
|
|
799
|
-
let
|
|
800
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
801
|
-
var Rt,
|
|
807
|
+
let ct = J;
|
|
808
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ct);
|
|
809
|
+
var Rt, ot;
|
|
802
810
|
const Kt = class Kt extends HTMLElement {
|
|
803
811
|
constructor() {
|
|
804
812
|
super();
|
|
@@ -807,10 +815,10 @@ const Kt = class Kt extends HTMLElement {
|
|
|
807
815
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
808
816
|
var r;
|
|
809
817
|
const n = s.ctrlKey || s.metaKey || s.shiftKey, o = parseInt((r = s.target.closest(".nine-tab-item")) == null ? void 0 : r.dataset.index, 10);
|
|
810
|
-
t(this,
|
|
811
|
-
}), t(this,
|
|
818
|
+
t(this, ot).call(this, o, n);
|
|
819
|
+
}), t(this, ot).call(this, 0, !1);
|
|
812
820
|
}, "#init"));
|
|
813
|
-
h(this,
|
|
821
|
+
h(this, ot, /* @__PURE__ */ c((e, s = !1) => {
|
|
814
822
|
const n = /* @__PURE__ */ c(() => {
|
|
815
823
|
const u = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
816
824
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((y) => y.style.setProperty("display", "none"));
|
|
@@ -846,24 +854,24 @@ const Kt = class Kt extends HTMLElement {
|
|
|
846
854
|
t(this, Rt).call(this);
|
|
847
855
|
}
|
|
848
856
|
};
|
|
849
|
-
Rt = new WeakMap(),
|
|
857
|
+
Rt = new WeakMap(), ot = new WeakMap(), c(Kt, "NineTableSheets");
|
|
850
858
|
let Ot = Kt;
|
|
851
859
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Ot);
|
|
852
|
-
var T, Tt,
|
|
860
|
+
var T, Tt, rt, At;
|
|
853
861
|
const Ft = class Ft {
|
|
854
862
|
constructor(i) {
|
|
855
863
|
h(this, T);
|
|
856
864
|
h(this, Tt, /* @__PURE__ */ c(() => {
|
|
857
865
|
t(this, At).call(this), new ResizeObserver((i) => {
|
|
858
866
|
for (let e of i)
|
|
859
|
-
t(this, T).getAttribute("auto-height") === "true" && t(this,
|
|
867
|
+
t(this, T).getAttribute("auto-height") === "true" && t(this, rt).call(this);
|
|
860
868
|
}).observe(t(this, T));
|
|
861
869
|
}, "#init"));
|
|
862
|
-
h(this,
|
|
870
|
+
h(this, rt, /* @__PURE__ */ c(() => {
|
|
863
871
|
var a, d;
|
|
864
872
|
const i = Array.from(t(this, T).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
865
873
|
if (i.length === 0) return;
|
|
866
|
-
const e = parseInt(t(this, T).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((u) => u.getRowHeight())), n = (a = t(this, T).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : a.getBoundingClientRect().height, o = (d = t(this, T).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : d.getBoundingClientRect().height, r =
|
|
874
|
+
const e = parseInt(t(this, T).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((u) => u.getRowHeight())), n = (a = t(this, T).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : a.getBoundingClientRect().height, o = (d = t(this, T).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : d.getBoundingClientRect().height, r = ct.SCROLLBAR_SIZE, l = e * s + n + o + r;
|
|
867
875
|
t(this, T).style.height = `${l}px`;
|
|
868
876
|
}, "#applyAutoHeight"));
|
|
869
877
|
h(this, At, /* @__PURE__ */ c(() => {
|
|
@@ -973,14 +981,14 @@ const Ft = class Ft {
|
|
|
973
981
|
const l = t(this, T).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
974
982
|
l == null || l.forEach((a, d) => {
|
|
975
983
|
e[d] && setTimeout(() => {
|
|
976
|
-
a.generate(e[d]), s && t(this,
|
|
984
|
+
a.generate(e[d]), s && t(this, rt).call(this);
|
|
977
985
|
});
|
|
978
986
|
});
|
|
979
987
|
}, "#render"));
|
|
980
988
|
b(this, T, i), t(this, Tt).call(this);
|
|
981
989
|
}
|
|
982
990
|
};
|
|
983
|
-
T = new WeakMap(), Tt = new WeakMap(),
|
|
991
|
+
T = new WeakMap(), Tt = new WeakMap(), rt = new WeakMap(), At = new WeakMap(), c(Ft, "LayoutManager");
|
|
984
992
|
let zt = Ft;
|
|
985
993
|
var O, U;
|
|
986
994
|
const Zt = class Zt {
|
|
@@ -1005,11 +1013,11 @@ const Zt = class Zt {
|
|
|
1005
1013
|
};
|
|
1006
1014
|
O = new WeakMap(), U = new WeakMap(), c(Zt, "ngRow");
|
|
1007
1015
|
let Dt = Zt;
|
|
1008
|
-
var A,
|
|
1016
|
+
var A, v, k, j, kt, z, qt, lt, Lt, Ht, G;
|
|
1009
1017
|
const q = class q {
|
|
1010
1018
|
constructor(i, e) {
|
|
1011
1019
|
h(this, A);
|
|
1012
|
-
h(this,
|
|
1020
|
+
h(this, v);
|
|
1013
1021
|
h(this, k, []);
|
|
1014
1022
|
h(this, j, []);
|
|
1015
1023
|
h(this, kt, 0);
|
|
@@ -1020,14 +1028,14 @@ const q = class q {
|
|
|
1020
1028
|
Array.from(i).forEach((e) => {
|
|
1021
1029
|
var s;
|
|
1022
1030
|
t(this, z).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1023
|
-
}), (t(this,
|
|
1024
|
-
e.__ng || (e.__ng = t(this,
|
|
1031
|
+
}), (t(this, v).rawRecords || []).forEach((e) => {
|
|
1032
|
+
e.__ng || (e.__ng = t(this, lt).call(this)), e.__ng.height = t(this, z).slice();
|
|
1025
1033
|
});
|
|
1026
1034
|
}, "#initialize"));
|
|
1027
1035
|
S(this, "set", /* @__PURE__ */ c((i) => {
|
|
1028
1036
|
this.clear(), this.add(i, !1);
|
|
1029
1037
|
}, "set"));
|
|
1030
|
-
h(this,
|
|
1038
|
+
h(this, lt, /* @__PURE__ */ c(() => ({
|
|
1031
1039
|
rowState: q.ROW_STATE.EMPTY,
|
|
1032
1040
|
deleted: !1,
|
|
1033
1041
|
filtered: !1,
|
|
@@ -1041,7 +1049,7 @@ const q = class q {
|
|
|
1041
1049
|
}, "reset"));
|
|
1042
1050
|
S(this, "clear", /* @__PURE__ */ c(() => {
|
|
1043
1051
|
var i;
|
|
1044
|
-
t(this,
|
|
1052
|
+
t(this, v).rawRecords = [], b(this, k, []), b(this, j, []), (i = t(this, v).viewRecords) != null && i.reset && t(this, v).viewRecords.reset();
|
|
1045
1053
|
}, "clear"));
|
|
1046
1054
|
h(this, Lt, /* @__PURE__ */ c((i) => {
|
|
1047
1055
|
var n;
|
|
@@ -1055,30 +1063,30 @@ const q = class q {
|
|
|
1055
1063
|
}), s;
|
|
1056
1064
|
}, "#json2Array"));
|
|
1057
1065
|
h(this, Ht, /* @__PURE__ */ c((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1058
|
-
e.__ng = t(this,
|
|
1066
|
+
e.__ng = t(this, lt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = q.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1059
1067
|
}), i), "#defaultInsert"));
|
|
1060
1068
|
S(this, "add", /* @__PURE__ */ c((i, e = !0) => {
|
|
1061
1069
|
var o;
|
|
1062
1070
|
i === void 0 && (i = {});
|
|
1063
1071
|
const s = t(this, Lt).call(this, i);
|
|
1064
|
-
t(this,
|
|
1072
|
+
t(this, v).rawRecords = t(this, v).rawRecords.concat(t(this, Ht).call(this, s)), this.resetRecords();
|
|
1065
1073
|
const n = this.count() - 1;
|
|
1066
1074
|
return e || s.forEach((r, l) => {
|
|
1067
|
-
const a = t(this,
|
|
1075
|
+
const a = t(this, v).rawRecords[n - l];
|
|
1068
1076
|
a && (a.__ng.rowState = q.ROW_STATE.EMPTY);
|
|
1069
|
-
}), (o = t(this,
|
|
1077
|
+
}), (o = t(this, v).viewRecords) != null && o.reset && t(this, v).viewRecords.reset(), n;
|
|
1070
1078
|
}, "add"));
|
|
1071
1079
|
S(this, "delete", /* @__PURE__ */ c((i) => {
|
|
1072
1080
|
var s;
|
|
1073
1081
|
let e = [];
|
|
1074
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this,
|
|
1082
|
+
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) => {
|
|
1075
1083
|
if (t(this, k)[n]) {
|
|
1076
1084
|
const o = t(this, k)[n].__ng.rowid;
|
|
1077
|
-
t(this, k)[n].__ng.rowState === q.ROW_STATE.INSERT ? t(this,
|
|
1085
|
+
t(this, k)[n].__ng.rowState === q.ROW_STATE.INSERT ? t(this, v).rawRecords = t(this, v).rawRecords.filter((r) => r.__ng.rowid !== o) : t(this, v).rawRecords.forEach((r) => {
|
|
1078
1086
|
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = q.ROW_STATE.DELETE);
|
|
1079
1087
|
});
|
|
1080
1088
|
}
|
|
1081
|
-
}), this.resetRecords(), (s = t(this,
|
|
1089
|
+
}), this.resetRecords(), (s = t(this, v).viewRecords) != null && s.reset && t(this, v).viewRecords.reset();
|
|
1082
1090
|
}, "delete"));
|
|
1083
1091
|
S(this, "setValue", /* @__PURE__ */ c((i, e, s) => {
|
|
1084
1092
|
var a;
|
|
@@ -1088,16 +1096,16 @@ const q = class q {
|
|
|
1088
1096
|
const r = this.getValidData()[i];
|
|
1089
1097
|
if (!r) return;
|
|
1090
1098
|
const l = r.v[o];
|
|
1091
|
-
l !== s && r.__ng.rowState !== q.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(e) || (r.__ng.o[e] = l), r.__ng.rowState = q.ROW_STATE.UPDATE), r.v[o] = s, t(this,
|
|
1099
|
+
l !== s && r.__ng.rowState !== q.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(e) || (r.__ng.o[e] = l), r.__ng.rowState = q.ROW_STATE.UPDATE), r.v[o] = s, t(this, v).owner.refreshData && t(this, v).owner.refreshData(i);
|
|
1092
1100
|
}, "setValue"));
|
|
1093
1101
|
S(this, "resetRecords", /* @__PURE__ */ c(() => {
|
|
1094
|
-
b(this, j, t(this,
|
|
1102
|
+
b(this, j, t(this, v).rawRecords.filter((i) => !i.__ng.deleted)), b(this, k, t(this, v).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, v).rawRecords.forEach((i, e) => {
|
|
1095
1103
|
i.__ng.rowidx = e;
|
|
1096
1104
|
}), t(this, k).forEach((i, e) => {
|
|
1097
1105
|
i.__ng.i = e;
|
|
1098
1106
|
});
|
|
1099
1107
|
}, "resetRecords"));
|
|
1100
|
-
S(this, "getValidData", /* @__PURE__ */ c(() => (t(this, k).length === 0 && t(this,
|
|
1108
|
+
S(this, "getValidData", /* @__PURE__ */ c(() => (t(this, k).length === 0 && t(this, v).rawRecords.length > 0 && this.resetRecords(), t(this, k)), "getValidData"));
|
|
1101
1109
|
h(this, G, /* @__PURE__ */ c((i) => {
|
|
1102
1110
|
var s;
|
|
1103
1111
|
if (!i) return i;
|
|
@@ -1123,10 +1131,10 @@ const q = class q {
|
|
|
1123
1131
|
}
|
|
1124
1132
|
return t(this, G).call(this, s[i]);
|
|
1125
1133
|
}, "get"));
|
|
1126
|
-
b(this, A, i), b(this,
|
|
1134
|
+
b(this, A, i), b(this, v, e), t(this, qt).call(this);
|
|
1127
1135
|
}
|
|
1128
1136
|
get source() {
|
|
1129
|
-
return t(this, G).call(this, t(this,
|
|
1137
|
+
return t(this, G).call(this, t(this, v).rawRecords);
|
|
1130
1138
|
}
|
|
1131
1139
|
set source(i) {
|
|
1132
1140
|
this.clear(), this.add(i, !1);
|
|
@@ -1141,7 +1149,7 @@ const q = class q {
|
|
|
1141
1149
|
return this.length;
|
|
1142
1150
|
}
|
|
1143
1151
|
};
|
|
1144
|
-
A = new WeakMap(),
|
|
1152
|
+
A = new WeakMap(), v = new WeakMap(), k = new WeakMap(), j = new WeakMap(), kt = new WeakMap(), z = new WeakMap(), qt = new WeakMap(), lt = new WeakMap(), Lt = new WeakMap(), Ht = new WeakMap(), G = new WeakMap(), c(q, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1145
1153
|
S(q, "ROW_STATE", {
|
|
1146
1154
|
EMPTY: "EMPTY",
|
|
1147
1155
|
NORMAL: "NORMAL",
|