@ninebone/table 0.0.119 β 0.0.121
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 +57 -55
- 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,7 +23,7 @@ const me = class me extends Ie.constructor {
|
|
|
23
23
|
c(me, "Trace");
|
|
24
24
|
let ce = me;
|
|
25
25
|
const Y = new ce();
|
|
26
|
-
var I, W, p, O, z,
|
|
26
|
+
var I, W, p, O, z, N, G, B, J;
|
|
27
27
|
const ve = class ve extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
@@ -32,13 +32,13 @@ const ve = class ve extends HTMLElement {
|
|
|
32
32
|
f(this, p);
|
|
33
33
|
f(this, O);
|
|
34
34
|
f(this, z);
|
|
35
|
-
f(this,
|
|
36
|
-
f(this,
|
|
35
|
+
f(this, N);
|
|
36
|
+
f(this, G, /* @__PURE__ */ c(() => {
|
|
37
37
|
if (!e(this, I)) return;
|
|
38
38
|
const t = e(this, I).querySelector(".ng-container-body");
|
|
39
|
-
t && (y(this,
|
|
39
|
+
t && (y(this, N, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), e(this,
|
|
41
|
+
})), e(this, N).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ c(() => {
|
|
44
44
|
if (!e(this, I) || !e(this, p) || e(this, W)) return;
|
|
@@ -67,7 +67,7 @@ const ve = class ve extends HTMLElement {
|
|
|
67
67
|
const x = a - g;
|
|
68
68
|
b > x && (b = x), o.style.left = `${b}px`, e(this, p).left.disabled = b === 0, e(this, p).right.disabled = b >= x - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
|
-
f(this,
|
|
70
|
+
f(this, B, /* @__PURE__ */ c((t) => {
|
|
71
71
|
if (!e(this, p)) return !1;
|
|
72
72
|
const i = e(this, p).container, n = i.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
@@ -80,14 +80,14 @@ const ve = class ve extends HTMLElement {
|
|
|
80
80
|
let h = d > 0 ? -l * (g - a) / d : 0;
|
|
81
81
|
return -h > g - a && (h = -(g - a)), -h + 5 > g - a && (h = -(g - a)), a >= g && (h = 0), n.style.transform = `translateX(${h}px)`, l > 0 && l < d - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
|
-
f(this,
|
|
83
|
+
f(this, J, /* @__PURE__ */ c(() => {
|
|
84
84
|
const t = /* @__PURE__ */ c((n) => {
|
|
85
85
|
clearInterval(e(this, O)), clearInterval(e(this, z));
|
|
86
86
|
const o = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
87
|
-
e(this,
|
|
87
|
+
e(this, B).call(this, o + n), y(this, O, setInterval(() => {
|
|
88
88
|
clearInterval(e(this, O)), y(this, z, setInterval(() => {
|
|
89
89
|
const r = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
90
|
-
e(this,
|
|
90
|
+
e(this, B).call(this, r + n) || clearInterval(e(this, z));
|
|
91
91
|
}, 50));
|
|
92
92
|
}, 500));
|
|
93
93
|
}, "delayScroll"), i = /* @__PURE__ */ c(() => {
|
|
@@ -103,14 +103,14 @@ const ve = class ve extends HTMLElement {
|
|
|
103
103
|
if (n.button !== 0) return;
|
|
104
104
|
n.preventDefault();
|
|
105
105
|
const o = e(this, p).track.getBoundingClientRect(), r = e(this, p).thumb.clientWidth;
|
|
106
|
-
e(this,
|
|
106
|
+
e(this, B).call(this, n.clientX - o.left - r / 2);
|
|
107
107
|
}), e(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
109
|
n.stopPropagation(), n.preventDefault(), y(this, W, !0), this.shiftX = n.clientX - e(this, p).thumb.getBoundingClientRect().left;
|
|
110
110
|
const o = /* @__PURE__ */ c((l) => {
|
|
111
111
|
if (!e(this, W)) return;
|
|
112
112
|
const d = e(this, p).track.getBoundingClientRect();
|
|
113
|
-
e(this,
|
|
113
|
+
e(this, B).call(this, l.clientX - d.left - this.shiftX);
|
|
114
114
|
}, "onMouseMove"), r = /* @__PURE__ */ c(() => {
|
|
115
115
|
y(this, W, !1), i(), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
116
116
|
}, "onMouseUp");
|
|
@@ -195,21 +195,21 @@ const ve = class ve extends HTMLElement {
|
|
|
195
195
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
196
196
|
left: this.querySelector(".ng-scroll-left"),
|
|
197
197
|
right: this.querySelector(".ng-scroll-right")
|
|
198
|
-
}), e(this,
|
|
198
|
+
}), e(this, J).call(this), e(this, G).call(this), this.refresh();
|
|
199
199
|
}, "initWhenReady");
|
|
200
200
|
t();
|
|
201
201
|
}
|
|
202
202
|
disconnectedCallback() {
|
|
203
|
-
e(this,
|
|
203
|
+
e(this, N) && e(this, N).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
I = new WeakMap(), W = new WeakMap(), p = new WeakMap(), O = new WeakMap(), z = new WeakMap(),
|
|
206
|
+
I = new WeakMap(), W = new WeakMap(), p = new WeakMap(), O = new WeakMap(), z = new WeakMap(), N = new WeakMap(), G = new WeakMap(), B = new WeakMap(), J = new WeakMap(), c(ve, "NineTableHScrollBar");
|
|
207
207
|
let he = ve;
|
|
208
208
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", he);
|
|
209
|
-
var
|
|
209
|
+
var X, M, C;
|
|
210
210
|
const xe = class xe {
|
|
211
211
|
constructor(s) {
|
|
212
|
-
f(this,
|
|
212
|
+
f(this, X);
|
|
213
213
|
f(this, M, []);
|
|
214
214
|
f(this, C, null);
|
|
215
215
|
v(this, "initTemplate", /* @__PURE__ */ c((s) => {
|
|
@@ -238,13 +238,15 @@ const xe = class xe {
|
|
|
238
238
|
o += a, Y.log(`[RowManager] Measured TR[${d}] height: ${a}px`);
|
|
239
239
|
}), y(this, C, o), console.log(`[RowManager] Template Height Cached Successfully: ${e(this, C)}px`), e(this, C);
|
|
240
240
|
}, "measureAndCacheHeight"));
|
|
241
|
-
v(this, "calculateRequiredRowCount", /* @__PURE__ */ c((s) => {
|
|
242
|
-
const t = s.clientHeight || s.getBoundingClientRect().height || 400, i = e(this, C) !== null ? e(this, C) : this.measureAndCacheHeight(s), r = Math.ceil(t / i) + 20;
|
|
243
|
-
return console.log(`[RowManager] Container Height: ${t}px | Template Height: ${i}px | Target Rows: ${r}`), r;
|
|
244
|
-
}, "calculateRequiredRowCount"));
|
|
245
241
|
/**
|
|
246
|
-
* π―
|
|
242
|
+
* π― nine-table-sheet μ 체 λμ΄λ₯Ό κΈ°μ€μΌλ‘ νμν ν κ°―μ μ°μ
|
|
247
243
|
*/
|
|
244
|
+
v(this, "calculateRequiredRowCount", /* @__PURE__ */ c((s) => {
|
|
245
|
+
const t = e(this, X) instanceof HTMLElement ? e(this, X) : s, i = t.clientHeight || t.getBoundingClientRect().height || 400;
|
|
246
|
+
Y.log(t);
|
|
247
|
+
const n = e(this, C) !== null ? e(this, C) : this.measureAndCacheHeight(s), l = Math.ceil(i / n) + 20;
|
|
248
|
+
return console.log(`[RowManager] NineTableSheet Height: ${i}px | Template Height: ${n}px | Target Rows: ${l}`), l;
|
|
249
|
+
}, "calculateRequiredRowCount"));
|
|
248
250
|
v(this, "renderRows", /* @__PURE__ */ c((s, t = null) => {
|
|
249
251
|
if (e(this, M).length === 0) return;
|
|
250
252
|
const i = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
@@ -258,16 +260,16 @@ const xe = class xe {
|
|
|
258
260
|
});
|
|
259
261
|
n ? n.before(o) : i.appendChild(o), console.log(`[RowManager] Successfully rendered. Total DOM tr count: ${i.querySelectorAll("tr:not(.nodata)").length}`);
|
|
260
262
|
}, "renderRows"));
|
|
261
|
-
y(this,
|
|
263
|
+
y(this, X, s);
|
|
262
264
|
}
|
|
263
265
|
get templateLength() {
|
|
264
266
|
return e(this, M).length || 1;
|
|
265
267
|
}
|
|
266
268
|
};
|
|
267
|
-
|
|
269
|
+
X = new WeakMap(), M = new WeakMap(), C = new WeakMap(), c(xe, "RowManager");
|
|
268
270
|
let de = xe;
|
|
269
271
|
var k, L, Q;
|
|
270
|
-
const
|
|
272
|
+
const U = class U extends HTMLElement {
|
|
271
273
|
constructor() {
|
|
272
274
|
super();
|
|
273
275
|
f(this, k, null);
|
|
@@ -353,7 +355,7 @@ const V = class V extends HTMLElement {
|
|
|
353
355
|
i && (i.scrollTop = t);
|
|
354
356
|
}, "scrollToY"));
|
|
355
357
|
f(this, Q, /* @__PURE__ */ c(() => {
|
|
356
|
-
const t =
|
|
358
|
+
const t = U.SCROLLBAR_SIZE;
|
|
357
359
|
this.innerHTML = `
|
|
358
360
|
<style>
|
|
359
361
|
nine-table-sheet {
|
|
@@ -478,8 +480,8 @@ const V = class V extends HTMLElement {
|
|
|
478
480
|
this.innerHTML = "", Y.log("NineTableSheet destroyed.");
|
|
479
481
|
}
|
|
480
482
|
};
|
|
481
|
-
k = new WeakMap(), L = new WeakMap(), Q = new WeakMap(), c(
|
|
482
|
-
let fe =
|
|
483
|
+
k = new WeakMap(), L = new WeakMap(), Q = new WeakMap(), c(U, "NineTableSheet"), v(U, "SCROLLBAR_SIZE", 16);
|
|
484
|
+
let fe = U;
|
|
483
485
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", fe);
|
|
484
486
|
var ee;
|
|
485
487
|
const Re = class Re extends HTMLElement {
|
|
@@ -544,19 +546,19 @@ const Re = class Re extends HTMLElement {
|
|
|
544
546
|
ee = new WeakMap(), c(Re, "NineTableSheets");
|
|
545
547
|
let ue = Re;
|
|
546
548
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", ue);
|
|
547
|
-
var _,
|
|
549
|
+
var _, Z, te, K, se;
|
|
548
550
|
const Se = class Se {
|
|
549
551
|
constructor(s) {
|
|
550
552
|
f(this, _);
|
|
551
|
-
f(this,
|
|
553
|
+
f(this, Z, null);
|
|
552
554
|
f(this, te, /* @__PURE__ */ c(() => {
|
|
553
555
|
const s = e(this, _).host;
|
|
554
|
-
s && (y(this,
|
|
556
|
+
s && (y(this, Z, new ResizeObserver((t) => {
|
|
555
557
|
for (let i of t)
|
|
556
|
-
s.getAttribute("auto-height") === "true" && e(this,
|
|
557
|
-
})), e(this,
|
|
558
|
+
s.getAttribute("auto-height") === "true" && e(this, K).call(this, s);
|
|
559
|
+
})), e(this, Z).observe(s));
|
|
558
560
|
}, "#observeResize"));
|
|
559
|
-
f(this,
|
|
561
|
+
f(this, K, /* @__PURE__ */ c((s) => {
|
|
560
562
|
var A, E;
|
|
561
563
|
const t = (A = s.shadowRoot) == null ? void 0 : A.querySelector("nine-table-sheet.active");
|
|
562
564
|
if (!t) return;
|
|
@@ -668,45 +670,45 @@ const Se = class Se {
|
|
|
668
670
|
const l = e(this, _).querySelectorAll("nine-table-sheet");
|
|
669
671
|
l == null || l.forEach((d, a) => {
|
|
670
672
|
i[a] && setTimeout(() => {
|
|
671
|
-
d.init(i[a]), n && e(this,
|
|
673
|
+
d.init(i[a]), n && e(this, K).call(this, s);
|
|
672
674
|
});
|
|
673
675
|
});
|
|
674
676
|
}, "#render"));
|
|
675
677
|
y(this, _, s), e(this, se).call(this), e(this, te).call(this);
|
|
676
678
|
}
|
|
677
679
|
};
|
|
678
|
-
_ = new WeakMap(),
|
|
680
|
+
_ = new WeakMap(), Z = new WeakMap(), te = new WeakMap(), K = new WeakMap(), se = new WeakMap(), c(Se, "LayoutManager");
|
|
679
681
|
let be = Se;
|
|
680
|
-
var $,
|
|
682
|
+
var $, D;
|
|
681
683
|
const Ee = class Ee {
|
|
682
684
|
constructor(s) {
|
|
683
685
|
f(this, $);
|
|
684
|
-
f(this,
|
|
686
|
+
f(this, D, -1);
|
|
685
687
|
v(this, "count", /* @__PURE__ */ c(() => e(this, $).rawRecords.length, "count"));
|
|
686
688
|
y(this, $, s);
|
|
687
689
|
}
|
|
688
690
|
get at() {
|
|
689
|
-
return e(this,
|
|
691
|
+
return e(this, D);
|
|
690
692
|
}
|
|
691
693
|
set at(s) {
|
|
692
694
|
var i, n;
|
|
693
|
-
y(this,
|
|
695
|
+
y(this, D, parseInt(s, 10));
|
|
694
696
|
const t = ((n = (i = e(this, $).owner).querySelector) == null ? void 0 : n.call(i, ".ng-container-body")) || e(this, $).owner.body;
|
|
695
|
-
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this,
|
|
697
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, D)}"]`) && setTimeout(() => {
|
|
696
698
|
var o, r;
|
|
697
|
-
(r = (o = e(this, $).owner).scrollTo_V1) == null || r.call(o, e(this,
|
|
699
|
+
(r = (o = e(this, $).owner).scrollTo_V1) == null || r.call(o, e(this, D));
|
|
698
700
|
});
|
|
699
701
|
}
|
|
700
702
|
};
|
|
701
|
-
$ = new WeakMap(),
|
|
703
|
+
$ = new WeakMap(), D = new WeakMap(), c(Ee, "ngRow");
|
|
702
704
|
let ge = Ee;
|
|
703
|
-
var S, m, q,
|
|
705
|
+
var S, m, q, F, ie, H, ne, j, re, oe, V;
|
|
704
706
|
const T = class T {
|
|
705
707
|
constructor(s, t) {
|
|
706
708
|
f(this, S);
|
|
707
709
|
f(this, m);
|
|
708
710
|
f(this, q, []);
|
|
709
|
-
f(this,
|
|
711
|
+
f(this, F, []);
|
|
710
712
|
f(this, ie, 0);
|
|
711
713
|
f(this, H, []);
|
|
712
714
|
f(this, ne, /* @__PURE__ */ c(() => {
|
|
@@ -716,13 +718,13 @@ const T = class T {
|
|
|
716
718
|
var i;
|
|
717
719
|
e(this, H).push(((i = t.getBoundingClientRect) == null ? void 0 : i.call(t).height) || 24);
|
|
718
720
|
}), (e(this, m).rawRecords || []).forEach((t) => {
|
|
719
|
-
t.__ng || (t.__ng = e(this,
|
|
721
|
+
t.__ng || (t.__ng = e(this, j).call(this)), t.__ng.height = e(this, H).slice();
|
|
720
722
|
});
|
|
721
723
|
}, "#initialize"));
|
|
722
724
|
v(this, "set", /* @__PURE__ */ c((s) => {
|
|
723
725
|
this.clear(), this.add(s, !1);
|
|
724
726
|
}, "set"));
|
|
725
|
-
f(this,
|
|
727
|
+
f(this, j, /* @__PURE__ */ c(() => ({
|
|
726
728
|
rowState: T.ROW_STATE.EMPTY,
|
|
727
729
|
deleted: !1,
|
|
728
730
|
filtered: !1,
|
|
@@ -732,11 +734,11 @@ const T = class T {
|
|
|
732
734
|
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, H).slice(), -1, {}, {}]
|
|
733
735
|
}), "#getDefaultMeta"));
|
|
734
736
|
v(this, "reset", /* @__PURE__ */ c(() => {
|
|
735
|
-
y(this, q, []), y(this,
|
|
737
|
+
y(this, q, []), y(this, F, []);
|
|
736
738
|
}, "reset"));
|
|
737
739
|
v(this, "clear", /* @__PURE__ */ c(() => {
|
|
738
740
|
var s;
|
|
739
|
-
e(this, m).rawRecords = [], y(this, q, []), y(this,
|
|
741
|
+
e(this, m).rawRecords = [], y(this, q, []), y(this, F, []), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
740
742
|
}, "clear"));
|
|
741
743
|
f(this, re, /* @__PURE__ */ c((s) => {
|
|
742
744
|
var n;
|
|
@@ -750,7 +752,7 @@ const T = class T {
|
|
|
750
752
|
}), i;
|
|
751
753
|
}, "#json2Array"));
|
|
752
754
|
f(this, oe, /* @__PURE__ */ c((s) => (Array.isArray(s) || (s = [s]), s.forEach((t) => {
|
|
753
|
-
t.__ng = e(this,
|
|
755
|
+
t.__ng = e(this, j).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = T.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
754
756
|
}), s), "#defaultInsert"));
|
|
755
757
|
v(this, "add", /* @__PURE__ */ c((s, t = !0) => {
|
|
756
758
|
var o;
|
|
@@ -786,14 +788,14 @@ const T = class T {
|
|
|
786
788
|
l !== i && r.__ng.rowState !== T.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(t) || (r.__ng.o[t] = l), r.__ng.rowState = T.ROW_STATE.UPDATE), r.v[o] = i, e(this, m).owner.refreshData && e(this, m).owner.refreshData(s);
|
|
787
789
|
}, "setValue"));
|
|
788
790
|
v(this, "resetRecords", /* @__PURE__ */ c(() => {
|
|
789
|
-
y(this,
|
|
791
|
+
y(this, F, e(this, m).rawRecords.filter((s) => !s.__ng.deleted)), y(this, q, e(this, m).rawRecords.filter((s) => !s.__ng.deleted && !s.__ng.filtered)), e(this, m).rawRecords.forEach((s, t) => {
|
|
790
792
|
s.__ng.rowidx = t;
|
|
791
793
|
}), e(this, q).forEach((s, t) => {
|
|
792
794
|
s.__ng.i = t;
|
|
793
795
|
});
|
|
794
796
|
}, "resetRecords"));
|
|
795
797
|
v(this, "getValidData", /* @__PURE__ */ c(() => (e(this, q).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, q)), "getValidData"));
|
|
796
|
-
f(this,
|
|
798
|
+
f(this, V, /* @__PURE__ */ c((s) => {
|
|
797
799
|
var i;
|
|
798
800
|
if (!s) return s;
|
|
799
801
|
const t = typeof ((i = e(this, S).fields) == null ? void 0 : i.get) == "function" ? e(this, S).fields.get() : [];
|
|
@@ -809,19 +811,19 @@ const T = class T {
|
|
|
809
811
|
var o;
|
|
810
812
|
const i = this.getValidData();
|
|
811
813
|
if (!i || i.length <= 0) return;
|
|
812
|
-
if (s == null) return e(this,
|
|
814
|
+
if (s == null) return e(this, V).call(this, i);
|
|
813
815
|
if (s < 0 || s >= i.length) return null;
|
|
814
816
|
const n = typeof ((o = e(this, S).fields) == null ? void 0 : o.get) == "function" ? e(this, S).fields.get() : [];
|
|
815
817
|
if (t != null) {
|
|
816
818
|
const r = n.indexOf(t);
|
|
817
819
|
return r >= 0 ? i[s].v[r] : null;
|
|
818
820
|
}
|
|
819
|
-
return e(this,
|
|
821
|
+
return e(this, V).call(this, i[s]);
|
|
820
822
|
}, "get"));
|
|
821
823
|
y(this, S, s), y(this, m, t), e(this, ne).call(this);
|
|
822
824
|
}
|
|
823
825
|
get source() {
|
|
824
|
-
return e(this,
|
|
826
|
+
return e(this, V).call(this, e(this, m).rawRecords);
|
|
825
827
|
}
|
|
826
828
|
set source(s) {
|
|
827
829
|
this.clear(), this.add(s, !1);
|
|
@@ -830,7 +832,7 @@ const T = class T {
|
|
|
830
832
|
return ++Le(this, ie)._;
|
|
831
833
|
}
|
|
832
834
|
};
|
|
833
|
-
S = new WeakMap(), m = new WeakMap(), q = new WeakMap(),
|
|
835
|
+
S = new WeakMap(), m = new WeakMap(), q = new WeakMap(), F = new WeakMap(), ie = new WeakMap(), H = new WeakMap(), ne = new WeakMap(), j = new WeakMap(), re = new WeakMap(), oe = new WeakMap(), V = new WeakMap(), c(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
834
836
|
v(T, "ROW_STATE", {
|
|
835
837
|
EMPTY: "EMPTY",
|
|
836
838
|
NORMAL: "NORMAL",
|