@ninebone/table 0.0.458 β 0.0.463
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 +105 -105
- 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
|
@@ -4,7 +4,7 @@ var je = (R) => {
|
|
|
4
4
|
};
|
|
5
5
|
var Ye = (R, i, e) => i in R ? Pe(R, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : R[i] = e;
|
|
6
6
|
var c = (R, i) => Pe(R, "name", { value: i, configurable: !0 });
|
|
7
|
-
var
|
|
7
|
+
var S = (R, i, e) => Ye(R, typeof i != "symbol" ? i + "" : i, e), Fe = (R, i, e) => i.has(R) || je("Cannot " + e);
|
|
8
8
|
var t = (R, i, e) => (Fe(R, i, "read from private field"), e ? e.call(R) : i.get(R)), d = (R, i, e) => i.has(R) ? je("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(R) : i.set(R, e), b = (R, i, e, s) => (Fe(R, i, "write to private field"), s ? s.call(R, e) : i.set(R, e), e);
|
|
9
9
|
var Ve = (R, i, e, s) => ({
|
|
10
10
|
set _(r) {
|
|
@@ -22,14 +22,14 @@ const Ce = class Ce extends Ue.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
c(Ce, "Trace");
|
|
24
24
|
let oe = Ce;
|
|
25
|
-
const
|
|
26
|
-
var B,
|
|
25
|
+
const D = new oe();
|
|
26
|
+
var B, j, w, X, K, Z, Mt, G, It;
|
|
27
27
|
const Le = class Le extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
d(this, B);
|
|
31
|
-
d(this,
|
|
32
|
-
d(this,
|
|
31
|
+
d(this, j, !1);
|
|
32
|
+
d(this, w);
|
|
33
33
|
d(this, X);
|
|
34
34
|
d(this, K);
|
|
35
35
|
d(this, Z);
|
|
@@ -40,11 +40,11 @@ const Le = class Le extends HTMLElement {
|
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), t(this, Z).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
|
-
|
|
44
|
-
if (!t(this, B) || !t(this,
|
|
45
|
-
const e = t(this,
|
|
43
|
+
S(this, "refresh", /* @__PURE__ */ c(() => {
|
|
44
|
+
if (!t(this, B) || !t(this, w) || t(this, j)) return;
|
|
45
|
+
const e = t(this, w).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const r = t(this,
|
|
47
|
+
const r = t(this, w).track, n = t(this, w).thumb, o = t(this, B).querySelector(".ng-container-bottom"), a = e.clientWidth, h = s.scrollWidth;
|
|
48
48
|
if (a !== 0 && h > a)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -59,27 +59,27 @@ const Le = class Le extends HTMLElement {
|
|
|
59
59
|
let g = 0;
|
|
60
60
|
p > 0 && (g = parseInt(u / p * (l - f), 10)), g < 0 && (g = 0);
|
|
61
61
|
const m = l - f;
|
|
62
|
-
g > m && (g = m), n.style.left = `${g}px`, t(this,
|
|
62
|
+
g > m && (g = m), n.style.left = `${g}px`, t(this, w).left.disabled = g === 0, t(this, w).right.disabled = g >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
d(this, G, /* @__PURE__ */ c((e) => {
|
|
65
|
-
if (!t(this,
|
|
66
|
-
const s = t(this,
|
|
65
|
+
if (!t(this, w)) return !1;
|
|
66
|
+
const s = t(this, w).container, r = s.querySelector("table");
|
|
67
67
|
if (!r) return !1;
|
|
68
|
-
const n = t(this,
|
|
68
|
+
const n = t(this, w).track.getBoundingClientRect(), o = t(this, w).thumb.clientWidth;
|
|
69
69
|
let a = e;
|
|
70
70
|
a < 0 && (a = 0);
|
|
71
71
|
const h = n.width - o;
|
|
72
|
-
a > h && (a = h), a = parseInt(a, 10), t(this,
|
|
72
|
+
a > h && (a = h), a = parseInt(a, 10), t(this, w).thumb.style.left = `${a}px`, t(this, w).left.disabled = a === 0, t(this, w).right.disabled = a >= h - 1;
|
|
73
73
|
const l = s.clientWidth, u = r.scrollWidth - l;
|
|
74
74
|
return h > 0 && u > 0 && (s.scrollLeft = a / h * u), a > 0 && a < h - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
d(this, It, /* @__PURE__ */ c(() => {
|
|
77
77
|
const e = /* @__PURE__ */ c((r) => {
|
|
78
78
|
clearInterval(t(this, X)), clearInterval(t(this, K));
|
|
79
|
-
const n = parseInt(t(this,
|
|
79
|
+
const n = parseInt(t(this, w).thumb.style.left || 0, 10);
|
|
80
80
|
t(this, G).call(this, n + r), b(this, X, setInterval(() => {
|
|
81
81
|
clearInterval(t(this, X)), b(this, K, setInterval(() => {
|
|
82
|
-
const o = parseInt(t(this,
|
|
82
|
+
const o = parseInt(t(this, w).thumb.style.left || 0, 10);
|
|
83
83
|
t(this, G).call(this, o + r) || clearInterval(t(this, K));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
@@ -87,25 +87,25 @@ const Le = class Le extends HTMLElement {
|
|
|
87
87
|
clearInterval(t(this, X)), clearInterval(t(this, K));
|
|
88
88
|
}, "clearTimer");
|
|
89
89
|
["mouseup", "mouseleave", "touchend"].forEach((r) => {
|
|
90
|
-
t(this,
|
|
91
|
-
}), t(this,
|
|
90
|
+
t(this, w).left.addEventListener(r, s), t(this, w).right.addEventListener(r, s), t(this, w).track.addEventListener(r, s);
|
|
91
|
+
}), t(this, w).left.addEventListener("mousedown", (r) => {
|
|
92
92
|
r.button === 0 && e(-20);
|
|
93
|
-
}), t(this,
|
|
93
|
+
}), t(this, w).right.addEventListener("mousedown", (r) => {
|
|
94
94
|
r.button === 0 && e(20);
|
|
95
|
-
}), t(this,
|
|
95
|
+
}), t(this, w).left.addEventListener("touchstart", () => e(-20)), t(this, w).right.addEventListener("touchstart", () => e(20)), t(this, w).track.addEventListener("mousedown", (r) => {
|
|
96
96
|
if (r.button !== 0) return;
|
|
97
97
|
r.preventDefault();
|
|
98
|
-
const n = t(this,
|
|
98
|
+
const n = t(this, w).track.getBoundingClientRect(), o = t(this, w).thumb.clientWidth;
|
|
99
99
|
t(this, G).call(this, r.clientX - n.left - o / 2);
|
|
100
|
-
}), t(this,
|
|
100
|
+
}), t(this, w).thumb.addEventListener("mousedown", (r) => {
|
|
101
101
|
if (r.button !== 0) return;
|
|
102
|
-
r.stopPropagation(), r.preventDefault(), b(this,
|
|
102
|
+
r.stopPropagation(), r.preventDefault(), b(this, j, !0), this.shiftX = r.clientX - t(this, w).thumb.getBoundingClientRect().left;
|
|
103
103
|
const n = /* @__PURE__ */ c((a) => {
|
|
104
|
-
if (!t(this,
|
|
105
|
-
const h = t(this,
|
|
104
|
+
if (!t(this, j)) return;
|
|
105
|
+
const h = t(this, w).track.getBoundingClientRect();
|
|
106
106
|
t(this, G).call(this, a.clientX - h.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), o = /* @__PURE__ */ c(() => {
|
|
108
|
-
b(this,
|
|
108
|
+
b(this, j, !1), s(), document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", o), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
110
|
document.addEventListener("mousemove", n), document.addEventListener("mouseup", o);
|
|
111
111
|
});
|
|
@@ -182,14 +182,14 @@ const Le = class Le extends HTMLElement {
|
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
b(this,
|
|
185
|
+
b(this, w, {
|
|
186
186
|
container: s,
|
|
187
187
|
track: this.querySelector(".ng-scroll-track"),
|
|
188
188
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
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, j) || this.refresh();
|
|
193
193
|
}), t(this, It).call(this), t(this, Mt).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
@@ -198,22 +198,22 @@ const Le = class Le extends HTMLElement {
|
|
|
198
198
|
t(this, Z) && t(this, Z).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
B = new WeakMap(),
|
|
201
|
+
B = new WeakMap(), j = new WeakMap(), w = new WeakMap(), X = new WeakMap(), K = new WeakMap(), Z = new WeakMap(), Mt = new WeakMap(), G = new WeakMap(), It = new WeakMap(), c(Le, "NineTableHScrollBar");
|
|
202
202
|
let ae = Le;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ae);
|
|
204
|
-
var
|
|
204
|
+
var F, ot, J, q, xt, vt, _t;
|
|
205
205
|
const He = class He extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
|
-
d(this,
|
|
208
|
+
d(this, F);
|
|
209
209
|
d(this, ot);
|
|
210
210
|
d(this, J, !1);
|
|
211
211
|
d(this, q);
|
|
212
212
|
d(this, xt, 0);
|
|
213
213
|
d(this, vt, 0);
|
|
214
|
-
|
|
215
|
-
if (!t(this,
|
|
216
|
-
const e = t(this, q).container, s = t(this, q).track, r = t(this, q).thumb, n = e.clientHeight, a = (t(this,
|
|
214
|
+
S(this, "refresh", /* @__PURE__ */ c(() => {
|
|
215
|
+
if (!t(this, F) || !t(this, q)) return;
|
|
216
|
+
const e = t(this, q).container, s = t(this, q).track, r = t(this, q).thumb, n = e.clientHeight, a = (t(this, F).data.get() || []).length, h = t(this, ot).getRowHeight(), l = a * h;
|
|
217
217
|
if (l <= n) {
|
|
218
218
|
r.style.display = "none", t(this, q).top.disabled = !0, t(this, q).bottom.disabled = !0;
|
|
219
219
|
return;
|
|
@@ -231,7 +231,7 @@ const He = class He extends HTMLElement {
|
|
|
231
231
|
}, "refresh"));
|
|
232
232
|
d(this, _t, /* @__PURE__ */ c(() => {
|
|
233
233
|
const e = t(this, q).container, s = /* @__PURE__ */ c(() => {
|
|
234
|
-
const n = (t(this,
|
|
234
|
+
const n = (t(this, F).data.get() || []).length, o = t(this, ot).getRowHeight();
|
|
235
235
|
return n * o;
|
|
236
236
|
}, "getContentHeight");
|
|
237
237
|
e.addEventListener("scroll", () => {
|
|
@@ -269,7 +269,7 @@ const He = class He extends HTMLElement {
|
|
|
269
269
|
}, "#init"));
|
|
270
270
|
}
|
|
271
271
|
connectedCallback() {
|
|
272
|
-
b(this,
|
|
272
|
+
b(this, F, this.getRootNode().host), b(this, ot, this.closest("nine-table-sheet")), this.innerHTML = `
|
|
273
273
|
<style>
|
|
274
274
|
nine-table-vscrollbar {
|
|
275
275
|
display: flex;
|
|
@@ -334,7 +334,7 @@ const He = class He extends HTMLElement {
|
|
|
334
334
|
<button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
|
|
335
335
|
`;
|
|
336
336
|
const e = /* @__PURE__ */ c(() => {
|
|
337
|
-
const s = t(this,
|
|
337
|
+
const s = t(this, F).shadowRoot.querySelector(".ng-container-body .ng-part-body");
|
|
338
338
|
if (!s) {
|
|
339
339
|
setTimeout(e, 10);
|
|
340
340
|
return;
|
|
@@ -350,27 +350,27 @@ const He = class He extends HTMLElement {
|
|
|
350
350
|
e();
|
|
351
351
|
}
|
|
352
352
|
};
|
|
353
|
-
|
|
353
|
+
F = new WeakMap(), ot = new WeakMap(), J = new WeakMap(), q = new WeakMap(), xt = new WeakMap(), vt = new WeakMap(), _t = new WeakMap(), c(He, "NineTableVScrollBar");
|
|
354
354
|
let le = He;
|
|
355
355
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", le);
|
|
356
|
-
var
|
|
356
|
+
var P, A, z, H, V, Q, wt, at, Nt, Wt, Ot, St, Et, Bt, zt, At, Dt, lt, Rt, Pt;
|
|
357
357
|
const $e = class $e {
|
|
358
358
|
constructor(i) {
|
|
359
|
-
d(this,
|
|
359
|
+
d(this, P);
|
|
360
360
|
d(this, A);
|
|
361
361
|
d(this, z, /* @__PURE__ */ new Map());
|
|
362
362
|
d(this, H, null);
|
|
363
|
-
d(this,
|
|
363
|
+
d(this, V, null);
|
|
364
364
|
d(this, Q, 0);
|
|
365
365
|
d(this, wt, 40);
|
|
366
366
|
d(this, at, !1);
|
|
367
367
|
d(this, Nt, 3);
|
|
368
|
-
|
|
368
|
+
S(this, "refresh", /* @__PURE__ */ c(() => {
|
|
369
369
|
var e;
|
|
370
370
|
const i = t(this, A).querySelector(".ng-container-body .ng-part-body");
|
|
371
371
|
i && (t(this, St).call(this), t(this, lt).call(this, i.scrollTop), (e = t(this, A).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
372
372
|
}, "refresh"));
|
|
373
|
-
|
|
373
|
+
S(this, "initialize", /* @__PURE__ */ c(() => {
|
|
374
374
|
b(this, H, null), t(this, z).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((r) => {
|
|
375
375
|
const n = t(this, A).querySelector(r);
|
|
376
376
|
if (!n) return;
|
|
@@ -430,7 +430,7 @@ const $e = class $e {
|
|
|
430
430
|
}), u.forEach((p) => p.remove()), o.style.display = a, o.style.visibility = h, o.style.position = l, b(this, H, f > 0 ? f : 24), t(this, Et).call(this), t(this, H);
|
|
431
431
|
}, "#measureAndCacheHeight"));
|
|
432
432
|
d(this, St, /* @__PURE__ */ c(() => {
|
|
433
|
-
const e = (t(this,
|
|
433
|
+
const e = (t(this, P).data.get() || []).length, s = t(this, H) || 24, r = e * s;
|
|
434
434
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
435
435
|
const o = t(this, A).querySelector(n);
|
|
436
436
|
if (!o) return;
|
|
@@ -472,7 +472,7 @@ const $e = class $e {
|
|
|
472
472
|
}
|
|
473
473
|
}, "#syncRowHeights"));
|
|
474
474
|
d(this, zt, /* @__PURE__ */ c(() => {
|
|
475
|
-
!t(this, A) || !(t(this, A) instanceof HTMLElement) || (b(this,
|
|
475
|
+
!t(this, A) || !(t(this, A) instanceof HTMLElement) || (b(this, V, new ResizeObserver((i) => {
|
|
476
476
|
for (const e of i) {
|
|
477
477
|
const s = e.target;
|
|
478
478
|
if (!s.classList.contains("active")) continue;
|
|
@@ -485,7 +485,7 @@ const $e = class $e {
|
|
|
485
485
|
t(this, Q) !== h && (b(this, Q, h), t(this, Et).call(this), t(this, H) !== null && t(this, At).call(this));
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
})), t(this,
|
|
488
|
+
})), t(this, V).observe(t(this, A)));
|
|
489
489
|
}, "#initResizeObserver"));
|
|
490
490
|
d(this, At, /* @__PURE__ */ c(() => {
|
|
491
491
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
@@ -500,14 +500,14 @@ const $e = class $e {
|
|
|
500
500
|
if (!s) return;
|
|
501
501
|
const r = s.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
502
502
|
if (!r) return;
|
|
503
|
-
const n = Array.from(r.querySelectorAll("tr:not(.nodata)")), o = ((l = t(this, z).get(e)) == null ? void 0 : l.length) || 1, h = (t(this,
|
|
503
|
+
const n = Array.from(r.querySelectorAll("tr:not(.nodata)")), o = ((l = t(this, z).get(e)) == null ? void 0 : l.length) || 1, h = (t(this, P).data.get() || []).length;
|
|
504
504
|
n.forEach((f, u) => {
|
|
505
505
|
const p = i + Math.floor(u / o);
|
|
506
506
|
if (p >= h) {
|
|
507
507
|
f.style.display = "none";
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
const g = t(this,
|
|
510
|
+
const g = t(this, P).data.get(p);
|
|
511
511
|
f.style.display = "", t(this, Rt).call(this, f, g, p);
|
|
512
512
|
});
|
|
513
513
|
});
|
|
@@ -516,7 +516,7 @@ const $e = class $e {
|
|
|
516
516
|
var h;
|
|
517
517
|
const e = t(this, H);
|
|
518
518
|
if (!e || e <= 0) return;
|
|
519
|
-
const r = (t(this,
|
|
519
|
+
const r = (t(this, P).data.get() || []).length, n = Math.max(0, Math.floor(i / e)), o = n * e, a = ((h = t(this, z).get(".ng-container-body")) == null ? void 0 : h.length) || 1;
|
|
520
520
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((l) => {
|
|
521
521
|
const f = t(this, A).querySelector(l);
|
|
522
522
|
if (!f) return;
|
|
@@ -528,7 +528,7 @@ const $e = class $e {
|
|
|
528
528
|
g.style.display = "none";
|
|
529
529
|
return;
|
|
530
530
|
}
|
|
531
|
-
const E = t(this,
|
|
531
|
+
const E = t(this, P).data.get(v);
|
|
532
532
|
g.style.display = "", t(this, Rt).call(this, g, E, v);
|
|
533
533
|
});
|
|
534
534
|
}), t(this, at) || (b(this, at, !0), setTimeout(() => {
|
|
@@ -570,10 +570,10 @@ const $e = class $e {
|
|
|
570
570
|
g > 0 && (r[u] && (r[u].style.height = `${g}px`), n[u] && (n[u].style.height = `${g}px`), o[u] && (o[u].style.height = `${g}px`));
|
|
571
571
|
}
|
|
572
572
|
}, "#syncHeaderHeights"));
|
|
573
|
-
|
|
574
|
-
t(this,
|
|
573
|
+
S(this, "destroy", /* @__PURE__ */ c(() => {
|
|
574
|
+
t(this, V) && (t(this, V).disconnect(), b(this, V, null));
|
|
575
575
|
}, "destroy"));
|
|
576
|
-
b(this,
|
|
576
|
+
b(this, P, i.getRootNode().host), b(this, A, i), t(this, zt).call(this);
|
|
577
577
|
}
|
|
578
578
|
getRowHeight() {
|
|
579
579
|
return t(this, H);
|
|
@@ -583,7 +583,7 @@ const $e = class $e {
|
|
|
583
583
|
return ((e = t(this, z).get(i)) == null ? void 0 : e.length) || 1;
|
|
584
584
|
}
|
|
585
585
|
};
|
|
586
|
-
|
|
586
|
+
P = new WeakMap(), A = new WeakMap(), z = new WeakMap(), H = new WeakMap(), V = new WeakMap(), Q = new WeakMap(), wt = new WeakMap(), at = new WeakMap(), Nt = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), Bt = new WeakMap(), zt = new WeakMap(), At = new WeakMap(), Dt = new WeakMap(), lt = new WeakMap(), Rt = new WeakMap(), Pt = new WeakMap(), c($e, "RowManager");
|
|
587
587
|
let ce = $e;
|
|
588
588
|
const jt = class jt {
|
|
589
589
|
/**
|
|
@@ -671,7 +671,7 @@ const yt = class yt extends HTMLElement {
|
|
|
671
671
|
d(this, Ft);
|
|
672
672
|
d(this, tt, null);
|
|
673
673
|
d(this, et);
|
|
674
|
-
|
|
674
|
+
S(this, "invalidate", /* @__PURE__ */ c(() => {
|
|
675
675
|
var e, s;
|
|
676
676
|
t(this, et).refresh(), (e = this.querySelector("nine-table-hscrollbar")) == null || e.refresh(), (s = this.querySelector("nine-table-vscrollbar")) == null || s.refresh();
|
|
677
677
|
}, "invalidate"));
|
|
@@ -707,7 +707,7 @@ const yt = class yt extends HTMLElement {
|
|
|
707
707
|
}), e === "body" ? s.style.flex = "1" : (s.style.flex = `0 0 ${n}px`, s.style.width = `${n}px`);
|
|
708
708
|
});
|
|
709
709
|
}, "#updateContainerWidths"));
|
|
710
|
-
|
|
710
|
+
S(this, "generate", /* @__PURE__ */ c((e) => {
|
|
711
711
|
e && (b(this, tt, he.compile(e)), t(this, Vt).call(this), t(this, Yt).call(this), t(this, et).initialize(), setTimeout(() => {
|
|
712
712
|
var s;
|
|
713
713
|
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
@@ -729,12 +729,12 @@ const yt = class yt extends HTMLElement {
|
|
|
729
729
|
l.remove();
|
|
730
730
|
}), n;
|
|
731
731
|
}, "#createSplitTable"));
|
|
732
|
-
|
|
733
|
-
|
|
732
|
+
S(this, "getRowHeight", /* @__PURE__ */ c(() => t(this, et).getRowHeight(), "getRowHeight"));
|
|
733
|
+
S(this, "scrollToX", /* @__PURE__ */ c((e) => {
|
|
734
734
|
const s = this.querySelector(".ng-container-body .ng-part-body");
|
|
735
735
|
s && (s.scrollLeft = e);
|
|
736
736
|
}, "scrollToX"));
|
|
737
|
-
|
|
737
|
+
S(this, "scrollToY", /* @__PURE__ */ c((e) => {
|
|
738
738
|
const s = this.querySelector(".ng-container-body .ng-part-body");
|
|
739
739
|
s && (s.scrollTop = e);
|
|
740
740
|
}, "scrollToY"));
|
|
@@ -890,10 +890,10 @@ const yt = class yt extends HTMLElement {
|
|
|
890
890
|
t(this, Ut).call(this);
|
|
891
891
|
}
|
|
892
892
|
disconnectedCallback() {
|
|
893
|
-
this.innerHTML = "",
|
|
893
|
+
this.innerHTML = "", D.log("NineTableSheet destroyed.");
|
|
894
894
|
}
|
|
895
895
|
};
|
|
896
|
-
Ft = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), ct = new WeakMap(), Ut = new WeakMap(), Xt = new WeakMap(), c(yt, "NineTableSheet"),
|
|
896
|
+
Ft = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), ct = new WeakMap(), Ut = new WeakMap(), Xt = new WeakMap(), c(yt, "NineTableSheet"), S(yt, "SCROLLBAR_SIZE", 16);
|
|
897
897
|
let $t = yt;
|
|
898
898
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", $t);
|
|
899
899
|
var Kt, qt;
|
|
@@ -1077,7 +1077,7 @@ const _e = class _e {
|
|
|
1077
1077
|
constructor(i) {
|
|
1078
1078
|
d(this, Tt);
|
|
1079
1079
|
d(this, ht, -1);
|
|
1080
|
-
|
|
1080
|
+
S(this, "count", /* @__PURE__ */ c(() => t(this, Tt).rawRecords.length, "count"));
|
|
1081
1081
|
b(this, Tt, i);
|
|
1082
1082
|
}
|
|
1083
1083
|
get at() {
|
|
@@ -1090,7 +1090,7 @@ const _e = class _e {
|
|
|
1090
1090
|
};
|
|
1091
1091
|
Tt = new WeakMap(), ht = new WeakMap(), c(_e, "ngRow");
|
|
1092
1092
|
let ue = _e;
|
|
1093
|
-
var I, k, _, dt, Jt,
|
|
1093
|
+
var I, k, _, dt, Jt, Y, Qt, st, Ct, te, ee, ft;
|
|
1094
1094
|
const N = class N {
|
|
1095
1095
|
constructor(i, e) {
|
|
1096
1096
|
d(this, I);
|
|
@@ -1098,15 +1098,15 @@ const N = class N {
|
|
|
1098
1098
|
d(this, _, []);
|
|
1099
1099
|
d(this, dt, []);
|
|
1100
1100
|
d(this, Jt, 0);
|
|
1101
|
-
d(this,
|
|
1101
|
+
d(this, Y, []);
|
|
1102
1102
|
d(this, Qt, /* @__PURE__ */ c(() => {
|
|
1103
|
-
b(this,
|
|
1103
|
+
b(this, Y, []);
|
|
1104
1104
|
const i = t(this, I).template || [];
|
|
1105
1105
|
Array.from(i).forEach((e) => {
|
|
1106
1106
|
var s;
|
|
1107
|
-
t(this,
|
|
1107
|
+
t(this, Y).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1108
1108
|
}), (t(this, k).rawRecords || []).forEach((e) => {
|
|
1109
|
-
e.__ng || (e.__ng = t(this, Ct).call(this)), e.__ng.height = t(this,
|
|
1109
|
+
e.__ng || (e.__ng = t(this, Ct).call(this)), e.__ng.height = t(this, Y).slice();
|
|
1110
1110
|
});
|
|
1111
1111
|
}, "#initialize"));
|
|
1112
1112
|
d(this, st, /* @__PURE__ */ c(() => {
|
|
@@ -1114,7 +1114,7 @@ const N = class N {
|
|
|
1114
1114
|
i.invalidate();
|
|
1115
1115
|
});
|
|
1116
1116
|
}, "#invalidate"));
|
|
1117
|
-
|
|
1117
|
+
S(this, "get", /* @__PURE__ */ c((i, e) => {
|
|
1118
1118
|
var n;
|
|
1119
1119
|
const s = this.getValidData();
|
|
1120
1120
|
if (!s || s.length <= 0) return;
|
|
@@ -1127,22 +1127,22 @@ const N = class N {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
return t(this, ft).call(this, s[i]);
|
|
1129
1129
|
}, "get"));
|
|
1130
|
-
|
|
1130
|
+
S(this, "set", /* @__PURE__ */ c((i) => {
|
|
1131
1131
|
this.clear(), this.add(i, !1), t(this, st).call(this);
|
|
1132
1132
|
}, "set"));
|
|
1133
1133
|
d(this, Ct, /* @__PURE__ */ c(() => ({
|
|
1134
1134
|
rowState: N.ROW_STATE.EMPTY,
|
|
1135
1135
|
deleted: !1,
|
|
1136
1136
|
filtered: !1,
|
|
1137
|
-
height: t(this,
|
|
1137
|
+
height: t(this, Y).slice(),
|
|
1138
1138
|
o: {},
|
|
1139
1139
|
c: {},
|
|
1140
|
-
_: [0, 0, 0, 0, N.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this,
|
|
1140
|
+
_: [0, 0, 0, 0, N.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, Y).slice(), -1, {}, {}]
|
|
1141
1141
|
}), "#getDefaultMeta"));
|
|
1142
|
-
|
|
1142
|
+
S(this, "reset", /* @__PURE__ */ c(() => {
|
|
1143
1143
|
b(this, _, []), b(this, dt, []), t(this, st).call(this);
|
|
1144
1144
|
}, "reset"));
|
|
1145
|
-
|
|
1145
|
+
S(this, "clear", /* @__PURE__ */ c(() => {
|
|
1146
1146
|
var i;
|
|
1147
1147
|
t(this, k).rawRecords = [], b(this, _, []), b(this, dt, []), (i = t(this, k).viewRecords) != null && i.reset && t(this, k).viewRecords.reset();
|
|
1148
1148
|
}, "clear"));
|
|
@@ -1160,7 +1160,7 @@ const N = class N {
|
|
|
1160
1160
|
d(this, ee, /* @__PURE__ */ c((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1161
1161
|
e.__ng = t(this, Ct).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = N.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1162
1162
|
}), i), "#defaultInsert"));
|
|
1163
|
-
|
|
1163
|
+
S(this, "add", /* @__PURE__ */ c((i, e = !0) => {
|
|
1164
1164
|
i === void 0 && (i = {});
|
|
1165
1165
|
const s = t(this, te).call(this, i);
|
|
1166
1166
|
t(this, k).rawRecords = t(this, k).rawRecords.concat(t(this, ee).call(this, s)), this.resetRecords();
|
|
@@ -1170,7 +1170,7 @@ const N = class N {
|
|
|
1170
1170
|
a && (a.__ng.rowState = N.ROW_STATE.EMPTY);
|
|
1171
1171
|
}), t(this, st).call(this), r;
|
|
1172
1172
|
}, "add"));
|
|
1173
|
-
|
|
1173
|
+
S(this, "delete", /* @__PURE__ */ c((i) => {
|
|
1174
1174
|
let e = [];
|
|
1175
1175
|
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, k).host.row.at] : e = [parseInt(i, 10)], e.sort((s, r) => r - s).forEach((s) => {
|
|
1176
1176
|
if (t(this, _)[s]) {
|
|
@@ -1181,7 +1181,7 @@ const N = class N {
|
|
|
1181
1181
|
}
|
|
1182
1182
|
}), this.resetRecords(), t(this, st).call(this);
|
|
1183
1183
|
}, "delete"));
|
|
1184
|
-
|
|
1184
|
+
S(this, "setValue", /* @__PURE__ */ c((i, e, s) => {
|
|
1185
1185
|
var h;
|
|
1186
1186
|
i = parseInt(i, 10);
|
|
1187
1187
|
const n = (typeof ((h = t(this, I).fields) == null ? void 0 : h.get) == "function" ? t(this, I).fields.get() : []).indexOf(e);
|
|
@@ -1191,14 +1191,14 @@ const N = class N {
|
|
|
1191
1191
|
const a = o.v[n];
|
|
1192
1192
|
a !== s && o.__ng.rowState !== N.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = a), o.__ng.rowState = N.ROW_STATE.UPDATE), o.v[n] = s;
|
|
1193
1193
|
}, "setValue"));
|
|
1194
|
-
|
|
1194
|
+
S(this, "resetRecords", /* @__PURE__ */ c(() => {
|
|
1195
1195
|
b(this, dt, t(this, k).rawRecords.filter((i) => !i.__ng.deleted)), b(this, _, t(this, k).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, k).rawRecords.forEach((i, e) => {
|
|
1196
1196
|
i.__ng.rowidx = e;
|
|
1197
1197
|
}), t(this, _).forEach((i, e) => {
|
|
1198
1198
|
i.__ng.i = e;
|
|
1199
1199
|
});
|
|
1200
1200
|
}, "resetRecords"));
|
|
1201
|
-
|
|
1201
|
+
S(this, "getValidData", /* @__PURE__ */ c(() => (t(this, _).length === 0 && t(this, k).rawRecords.length > 0 && this.resetRecords(), t(this, _)), "getValidData"));
|
|
1202
1202
|
d(this, ft, /* @__PURE__ */ c((i) => {
|
|
1203
1203
|
var o;
|
|
1204
1204
|
if (!i) return i;
|
|
@@ -1210,7 +1210,7 @@ const N = class N {
|
|
|
1210
1210
|
});
|
|
1211
1211
|
return e ? n[0] : n;
|
|
1212
1212
|
}, "#conv"));
|
|
1213
|
-
|
|
1213
|
+
S(this, "count", /* @__PURE__ */ c(() => this.getValidData().length, "count"));
|
|
1214
1214
|
b(this, I, i), b(this, k, e), t(this, Qt).call(this);
|
|
1215
1215
|
}
|
|
1216
1216
|
get source() {
|
|
@@ -1229,8 +1229,8 @@ const N = class N {
|
|
|
1229
1229
|
return this.length;
|
|
1230
1230
|
}
|
|
1231
1231
|
};
|
|
1232
|
-
I = new WeakMap(), k = new WeakMap(), _ = new WeakMap(), dt = new WeakMap(), Jt = new WeakMap(),
|
|
1233
|
-
|
|
1232
|
+
I = new WeakMap(), k = new WeakMap(), _ = new WeakMap(), dt = new WeakMap(), Jt = new WeakMap(), Y = new WeakMap(), Qt = new WeakMap(), st = new WeakMap(), Ct = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ft = new WeakMap(), c(N, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1233
|
+
S(N, "ROW_STATE", {
|
|
1234
1234
|
EMPTY: "EMPTY",
|
|
1235
1235
|
NORMAL: "NORMAL",
|
|
1236
1236
|
INSERT: "INSERT",
|
|
@@ -1267,7 +1267,7 @@ const We = class We {
|
|
|
1267
1267
|
constructor(i) {
|
|
1268
1268
|
d(this, ut);
|
|
1269
1269
|
d(this, L, []);
|
|
1270
|
-
|
|
1270
|
+
S(this, "add", /* @__PURE__ */ c((i, e = "string") => {
|
|
1271
1271
|
i.forEach((s) => {
|
|
1272
1272
|
t(this, L).some((r) => r.name === s) || t(this, L).push({ name: s, type: e });
|
|
1273
1273
|
}), t(this, Lt).call(this);
|
|
@@ -1279,11 +1279,11 @@ const We = class We {
|
|
|
1279
1279
|
}), b(this, L, Array.from(i, ([e, s]) => ({ name: e, type: s }))), b(this, L, t(this, L).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, L).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1280
1280
|
}, "#adjust"));
|
|
1281
1281
|
d(this, se, /* @__PURE__ */ c(() => {
|
|
1282
|
-
b(this, L, []),
|
|
1282
|
+
b(this, L, []), D.log(t(this, ut).querySelectorAll("table"));
|
|
1283
1283
|
const i = Array.from(t(this, ut).querySelectorAll("table"));
|
|
1284
1284
|
if (!(!i || i.length === 0)) {
|
|
1285
1285
|
for (const e of i)
|
|
1286
|
-
|
|
1286
|
+
D.log(e), $("[data-bind]", e).each((s, r) => {
|
|
1287
1287
|
const n = r.dataset.bind, o = r.getAttribute("data-type") || "string";
|
|
1288
1288
|
n && t(this, L).push({ name: n, type: o });
|
|
1289
1289
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1342,7 +1342,7 @@ const Oe = class Oe extends HTMLElement {
|
|
|
1342
1342
|
d(this, rt);
|
|
1343
1343
|
d(this, ie);
|
|
1344
1344
|
d(this, re, /* @__PURE__ */ c(() => {
|
|
1345
|
-
this.fields = new pe(this), b(this, ie, new fe(this)),
|
|
1345
|
+
this.fields = new pe(this), b(this, ie, new fe(this)), D.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1346
1346
|
}, "#init"));
|
|
1347
1347
|
this.attachShadow({ mode: "open" }), b(this, rt, new be(this));
|
|
1348
1348
|
}
|
|
@@ -1350,7 +1350,7 @@ const Oe = class Oe extends HTMLElement {
|
|
|
1350
1350
|
t(this, re).call(this);
|
|
1351
1351
|
}
|
|
1352
1352
|
disconnectedCallback() {
|
|
1353
|
-
|
|
1353
|
+
D.log("NineTable disconnected.");
|
|
1354
1354
|
}
|
|
1355
1355
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1356
1356
|
get data() {
|
|
@@ -1379,7 +1379,7 @@ const mt = class mt extends HTMLElement {
|
|
|
1379
1379
|
connectedCallback() {
|
|
1380
1380
|
}
|
|
1381
1381
|
};
|
|
1382
|
-
c(mt, "BasicCellElement"),
|
|
1382
|
+
c(mt, "BasicCellElement"), S(mt, "_styleCache", /* @__PURE__ */ new Map()), S(mt, "_customStyleCache", /* @__PURE__ */ new Map());
|
|
1383
1383
|
let me = mt;
|
|
1384
1384
|
var T, Ht, y, Se, Ee, Ae, Re, qe;
|
|
1385
1385
|
const Be = class Be extends me {
|
|
@@ -1392,7 +1392,7 @@ const Be = class Be extends me {
|
|
|
1392
1392
|
d(this, Ee);
|
|
1393
1393
|
d(this, Ae);
|
|
1394
1394
|
d(this, Re);
|
|
1395
|
-
|
|
1395
|
+
S(this, "getDisplayText", /* @__PURE__ */ c((e) => {
|
|
1396
1396
|
if (t(this, y))
|
|
1397
1397
|
if (t(this, y).closest("tbody")) {
|
|
1398
1398
|
const s = t(this, y).closest("tr").data, r = parseInt(t(this, y).dataset.row);
|
|
@@ -1412,11 +1412,6 @@ const Be = class Be extends me {
|
|
|
1412
1412
|
} catch {
|
|
1413
1413
|
}
|
|
1414
1414
|
}, "getDisplayText"));
|
|
1415
|
-
w(this, "reset", /* @__PURE__ */ c(() => {
|
|
1416
|
-
U.log("super reset"), parseInt(t(this, y).dataset.row);
|
|
1417
|
-
const e = t(this, Ht).data;
|
|
1418
|
-
U.log(e);
|
|
1419
|
-
}, "reset"));
|
|
1420
1415
|
d(this, qe, /* @__PURE__ */ c(() => {
|
|
1421
1416
|
if (!(!t(this, T) || !t(this, T).template || !t(this, y).closest("tbody.bindable"))) {
|
|
1422
1417
|
var e = ninegrid.j.querySelectorAll(t(this, y)).attr("suppress");
|
|
@@ -1446,7 +1441,7 @@ const Be = class Be extends me {
|
|
|
1446
1441
|
}
|
|
1447
1442
|
}
|
|
1448
1443
|
}, "#resetSuppress"));
|
|
1449
|
-
|
|
1444
|
+
S(this, "getExprValue", /* @__PURE__ */ c((e, s, r, n) => {
|
|
1450
1445
|
if (typeof e < "u")
|
|
1451
1446
|
try {
|
|
1452
1447
|
r = parseInt(r);
|
|
@@ -1477,23 +1472,28 @@ const Be = class Be extends me {
|
|
|
1477
1472
|
get data() {
|
|
1478
1473
|
return t(this, y).closest("tr").data;
|
|
1479
1474
|
}
|
|
1475
|
+
reset() {
|
|
1476
|
+
D.log("super reset"), parseInt(t(this, y).dataset.row);
|
|
1477
|
+
const e = t(this, Ht).data;
|
|
1478
|
+
D.log(e);
|
|
1479
|
+
}
|
|
1480
1480
|
};
|
|
1481
1481
|
T = new WeakMap(), Ht = new WeakMap(), y = new WeakMap(), Se = new WeakMap(), Ee = new WeakMap(), Ae = new WeakMap(), Re = new WeakMap(), qe = new WeakMap(), c(Be, "CellElement");
|
|
1482
1482
|
let xe = Be;
|
|
1483
1483
|
const ze = class ze extends xe {
|
|
1484
1484
|
constructor() {
|
|
1485
1485
|
super();
|
|
1486
|
-
w(this, "reset", /* @__PURE__ */ c(() => {
|
|
1487
|
-
U.log("editable reset"), super.reset();
|
|
1488
|
-
}, "reset"));
|
|
1489
1486
|
}
|
|
1490
1487
|
connectedCallback() {
|
|
1491
1488
|
super.connectedCallback();
|
|
1492
1489
|
}
|
|
1490
|
+
reset() {
|
|
1491
|
+
D.log("editable reset"), super.reset();
|
|
1492
|
+
}
|
|
1493
1493
|
};
|
|
1494
1494
|
c(ze, "EditableCellElement");
|
|
1495
1495
|
let ve = ze;
|
|
1496
|
-
var ke, nt, gt, bt, ne,
|
|
1496
|
+
var ke, nt, gt, bt, ne, U, Te;
|
|
1497
1497
|
const De = class De extends ve {
|
|
1498
1498
|
constructor() {
|
|
1499
1499
|
super();
|
|
@@ -1502,9 +1502,9 @@ const De = class De extends ve {
|
|
|
1502
1502
|
d(this, gt);
|
|
1503
1503
|
d(this, bt);
|
|
1504
1504
|
d(this, ne);
|
|
1505
|
-
d(this,
|
|
1506
|
-
|
|
1507
|
-
|
|
1505
|
+
d(this, U);
|
|
1506
|
+
S(this, "reset", /* @__PURE__ */ c(() => {
|
|
1507
|
+
D.log("==============="), super.reset(), D.log("input reset");
|
|
1508
1508
|
}, "reset"));
|
|
1509
1509
|
/**
|
|
1510
1510
|
dataRefresh = (v) => {
|
|
@@ -1540,18 +1540,18 @@ const De = class De extends ve {
|
|
|
1540
1540
|
if (!["Escape", "Enter", "Tab", "Home", "End", "ArrowLeft", "ArrowRight", "PageUp", "PageDown", "Backspace", "Delete"].includes(e.code)) {
|
|
1541
1541
|
if (t(this, nt) == "number") {
|
|
1542
1542
|
let n = [];
|
|
1543
|
-
if (t(this,
|
|
1543
|
+
if (t(this, U) && Number(t(this, U)) > 0 && n.push("."), t(this, bt) && Number(t(this, bt)) >= 0 && n.push("-"), !(e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105) && !n.includes(e.key) && e.preventDefault(), t(this, U) && (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105) && e.target.selectionStart == e.target.selectionEnd) {
|
|
1544
1544
|
var s = e.target.value, r = s.indexOf(".");
|
|
1545
1545
|
if (r >= 0) {
|
|
1546
1546
|
var s = s.substr(r + 1, s.length);
|
|
1547
|
-
s.length >= Number(t(this,
|
|
1547
|
+
s.length >= Number(t(this, U)) && e.preventDefault();
|
|
1548
1548
|
}
|
|
1549
1549
|
}
|
|
1550
1550
|
}
|
|
1551
1551
|
t(this, gt) && ninegrid.getByteLength(e.target.value) >= Number(t(this, gt)) && e.target.selectionStart == e.target.selectionEnd && e.preventDefault();
|
|
1552
1552
|
}
|
|
1553
1553
|
}, "#onKeyDown"));
|
|
1554
|
-
if (this.applyBaseStyle(), b(this, nt, this.getAttribute("type") || "text"), b(this, gt, this.getAttribute("maxbyte")), b(this, bt, this.getAttribute("min")), b(this, ne, this.getAttribute("max")), b(this,
|
|
1554
|
+
if (this.applyBaseStyle(), b(this, nt, this.getAttribute("type") || "text"), b(this, gt, this.getAttribute("maxbyte")), b(this, bt, this.getAttribute("min")), b(this, ne, this.getAttribute("max")), b(this, U, this.getAttribute("scale")), !["text", "number"].includes(t(this, nt))) throw `invalid type : ${t(this, nt)}`;
|
|
1555
1555
|
}
|
|
1556
1556
|
connectedCallback() {
|
|
1557
1557
|
for (var e = [], s = 0; s < this.attributes.length; s++)
|
|
@@ -1564,7 +1564,7 @@ const De = class De extends ve {
|
|
|
1564
1564
|
`, super.connectedCallback();
|
|
1565
1565
|
}
|
|
1566
1566
|
};
|
|
1567
|
-
ke = new WeakMap(), nt = new WeakMap(), gt = new WeakMap(), bt = new WeakMap(), ne = new WeakMap(),
|
|
1567
|
+
ke = new WeakMap(), nt = new WeakMap(), gt = new WeakMap(), bt = new WeakMap(), ne = new WeakMap(), U = new WeakMap(), Te = new WeakMap(), c(De, "CellInputText");
|
|
1568
1568
|
let we = De;
|
|
1569
1569
|
customElements.get("cell-input-text");
|
|
1570
1570
|
customElements.get("cell-input") || customElements.define("cell-input", we);
|