@ninebone/table 0.0.713 β 0.0.715
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 +71 -67
- 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
|
@@ -23,28 +23,28 @@ const We = class We extends ls.constructor {
|
|
|
23
23
|
h(We, "Trace");
|
|
24
24
|
let ue = We;
|
|
25
25
|
const E = new ue();
|
|
26
|
-
var
|
|
26
|
+
var D, Y, R, K, Z, G, Dt, J, Pt;
|
|
27
27
|
const Be = class Be extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
d(this,
|
|
30
|
+
d(this, D);
|
|
31
31
|
d(this, Y, !1);
|
|
32
32
|
d(this, R);
|
|
33
33
|
d(this, K);
|
|
34
34
|
d(this, Z);
|
|
35
35
|
d(this, G);
|
|
36
36
|
d(this, Dt, /* @__PURE__ */ h(() => {
|
|
37
|
-
if (!t(this,
|
|
38
|
-
const e = t(this,
|
|
37
|
+
if (!t(this, D)) return;
|
|
38
|
+
const e = t(this, D).querySelector(".ng-container-body .ng-part-body");
|
|
39
39
|
e && (p(this, G, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), t(this, G).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
44
|
-
if (!t(this,
|
|
44
|
+
if (!t(this, D) || !t(this, R) || t(this, Y)) return;
|
|
45
45
|
const e = t(this, R).container, n = e.querySelector("table");
|
|
46
46
|
if (!n) return;
|
|
47
|
-
const r = t(this, R).track, o = t(this, R).thumb, i = t(this,
|
|
47
|
+
const r = t(this, R).track, o = t(this, R).thumb, i = t(this, D).querySelector(".ng-container-bottom"), a = e.clientWidth, c = n.scrollWidth;
|
|
48
48
|
if (a !== 0 && c > a)
|
|
49
49
|
i && (i.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -112,7 +112,7 @@ const Be = class Be extends HTMLElement {
|
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (p(this,
|
|
115
|
+
if (p(this, D, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, D)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -177,7 +177,7 @@ const Be = class Be extends HTMLElement {
|
|
|
177
177
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
178
178
|
`;
|
|
179
179
|
const e = /* @__PURE__ */ h(() => {
|
|
180
|
-
const n = t(this,
|
|
180
|
+
const n = t(this, D).querySelector(".ng-container-body .ng-part-body");
|
|
181
181
|
if (!n) {
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
@@ -198,7 +198,7 @@ const Be = class Be extends HTMLElement {
|
|
|
198
198
|
t(this, G) && t(this, G).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
201
|
+
D = new WeakMap(), Y = new WeakMap(), R = new WeakMap(), K = new WeakMap(), Z = new WeakMap(), G = new WeakMap(), Dt = new WeakMap(), J = new WeakMap(), Pt = new WeakMap(), h(Be, "NineTableHScrollBar");
|
|
202
202
|
let ge = Be;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ge);
|
|
204
204
|
var Q, tt, ft, C, Et, At, Ft;
|
|
@@ -353,13 +353,13 @@ const De = class De extends HTMLElement {
|
|
|
353
353
|
Q = new WeakMap(), tt = new WeakMap(), ft = new WeakMap(), C = new WeakMap(), Et = new WeakMap(), At = new WeakMap(), Ft = new WeakMap(), h(De, "NineTableVScrollBar");
|
|
354
354
|
let be = De;
|
|
355
355
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", be);
|
|
356
|
-
var
|
|
356
|
+
var F, S, et, P, N, V, st, qt, Le, He, jt, Yt, Tt, Ct, kt, Vt, Ut, Lt, Ie, ut, Ht, Xt;
|
|
357
357
|
const Pe = class Pe {
|
|
358
358
|
constructor(s) {
|
|
359
|
-
d(this,
|
|
359
|
+
d(this, F);
|
|
360
360
|
d(this, S);
|
|
361
361
|
d(this, et);
|
|
362
|
-
d(this,
|
|
362
|
+
d(this, P, /* @__PURE__ */ new Map());
|
|
363
363
|
d(this, N, null);
|
|
364
364
|
d(this, V, null);
|
|
365
365
|
d(this, st, 0);
|
|
@@ -378,7 +378,7 @@ const Pe = class Pe {
|
|
|
378
378
|
E.log("rowManager.initialize"), p(this, et, {
|
|
379
379
|
scrollTables: t(this, S).querySelectorAll(".ng-part-body table"),
|
|
380
380
|
firstTr: t(this, S).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")
|
|
381
|
-
}), p(this, N, null), t(this,
|
|
381
|
+
}), p(this, N, null), t(this, P).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
382
382
|
const a = t(this, S).querySelector(i);
|
|
383
383
|
if (!a) return;
|
|
384
384
|
const c = a.querySelector(".ng-part-body table");
|
|
@@ -386,7 +386,7 @@ const Pe = class Pe {
|
|
|
386
386
|
const l = c.querySelector("tbody.bindable-tbody");
|
|
387
387
|
if (!l) return;
|
|
388
388
|
const u = Array.from(l.querySelectorAll("tr")).map((b) => b.cloneNode(!0));
|
|
389
|
-
t(this,
|
|
389
|
+
t(this, P).set(i, u);
|
|
390
390
|
});
|
|
391
391
|
const s = t(this, S).querySelector(".ng-container-body .ng-part-body"), e = t(this, S).querySelector(".ng-container-left .ng-part-body"), n = t(this, S).querySelector(".ng-container-right .ng-part-body"), r = t(this, S).querySelector(".ng-container-body .ng-part-header"), o = t(this, S).querySelector(".ng-container-body .ng-part-footer");
|
|
392
392
|
if (s) {
|
|
@@ -408,7 +408,7 @@ const Pe = class Pe {
|
|
|
408
408
|
}, "initialize"));
|
|
409
409
|
d(this, Yt, /* @__PURE__ */ h((s, e) => {
|
|
410
410
|
E.log("rowManager.#renderRows");
|
|
411
|
-
const n = t(this,
|
|
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");
|
|
414
414
|
if (!r) return;
|
|
@@ -425,7 +425,7 @@ const Pe = class Pe {
|
|
|
425
425
|
return t(this, N);
|
|
426
426
|
const s = t(this, S).querySelector(".ng-container-body .ng-part-body");
|
|
427
427
|
E.log("rowManager.#measureAndCacheHeight");
|
|
428
|
-
const e = t(this,
|
|
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
431
|
if (E.log(n), !n) throw new Error("invalid dom");
|
|
@@ -449,7 +449,7 @@ const Pe = class Pe {
|
|
|
449
449
|
}, "#measureAndCacheHeight"));
|
|
450
450
|
d(this, Ct, /* @__PURE__ */ h(() => {
|
|
451
451
|
E.log("rowManager.#updateVirtualScrollHeight");
|
|
452
|
-
const e = (t(this,
|
|
452
|
+
const e = (t(this, F).data.get() || []).length, n = t(this, N), r = e * n;
|
|
453
453
|
E.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, S).querySelector(o);
|
|
455
455
|
if (!i) return;
|
|
@@ -519,14 +519,14 @@ const Pe = class Pe {
|
|
|
519
519
|
if (!n) return;
|
|
520
520
|
const r = n.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
521
521
|
if (!r) return;
|
|
522
|
-
const o = Array.from(r.querySelectorAll("tr:not(.nodata)")), i = ((l = t(this,
|
|
522
|
+
const o = Array.from(r.querySelectorAll("tr:not(.nodata)")), i = ((l = t(this, P).get(e)) == null ? void 0 : l.length) || 1, c = (t(this, F).data.get() || []).length;
|
|
523
523
|
o.forEach((f, u) => {
|
|
524
524
|
const b = s + Math.floor(u / i);
|
|
525
525
|
if (b >= c) {
|
|
526
526
|
f.style.visibility = "hidden";
|
|
527
527
|
return;
|
|
528
528
|
}
|
|
529
|
-
const g = t(this,
|
|
529
|
+
const g = t(this, F).data.get(b);
|
|
530
530
|
f.style.display = "", t(this, Ht).call(this, f, g, b);
|
|
531
531
|
});
|
|
532
532
|
});
|
|
@@ -535,9 +535,9 @@ const Pe = class Pe {
|
|
|
535
535
|
var u, b;
|
|
536
536
|
const e = t(this, N);
|
|
537
537
|
if (!e || e <= 0) return;
|
|
538
|
-
const n = t(this,
|
|
538
|
+
const n = t(this, F).data.length;
|
|
539
539
|
if (n === 0) return;
|
|
540
|
-
const r = ((u = t(this,
|
|
540
|
+
const r = ((u = t(this, P).get(".ng-container-body")) == null ? void 0 : u.length) || 1, o = t(this, S).querySelector(".ng-container-body .ng-part-body");
|
|
541
541
|
E.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);
|
|
@@ -556,7 +556,7 @@ const Pe = class Pe {
|
|
|
556
556
|
m.style.display = "none";
|
|
557
557
|
return;
|
|
558
558
|
}
|
|
559
|
-
const _ = t(this,
|
|
559
|
+
const _ = t(this, F).data.get(T);
|
|
560
560
|
m.style.display = "", t(this, Ht).call(this, m, _, T);
|
|
561
561
|
});
|
|
562
562
|
}));
|
|
@@ -600,17 +600,17 @@ const Pe = class Pe {
|
|
|
600
600
|
A(this, "destroy", /* @__PURE__ */ h(() => {
|
|
601
601
|
t(this, V) && (t(this, V).disconnect(), p(this, V, null));
|
|
602
602
|
}, "destroy"));
|
|
603
|
-
p(this,
|
|
603
|
+
p(this, F, s.getRootNode().host), p(this, S, s), t(this, Ut).call(this);
|
|
604
604
|
}
|
|
605
605
|
getRowHeight() {
|
|
606
606
|
return t(this, N);
|
|
607
607
|
}
|
|
608
608
|
templateLength(s = ".ng-container-body") {
|
|
609
609
|
var e;
|
|
610
|
-
return ((e = t(this,
|
|
610
|
+
return ((e = t(this, P).get(s)) == null ? void 0 : e.length) || 1;
|
|
611
611
|
}
|
|
612
612
|
};
|
|
613
|
-
|
|
613
|
+
F = new WeakMap(), S = new WeakMap(), et = new WeakMap(), P = new WeakMap(), N = new WeakMap(), V = new WeakMap(), st = new WeakMap(), qt = new WeakMap(), Le = new WeakMap(), He = new WeakMap(), jt = new WeakMap(), Yt = new WeakMap(), Tt = new WeakMap(), Ct = new WeakMap(), kt = new WeakMap(), Vt = new WeakMap(), Ut = new WeakMap(), Lt = new WeakMap(), Ie = new WeakMap(), ut = new WeakMap(), Ht = new WeakMap(), Xt = new WeakMap(), h(Pe, "RowManager");
|
|
614
614
|
let pe = Pe;
|
|
615
615
|
const Kt = class Kt {
|
|
616
616
|
/**
|
|
@@ -691,16 +691,16 @@ const Kt = class Kt {
|
|
|
691
691
|
};
|
|
692
692
|
h(Kt, "TableCompiler");
|
|
693
693
|
let ye = Kt;
|
|
694
|
-
var
|
|
694
|
+
var z, nt, j, wt, is;
|
|
695
695
|
const Fe = class Fe {
|
|
696
696
|
constructor(s) {
|
|
697
697
|
d(this, j);
|
|
698
|
-
d(this,
|
|
698
|
+
d(this, z);
|
|
699
699
|
d(this, nt, { startRow: -1, startCol: -1, endRow: -1, endCol: -1 });
|
|
700
700
|
A(this, "render", /* @__PURE__ */ h(() => {
|
|
701
701
|
const { startRow: s, startCol: e, endRow: n, endCol: r } = t(this, nt);
|
|
702
702
|
E.log("π¨ [CellSelection.render] Rendering range ->", t(this, nt));
|
|
703
|
-
const o = t(this,
|
|
703
|
+
const o = t(this, z).querySelectorAll(
|
|
704
704
|
".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"
|
|
705
705
|
);
|
|
706
706
|
if (o.forEach((a) => {
|
|
@@ -725,12 +725,12 @@ const Fe = class Fe {
|
|
|
725
725
|
});
|
|
726
726
|
}), E.log(`β¨ [CellSelection.render] Total rendered cells marked: ${i}`);
|
|
727
727
|
}, "render"));
|
|
728
|
-
p(this,
|
|
728
|
+
p(this, z, s), dt(this, j, is).call(this), E.log("π― [CellSelection] Initialized");
|
|
729
729
|
}
|
|
730
730
|
setRange(s, e, n, r) {
|
|
731
731
|
E.log(`π [CellSelection.setRange] Input -> startRow: ${s}, startCol: ${e}, endRow: ${n}, endCol: ${r}`);
|
|
732
732
|
let o = Math.min(s, n), i = Math.max(s, n), a = Math.min(e, r), c = Math.max(e, r);
|
|
733
|
-
const l = t(this,
|
|
733
|
+
const l = t(this, z).querySelectorAll(
|
|
734
734
|
".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"
|
|
735
735
|
);
|
|
736
736
|
let f = !0, u = 0;
|
|
@@ -753,14 +753,14 @@ const Fe = class Fe {
|
|
|
753
753
|
p(this, nt, { startRow: o, startCol: a, endRow: i, endCol: c }), E.log("π¦ [CellSelection.setRange] Final Range ->", t(this, nt)), this.render();
|
|
754
754
|
}
|
|
755
755
|
};
|
|
756
|
-
|
|
756
|
+
z = new WeakMap(), nt = new WeakMap(), j = new WeakSet(), wt = /* @__PURE__ */ h(function(s) {
|
|
757
757
|
if (!s || s.classList.contains("nodata")) return { dataRow: -1, subRowIndex: -1, matrixRow: -1 };
|
|
758
758
|
const e = parseInt(s.dataset.row, 10);
|
|
759
759
|
if (isNaN(e)) return { dataRow: -1, subRowIndex: -1, matrixRow: -1 };
|
|
760
760
|
const n = s.closest("tbody"), o = Array.from(n.querySelectorAll("tr:not(.nodata)")).filter((l) => parseInt(l.dataset.row, 10) === e), i = o.indexOf(s), a = o.length > 0 ? o.length : 1, c = e * a + (i >= 0 ? i : s.sectionRowIndex % a);
|
|
761
761
|
return { dataRow: e, subRowIndex: i, matrixRow: c };
|
|
762
762
|
}, "#getMatrixRow"), is = /* @__PURE__ */ h(function() {
|
|
763
|
-
const s = t(this,
|
|
763
|
+
const s = t(this, z).querySelector(".ng-container-top");
|
|
764
764
|
if (!s) {
|
|
765
765
|
E.log("β [CellSelection] .ng-container-top not found!");
|
|
766
766
|
return;
|
|
@@ -769,14 +769,18 @@ F = new WeakMap(), nt = new WeakMap(), j = new WeakSet(), wt = /* @__PURE__ */ h
|
|
|
769
769
|
if (e.button !== 0) return;
|
|
770
770
|
const n = e.target.closest("td, th");
|
|
771
771
|
if (!n || n.dataset.row === void 0 || n.dataset.col === void 0 || n.closest("tr").classList.contains("nodata")) return;
|
|
772
|
+
t(this, z).style.userSelect = "none", t(this, z).style.webkitUserSelect = "none";
|
|
772
773
|
const r = n.closest("tr"), { matrixRow: o } = dt(this, j, wt).call(this, r), i = parseInt(n.dataset.col, 10);
|
|
773
|
-
if (o < 0)
|
|
774
|
+
if (o < 0) {
|
|
775
|
+
t(this, z).style.userSelect = "", t(this, z).style.webkitUserSelect = "";
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
774
778
|
E.log(`π±οΈ [MouseDown Success] startRow: ${o}, startCol: ${i}`), this.setRange(o, i, o, i);
|
|
775
779
|
const a = /* @__PURE__ */ h((l) => {
|
|
776
780
|
const f = document.elementFromPoint(l.clientX, l.clientY);
|
|
777
781
|
let u = f == null ? void 0 : f.closest("td, th");
|
|
778
|
-
if (!u || !t(this,
|
|
779
|
-
const v = t(this,
|
|
782
|
+
if (!u || !t(this, z).contains(u)) {
|
|
783
|
+
const v = t(this, z).querySelectorAll(".ng-part-body tbody tr:not(.nodata) td, .ng-part-body tbody tr:not(.nodata) th");
|
|
780
784
|
for (const w of v) {
|
|
781
785
|
const m = w.getBoundingClientRect();
|
|
782
786
|
if (l.clientX >= m.left && l.clientX <= m.right && l.clientY >= m.top && l.clientY <= m.bottom) {
|
|
@@ -789,7 +793,7 @@ F = new WeakMap(), nt = new WeakMap(), j = new WeakSet(), wt = /* @__PURE__ */ h
|
|
|
789
793
|
const b = u.closest("tr"), { matrixRow: g } = dt(this, j, wt).call(this, b), y = parseInt(u.dataset.col, 10);
|
|
790
794
|
g < 0 || this.setRange(o, i, g, y);
|
|
791
795
|
}, "onMouseMove"), c = /* @__PURE__ */ h(() => {
|
|
792
|
-
E.log("π±οΈ [MouseUp] Drag ended."), document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", c);
|
|
796
|
+
E.log("π±οΈ [MouseUp] Drag ended."), t(this, z).style.userSelect = "", t(this, z).style.webkitUserSelect = "", document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", c);
|
|
793
797
|
}, "onMouseUp");
|
|
794
798
|
document.addEventListener("mousemove", a), document.addEventListener("mouseup", c);
|
|
795
799
|
});
|
|
@@ -1304,18 +1308,18 @@ const Ve = class Ve {
|
|
|
1304
1308
|
};
|
|
1305
1309
|
_t = new WeakMap(), bt = new WeakMap(), h(Ve, "ngRow");
|
|
1306
1310
|
let we = Ve;
|
|
1307
|
-
var
|
|
1308
|
-
const
|
|
1311
|
+
var O, k, W, pt, re, U, oe, it, Nt, ie, ae, yt;
|
|
1312
|
+
const B = class B {
|
|
1309
1313
|
constructor(s, e) {
|
|
1310
|
-
d(this,
|
|
1314
|
+
d(this, O);
|
|
1311
1315
|
d(this, k);
|
|
1312
|
-
d(this,
|
|
1316
|
+
d(this, W, []);
|
|
1313
1317
|
d(this, pt, []);
|
|
1314
1318
|
d(this, re, 0);
|
|
1315
1319
|
d(this, U, []);
|
|
1316
1320
|
d(this, oe, /* @__PURE__ */ h(() => {
|
|
1317
1321
|
p(this, U, []);
|
|
1318
|
-
const s = t(this,
|
|
1322
|
+
const s = t(this, O).template || [];
|
|
1319
1323
|
Array.from(s).forEach((e) => {
|
|
1320
1324
|
var n;
|
|
1321
1325
|
t(this, U).push(((n = e.getBoundingClientRect) == null ? void 0 : n.call(e).height) || 24);
|
|
@@ -1324,8 +1328,8 @@ const W = class W {
|
|
|
1324
1328
|
});
|
|
1325
1329
|
}, "#initialize"));
|
|
1326
1330
|
d(this, it, /* @__PURE__ */ h(() => {
|
|
1327
|
-
const s = t(this,
|
|
1328
|
-
s == null || s.classList.toggle("nodata", this.length === 0), t(this,
|
|
1331
|
+
const s = t(this, O).shadowRoot.querySelector("nine-table-sheets");
|
|
1332
|
+
s == null || s.classList.toggle("nodata", this.length === 0), t(this, O).shadowRoot.querySelectorAll("nine-table-sheet").forEach((e) => {
|
|
1329
1333
|
e.invalidate();
|
|
1330
1334
|
});
|
|
1331
1335
|
}, "#invalidate"));
|
|
@@ -1335,7 +1339,7 @@ const W = class W {
|
|
|
1335
1339
|
if (!n || n.length <= 0) return;
|
|
1336
1340
|
if (s == null) return t(this, yt).call(this, n);
|
|
1337
1341
|
if (s < 0 || s >= n.length) return null;
|
|
1338
|
-
const r = typeof ((o = t(this,
|
|
1342
|
+
const r = typeof ((o = t(this, O).fields) == null ? void 0 : o.get) == "function" ? t(this, O).fields.get() : [];
|
|
1339
1343
|
if (e != null) {
|
|
1340
1344
|
const i = r.indexOf(e);
|
|
1341
1345
|
return i >= 0 ? n[s].v[i] : null;
|
|
@@ -1346,25 +1350,25 @@ const W = class W {
|
|
|
1346
1350
|
this.clear(), this.add(s, !1), t(this, it).call(this);
|
|
1347
1351
|
}, "set"));
|
|
1348
1352
|
d(this, Nt, /* @__PURE__ */ h(() => ({
|
|
1349
|
-
rowState:
|
|
1353
|
+
rowState: B.ROW_STATE.EMPTY,
|
|
1350
1354
|
deleted: !1,
|
|
1351
1355
|
filtered: !1,
|
|
1352
1356
|
height: t(this, U).slice(),
|
|
1353
1357
|
o: {},
|
|
1354
1358
|
c: {},
|
|
1355
|
-
_: [0, 0, 0, 0,
|
|
1359
|
+
_: [0, 0, 0, 0, B.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, U).slice(), -1, {}, {}]
|
|
1356
1360
|
}), "#getDefaultMeta"));
|
|
1357
1361
|
A(this, "reset", /* @__PURE__ */ h(() => {
|
|
1358
|
-
p(this,
|
|
1362
|
+
p(this, W, []), p(this, pt, []), t(this, it).call(this);
|
|
1359
1363
|
}, "reset"));
|
|
1360
1364
|
A(this, "clear", /* @__PURE__ */ h(() => {
|
|
1361
1365
|
var s;
|
|
1362
|
-
t(this, k).rawRecords = [], p(this,
|
|
1366
|
+
t(this, k).rawRecords = [], p(this, W, []), p(this, pt, []), (s = t(this, k).viewRecords) != null && s.reset && t(this, k).viewRecords.reset();
|
|
1363
1367
|
}, "clear"));
|
|
1364
1368
|
d(this, ie, /* @__PURE__ */ h((s) => {
|
|
1365
1369
|
var r;
|
|
1366
1370
|
Array.isArray(s) || (s = [s]);
|
|
1367
|
-
const e = typeof ((r = t(this,
|
|
1371
|
+
const e = typeof ((r = t(this, O).fields) == null ? void 0 : r.get) == "function" ? t(this, O).fields.get() : Object.keys(s[0] || {}), n = [];
|
|
1368
1372
|
return s.forEach((o) => {
|
|
1369
1373
|
const i = { v: [] };
|
|
1370
1374
|
e.forEach((a) => {
|
|
@@ -1373,7 +1377,7 @@ const W = class W {
|
|
|
1373
1377
|
}), n;
|
|
1374
1378
|
}, "#json2Array"));
|
|
1375
1379
|
d(this, ae, /* @__PURE__ */ h((s) => (Array.isArray(s) || (s = [s]), s.forEach((e) => {
|
|
1376
|
-
e.__ng = t(this, Nt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState =
|
|
1380
|
+
e.__ng = t(this, Nt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = B.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1377
1381
|
}), s), "#defaultInsert"));
|
|
1378
1382
|
A(this, "add", /* @__PURE__ */ h((s, e = !0) => {
|
|
1379
1383
|
s === void 0 && (s = {});
|
|
@@ -1382,16 +1386,16 @@ const W = class W {
|
|
|
1382
1386
|
const r = this.count() - 1;
|
|
1383
1387
|
return e || n.forEach((o, i) => {
|
|
1384
1388
|
const a = t(this, k).rawRecords[r - i];
|
|
1385
|
-
a && (a.__ng.rowState =
|
|
1389
|
+
a && (a.__ng.rowState = B.ROW_STATE.EMPTY);
|
|
1386
1390
|
}), t(this, it).call(this), r;
|
|
1387
1391
|
}, "add"));
|
|
1388
1392
|
A(this, "delete", /* @__PURE__ */ h((s) => {
|
|
1389
1393
|
let e = [];
|
|
1390
1394
|
Array.isArray(s) ? e = s : typeof s > "u" ? e = [t(this, k).host.row.at] : e = [parseInt(s, 10)], e.sort((n, r) => r - n).forEach((n) => {
|
|
1391
|
-
if (t(this,
|
|
1392
|
-
const r = t(this,
|
|
1393
|
-
t(this,
|
|
1394
|
-
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState =
|
|
1395
|
+
if (t(this, W)[n]) {
|
|
1396
|
+
const r = t(this, W)[n].__ng.rowid;
|
|
1397
|
+
t(this, W)[n].__ng.rowState === B.ROW_STATE.INSERT ? t(this, k).rawRecords = t(this, k).rawRecords.filter((o) => o.__ng.rowid !== r) : t(this, k).rawRecords.forEach((o) => {
|
|
1398
|
+
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState = B.ROW_STATE.DELETE);
|
|
1395
1399
|
});
|
|
1396
1400
|
}
|
|
1397
1401
|
}), this.resetRecords(), t(this, it).call(this);
|
|
@@ -1399,25 +1403,25 @@ const W = class W {
|
|
|
1399
1403
|
A(this, "setValue", /* @__PURE__ */ h((s, e, n) => {
|
|
1400
1404
|
var c;
|
|
1401
1405
|
s = parseInt(s, 10);
|
|
1402
|
-
const o = (typeof ((c = t(this,
|
|
1406
|
+
const o = (typeof ((c = t(this, O).fields) == null ? void 0 : c.get) == "function" ? t(this, O).fields.get() : []).indexOf(e);
|
|
1403
1407
|
if (o < 0) return;
|
|
1404
1408
|
const i = this.getValidData()[s];
|
|
1405
1409
|
if (!i) return;
|
|
1406
1410
|
const a = i.v[o];
|
|
1407
|
-
a !== n && i.__ng.rowState !==
|
|
1411
|
+
a !== n && i.__ng.rowState !== B.ROW_STATE.INSERT && (i.__ng.o.hasOwnProperty(e) || (i.__ng.o[e] = a), i.__ng.rowState = B.ROW_STATE.UPDATE), i.v[o] = n;
|
|
1408
1412
|
}, "setValue"));
|
|
1409
1413
|
A(this, "resetRecords", /* @__PURE__ */ h(() => {
|
|
1410
|
-
p(this, pt, t(this, k).rawRecords.filter((s) => !s.__ng.deleted)), p(this,
|
|
1414
|
+
p(this, pt, t(this, k).rawRecords.filter((s) => !s.__ng.deleted)), p(this, W, t(this, k).rawRecords.filter((s) => !s.__ng.deleted && !s.__ng.filtered)), t(this, k).rawRecords.forEach((s, e) => {
|
|
1411
1415
|
s.__ng.rowidx = e;
|
|
1412
|
-
}), t(this,
|
|
1416
|
+
}), t(this, W).forEach((s, e) => {
|
|
1413
1417
|
s.__ng.i = e;
|
|
1414
1418
|
});
|
|
1415
1419
|
}, "resetRecords"));
|
|
1416
|
-
A(this, "getValidData", /* @__PURE__ */ h(() => (t(this,
|
|
1420
|
+
A(this, "getValidData", /* @__PURE__ */ h(() => (t(this, W).length === 0 && t(this, k).rawRecords.length > 0 && this.resetRecords(), t(this, W)), "getValidData"));
|
|
1417
1421
|
d(this, yt, /* @__PURE__ */ h((s) => {
|
|
1418
1422
|
var i;
|
|
1419
1423
|
if (!s) return s;
|
|
1420
|
-
const e = !Array.isArray(s), n = e ? [s] : s, r = typeof ((i = t(this,
|
|
1424
|
+
const e = !Array.isArray(s), n = e ? [s] : s, r = typeof ((i = t(this, O).fields) == null ? void 0 : i.get) == "function" ? t(this, O).fields.get() : [], o = n.filter((a) => !a.__ng.deleted).map((a) => {
|
|
1421
1425
|
const c = {};
|
|
1422
1426
|
return r.forEach((l, f) => {
|
|
1423
1427
|
c[l] = a.v ? a.v[f] : a[l];
|
|
@@ -1426,7 +1430,7 @@ const W = class W {
|
|
|
1426
1430
|
return e ? o[0] : o;
|
|
1427
1431
|
}, "#conv"));
|
|
1428
1432
|
A(this, "count", /* @__PURE__ */ h(() => this.getValidData().length, "count"));
|
|
1429
|
-
p(this,
|
|
1433
|
+
p(this, O, s), p(this, k, e), t(this, oe).call(this);
|
|
1430
1434
|
}
|
|
1431
1435
|
get source() {
|
|
1432
1436
|
return t(this, yt).call(this, t(this, k).rawRecords);
|
|
@@ -1438,24 +1442,24 @@ const W = class W {
|
|
|
1438
1442
|
return ++os(this, re)._;
|
|
1439
1443
|
}
|
|
1440
1444
|
get count() {
|
|
1441
|
-
return t(this,
|
|
1445
|
+
return t(this, W).length;
|
|
1442
1446
|
}
|
|
1443
1447
|
get length() {
|
|
1444
|
-
return t(this,
|
|
1448
|
+
return t(this, W).length;
|
|
1445
1449
|
}
|
|
1446
1450
|
getRowCount() {
|
|
1447
1451
|
return this.length;
|
|
1448
1452
|
}
|
|
1449
1453
|
};
|
|
1450
|
-
|
|
1451
|
-
A(
|
|
1454
|
+
O = new WeakMap(), k = new WeakMap(), W = new WeakMap(), pt = new WeakMap(), re = new WeakMap(), U = new WeakMap(), oe = new WeakMap(), it = new WeakMap(), Nt = new WeakMap(), ie = new WeakMap(), ae = new WeakMap(), yt = new WeakMap(), h(B, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1455
|
+
A(B, "ROW_STATE", {
|
|
1452
1456
|
EMPTY: "EMPTY",
|
|
1453
1457
|
NORMAL: "NORMAL",
|
|
1454
1458
|
INSERT: "INSERT",
|
|
1455
1459
|
UPDATE: "UPDATE",
|
|
1456
1460
|
DELETE: "DELETE"
|
|
1457
1461
|
});
|
|
1458
|
-
let Se =
|
|
1462
|
+
let Se = B;
|
|
1459
1463
|
var at;
|
|
1460
1464
|
const Ue = class Ue {
|
|
1461
1465
|
constructor(s) {
|