@ninebone/table 0.0.409 β 0.0.411
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 +80 -81
- 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,26 +22,26 @@ const re = class re extends Se.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(re, "Trace");
|
|
24
24
|
let jt = re;
|
|
25
|
-
const
|
|
26
|
-
var _,
|
|
25
|
+
const k = new jt();
|
|
26
|
+
var _, O, p, P, V, Y, St, X, Et;
|
|
27
27
|
const le = class le extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
c(this, _);
|
|
31
|
-
c(this,
|
|
31
|
+
c(this, O, !1);
|
|
32
32
|
c(this, p);
|
|
33
|
+
c(this, P);
|
|
33
34
|
c(this, V);
|
|
34
35
|
c(this, Y);
|
|
35
|
-
c(this, X);
|
|
36
36
|
c(this, St, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!t(this, _)) return;
|
|
38
38
|
const e = t(this, _).querySelector(".ng-container-body");
|
|
39
|
-
e && (g(this,
|
|
39
|
+
e && (g(this, Y, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), t(this,
|
|
41
|
+
})), t(this, Y).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!t(this, _) || !t(this, p) || t(this,
|
|
44
|
+
if (!t(this, _) || !t(this, p) || t(this, O)) return;
|
|
45
45
|
const e = t(this, p).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
47
|
const n = t(this, p).track, r = t(this, p).thumb, o = t(this, _).querySelector(".ng-container-bottom"), l = e.clientWidth, d = s.scrollWidth;
|
|
@@ -59,9 +59,9 @@ const le = class le extends HTMLElement {
|
|
|
59
59
|
let y = 0;
|
|
60
60
|
b > 0 && (y = parseInt(u / b * (h - f), 10)), y < 0 && (y = 0);
|
|
61
61
|
const m = h - f;
|
|
62
|
-
y > m && (y = m), r.style.left = `${y}px`,
|
|
62
|
+
y > m && (y = m), r.style.left = `${y}px`, k.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
c(this,
|
|
64
|
+
c(this, X, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
66
66
|
const s = t(this, p).container, n = s.querySelector("table");
|
|
67
67
|
if (!n) return !1;
|
|
@@ -75,16 +75,16 @@ const le = class le extends HTMLElement {
|
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
c(this, Et, /* @__PURE__ */ a(() => {
|
|
77
77
|
const e = /* @__PURE__ */ a((n) => {
|
|
78
|
-
clearInterval(t(this,
|
|
78
|
+
clearInterval(t(this, P)), clearInterval(t(this, V));
|
|
79
79
|
const r = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
80
|
-
t(this,
|
|
81
|
-
clearInterval(t(this,
|
|
80
|
+
t(this, X).call(this, r + n), g(this, P, setInterval(() => {
|
|
81
|
+
clearInterval(t(this, P)), g(this, V, setInterval(() => {
|
|
82
82
|
const o = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
83
|
-
t(this,
|
|
83
|
+
t(this, X).call(this, o + n) || clearInterval(t(this, V));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
87
|
-
clearInterval(t(this,
|
|
87
|
+
clearInterval(t(this, P)), clearInterval(t(this, V));
|
|
88
88
|
}, "clearTimer");
|
|
89
89
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
90
90
|
t(this, p).left.addEventListener(n, s), t(this, p).right.addEventListener(n, s), t(this, p).track.addEventListener(n, s);
|
|
@@ -96,16 +96,16 @@ const le = class le extends HTMLElement {
|
|
|
96
96
|
if (n.button !== 0) return;
|
|
97
97
|
n.preventDefault();
|
|
98
98
|
const r = t(this, p).track.getBoundingClientRect(), o = t(this, p).thumb.clientWidth;
|
|
99
|
-
t(this,
|
|
99
|
+
t(this, X).call(this, n.clientX - r.left - o / 2);
|
|
100
100
|
}), t(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
101
101
|
if (n.button !== 0) return;
|
|
102
|
-
n.stopPropagation(), n.preventDefault(), g(this,
|
|
102
|
+
n.stopPropagation(), n.preventDefault(), g(this, O, !0), this.shiftX = n.clientX - t(this, p).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ a((l) => {
|
|
104
|
-
if (!t(this,
|
|
104
|
+
if (!t(this, O)) return;
|
|
105
105
|
const d = t(this, p).track.getBoundingClientRect();
|
|
106
|
-
t(this,
|
|
106
|
+
t(this, X).call(this, l.clientX - d.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
108
|
-
g(this,
|
|
108
|
+
g(this, O, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
110
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
111
111
|
});
|
|
@@ -189,25 +189,25 @@ const le = class le extends HTMLElement {
|
|
|
189
189
|
left: this.querySelector(".ng-scroll-left"),
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), s.addEventListener("scroll", () => {
|
|
192
|
-
t(this,
|
|
192
|
+
t(this, O) || this.refresh();
|
|
193
193
|
}), t(this, Et).call(this), t(this, St).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
196
196
|
}
|
|
197
197
|
disconnectedCallback() {
|
|
198
|
-
t(this,
|
|
198
|
+
t(this, Y) && t(this, Y).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
_ = new WeakMap(),
|
|
201
|
+
_ = new WeakMap(), O = new WeakMap(), p = new WeakMap(), P = new WeakMap(), V = new WeakMap(), Y = new WeakMap(), St = new WeakMap(), X = new WeakMap(), Et = new WeakMap(), a(le, "NineTableHScrollBar");
|
|
202
202
|
let Kt = le;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Kt);
|
|
204
|
-
var
|
|
204
|
+
var U, Q, z, S, ht, dt, Rt;
|
|
205
205
|
const ae = class ae extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
|
-
c(this,
|
|
208
|
+
c(this, U);
|
|
209
209
|
c(this, Q);
|
|
210
|
-
c(this,
|
|
210
|
+
c(this, z, !1);
|
|
211
211
|
c(this, S);
|
|
212
212
|
c(this, ht, 0);
|
|
213
213
|
c(this, dt, 0);
|
|
@@ -215,36 +215,35 @@ const ae = class ae extends HTMLElement {
|
|
|
215
215
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
216
216
|
*/
|
|
217
217
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, l = (t(this, D).data.get() || []).length, d = t(this, Q).getRowHeight(), h = l * d;
|
|
218
|
+
k.log("refresh", t(this, z)), k.log("refresh2");
|
|
219
|
+
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, l = (t(this, U).data.get() || []).length, d = t(this, Q).getRowHeight(), h = l * d;
|
|
221
220
|
if (h <= r) {
|
|
222
221
|
n.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
223
222
|
return;
|
|
224
223
|
} else
|
|
225
224
|
n.style.display = "block";
|
|
226
225
|
const f = s.clientHeight;
|
|
227
|
-
if (
|
|
226
|
+
if (f <= 0) return;
|
|
228
227
|
const u = Math.max(Math.min(f * (r / h), f), 20);
|
|
229
228
|
n.style.height = `${u}px`;
|
|
230
229
|
const b = e.scrollTop, y = Math.max(h - r, 1);
|
|
231
230
|
let m = 0;
|
|
232
231
|
y > 0 && (m = b / y * (f - u));
|
|
233
232
|
const R = f - u;
|
|
234
|
-
m < 0 && (m = 0), m > R && (m = R), n.style.top = `${m}px`,
|
|
233
|
+
m < 0 && (m = 0), m > R && (m = R), n.style.top = `${m}px`, k.log("currentScrollTop", b), k.log("maxScrollTop", y), k.log("trackHeight", f), k.log("thumbHeight", u), t(this, S).top.disabled = b <= 0, t(this, S).bottom.disabled = b >= y - 1;
|
|
235
234
|
}, "refresh"));
|
|
236
235
|
c(this, Rt, /* @__PURE__ */ a(() => {
|
|
237
236
|
const e = t(this, S).container, s = /* @__PURE__ */ a(() => {
|
|
238
|
-
const r = (t(this,
|
|
237
|
+
const r = (t(this, U).data.get() || []).length, o = t(this, Q).getRowHeight();
|
|
239
238
|
return r * o;
|
|
240
239
|
}, "getContentHeight");
|
|
241
240
|
e.addEventListener("scroll", () => {
|
|
242
|
-
t(this,
|
|
241
|
+
t(this, z) || this.refresh();
|
|
243
242
|
}), t(this, S).thumb.addEventListener("mousedown", (n) => {
|
|
244
243
|
if (n.button !== 0) return;
|
|
245
|
-
n.stopPropagation(), n.preventDefault(), g(this,
|
|
244
|
+
n.stopPropagation(), n.preventDefault(), g(this, z, !0), g(this, ht, n.clientY), g(this, dt, e.scrollTop);
|
|
246
245
|
const r = /* @__PURE__ */ a((l) => {
|
|
247
|
-
if (!t(this,
|
|
246
|
+
if (!t(this, z)) return;
|
|
248
247
|
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h, b = l.clientY - t(this, ht), y = e.clientHeight, m = s(), R = Math.max(m - y, 1);
|
|
249
248
|
if (u > 0 && R > 0) {
|
|
250
249
|
const J = b / u * R;
|
|
@@ -254,7 +253,7 @@ const ae = class ae extends HTMLElement {
|
|
|
254
253
|
}
|
|
255
254
|
this.refresh();
|
|
256
255
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
257
|
-
g(this,
|
|
256
|
+
g(this, z, !1), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
258
257
|
}, "onMouseUp");
|
|
259
258
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
260
259
|
}), t(this, S).track.addEventListener("mousedown", (n) => {
|
|
@@ -273,7 +272,7 @@ const ae = class ae extends HTMLElement {
|
|
|
273
272
|
}, "#init"));
|
|
274
273
|
}
|
|
275
274
|
connectedCallback() {
|
|
276
|
-
g(this,
|
|
275
|
+
g(this, U, this.getRootNode().host), g(this, Q, this.closest("nine-table-sheet")), this.innerHTML = `
|
|
277
276
|
<style>
|
|
278
277
|
nine-table-vscrollbar {
|
|
279
278
|
display: flex;
|
|
@@ -339,7 +338,7 @@ const ae = class ae extends HTMLElement {
|
|
|
339
338
|
<button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
|
|
340
339
|
`;
|
|
341
340
|
const e = /* @__PURE__ */ a(() => {
|
|
342
|
-
const s = t(this,
|
|
341
|
+
const s = t(this, U).shadowRoot.querySelector(".ng-container-body");
|
|
343
342
|
if (!s) {
|
|
344
343
|
setTimeout(e, 10);
|
|
345
344
|
return;
|
|
@@ -355,7 +354,7 @@ const ae = class ae extends HTMLElement {
|
|
|
355
354
|
e();
|
|
356
355
|
}
|
|
357
356
|
};
|
|
358
|
-
|
|
357
|
+
U = new WeakMap(), Q = new WeakMap(), z = new WeakMap(), S = new WeakMap(), ht = new WeakMap(), dt = new WeakMap(), Rt = new WeakMap(), a(ae, "NineTableVScrollBar");
|
|
359
358
|
let Zt = ae;
|
|
360
359
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", Zt);
|
|
361
360
|
var At, tt;
|
|
@@ -429,16 +428,16 @@ At = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, At, /* @__PU
|
|
|
429
428
|
});
|
|
430
429
|
}, "#resetColIndex"));
|
|
431
430
|
let Gt = M;
|
|
432
|
-
var I, w, W, T,
|
|
431
|
+
var I, w, W, T, D, F, B, et, Tt, qt, kt, ft, ut, Lt, Ht, gt, Ct, it, bt;
|
|
433
432
|
const ce = class ce {
|
|
434
433
|
constructor(i) {
|
|
435
434
|
c(this, I);
|
|
436
435
|
c(this, w);
|
|
437
436
|
c(this, W, /* @__PURE__ */ new Map());
|
|
438
437
|
c(this, T, null);
|
|
439
|
-
c(this,
|
|
438
|
+
c(this, D, null);
|
|
440
439
|
c(this, F, 0);
|
|
441
|
-
c(this,
|
|
440
|
+
c(this, B, 40);
|
|
442
441
|
c(this, et, !1);
|
|
443
442
|
c(this, Tt, 3);
|
|
444
443
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
@@ -478,7 +477,7 @@ const ce = class ce {
|
|
|
478
477
|
if (!n) return;
|
|
479
478
|
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
480
479
|
const r = n.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
481
|
-
for (let l = 0; l < t(this,
|
|
480
|
+
for (let l = 0; l < t(this, B); l++)
|
|
482
481
|
s.forEach((d) => {
|
|
483
482
|
o.appendChild(d.cloneNode(!0));
|
|
484
483
|
});
|
|
@@ -507,7 +506,7 @@ const ce = class ce {
|
|
|
507
506
|
c(this, ft, /* @__PURE__ */ a(() => {
|
|
508
507
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
509
508
|
const s = (t(this, I).data.get() || []).length, n = t(this, T) || 24, r = s * n;
|
|
510
|
-
|
|
509
|
+
k.log(`[VirtualHeight] totalCount: ${s}, rowHeight: ${n}, totalVirtualHeight: ${r}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
511
510
|
const l = t(this, w).querySelector(o), d = l == null ? void 0 : l.querySelector("table");
|
|
512
511
|
d && (d.style.height = `${r}px`);
|
|
513
512
|
});
|
|
@@ -515,7 +514,7 @@ const ce = class ce {
|
|
|
515
514
|
c(this, ut, /* @__PURE__ */ a(() => {
|
|
516
515
|
if ((t(this, I).data.get() || []).length, t(this, F) > 0 && t(this, T) > 0) {
|
|
517
516
|
const e = Math.ceil(t(this, F) / t(this, T));
|
|
518
|
-
g(this,
|
|
517
|
+
g(this, B, e + t(this, Tt)), k.log("visibleRows:", e, "cachedRowCount:", t(this, B));
|
|
519
518
|
}
|
|
520
519
|
}, "#updateRowCount"));
|
|
521
520
|
c(this, Lt, /* @__PURE__ */ a(() => {
|
|
@@ -533,7 +532,7 @@ const ce = class ce {
|
|
|
533
532
|
}
|
|
534
533
|
}, "#syncRowHeights"));
|
|
535
534
|
c(this, Ht, /* @__PURE__ */ a(() => {
|
|
536
|
-
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (g(this,
|
|
535
|
+
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (g(this, D, new ResizeObserver((i) => {
|
|
537
536
|
for (const e of i) {
|
|
538
537
|
const s = e.target;
|
|
539
538
|
if (!s.classList.contains("active")) continue;
|
|
@@ -546,7 +545,7 @@ const ce = class ce {
|
|
|
546
545
|
t(this, F) !== l && (g(this, F, l), t(this, ut).call(this), t(this, T) !== null && t(this, gt).call(this));
|
|
547
546
|
}
|
|
548
547
|
}
|
|
549
|
-
})), t(this,
|
|
548
|
+
})), t(this, D).observe(t(this, w)));
|
|
550
549
|
}, "#initResizeObserver"));
|
|
551
550
|
c(this, gt, /* @__PURE__ */ a(() => {
|
|
552
551
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
@@ -577,8 +576,8 @@ const ce = class ce {
|
|
|
577
576
|
var d;
|
|
578
577
|
const e = t(this, T);
|
|
579
578
|
if (!e || e <= 0) return;
|
|
580
|
-
const n = (t(this, I).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, W).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this,
|
|
581
|
-
|
|
579
|
+
const n = (t(this, I).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, W).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this, B);
|
|
580
|
+
k.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, B)}, targetDataIndex range: ${r} ~ ${l} (Total: ${n})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
582
581
|
const f = t(this, w).querySelector(h);
|
|
583
582
|
if (!f) return;
|
|
584
583
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
@@ -603,7 +602,7 @@ const ce = class ce {
|
|
|
603
602
|
});
|
|
604
603
|
}, "#bindRowData"));
|
|
605
604
|
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
606
|
-
t(this,
|
|
605
|
+
t(this, D) && (t(this, D).disconnect(), g(this, D, null));
|
|
607
606
|
}, "destroy"));
|
|
608
607
|
g(this, I, i.getRootNode().host), g(this, w, i), t(this, Ht).call(this);
|
|
609
608
|
}
|
|
@@ -615,7 +614,7 @@ const ce = class ce {
|
|
|
615
614
|
return ((e = t(this, W).get(i)) == null ? void 0 : e.length) || 1;
|
|
616
615
|
}
|
|
617
616
|
};
|
|
618
|
-
I = new WeakMap(), w = new WeakMap(), W = new WeakMap(), T = new WeakMap(),
|
|
617
|
+
I = new WeakMap(), w = new WeakMap(), W = new WeakMap(), T = new WeakMap(), D = new WeakMap(), F = new WeakMap(), B = new WeakMap(), et = new WeakMap(), Tt = new WeakMap(), qt = new WeakMap(), kt = new WeakMap(), ft = new WeakMap(), ut = new WeakMap(), Lt = new WeakMap(), Ht = new WeakMap(), gt = new WeakMap(), Ct = new WeakMap(), it = new WeakMap(), bt = new WeakMap(), a(ce, "RowManager");
|
|
619
618
|
let Jt = ce;
|
|
620
619
|
var Mt, st, j, _t, $t, It, Wt, Ot;
|
|
621
620
|
const ct = class ct extends HTMLElement {
|
|
@@ -848,7 +847,7 @@ const ct = class ct extends HTMLElement {
|
|
|
848
847
|
t(this, Wt).call(this);
|
|
849
848
|
}
|
|
850
849
|
disconnectedCallback() {
|
|
851
|
-
this.innerHTML = "",
|
|
850
|
+
this.innerHTML = "", k.log("NineTableSheet destroyed.");
|
|
852
851
|
}
|
|
853
852
|
};
|
|
854
853
|
Mt = new WeakMap(), st = new WeakMap(), j = new WeakMap(), _t = new WeakMap(), $t = new WeakMap(), It = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(), a(ct, "NineTableSheet"), v(ct, "SCROLLBAR_SIZE", 16);
|
|
@@ -1048,27 +1047,27 @@ const fe = class fe {
|
|
|
1048
1047
|
};
|
|
1049
1048
|
mt = new WeakMap(), nt = new WeakMap(), a(fe, "ngRow");
|
|
1050
1049
|
let ee = fe;
|
|
1051
|
-
var
|
|
1050
|
+
var L, E, H, ot, Nt, N, Pt, K, xt, Vt, Yt, rt;
|
|
1052
1051
|
const C = class C {
|
|
1053
1052
|
constructor(i, e) {
|
|
1054
|
-
c(this,
|
|
1053
|
+
c(this, L);
|
|
1055
1054
|
c(this, E);
|
|
1056
|
-
c(this,
|
|
1055
|
+
c(this, H, []);
|
|
1057
1056
|
c(this, ot, []);
|
|
1058
1057
|
c(this, Nt, 0);
|
|
1059
|
-
c(this,
|
|
1058
|
+
c(this, N, []);
|
|
1060
1059
|
c(this, Pt, /* @__PURE__ */ a(() => {
|
|
1061
|
-
g(this,
|
|
1062
|
-
const i = t(this,
|
|
1060
|
+
g(this, N, []);
|
|
1061
|
+
const i = t(this, L).template || [];
|
|
1063
1062
|
Array.from(i).forEach((e) => {
|
|
1064
1063
|
var s;
|
|
1065
|
-
t(this,
|
|
1064
|
+
t(this, N).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1066
1065
|
}), (t(this, E).rawRecords || []).forEach((e) => {
|
|
1067
|
-
e.__ng || (e.__ng = t(this, xt).call(this)), e.__ng.height = t(this,
|
|
1066
|
+
e.__ng || (e.__ng = t(this, xt).call(this)), e.__ng.height = t(this, N).slice();
|
|
1068
1067
|
});
|
|
1069
1068
|
}, "#initialize"));
|
|
1070
1069
|
c(this, K, /* @__PURE__ */ a(() => {
|
|
1071
|
-
t(this,
|
|
1070
|
+
t(this, L).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1072
1071
|
i.invalidate();
|
|
1073
1072
|
});
|
|
1074
1073
|
}, "#invalidate"));
|
|
@@ -1078,7 +1077,7 @@ const C = class C {
|
|
|
1078
1077
|
if (!s || s.length <= 0) return;
|
|
1079
1078
|
if (i == null) return t(this, rt).call(this, s);
|
|
1080
1079
|
if (i < 0 || i >= s.length) return null;
|
|
1081
|
-
const n = typeof ((r = t(this,
|
|
1080
|
+
const n = typeof ((r = t(this, L).fields) == null ? void 0 : r.get) == "function" ? t(this, L).fields.get() : [];
|
|
1082
1081
|
if (e != null) {
|
|
1083
1082
|
const o = n.indexOf(e);
|
|
1084
1083
|
return o >= 0 ? s[i].v[o] : null;
|
|
@@ -1092,22 +1091,22 @@ const C = class C {
|
|
|
1092
1091
|
rowState: C.ROW_STATE.EMPTY,
|
|
1093
1092
|
deleted: !1,
|
|
1094
1093
|
filtered: !1,
|
|
1095
|
-
height: t(this,
|
|
1094
|
+
height: t(this, N).slice(),
|
|
1096
1095
|
o: {},
|
|
1097
1096
|
c: {},
|
|
1098
|
-
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this,
|
|
1097
|
+
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, N).slice(), -1, {}, {}]
|
|
1099
1098
|
}), "#getDefaultMeta"));
|
|
1100
1099
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
1101
|
-
g(this,
|
|
1100
|
+
g(this, H, []), g(this, ot, []), t(this, K).call(this);
|
|
1102
1101
|
}, "reset"));
|
|
1103
1102
|
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
1104
1103
|
var i;
|
|
1105
|
-
t(this, E).rawRecords = [], g(this,
|
|
1104
|
+
t(this, E).rawRecords = [], g(this, H, []), g(this, ot, []), (i = t(this, E).viewRecords) != null && i.reset && t(this, E).viewRecords.reset();
|
|
1106
1105
|
}, "clear"));
|
|
1107
1106
|
c(this, Vt, /* @__PURE__ */ a((i) => {
|
|
1108
1107
|
var n;
|
|
1109
1108
|
Array.isArray(i) || (i = [i]);
|
|
1110
|
-
const e = typeof ((n = t(this,
|
|
1109
|
+
const e = typeof ((n = t(this, L).fields) == null ? void 0 : n.get) == "function" ? t(this, L).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1111
1110
|
return i.forEach((r) => {
|
|
1112
1111
|
const o = { v: [] };
|
|
1113
1112
|
e.forEach((l) => {
|
|
@@ -1131,9 +1130,9 @@ const C = class C {
|
|
|
1131
1130
|
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
1132
1131
|
let e = [];
|
|
1133
1132
|
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s, n) => n - s).forEach((s) => {
|
|
1134
|
-
if (t(this,
|
|
1135
|
-
const n = t(this,
|
|
1136
|
-
t(this,
|
|
1133
|
+
if (t(this, H)[s]) {
|
|
1134
|
+
const n = t(this, H)[s].__ng.rowid;
|
|
1135
|
+
t(this, H)[s].__ng.rowState === C.ROW_STATE.INSERT ? t(this, E).rawRecords = t(this, E).rawRecords.filter((r) => r.__ng.rowid !== n) : t(this, E).rawRecords.forEach((r) => {
|
|
1137
1136
|
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState = C.ROW_STATE.DELETE);
|
|
1138
1137
|
});
|
|
1139
1138
|
}
|
|
@@ -1142,7 +1141,7 @@ const C = class C {
|
|
|
1142
1141
|
v(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
|
|
1143
1142
|
var d;
|
|
1144
1143
|
i = parseInt(i, 10);
|
|
1145
|
-
const r = (typeof ((d = t(this,
|
|
1144
|
+
const r = (typeof ((d = t(this, L).fields) == null ? void 0 : d.get) == "function" ? t(this, L).fields.get() : []).indexOf(e);
|
|
1146
1145
|
if (r < 0) return;
|
|
1147
1146
|
const o = this.getValidData()[i];
|
|
1148
1147
|
if (!o) return;
|
|
@@ -1150,17 +1149,17 @@ const C = class C {
|
|
|
1150
1149
|
l !== s && o.__ng.rowState !== C.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = l), o.__ng.rowState = C.ROW_STATE.UPDATE), o.v[r] = s;
|
|
1151
1150
|
}, "setValue"));
|
|
1152
1151
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1153
|
-
g(this, ot, t(this, E).rawRecords.filter((i) => !i.__ng.deleted)), g(this,
|
|
1152
|
+
g(this, ot, t(this, E).rawRecords.filter((i) => !i.__ng.deleted)), g(this, H, t(this, E).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, E).rawRecords.forEach((i, e) => {
|
|
1154
1153
|
i.__ng.rowidx = e;
|
|
1155
|
-
}), t(this,
|
|
1154
|
+
}), t(this, H).forEach((i, e) => {
|
|
1156
1155
|
i.__ng.i = e;
|
|
1157
1156
|
});
|
|
1158
1157
|
}, "resetRecords"));
|
|
1159
|
-
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this,
|
|
1158
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this, H).length === 0 && t(this, E).rawRecords.length > 0 && this.resetRecords(), t(this, H)), "getValidData"));
|
|
1160
1159
|
c(this, rt, /* @__PURE__ */ a((i) => {
|
|
1161
1160
|
var o;
|
|
1162
1161
|
if (!i) return i;
|
|
1163
|
-
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this,
|
|
1162
|
+
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this, L).fields) == null ? void 0 : o.get) == "function" ? t(this, L).fields.get() : [], r = s.filter((l) => !l.__ng.deleted).map((l) => {
|
|
1164
1163
|
const d = {};
|
|
1165
1164
|
return n.forEach((h, f) => {
|
|
1166
1165
|
d[h] = l.v ? l.v[f] : l[h];
|
|
@@ -1169,7 +1168,7 @@ const C = class C {
|
|
|
1169
1168
|
return e ? r[0] : r;
|
|
1170
1169
|
}, "#conv"));
|
|
1171
1170
|
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
1172
|
-
g(this,
|
|
1171
|
+
g(this, L, i), g(this, E, e), t(this, Pt).call(this);
|
|
1173
1172
|
}
|
|
1174
1173
|
get source() {
|
|
1175
1174
|
return t(this, rt).call(this, t(this, E).rawRecords);
|
|
@@ -1181,13 +1180,13 @@ const C = class C {
|
|
|
1181
1180
|
return ++ve(this, Nt)._;
|
|
1182
1181
|
}
|
|
1183
1182
|
get length() {
|
|
1184
|
-
return t(this,
|
|
1183
|
+
return t(this, H).length;
|
|
1185
1184
|
}
|
|
1186
1185
|
getRowCount() {
|
|
1187
1186
|
return this.length;
|
|
1188
1187
|
}
|
|
1189
1188
|
};
|
|
1190
|
-
|
|
1189
|
+
L = new WeakMap(), E = new WeakMap(), H = new WeakMap(), ot = new WeakMap(), Nt = new WeakMap(), N = new WeakMap(), Pt = new WeakMap(), K = new WeakMap(), xt = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), rt = new WeakMap(), a(C, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1191
1190
|
v(C, "ROW_STATE", {
|
|
1192
1191
|
EMPTY: "EMPTY",
|
|
1193
1192
|
NORMAL: "NORMAL",
|
|
@@ -1237,11 +1236,11 @@ const ge = class ge {
|
|
|
1237
1236
|
}), g(this, A, Array.from(i, ([e, s]) => ({ name: e, type: s }))), g(this, A, t(this, A).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, A).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1238
1237
|
}, "#adjust"));
|
|
1239
1238
|
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1240
|
-
g(this, A, []),
|
|
1239
|
+
g(this, A, []), k.log(t(this, lt).querySelectorAll("table"));
|
|
1241
1240
|
const i = Array.from(t(this, lt).querySelectorAll("table"));
|
|
1242
1241
|
if (!(!i || i.length === 0)) {
|
|
1243
1242
|
for (const e of i)
|
|
1244
|
-
|
|
1243
|
+
k.log(e), $("[data-bind]", e).each((s, n) => {
|
|
1245
1244
|
const r = n.dataset.bind, o = n.getAttribute("data-type") || "string";
|
|
1246
1245
|
r && t(this, A).push({ name: r, type: o });
|
|
1247
1246
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1300,7 +1299,7 @@ const be = class be extends HTMLElement {
|
|
|
1300
1299
|
c(this, G);
|
|
1301
1300
|
c(this, Ut);
|
|
1302
1301
|
c(this, Ft, /* @__PURE__ */ a(() => {
|
|
1303
|
-
this.fields = new ne(this), g(this, Ut, new te(this)),
|
|
1302
|
+
this.fields = new ne(this), g(this, Ut, new te(this)), k.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1304
1303
|
}, "#init"));
|
|
1305
1304
|
this.attachShadow({ mode: "open" }), g(this, G, new se(this));
|
|
1306
1305
|
}
|
|
@@ -1308,7 +1307,7 @@ const be = class be extends HTMLElement {
|
|
|
1308
1307
|
t(this, Ft).call(this);
|
|
1309
1308
|
}
|
|
1310
1309
|
disconnectedCallback() {
|
|
1311
|
-
|
|
1310
|
+
k.log("NineTable disconnected.");
|
|
1312
1311
|
}
|
|
1313
1312
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1314
1313
|
get data() {
|