@ninebone/table 0.0.751 β 0.0.753
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 +93 -100
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +3 -3
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -22,13 +22,13 @@ const Xe = class Xe extends ms.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
h(Xe, "Trace");
|
|
24
24
|
let we = Xe;
|
|
25
|
-
const
|
|
26
|
-
var B,
|
|
25
|
+
const S = new we();
|
|
26
|
+
var B, X, A, tt, et, st, Vt, nt, Ut;
|
|
27
27
|
const Ke = class Ke extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
d(this, B);
|
|
31
|
-
d(this,
|
|
31
|
+
d(this, X, !1);
|
|
32
32
|
d(this, A);
|
|
33
33
|
d(this, tt);
|
|
34
34
|
d(this, et);
|
|
@@ -41,7 +41,7 @@ const Ke = class Ke extends HTMLElement {
|
|
|
41
41
|
})), t(this, st).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
E(this, "refresh", /* @__PURE__ */ h(() => {
|
|
44
|
-
if (!t(this, B) || !t(this, A) || t(this,
|
|
44
|
+
if (!t(this, B) || !t(this, A) || t(this, X)) return;
|
|
45
45
|
const e = t(this, A).container, n = e.querySelector("table");
|
|
46
46
|
if (!n) return;
|
|
47
47
|
const r = t(this, A).track, o = t(this, A).thumb, i = t(this, B).querySelector(".ng-container-bottom"), a = e.clientWidth, c = n.scrollWidth;
|
|
@@ -99,13 +99,13 @@ const Ke = class Ke extends HTMLElement {
|
|
|
99
99
|
t(this, nt).call(this, r.clientX - o.left - i / 2);
|
|
100
100
|
}), t(this, A).thumb.addEventListener("mousedown", (r) => {
|
|
101
101
|
if (r.button !== 0) return;
|
|
102
|
-
r.stopPropagation(), r.preventDefault(), p(this,
|
|
102
|
+
r.stopPropagation(), r.preventDefault(), p(this, X, !0), this.shiftX = r.clientX - t(this, A).thumb.getBoundingClientRect().left;
|
|
103
103
|
const o = /* @__PURE__ */ h((a) => {
|
|
104
|
-
if (!t(this,
|
|
104
|
+
if (!t(this, X)) return;
|
|
105
105
|
const c = t(this, A).track.getBoundingClientRect();
|
|
106
106
|
t(this, nt).call(this, a.clientX - c.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), i = /* @__PURE__ */ h(() => {
|
|
108
|
-
p(this,
|
|
108
|
+
p(this, X, !1), n(), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", i), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
110
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", i);
|
|
111
111
|
});
|
|
@@ -189,7 +189,7 @@ const Ke = class Ke extends HTMLElement {
|
|
|
189
189
|
left: this.querySelector(".ng-scroll-left"),
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), n.addEventListener("scroll", () => {
|
|
192
|
-
t(this,
|
|
192
|
+
t(this, X) || this.refresh();
|
|
193
193
|
}), t(this, Ut).call(this), t(this, Vt).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
@@ -198,7 +198,7 @@ const Ke = class Ke extends HTMLElement {
|
|
|
198
198
|
t(this, st) && t(this, st).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
B = new WeakMap(),
|
|
201
|
+
B = new WeakMap(), X = new WeakMap(), A = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), st = new WeakMap(), Vt = new WeakMap(), nt = new WeakMap(), Ut = new WeakMap(), h(Ke, "NineTableHScrollBar");
|
|
202
202
|
let Se = Ke;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Se);
|
|
204
204
|
var rt, ot, bt, C, Tt, Ct, Xt;
|
|
@@ -212,7 +212,7 @@ const Ge = class Ge extends HTMLElement {
|
|
|
212
212
|
d(this, Tt, 0);
|
|
213
213
|
d(this, Ct, 0);
|
|
214
214
|
E(this, "refresh", /* @__PURE__ */ h(() => {
|
|
215
|
-
if (
|
|
215
|
+
if (S.log("vscrollbar.refresh"), !t(this, rt) || !t(this, C)) return;
|
|
216
216
|
const e = t(this, C).container, n = t(this, C).track, r = t(this, C).thumb, o = e.clientHeight, i = t(this, rt).data.length, a = t(this, ot).getRowHeight(), c = i * a;
|
|
217
217
|
if (c <= o || i === 0) {
|
|
218
218
|
this.style.display = "none";
|
|
@@ -224,14 +224,14 @@ const Ge = class Ge extends HTMLElement {
|
|
|
224
224
|
const f = Math.max(Math.min(l * (o / c), l), 20);
|
|
225
225
|
r.style.height = `${f}px`;
|
|
226
226
|
const u = e.scrollTop, b = Math.max(c - o, 1);
|
|
227
|
-
|
|
227
|
+
S.log(e, u, b);
|
|
228
228
|
let g = 0;
|
|
229
229
|
b > 0 && (g = u / b * (l - f));
|
|
230
230
|
const y = l - f;
|
|
231
231
|
g < 0 && (g = 0), g > y && (g = y), r.style.top = `${g}px`, t(this, C).top.disabled = u <= 0, t(this, C).bottom.disabled = u >= b - 1;
|
|
232
232
|
}, "refresh"));
|
|
233
233
|
d(this, Xt, /* @__PURE__ */ h(() => {
|
|
234
|
-
|
|
234
|
+
S.log("nine-table-vscrollbar.#init");
|
|
235
235
|
const e = t(this, C).container, n = /* @__PURE__ */ h(() => {
|
|
236
236
|
const o = (t(this, rt).data.get() || []).length, i = t(this, ot).getRowHeight();
|
|
237
237
|
return o * i;
|
|
@@ -243,8 +243,8 @@ const Ge = class Ge extends HTMLElement {
|
|
|
243
243
|
if (!t(this, bt)) return;
|
|
244
244
|
const c = t(this, C).track.getBoundingClientRect(), l = t(this, C).thumb.clientHeight, u = c.height - l, b = a.clientY - t(this, Tt), g = e.clientHeight, y = n(), v = Math.max(y - g, 1);
|
|
245
245
|
if (u > 0 && v > 0) {
|
|
246
|
-
const
|
|
247
|
-
let m = t(this, Ct) +
|
|
246
|
+
const w = b / u * v;
|
|
247
|
+
let m = t(this, Ct) + w;
|
|
248
248
|
const I = Math.max(0, y - g);
|
|
249
249
|
m < 0 && (m = 0), m > I && (m = I), e.scrollTop = m;
|
|
250
250
|
}
|
|
@@ -353,7 +353,7 @@ const Ge = class Ge extends HTMLElement {
|
|
|
353
353
|
rt = new WeakMap(), ot = new WeakMap(), bt = new WeakMap(), C = new WeakMap(), Tt = new WeakMap(), Ct = new WeakMap(), Xt = new WeakMap(), h(Ge, "NineTableVScrollBar");
|
|
354
354
|
let Re = Ge;
|
|
355
355
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", Re);
|
|
356
|
-
var j, R, it, P, D,
|
|
356
|
+
var j, R, it, P, D, K, at, kt, ze, We, Kt, Gt, Lt, It, Ht, Zt, Jt, Mt, Be, pt, $t, Qt;
|
|
357
357
|
const Ze = class Ze {
|
|
358
358
|
constructor(s) {
|
|
359
359
|
d(this, j);
|
|
@@ -361,7 +361,7 @@ const Ze = class Ze {
|
|
|
361
361
|
d(this, it);
|
|
362
362
|
d(this, P, /* @__PURE__ */ new Map());
|
|
363
363
|
d(this, D, null);
|
|
364
|
-
d(this,
|
|
364
|
+
d(this, K, null);
|
|
365
365
|
d(this, at, 0);
|
|
366
366
|
d(this, kt, 40);
|
|
367
367
|
d(this, ze, !1);
|
|
@@ -370,12 +370,12 @@ const Ze = class Ze {
|
|
|
370
370
|
d(this, Kt, 3);
|
|
371
371
|
E(this, "refresh", /* @__PURE__ */ h(() => {
|
|
372
372
|
var e;
|
|
373
|
-
|
|
373
|
+
S.log("rowManager.refresh");
|
|
374
374
|
const s = t(this, R).querySelector(".ng-container-body .ng-part-body");
|
|
375
375
|
s && (t(this, Lt).call(this), t(this, It).call(this), t(this, pt).call(this, s.scrollTop), (e = t(this, R).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
376
376
|
}, "refresh"));
|
|
377
377
|
E(this, "initialize", /* @__PURE__ */ h(() => {
|
|
378
|
-
|
|
378
|
+
S.log("rowManager.initialize"), p(this, it, {
|
|
379
379
|
scrollTables: t(this, R).querySelectorAll(".ng-part-body table"),
|
|
380
380
|
firstTr: t(this, R).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")
|
|
381
381
|
}), p(this, D, null), t(this, P).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
@@ -401,13 +401,13 @@ const Ze = class Ze {
|
|
|
401
401
|
}, "handleContainerScroll");
|
|
402
402
|
[s, e, n].forEach((c) => {
|
|
403
403
|
c == null || c.addEventListener("scroll", (l) => {
|
|
404
|
-
|
|
404
|
+
S.log(l), S.log("rowManager.scroll event"), a(c);
|
|
405
405
|
});
|
|
406
406
|
});
|
|
407
407
|
}
|
|
408
408
|
}, "initialize"));
|
|
409
409
|
d(this, Gt, /* @__PURE__ */ h((s, e) => {
|
|
410
|
-
|
|
410
|
+
S.log("rowManager.#renderRows");
|
|
411
411
|
const n = t(this, P).get(e);
|
|
412
412
|
if (!n || n.length === 0) return;
|
|
413
413
|
const r = s.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -424,11 +424,11 @@ const Ze = class Ze {
|
|
|
424
424
|
if (t(this, D) !== null && t(this, D) > 0)
|
|
425
425
|
return t(this, D);
|
|
426
426
|
const s = t(this, R).querySelector(".ng-container-body .ng-part-body");
|
|
427
|
-
|
|
427
|
+
S.log("rowManager.#measureAndCacheHeight");
|
|
428
428
|
const e = t(this, P).get(".ng-container-body");
|
|
429
429
|
if (!e || e.length === 0) throw new Error("invalid dom");
|
|
430
430
|
const n = s.querySelector("tbody.bindable-tbody");
|
|
431
|
-
if (
|
|
431
|
+
if (S.log(n), !n) throw new Error("invalid dom");
|
|
432
432
|
n.querySelectorAll("tr:not(.nodata)").forEach((b) => b.remove());
|
|
433
433
|
const r = n.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
434
434
|
e.forEach((b) => {
|
|
@@ -448,9 +448,9 @@ const Ze = class Ze {
|
|
|
448
448
|
}), u.forEach((b) => b.remove()), i.style.display = a, i.style.visibility = c, i.style.position = l, f <= 0 ? -1 : (p(this, D, f), t(this, Ht).call(this), t(this, D));
|
|
449
449
|
}, "#measureAndCacheHeight"));
|
|
450
450
|
d(this, It, /* @__PURE__ */ h(() => {
|
|
451
|
-
|
|
451
|
+
S.log("rowManager.#updateVirtualScrollHeight");
|
|
452
452
|
const e = (t(this, j).data.get() || []).length, n = t(this, D), r = e * n;
|
|
453
|
-
|
|
453
|
+
S.log("π [VirtualHeight]", { totalCount: e, rowHeight: n, totalVirtualHeight: r }), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
454
454
|
const i = t(this, R).querySelector(o);
|
|
455
455
|
if (!i) return;
|
|
456
456
|
const a = i.querySelector(".ng-part-body .ng-virtual-spacer");
|
|
@@ -467,8 +467,8 @@ const Ze = class Ze {
|
|
|
467
467
|
var a, c, l, f, u, b;
|
|
468
468
|
const s = t(this, R).querySelector(".ng-container-left .ng-part-body table"), e = t(this, R).querySelector(".ng-container-body .ng-part-body table"), n = t(this, R).querySelector(".ng-container-right .ng-part-body table");
|
|
469
469
|
if (e) {
|
|
470
|
-
const g = s ? Array.from(s.querySelectorAll("tbody tr")) : [], y = Array.from(e.querySelectorAll("tbody tr")), v = n ? Array.from(n.querySelectorAll("tbody tr")) : [],
|
|
471
|
-
for (let m = 0; m <
|
|
470
|
+
const g = s ? Array.from(s.querySelectorAll("tbody tr")) : [], y = Array.from(e.querySelectorAll("tbody tr")), v = n ? Array.from(n.querySelectorAll("tbody tr")) : [], w = Math.max(g.length, y.length, v.length);
|
|
471
|
+
for (let m = 0; m < w; m++) {
|
|
472
472
|
const I = [
|
|
473
473
|
((a = g[m]) == null ? void 0 : a.getBoundingClientRect().height) || 0,
|
|
474
474
|
((c = y[m]) == null ? void 0 : c.getBoundingClientRect().height) || 0,
|
|
@@ -479,8 +479,8 @@ const Ze = class Ze {
|
|
|
479
479
|
}
|
|
480
480
|
const r = t(this, R).querySelector(".ng-container-left .ng-part-footer table"), o = t(this, R).querySelector(".ng-container-body .ng-part-footer table"), i = t(this, R).querySelector(".ng-container-right .ng-part-footer table");
|
|
481
481
|
if (o) {
|
|
482
|
-
const g = r ? Array.from(r.querySelectorAll("tfoot tr")) : [], y = Array.from(o.querySelectorAll("tfoot tr")), v = i ? Array.from(i.querySelectorAll("tfoot tr")) : [],
|
|
483
|
-
for (let m = 0; m <
|
|
482
|
+
const g = r ? Array.from(r.querySelectorAll("tfoot tr")) : [], y = Array.from(o.querySelectorAll("tfoot tr")), v = i ? Array.from(i.querySelectorAll("tfoot tr")) : [], w = Math.max(g.length, y.length, v.length);
|
|
483
|
+
for (let m = 0; m < w; m++) {
|
|
484
484
|
const I = [
|
|
485
485
|
((f = g[m]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
486
486
|
((u = y[m]) == null ? void 0 : u.getBoundingClientRect().height) || 0,
|
|
@@ -491,7 +491,7 @@ const Ze = class Ze {
|
|
|
491
491
|
}
|
|
492
492
|
}, "#syncRowHeights"));
|
|
493
493
|
d(this, Jt, /* @__PURE__ */ h(() => {
|
|
494
|
-
!t(this, R) || !(t(this, R) instanceof HTMLElement) || (p(this,
|
|
494
|
+
!t(this, R) || !(t(this, R) instanceof HTMLElement) || (p(this, K, new ResizeObserver((s) => {
|
|
495
495
|
for (const e of s) {
|
|
496
496
|
const n = e.target;
|
|
497
497
|
if (!n.classList.contains("active")) continue;
|
|
@@ -504,10 +504,10 @@ const Ze = class Ze {
|
|
|
504
504
|
t(this, at) !== c && (p(this, at, c), t(this, Ht).call(this), t(this, D) !== null && (t(this, Mt).call(this), this.refresh()));
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
})), t(this,
|
|
507
|
+
})), t(this, K).observe(t(this, R)));
|
|
508
508
|
}, "#initResizeObserver"));
|
|
509
509
|
d(this, Mt, /* @__PURE__ */ h(() => {
|
|
510
|
-
|
|
510
|
+
S.log("rowManager.#renderAllContainers"), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((s) => {
|
|
511
511
|
const e = t(this, R).querySelector(s);
|
|
512
512
|
e && e.querySelector(".ng-part-body tbody.bindable-tbody") && t(this, Gt).call(this, e, s);
|
|
513
513
|
}), t(this, Qt).call(this), t(this, Zt).call(this);
|
|
@@ -538,14 +538,14 @@ const Ze = class Ze {
|
|
|
538
538
|
const n = t(this, j).data.length;
|
|
539
539
|
if (n === 0) return;
|
|
540
540
|
const r = ((u = t(this, P).get(".ng-container-body")) == null ? void 0 : u.length) || 1, o = t(this, R).querySelector(".ng-container-body .ng-part-body");
|
|
541
|
-
|
|
541
|
+
S.log("bodyContainer.clientHeight", o.clientHeight);
|
|
542
542
|
const i = Math.max(0, n - Math.floor(o.clientHeight / e)), a = Math.min(i, Math.max(0, Math.floor(s / e)));
|
|
543
543
|
let c = Math.floor(a * e);
|
|
544
|
-
|
|
544
|
+
S.log(`π [Scroll Calc] maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`), a === i && S.log(`π [Scroll Inspect] scrollTop: ${s}, rowHeight: ${e}, maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`);
|
|
545
545
|
const l = t(this, it).firstTr, f = l && l.dataset.row !== void 0 ? parseInt(l.dataset.row, 10) : -1;
|
|
546
546
|
(b = t(this, it)) == null || b.scrollTables.forEach((g) => {
|
|
547
547
|
g.style.transform = `translate3d(0, ${c}px, 0)`;
|
|
548
|
-
}), f !== a && (
|
|
548
|
+
}), f !== a && (S.log(`π [Row Bind Trigger] currentStartIndex(${f}) !== startIndex(${a})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((g) => {
|
|
549
549
|
const y = t(this, R).querySelector(g);
|
|
550
550
|
if (!y) return;
|
|
551
551
|
const v = y.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -584,7 +584,7 @@ const Ze = class Ze {
|
|
|
584
584
|
}, "#bindRowData"));
|
|
585
585
|
d(this, Qt, /* @__PURE__ */ h(() => {
|
|
586
586
|
var c, l, f;
|
|
587
|
-
|
|
587
|
+
S.log("rowManager.#syncHeaderHeights");
|
|
588
588
|
const s = t(this, R).querySelector(".ng-container-left .ng-part-header table"), e = t(this, R).querySelector(".ng-container-body .ng-part-header table"), n = t(this, R).querySelector(".ng-container-right .ng-part-header table");
|
|
589
589
|
if (!e) return;
|
|
590
590
|
const r = s ? Array.from(s.querySelectorAll("tr")) : [], o = Array.from(e.querySelectorAll("tr")), i = n ? Array.from(n.querySelectorAll("tr")) : [], a = Math.max(r.length, o.length, i.length);
|
|
@@ -598,7 +598,7 @@ const Ze = class Ze {
|
|
|
598
598
|
}
|
|
599
599
|
}, "#syncHeaderHeights"));
|
|
600
600
|
E(this, "destroy", /* @__PURE__ */ h(() => {
|
|
601
|
-
t(this,
|
|
601
|
+
t(this, K) && (t(this, K).disconnect(), p(this, K, null));
|
|
602
602
|
}, "destroy"));
|
|
603
603
|
p(this, j, s.getRootNode().host), p(this, R, s), t(this, Jt).call(this);
|
|
604
604
|
}
|
|
@@ -610,7 +610,7 @@ const Ze = class Ze {
|
|
|
610
610
|
return ((e = t(this, P).get(s)) == null ? void 0 : e.length) || 1;
|
|
611
611
|
}
|
|
612
612
|
};
|
|
613
|
-
j = new WeakMap(), R = new WeakMap(), it = new WeakMap(), P = new WeakMap(), D = new WeakMap(),
|
|
613
|
+
j = new WeakMap(), R = new WeakMap(), it = new WeakMap(), P = new WeakMap(), D = new WeakMap(), K = new WeakMap(), at = new WeakMap(), kt = new WeakMap(), ze = new WeakMap(), We = new WeakMap(), Kt = new WeakMap(), Gt = new WeakMap(), Lt = new WeakMap(), It = new WeakMap(), Ht = new WeakMap(), Zt = new WeakMap(), Jt = new WeakMap(), Mt = new WeakMap(), Be = new WeakMap(), pt = new WeakMap(), $t = new WeakMap(), Qt = new WeakMap(), h(Ze, "RowManager");
|
|
614
614
|
let Ae = Ze;
|
|
615
615
|
const te = class te {
|
|
616
616
|
/**
|
|
@@ -630,8 +630,8 @@ const te = class te {
|
|
|
630
630
|
if (l.children.length > 0 && l.firstElementChild.tagName.includes("-")) return;
|
|
631
631
|
let u = `cell-${f}`;
|
|
632
632
|
const b = l.getAttribute("data-bind"), g = l.getAttribute("data-expr"), y = l.getAttribute("maxbyte"), v = l.getAttribute("type");
|
|
633
|
-
let
|
|
634
|
-
b &&
|
|
633
|
+
let w = [];
|
|
634
|
+
b && w.push(`data-bind="${b}"`), g && w.push(`data-expr="${g}"`), y && w.push(`maxbyte="${y}"`), v && w.push(`type="${v}"`), l.innerHTML = `<${u} ${w.join(" ")}></${u}>`;
|
|
635
635
|
}), a.querySelectorAll("tbody td, tfoot td").forEach((l) => {
|
|
636
636
|
l.setAttribute("tabindex", "0");
|
|
637
637
|
});
|
|
@@ -659,24 +659,24 @@ const te = class te {
|
|
|
659
659
|
const g = Array.from(Array(u), () => Array(b).fill(null));
|
|
660
660
|
l.forEach((y) => {
|
|
661
661
|
const v = y.sectionRowIndex;
|
|
662
|
-
let
|
|
662
|
+
let w = 0;
|
|
663
663
|
Array.from(y.querySelectorAll("th,td")).forEach((m) => {
|
|
664
664
|
for (let H = 0; H < g[v].length; H++)
|
|
665
665
|
if (g[v][H] === null) {
|
|
666
|
-
|
|
666
|
+
w = H;
|
|
667
667
|
break;
|
|
668
668
|
}
|
|
669
669
|
const I = m.rowSpan || 1, T = m.colSpan || 1;
|
|
670
670
|
for (let H = 0; H < I; H++)
|
|
671
671
|
for (let F = 0; F < T; F++)
|
|
672
|
-
v + H < u &&
|
|
672
|
+
v + H < u && w + F < b && (g[v + H][w + F] = H === 0 && F === 0 ? "1" : "0");
|
|
673
673
|
});
|
|
674
674
|
}), l.forEach((y) => {
|
|
675
675
|
const v = y.sectionRowIndex;
|
|
676
|
-
Array.from(y.querySelectorAll("th,td")).forEach((
|
|
676
|
+
Array.from(y.querySelectorAll("th,td")).forEach((w) => {
|
|
677
677
|
for (let m = 0; m < g[v].length; m++)
|
|
678
678
|
if (g[v][m] === "1") {
|
|
679
|
-
|
|
679
|
+
w.dataset.col = m, g[v][m] = "0";
|
|
680
680
|
break;
|
|
681
681
|
}
|
|
682
682
|
});
|
|
@@ -693,15 +693,15 @@ const te = class te {
|
|
|
693
693
|
};
|
|
694
694
|
h(te, "TableCompiler");
|
|
695
695
|
let Ee = te;
|
|
696
|
-
var _, Y,
|
|
696
|
+
var _, Y, V, At, bs;
|
|
697
697
|
const Je = class Je {
|
|
698
698
|
constructor(s) {
|
|
699
|
-
d(this,
|
|
699
|
+
d(this, V);
|
|
700
700
|
d(this, _);
|
|
701
701
|
d(this, Y, { startRow: -1, startCol: -1, endRow: -1, endCol: -1 });
|
|
702
702
|
E(this, "render", /* @__PURE__ */ h(() => {
|
|
703
703
|
const { startRow: s, startCol: e, endRow: n, endCol: r } = t(this, Y);
|
|
704
|
-
|
|
704
|
+
S.log("π¨ [CellSelection.render] Rendering range ->", t(this, Y));
|
|
705
705
|
const o = t(this, _).querySelectorAll(
|
|
706
706
|
".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"
|
|
707
707
|
);
|
|
@@ -710,35 +710,32 @@ const Je = class Je {
|
|
|
710
710
|
c.classList.remove("selected", "selected-top", "selected-bottom", "selected-left", "selected-right");
|
|
711
711
|
});
|
|
712
712
|
}), s < 0 || e < 0) {
|
|
713
|
-
|
|
713
|
+
S.log("β οΈ [CellSelection.render] Range is invalid (< 0), skipping render.");
|
|
714
714
|
return;
|
|
715
715
|
}
|
|
716
716
|
let i = 0;
|
|
717
717
|
o.forEach((a) => {
|
|
718
718
|
a.querySelectorAll("tbody tr").forEach((c) => {
|
|
719
|
-
const { matrixRow: l } = Q(this,
|
|
719
|
+
const { matrixRow: l } = Q(this, V, At).call(this, c);
|
|
720
720
|
l < 0 || c.querySelectorAll("td, th").forEach((f) => {
|
|
721
721
|
const u = parseInt(f.dataset.col, 10);
|
|
722
722
|
if (isNaN(u)) return;
|
|
723
723
|
const b = parseInt(f.rowSpan || 1, 10), g = parseInt(f.colSpan || 1, 10), y = l + b - 1, v = u + g - 1;
|
|
724
|
-
|
|
725
|
-
i++, f.classList.add("selected");
|
|
726
|
-
const m = s === n && e === r;
|
|
727
|
-
w.log(f, s, e, n, r), m ? f.classList.add("selected-top", "selected-bottom", "selected-left", "selected-right") : (l <= s && f.classList.add("selected-top"), y >= n && f.classList.add("selected-bottom"), u <= e && f.classList.add("selected-left"), v >= r && f.classList.add("selected-right"));
|
|
724
|
+
y >= s && l <= n && v >= e && u <= r && (i++, f.classList.add("selected"), S.log(f, s, e, n, r), l <= s && f.classList.add("selected-top"), y >= n && f.classList.add("selected-bottom"), u <= e && f.classList.add("selected-left"), v >= r && f.classList.add("selected-right"));
|
|
728
725
|
});
|
|
729
726
|
});
|
|
730
|
-
}),
|
|
727
|
+
}), S.log(`β¨ [CellSelection.render] Total rendered cells marked: ${i}`);
|
|
731
728
|
}, "render"));
|
|
732
|
-
p(this, _, s), Q(this,
|
|
729
|
+
p(this, _, s), Q(this, V, bs).call(this), t(this, _).querySelectorAll(
|
|
733
730
|
".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"
|
|
734
731
|
).forEach((n) => {
|
|
735
732
|
n.addEventListener("scroll", () => {
|
|
736
733
|
t(this, Y).startRow >= 0 && t(this, Y).startCol >= 0 && this.render();
|
|
737
734
|
});
|
|
738
|
-
}),
|
|
735
|
+
}), S.log("π― [CellSelection] Initialized");
|
|
739
736
|
}
|
|
740
737
|
setRange(s, e, n, r) {
|
|
741
|
-
|
|
738
|
+
S.log(`π [CellSelection.setRange] Input -> startRow: ${s}, startCol: ${e}, endRow: ${n}, endCol: ${r}`);
|
|
742
739
|
let o = Math.min(s, n), i = Math.max(s, n), a = Math.min(e, r), c = Math.max(e, r);
|
|
743
740
|
const l = t(this, _).querySelectorAll(
|
|
744
741
|
".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"
|
|
@@ -748,22 +745,22 @@ const Je = class Je {
|
|
|
748
745
|
f = !1, u++, l.forEach((b) => {
|
|
749
746
|
b.querySelectorAll("tbody tr").forEach((g) => {
|
|
750
747
|
if (g.classList.contains("nodata")) return;
|
|
751
|
-
const { matrixRow: y } = Q(this,
|
|
748
|
+
const { matrixRow: y } = Q(this, V, At).call(this, g);
|
|
752
749
|
y < 0 || g.querySelectorAll("td, th").forEach((v) => {
|
|
753
|
-
const
|
|
754
|
-
if (isNaN(
|
|
755
|
-
const m = parseInt(v.rowSpan || 1, 10), I = parseInt(v.colSpan || 1, 10), T = y + m - 1, H =
|
|
756
|
-
if (T >= o && y <= i && H >= a &&
|
|
757
|
-
const
|
|
758
|
-
(
|
|
750
|
+
const w = parseInt(v.dataset.col, 10);
|
|
751
|
+
if (isNaN(w)) return;
|
|
752
|
+
const m = parseInt(v.rowSpan || 1, 10), I = parseInt(v.colSpan || 1, 10), T = y + m - 1, H = w + I - 1;
|
|
753
|
+
if (T >= o && y <= i && H >= a && w <= c) {
|
|
754
|
+
const U = Math.min(o, y), cs = Math.max(i, T), hs = Math.min(a, w), ds = Math.max(c, H);
|
|
755
|
+
(U !== o || cs !== i || hs !== a || ds !== c) && (o = U, i = cs, a = hs, c = ds, f = !0);
|
|
759
756
|
}
|
|
760
757
|
});
|
|
761
758
|
});
|
|
762
759
|
});
|
|
763
|
-
p(this, Y, { startRow: o, startCol: a, endRow: i, endCol: c }),
|
|
760
|
+
p(this, Y, { startRow: o, startCol: a, endRow: i, endCol: c }), S.log("π¦ [CellSelection.setRange] Final Range ->", t(this, Y)), this.render();
|
|
764
761
|
}
|
|
765
762
|
};
|
|
766
|
-
_ = new WeakMap(), Y = new WeakMap(),
|
|
763
|
+
_ = new WeakMap(), Y = new WeakMap(), V = new WeakSet(), At = /* @__PURE__ */ h(function(s) {
|
|
767
764
|
if (!s || s.classList.contains("nodata")) return { dataRow: -1, subRowIndex: -1, matrixRow: -1 };
|
|
768
765
|
const e = parseInt(s.dataset.row, 10);
|
|
769
766
|
if (isNaN(e)) return { dataRow: -1, subRowIndex: -1, matrixRow: -1 };
|
|
@@ -772,7 +769,7 @@ _ = new WeakMap(), Y = new WeakMap(), U = new WeakSet(), At = /* @__PURE__ */ h(
|
|
|
772
769
|
}, "#getMatrixRow"), bs = /* @__PURE__ */ h(function() {
|
|
773
770
|
const s = t(this, _).querySelector(".ng-container-top");
|
|
774
771
|
if (!s) {
|
|
775
|
-
|
|
772
|
+
S.log("β [CellSelection] .ng-container-top not found!");
|
|
776
773
|
return;
|
|
777
774
|
}
|
|
778
775
|
s.addEventListener("mousedown", (e) => {
|
|
@@ -780,46 +777,46 @@ _ = new WeakMap(), Y = new WeakMap(), U = new WeakSet(), At = /* @__PURE__ */ h(
|
|
|
780
777
|
const n = e.target.closest("td, th");
|
|
781
778
|
if (!n || n.dataset.row === void 0 || n.dataset.col === void 0 || n.closest("tr").classList.contains("nodata")) return;
|
|
782
779
|
t(this, _).style.userSelect = "none", t(this, _).style.webkitUserSelect = "none";
|
|
783
|
-
const r = n.closest("tr"), { matrixRow: o } = Q(this,
|
|
780
|
+
const r = n.closest("tr"), { matrixRow: o } = Q(this, V, At).call(this, r), i = parseInt(n.dataset.col, 10);
|
|
784
781
|
if (o < 0) {
|
|
785
782
|
t(this, _).style.userSelect = "", t(this, _).style.webkitUserSelect = "";
|
|
786
783
|
return;
|
|
787
784
|
}
|
|
788
|
-
|
|
785
|
+
S.log(`π±οΈ [MouseDown Success] startRow: ${o}, startCol: ${i}`), this.setRange(o, i, o, i);
|
|
789
786
|
const a = /* @__PURE__ */ h((l) => {
|
|
790
787
|
const f = document.elementFromPoint(l.clientX, l.clientY);
|
|
791
788
|
let u = f == null ? void 0 : f.closest("td, th");
|
|
792
789
|
if (!u || !t(this, _).contains(u)) {
|
|
793
790
|
const v = t(this, _).querySelectorAll(".ng-part-body tbody tr:not(.nodata) td, .ng-part-body tbody tr:not(.nodata) th");
|
|
794
|
-
for (const
|
|
795
|
-
const m =
|
|
791
|
+
for (const w of v) {
|
|
792
|
+
const m = w.getBoundingClientRect();
|
|
796
793
|
if (l.clientX >= m.left && l.clientX <= m.right && l.clientY >= m.top && l.clientY <= m.bottom) {
|
|
797
|
-
u =
|
|
794
|
+
u = w;
|
|
798
795
|
break;
|
|
799
796
|
}
|
|
800
797
|
}
|
|
801
798
|
}
|
|
802
799
|
if (!u || u.dataset.row === void 0 || u.dataset.col === void 0 || u.closest("tr").classList.contains("nodata")) return;
|
|
803
|
-
const b = u.closest("tr"), { matrixRow: g } = Q(this,
|
|
800
|
+
const b = u.closest("tr"), { matrixRow: g } = Q(this, V, At).call(this, b), y = parseInt(u.dataset.col, 10);
|
|
804
801
|
g < 0 || this.setRange(o, i, g, y);
|
|
805
802
|
}, "onMouseMove"), c = /* @__PURE__ */ h(() => {
|
|
806
|
-
|
|
803
|
+
S.log("π±οΈ [MouseUp] Drag ended."), t(this, _).style.userSelect = "", t(this, _).style.webkitUserSelect = "", document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", c);
|
|
807
804
|
}, "onMouseUp");
|
|
808
805
|
document.addEventListener("mousemove", a), document.addEventListener("mouseup", c);
|
|
809
806
|
});
|
|
810
807
|
}, "#initEvents"), h(Je, "CellSelection");
|
|
811
808
|
let qe = Je;
|
|
812
|
-
var
|
|
809
|
+
var G, lt, ee, se, _t, ne, ps;
|
|
813
810
|
const Qe = class Qe {
|
|
814
811
|
// π― ν€λ³΄λ λ€λΉκ²μ΄μ
μ€ μ€ν¬λ‘€ ν λ°©μ§ νλκ·Έ
|
|
815
812
|
constructor(s) {
|
|
816
813
|
d(this, ne);
|
|
817
|
-
d(this,
|
|
814
|
+
d(this, G);
|
|
818
815
|
d(this, lt, null);
|
|
819
816
|
d(this, ee, -1);
|
|
820
817
|
d(this, se, -1);
|
|
821
818
|
d(this, _t, !1);
|
|
822
|
-
p(this,
|
|
819
|
+
p(this, G, s), Q(this, ne, ps).call(this), S.log("π― [CellNavigation] Initialized");
|
|
823
820
|
}
|
|
824
821
|
get currentCell() {
|
|
825
822
|
return t(this, lt);
|
|
@@ -833,7 +830,7 @@ const Qe = class Qe {
|
|
|
833
830
|
const r = s.closest("tr"), o = r == null ? void 0 : r.closest("tbody");
|
|
834
831
|
if (o) {
|
|
835
832
|
const a = Array.from(o.querySelectorAll("tr:not(.nodata)")).filter((u) => parseInt(u.dataset.row, 10) === e), c = a.length > 0 ? a.length : 1, l = a.indexOf(r), f = e * c + (l >= 0 ? l : 0);
|
|
836
|
-
p(this, _t, !0), t(this,
|
|
833
|
+
p(this, _t, !0), t(this, G).selection.setRange(f, n, f, n), setTimeout(() => {
|
|
837
834
|
p(this, _t, !1);
|
|
838
835
|
}, 0);
|
|
839
836
|
}
|
|
@@ -842,7 +839,7 @@ const Qe = class Qe {
|
|
|
842
839
|
moveCell(s) {
|
|
843
840
|
var I, T, H, F;
|
|
844
841
|
if (!t(this, lt)) return;
|
|
845
|
-
const e = t(this, lt), n = e.closest("tr"), r = parseInt(e.dataset.row, 10), o = parseInt(e.dataset.col, 10), i = n == null ? void 0 : n.closest("tbody"), c = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((
|
|
842
|
+
const e = t(this, lt), n = e.closest("tr"), r = parseInt(e.dataset.row, 10), o = parseInt(e.dataset.col, 10), i = n == null ? void 0 : n.closest("tbody"), c = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((U) => parseInt(U.dataset.row, 10) === r), l = c.length > 0 ? c.length : 1, f = c.indexOf(n);
|
|
846
843
|
let u = r, b = f, g = o;
|
|
847
844
|
switch (s.code) {
|
|
848
845
|
case "Tab":
|
|
@@ -862,22 +859,18 @@ const Qe = class Qe {
|
|
|
862
859
|
break;
|
|
863
860
|
}
|
|
864
861
|
let y = null;
|
|
865
|
-
const m = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((
|
|
862
|
+
const m = Array.from(i.querySelectorAll("tr:not(.nodata)")).filter((U) => parseInt(U.dataset.row, 10) === u)[b];
|
|
866
863
|
if (m && (y = m.querySelector(`[data-col="${g}"]`)), y)
|
|
867
864
|
this.currentCell = y;
|
|
868
865
|
else if (u !== r && u >= 0) {
|
|
869
|
-
const
|
|
870
|
-
(F = (H = t(this,
|
|
866
|
+
const U = ((T = (I = t(this, G)).getRowHeight) == null ? void 0 : T.call(I)) || 40;
|
|
867
|
+
(F = (H = t(this, G)).scrollToY) == null || F.call(H, u * U);
|
|
871
868
|
}
|
|
872
869
|
}
|
|
873
870
|
};
|
|
874
|
-
|
|
875
|
-
t(this,
|
|
876
|
-
|
|
877
|
-
const e = s.target.closest("td, th");
|
|
878
|
-
!e || e.dataset.row === void 0 || e.dataset.col === void 0 || e.closest("tr").classList.contains("nodata") || (this.currentCell = e);
|
|
879
|
-
}), t(this, V).addEventListener("keydown", (s) => {
|
|
880
|
-
w.log(s), ["Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(s.code) && this.moveCell(s);
|
|
871
|
+
G = new WeakMap(), lt = new WeakMap(), ee = new WeakMap(), se = new WeakMap(), _t = new WeakMap(), ne = new WeakSet(), ps = /* @__PURE__ */ h(function() {
|
|
872
|
+
t(this, G).addEventListener("keydown", (s) => {
|
|
873
|
+
S.log(s), ["Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(s.code) && this.moveCell(s);
|
|
881
874
|
});
|
|
882
875
|
}, "#initEvents"), h(Qe, "CellNavigation");
|
|
883
876
|
let Te = Qe;
|
|
@@ -891,10 +884,10 @@ const Et = class Et extends HTMLElement {
|
|
|
891
884
|
d(this, Nt);
|
|
892
885
|
d(this, Dt);
|
|
893
886
|
E(this, "invalidate", /* @__PURE__ */ h(() => {
|
|
894
|
-
|
|
887
|
+
S.log("sheet.invalidate()"), t(this, ht).refresh();
|
|
895
888
|
}, "invalidate"));
|
|
896
889
|
E(this, "generate", /* @__PURE__ */ h((e) => {
|
|
897
|
-
if (
|
|
890
|
+
if (S.log("sheet.generate()"), !e) return;
|
|
898
891
|
p(this, ct, Ee.compile(e)), t(this, oe).call(this), t(this, ie).call(this);
|
|
899
892
|
const n = this.querySelector(".ng-container-body .ng-part-header"), r = this.querySelector(".ng-container-body .ng-part-footer"), o = this.querySelector(".ng-nodata-overlay");
|
|
900
893
|
n && o && (o.style.top = `${n.offsetHeight}px`), r && o && (o.style.bottom = `${r.offsetHeight}px`), t(this, ht).initialize(), setTimeout(() => {
|
|
@@ -1165,7 +1158,7 @@ const Et = class Et extends HTMLElement {
|
|
|
1165
1158
|
return t(this, Dt);
|
|
1166
1159
|
}
|
|
1167
1160
|
disconnectedCallback() {
|
|
1168
|
-
this.innerHTML = "",
|
|
1161
|
+
this.innerHTML = "", S.log("NineTableSheet destroyed.");
|
|
1169
1162
|
}
|
|
1170
1163
|
};
|
|
1171
1164
|
re = new WeakMap(), ct = new WeakMap(), ht = new WeakMap(), Nt = new WeakMap(), Dt = new WeakMap(), oe = new WeakMap(), ie = new WeakMap(), yt = new WeakMap(), ae = new WeakMap(), le = new WeakMap(), h(Et, "NineTableSheet"), E(Et, "SCROLLBAR_SIZE", 16);
|
|
@@ -1189,8 +1182,8 @@ const ts = class ts extends HTMLElement {
|
|
|
1189
1182
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((g) => g.style.setProperty("display", "none"));
|
|
1190
1183
|
const b = f.filter((g) => g.classList.contains("active"));
|
|
1191
1184
|
b.length < 2 || b.forEach((g) => {
|
|
1192
|
-
const y = parseInt(g.getAttribute("data-index"), 10), v = this.querySelector(`nine-splitter[data-split-index="${y}"]`),
|
|
1193
|
-
v &&
|
|
1185
|
+
const y = parseInt(g.getAttribute("data-index"), 10), v = this.querySelector(`nine-splitter[data-split-index="${y}"]`), w = f[y + 1];
|
|
1186
|
+
v && w && w.classList.contains("active") && v.style.setProperty("display", "flex");
|
|
1194
1187
|
});
|
|
1195
1188
|
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), i = this.querySelector("nine-table-sheets-body"), a = o.querySelectorAll(".nine-tab-item"), c = i.querySelectorAll("nine-table-sheet");
|
|
1196
1189
|
if (!a[e]) return;
|
|
@@ -1588,11 +1581,11 @@ const rs = class rs {
|
|
|
1588
1581
|
}), p(this, M, Array.from(s, ([e, n]) => ({ name: e, type: n }))), p(this, M, t(this, M).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, M).sort((e, n) => e.name.length < n.name.length ? 1 : -1);
|
|
1589
1582
|
}, "#adjust"));
|
|
1590
1583
|
d(this, pe, /* @__PURE__ */ h(() => {
|
|
1591
|
-
p(this, M, []),
|
|
1584
|
+
p(this, M, []), S.log(t(this, wt).querySelectorAll("table"));
|
|
1592
1585
|
const s = Array.from(t(this, wt).querySelectorAll("table"));
|
|
1593
1586
|
if (!(!s || s.length === 0)) {
|
|
1594
1587
|
for (const e of s)
|
|
1595
|
-
|
|
1588
|
+
S.log(e), $("[data-bind]", e).each((n, r) => {
|
|
1596
1589
|
const o = r.dataset.bind, i = r.getAttribute("data-type") || "string";
|
|
1597
1590
|
o && t(this, M).push({ name: o, type: i });
|
|
1598
1591
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((n) => {
|
|
@@ -1651,7 +1644,7 @@ const os = class os extends HTMLElement {
|
|
|
1651
1644
|
d(this, ut);
|
|
1652
1645
|
d(this, ye);
|
|
1653
1646
|
d(this, me, /* @__PURE__ */ h(() => {
|
|
1654
|
-
this.fields = new Me(this), p(this, ye, new ke(this)),
|
|
1647
|
+
this.fields = new Me(this), p(this, ye, new ke(this)), S.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1655
1648
|
}, "#init"));
|
|
1656
1649
|
this.attachShadow({ mode: "open" }), p(this, ut, new He(this));
|
|
1657
1650
|
}
|
|
@@ -1659,7 +1652,7 @@ const os = class os extends HTMLElement {
|
|
|
1659
1652
|
t(this, me).call(this);
|
|
1660
1653
|
}
|
|
1661
1654
|
disconnectedCallback() {
|
|
1662
|
-
|
|
1655
|
+
S.log("NineTable disconnected.");
|
|
1663
1656
|
}
|
|
1664
1657
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1665
1658
|
get data() {
|
|
@@ -1745,8 +1738,8 @@ const is = class is extends _e {
|
|
|
1745
1738
|
else
|
|
1746
1739
|
o = !0;
|
|
1747
1740
|
o ? ninegrid.j.querySelectorAll(t(this, x)).removeClass("suppress") : ninegrid.j.querySelectorAll(t(this, x)).addClass("suppress"), ninegrid.j.querySelectorAll(t(this, x)).hasClass("hidden") || (o ? ninegrid.j.querySelectorAll(t(this, x)).removeClass("hidden") : ninegrid.j.querySelectorAll(t(this, x)).addClass("hidden"));
|
|
1748
|
-
var y = parseInt(t(this, x).dataset.matrixRow), v = y - 1,
|
|
1749
|
-
$(
|
|
1741
|
+
var y = parseInt(t(this, x).dataset.matrixRow), v = y - 1, w = t(this, L).body.querySelector(`tbody.bindable [data-col="${t(this, x).dataset.col}"][data-matrix-row="${v}"]`);
|
|
1742
|
+
$(w).hasClass("suppress") && !ninegrid.j.querySelectorAll(t(this, x)).hasClass("suppress") ? ninegrid.j.querySelectorAll(w).removeClass("last-none-suppress").addClass("last-suppress") : !$(w).hasClass("suppress") && ninegrid.j.querySelectorAll(t(this, x)).hasClass("suppress") ? ninegrid.j.querySelectorAll(w).removeClass("last-suppress").addClass("last-none-suppress") : ninegrid.j.querySelectorAll(w).removeClass("last-none-suppress").removeClass("last-suppress");
|
|
1750
1743
|
}
|
|
1751
1744
|
}
|
|
1752
1745
|
}, "#resetSuppress"));
|