@ninebone/table 0.0.714 β 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 -68
- 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,15 +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
|
-
l.preventDefault();
|
|
777
780
|
const f = document.elementFromPoint(l.clientX, l.clientY);
|
|
778
781
|
let u = f == null ? void 0 : f.closest("td, th");
|
|
779
|
-
if (!u || !t(this,
|
|
780
|
-
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");
|
|
781
784
|
for (const w of v) {
|
|
782
785
|
const m = w.getBoundingClientRect();
|
|
783
786
|
if (l.clientX >= m.left && l.clientX <= m.right && l.clientY >= m.top && l.clientY <= m.bottom) {
|
|
@@ -790,7 +793,7 @@ F = new WeakMap(), nt = new WeakMap(), j = new WeakSet(), wt = /* @__PURE__ */ h
|
|
|
790
793
|
const b = u.closest("tr"), { matrixRow: g } = dt(this, j, wt).call(this, b), y = parseInt(u.dataset.col, 10);
|
|
791
794
|
g < 0 || this.setRange(o, i, g, y);
|
|
792
795
|
}, "onMouseMove"), c = /* @__PURE__ */ h(() => {
|
|
793
|
-
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);
|
|
794
797
|
}, "onMouseUp");
|
|
795
798
|
document.addEventListener("mousemove", a), document.addEventListener("mouseup", c);
|
|
796
799
|
});
|
|
@@ -1305,18 +1308,18 @@ const Ve = class Ve {
|
|
|
1305
1308
|
};
|
|
1306
1309
|
_t = new WeakMap(), bt = new WeakMap(), h(Ve, "ngRow");
|
|
1307
1310
|
let we = Ve;
|
|
1308
|
-
var
|
|
1309
|
-
const
|
|
1311
|
+
var O, k, W, pt, re, U, oe, it, Nt, ie, ae, yt;
|
|
1312
|
+
const B = class B {
|
|
1310
1313
|
constructor(s, e) {
|
|
1311
|
-
d(this,
|
|
1314
|
+
d(this, O);
|
|
1312
1315
|
d(this, k);
|
|
1313
|
-
d(this,
|
|
1316
|
+
d(this, W, []);
|
|
1314
1317
|
d(this, pt, []);
|
|
1315
1318
|
d(this, re, 0);
|
|
1316
1319
|
d(this, U, []);
|
|
1317
1320
|
d(this, oe, /* @__PURE__ */ h(() => {
|
|
1318
1321
|
p(this, U, []);
|
|
1319
|
-
const s = t(this,
|
|
1322
|
+
const s = t(this, O).template || [];
|
|
1320
1323
|
Array.from(s).forEach((e) => {
|
|
1321
1324
|
var n;
|
|
1322
1325
|
t(this, U).push(((n = e.getBoundingClientRect) == null ? void 0 : n.call(e).height) || 24);
|
|
@@ -1325,8 +1328,8 @@ const W = class W {
|
|
|
1325
1328
|
});
|
|
1326
1329
|
}, "#initialize"));
|
|
1327
1330
|
d(this, it, /* @__PURE__ */ h(() => {
|
|
1328
|
-
const s = t(this,
|
|
1329
|
-
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) => {
|
|
1330
1333
|
e.invalidate();
|
|
1331
1334
|
});
|
|
1332
1335
|
}, "#invalidate"));
|
|
@@ -1336,7 +1339,7 @@ const W = class W {
|
|
|
1336
1339
|
if (!n || n.length <= 0) return;
|
|
1337
1340
|
if (s == null) return t(this, yt).call(this, n);
|
|
1338
1341
|
if (s < 0 || s >= n.length) return null;
|
|
1339
|
-
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() : [];
|
|
1340
1343
|
if (e != null) {
|
|
1341
1344
|
const i = r.indexOf(e);
|
|
1342
1345
|
return i >= 0 ? n[s].v[i] : null;
|
|
@@ -1347,25 +1350,25 @@ const W = class W {
|
|
|
1347
1350
|
this.clear(), this.add(s, !1), t(this, it).call(this);
|
|
1348
1351
|
}, "set"));
|
|
1349
1352
|
d(this, Nt, /* @__PURE__ */ h(() => ({
|
|
1350
|
-
rowState:
|
|
1353
|
+
rowState: B.ROW_STATE.EMPTY,
|
|
1351
1354
|
deleted: !1,
|
|
1352
1355
|
filtered: !1,
|
|
1353
1356
|
height: t(this, U).slice(),
|
|
1354
1357
|
o: {},
|
|
1355
1358
|
c: {},
|
|
1356
|
-
_: [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, {}, {}]
|
|
1357
1360
|
}), "#getDefaultMeta"));
|
|
1358
1361
|
A(this, "reset", /* @__PURE__ */ h(() => {
|
|
1359
|
-
p(this,
|
|
1362
|
+
p(this, W, []), p(this, pt, []), t(this, it).call(this);
|
|
1360
1363
|
}, "reset"));
|
|
1361
1364
|
A(this, "clear", /* @__PURE__ */ h(() => {
|
|
1362
1365
|
var s;
|
|
1363
|
-
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();
|
|
1364
1367
|
}, "clear"));
|
|
1365
1368
|
d(this, ie, /* @__PURE__ */ h((s) => {
|
|
1366
1369
|
var r;
|
|
1367
1370
|
Array.isArray(s) || (s = [s]);
|
|
1368
|
-
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 = [];
|
|
1369
1372
|
return s.forEach((o) => {
|
|
1370
1373
|
const i = { v: [] };
|
|
1371
1374
|
e.forEach((a) => {
|
|
@@ -1374,7 +1377,7 @@ const W = class W {
|
|
|
1374
1377
|
}), n;
|
|
1375
1378
|
}, "#json2Array"));
|
|
1376
1379
|
d(this, ae, /* @__PURE__ */ h((s) => (Array.isArray(s) || (s = [s]), s.forEach((e) => {
|
|
1377
|
-
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;
|
|
1378
1381
|
}), s), "#defaultInsert"));
|
|
1379
1382
|
A(this, "add", /* @__PURE__ */ h((s, e = !0) => {
|
|
1380
1383
|
s === void 0 && (s = {});
|
|
@@ -1383,16 +1386,16 @@ const W = class W {
|
|
|
1383
1386
|
const r = this.count() - 1;
|
|
1384
1387
|
return e || n.forEach((o, i) => {
|
|
1385
1388
|
const a = t(this, k).rawRecords[r - i];
|
|
1386
|
-
a && (a.__ng.rowState =
|
|
1389
|
+
a && (a.__ng.rowState = B.ROW_STATE.EMPTY);
|
|
1387
1390
|
}), t(this, it).call(this), r;
|
|
1388
1391
|
}, "add"));
|
|
1389
1392
|
A(this, "delete", /* @__PURE__ */ h((s) => {
|
|
1390
1393
|
let e = [];
|
|
1391
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) => {
|
|
1392
|
-
if (t(this,
|
|
1393
|
-
const r = t(this,
|
|
1394
|
-
t(this,
|
|
1395
|
-
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);
|
|
1396
1399
|
});
|
|
1397
1400
|
}
|
|
1398
1401
|
}), this.resetRecords(), t(this, it).call(this);
|
|
@@ -1400,25 +1403,25 @@ const W = class W {
|
|
|
1400
1403
|
A(this, "setValue", /* @__PURE__ */ h((s, e, n) => {
|
|
1401
1404
|
var c;
|
|
1402
1405
|
s = parseInt(s, 10);
|
|
1403
|
-
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);
|
|
1404
1407
|
if (o < 0) return;
|
|
1405
1408
|
const i = this.getValidData()[s];
|
|
1406
1409
|
if (!i) return;
|
|
1407
1410
|
const a = i.v[o];
|
|
1408
|
-
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;
|
|
1409
1412
|
}, "setValue"));
|
|
1410
1413
|
A(this, "resetRecords", /* @__PURE__ */ h(() => {
|
|
1411
|
-
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) => {
|
|
1412
1415
|
s.__ng.rowidx = e;
|
|
1413
|
-
}), t(this,
|
|
1416
|
+
}), t(this, W).forEach((s, e) => {
|
|
1414
1417
|
s.__ng.i = e;
|
|
1415
1418
|
});
|
|
1416
1419
|
}, "resetRecords"));
|
|
1417
|
-
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"));
|
|
1418
1421
|
d(this, yt, /* @__PURE__ */ h((s) => {
|
|
1419
1422
|
var i;
|
|
1420
1423
|
if (!s) return s;
|
|
1421
|
-
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) => {
|
|
1422
1425
|
const c = {};
|
|
1423
1426
|
return r.forEach((l, f) => {
|
|
1424
1427
|
c[l] = a.v ? a.v[f] : a[l];
|
|
@@ -1427,7 +1430,7 @@ const W = class W {
|
|
|
1427
1430
|
return e ? o[0] : o;
|
|
1428
1431
|
}, "#conv"));
|
|
1429
1432
|
A(this, "count", /* @__PURE__ */ h(() => this.getValidData().length, "count"));
|
|
1430
|
-
p(this,
|
|
1433
|
+
p(this, O, s), p(this, k, e), t(this, oe).call(this);
|
|
1431
1434
|
}
|
|
1432
1435
|
get source() {
|
|
1433
1436
|
return t(this, yt).call(this, t(this, k).rawRecords);
|
|
@@ -1439,24 +1442,24 @@ const W = class W {
|
|
|
1439
1442
|
return ++os(this, re)._;
|
|
1440
1443
|
}
|
|
1441
1444
|
get count() {
|
|
1442
|
-
return t(this,
|
|
1445
|
+
return t(this, W).length;
|
|
1443
1446
|
}
|
|
1444
1447
|
get length() {
|
|
1445
|
-
return t(this,
|
|
1448
|
+
return t(this, W).length;
|
|
1446
1449
|
}
|
|
1447
1450
|
getRowCount() {
|
|
1448
1451
|
return this.length;
|
|
1449
1452
|
}
|
|
1450
1453
|
};
|
|
1451
|
-
|
|
1452
|
-
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", {
|
|
1453
1456
|
EMPTY: "EMPTY",
|
|
1454
1457
|
NORMAL: "NORMAL",
|
|
1455
1458
|
INSERT: "INSERT",
|
|
1456
1459
|
UPDATE: "UPDATE",
|
|
1457
1460
|
DELETE: "DELETE"
|
|
1458
1461
|
});
|
|
1459
|
-
let Se =
|
|
1462
|
+
let Se = B;
|
|
1460
1463
|
var at;
|
|
1461
1464
|
const Ue = class Ue {
|
|
1462
1465
|
constructor(s) {
|