@ninebone/table 0.0.182 β 0.0.183
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 +104 -104
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +4 -4
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -22,26 +22,26 @@ const Re = class Re extends We.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
l(Re, "Trace");
|
|
24
24
|
let be = Re;
|
|
25
|
-
const
|
|
26
|
-
var _,
|
|
25
|
+
const I = new be();
|
|
26
|
+
var _, B, y, D, N, P, te, V, ie;
|
|
27
27
|
const Te = class Te extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
u(this, _);
|
|
31
|
-
u(this,
|
|
31
|
+
u(this, B, !1);
|
|
32
32
|
u(this, y);
|
|
33
|
-
u(this, B);
|
|
34
33
|
u(this, D);
|
|
35
34
|
u(this, N);
|
|
35
|
+
u(this, P);
|
|
36
36
|
u(this, te, /* @__PURE__ */ l(() => {
|
|
37
37
|
if (!e(this, _)) return;
|
|
38
38
|
const t = e(this, _).querySelector(".ng-container-body");
|
|
39
|
-
t && (p(this,
|
|
39
|
+
t && (p(this, P, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), e(this,
|
|
41
|
+
})), e(this, P).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ l(() => {
|
|
44
|
-
if (!e(this, _) || !e(this, y) || e(this,
|
|
44
|
+
if (!e(this, _) || !e(this, y) || e(this, B)) return;
|
|
45
45
|
const t = e(this, y).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
47
|
const n = e(this, y).track, r = e(this, y).thumb, o = e(this, _).querySelector(".ng-container-bottom"), h = t.clientWidth, b = s.scrollWidth;
|
|
@@ -67,7 +67,7 @@ const Te = class Te extends HTMLElement {
|
|
|
67
67
|
const S = a - d;
|
|
68
68
|
f > S && (f = S), r.style.left = `${f}px`, e(this, y).left.disabled = f === 0, e(this, y).right.disabled = f >= S - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
|
-
u(this,
|
|
70
|
+
u(this, V, /* @__PURE__ */ l((t) => {
|
|
71
71
|
if (!e(this, y)) return !1;
|
|
72
72
|
const s = e(this, y).container, n = s.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
@@ -82,16 +82,16 @@ const Te = class Te extends HTMLElement {
|
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
83
|
u(this, ie, /* @__PURE__ */ l(() => {
|
|
84
84
|
const t = /* @__PURE__ */ l((n) => {
|
|
85
|
-
clearInterval(e(this,
|
|
85
|
+
clearInterval(e(this, D)), clearInterval(e(this, N));
|
|
86
86
|
const r = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
87
|
-
e(this,
|
|
88
|
-
clearInterval(e(this,
|
|
87
|
+
e(this, V).call(this, r + n), p(this, D, setInterval(() => {
|
|
88
|
+
clearInterval(e(this, D)), p(this, N, setInterval(() => {
|
|
89
89
|
const o = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
90
|
-
e(this,
|
|
90
|
+
e(this, V).call(this, o + n) || clearInterval(e(this, N));
|
|
91
91
|
}, 50));
|
|
92
92
|
}, 500));
|
|
93
93
|
}, "delayScroll"), s = /* @__PURE__ */ l(() => {
|
|
94
|
-
clearInterval(e(this,
|
|
94
|
+
clearInterval(e(this, D)), clearInterval(e(this, N));
|
|
95
95
|
}, "clearTimer");
|
|
96
96
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
97
97
|
e(this, y).left.addEventListener(n, s), e(this, y).right.addEventListener(n, s), e(this, y).track.addEventListener(n, s);
|
|
@@ -103,16 +103,16 @@ const Te = class Te extends HTMLElement {
|
|
|
103
103
|
if (n.button !== 0) return;
|
|
104
104
|
n.preventDefault();
|
|
105
105
|
const r = e(this, y).track.getBoundingClientRect(), o = e(this, y).thumb.clientWidth;
|
|
106
|
-
e(this,
|
|
106
|
+
e(this, V).call(this, n.clientX - r.left - o / 2);
|
|
107
107
|
}), e(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
|
-
n.stopPropagation(), n.preventDefault(), p(this,
|
|
109
|
+
n.stopPropagation(), n.preventDefault(), p(this, B, !0), this.shiftX = n.clientX - e(this, y).thumb.getBoundingClientRect().left;
|
|
110
110
|
const r = /* @__PURE__ */ l((h) => {
|
|
111
|
-
if (!e(this,
|
|
111
|
+
if (!e(this, B)) return;
|
|
112
112
|
const b = e(this, y).track.getBoundingClientRect();
|
|
113
|
-
e(this,
|
|
113
|
+
e(this, V).call(this, h.clientX - b.left - this.shiftX);
|
|
114
114
|
}, "onMouseMove"), o = /* @__PURE__ */ l(() => {
|
|
115
|
-
p(this,
|
|
115
|
+
p(this, B, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
116
116
|
}, "onMouseUp");
|
|
117
117
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
118
118
|
});
|
|
@@ -200,21 +200,21 @@ const Te = class Te extends HTMLElement {
|
|
|
200
200
|
t();
|
|
201
201
|
}
|
|
202
202
|
disconnectedCallback() {
|
|
203
|
-
e(this,
|
|
203
|
+
e(this, P) && e(this, P).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
_ = new WeakMap(),
|
|
206
|
+
_ = new WeakMap(), B = new WeakMap(), y = new WeakMap(), D = new WeakMap(), N = new WeakMap(), P = new WeakMap(), te = new WeakMap(), V = new WeakMap(), ie = new WeakMap(), l(Te, "NineTableHScrollBar");
|
|
207
207
|
let ge = Te;
|
|
208
208
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ge);
|
|
209
|
-
var
|
|
209
|
+
var X, M, E, z, H, $, se, ne;
|
|
210
210
|
const qe = class qe {
|
|
211
211
|
constructor(i) {
|
|
212
|
-
u(this,
|
|
212
|
+
u(this, X);
|
|
213
213
|
u(this, M, []);
|
|
214
214
|
u(this, E, null);
|
|
215
|
-
u(this,
|
|
216
|
-
u(this, I, 0);
|
|
215
|
+
u(this, z, null);
|
|
217
216
|
u(this, H, 0);
|
|
217
|
+
u(this, $, 0);
|
|
218
218
|
u(this, se, /* @__PURE__ */ l(() => {
|
|
219
219
|
e(this, ne).call(this);
|
|
220
220
|
}, "#init"));
|
|
@@ -222,7 +222,7 @@ const qe = class qe {
|
|
|
222
222
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
223
223
|
*/
|
|
224
224
|
u(this, ne, /* @__PURE__ */ l(() => {
|
|
225
|
-
!e(this,
|
|
225
|
+
!e(this, X) || !(e(this, X) instanceof HTMLElement) || (p(this, z, new ResizeObserver((i) => {
|
|
226
226
|
for (const t of i) {
|
|
227
227
|
const s = t.target;
|
|
228
228
|
if (!s.classList.contains("active"))
|
|
@@ -234,16 +234,16 @@ const qe = class qe {
|
|
|
234
234
|
const h = s.querySelector(".ng-container-body") || s, b = h.querySelector("thead"), a = h.querySelector("tfoot");
|
|
235
235
|
b && (o += b.offsetHeight || b.getBoundingClientRect().height), a && (o += a.offsetHeight || a.getBoundingClientRect().height);
|
|
236
236
|
const d = Math.max(r - o, 100);
|
|
237
|
-
if (e(this,
|
|
238
|
-
const c = Math.ceil(e(this,
|
|
239
|
-
p(this,
|
|
237
|
+
if (e(this, H) !== d && (p(this, H, d), e(this, E) !== null)) {
|
|
238
|
+
const c = Math.ceil(e(this, H) / e(this, E));
|
|
239
|
+
p(this, $, c + 20), I.log(`[RowManager] Resized. Height: ${e(this, H)}px | Target Rows: ${e(this, $)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((g) => {
|
|
240
240
|
const f = s.querySelector(g);
|
|
241
241
|
f && f.querySelector("tbody") && this.renderRows(f);
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
})), e(this,
|
|
246
|
+
})), e(this, z).observe(e(this, X)));
|
|
247
247
|
}, "#initResizeObserver"));
|
|
248
248
|
v(this, "initTemplate", /* @__PURE__ */ l((i) => {
|
|
249
249
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
@@ -269,12 +269,12 @@ const qe = class qe {
|
|
|
269
269
|
if (t.querySelectorAll("tr:not(.nodata)").forEach((c, g) => {
|
|
270
270
|
const f = c.offsetHeight || c.getBoundingClientRect().height;
|
|
271
271
|
f === 0 ? a += 40 : a += f;
|
|
272
|
-
}), r && (r.style.display = o, r.style.visibility = h, r.style.position = b), p(this, E, a), e(this,
|
|
273
|
-
const c = Math.ceil(e(this,
|
|
274
|
-
p(this,
|
|
272
|
+
}), r && (r.style.display = o, r.style.visibility = h, r.style.position = b), p(this, E, a), e(this, H) > 0) {
|
|
273
|
+
const c = Math.ceil(e(this, H) / e(this, E));
|
|
274
|
+
p(this, $, c + 20);
|
|
275
275
|
} else
|
|
276
|
-
p(this,
|
|
277
|
-
return console.log(`[RowManager] Template Height Cached: ${e(this, E)}px | RowCount: ${e(this,
|
|
276
|
+
p(this, $, 40);
|
|
277
|
+
return console.log(`[RowManager] Template Height Cached: ${e(this, E)}px | RowCount: ${e(this, $)}`), e(this, E);
|
|
278
278
|
}, "measureAndCacheHeight"));
|
|
279
279
|
/**
|
|
280
280
|
* π― μΊμλ ν κ°μ λ°ν (μμ λλ§ μ΅μνμ λ°©μ΄ μ°μ°)
|
|
@@ -297,7 +297,7 @@ const qe = class qe {
|
|
|
297
297
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
298
298
|
if (!t) return;
|
|
299
299
|
t.querySelectorAll("tr:not(.nodata)").forEach((o) => o.remove());
|
|
300
|
-
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment(), r = e(this,
|
|
300
|
+
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment(), r = e(this, $);
|
|
301
301
|
for (let o = 0; o < r; o++)
|
|
302
302
|
e(this, M).forEach((h) => {
|
|
303
303
|
n.appendChild(h.cloneNode(!0));
|
|
@@ -305,15 +305,15 @@ const qe = class qe {
|
|
|
305
305
|
s ? s.before(n) : t.appendChild(n), console.log(`[RowManager] Rendered ${r} sets into DOM.`);
|
|
306
306
|
}, "renderRows"));
|
|
307
307
|
v(this, "destroy", /* @__PURE__ */ l(() => {
|
|
308
|
-
e(this,
|
|
308
|
+
e(this, z) && (e(this, z).disconnect(), p(this, z, null));
|
|
309
309
|
}, "destroy"));
|
|
310
|
-
p(this,
|
|
310
|
+
p(this, X, i), e(this, se).call(this);
|
|
311
311
|
}
|
|
312
312
|
get templateLength() {
|
|
313
313
|
return e(this, M).length || 1;
|
|
314
314
|
}
|
|
315
315
|
};
|
|
316
|
-
|
|
316
|
+
X = new WeakMap(), M = new WeakMap(), E = new WeakMap(), z = new WeakMap(), H = new WeakMap(), $ = new WeakMap(), se = new WeakMap(), ne = new WeakMap(), l(qe, "RowManager");
|
|
317
317
|
let pe = qe;
|
|
318
318
|
var L, K, re;
|
|
319
319
|
const G = class G extends HTMLElement {
|
|
@@ -327,7 +327,7 @@ const G = class G extends HTMLElement {
|
|
|
327
327
|
const d = /* @__PURE__ */ l((g) => {
|
|
328
328
|
if (g.querySelector("colgroup")) return;
|
|
329
329
|
const f = g.querySelector("tbody tr") || g.querySelector("tr"), S = f ? f.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), A = Math.max(Math.floor((g.clientWidth || 600) / S), 100);
|
|
330
|
-
for (let
|
|
330
|
+
for (let q = 0; q < S; q++) {
|
|
331
331
|
const U = document.createElement("col");
|
|
332
332
|
U.setAttribute("width", A), x.appendChild(U);
|
|
333
333
|
}
|
|
@@ -343,12 +343,12 @@ const G = class G extends HTMLElement {
|
|
|
343
343
|
const r = this.querySelector(".ng-container-left"), o = this.querySelector(".ng-container-body"), h = this.querySelector(".ng-container-right"), b = /* @__PURE__ */ l((a, d, c = !1) => {
|
|
344
344
|
const g = a.cloneNode(!0), f = Array.from(g.querySelectorAll("colgroup col")), S = [];
|
|
345
345
|
return f.forEach((x, A) => {
|
|
346
|
-
const
|
|
347
|
-
(c ?
|
|
346
|
+
const q = x.getAttribute("fixed");
|
|
347
|
+
(c ? q !== "left" && q !== "right" : q === d) || S.push(A);
|
|
348
348
|
}), S.reverse().forEach((x) => {
|
|
349
349
|
f[x] && f[x].remove(), g.querySelectorAll("tr").forEach((A) => {
|
|
350
|
-
const
|
|
351
|
-
|
|
350
|
+
const q = A.querySelectorAll("th, td");
|
|
351
|
+
q[x] && q[x].remove();
|
|
352
352
|
});
|
|
353
353
|
}), g;
|
|
354
354
|
}, "filterTableByFixed");
|
|
@@ -386,7 +386,7 @@ const G = class G extends HTMLElement {
|
|
|
386
386
|
setTimeout(() => {
|
|
387
387
|
const a = this.querySelector("nine-table-hscrollbar");
|
|
388
388
|
a && typeof a.refresh == "function" && a.refresh();
|
|
389
|
-
}, 0),
|
|
389
|
+
}, 0), I.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
390
390
|
}, "init"));
|
|
391
391
|
v(this, "getRowCount", /* @__PURE__ */ l(() => e(this, L) ? e(this, L).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
392
392
|
v(this, "scrollToX", /* @__PURE__ */ l((t) => {
|
|
@@ -520,7 +520,7 @@ const G = class G extends HTMLElement {
|
|
|
520
520
|
e(this, re).call(this);
|
|
521
521
|
}
|
|
522
522
|
disconnectedCallback() {
|
|
523
|
-
this.innerHTML = "",
|
|
523
|
+
this.innerHTML = "", I.log("NineTableSheet destroyed.");
|
|
524
524
|
}
|
|
525
525
|
};
|
|
526
526
|
L = new WeakMap(), K = new WeakMap(), re = new WeakMap(), l(G, "NineTableSheet"), v(G, "SCROLLBAR_SIZE", 16);
|
|
@@ -545,8 +545,8 @@ const Ce = class Ce extends HTMLElement {
|
|
|
545
545
|
Array.from(c.querySelectorAll("nine-splitter")).forEach((x) => x.style.setProperty("display", "none"));
|
|
546
546
|
const S = g.filter((x) => x.classList.contains("active"));
|
|
547
547
|
S.length < 2 || S.forEach((x) => {
|
|
548
|
-
const A = parseInt(x.getAttribute("data-index"), 10),
|
|
549
|
-
|
|
548
|
+
const A = parseInt(x.getAttribute("data-index"), 10), q = c.querySelector(`nine-splitter[data-split-index="${A}"]`), U = g[A + 1];
|
|
549
|
+
q && U && U.classList.contains("active") && q.style.setProperty("display", "block");
|
|
550
550
|
});
|
|
551
551
|
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), h = r.querySelectorAll(".nine-tab-item"), b = o.querySelectorAll("nine-table-sheet");
|
|
552
552
|
if (!h[t]) return;
|
|
@@ -586,13 +586,13 @@ const Ce = class Ce extends HTMLElement {
|
|
|
586
586
|
oe = new WeakMap(), l(Ce, "NineTableSheets");
|
|
587
587
|
let we = Ce;
|
|
588
588
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", we);
|
|
589
|
-
var
|
|
589
|
+
var R, J, le, Q, ae;
|
|
590
590
|
const ke = class ke {
|
|
591
591
|
constructor(i) {
|
|
592
|
-
u(this,
|
|
592
|
+
u(this, R);
|
|
593
593
|
u(this, J, null);
|
|
594
594
|
u(this, le, /* @__PURE__ */ l(() => {
|
|
595
|
-
const i = e(this,
|
|
595
|
+
const i = e(this, R).host;
|
|
596
596
|
i && (p(this, J, new ResizeObserver((t) => {
|
|
597
597
|
for (let s of t)
|
|
598
598
|
i.getAttribute("auto-height") === "true" && e(this, Q).call(this, i);
|
|
@@ -600,21 +600,21 @@ const ke = class ke {
|
|
|
600
600
|
}, "#observeResize"));
|
|
601
601
|
u(this, Q, /* @__PURE__ */ l((i) => {
|
|
602
602
|
var A;
|
|
603
|
-
const t = e(this,
|
|
604
|
-
if (!t) return;
|
|
605
|
-
const s = ((A = t.getRowCount) == null ? void 0 : A.call(t)) || 0, n = parseInt(i.getAttribute("max-display-row"), 10) || 10, r = Math.min(s, n), o = t.querySelector("tbody tr") || t.querySelector("tr"), h = o ? o.getBoundingClientRect().height : 32, b = e(this,
|
|
606
|
-
|
|
603
|
+
const t = e(this, R).querySelector("nine-table-sheet.active");
|
|
604
|
+
if (I.log(i), I.log(e(this, R)), I.log(t), !t) return;
|
|
605
|
+
const s = ((A = t.getRowCount) == null ? void 0 : A.call(t)) || 0, n = parseInt(i.getAttribute("max-display-row"), 10) || 10, r = Math.min(s, n), o = t.querySelector("tbody tr") || t.querySelector("tr"), h = o ? o.getBoundingClientRect().height : 32, b = e(this, R).querySelector("nine-table-header"), a = e(this, R).querySelector("nine-table-sheets-footer"), d = b ? b.getBoundingClientRect().height : 40, c = a ? a.getBoundingClientRect().height : 32, g = 16;
|
|
606
|
+
I.log(b, a), I.log(b.getBoundingClientRect().height, a.getBoundingClientRect().height);
|
|
607
607
|
const f = d + c + g, S = r * h + f;
|
|
608
608
|
i.style.height = `${S}px`, i.style.maxHeight = `${n * h + f}px`;
|
|
609
|
-
const x = e(this,
|
|
609
|
+
const x = e(this, R).querySelector("nine-table-sheets-body");
|
|
610
610
|
x && (x.style.overflowY = s > n ? "auto" : "hidden");
|
|
611
611
|
}, "#applyAutoHeight"));
|
|
612
612
|
u(this, ae, /* @__PURE__ */ l(() => {
|
|
613
|
-
const i = e(this,
|
|
613
|
+
const i = e(this, R).host, s = Array.from(i.children).filter((a) => a.tagName === "TABLE"), n = i.getAttribute("auto-height") === "true", r = s.length, o = s.map((a, d) => {
|
|
614
614
|
const g = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`, f = d < r - 1 ? `<nine-splitter class="h" data-split-index="${d}"></nine-splitter>` : "";
|
|
615
615
|
return g + f;
|
|
616
616
|
}).join(""), h = s.map((a, d) => `<div class="nine-tab-item ${d === 0 ? "active" : ""}" data-index="${d}">Sheet ${d + 1}</div>`).join("");
|
|
617
|
-
e(this,
|
|
617
|
+
e(this, R).innerHTML = `
|
|
618
618
|
<style>
|
|
619
619
|
:host {
|
|
620
620
|
display: flex;
|
|
@@ -721,71 +721,71 @@ const ke = class ke {
|
|
|
721
721
|
</nine-table-body>
|
|
722
722
|
<nine-table-footer></nine-table-footer>
|
|
723
723
|
`;
|
|
724
|
-
const b = e(this,
|
|
724
|
+
const b = e(this, R).querySelectorAll("nine-table-sheet");
|
|
725
725
|
b == null || b.forEach((a, d) => {
|
|
726
726
|
s[d] && setTimeout(() => {
|
|
727
727
|
a.init(s[d]), n && e(this, Q).call(this, i);
|
|
728
728
|
});
|
|
729
729
|
});
|
|
730
730
|
}, "#render"));
|
|
731
|
-
p(this,
|
|
731
|
+
p(this, R, i), e(this, ae).call(this), e(this, le).call(this);
|
|
732
732
|
}
|
|
733
733
|
};
|
|
734
|
-
|
|
734
|
+
R = new WeakMap(), J = new WeakMap(), le = new WeakMap(), Q = new WeakMap(), ae = new WeakMap(), l(ke, "LayoutManager");
|
|
735
735
|
let me = ke;
|
|
736
|
-
var
|
|
736
|
+
var W, Y;
|
|
737
737
|
const Ae = class Ae {
|
|
738
738
|
constructor(i) {
|
|
739
|
-
u(this,
|
|
740
|
-
u(this,
|
|
741
|
-
v(this, "count", /* @__PURE__ */ l(() => e(this,
|
|
742
|
-
p(this,
|
|
739
|
+
u(this, W);
|
|
740
|
+
u(this, Y, -1);
|
|
741
|
+
v(this, "count", /* @__PURE__ */ l(() => e(this, W).rawRecords.length, "count"));
|
|
742
|
+
p(this, W, i);
|
|
743
743
|
}
|
|
744
744
|
get at() {
|
|
745
|
-
return e(this,
|
|
745
|
+
return e(this, Y);
|
|
746
746
|
}
|
|
747
747
|
set at(i) {
|
|
748
748
|
var s, n;
|
|
749
|
-
p(this,
|
|
750
|
-
const t = ((n = (s = e(this,
|
|
751
|
-
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this,
|
|
749
|
+
p(this, Y, parseInt(i, 10));
|
|
750
|
+
const t = ((n = (s = e(this, W).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || e(this, W).owner.body;
|
|
751
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, Y)}"]`) && setTimeout(() => {
|
|
752
752
|
var r, o;
|
|
753
|
-
(o = (r = e(this,
|
|
753
|
+
(o = (r = e(this, W).owner).scrollTo_V1) == null || o.call(r, e(this, Y));
|
|
754
754
|
});
|
|
755
755
|
}
|
|
756
756
|
};
|
|
757
|
-
|
|
757
|
+
W = new WeakMap(), Y = new WeakMap(), l(Ae, "ngRow");
|
|
758
758
|
let ve = Ae;
|
|
759
|
-
var
|
|
760
|
-
const
|
|
759
|
+
var T, m, k, Z, ce, O, he, ee, de, fe, j;
|
|
760
|
+
const C = class C {
|
|
761
761
|
constructor(i, t) {
|
|
762
|
-
u(this,
|
|
762
|
+
u(this, T);
|
|
763
763
|
u(this, m);
|
|
764
764
|
u(this, k, []);
|
|
765
765
|
u(this, Z, []);
|
|
766
766
|
u(this, ce, 0);
|
|
767
|
-
u(this,
|
|
767
|
+
u(this, O, []);
|
|
768
768
|
u(this, he, /* @__PURE__ */ l(() => {
|
|
769
|
-
p(this,
|
|
770
|
-
const i = e(this,
|
|
769
|
+
p(this, O, []);
|
|
770
|
+
const i = e(this, T).template || [];
|
|
771
771
|
Array.from(i).forEach((t) => {
|
|
772
772
|
var s;
|
|
773
|
-
e(this,
|
|
773
|
+
e(this, O).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
774
774
|
}), (e(this, m).rawRecords || []).forEach((t) => {
|
|
775
|
-
t.__ng || (t.__ng = e(this, ee).call(this)), t.__ng.height = e(this,
|
|
775
|
+
t.__ng || (t.__ng = e(this, ee).call(this)), t.__ng.height = e(this, O).slice();
|
|
776
776
|
});
|
|
777
777
|
}, "#initialize"));
|
|
778
778
|
v(this, "set", /* @__PURE__ */ l((i) => {
|
|
779
779
|
this.clear(), this.add(i, !1);
|
|
780
780
|
}, "set"));
|
|
781
781
|
u(this, ee, /* @__PURE__ */ l(() => ({
|
|
782
|
-
rowState:
|
|
782
|
+
rowState: C.ROW_STATE.EMPTY,
|
|
783
783
|
deleted: !1,
|
|
784
784
|
filtered: !1,
|
|
785
|
-
height: e(this,
|
|
785
|
+
height: e(this, O).slice(),
|
|
786
786
|
o: {},
|
|
787
787
|
c: {},
|
|
788
|
-
_: [0, 0, 0, 0,
|
|
788
|
+
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, O).slice(), -1, {}, {}]
|
|
789
789
|
}), "#getDefaultMeta"));
|
|
790
790
|
v(this, "reset", /* @__PURE__ */ l(() => {
|
|
791
791
|
p(this, k, []), p(this, Z, []);
|
|
@@ -797,7 +797,7 @@ const q = class q {
|
|
|
797
797
|
u(this, de, /* @__PURE__ */ l((i) => {
|
|
798
798
|
var n;
|
|
799
799
|
Array.isArray(i) || (i = [i]);
|
|
800
|
-
const t = typeof ((n = e(this,
|
|
800
|
+
const t = typeof ((n = e(this, T).fields) == null ? void 0 : n.get) == "function" ? e(this, T).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
801
801
|
return i.forEach((r) => {
|
|
802
802
|
const o = { v: [] };
|
|
803
803
|
t.forEach((h) => {
|
|
@@ -806,7 +806,7 @@ const q = class q {
|
|
|
806
806
|
}), s;
|
|
807
807
|
}, "#json2Array"));
|
|
808
808
|
u(this, fe, /* @__PURE__ */ l((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
809
|
-
t.__ng = e(this, ee).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState =
|
|
809
|
+
t.__ng = e(this, ee).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = C.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
810
810
|
}), i), "#defaultInsert"));
|
|
811
811
|
v(this, "add", /* @__PURE__ */ l((i, t = !0) => {
|
|
812
812
|
var r;
|
|
@@ -816,7 +816,7 @@ const q = class q {
|
|
|
816
816
|
const n = this.count() - 1;
|
|
817
817
|
return t || s.forEach((o, h) => {
|
|
818
818
|
const b = e(this, m).rawRecords[n - h];
|
|
819
|
-
b && (b.__ng.rowState =
|
|
819
|
+
b && (b.__ng.rowState = C.ROW_STATE.EMPTY);
|
|
820
820
|
}), (r = e(this, m).viewRecords) != null && r.reset && e(this, m).viewRecords.reset(), n;
|
|
821
821
|
}, "add"));
|
|
822
822
|
v(this, "delete", /* @__PURE__ */ l((i) => {
|
|
@@ -825,8 +825,8 @@ const q = class q {
|
|
|
825
825
|
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, m).owner.row.at] : t = [parseInt(i, 10)], t.sort((n, r) => r - n).forEach((n) => {
|
|
826
826
|
if (e(this, k)[n]) {
|
|
827
827
|
const r = e(this, k)[n].__ng.rowid;
|
|
828
|
-
e(this, k)[n].__ng.rowState ===
|
|
829
|
-
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState =
|
|
828
|
+
e(this, k)[n].__ng.rowState === C.ROW_STATE.INSERT ? e(this, m).rawRecords = e(this, m).rawRecords.filter((o) => o.__ng.rowid !== r) : e(this, m).rawRecords.forEach((o) => {
|
|
829
|
+
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState = C.ROW_STATE.DELETE);
|
|
830
830
|
});
|
|
831
831
|
}
|
|
832
832
|
}), this.resetRecords(), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
@@ -834,12 +834,12 @@ const q = class q {
|
|
|
834
834
|
v(this, "setValue", /* @__PURE__ */ l((i, t, s) => {
|
|
835
835
|
var b;
|
|
836
836
|
i = parseInt(i, 10);
|
|
837
|
-
const r = (typeof ((b = e(this,
|
|
837
|
+
const r = (typeof ((b = e(this, T).fields) == null ? void 0 : b.get) == "function" ? e(this, T).fields.get() : []).indexOf(t);
|
|
838
838
|
if (r < 0) return;
|
|
839
839
|
const o = this.getValidData()[i];
|
|
840
840
|
if (!o) return;
|
|
841
841
|
const h = o.v[r];
|
|
842
|
-
h !== s && o.__ng.rowState !==
|
|
842
|
+
h !== s && o.__ng.rowState !== C.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(t) || (o.__ng.o[t] = h), o.__ng.rowState = C.ROW_STATE.UPDATE), o.v[r] = s, e(this, m).owner.refreshData && e(this, m).owner.refreshData(i);
|
|
843
843
|
}, "setValue"));
|
|
844
844
|
v(this, "resetRecords", /* @__PURE__ */ l(() => {
|
|
845
845
|
p(this, Z, e(this, m).rawRecords.filter((i) => !i.__ng.deleted)), p(this, k, e(this, m).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, m).rawRecords.forEach((i, t) => {
|
|
@@ -852,7 +852,7 @@ const q = class q {
|
|
|
852
852
|
u(this, j, /* @__PURE__ */ l((i) => {
|
|
853
853
|
var s;
|
|
854
854
|
if (!i) return i;
|
|
855
|
-
const t = typeof ((s = e(this,
|
|
855
|
+
const t = typeof ((s = e(this, T).fields) == null ? void 0 : s.get) == "function" ? e(this, T).fields.get() : [];
|
|
856
856
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
857
857
|
const r = {};
|
|
858
858
|
return t.forEach((o, h) => {
|
|
@@ -867,14 +867,14 @@ const q = class q {
|
|
|
867
867
|
if (!s || s.length <= 0) return;
|
|
868
868
|
if (i == null) return e(this, j).call(this, s);
|
|
869
869
|
if (i < 0 || i >= s.length) return null;
|
|
870
|
-
const n = typeof ((r = e(this,
|
|
870
|
+
const n = typeof ((r = e(this, T).fields) == null ? void 0 : r.get) == "function" ? e(this, T).fields.get() : [];
|
|
871
871
|
if (t != null) {
|
|
872
872
|
const o = n.indexOf(t);
|
|
873
873
|
return o >= 0 ? s[i].v[o] : null;
|
|
874
874
|
}
|
|
875
875
|
return e(this, j).call(this, s[i]);
|
|
876
876
|
}, "get"));
|
|
877
|
-
p(this,
|
|
877
|
+
p(this, T, i), p(this, m, t), e(this, he).call(this);
|
|
878
878
|
}
|
|
879
879
|
get source() {
|
|
880
880
|
return e(this, j).call(this, e(this, m).rawRecords);
|
|
@@ -886,15 +886,15 @@ const q = class q {
|
|
|
886
886
|
return ++$e(this, ce)._;
|
|
887
887
|
}
|
|
888
888
|
};
|
|
889
|
-
|
|
890
|
-
v(
|
|
889
|
+
T = new WeakMap(), m = new WeakMap(), k = new WeakMap(), Z = new WeakMap(), ce = new WeakMap(), O = new WeakMap(), he = new WeakMap(), ee = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), j = new WeakMap(), l(C, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
890
|
+
v(C, "ROW_STATE", {
|
|
891
891
|
EMPTY: "EMPTY",
|
|
892
892
|
NORMAL: "NORMAL",
|
|
893
893
|
INSERT: "INSERT",
|
|
894
894
|
UPDATE: "UPDATE",
|
|
895
895
|
DELETE: "DELETE"
|
|
896
896
|
});
|
|
897
|
-
let xe =
|
|
897
|
+
let xe = C;
|
|
898
898
|
const Le = class Le {
|
|
899
899
|
constructor(i) {
|
|
900
900
|
this.owner = i, this.row = new ve(this), this.data = new xe(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
@@ -916,35 +916,35 @@ const Le = class Le {
|
|
|
916
916
|
};
|
|
917
917
|
l(Le, "ngDataManager");
|
|
918
918
|
let Se = Le;
|
|
919
|
-
var
|
|
919
|
+
var F, ue;
|
|
920
920
|
const _e = class _e extends HTMLElement {
|
|
921
921
|
constructor() {
|
|
922
922
|
super();
|
|
923
923
|
//#created = false;
|
|
924
|
-
u(this,
|
|
924
|
+
u(this, F);
|
|
925
925
|
u(this, ue);
|
|
926
|
-
this.attachShadow({ mode: "open" }), p(this,
|
|
926
|
+
this.attachShadow({ mode: "open" }), p(this, F, new Se(this));
|
|
927
927
|
}
|
|
928
928
|
connectedCallback() {
|
|
929
|
-
p(this, ue, new me(this.shadowRoot)),
|
|
929
|
+
p(this, ue, new me(this.shadowRoot)), I.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
930
930
|
}
|
|
931
931
|
disconnectedCallback() {
|
|
932
|
-
|
|
932
|
+
I.log("NineTable disconnected.");
|
|
933
933
|
}
|
|
934
934
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
935
935
|
get data() {
|
|
936
|
-
return e(this,
|
|
936
|
+
return e(this, F).data;
|
|
937
937
|
}
|
|
938
938
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
939
939
|
get row() {
|
|
940
|
-
return e(this,
|
|
940
|
+
return e(this, F).row;
|
|
941
941
|
}
|
|
942
942
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
943
943
|
get dataManager() {
|
|
944
|
-
return e(this,
|
|
944
|
+
return e(this, F);
|
|
945
945
|
}
|
|
946
946
|
};
|
|
947
|
-
|
|
947
|
+
F = new WeakMap(), ue = new WeakMap(), l(_e, "NineTable");
|
|
948
948
|
let Ee = _e;
|
|
949
949
|
customElements.get("nine-table") || customElements.define("nine-table", Ee);
|
|
950
950
|
//# sourceMappingURL=nine-table.js.map
|