@ninebone/table 0.0.519 β 0.0.520
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 +77 -74
- 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 Le = class Le extends Xe.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
h(Le, "Trace");
|
|
24
24
|
let oe = Le;
|
|
25
|
-
const
|
|
25
|
+
const H = new oe();
|
|
26
26
|
var z, j, w, X, K, Z, It, G, _t;
|
|
27
27
|
const He = class He extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -213,7 +213,7 @@ const Me = class Me extends HTMLElement {
|
|
|
213
213
|
d(this, vt, 0);
|
|
214
214
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
215
215
|
if (!t(this, F) || !t(this, q)) return;
|
|
216
|
-
|
|
216
|
+
H.log("nine-table-vscrollbar.refresh");
|
|
217
217
|
const e = t(this, q).container, s = t(this, q).track, r = t(this, q).thumb, n = e.clientHeight, a = (t(this, F).data.get() || []).length, c = t(this, ot).getRowHeight(), l = a * c;
|
|
218
218
|
if (l <= n) {
|
|
219
219
|
r.style.display = "none", t(this, q).top.disabled = !0, t(this, q).bottom.disabled = !0;
|
|
@@ -231,7 +231,7 @@ const Me = class Me extends HTMLElement {
|
|
|
231
231
|
m < 0 && (m = 0), m > v && (m = v), r.style.top = `${m}px`, t(this, q).top.disabled = b <= 0, t(this, q).bottom.disabled = b >= g - 1;
|
|
232
232
|
}, "refresh"));
|
|
233
233
|
d(this, Nt, /* @__PURE__ */ h(() => {
|
|
234
|
-
|
|
234
|
+
H.log("nine-table-vscrollbar.#init");
|
|
235
235
|
const e = t(this, q).container, s = /* @__PURE__ */ h(() => {
|
|
236
236
|
const n = (t(this, F).data.get() || []).length, o = t(this, ot).getRowHeight();
|
|
237
237
|
return n * o;
|
|
@@ -247,8 +247,8 @@ const Me = class Me extends HTMLElement {
|
|
|
247
247
|
if (u > 0 && v > 0) {
|
|
248
248
|
const E = b / u * v;
|
|
249
249
|
let x = t(this, vt) + E;
|
|
250
|
-
const
|
|
251
|
-
x < 0 && (x = 0), x >
|
|
250
|
+
const M = Math.max(0, m - g);
|
|
251
|
+
x < 0 && (x = 0), x > M && (x = M), e.scrollTop = x;
|
|
252
252
|
}
|
|
253
253
|
this.refresh();
|
|
254
254
|
}, "onMouseMove"), o = /* @__PURE__ */ h(() => {
|
|
@@ -355,13 +355,13 @@ const Me = class Me extends HTMLElement {
|
|
|
355
355
|
F = new WeakMap(), ot = new WeakMap(), J = new WeakMap(), q = new WeakMap(), xt = new WeakMap(), vt = new WeakMap(), Nt = new WeakMap(), h(Me, "NineTableVScrollBar");
|
|
356
356
|
let le = Me;
|
|
357
357
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", le);
|
|
358
|
-
var P, S, D,
|
|
358
|
+
var P, S, D, I, V, Q, wt, Se, at, Wt, Ot, Bt, St, Et, zt, Dt, At, Ee, lt, Rt, Pt;
|
|
359
359
|
const $e = class $e {
|
|
360
360
|
constructor(i) {
|
|
361
361
|
d(this, P);
|
|
362
362
|
d(this, S);
|
|
363
363
|
d(this, D, /* @__PURE__ */ new Map());
|
|
364
|
-
d(this,
|
|
364
|
+
d(this, I, null);
|
|
365
365
|
d(this, V, null);
|
|
366
366
|
d(this, Q, 0);
|
|
367
367
|
d(this, wt, 40);
|
|
@@ -369,12 +369,12 @@ const $e = class $e {
|
|
|
369
369
|
d(this, at, !1);
|
|
370
370
|
d(this, Wt, 3);
|
|
371
371
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
372
|
-
|
|
372
|
+
H.log("rowManager.refresh");
|
|
373
373
|
const i = t(this, S).querySelector(".ng-container-body .ng-part-body");
|
|
374
374
|
i && (t(this, St).call(this), t(this, lt).call(this, i.scrollTop));
|
|
375
375
|
}, "refresh"));
|
|
376
376
|
A(this, "initialize", /* @__PURE__ */ h(() => {
|
|
377
|
-
|
|
377
|
+
H.log("rowManager.initialize"), y(this, I, null), t(this, D).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
378
378
|
const a = t(this, S).querySelector(o);
|
|
379
379
|
if (!a) return;
|
|
380
380
|
const c = a.querySelector(".ng-part-body table");
|
|
@@ -402,6 +402,7 @@ const $e = class $e {
|
|
|
402
402
|
}
|
|
403
403
|
}, "initialize"));
|
|
404
404
|
d(this, Ot, /* @__PURE__ */ h((i, e) => {
|
|
405
|
+
H.log("rowManager.#renderRows");
|
|
405
406
|
const s = t(this, D).get(e);
|
|
406
407
|
if (!s || s.length === 0) return;
|
|
407
408
|
const r = i.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -415,9 +416,9 @@ const $e = class $e {
|
|
|
415
416
|
n ? n.before(o) : r.appendChild(o);
|
|
416
417
|
}, "#renderRows"));
|
|
417
418
|
d(this, Bt, /* @__PURE__ */ h((i) => {
|
|
418
|
-
if (t(this,
|
|
419
|
-
return t(this,
|
|
420
|
-
|
|
419
|
+
if (H.log("rowManager.#measureAndCacheHeight"), t(this, I) !== null && t(this, I) > 0)
|
|
420
|
+
return t(this, I);
|
|
421
|
+
H.log("#measureAndCacheHeight");
|
|
421
422
|
const e = t(this, D).get(".ng-container-body");
|
|
422
423
|
if (!e || e.length === 0) return 24;
|
|
423
424
|
const s = i.querySelector("tbody.bindable-tbody");
|
|
@@ -433,10 +434,11 @@ const $e = class $e {
|
|
|
433
434
|
const u = s.querySelectorAll("tr:not(.nodata)");
|
|
434
435
|
return u.forEach((b) => {
|
|
435
436
|
f += b.offsetHeight || b.getBoundingClientRect().height;
|
|
436
|
-
}), u.forEach((b) => b.remove()), o.style.display = a, o.style.visibility = c, o.style.position = l, y(this,
|
|
437
|
+
}), u.forEach((b) => b.remove()), o.style.display = a, o.style.visibility = c, o.style.position = l, y(this, I, f > 0 ? f : 24), t(this, Et).call(this), t(this, I);
|
|
437
438
|
}, "#measureAndCacheHeight"));
|
|
438
439
|
d(this, St, /* @__PURE__ */ h(() => {
|
|
439
|
-
|
|
440
|
+
H.log("rowManager.#updateVirtualScrollHeight");
|
|
441
|
+
const e = (t(this, P).data.get() || []).length, s = t(this, I), r = e * s;
|
|
440
442
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
441
443
|
const o = t(this, S).querySelector(n);
|
|
442
444
|
if (!o) return;
|
|
@@ -445,8 +447,8 @@ const $e = class $e {
|
|
|
445
447
|
});
|
|
446
448
|
}, "#updateVirtualScrollHeight"));
|
|
447
449
|
d(this, Et, /* @__PURE__ */ h(() => {
|
|
448
|
-
if (t(this, Q) > 0 && t(this,
|
|
449
|
-
const i = Math.ceil(t(this, Q) / t(this,
|
|
450
|
+
if (t(this, Q) > 0 && t(this, I) > 0) {
|
|
451
|
+
const i = Math.ceil(t(this, Q) / t(this, I));
|
|
450
452
|
y(this, wt, i + t(this, Wt));
|
|
451
453
|
}
|
|
452
454
|
}, "#updateRowCount"));
|
|
@@ -456,11 +458,11 @@ const $e = class $e {
|
|
|
456
458
|
if (e) {
|
|
457
459
|
const g = i ? Array.from(i.querySelectorAll("tbody tr")) : [], m = Array.from(e.querySelectorAll("tbody tr")), v = s ? Array.from(s.querySelectorAll("tbody tr")) : [], E = Math.max(g.length, m.length, v.length);
|
|
458
460
|
for (let x = 0; x < E; x++) {
|
|
459
|
-
const
|
|
461
|
+
const M = [
|
|
460
462
|
((a = g[x]) == null ? void 0 : a.getBoundingClientRect().height) || 0,
|
|
461
463
|
((c = m[x]) == null ? void 0 : c.getBoundingClientRect().height) || 0,
|
|
462
464
|
((l = v[x]) == null ? void 0 : l.getBoundingClientRect().height) || 0
|
|
463
|
-
], k = Math.max(...
|
|
465
|
+
], k = Math.max(...M);
|
|
464
466
|
k > 0 && (g[x] && (g[x].style.height = `${k}px`), m[x] && (m[x].style.height = `${k}px`), v[x] && (v[x].style.height = `${k}px`));
|
|
465
467
|
}
|
|
466
468
|
}
|
|
@@ -468,11 +470,11 @@ const $e = class $e {
|
|
|
468
470
|
if (n) {
|
|
469
471
|
const g = r ? Array.from(r.querySelectorAll("tfoot tr")) : [], m = Array.from(n.querySelectorAll("tfoot tr")), v = o ? Array.from(o.querySelectorAll("tfoot tr")) : [], E = Math.max(g.length, m.length, v.length);
|
|
470
472
|
for (let x = 0; x < E; x++) {
|
|
471
|
-
const
|
|
473
|
+
const M = [
|
|
472
474
|
((f = g[x]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
473
475
|
((u = m[x]) == null ? void 0 : u.getBoundingClientRect().height) || 0,
|
|
474
476
|
((b = v[x]) == null ? void 0 : b.getBoundingClientRect().height) || 0
|
|
475
|
-
], k = Math.max(...
|
|
477
|
+
], k = Math.max(...M);
|
|
476
478
|
k > 0 && (g[x] && (g[x].style.height = `${k}px`), m[x] && (m[x].style.height = `${k}px`), v[x] && (v[x].style.height = `${k}px`));
|
|
477
479
|
}
|
|
478
480
|
}
|
|
@@ -488,13 +490,13 @@ const $e = class $e {
|
|
|
488
490
|
const o = s.querySelector(".ng-part-header"), a = s.querySelector(".ng-part-footer");
|
|
489
491
|
o && (n += o.offsetHeight), a && (n += a.offsetHeight);
|
|
490
492
|
const c = Math.max(r - n, 100);
|
|
491
|
-
t(this, Q) !== c && (y(this, Q, c), t(this, Et).call(this), t(this,
|
|
493
|
+
t(this, Q) !== c && (y(this, Q, c), t(this, Et).call(this), t(this, I) !== null && t(this, At).call(this));
|
|
492
494
|
}
|
|
493
495
|
}
|
|
494
496
|
})), t(this, V).observe(t(this, S)));
|
|
495
497
|
}, "#initResizeObserver"));
|
|
496
498
|
d(this, At, /* @__PURE__ */ h(() => {
|
|
497
|
-
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
499
|
+
H.log("rowManager.#renderAllContainers"), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
498
500
|
const e = t(this, S).querySelector(i);
|
|
499
501
|
e && e.querySelector(".ng-part-body tbody.bindable-tbody") && t(this, Ot).call(this, e, i);
|
|
500
502
|
}), t(this, Pt).call(this), t(this, zt).call(this);
|
|
@@ -520,7 +522,7 @@ const $e = class $e {
|
|
|
520
522
|
}, "#adjustBufferRows"));
|
|
521
523
|
d(this, lt, /* @__PURE__ */ h((i) => {
|
|
522
524
|
var u;
|
|
523
|
-
const e = t(this,
|
|
525
|
+
const e = t(this, I);
|
|
524
526
|
if (!e || e <= 0) return;
|
|
525
527
|
const r = (t(this, P).data.get() || []).length, n = Math.max(0, Math.floor(i / e)), o = n * e, a = ((u = t(this, D).get(".ng-container-body")) == null ? void 0 : u.length) || 1, c = t(this, S).querySelector(".ng-container-body"), l = c == null ? void 0 : c.querySelector(".ng-part-body tbody.bindable-tbody tr:not(.nodata)"), f = l && l.dataset.row !== void 0 ? parseInt(l.dataset.row, 10) : -1;
|
|
526
528
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((b) => {
|
|
@@ -528,19 +530,19 @@ const $e = class $e {
|
|
|
528
530
|
if (!g) return;
|
|
529
531
|
const m = g.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
530
532
|
m && (m.style.transform = `translateY(${o}px)`);
|
|
531
|
-
}),
|
|
533
|
+
}), H.log("#handleScroll", f, n), f !== n && [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((b) => {
|
|
532
534
|
const g = t(this, S).querySelector(b);
|
|
533
535
|
if (!g) return;
|
|
534
536
|
const m = g.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
535
537
|
if (!m) return;
|
|
536
538
|
Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((E, x) => {
|
|
537
|
-
const
|
|
538
|
-
if (
|
|
539
|
+
const M = n + Math.floor(x / a);
|
|
540
|
+
if (M >= r) {
|
|
539
541
|
E.style.display = "none";
|
|
540
542
|
return;
|
|
541
543
|
}
|
|
542
|
-
const k = t(this, P).data.get(
|
|
543
|
-
E.style.display = "", t(this, Rt).call(this, E, k,
|
|
544
|
+
const k = t(this, P).data.get(M);
|
|
545
|
+
E.style.display = "", t(this, Rt).call(this, E, k, M);
|
|
544
546
|
});
|
|
545
547
|
});
|
|
546
548
|
}, "#handleScroll"));
|
|
@@ -559,7 +561,7 @@ const $e = class $e {
|
|
|
559
561
|
});
|
|
560
562
|
}; */
|
|
561
563
|
d(this, Rt, /* @__PURE__ */ h((i, e, s) => {
|
|
562
|
-
i.dataset.row = s, i.data = e,
|
|
564
|
+
i.dataset.row = s, i.data = e, H.log(e, s), Array.from(i.cells).forEach((r, n) => {
|
|
563
565
|
r.dataset.row = s;
|
|
564
566
|
const o = Array.from(r.children).find((a) => a.tagName.toLowerCase().startsWith("cell-") || typeof a.refresh == "function");
|
|
565
567
|
o && typeof o.refresh == "function" && o.refresh();
|
|
@@ -567,6 +569,7 @@ const $e = class $e {
|
|
|
567
569
|
}, "#bindRowData"));
|
|
568
570
|
d(this, Pt, /* @__PURE__ */ h(() => {
|
|
569
571
|
var c, l, f;
|
|
572
|
+
H.log("rowManager.#syncHeaderHeights");
|
|
570
573
|
const i = t(this, S).querySelector(".ng-container-left .ng-part-header table"), e = t(this, S).querySelector(".ng-container-body .ng-part-header table"), s = t(this, S).querySelector(".ng-container-right .ng-part-header table");
|
|
571
574
|
if (!e) return;
|
|
572
575
|
const r = i ? Array.from(i.querySelectorAll("tr")) : [], n = Array.from(e.querySelectorAll("tr")), o = s ? Array.from(s.querySelectorAll("tr")) : [], a = Math.max(r.length, n.length, o.length);
|
|
@@ -585,14 +588,14 @@ const $e = class $e {
|
|
|
585
588
|
y(this, P, i.getRootNode().host), y(this, S, i), t(this, Dt).call(this);
|
|
586
589
|
}
|
|
587
590
|
getRowHeight() {
|
|
588
|
-
return t(this,
|
|
591
|
+
return t(this, I);
|
|
589
592
|
}
|
|
590
593
|
templateLength(i = ".ng-container-body") {
|
|
591
594
|
var e;
|
|
592
595
|
return ((e = t(this, D).get(i)) == null ? void 0 : e.length) || 1;
|
|
593
596
|
}
|
|
594
597
|
};
|
|
595
|
-
P = new WeakMap(), S = new WeakMap(), D = new WeakMap(),
|
|
598
|
+
P = new WeakMap(), S = new WeakMap(), D = new WeakMap(), I = new WeakMap(), V = new WeakMap(), Q = new WeakMap(), wt = new WeakMap(), Se = new WeakMap(), at = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(), Bt = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), zt = new WeakMap(), Dt = new WeakMap(), At = new WeakMap(), Ee = new WeakMap(), lt = new WeakMap(), Rt = new WeakMap(), Pt = new WeakMap(), h($e, "RowManager");
|
|
596
599
|
let ce = $e;
|
|
597
600
|
const jt = class jt {
|
|
598
601
|
/**
|
|
@@ -646,8 +649,8 @@ const jt = class jt {
|
|
|
646
649
|
E = B;
|
|
647
650
|
break;
|
|
648
651
|
}
|
|
649
|
-
const
|
|
650
|
-
for (let B = 0; B <
|
|
652
|
+
const M = x.rowSpan || 1, k = x.colSpan || 1;
|
|
653
|
+
for (let B = 0; B < M; B++)
|
|
651
654
|
for (let yt = 0; yt < k; yt++)
|
|
652
655
|
v + B < u && E + yt < b && (g[v + B][E + yt] = B === 0 && yt === 0 ? "1" : "0");
|
|
653
656
|
});
|
|
@@ -898,7 +901,7 @@ const pt = class pt extends HTMLElement {
|
|
|
898
901
|
t(this, Ut).call(this);
|
|
899
902
|
}
|
|
900
903
|
disconnectedCallback() {
|
|
901
|
-
this.innerHTML = "",
|
|
904
|
+
this.innerHTML = "", H.log("NineTableSheet destroyed.");
|
|
902
905
|
}
|
|
903
906
|
};
|
|
904
907
|
Ft = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), ct = new WeakMap(), Ut = new WeakMap(), Xt = new WeakMap(), h(pt, "NineTableSheet"), A(pt, "SCROLLBAR_SIZE", 16);
|
|
@@ -955,29 +958,29 @@ const Ie = class Ie extends HTMLElement {
|
|
|
955
958
|
Kt = new WeakMap(), qt = new WeakMap(), h(Ie, "NineTableSheets");
|
|
956
959
|
let de = Ie;
|
|
957
960
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", de);
|
|
958
|
-
var
|
|
961
|
+
var _, Zt, kt, Gt;
|
|
959
962
|
const _e = class _e {
|
|
960
963
|
constructor(i) {
|
|
961
|
-
d(this,
|
|
964
|
+
d(this, _);
|
|
962
965
|
d(this, Zt, /* @__PURE__ */ h(() => {
|
|
963
966
|
t(this, Gt).call(this), new ResizeObserver((i) => {
|
|
964
967
|
for (let e of i)
|
|
965
|
-
t(this,
|
|
966
|
-
}).observe(t(this,
|
|
968
|
+
t(this, _).getAttribute("auto-height") === "true" && t(this, kt).call(this);
|
|
969
|
+
}).observe(t(this, _));
|
|
967
970
|
}, "#init"));
|
|
968
971
|
d(this, kt, /* @__PURE__ */ h(() => {
|
|
969
972
|
var c, l;
|
|
970
|
-
const i = Array.from(t(this,
|
|
973
|
+
const i = Array.from(t(this, _).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
971
974
|
if (i.length === 0) return;
|
|
972
|
-
const e = parseInt(t(this,
|
|
973
|
-
t(this,
|
|
975
|
+
const e = parseInt(t(this, _).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), r = (c = t(this, _).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : c.getBoundingClientRect().height, n = (l = t(this, _).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, o = $t.SCROLLBAR_SIZE, a = e * s + r + n + o;
|
|
976
|
+
t(this, _).style.height = `${a}px`;
|
|
974
977
|
}, "#applyAutoHeight"));
|
|
975
978
|
d(this, Gt, /* @__PURE__ */ h(() => {
|
|
976
|
-
const e = Array.from(t(this,
|
|
979
|
+
const e = Array.from(t(this, _).children).filter((c) => c.tagName === "TABLE"), s = t(this, _).getAttribute("auto-height") === "true", r = e.length, n = e.map((c, l) => {
|
|
977
980
|
const u = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`, b = l < r - 1 ? `<nine-splitter class="h" data-split-index="${l}"></nine-splitter>` : "";
|
|
978
981
|
return u + b;
|
|
979
982
|
}).join(""), o = e.map((c, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
980
|
-
t(this,
|
|
983
|
+
t(this, _).shadowRoot.innerHTML = `
|
|
981
984
|
<style>
|
|
982
985
|
:host {
|
|
983
986
|
display: flex;
|
|
@@ -1068,17 +1071,17 @@ const _e = class _e {
|
|
|
1068
1071
|
</nine-table-body>
|
|
1069
1072
|
<nine-table-footer></nine-table-footer>
|
|
1070
1073
|
`;
|
|
1071
|
-
const a = t(this,
|
|
1074
|
+
const a = t(this, _).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1072
1075
|
a == null || a.forEach((c, l) => {
|
|
1073
1076
|
e[l] && setTimeout(() => {
|
|
1074
1077
|
c.generate(e[l]), s && t(this, kt).call(this);
|
|
1075
1078
|
});
|
|
1076
1079
|
});
|
|
1077
1080
|
}, "#render"));
|
|
1078
|
-
y(this,
|
|
1081
|
+
y(this, _, i), t(this, Zt).call(this);
|
|
1079
1082
|
}
|
|
1080
1083
|
};
|
|
1081
|
-
|
|
1084
|
+
_ = new WeakMap(), Zt = new WeakMap(), kt = new WeakMap(), Gt = new WeakMap(), h(_e, "LayoutManager");
|
|
1082
1085
|
let fe = _e;
|
|
1083
1086
|
var Tt, ht;
|
|
1084
1087
|
const Ne = class Ne {
|
|
@@ -1098,18 +1101,18 @@ const Ne = class Ne {
|
|
|
1098
1101
|
};
|
|
1099
1102
|
Tt = new WeakMap(), ht = new WeakMap(), h(Ne, "ngRow");
|
|
1100
1103
|
let ue = Ne;
|
|
1101
|
-
var
|
|
1104
|
+
var N, T, W, dt, Jt, Y, Qt, st, Ct, te, ee, ft;
|
|
1102
1105
|
const O = class O {
|
|
1103
1106
|
constructor(i, e) {
|
|
1104
|
-
d(this,
|
|
1107
|
+
d(this, N);
|
|
1105
1108
|
d(this, T);
|
|
1106
|
-
d(this,
|
|
1109
|
+
d(this, W, []);
|
|
1107
1110
|
d(this, dt, []);
|
|
1108
1111
|
d(this, Jt, 0);
|
|
1109
1112
|
d(this, Y, []);
|
|
1110
1113
|
d(this, Qt, /* @__PURE__ */ h(() => {
|
|
1111
1114
|
y(this, Y, []);
|
|
1112
|
-
const i = t(this,
|
|
1115
|
+
const i = t(this, N).template || [];
|
|
1113
1116
|
Array.from(i).forEach((e) => {
|
|
1114
1117
|
var s;
|
|
1115
1118
|
t(this, Y).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
@@ -1118,7 +1121,7 @@ const O = class O {
|
|
|
1118
1121
|
});
|
|
1119
1122
|
}, "#initialize"));
|
|
1120
1123
|
d(this, st, /* @__PURE__ */ h(() => {
|
|
1121
|
-
t(this,
|
|
1124
|
+
t(this, N).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1122
1125
|
i.invalidate();
|
|
1123
1126
|
});
|
|
1124
1127
|
}, "#invalidate"));
|
|
@@ -1128,7 +1131,7 @@ const O = class O {
|
|
|
1128
1131
|
if (!s || s.length <= 0) return;
|
|
1129
1132
|
if (i == null) return t(this, ft).call(this, s);
|
|
1130
1133
|
if (i < 0 || i >= s.length) return null;
|
|
1131
|
-
const r = typeof ((n = t(this,
|
|
1134
|
+
const r = typeof ((n = t(this, N).fields) == null ? void 0 : n.get) == "function" ? t(this, N).fields.get() : [];
|
|
1132
1135
|
if (e != null) {
|
|
1133
1136
|
const o = r.indexOf(e);
|
|
1134
1137
|
return o >= 0 ? s[i].v[o] : null;
|
|
@@ -1148,16 +1151,16 @@ const O = class O {
|
|
|
1148
1151
|
_: [0, 0, 0, 0, O.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, Y).slice(), -1, {}, {}]
|
|
1149
1152
|
}), "#getDefaultMeta"));
|
|
1150
1153
|
A(this, "reset", /* @__PURE__ */ h(() => {
|
|
1151
|
-
y(this,
|
|
1154
|
+
y(this, W, []), y(this, dt, []), t(this, st).call(this);
|
|
1152
1155
|
}, "reset"));
|
|
1153
1156
|
A(this, "clear", /* @__PURE__ */ h(() => {
|
|
1154
1157
|
var i;
|
|
1155
|
-
t(this, T).rawRecords = [], y(this,
|
|
1158
|
+
t(this, T).rawRecords = [], y(this, W, []), y(this, dt, []), (i = t(this, T).viewRecords) != null && i.reset && t(this, T).viewRecords.reset();
|
|
1156
1159
|
}, "clear"));
|
|
1157
1160
|
d(this, te, /* @__PURE__ */ h((i) => {
|
|
1158
1161
|
var r;
|
|
1159
1162
|
Array.isArray(i) || (i = [i]);
|
|
1160
|
-
const e = typeof ((r = t(this,
|
|
1163
|
+
const e = typeof ((r = t(this, N).fields) == null ? void 0 : r.get) == "function" ? t(this, N).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1161
1164
|
return i.forEach((n) => {
|
|
1162
1165
|
const o = { v: [] };
|
|
1163
1166
|
e.forEach((a) => {
|
|
@@ -1181,9 +1184,9 @@ const O = class O {
|
|
|
1181
1184
|
A(this, "delete", /* @__PURE__ */ h((i) => {
|
|
1182
1185
|
let e = [];
|
|
1183
1186
|
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, T).host.row.at] : e = [parseInt(i, 10)], e.sort((s, r) => r - s).forEach((s) => {
|
|
1184
|
-
if (t(this,
|
|
1185
|
-
const r = t(this,
|
|
1186
|
-
t(this,
|
|
1187
|
+
if (t(this, W)[s]) {
|
|
1188
|
+
const r = t(this, W)[s].__ng.rowid;
|
|
1189
|
+
t(this, W)[s].__ng.rowState === O.ROW_STATE.INSERT ? t(this, T).rawRecords = t(this, T).rawRecords.filter((n) => n.__ng.rowid !== r) : t(this, T).rawRecords.forEach((n) => {
|
|
1187
1190
|
n.__ng.rowid === r && (n.__ng.deleted = !0, n.__ng.rowState = O.ROW_STATE.DELETE);
|
|
1188
1191
|
});
|
|
1189
1192
|
}
|
|
@@ -1192,7 +1195,7 @@ const O = class O {
|
|
|
1192
1195
|
A(this, "setValue", /* @__PURE__ */ h((i, e, s) => {
|
|
1193
1196
|
var c;
|
|
1194
1197
|
i = parseInt(i, 10);
|
|
1195
|
-
const n = (typeof ((c = t(this,
|
|
1198
|
+
const n = (typeof ((c = t(this, N).fields) == null ? void 0 : c.get) == "function" ? t(this, N).fields.get() : []).indexOf(e);
|
|
1196
1199
|
if (n < 0) return;
|
|
1197
1200
|
const o = this.getValidData()[i];
|
|
1198
1201
|
if (!o) return;
|
|
@@ -1200,17 +1203,17 @@ const O = class O {
|
|
|
1200
1203
|
a !== s && o.__ng.rowState !== O.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = a), o.__ng.rowState = O.ROW_STATE.UPDATE), o.v[n] = s;
|
|
1201
1204
|
}, "setValue"));
|
|
1202
1205
|
A(this, "resetRecords", /* @__PURE__ */ h(() => {
|
|
1203
|
-
y(this, dt, t(this, T).rawRecords.filter((i) => !i.__ng.deleted)), y(this,
|
|
1206
|
+
y(this, dt, t(this, T).rawRecords.filter((i) => !i.__ng.deleted)), y(this, W, t(this, T).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, T).rawRecords.forEach((i, e) => {
|
|
1204
1207
|
i.__ng.rowidx = e;
|
|
1205
|
-
}), t(this,
|
|
1208
|
+
}), t(this, W).forEach((i, e) => {
|
|
1206
1209
|
i.__ng.i = e;
|
|
1207
1210
|
});
|
|
1208
1211
|
}, "resetRecords"));
|
|
1209
|
-
A(this, "getValidData", /* @__PURE__ */ h(() => (t(this,
|
|
1212
|
+
A(this, "getValidData", /* @__PURE__ */ h(() => (t(this, W).length === 0 && t(this, T).rawRecords.length > 0 && this.resetRecords(), t(this, W)), "getValidData"));
|
|
1210
1213
|
d(this, ft, /* @__PURE__ */ h((i) => {
|
|
1211
1214
|
var o;
|
|
1212
1215
|
if (!i) return i;
|
|
1213
|
-
const e = !Array.isArray(i), s = e ? [i] : i, r = typeof ((o = t(this,
|
|
1216
|
+
const e = !Array.isArray(i), s = e ? [i] : i, r = typeof ((o = t(this, N).fields) == null ? void 0 : o.get) == "function" ? t(this, N).fields.get() : [], n = s.filter((a) => !a.__ng.deleted).map((a) => {
|
|
1214
1217
|
const c = {};
|
|
1215
1218
|
return r.forEach((l, f) => {
|
|
1216
1219
|
c[l] = a.v ? a.v[f] : a[l];
|
|
@@ -1219,7 +1222,7 @@ const O = class O {
|
|
|
1219
1222
|
return e ? n[0] : n;
|
|
1220
1223
|
}, "#conv"));
|
|
1221
1224
|
A(this, "count", /* @__PURE__ */ h(() => this.getValidData().length, "count"));
|
|
1222
|
-
y(this,
|
|
1225
|
+
y(this, N, i), y(this, T, e), t(this, Qt).call(this);
|
|
1223
1226
|
}
|
|
1224
1227
|
get source() {
|
|
1225
1228
|
return t(this, ft).call(this, t(this, T).rawRecords);
|
|
@@ -1231,13 +1234,13 @@ const O = class O {
|
|
|
1231
1234
|
return ++Ye(this, Jt)._;
|
|
1232
1235
|
}
|
|
1233
1236
|
get length() {
|
|
1234
|
-
return t(this,
|
|
1237
|
+
return t(this, W).length;
|
|
1235
1238
|
}
|
|
1236
1239
|
getRowCount() {
|
|
1237
1240
|
return this.length;
|
|
1238
1241
|
}
|
|
1239
1242
|
};
|
|
1240
|
-
|
|
1243
|
+
N = new WeakMap(), T = new WeakMap(), W = new WeakMap(), dt = new WeakMap(), Jt = new WeakMap(), Y = new WeakMap(), Qt = new WeakMap(), st = new WeakMap(), Ct = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ft = new WeakMap(), h(O, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1241
1244
|
A(O, "ROW_STATE", {
|
|
1242
1245
|
EMPTY: "EMPTY",
|
|
1243
1246
|
NORMAL: "NORMAL",
|
|
@@ -1287,11 +1290,11 @@ const Oe = class Oe {
|
|
|
1287
1290
|
}), y(this, L, Array.from(i, ([e, s]) => ({ name: e, type: s }))), y(this, L, t(this, L).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, L).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1288
1291
|
}, "#adjust"));
|
|
1289
1292
|
d(this, se, /* @__PURE__ */ h(() => {
|
|
1290
|
-
y(this, L, []),
|
|
1293
|
+
y(this, L, []), H.log(t(this, ut).querySelectorAll("table"));
|
|
1291
1294
|
const i = Array.from(t(this, ut).querySelectorAll("table"));
|
|
1292
1295
|
if (!(!i || i.length === 0)) {
|
|
1293
1296
|
for (const e of i)
|
|
1294
|
-
|
|
1297
|
+
H.log(e), $("[data-bind]", e).each((s, r) => {
|
|
1295
1298
|
const n = r.dataset.bind, o = r.getAttribute("data-type") || "string";
|
|
1296
1299
|
n && t(this, L).push({ name: n, type: o });
|
|
1297
1300
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1350,7 +1353,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1350
1353
|
d(this, rt);
|
|
1351
1354
|
d(this, ie);
|
|
1352
1355
|
d(this, re, /* @__PURE__ */ h(() => {
|
|
1353
|
-
this.fields = new ye(this), y(this, ie, new fe(this)),
|
|
1356
|
+
this.fields = new ye(this), y(this, ie, new fe(this)), H.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1354
1357
|
}, "#init"));
|
|
1355
1358
|
this.attachShadow({ mode: "open" }), y(this, rt, new be(this));
|
|
1356
1359
|
}
|
|
@@ -1358,7 +1361,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1358
1361
|
t(this, re).call(this);
|
|
1359
1362
|
}
|
|
1360
1363
|
disconnectedCallback() {
|
|
1361
|
-
|
|
1364
|
+
H.log("NineTable disconnected.");
|
|
1362
1365
|
}
|
|
1363
1366
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1364
1367
|
get data() {
|
|
@@ -1425,9 +1428,9 @@ const ze = class ze extends me {
|
|
|
1425
1428
|
var e = ninegrid.j.querySelectorAll(t(this, p)).attr("suppress");
|
|
1426
1429
|
if (e && (e = parseInt(e)), e && !isNaN(e)) {
|
|
1427
1430
|
var s = t(this, p).closest("tr"), r = [];
|
|
1428
|
-
$("th,td", s).each((x,
|
|
1429
|
-
var k = ninegrid.j.querySelectorAll(
|
|
1430
|
-
k &&
|
|
1431
|
+
$("th,td", s).each((x, M) => {
|
|
1432
|
+
var k = ninegrid.j.querySelectorAll(M).attr("suppress");
|
|
1433
|
+
k && M.dataset.row && (k = parseInt(k), !isNaN(k) && k <= e && r.push(k));
|
|
1431
1434
|
}), r.sort();
|
|
1432
1435
|
var n = !1;
|
|
1433
1436
|
if (parseInt(s.sectionRowIndex / t(this, C).template.length) > 0)
|
|
@@ -1512,7 +1515,7 @@ const Pe = class Pe extends ve {
|
|
|
1512
1515
|
d(this, U);
|
|
1513
1516
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
1514
1517
|
const e = super.refresh();
|
|
1515
|
-
|
|
1518
|
+
H.log("::", e), t(this, Mt).value = e;
|
|
1516
1519
|
}, "refresh"));
|
|
1517
1520
|
/**
|
|
1518
1521
|
dataRefresh = (v) => {
|