@ninebone/table 0.0.629 β 0.0.631
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nine-table.js +126 -125
- 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,29 +22,29 @@ const He = class He extends Ke.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
c(He, "Trace");
|
|
24
24
|
let oe = He;
|
|
25
|
-
const
|
|
26
|
-
var
|
|
25
|
+
const M = new oe();
|
|
26
|
+
var B, j, w, X, K, Z, It, G, _t;
|
|
27
27
|
const Me = class Me extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
d(this,
|
|
30
|
+
d(this, B);
|
|
31
31
|
d(this, j, !1);
|
|
32
32
|
d(this, w);
|
|
33
33
|
d(this, X);
|
|
34
34
|
d(this, K);
|
|
35
35
|
d(this, Z);
|
|
36
36
|
d(this, It, /* @__PURE__ */ c(() => {
|
|
37
|
-
if (!t(this,
|
|
38
|
-
const e = t(this,
|
|
37
|
+
if (!t(this, B)) return;
|
|
38
|
+
const e = t(this, B).querySelector(".ng-container-body .ng-part-body");
|
|
39
39
|
e && (y(this, Z, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), t(this, Z).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
A(this, "refresh", /* @__PURE__ */ c(() => {
|
|
44
|
-
if (!t(this,
|
|
44
|
+
if (!t(this, B) || !t(this, w) || t(this, j)) return;
|
|
45
45
|
const e = t(this, w).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const r = t(this, w).track, n = t(this, w).thumb, o = t(this,
|
|
47
|
+
const r = t(this, w).track, n = t(this, w).thumb, o = t(this, B).querySelector(".ng-container-bottom"), a = e.clientWidth, h = s.scrollWidth;
|
|
48
48
|
if (a !== 0 && h > a)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -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 u = e.scrollLeft,
|
|
59
|
-
let
|
|
60
|
-
|
|
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 m = l - f;
|
|
62
|
-
|
|
62
|
+
g > m && (g = m), n.style.left = `${g}px`, t(this, w).left.disabled = g === 0, t(this, w).right.disabled = g >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
d(this, G, /* @__PURE__ */ c((e) => {
|
|
65
65
|
if (!t(this, w)) return !1;
|
|
@@ -112,7 +112,7 @@ const Me = class Me extends HTMLElement {
|
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (y(this,
|
|
115
|
+
if (y(this, B, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, B)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -177,7 +177,7 @@ const Me = class Me extends HTMLElement {
|
|
|
177
177
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
178
178
|
`;
|
|
179
179
|
const e = /* @__PURE__ */ c(() => {
|
|
180
|
-
const s = t(this,
|
|
180
|
+
const s = t(this, B).querySelector(".ng-container-body .ng-part-body");
|
|
181
181
|
if (!s) {
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
@@ -198,7 +198,7 @@ const Me = class Me extends HTMLElement {
|
|
|
198
198
|
t(this, Z) && t(this, Z).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
201
|
+
B = new WeakMap(), j = new WeakMap(), w = new WeakMap(), X = new WeakMap(), K = new WeakMap(), Z = new WeakMap(), It = new WeakMap(), G = new WeakMap(), _t = new WeakMap(), c(Me, "NineTableHScrollBar");
|
|
202
202
|
let ae = Me;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ae);
|
|
204
204
|
var F, at, J, T, vt, xt, Nt;
|
|
@@ -223,14 +223,14 @@ const $e = class $e extends HTMLElement {
|
|
|
223
223
|
if (f <= 0) return;
|
|
224
224
|
const u = Math.max(Math.min(f * (n / l), f), 20);
|
|
225
225
|
r.style.height = `${u}px`;
|
|
226
|
-
const
|
|
226
|
+
const b = e.scrollTop, g = Math.max(l - n, 1);
|
|
227
227
|
let m = 0;
|
|
228
|
-
|
|
228
|
+
g > 0 && (m = b / g * (f - u));
|
|
229
229
|
const x = f - u;
|
|
230
|
-
m < 0 && (m = 0), m > x && (m = x), r.style.top = `${m}px`, t(this, T).top.disabled =
|
|
230
|
+
m < 0 && (m = 0), m > x && (m = x), r.style.top = `${m}px`, t(this, T).top.disabled = b <= 0, t(this, T).bottom.disabled = b >= g - 1;
|
|
231
231
|
}, "refresh"));
|
|
232
232
|
d(this, Nt, /* @__PURE__ */ c(() => {
|
|
233
|
-
|
|
233
|
+
M.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, u = h.height - l,
|
|
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, m = s(), x = Math.max(m - g, 1);
|
|
246
246
|
if (u > 0 && x > 0) {
|
|
247
|
-
const E =
|
|
247
|
+
const E = b / u * x;
|
|
248
248
|
let v = t(this, xt) + E;
|
|
249
|
-
const I = Math.max(0, m -
|
|
249
|
+
const I = Math.max(0, m - g);
|
|
250
250
|
v < 0 && (v = 0), v > I && (v = I), e.scrollTop = v;
|
|
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, u = s(),
|
|
260
|
-
if (l > 0 &&
|
|
261
|
-
const
|
|
262
|
-
e.scrollTop =
|
|
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
|
+
if (l > 0 && b > 0) {
|
|
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", () => {
|
|
@@ -354,7 +354,7 @@ const $e = class $e extends HTMLElement {
|
|
|
354
354
|
F = new WeakMap(), at = new WeakMap(), J = new WeakMap(), T = new WeakMap(), vt = new WeakMap(), xt = new WeakMap(), Nt = new WeakMap(), c($e, "NineTableVScrollBar");
|
|
355
355
|
let le = $e;
|
|
356
356
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", le);
|
|
357
|
-
var P, S, Q, D, _, V, tt, wt, Se, Ee, Wt, Ot,
|
|
357
|
+
var P, S, Q, D, _, V, tt, wt, Se, Ee, Wt, Ot, zt, St, Et, Bt, Dt, At, Ae, lt, qt, Pt;
|
|
358
358
|
const Ie = class Ie {
|
|
359
359
|
constructor(i) {
|
|
360
360
|
d(this, P);
|
|
@@ -371,12 +371,12 @@ const Ie = class Ie {
|
|
|
371
371
|
d(this, Wt, 3);
|
|
372
372
|
A(this, "refresh", /* @__PURE__ */ c(() => {
|
|
373
373
|
var e;
|
|
374
|
-
|
|
374
|
+
M.log("rowManager.refresh");
|
|
375
375
|
const i = t(this, S).querySelector(".ng-container-body .ng-part-body");
|
|
376
376
|
i && (t(this, St).call(this), t(this, lt).call(this, i.scrollTop), (e = t(this, S).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
377
377
|
}, "refresh"));
|
|
378
378
|
A(this, "initialize", /* @__PURE__ */ c(() => {
|
|
379
|
-
|
|
379
|
+
M.log("rowManager.initialize"), y(this, Q, {
|
|
380
380
|
scrollTables: t(this, S).querySelectorAll(".ng-part-body table"),
|
|
381
381
|
firstTr: t(this, S).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")
|
|
382
382
|
}), y(this, _, null), t(this, D).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
@@ -386,12 +386,12 @@ 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 u = Array.from(l.querySelectorAll("tr")).map((
|
|
389
|
+
const u = Array.from(l.querySelectorAll("tr")).map((b) => b.cloneNode(!0));
|
|
390
390
|
t(this, D).set(o, u);
|
|
391
391
|
});
|
|
392
392
|
const i = t(this, S).querySelector(".ng-container-body .ng-part-body"), e = t(this, S).querySelector(".ng-container-left .ng-part-body"), s = t(this, S).querySelector(".ng-container-right .ng-part-body"), r = t(this, S).querySelector(".ng-container-body .ng-part-header"), n = t(this, S).querySelector(".ng-container-body .ng-part-footer");
|
|
393
393
|
if (i) {
|
|
394
|
-
t(this,
|
|
394
|
+
t(this, zt).call(this, i), t(this, At).call(this), t(this, St).call(this), t(this, lt).call(this, i.scrollTop);
|
|
395
395
|
let o = !1;
|
|
396
396
|
const a = /* @__PURE__ */ c((h) => {
|
|
397
397
|
if (o) return;
|
|
@@ -407,7 +407,7 @@ const Ie = class Ie {
|
|
|
407
407
|
}
|
|
408
408
|
}, "initialize"));
|
|
409
409
|
d(this, Ot, /* @__PURE__ */ c((i, e) => {
|
|
410
|
-
|
|
410
|
+
M.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");
|
|
@@ -420,36 +420,37 @@ const Ie = class Ie {
|
|
|
420
420
|
});
|
|
421
421
|
n ? n.before(o) : r.appendChild(o), e === ".ng-container-body" && (t(this, Q).firstTr = r.querySelector("tr:not(.nodata)"));
|
|
422
422
|
}, "#renderRows"));
|
|
423
|
-
d(this,
|
|
424
|
-
if (
|
|
423
|
+
d(this, zt, /* @__PURE__ */ c((i) => {
|
|
424
|
+
if (M.log("rowManager.#measureAndCacheHeight"), t(this, _) !== null && t(this, _) > 0)
|
|
425
425
|
return t(this, _);
|
|
426
|
-
|
|
426
|
+
M.log("#measureAndCacheHeight");
|
|
427
427
|
const e = t(this, D).get(".ng-container-body");
|
|
428
428
|
if (!e || e.length === 0) throw new Error("invalid dom");
|
|
429
429
|
const s = i.querySelector("tbody.bindable-tbody");
|
|
430
|
-
if (
|
|
431
|
-
s.querySelectorAll("tr:not(.nodata)").forEach((
|
|
430
|
+
if (M.log(s), !s) throw new Error("invalid dom");
|
|
431
|
+
s.querySelectorAll("tr:not(.nodata)").forEach((b) => b.remove());
|
|
432
432
|
const r = s.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
433
|
-
e.forEach((
|
|
434
|
-
n.appendChild(
|
|
433
|
+
e.forEach((b) => {
|
|
434
|
+
n.appendChild(b.cloneNode(!0));
|
|
435
435
|
}), r ? r.before(n) : s.appendChild(n);
|
|
436
436
|
const o = t(this, S), a = o.style.display, h = o.style.visibility, l = o.style.position;
|
|
437
437
|
(a === "none" || window.getComputedStyle(o).display === "none") && (o.style.display = "block", o.style.visibility = "hidden", o.style.position = "absolute");
|
|
438
438
|
let f = 0;
|
|
439
439
|
const u = s.querySelectorAll("tr");
|
|
440
|
-
|
|
441
|
-
let
|
|
442
|
-
if (
|
|
443
|
-
const m = window.getComputedStyle(
|
|
444
|
-
|
|
440
|
+
if (u.forEach((b) => {
|
|
441
|
+
let g = b.offsetHeight || b.getBoundingClientRect().height;
|
|
442
|
+
if (g === 0) {
|
|
443
|
+
const m = window.getComputedStyle(b);
|
|
444
|
+
g = parseFloat(m.height) || parseFloat(m.minHeight) || 0;
|
|
445
445
|
}
|
|
446
|
-
|
|
447
|
-
}), u.forEach((
|
|
446
|
+
f += g;
|
|
447
|
+
}), u.forEach((b) => b.remove()), o.style.display = a, o.style.visibility = h, o.style.position = l, f <= 0) throw new Error("invalid dom");
|
|
448
|
+
return y(this, _, f), t(this, Et).call(this), t(this, _);
|
|
448
449
|
}, "#measureAndCacheHeight"));
|
|
449
450
|
d(this, St, /* @__PURE__ */ c(() => {
|
|
450
|
-
|
|
451
|
+
M.log("rowManager.#updateVirtualScrollHeight");
|
|
451
452
|
const e = (t(this, P).data.get() || []).length, s = t(this, _), r = e * s;
|
|
452
|
-
|
|
453
|
+
M.log("π [VirtualHeight]", { totalCount: e, rowHeight: s, totalVirtualHeight: r }), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
453
454
|
const o = t(this, S).querySelector(n);
|
|
454
455
|
if (!o) return;
|
|
455
456
|
const a = o.querySelector(".ng-part-body .ng-virtual-spacer");
|
|
@@ -462,30 +463,30 @@ const Ie = class Ie {
|
|
|
462
463
|
y(this, wt, i + t(this, Wt));
|
|
463
464
|
}
|
|
464
465
|
}, "#updateRowCount"));
|
|
465
|
-
d(this,
|
|
466
|
-
var a, h, l, f, u,
|
|
466
|
+
d(this, Bt, /* @__PURE__ */ c(() => {
|
|
467
|
+
var a, h, l, f, u, b;
|
|
467
468
|
const i = t(this, S).querySelector(".ng-container-left .ng-part-body table"), e = t(this, S).querySelector(".ng-container-body .ng-part-body table"), s = t(this, S).querySelector(".ng-container-right .ng-part-body table");
|
|
468
469
|
if (e) {
|
|
469
|
-
const
|
|
470
|
+
const g = i ? Array.from(i.querySelectorAll("tbody tr")) : [], m = Array.from(e.querySelectorAll("tbody tr")), x = s ? Array.from(s.querySelectorAll("tbody tr")) : [], E = Math.max(g.length, m.length, x.length);
|
|
470
471
|
for (let v = 0; v < E; v++) {
|
|
471
472
|
const I = [
|
|
472
|
-
((a =
|
|
473
|
+
((a = g[v]) == null ? void 0 : a.getBoundingClientRect().height) || 0,
|
|
473
474
|
((h = m[v]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
474
475
|
((l = x[v]) == null ? void 0 : l.getBoundingClientRect().height) || 0
|
|
475
476
|
], R = Math.max(...I);
|
|
476
|
-
R > 0 && (
|
|
477
|
+
R > 0 && (g[v] && (g[v].style.height = `${R}px`), m[v] && (m[v].style.height = `${R}px`), x[v] && (x[v].style.height = `${R}px`));
|
|
477
478
|
}
|
|
478
479
|
}
|
|
479
480
|
const r = t(this, S).querySelector(".ng-container-left .ng-part-footer table"), n = t(this, S).querySelector(".ng-container-body .ng-part-footer table"), o = t(this, S).querySelector(".ng-container-right .ng-part-footer table");
|
|
480
481
|
if (n) {
|
|
481
|
-
const
|
|
482
|
+
const g = r ? Array.from(r.querySelectorAll("tfoot tr")) : [], m = Array.from(n.querySelectorAll("tfoot tr")), x = o ? Array.from(o.querySelectorAll("tfoot tr")) : [], E = Math.max(g.length, m.length, x.length);
|
|
482
483
|
for (let v = 0; v < E; v++) {
|
|
483
484
|
const I = [
|
|
484
|
-
((f =
|
|
485
|
+
((f = g[v]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
485
486
|
((u = m[v]) == null ? void 0 : u.getBoundingClientRect().height) || 0,
|
|
486
|
-
((
|
|
487
|
+
((b = x[v]) == null ? void 0 : b.getBoundingClientRect().height) || 0
|
|
487
488
|
], R = Math.max(...I);
|
|
488
|
-
R > 0 && (
|
|
489
|
+
R > 0 && (g[v] && (g[v].style.height = `${R}px`), m[v] && (m[v].style.height = `${R}px`), x[v] && (x[v].style.height = `${R}px`));
|
|
489
490
|
}
|
|
490
491
|
}
|
|
491
492
|
}, "#syncRowHeights"));
|
|
@@ -506,10 +507,10 @@ const Ie = class Ie {
|
|
|
506
507
|
})), t(this, V).observe(t(this, S)));
|
|
507
508
|
}, "#initResizeObserver"));
|
|
508
509
|
d(this, At, /* @__PURE__ */ c(() => {
|
|
509
|
-
|
|
510
|
+
M.log("rowManager.#renderAllContainers"), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
510
511
|
const e = t(this, S).querySelector(i);
|
|
511
512
|
e && e.querySelector(".ng-part-body tbody.bindable-tbody") && t(this, Ot).call(this, e, i);
|
|
512
|
-
}), t(this, Pt).call(this), t(this,
|
|
513
|
+
}), t(this, Pt).call(this), t(this, Bt).call(this);
|
|
513
514
|
}, "#renderAllContainers"));
|
|
514
515
|
d(this, Ae, /* @__PURE__ */ c((i) => {
|
|
515
516
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
@@ -520,13 +521,13 @@ const Ie = class Ie {
|
|
|
520
521
|
if (!r) return;
|
|
521
522
|
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;
|
|
522
523
|
n.forEach((f, u) => {
|
|
523
|
-
const
|
|
524
|
-
if (
|
|
524
|
+
const b = i + Math.floor(u / o);
|
|
525
|
+
if (b >= h) {
|
|
525
526
|
f.style.visibility = "hidden";
|
|
526
527
|
return;
|
|
527
528
|
}
|
|
528
|
-
const
|
|
529
|
-
f.style.display = "", t(this, qt).call(this, f,
|
|
529
|
+
const g = t(this, P).data.get(b);
|
|
530
|
+
f.style.display = "", t(this, qt).call(this, f, g, b);
|
|
530
531
|
});
|
|
531
532
|
});
|
|
532
533
|
}, "#adjustBufferRows"));
|
|
@@ -537,12 +538,12 @@ const Ie = class Ie {
|
|
|
537
538
|
const s = t(this, P).data.length;
|
|
538
539
|
if (s === 0) return;
|
|
539
540
|
const r = ((f = t(this, D).get(".ng-container-body")) == null ? void 0 : f.length) || 1, n = Math.max(0, s - 1), o = Math.min(n, Math.max(0, Math.floor(i / e))), a = Math.floor(o * e), h = t(this, Q).firstTr, l = h && h.dataset.row !== void 0 ? parseInt(h.dataset.row, 10) : -1;
|
|
540
|
-
(u = t(this, Q)) == null || u.scrollTables.forEach((
|
|
541
|
-
|
|
542
|
-
}), l !== o && [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
543
|
-
const
|
|
544
|
-
if (!
|
|
545
|
-
const m =
|
|
541
|
+
(u = t(this, Q)) == null || u.scrollTables.forEach((b) => {
|
|
542
|
+
b.style.transform = `translate3d(0, ${a}px, 0)`;
|
|
543
|
+
}), l !== o && [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((b) => {
|
|
544
|
+
const g = t(this, S).querySelector(b);
|
|
545
|
+
if (!g) return;
|
|
546
|
+
const m = g.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
546
547
|
if (!m) return;
|
|
547
548
|
Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((E, v) => {
|
|
548
549
|
const I = o + Math.floor(v / r);
|
|
@@ -578,17 +579,17 @@ const Ie = class Ie {
|
|
|
578
579
|
}, "#bindRowData"));
|
|
579
580
|
d(this, Pt, /* @__PURE__ */ c(() => {
|
|
580
581
|
var h, l, f;
|
|
581
|
-
|
|
582
|
+
M.log("rowManager.#syncHeaderHeights");
|
|
582
583
|
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");
|
|
583
584
|
if (!e) return;
|
|
584
585
|
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
586
|
for (let u = 0; u < a; u++) {
|
|
586
|
-
const
|
|
587
|
+
const b = [
|
|
587
588
|
((h = r[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
588
589
|
((l = n[u]) == null ? void 0 : l.getBoundingClientRect().height) || 0,
|
|
589
590
|
((f = o[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
590
|
-
],
|
|
591
|
-
|
|
591
|
+
], g = Math.max(...b);
|
|
592
|
+
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`));
|
|
592
593
|
}
|
|
593
594
|
}, "#syncHeaderHeights"));
|
|
594
595
|
A(this, "destroy", /* @__PURE__ */ c(() => {
|
|
@@ -604,7 +605,7 @@ const Ie = class Ie {
|
|
|
604
605
|
return ((e = t(this, D).get(i)) == null ? void 0 : e.length) || 1;
|
|
605
606
|
}
|
|
606
607
|
};
|
|
607
|
-
P = new WeakMap(), S = new WeakMap(), Q = new WeakMap(), D = new WeakMap(), _ = new WeakMap(), V = new WeakMap(), tt = new WeakMap(), wt = new WeakMap(), Se = new WeakMap(), Ee = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(),
|
|
608
|
+
P = new WeakMap(), S = new WeakMap(), Q = new WeakMap(), D = new WeakMap(), _ = new WeakMap(), V = new WeakMap(), tt = new WeakMap(), wt = new WeakMap(), Se = new WeakMap(), Ee = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(), zt = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), Bt = new WeakMap(), Dt = new WeakMap(), At = new WeakMap(), Ae = new WeakMap(), lt = new WeakMap(), qt = new WeakMap(), Pt = new WeakMap(), c(Ie, "RowManager");
|
|
608
609
|
let ce = Ie;
|
|
609
610
|
const jt = class jt {
|
|
610
611
|
/**
|
|
@@ -623,16 +624,16 @@ const jt = class jt {
|
|
|
623
624
|
const f = l.getAttribute("cell-type") || "renderer";
|
|
624
625
|
if (l.children.length > 0 && l.firstElementChild.tagName.includes("-")) return;
|
|
625
626
|
let u = `cell-${f}`;
|
|
626
|
-
const
|
|
627
|
+
const b = l.getAttribute("data-bind"), g = l.getAttribute("data-expr"), m = l.getAttribute("maxbyte"), x = l.getAttribute("type");
|
|
627
628
|
let E = [];
|
|
628
|
-
|
|
629
|
+
b && E.push(`data-bind="${b}"`), g && E.push(`data-expr="${g}"`), m && E.push(`maxbyte="${m}"`), x && E.push(`type="${x}"`), l.innerHTML = `<${u} ${E.join(" ")}></${u}>`;
|
|
629
630
|
});
|
|
630
631
|
}, "processCellTypes"), s = /* @__PURE__ */ c((a) => {
|
|
631
632
|
if (!a.querySelector("colgroup")) {
|
|
632
633
|
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);
|
|
633
|
-
for (let
|
|
634
|
-
const
|
|
635
|
-
|
|
634
|
+
for (let b = 0; b < l; b++) {
|
|
635
|
+
const g = document.createElement("col");
|
|
636
|
+
g.setAttribute("width", u), f.appendChild(g);
|
|
636
637
|
}
|
|
637
638
|
a.prepend(f);
|
|
638
639
|
}
|
|
@@ -644,31 +645,31 @@ const jt = class jt {
|
|
|
644
645
|
}, "ensureTableStructure"), r = /* @__PURE__ */ c((a, h) => {
|
|
645
646
|
const l = Array.from(a.querySelectorAll(h + " tr")), f = Array.from(a.querySelectorAll(h + " th," + h + " td")), u = l.length;
|
|
646
647
|
if (u === 0 || f.length === 0) return;
|
|
647
|
-
let
|
|
648
|
+
let b = 0;
|
|
648
649
|
f.forEach((m) => {
|
|
649
|
-
|
|
650
|
+
b += m.colSpan || 1;
|
|
650
651
|
});
|
|
651
|
-
const
|
|
652
|
+
const g = Array.from(Array(u), () => Array(b).fill(null));
|
|
652
653
|
l.forEach((m) => {
|
|
653
654
|
const x = m.sectionRowIndex;
|
|
654
655
|
let E = 0;
|
|
655
656
|
Array.from(m.querySelectorAll("th,td")).forEach((v) => {
|
|
656
|
-
for (let
|
|
657
|
-
if (
|
|
658
|
-
E =
|
|
657
|
+
for (let z = 0; z < g[x].length; z++)
|
|
658
|
+
if (g[x][z] === null) {
|
|
659
|
+
E = z;
|
|
659
660
|
break;
|
|
660
661
|
}
|
|
661
662
|
const I = v.rowSpan || 1, R = v.colSpan || 1;
|
|
662
|
-
for (let
|
|
663
|
+
for (let z = 0; z < I; z++)
|
|
663
664
|
for (let yt = 0; yt < R; yt++)
|
|
664
|
-
x +
|
|
665
|
+
x + z < u && E + yt < b && (g[x + z][E + yt] = z === 0 && yt === 0 ? "1" : "0");
|
|
665
666
|
});
|
|
666
667
|
}), l.forEach((m) => {
|
|
667
668
|
const x = m.sectionRowIndex;
|
|
668
669
|
Array.from(m.querySelectorAll("th,td")).forEach((E) => {
|
|
669
|
-
for (let v = 0; v <
|
|
670
|
-
if (
|
|
671
|
-
E.dataset.col = v,
|
|
670
|
+
for (let v = 0; v < g[x].length; v++)
|
|
671
|
+
if (g[x][v] === "1") {
|
|
672
|
+
E.dataset.col = v, g[x][v] = "0";
|
|
672
673
|
break;
|
|
673
674
|
}
|
|
674
675
|
});
|
|
@@ -948,7 +949,7 @@ const pt = class pt extends HTMLElement {
|
|
|
948
949
|
t(this, Ut).call(this);
|
|
949
950
|
}
|
|
950
951
|
disconnectedCallback() {
|
|
951
|
-
this.innerHTML = "",
|
|
952
|
+
this.innerHTML = "", M.log("NineTableSheet destroyed.");
|
|
952
953
|
}
|
|
953
954
|
};
|
|
954
955
|
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"), A(pt, "SCROLLBAR_SIZE", 16);
|
|
@@ -969,10 +970,10 @@ const _e = class _e extends HTMLElement {
|
|
|
969
970
|
d(this, Rt, /* @__PURE__ */ c((e, s = !1) => {
|
|
970
971
|
const r = /* @__PURE__ */ c(() => {
|
|
971
972
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
972
|
-
Array.from(this.querySelectorAll("nine-splitter")).forEach((
|
|
973
|
-
const
|
|
974
|
-
|
|
975
|
-
const m = parseInt(
|
|
973
|
+
Array.from(this.querySelectorAll("nine-splitter")).forEach((g) => g.style.setProperty("display", "none"));
|
|
974
|
+
const b = f.filter((g) => g.classList.contains("active"));
|
|
975
|
+
b.length < 2 || b.forEach((g) => {
|
|
976
|
+
const m = parseInt(g.getAttribute("data-index"), 10), x = this.querySelector(`nine-splitter[data-split-index="${m}"]`), E = f[m + 1];
|
|
976
977
|
x && E && E.classList.contains("active") && x.style.setProperty("display", "flex");
|
|
977
978
|
});
|
|
978
979
|
}, "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");
|
|
@@ -981,16 +982,16 @@ const _e = class _e extends HTMLElement {
|
|
|
981
982
|
a.forEach((f, u) => {
|
|
982
983
|
f.classList.toggle("active", u === e);
|
|
983
984
|
}), h.forEach((f, u) => {
|
|
984
|
-
const
|
|
985
|
-
f.classList.toggle("active",
|
|
985
|
+
const b = u === e;
|
|
986
|
+
f.classList.toggle("active", b), f.style.flex = b ? "1 1 100%" : "";
|
|
986
987
|
});
|
|
987
988
|
else {
|
|
988
989
|
const f = a[e], u = n.querySelectorAll(".nine-tab-item.active");
|
|
989
990
|
if (f.classList.contains("active") && u.length <= 1)
|
|
990
991
|
return;
|
|
991
992
|
f.classList.toggle("active");
|
|
992
|
-
const
|
|
993
|
-
|
|
993
|
+
const b = o.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
994
|
+
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
994
995
|
}
|
|
995
996
|
const l = o.querySelectorAll("nine-table-sheet.active");
|
|
996
997
|
l == null || l.forEach((f) => {
|
|
@@ -1005,29 +1006,29 @@ const _e = class _e extends HTMLElement {
|
|
|
1005
1006
|
Kt = new WeakMap(), Rt = new WeakMap(), c(_e, "NineTableSheets");
|
|
1006
1007
|
let de = _e;
|
|
1007
1008
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", de);
|
|
1008
|
-
var
|
|
1009
|
+
var H, Zt, Tt, Gt;
|
|
1009
1010
|
const Ne = class Ne {
|
|
1010
1011
|
constructor(i) {
|
|
1011
|
-
d(this,
|
|
1012
|
+
d(this, H);
|
|
1012
1013
|
d(this, Zt, /* @__PURE__ */ c(() => {
|
|
1013
1014
|
t(this, Gt).call(this), new ResizeObserver((i) => {
|
|
1014
1015
|
for (let e of i)
|
|
1015
|
-
t(this,
|
|
1016
|
-
}).observe(t(this,
|
|
1016
|
+
t(this, H).getAttribute("auto-height") === "true" && t(this, Tt).call(this);
|
|
1017
|
+
}).observe(t(this, H));
|
|
1017
1018
|
}, "#init"));
|
|
1018
1019
|
d(this, Tt, /* @__PURE__ */ c(() => {
|
|
1019
1020
|
var h, l;
|
|
1020
|
-
const i = Array.from(t(this,
|
|
1021
|
+
const i = Array.from(t(this, H).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
1021
1022
|
if (i.length === 0) return;
|
|
1022
|
-
const e = parseInt(t(this,
|
|
1023
|
-
t(this,
|
|
1023
|
+
const e = parseInt(t(this, H).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), r = (h = t(this, H).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : h.getBoundingClientRect().height, n = (l = t(this, H).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, o = $t.SCROLLBAR_SIZE, a = e * s + r + n + o;
|
|
1024
|
+
t(this, H).style.height = `${a}px`;
|
|
1024
1025
|
}, "#applyAutoHeight"));
|
|
1025
1026
|
d(this, Gt, /* @__PURE__ */ c(() => {
|
|
1026
|
-
const e = Array.from(t(this,
|
|
1027
|
-
const u = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`,
|
|
1028
|
-
return u +
|
|
1027
|
+
const e = Array.from(t(this, H).children).filter((h) => h.tagName === "TABLE"), s = t(this, H).getAttribute("auto-height") === "true", r = e.length, n = e.map((h, l) => {
|
|
1028
|
+
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>` : "";
|
|
1029
|
+
return u + b;
|
|
1029
1030
|
}).join(""), o = e.map((h, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
1030
|
-
t(this,
|
|
1031
|
+
t(this, H).shadowRoot.innerHTML = `
|
|
1031
1032
|
<style>
|
|
1032
1033
|
:host {
|
|
1033
1034
|
display: flex;
|
|
@@ -1147,18 +1148,18 @@ const Ne = class Ne {
|
|
|
1147
1148
|
<nine-table-analysis></nine-table-analysis>
|
|
1148
1149
|
</nine-table-body>
|
|
1149
1150
|
<nine-table-footer></nine-table-footer>
|
|
1150
|
-
`, t(this,
|
|
1151
|
-
const a = t(this,
|
|
1151
|
+
`, t(this, H).shadowRoot.querySelector("nine-table-sheets").classList.add("nodata");
|
|
1152
|
+
const a = t(this, H).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1152
1153
|
a == null || a.forEach((h, l) => {
|
|
1153
1154
|
e[l] && setTimeout(() => {
|
|
1154
1155
|
h.generate(e[l]), s && t(this, Tt).call(this);
|
|
1155
1156
|
});
|
|
1156
1157
|
});
|
|
1157
1158
|
}, "#render"));
|
|
1158
|
-
y(this,
|
|
1159
|
+
y(this, H, i), t(this, Zt).call(this);
|
|
1159
1160
|
}
|
|
1160
1161
|
};
|
|
1161
|
-
|
|
1162
|
+
H = new WeakMap(), Zt = new WeakMap(), Tt = new WeakMap(), Gt = new WeakMap(), c(Ne, "LayoutManager");
|
|
1162
1163
|
let fe = Ne;
|
|
1163
1164
|
var kt, ht;
|
|
1164
1165
|
const We = class We {
|
|
@@ -1354,7 +1355,7 @@ const Oe = class Oe {
|
|
|
1354
1355
|
rt = new WeakMap(), c(Oe, "ngDataManager");
|
|
1355
1356
|
let be = Oe;
|
|
1356
1357
|
var ut, L, Lt, se;
|
|
1357
|
-
const
|
|
1358
|
+
const ze = class ze {
|
|
1358
1359
|
// π― μ΄μ { name: string, type: string } κ°μ²΄λ€μ λ°°μ΄λ‘ κ΄λ¦¬ν©λλ€.
|
|
1359
1360
|
constructor(i) {
|
|
1360
1361
|
d(this, ut);
|
|
@@ -1371,11 +1372,11 @@ const Be = class Be {
|
|
|
1371
1372
|
}), 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);
|
|
1372
1373
|
}, "#adjust"));
|
|
1373
1374
|
d(this, se, /* @__PURE__ */ c(() => {
|
|
1374
|
-
y(this, L, []),
|
|
1375
|
+
y(this, L, []), M.log(t(this, ut).querySelectorAll("table"));
|
|
1375
1376
|
const i = Array.from(t(this, ut).querySelectorAll("table"));
|
|
1376
1377
|
if (!(!i || i.length === 0)) {
|
|
1377
1378
|
for (const e of i)
|
|
1378
|
-
|
|
1379
|
+
M.log(e), $("[data-bind]", e).each((s, r) => {
|
|
1379
1380
|
const n = r.dataset.bind, o = r.getAttribute("data-type") || "string";
|
|
1380
1381
|
n && t(this, L).push({ name: n, type: o });
|
|
1381
1382
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1424,17 +1425,17 @@ const Be = class Be {
|
|
|
1424
1425
|
return t(this, L).some((e) => e.name === i);
|
|
1425
1426
|
}
|
|
1426
1427
|
};
|
|
1427
|
-
ut = new WeakMap(), L = new WeakMap(), Lt = new WeakMap(), se = new WeakMap(), c(
|
|
1428
|
-
let ye =
|
|
1428
|
+
ut = new WeakMap(), L = new WeakMap(), Lt = new WeakMap(), se = new WeakMap(), c(ze, "ngFields");
|
|
1429
|
+
let ye = ze;
|
|
1429
1430
|
var nt, ie, re;
|
|
1430
|
-
const
|
|
1431
|
+
const Be = class Be extends HTMLElement {
|
|
1431
1432
|
constructor() {
|
|
1432
1433
|
super();
|
|
1433
1434
|
//#created = false;
|
|
1434
1435
|
d(this, nt);
|
|
1435
1436
|
d(this, ie);
|
|
1436
1437
|
d(this, re, /* @__PURE__ */ c(() => {
|
|
1437
|
-
this.fields = new ye(this), y(this, ie, new fe(this)),
|
|
1438
|
+
this.fields = new ye(this), y(this, ie, new fe(this)), M.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1438
1439
|
}, "#init"));
|
|
1439
1440
|
this.attachShadow({ mode: "open" }), y(this, nt, new be(this));
|
|
1440
1441
|
}
|
|
@@ -1442,7 +1443,7 @@ const ze = class ze extends HTMLElement {
|
|
|
1442
1443
|
t(this, re).call(this);
|
|
1443
1444
|
}
|
|
1444
1445
|
disconnectedCallback() {
|
|
1445
|
-
|
|
1446
|
+
M.log("NineTable disconnected.");
|
|
1446
1447
|
}
|
|
1447
1448
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1448
1449
|
get data() {
|
|
@@ -1457,8 +1458,8 @@ const ze = class ze extends HTMLElement {
|
|
|
1457
1458
|
return t(this, nt);
|
|
1458
1459
|
}
|
|
1459
1460
|
};
|
|
1460
|
-
nt = new WeakMap(), ie = new WeakMap(), re = new WeakMap(), c(
|
|
1461
|
-
let pe =
|
|
1461
|
+
nt = new WeakMap(), ie = new WeakMap(), re = new WeakMap(), c(Be, "NineTable");
|
|
1462
|
+
let pe = Be;
|
|
1462
1463
|
customElements.get("nine-table") || customElements.define("nine-table", pe);
|
|
1463
1464
|
const mt = class mt extends HTMLElement {
|
|
1464
1465
|
// π 컀μ€ν
μ€νμΌμ© μΊμ μΆκ°
|
|
@@ -1519,8 +1520,8 @@ const De = class De extends me {
|
|
|
1519
1520
|
if (o > e) break;
|
|
1520
1521
|
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);
|
|
1521
1522
|
t(this, p).dataset.matrixRow;
|
|
1522
|
-
var u = t(this, C).body.querySelector(`tbody.bindable [suppress="${o}"][data-matrix-row="${t(this, p).dataset.matrixRow}"]`),
|
|
1523
|
-
if (
|
|
1523
|
+
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];
|
|
1524
|
+
if (b != g) {
|
|
1524
1525
|
n = !0;
|
|
1525
1526
|
break;
|
|
1526
1527
|
}
|