@ninebone/table 0.0.675 β 0.0.677
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 +123 -123
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +1 -1
- 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 He = class He extends Ke.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
c(He, "Trace");
|
|
24
24
|
let oe = He;
|
|
25
|
-
const
|
|
25
|
+
const L = new oe();
|
|
26
26
|
var B, j, S, X, K, Z, _t, G, Nt;
|
|
27
27
|
const Me = class Me extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -55,11 +55,11 @@ const Me = class Me extends HTMLElement {
|
|
|
55
55
|
if (l <= 0) return;
|
|
56
56
|
const f = Math.max(Math.min(l * (a / h), l), 20);
|
|
57
57
|
n.style.width = `${f}px`;
|
|
58
|
-
const
|
|
59
|
-
let
|
|
60
|
-
b > 0 && (
|
|
58
|
+
const u = e.scrollLeft, b = h - a;
|
|
59
|
+
let g = 0;
|
|
60
|
+
b > 0 && (g = parseInt(u / b * (l - f), 10)), g < 0 && (g = 0);
|
|
61
61
|
const v = l - f;
|
|
62
|
-
|
|
62
|
+
g > v && (g = v), n.style.left = `${g}px`, t(this, S).left.disabled = g === 0, t(this, S).right.disabled = g >= v - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
d(this, G, /* @__PURE__ */ c((e) => {
|
|
65
65
|
if (!t(this, S)) return !1;
|
|
@@ -70,8 +70,8 @@ const Me = class Me extends HTMLElement {
|
|
|
70
70
|
a < 0 && (a = 0);
|
|
71
71
|
const h = n.width - o;
|
|
72
72
|
a > h && (a = h), a = parseInt(a, 10), t(this, S).thumb.style.left = `${a}px`, t(this, S).left.disabled = a === 0, t(this, S).right.disabled = a >= h - 1;
|
|
73
|
-
const l = s.clientWidth,
|
|
74
|
-
return h > 0 &&
|
|
73
|
+
const l = s.clientWidth, u = r.scrollWidth - l;
|
|
74
|
+
return h > 0 && u > 0 && (s.scrollLeft = a / h * u), a > 0 && a < h - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
d(this, Nt, /* @__PURE__ */ c(() => {
|
|
77
77
|
const e = /* @__PURE__ */ c((r) => {
|
|
@@ -223,14 +223,14 @@ const $e = class $e extends HTMLElement {
|
|
|
223
223
|
if (l <= 0) return;
|
|
224
224
|
const f = Math.max(Math.min(l * (n / h), l), 20);
|
|
225
225
|
r.style.height = `${f}px`;
|
|
226
|
-
const
|
|
227
|
-
let
|
|
228
|
-
b > 0 && (
|
|
226
|
+
const u = e.scrollTop, b = Math.max(h - n, 1);
|
|
227
|
+
let g = 0;
|
|
228
|
+
b > 0 && (g = u / b * (l - f));
|
|
229
229
|
const v = l - f;
|
|
230
|
-
|
|
230
|
+
g < 0 && (g = 0), g > v && (g = v), r.style.top = `${g}px`, t(this, T).top.disabled = u <= 0, t(this, T).bottom.disabled = u >= b - 1;
|
|
231
231
|
}, "refresh"));
|
|
232
232
|
d(this, Wt, /* @__PURE__ */ c(() => {
|
|
233
|
-
|
|
233
|
+
L.log("nine-table-vscrollbar.#init");
|
|
234
234
|
const e = t(this, T).container, s = /* @__PURE__ */ c(() => {
|
|
235
235
|
const n = (t(this, F).data.get() || []).length, o = t(this, at).getRowHeight();
|
|
236
236
|
return n * o;
|
|
@@ -242,11 +242,11 @@ const $e = class $e extends HTMLElement {
|
|
|
242
242
|
r.stopPropagation(), r.preventDefault(), y(this, J, !0), y(this, vt, r.clientY), y(this, xt, e.scrollTop);
|
|
243
243
|
const n = /* @__PURE__ */ c((a) => {
|
|
244
244
|
if (!t(this, J)) return;
|
|
245
|
-
const h = t(this, T).track.getBoundingClientRect(), l = t(this, T).thumb.clientHeight,
|
|
246
|
-
if (
|
|
247
|
-
const A = b /
|
|
245
|
+
const h = t(this, T).track.getBoundingClientRect(), l = t(this, T).thumb.clientHeight, u = h.height - l, b = a.clientY - t(this, vt), g = e.clientHeight, v = s(), w = Math.max(v - g, 1);
|
|
246
|
+
if (u > 0 && w > 0) {
|
|
247
|
+
const A = b / u * w;
|
|
248
248
|
let m = t(this, xt) + A;
|
|
249
|
-
const W = Math.max(0, v -
|
|
249
|
+
const W = Math.max(0, v - g);
|
|
250
250
|
m < 0 && (m = 0), m > W && (m = W), e.scrollTop = m;
|
|
251
251
|
}
|
|
252
252
|
this.refresh();
|
|
@@ -256,10 +256,10 @@ const $e = class $e extends HTMLElement {
|
|
|
256
256
|
document.addEventListener("mousemove", n), document.addEventListener("mouseup", o);
|
|
257
257
|
}), t(this, T).track.addEventListener("mousedown", (r) => {
|
|
258
258
|
if (r.button !== 0 || r.target === t(this, T).thumb) return;
|
|
259
|
-
const n = t(this, T).track.getBoundingClientRect(), o = t(this, T).thumb.clientHeight, a = r.clientY - n.top - o / 2, l = n.height - o, f = e.clientHeight,
|
|
259
|
+
const n = t(this, T).track.getBoundingClientRect(), o = t(this, T).thumb.clientHeight, a = r.clientY - n.top - o / 2, l = n.height - o, f = e.clientHeight, u = s(), b = Math.max(u - f, 1);
|
|
260
260
|
if (l > 0 && b > 0) {
|
|
261
|
-
const
|
|
262
|
-
e.scrollTop =
|
|
261
|
+
const g = Math.max(0, Math.min(1, a / l));
|
|
262
|
+
e.scrollTop = g * b;
|
|
263
263
|
}
|
|
264
264
|
this.refresh();
|
|
265
265
|
}), t(this, T).top.addEventListener("click", () => {
|
|
@@ -371,12 +371,12 @@ const Ie = class Ie {
|
|
|
371
371
|
d(this, Ot, 3);
|
|
372
372
|
E(this, "refresh", /* @__PURE__ */ c(() => {
|
|
373
373
|
var e;
|
|
374
|
-
|
|
374
|
+
L.log("rowManager.refresh");
|
|
375
375
|
const i = t(this, x).querySelector(".ng-container-body .ng-part-body");
|
|
376
376
|
i && (t(this, St).call(this), t(this, Et).call(this), t(this, lt).call(this, i.scrollTop), (e = t(this, x).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
377
377
|
}, "refresh"));
|
|
378
378
|
E(this, "initialize", /* @__PURE__ */ c(() => {
|
|
379
|
-
|
|
379
|
+
L.log("rowManager.initialize"), y(this, Q, {
|
|
380
380
|
scrollTables: t(this, x).querySelectorAll(".ng-part-body table"),
|
|
381
381
|
firstTr: t(this, x).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")
|
|
382
382
|
}), y(this, I, null), t(this, D).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
@@ -386,8 +386,8 @@ const Ie = class Ie {
|
|
|
386
386
|
if (!h) return;
|
|
387
387
|
const l = h.querySelector("tbody.bindable-tbody");
|
|
388
388
|
if (!l) return;
|
|
389
|
-
const
|
|
390
|
-
t(this, D).set(o,
|
|
389
|
+
const u = Array.from(l.querySelectorAll("tr")).map((b) => b.cloneNode(!0));
|
|
390
|
+
t(this, D).set(o, u);
|
|
391
391
|
});
|
|
392
392
|
const i = t(this, x).querySelector(".ng-container-body .ng-part-body"), e = t(this, x).querySelector(".ng-container-left .ng-part-body"), s = t(this, x).querySelector(".ng-container-right .ng-part-body"), r = t(this, x).querySelector(".ng-container-body .ng-part-header"), n = t(this, x).querySelector(".ng-container-body .ng-part-footer");
|
|
393
393
|
if (i) {
|
|
@@ -407,7 +407,7 @@ const Ie = class Ie {
|
|
|
407
407
|
}
|
|
408
408
|
}, "initialize"));
|
|
409
409
|
d(this, zt, /* @__PURE__ */ c((i, e) => {
|
|
410
|
-
|
|
410
|
+
L.log("rowManager.#renderRows");
|
|
411
411
|
const s = t(this, D).get(e);
|
|
412
412
|
if (!s || s.length === 0) return;
|
|
413
413
|
const r = i.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -424,11 +424,11 @@ const Ie = class Ie {
|
|
|
424
424
|
if (t(this, I) !== null && t(this, I) > 0)
|
|
425
425
|
return t(this, I);
|
|
426
426
|
const i = t(this, x).querySelector(".ng-container-body .ng-part-body");
|
|
427
|
-
|
|
427
|
+
L.log("rowManager.#measureAndCacheHeight");
|
|
428
428
|
const e = t(this, D).get(".ng-container-body");
|
|
429
429
|
if (!e || e.length === 0) throw new Error("invalid dom");
|
|
430
430
|
const s = i.querySelector("tbody.bindable-tbody");
|
|
431
|
-
if (
|
|
431
|
+
if (L.log(s), !s) throw new Error("invalid dom");
|
|
432
432
|
s.querySelectorAll("tr:not(.nodata)").forEach((b) => b.remove());
|
|
433
433
|
const r = s.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
434
434
|
e.forEach((b) => {
|
|
@@ -437,21 +437,21 @@ const Ie = class Ie {
|
|
|
437
437
|
const o = t(this, x), a = o.style.display, h = o.style.visibility, l = o.style.position;
|
|
438
438
|
(a === "none" || window.getComputedStyle(o).display === "none") && (o.style.display = "block", o.style.visibility = "hidden", o.style.position = "absolute");
|
|
439
439
|
let f = 0;
|
|
440
|
-
const
|
|
441
|
-
if (
|
|
442
|
-
let
|
|
443
|
-
if (
|
|
440
|
+
const u = s.querySelectorAll("tr");
|
|
441
|
+
if (u.forEach((b) => {
|
|
442
|
+
let g = b.offsetHeight || b.getBoundingClientRect().height;
|
|
443
|
+
if (g === 0) {
|
|
444
444
|
const v = window.getComputedStyle(b);
|
|
445
|
-
|
|
445
|
+
g = parseFloat(v.height) || parseFloat(v.minHeight) || 0;
|
|
446
446
|
}
|
|
447
|
-
f +=
|
|
448
|
-
}),
|
|
447
|
+
f += g;
|
|
448
|
+
}), u.forEach((b) => b.remove()), o.style.display = a, o.style.visibility = h, o.style.position = l, f <= 0) throw new Error("#measureAndCacheHeight() invalid dom");
|
|
449
449
|
return y(this, I, f), t(this, At).call(this), t(this, I);
|
|
450
450
|
}, "#measureAndCacheHeight"));
|
|
451
451
|
d(this, Et, /* @__PURE__ */ c(() => {
|
|
452
|
-
|
|
452
|
+
L.log("rowManager.#updateVirtualScrollHeight");
|
|
453
453
|
const e = (t(this, P).data.get() || []).length, s = t(this, I), r = e * s;
|
|
454
|
-
|
|
454
|
+
L.log("π [VirtualHeight]", { totalCount: e, rowHeight: s, totalVirtualHeight: r }), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
455
455
|
const o = t(this, x).querySelector(n);
|
|
456
456
|
if (!o) return;
|
|
457
457
|
const a = o.querySelector(".ng-part-body .ng-virtual-spacer");
|
|
@@ -465,29 +465,29 @@ const Ie = class Ie {
|
|
|
465
465
|
}
|
|
466
466
|
}, "#updateRowCount"));
|
|
467
467
|
d(this, Bt, /* @__PURE__ */ c(() => {
|
|
468
|
-
var a, h, l, f,
|
|
468
|
+
var a, h, l, f, u, b;
|
|
469
469
|
const i = t(this, x).querySelector(".ng-container-left .ng-part-body table"), e = t(this, x).querySelector(".ng-container-body .ng-part-body table"), s = t(this, x).querySelector(".ng-container-right .ng-part-body table");
|
|
470
470
|
if (e) {
|
|
471
|
-
const
|
|
471
|
+
const g = i ? Array.from(i.querySelectorAll("tbody tr")) : [], v = Array.from(e.querySelectorAll("tbody tr")), w = s ? Array.from(s.querySelectorAll("tbody tr")) : [], A = Math.max(g.length, v.length, w.length);
|
|
472
472
|
for (let m = 0; m < A; m++) {
|
|
473
473
|
const W = [
|
|
474
|
-
((a =
|
|
474
|
+
((a = g[m]) == null ? void 0 : a.getBoundingClientRect().height) || 0,
|
|
475
475
|
((h = v[m]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
476
476
|
((l = w[m]) == null ? void 0 : l.getBoundingClientRect().height) || 0
|
|
477
477
|
], R = Math.max(...W);
|
|
478
|
-
R > 0 && (
|
|
478
|
+
R > 0 && (g[m] && (g[m].style.height = `${R}px`), v[m] && (v[m].style.height = `${R}px`), w[m] && (w[m].style.height = `${R}px`));
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
const r = t(this, x).querySelector(".ng-container-left .ng-part-footer table"), n = t(this, x).querySelector(".ng-container-body .ng-part-footer table"), o = t(this, x).querySelector(".ng-container-right .ng-part-footer table");
|
|
482
482
|
if (n) {
|
|
483
|
-
const
|
|
483
|
+
const g = r ? Array.from(r.querySelectorAll("tfoot tr")) : [], v = Array.from(n.querySelectorAll("tfoot tr")), w = o ? Array.from(o.querySelectorAll("tfoot tr")) : [], A = Math.max(g.length, v.length, w.length);
|
|
484
484
|
for (let m = 0; m < A; m++) {
|
|
485
485
|
const W = [
|
|
486
|
-
((f =
|
|
487
|
-
((
|
|
486
|
+
((f = g[m]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
487
|
+
((u = v[m]) == null ? void 0 : u.getBoundingClientRect().height) || 0,
|
|
488
488
|
((b = w[m]) == null ? void 0 : b.getBoundingClientRect().height) || 0
|
|
489
489
|
], R = Math.max(...W);
|
|
490
|
-
R > 0 && (
|
|
490
|
+
R > 0 && (g[m] && (g[m].style.height = `${R}px`), v[m] && (v[m].style.height = `${R}px`), w[m] && (w[m].style.height = `${R}px`));
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
}, "#syncRowHeights"));
|
|
@@ -508,7 +508,7 @@ const Ie = class Ie {
|
|
|
508
508
|
})), t(this, V).observe(t(this, x)));
|
|
509
509
|
}, "#initResizeObserver"));
|
|
510
510
|
d(this, qt, /* @__PURE__ */ c(() => {
|
|
511
|
-
|
|
511
|
+
L.log("rowManager.#renderAllContainers"), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
512
512
|
const e = t(this, x).querySelector(i);
|
|
513
513
|
e && e.querySelector(".ng-part-body tbody.bindable-tbody") && t(this, zt).call(this, e, i);
|
|
514
514
|
}), t(this, Pt).call(this), t(this, Bt).call(this);
|
|
@@ -521,33 +521,33 @@ const Ie = class Ie {
|
|
|
521
521
|
const r = s.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
522
522
|
if (!r) return;
|
|
523
523
|
const n = Array.from(r.querySelectorAll("tr:not(.nodata)")), o = ((l = t(this, D).get(e)) == null ? void 0 : l.length) || 1, h = (t(this, P).data.get() || []).length;
|
|
524
|
-
n.forEach((f,
|
|
525
|
-
const b = i + Math.floor(
|
|
524
|
+
n.forEach((f, u) => {
|
|
525
|
+
const b = i + Math.floor(u / o);
|
|
526
526
|
if (b >= h) {
|
|
527
527
|
f.style.visibility = "hidden";
|
|
528
528
|
return;
|
|
529
529
|
}
|
|
530
|
-
const
|
|
531
|
-
f.style.display = "", t(this, Rt).call(this, f,
|
|
530
|
+
const g = t(this, P).data.get(b);
|
|
531
|
+
f.style.display = "", t(this, Rt).call(this, f, g, b);
|
|
532
532
|
});
|
|
533
533
|
});
|
|
534
534
|
}, "#adjustBufferRows"));
|
|
535
535
|
d(this, lt, /* @__PURE__ */ c((i) => {
|
|
536
|
-
var
|
|
536
|
+
var u, b;
|
|
537
537
|
const e = t(this, I);
|
|
538
538
|
if (!e || e <= 0) return;
|
|
539
539
|
const s = t(this, P).data.length;
|
|
540
540
|
if (s === 0) return;
|
|
541
|
-
const r = ((
|
|
542
|
-
|
|
541
|
+
const r = ((u = t(this, D).get(".ng-container-body")) == null ? void 0 : u.length) || 1, n = t(this, x).querySelector(".ng-container-body .ng-part-body");
|
|
542
|
+
L.log("bodyContainer.clientHeight", n.clientHeight);
|
|
543
543
|
const o = Math.max(0, s - Math.floor(n.clientHeight / e)), a = Math.min(o, Math.max(0, Math.floor(i / e)));
|
|
544
544
|
let h = Math.floor(a * e);
|
|
545
|
-
a === o &&
|
|
545
|
+
a === o && L.log(`π [Scroll Inspect] scrollTop: ${i}, rowHeight: ${e}, maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${h}`);
|
|
546
546
|
const l = t(this, Q).firstTr, f = l && l.dataset.row !== void 0 ? parseInt(l.dataset.row, 10) : -1;
|
|
547
|
-
(b = t(this, Q)) == null || b.scrollTables.forEach((
|
|
548
|
-
|
|
549
|
-
}), f !== a && [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
550
|
-
const v = t(this, x).querySelector(
|
|
547
|
+
(b = t(this, Q)) == null || b.scrollTables.forEach((g) => {
|
|
548
|
+
g.style.transform = `translate3d(0, ${h}px, 0)`;
|
|
549
|
+
}), f !== a && [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((g) => {
|
|
550
|
+
const v = t(this, x).querySelector(g);
|
|
551
551
|
if (!v) return;
|
|
552
552
|
const w = v.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
553
553
|
if (!w) return;
|
|
@@ -585,17 +585,17 @@ const Ie = class Ie {
|
|
|
585
585
|
}, "#bindRowData"));
|
|
586
586
|
d(this, Pt, /* @__PURE__ */ c(() => {
|
|
587
587
|
var h, l, f;
|
|
588
|
-
|
|
588
|
+
L.log("rowManager.#syncHeaderHeights");
|
|
589
589
|
const i = t(this, x).querySelector(".ng-container-left .ng-part-header table"), e = t(this, x).querySelector(".ng-container-body .ng-part-header table"), s = t(this, x).querySelector(".ng-container-right .ng-part-header table");
|
|
590
590
|
if (!e) return;
|
|
591
591
|
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);
|
|
592
|
-
for (let
|
|
592
|
+
for (let u = 0; u < a; u++) {
|
|
593
593
|
const b = [
|
|
594
|
-
((h = r[
|
|
595
|
-
((l = n[
|
|
596
|
-
((f = o[
|
|
597
|
-
],
|
|
598
|
-
|
|
594
|
+
((h = r[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
595
|
+
((l = n[u]) == null ? void 0 : l.getBoundingClientRect().height) || 0,
|
|
596
|
+
((f = o[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
597
|
+
], g = Math.max(...b);
|
|
598
|
+
g > 0 && (r[u] && (r[u].style.height = `${g}px`), n[u] && (n[u].style.height = `${g}px`), o[u] && (o[u].style.height = `${g}px`));
|
|
599
599
|
}
|
|
600
600
|
}, "#syncHeaderHeights"));
|
|
601
601
|
E(this, "destroy", /* @__PURE__ */ c(() => {
|
|
@@ -629,17 +629,17 @@ const jt = class jt {
|
|
|
629
629
|
a.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach((l) => {
|
|
630
630
|
const f = l.getAttribute("cell-type") || "renderer";
|
|
631
631
|
if (l.children.length > 0 && l.firstElementChild.tagName.includes("-")) return;
|
|
632
|
-
let
|
|
633
|
-
const b = l.getAttribute("data-bind"),
|
|
632
|
+
let u = `cell-${f}`;
|
|
633
|
+
const b = l.getAttribute("data-bind"), g = l.getAttribute("data-expr"), v = l.getAttribute("maxbyte"), w = l.getAttribute("type");
|
|
634
634
|
let A = [];
|
|
635
|
-
b && A.push(`data-bind="${b}"`),
|
|
635
|
+
b && A.push(`data-bind="${b}"`), g && A.push(`data-expr="${g}"`), v && A.push(`maxbyte="${v}"`), w && A.push(`type="${w}"`), l.innerHTML = `<${u} ${A.join(" ")}></${u}>`;
|
|
636
636
|
});
|
|
637
637
|
}, "processCellTypes"), s = /* @__PURE__ */ c((a) => {
|
|
638
638
|
if (!a.querySelector("colgroup")) {
|
|
639
|
-
const h = a.querySelector("tbody tr") || a.querySelector("tr"), l = h ? h.querySelectorAll("th, td").length : 1, f = document.createElement("colgroup"),
|
|
639
|
+
const h = a.querySelector("tbody tr") || a.querySelector("tr"), l = h ? h.querySelectorAll("th, td").length : 1, f = document.createElement("colgroup"), u = Math.max(Math.floor(a.clientWidth / l), 100);
|
|
640
640
|
for (let b = 0; b < l; b++) {
|
|
641
|
-
const
|
|
642
|
-
|
|
641
|
+
const g = document.createElement("col");
|
|
642
|
+
g.setAttribute("width", u), f.appendChild(g);
|
|
643
643
|
}
|
|
644
644
|
a.prepend(f);
|
|
645
645
|
}
|
|
@@ -649,33 +649,33 @@ const jt = class jt {
|
|
|
649
649
|
}
|
|
650
650
|
a.classList.add("nine-table-element");
|
|
651
651
|
}, "ensureTableStructure"), r = /* @__PURE__ */ c((a, h) => {
|
|
652
|
-
const l = Array.from(a.querySelectorAll(h + " tr")), f = Array.from(a.querySelectorAll(h + " th," + h + " td")),
|
|
653
|
-
if (
|
|
652
|
+
const l = Array.from(a.querySelectorAll(h + " tr")), f = Array.from(a.querySelectorAll(h + " th," + h + " td")), u = l.length;
|
|
653
|
+
if (u === 0 || f.length === 0) return;
|
|
654
654
|
let b = 0;
|
|
655
655
|
f.forEach((v) => {
|
|
656
656
|
b += v.colSpan || 1;
|
|
657
657
|
});
|
|
658
|
-
const
|
|
658
|
+
const g = Array.from(Array(u), () => Array(b).fill(null));
|
|
659
659
|
l.forEach((v) => {
|
|
660
660
|
const w = v.sectionRowIndex;
|
|
661
661
|
let A = 0;
|
|
662
662
|
Array.from(v.querySelectorAll("th,td")).forEach((m) => {
|
|
663
|
-
for (let O = 0; O <
|
|
664
|
-
if (
|
|
663
|
+
for (let O = 0; O < g[w].length; O++)
|
|
664
|
+
if (g[w][O] === null) {
|
|
665
665
|
A = O;
|
|
666
666
|
break;
|
|
667
667
|
}
|
|
668
668
|
const W = m.rowSpan || 1, R = m.colSpan || 1;
|
|
669
669
|
for (let O = 0; O < W; O++)
|
|
670
670
|
for (let yt = 0; yt < R; yt++)
|
|
671
|
-
w + O <
|
|
671
|
+
w + O < u && A + yt < b && (g[w + O][A + yt] = O === 0 && yt === 0 ? "1" : "0");
|
|
672
672
|
});
|
|
673
673
|
}), l.forEach((v) => {
|
|
674
674
|
const w = v.sectionRowIndex;
|
|
675
675
|
Array.from(v.querySelectorAll("th,td")).forEach((A) => {
|
|
676
|
-
for (let m = 0; m <
|
|
677
|
-
if (
|
|
678
|
-
A.dataset.col = m,
|
|
676
|
+
for (let m = 0; m < g[w].length; m++)
|
|
677
|
+
if (g[w][m] === "1") {
|
|
678
|
+
A.dataset.col = m, g[w][m] = "0";
|
|
679
679
|
break;
|
|
680
680
|
}
|
|
681
681
|
});
|
|
@@ -700,10 +700,10 @@ const pt = class pt extends HTMLElement {
|
|
|
700
700
|
d(this, et, null);
|
|
701
701
|
d(this, st);
|
|
702
702
|
E(this, "invalidate", /* @__PURE__ */ c(() => {
|
|
703
|
-
t(this, st).refresh();
|
|
703
|
+
L.log("sheet.invalidate()"), t(this, st).refresh();
|
|
704
704
|
}, "invalidate"));
|
|
705
705
|
E(this, "generate", /* @__PURE__ */ c((e) => {
|
|
706
|
-
if (!e) return;
|
|
706
|
+
if (L.log("sheet.generate()"), !e) return;
|
|
707
707
|
y(this, et, he.compile(e)), t(this, Vt).call(this), t(this, Yt).call(this);
|
|
708
708
|
const s = this.querySelector(".ng-container-body .ng-part-header"), r = this.querySelector(".ng-container-body .ng-part-footer"), n = this.querySelector(".ng-nodata-overlay");
|
|
709
709
|
s && n && (n.style.top = `${s.offsetHeight}px`), r && n && (n.style.bottom = `${r.offsetHeight}px`), t(this, st).initialize(), setTimeout(() => {
|
|
@@ -957,7 +957,7 @@ const pt = class pt extends HTMLElement {
|
|
|
957
957
|
t(this, Ut).call(this);
|
|
958
958
|
}
|
|
959
959
|
disconnectedCallback() {
|
|
960
|
-
this.innerHTML = "",
|
|
960
|
+
this.innerHTML = "", L.log("NineTableSheet destroyed.");
|
|
961
961
|
}
|
|
962
962
|
};
|
|
963
963
|
Ft = new WeakMap(), et = new WeakMap(), st = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), ct = new WeakMap(), Ut = new WeakMap(), Xt = new WeakMap(), c(pt, "NineTableSheet"), E(pt, "SCROLLBAR_SIZE", 16);
|
|
@@ -978,24 +978,24 @@ const _e = class _e extends HTMLElement {
|
|
|
978
978
|
d(this, Tt, /* @__PURE__ */ c((e, s = !1) => {
|
|
979
979
|
const r = /* @__PURE__ */ c(() => {
|
|
980
980
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
981
|
-
Array.from(this.querySelectorAll("nine-splitter")).forEach((
|
|
982
|
-
const b = f.filter((
|
|
983
|
-
b.length < 2 || b.forEach((
|
|
984
|
-
const v = parseInt(
|
|
981
|
+
Array.from(this.querySelectorAll("nine-splitter")).forEach((g) => g.style.setProperty("display", "none"));
|
|
982
|
+
const b = f.filter((g) => g.classList.contains("active"));
|
|
983
|
+
b.length < 2 || b.forEach((g) => {
|
|
984
|
+
const v = parseInt(g.getAttribute("data-index"), 10), w = this.querySelector(`nine-splitter[data-split-index="${v}"]`), A = f[v + 1];
|
|
985
985
|
w && A && A.classList.contains("active") && w.style.setProperty("display", "flex");
|
|
986
986
|
});
|
|
987
987
|
}, "updateSplitters"), n = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), a = n.querySelectorAll(".nine-tab-item"), h = o.querySelectorAll("nine-table-sheet");
|
|
988
988
|
if (!a[e]) return;
|
|
989
989
|
if (!s)
|
|
990
|
-
a.forEach((f,
|
|
991
|
-
f.classList.toggle("active",
|
|
992
|
-
}), h.forEach((f,
|
|
993
|
-
const b =
|
|
990
|
+
a.forEach((f, u) => {
|
|
991
|
+
f.classList.toggle("active", u === e);
|
|
992
|
+
}), h.forEach((f, u) => {
|
|
993
|
+
const b = u === e;
|
|
994
994
|
f.classList.toggle("active", b), f.style.flex = b ? "1 1 100%" : "";
|
|
995
995
|
});
|
|
996
996
|
else {
|
|
997
|
-
const f = a[e],
|
|
998
|
-
if (f.classList.contains("active") &&
|
|
997
|
+
const f = a[e], u = n.querySelectorAll(".nine-tab-item.active");
|
|
998
|
+
if (f.classList.contains("active") && u.length <= 1)
|
|
999
999
|
return;
|
|
1000
1000
|
f.classList.toggle("active");
|
|
1001
1001
|
const b = o.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
@@ -1033,8 +1033,8 @@ const Ne = class Ne {
|
|
|
1033
1033
|
}, "#applyAutoHeight"));
|
|
1034
1034
|
d(this, Gt, /* @__PURE__ */ c(() => {
|
|
1035
1035
|
const e = Array.from(t(this, M).children).filter((h) => h.tagName === "TABLE"), s = t(this, M).getAttribute("auto-height") === "true", r = e.length, n = e.map((h, l) => {
|
|
1036
|
-
const
|
|
1037
|
-
return
|
|
1036
|
+
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>` : "";
|
|
1037
|
+
return u + b;
|
|
1038
1038
|
}).join(""), o = e.map((h, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
1039
1039
|
t(this, M).shadowRoot.innerHTML = `
|
|
1040
1040
|
<style>
|
|
@@ -1186,7 +1186,7 @@ const We = class We {
|
|
|
1186
1186
|
}
|
|
1187
1187
|
};
|
|
1188
1188
|
Ct = new WeakMap(), ht = new WeakMap(), c(We, "ngRow");
|
|
1189
|
-
let
|
|
1189
|
+
let ge = We;
|
|
1190
1190
|
var _, k, N, dt, Jt, Y, Qt, it, Lt, te, ee, ft;
|
|
1191
1191
|
const z = class z {
|
|
1192
1192
|
constructor(i, e) {
|
|
@@ -1338,12 +1338,12 @@ E(z, "ROW_STATE", {
|
|
|
1338
1338
|
UPDATE: "UPDATE",
|
|
1339
1339
|
DELETE: "DELETE"
|
|
1340
1340
|
});
|
|
1341
|
-
let
|
|
1341
|
+
let ue = z;
|
|
1342
1342
|
var rt;
|
|
1343
1343
|
const Oe = class Oe {
|
|
1344
1344
|
constructor(i) {
|
|
1345
1345
|
d(this, rt);
|
|
1346
|
-
y(this, rt, i), this.row = new
|
|
1346
|
+
y(this, rt, i), this.row = new ge(this), this.data = new ue(t(this, rt), this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1347
1347
|
var e;
|
|
1348
1348
|
(e = t(this, rt).view) != null && e.redraw && t(this, rt).view.redraw();
|
|
1349
1349
|
}, this.setDataSource = (e) => {
|
|
@@ -1362,31 +1362,31 @@ const Oe = class Oe {
|
|
|
1362
1362
|
};
|
|
1363
1363
|
rt = new WeakMap(), c(Oe, "ngDataManager");
|
|
1364
1364
|
let be = Oe;
|
|
1365
|
-
var
|
|
1365
|
+
var gt, H, Ht, se;
|
|
1366
1366
|
const ze = class ze {
|
|
1367
1367
|
// π― μ΄μ { name: string, type: string } κ°μ²΄λ€μ λ°°μ΄λ‘ κ΄λ¦¬ν©λλ€.
|
|
1368
1368
|
constructor(i) {
|
|
1369
|
-
d(this,
|
|
1370
|
-
d(this,
|
|
1369
|
+
d(this, gt);
|
|
1370
|
+
d(this, H, []);
|
|
1371
1371
|
E(this, "add", /* @__PURE__ */ c((i, e = "string") => {
|
|
1372
1372
|
i.forEach((s) => {
|
|
1373
|
-
t(this,
|
|
1373
|
+
t(this, H).some((r) => r.name === s) || t(this, H).push({ name: s, type: e });
|
|
1374
1374
|
}), t(this, Ht).call(this);
|
|
1375
1375
|
}, "add"));
|
|
1376
1376
|
d(this, Ht, /* @__PURE__ */ c(() => {
|
|
1377
1377
|
const i = /* @__PURE__ */ new Map();
|
|
1378
|
-
t(this,
|
|
1378
|
+
t(this, H).forEach((e) => {
|
|
1379
1379
|
i.set(e.name, e.type);
|
|
1380
|
-
}), y(this,
|
|
1380
|
+
}), y(this, H, Array.from(i, ([e, s]) => ({ name: e, type: s }))), y(this, H, t(this, H).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, H).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1381
1381
|
}, "#adjust"));
|
|
1382
1382
|
d(this, se, /* @__PURE__ */ c(() => {
|
|
1383
|
-
y(this,
|
|
1384
|
-
const i = Array.from(t(this,
|
|
1383
|
+
y(this, H, []), L.log(t(this, gt).querySelectorAll("table"));
|
|
1384
|
+
const i = Array.from(t(this, gt).querySelectorAll("table"));
|
|
1385
1385
|
if (!(!i || i.length === 0)) {
|
|
1386
1386
|
for (const e of i)
|
|
1387
|
-
|
|
1387
|
+
L.log(e), $("[data-bind]", e).each((s, r) => {
|
|
1388
1388
|
const n = r.dataset.bind, o = r.getAttribute("data-type") || "string";
|
|
1389
|
-
n && t(this,
|
|
1389
|
+
n && t(this, H).push({ name: n, type: o });
|
|
1390
1390
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
1391
1391
|
$(`[${s}]`, e).each((r, n) => {
|
|
1392
1392
|
var o = n.getAttribute(s);
|
|
@@ -1403,7 +1403,7 @@ const ze = class ze {
|
|
|
1403
1403
|
if (a.trim() != "") {
|
|
1404
1404
|
const h = a.search(/[^_A-Za-z0-9]/g);
|
|
1405
1405
|
let l = "";
|
|
1406
|
-
h >= 0 ? l = a.substring(0, h) : o.startsWith("data.") && (l = a.replace("data.", "")), l && t(this,
|
|
1406
|
+
h >= 0 ? l = a.substring(0, h) : o.startsWith("data.") && (l = a.replace("data.", "")), l && t(this, H).push({ name: l, type: "string" });
|
|
1407
1407
|
}
|
|
1408
1408
|
});
|
|
1409
1409
|
});
|
|
@@ -1411,29 +1411,29 @@ const ze = class ze {
|
|
|
1411
1411
|
t(this, Ht).call(this);
|
|
1412
1412
|
}
|
|
1413
1413
|
}, "#init"));
|
|
1414
|
-
y(this,
|
|
1414
|
+
y(this, gt, i), t(this, se).call(this);
|
|
1415
1415
|
}
|
|
1416
1416
|
// π― κΈ°μ‘΄μ νλ μ΄λ¦λ§ μ°λ κ³³λ€κ³Όμ νΈνμ μν΄ μ΄λ¦ λ°°μ΄λ§ 리ν΄νλ λ©μλ μ μ§
|
|
1417
1417
|
get() {
|
|
1418
|
-
return t(this,
|
|
1418
|
+
return t(this, H).map((i) => i.name);
|
|
1419
1419
|
}
|
|
1420
1420
|
// π― λ΄λΆ κ°μ²΄ ν΅μ§Έλ‘ μ»κΈ°
|
|
1421
1421
|
getFields() {
|
|
1422
|
-
return t(this,
|
|
1422
|
+
return t(this, H);
|
|
1423
1423
|
}
|
|
1424
1424
|
// π― νΉμ νλμ λ°μ΄ν° νμ
μ‘°ν
|
|
1425
1425
|
getType(i) {
|
|
1426
|
-
const e = t(this,
|
|
1426
|
+
const e = t(this, H).find((s) => s.name === i);
|
|
1427
1427
|
return e ? e.type : "string";
|
|
1428
1428
|
}
|
|
1429
1429
|
indexOf(i) {
|
|
1430
|
-
return t(this,
|
|
1430
|
+
return t(this, H).findIndex((e) => e.name === i);
|
|
1431
1431
|
}
|
|
1432
1432
|
includes(i) {
|
|
1433
|
-
return t(this,
|
|
1433
|
+
return t(this, H).some((e) => e.name === i);
|
|
1434
1434
|
}
|
|
1435
1435
|
};
|
|
1436
|
-
|
|
1436
|
+
gt = new WeakMap(), H = new WeakMap(), Ht = new WeakMap(), se = new WeakMap(), c(ze, "ngFields");
|
|
1437
1437
|
let ye = ze;
|
|
1438
1438
|
var nt, ie, re;
|
|
1439
1439
|
const Be = class Be extends HTMLElement {
|
|
@@ -1443,7 +1443,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1443
1443
|
d(this, nt);
|
|
1444
1444
|
d(this, ie);
|
|
1445
1445
|
d(this, re, /* @__PURE__ */ c(() => {
|
|
1446
|
-
this.fields = new ye(this), y(this, ie, new fe(this)),
|
|
1446
|
+
this.fields = new ye(this), y(this, ie, new fe(this)), L.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1447
1447
|
}, "#init"));
|
|
1448
1448
|
this.attachShadow({ mode: "open" }), y(this, nt, new be(this));
|
|
1449
1449
|
}
|
|
@@ -1451,7 +1451,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1451
1451
|
t(this, re).call(this);
|
|
1452
1452
|
}
|
|
1453
1453
|
disconnectedCallback() {
|
|
1454
|
-
|
|
1454
|
+
L.log("NineTable disconnected.");
|
|
1455
1455
|
}
|
|
1456
1456
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1457
1457
|
get data() {
|
|
@@ -1528,8 +1528,8 @@ const De = class De extends me {
|
|
|
1528
1528
|
if (o > e) break;
|
|
1529
1529
|
var a = parseInt(t(this, p).dataset.row), h = a - 1, l = t(this, p).closest("tr").data, f = t(this, C).data.get(h);
|
|
1530
1530
|
t(this, p).dataset.matrixRow;
|
|
1531
|
-
var
|
|
1532
|
-
if (b !=
|
|
1531
|
+
var u = t(this, C).body.querySelector(`tbody.bindable [suppress="${o}"][data-matrix-row="${t(this, p).dataset.matrixRow}"]`), b = u.dataset.expr ? this.getExprValue(u.dataset.expr, l, a) : l[u.dataset.bind], g = u.dataset.expr ? this.getExprValue(u.dataset.expr, f, h) : f[u.dataset.bind];
|
|
1532
|
+
if (b != g) {
|
|
1533
1533
|
n = !0;
|
|
1534
1534
|
break;
|
|
1535
1535
|
}
|
|
@@ -1593,13 +1593,13 @@ const Pe = class Pe extends ve {
|
|
|
1593
1593
|
};
|
|
1594
1594
|
c(Pe, "EditableCellElement");
|
|
1595
1595
|
let xe = Pe;
|
|
1596
|
-
var $t, ot,
|
|
1596
|
+
var $t, ot, ut, bt, ne, U, Le;
|
|
1597
1597
|
const je = class je extends xe {
|
|
1598
1598
|
constructor() {
|
|
1599
1599
|
super();
|
|
1600
1600
|
d(this, $t);
|
|
1601
1601
|
d(this, ot);
|
|
1602
|
-
d(this,
|
|
1602
|
+
d(this, ut);
|
|
1603
1603
|
d(this, bt);
|
|
1604
1604
|
d(this, ne);
|
|
1605
1605
|
d(this, U);
|
|
@@ -1649,10 +1649,10 @@ const je = class je extends xe {
|
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
|
-
t(this,
|
|
1652
|
+
t(this, ut) && ninegrid.getByteLength(e.target.value) >= Number(t(this, ut)) && e.target.selectionStart == e.target.selectionEnd && e.preventDefault();
|
|
1653
1653
|
}
|
|
1654
1654
|
}, "#onKeyDown"));
|
|
1655
|
-
if (this.applyBaseStyle(), y(this, ot, this.getAttribute("type") || "text"), y(this,
|
|
1655
|
+
if (this.applyBaseStyle(), y(this, ot, this.getAttribute("type") || "text"), y(this, ut, this.getAttribute("maxbyte")), y(this, bt, this.getAttribute("min")), y(this, ne, this.getAttribute("max")), y(this, U, this.getAttribute("scale")), !["text", "number"].includes(t(this, ot))) throw `invalid type : ${t(this, ot)}`;
|
|
1656
1656
|
}
|
|
1657
1657
|
connectedCallback() {
|
|
1658
1658
|
for (var e = [], s = 0; s < this.attributes.length; s++)
|
|
@@ -1665,7 +1665,7 @@ const je = class je extends xe {
|
|
|
1665
1665
|
`, super.connectedCallback(), y(this, $t, this.querySelector("input"));
|
|
1666
1666
|
}
|
|
1667
1667
|
};
|
|
1668
|
-
$t = new WeakMap(), ot = new WeakMap(),
|
|
1668
|
+
$t = new WeakMap(), ot = new WeakMap(), ut = new WeakMap(), bt = new WeakMap(), ne = new WeakMap(), U = new WeakMap(), Le = new WeakMap(), c(je, "CellInputText");
|
|
1669
1669
|
let we = je;
|
|
1670
1670
|
customElements.get("cell-input-text");
|
|
1671
1671
|
customElements.get("cell-input") || customElements.define("cell-input", we);
|