@ninebone/table 0.0.443 → 0.0.444
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 +184 -183
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +1 -0
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -7,8 +7,8 @@ var h = (S, n) => xe(S, "name", { value: n, configurable: !0 });
|
|
|
7
7
|
var E = (S, n, e) => Ee(S, typeof n != "symbol" ? n + "" : n, e), we = (S, n, e) => n.has(S) || ve("Cannot " + e);
|
|
8
8
|
var t = (S, n, e) => (we(S, n, "read from private field"), e ? e.call(S) : n.get(S)), d = (S, n, e) => n.has(S) ? ve("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(S) : n.set(S, e), u = (S, n, e, i) => (we(S, n, "write to private field"), i ? i.call(S, e) : n.set(S, e), e);
|
|
9
9
|
var Se = (S, n, e, i) => ({
|
|
10
|
-
set _(
|
|
11
|
-
u(S, n,
|
|
10
|
+
set _(o) {
|
|
11
|
+
u(S, n, o, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
14
|
return t(S, n, i);
|
|
@@ -44,14 +44,14 @@ const he = class he extends HTMLElement {
|
|
|
44
44
|
if (!t(this, I) || !t(this, m) || t(this, B)) return;
|
|
45
45
|
const e = t(this, m).container, i = e.querySelector("table");
|
|
46
46
|
if (!i) return;
|
|
47
|
-
const
|
|
47
|
+
const o = t(this, m).track, r = t(this, m).thumb, s = t(this, I).querySelector(".ng-container-bottom"), l = e.clientWidth, c = i.scrollWidth;
|
|
48
48
|
if (l !== 0 && c > l)
|
|
49
|
-
|
|
49
|
+
s && (s.style.display = "flex");
|
|
50
50
|
else {
|
|
51
|
-
|
|
51
|
+
s && (s.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const a =
|
|
54
|
+
const a = o.clientWidth;
|
|
55
55
|
if (a <= 0) return;
|
|
56
56
|
const f = Math.max(Math.min(a * (l / c), a), 20);
|
|
57
57
|
r.style.width = `${f}px`;
|
|
@@ -63,51 +63,51 @@ const he = class he extends HTMLElement {
|
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
d(this, X, /* @__PURE__ */ h((e) => {
|
|
65
65
|
if (!t(this, m)) return !1;
|
|
66
|
-
const i = t(this, m).container,
|
|
67
|
-
if (!
|
|
68
|
-
const r = t(this, m).track.getBoundingClientRect(),
|
|
66
|
+
const i = t(this, m).container, o = i.querySelector("table");
|
|
67
|
+
if (!o) return !1;
|
|
68
|
+
const r = t(this, m).track.getBoundingClientRect(), s = t(this, m).thumb.clientWidth;
|
|
69
69
|
let l = e;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
|
-
const c = r.width -
|
|
71
|
+
const c = r.width - s;
|
|
72
72
|
l > c && (l = c), l = parseInt(l, 10), t(this, m).thumb.style.left = `${l}px`, t(this, m).left.disabled = l === 0, t(this, m).right.disabled = l >= c - 1;
|
|
73
|
-
const a = i.clientWidth, g =
|
|
73
|
+
const a = i.clientWidth, g = o.scrollWidth - a;
|
|
74
74
|
return c > 0 && g > 0 && (i.scrollLeft = l / c * g), l > 0 && l < c - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
d(this, qt, /* @__PURE__ */ h(() => {
|
|
77
|
-
const e = /* @__PURE__ */ h((
|
|
77
|
+
const e = /* @__PURE__ */ h((o) => {
|
|
78
78
|
clearInterval(t(this, Y)), clearInterval(t(this, F));
|
|
79
79
|
const r = parseInt(t(this, m).thumb.style.left || 0, 10);
|
|
80
|
-
t(this, X).call(this, r +
|
|
80
|
+
t(this, X).call(this, r + o), u(this, Y, setInterval(() => {
|
|
81
81
|
clearInterval(t(this, Y)), u(this, F, setInterval(() => {
|
|
82
|
-
const
|
|
83
|
-
t(this, X).call(this,
|
|
82
|
+
const s = parseInt(t(this, m).thumb.style.left || 0, 10);
|
|
83
|
+
t(this, X).call(this, s + o) || clearInterval(t(this, F));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), i = /* @__PURE__ */ h(() => {
|
|
87
87
|
clearInterval(t(this, Y)), clearInterval(t(this, F));
|
|
88
88
|
}, "clearTimer");
|
|
89
|
-
["mouseup", "mouseleave", "touchend"].forEach((
|
|
90
|
-
t(this, m).left.addEventListener(
|
|
91
|
-
}), t(this, m).left.addEventListener("mousedown", (
|
|
92
|
-
|
|
93
|
-
}), t(this, m).right.addEventListener("mousedown", (
|
|
94
|
-
|
|
95
|
-
}), t(this, m).left.addEventListener("touchstart", () => e(-20)), t(this, m).right.addEventListener("touchstart", () => e(20)), t(this, m).track.addEventListener("mousedown", (
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
const r = t(this, m).track.getBoundingClientRect(),
|
|
99
|
-
t(this, X).call(this,
|
|
100
|
-
}), t(this, m).thumb.addEventListener("mousedown", (
|
|
101
|
-
if (
|
|
102
|
-
|
|
89
|
+
["mouseup", "mouseleave", "touchend"].forEach((o) => {
|
|
90
|
+
t(this, m).left.addEventListener(o, i), t(this, m).right.addEventListener(o, i), t(this, m).track.addEventListener(o, i);
|
|
91
|
+
}), t(this, m).left.addEventListener("mousedown", (o) => {
|
|
92
|
+
o.button === 0 && e(-20);
|
|
93
|
+
}), t(this, m).right.addEventListener("mousedown", (o) => {
|
|
94
|
+
o.button === 0 && e(20);
|
|
95
|
+
}), t(this, m).left.addEventListener("touchstart", () => e(-20)), t(this, m).right.addEventListener("touchstart", () => e(20)), t(this, m).track.addEventListener("mousedown", (o) => {
|
|
96
|
+
if (o.button !== 0) return;
|
|
97
|
+
o.preventDefault();
|
|
98
|
+
const r = t(this, m).track.getBoundingClientRect(), s = t(this, m).thumb.clientWidth;
|
|
99
|
+
t(this, X).call(this, o.clientX - r.left - s / 2);
|
|
100
|
+
}), t(this, m).thumb.addEventListener("mousedown", (o) => {
|
|
101
|
+
if (o.button !== 0) return;
|
|
102
|
+
o.stopPropagation(), o.preventDefault(), u(this, B, !0), this.shiftX = o.clientX - t(this, m).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ h((l) => {
|
|
104
104
|
if (!t(this, B)) return;
|
|
105
105
|
const c = t(this, m).track.getBoundingClientRect();
|
|
106
106
|
t(this, X).call(this, l.clientX - c.left - this.shiftX);
|
|
107
|
-
}, "onMouseMove"),
|
|
108
|
-
u(this, B, !1), i(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup",
|
|
107
|
+
}, "onMouseMove"), s = /* @__PURE__ */ h(() => {
|
|
108
|
+
u(this, B, !1), i(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", s), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup",
|
|
110
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", s);
|
|
111
111
|
});
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
@@ -213,32 +213,32 @@ const de = class de extends HTMLElement {
|
|
|
213
213
|
d(this, gt, 0);
|
|
214
214
|
E(this, "refresh", /* @__PURE__ */ h(() => {
|
|
215
215
|
if (!t(this, N) || !t(this, R)) return;
|
|
216
|
-
const e = t(this, R).container, i = t(this, R).track,
|
|
216
|
+
const e = t(this, R).container, i = t(this, R).track, o = t(this, R).thumb, r = e.clientHeight, l = (t(this, N).data.get() || []).length, c = t(this, et).getRowHeight(), a = l * c;
|
|
217
217
|
if (a <= r) {
|
|
218
|
-
|
|
218
|
+
o.style.display = "none", t(this, R).top.disabled = !0, t(this, R).bottom.disabled = !0;
|
|
219
219
|
return;
|
|
220
220
|
} else
|
|
221
|
-
|
|
221
|
+
o.style.display = "block";
|
|
222
222
|
const f = i.clientHeight;
|
|
223
223
|
if (f <= 0) return;
|
|
224
224
|
const g = Math.max(Math.min(f * (r / a), f), 20);
|
|
225
|
-
|
|
225
|
+
o.style.height = `${g}px`;
|
|
226
226
|
const y = e.scrollTop, b = Math.max(a - r, 1);
|
|
227
227
|
let p = 0;
|
|
228
228
|
b > 0 && (p = y / b * (f - g));
|
|
229
229
|
const v = f - g;
|
|
230
|
-
p < 0 && (p = 0), p > v && (p = v),
|
|
230
|
+
p < 0 && (p = 0), p > v && (p = v), o.style.top = `${p}px`, t(this, R).top.disabled = y <= 0, t(this, R).bottom.disabled = y >= b - 1;
|
|
231
231
|
}, "refresh"));
|
|
232
232
|
d(this, Tt, /* @__PURE__ */ h(() => {
|
|
233
233
|
const e = t(this, R).container, i = /* @__PURE__ */ h(() => {
|
|
234
|
-
const r = (t(this, N).data.get() || []).length,
|
|
235
|
-
return r *
|
|
234
|
+
const r = (t(this, N).data.get() || []).length, s = t(this, et).getRowHeight();
|
|
235
|
+
return r * s;
|
|
236
236
|
}, "getContentHeight");
|
|
237
237
|
e.addEventListener("scroll", () => {
|
|
238
238
|
t(this, U) || this.refresh();
|
|
239
|
-
}), t(this, R).thumb.addEventListener("mousedown", (
|
|
240
|
-
if (
|
|
241
|
-
|
|
239
|
+
}), t(this, R).thumb.addEventListener("mousedown", (o) => {
|
|
240
|
+
if (o.button !== 0) return;
|
|
241
|
+
o.stopPropagation(), o.preventDefault(), u(this, U, !0), u(this, ft, o.clientY), u(this, gt, e.scrollTop);
|
|
242
242
|
const r = /* @__PURE__ */ h((l) => {
|
|
243
243
|
if (!t(this, U)) return;
|
|
244
244
|
const c = t(this, R).track.getBoundingClientRect(), a = t(this, R).thumb.clientHeight, g = c.height - a, y = l.clientY - t(this, ft), b = e.clientHeight, p = i(), v = Math.max(p - b, 1);
|
|
@@ -249,13 +249,13 @@ const de = class de extends HTMLElement {
|
|
|
249
249
|
x < 0 && (x = 0), x > tt && (x = tt), e.scrollTop = x;
|
|
250
250
|
}
|
|
251
251
|
this.refresh();
|
|
252
|
-
}, "onMouseMove"),
|
|
253
|
-
u(this, U, !1), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup",
|
|
252
|
+
}, "onMouseMove"), s = /* @__PURE__ */ h(() => {
|
|
253
|
+
u(this, U, !1), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", s), this.refresh();
|
|
254
254
|
}, "onMouseUp");
|
|
255
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup",
|
|
256
|
-
}), t(this, R).track.addEventListener("mousedown", (
|
|
257
|
-
if (
|
|
258
|
-
const r = t(this, R).track.getBoundingClientRect(),
|
|
255
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", s);
|
|
256
|
+
}), t(this, R).track.addEventListener("mousedown", (o) => {
|
|
257
|
+
if (o.button !== 0 || o.target === t(this, R).thumb) return;
|
|
258
|
+
const r = t(this, R).track.getBoundingClientRect(), s = t(this, R).thumb.clientHeight, l = o.clientY - r.top - s / 2, a = r.height - s, f = e.clientHeight, g = i(), y = Math.max(g - f, 1);
|
|
259
259
|
if (a > 0 && y > 0) {
|
|
260
260
|
const b = Math.max(0, Math.min(1, l / a));
|
|
261
261
|
e.scrollTop = b * y;
|
|
@@ -371,27 +371,27 @@ const fe = class fe {
|
|
|
371
371
|
n && (t(this, bt).call(this), t(this, it).call(this, n.scrollTop), (e = t(this, w).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
372
372
|
}, "refresh"));
|
|
373
373
|
E(this, "initialize", /* @__PURE__ */ h(() => {
|
|
374
|
-
u(this, T, null), t(this, W).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
375
|
-
const r = t(this, w).querySelector(
|
|
374
|
+
u(this, T, null), t(this, W).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
375
|
+
const r = t(this, w).querySelector(o);
|
|
376
376
|
if (!r) return;
|
|
377
|
-
const
|
|
378
|
-
if (!
|
|
379
|
-
const l =
|
|
377
|
+
const s = r.querySelector(".ng-part-body table");
|
|
378
|
+
if (!s) return;
|
|
379
|
+
const l = s.querySelector("tbody.bindable-tbody");
|
|
380
380
|
if (!l) return;
|
|
381
381
|
const a = Array.from(l.querySelectorAll("tr")).map((f) => f.cloneNode(!0));
|
|
382
|
-
t(this, W).set(
|
|
382
|
+
t(this, W).set(o, a);
|
|
383
383
|
});
|
|
384
384
|
const n = t(this, w).querySelector(".ng-container-body .ng-part-body"), e = t(this, w).querySelector(".ng-container-left .ng-part-body"), i = t(this, w).querySelector(".ng-container-right .ng-part-body");
|
|
385
385
|
if (n) {
|
|
386
386
|
t(this, Ct).call(this, n), t(this, pt).call(this), t(this, bt).call(this), t(this, it).call(this, n.scrollTop);
|
|
387
|
-
let
|
|
388
|
-
const r = /* @__PURE__ */ h((
|
|
387
|
+
let o = !1;
|
|
388
|
+
const r = /* @__PURE__ */ h((s, l) => {
|
|
389
389
|
var c;
|
|
390
|
-
|
|
390
|
+
o || (o = !0, n && n.scrollTop !== s && (n.scrollTop = s), e && e.scrollTop !== s && (e.scrollTop = s), i && i.scrollTop !== s && (i.scrollTop = s), t(this, it).call(this, s), (c = t(this, w).querySelector("nine-table-vscrollbar")) == null || c.refresh(), o = !1);
|
|
391
391
|
}, "syncScroll");
|
|
392
|
-
[n, e, i].forEach((
|
|
393
|
-
|
|
394
|
-
r(
|
|
392
|
+
[n, e, i].forEach((s) => {
|
|
393
|
+
s && s.addEventListener("scroll", () => {
|
|
394
|
+
r(s.scrollTop);
|
|
395
395
|
});
|
|
396
396
|
});
|
|
397
397
|
}
|
|
@@ -399,15 +399,15 @@ const fe = class fe {
|
|
|
399
399
|
d(this, Lt, /* @__PURE__ */ h((n, e) => {
|
|
400
400
|
const i = t(this, W).get(e);
|
|
401
401
|
if (!i || i.length === 0) return;
|
|
402
|
-
const
|
|
403
|
-
if (!
|
|
404
|
-
|
|
405
|
-
const r =
|
|
402
|
+
const o = n.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
403
|
+
if (!o) return;
|
|
404
|
+
o.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
405
|
+
const r = o.querySelector("tr.nodata"), s = document.createDocumentFragment();
|
|
406
406
|
for (let l = 0; l < t(this, ut); l++)
|
|
407
407
|
i.forEach((c) => {
|
|
408
|
-
|
|
408
|
+
s.appendChild(c.cloneNode(!0));
|
|
409
409
|
});
|
|
410
|
-
r ? r.before(
|
|
410
|
+
r ? r.before(s) : o.appendChild(s);
|
|
411
411
|
}, "#renderRows"));
|
|
412
412
|
d(this, Ct, /* @__PURE__ */ h((n) => {
|
|
413
413
|
if (t(this, T) !== null && t(this, T) > 0)
|
|
@@ -417,25 +417,25 @@ const fe = class fe {
|
|
|
417
417
|
const i = n.querySelector("tbody.bindable-tbody");
|
|
418
418
|
if (!i) return 24;
|
|
419
419
|
i.querySelectorAll("tr:not(.nodata)").forEach((y) => y.remove());
|
|
420
|
-
const
|
|
420
|
+
const o = i.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
421
421
|
e.forEach((y) => {
|
|
422
422
|
r.appendChild(y.cloneNode(!0));
|
|
423
|
-
}),
|
|
424
|
-
const
|
|
425
|
-
(l === "none" || window.getComputedStyle(
|
|
423
|
+
}), o ? o.before(r) : i.appendChild(r);
|
|
424
|
+
const s = t(this, w), l = s.style.display, c = s.style.visibility, a = s.style.position;
|
|
425
|
+
(l === "none" || window.getComputedStyle(s).display === "none") && (s.style.display = "block", s.style.visibility = "hidden", s.style.position = "absolute");
|
|
426
426
|
let f = 0;
|
|
427
427
|
const g = i.querySelectorAll("tr:not(.nodata)");
|
|
428
428
|
return g.forEach((y) => {
|
|
429
429
|
f += y.offsetHeight || y.getBoundingClientRect().height;
|
|
430
|
-
}), g.forEach((y) => y.remove()),
|
|
430
|
+
}), g.forEach((y) => y.remove()), s.style.display = l, s.style.visibility = c, s.style.position = a, u(this, T, f > 0 ? f : 24), t(this, yt).call(this), t(this, T);
|
|
431
431
|
}, "#measureAndCacheHeight"));
|
|
432
432
|
d(this, bt, /* @__PURE__ */ h(() => {
|
|
433
|
-
const e = (t(this, z).data.get() || []).length, i = t(this, T) || 24,
|
|
433
|
+
const e = (t(this, z).data.get() || []).length, i = t(this, T) || 24, o = e * i;
|
|
434
434
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((r) => {
|
|
435
|
-
const
|
|
436
|
-
if (!
|
|
437
|
-
const l =
|
|
438
|
-
l && (l.style.height = `${
|
|
435
|
+
const s = t(this, w).querySelector(r);
|
|
436
|
+
if (!s) return;
|
|
437
|
+
const l = s.querySelector(".ng-part-body .ng-virtual-spacer");
|
|
438
|
+
l && (l.style.height = `${o}px`);
|
|
439
439
|
});
|
|
440
440
|
}, "#updateVirtualScrollHeight"));
|
|
441
441
|
d(this, yt, /* @__PURE__ */ h(() => {
|
|
@@ -458,9 +458,9 @@ const fe = class fe {
|
|
|
458
458
|
O > 0 && (b[x] && (b[x].style.height = `${O}px`), p[x] && (p[x].style.height = `${O}px`), v[x] && (v[x].style.height = `${O}px`));
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
const
|
|
461
|
+
const o = t(this, w).querySelector(".ng-container-left .ng-part-footer table"), r = t(this, w).querySelector(".ng-container-body .ng-part-footer table"), s = t(this, w).querySelector(".ng-container-right .ng-part-footer table");
|
|
462
462
|
if (r) {
|
|
463
|
-
const b =
|
|
463
|
+
const b = o ? Array.from(o.querySelectorAll("tfoot tr")) : [], p = Array.from(r.querySelectorAll("tfoot tr")), v = s ? Array.from(s.querySelectorAll("tfoot tr")) : [], M = Math.max(b.length, p.length, v.length);
|
|
464
464
|
for (let x = 0; x < M; x++) {
|
|
465
465
|
const tt = [
|
|
466
466
|
((f = b[x]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
@@ -476,12 +476,12 @@ const fe = class fe {
|
|
|
476
476
|
for (const e of n) {
|
|
477
477
|
const i = e.target;
|
|
478
478
|
if (!i.classList.contains("active")) continue;
|
|
479
|
-
const
|
|
480
|
-
if (
|
|
479
|
+
const o = e.contentRect.height;
|
|
480
|
+
if (o > 0) {
|
|
481
481
|
let r = 0;
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
const c = Math.max(
|
|
482
|
+
const s = i.querySelector(".ng-part-header"), l = i.querySelector(".ng-part-footer");
|
|
483
|
+
s && (r += s.offsetHeight), l && (r += l.offsetHeight);
|
|
484
|
+
const c = Math.max(o - r, 100);
|
|
485
485
|
t(this, j) !== c && (u(this, j, c), t(this, yt).call(this), t(this, T) !== null && t(this, pt).call(this));
|
|
486
486
|
}
|
|
487
487
|
}
|
|
@@ -498,11 +498,11 @@ const fe = class fe {
|
|
|
498
498
|
var a;
|
|
499
499
|
const i = t(this, w).querySelector(e);
|
|
500
500
|
if (!i) return;
|
|
501
|
-
const
|
|
502
|
-
if (!
|
|
503
|
-
const r = Array.from(
|
|
501
|
+
const o = i.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
502
|
+
if (!o) return;
|
|
503
|
+
const r = Array.from(o.querySelectorAll("tr:not(.nodata)")), s = ((a = t(this, W).get(e)) == null ? void 0 : a.length) || 1, c = (t(this, z).data.get() || []).length;
|
|
504
504
|
r.forEach((f, g) => {
|
|
505
|
-
const y = n + Math.floor(g /
|
|
505
|
+
const y = n + Math.floor(g / s);
|
|
506
506
|
if (y >= c) {
|
|
507
507
|
f.style.display = "none";
|
|
508
508
|
return;
|
|
@@ -516,15 +516,15 @@ const fe = class fe {
|
|
|
516
516
|
var c;
|
|
517
517
|
const e = t(this, T);
|
|
518
518
|
if (!e || e <= 0) return;
|
|
519
|
-
const
|
|
519
|
+
const o = (t(this, z).data.get() || []).length, r = Math.max(0, Math.floor(n / e)), s = r * e, l = ((c = t(this, W).get(".ng-container-body")) == null ? void 0 : c.length) || 1;
|
|
520
520
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((a) => {
|
|
521
521
|
const f = t(this, w).querySelector(a);
|
|
522
522
|
if (!f) return;
|
|
523
523
|
const g = f.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
524
524
|
if (!g) return;
|
|
525
|
-
g.style.transform = `translateY(${
|
|
525
|
+
g.style.transform = `translateY(${s}px)`, Array.from(g.querySelectorAll("tr:not(.nodata)")).forEach((b, p) => {
|
|
526
526
|
const v = r + Math.floor(p / l);
|
|
527
|
-
if (v >=
|
|
527
|
+
if (v >= o) {
|
|
528
528
|
b.style.display = "none";
|
|
529
529
|
return;
|
|
530
530
|
}
|
|
@@ -536,23 +536,23 @@ const fe = class fe {
|
|
|
536
536
|
}, 0));
|
|
537
537
|
}, "#handleScroll"));
|
|
538
538
|
d(this, mt, /* @__PURE__ */ h((n, e, i) => {
|
|
539
|
-
n.dataset.row = i, Array.from(n.cells).forEach((
|
|
540
|
-
const
|
|
541
|
-
|
|
539
|
+
n.dataset.row = i, Array.from(n.cells).forEach((o, r) => {
|
|
540
|
+
const s = o.dataset.bind;
|
|
541
|
+
s && e && e[s] !== void 0 ? o.textContent = e[s] : o.textContent = e ? e[Object.keys(e)[r]] ?? `R${i}C${r}` : `행 ${i + 1}`, o.dataset.row = i;
|
|
542
542
|
});
|
|
543
543
|
}, "#bindRowData"));
|
|
544
544
|
d(this, $t, /* @__PURE__ */ h(() => {
|
|
545
545
|
var c, a, f;
|
|
546
546
|
const n = t(this, w).querySelector(".ng-container-left .ng-part-header table"), e = t(this, w).querySelector(".ng-container-body .ng-part-header table"), i = t(this, w).querySelector(".ng-container-right .ng-part-header table");
|
|
547
547
|
if (!e) return;
|
|
548
|
-
const
|
|
548
|
+
const o = n ? Array.from(n.querySelectorAll("tr")) : [], r = Array.from(e.querySelectorAll("tr")), s = i ? Array.from(i.querySelectorAll("tr")) : [], l = Math.max(o.length, r.length, s.length);
|
|
549
549
|
for (let g = 0; g < l; g++) {
|
|
550
550
|
const y = [
|
|
551
|
-
((c =
|
|
551
|
+
((c = o[g]) == null ? void 0 : c.getBoundingClientRect().height) || 0,
|
|
552
552
|
((a = r[g]) == null ? void 0 : a.getBoundingClientRect().height) || 0,
|
|
553
|
-
((f =
|
|
553
|
+
((f = s[g]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
554
554
|
], b = Math.max(...y);
|
|
555
|
-
b > 0 && (
|
|
555
|
+
b > 0 && (o[g] && (o[g].style.height = `${b}px`), r[g] && (r[g].style.height = `${b}px`), s[g] && (s[g].style.height = `${b}px`));
|
|
556
556
|
}
|
|
557
557
|
}, "#syncHeaderHeights"));
|
|
558
558
|
E(this, "destroy", /* @__PURE__ */ h(() => {
|
|
@@ -570,7 +570,7 @@ const fe = class fe {
|
|
|
570
570
|
};
|
|
571
571
|
z = new WeakMap(), w = new WeakMap(), W = new WeakMap(), T = new WeakMap(), P = new WeakMap(), j = new WeakMap(), ut = new WeakMap(), nt = new WeakMap(), kt = new WeakMap(), Lt = new WeakMap(), Ct = new WeakMap(), bt = new WeakMap(), yt = new WeakMap(), Ht = new WeakMap(), Mt = new WeakMap(), pt = new WeakMap(), _t = new WeakMap(), it = new WeakMap(), mt = new WeakMap(), $t = new WeakMap(), h(fe, "RowManager");
|
|
572
572
|
let te = fe;
|
|
573
|
-
var It,
|
|
573
|
+
var It, ot;
|
|
574
574
|
const _ = class _ {
|
|
575
575
|
/**
|
|
576
576
|
* 🎯 레이아웃 내의 여러 rawTables 배열을 일괄로 받아 단일 마스터 템플릿으로 사전 컴파일합니다.
|
|
@@ -582,10 +582,10 @@ const _ = class _ {
|
|
|
582
582
|
* 🎯 단일 원본 테이블을 받아 기본 구조 보정 및 2차원 격자 인덱스 사전 부여 완료된 마스터 테이블 반환
|
|
583
583
|
*/
|
|
584
584
|
static compile(n) {
|
|
585
|
-
var
|
|
585
|
+
var o, r, s, l;
|
|
586
586
|
if (!n) return null;
|
|
587
587
|
const e = n.cloneNode(!0);
|
|
588
|
-
return t(
|
|
588
|
+
return t(o = _, It).call(o, e), t(r = _, ot).call(r, e, "thead"), t(s = _, ot).call(s, e, "tbody"), t(l = _, ot).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((c, a) => {
|
|
589
589
|
const f = c.getAttribute("fixed");
|
|
590
590
|
f && e.querySelectorAll(`thead [data-col="${a}"], tbody [data-col="${a}"], tfoot [data-col="${a}"]`).forEach((g) => {
|
|
591
591
|
g.setAttribute("fixed", f);
|
|
@@ -593,28 +593,28 @@ const _ = class _ {
|
|
|
593
593
|
}), e;
|
|
594
594
|
}
|
|
595
595
|
};
|
|
596
|
-
It = new WeakMap(),
|
|
596
|
+
It = new WeakMap(), ot = new WeakMap(), h(_, "TableCompiler"), d(_, It, /* @__PURE__ */ h((n) => {
|
|
597
597
|
if (!n.querySelector("colgroup")) {
|
|
598
|
-
const e = n.querySelector("tbody tr") || n.querySelector("tr"), i = e ? e.querySelectorAll("th, td").length : 1,
|
|
599
|
-
for (let
|
|
598
|
+
const e = n.querySelector("tbody tr") || n.querySelector("tr"), i = e ? e.querySelectorAll("th, td").length : 1, o = document.createElement("colgroup"), r = Math.max(Math.floor(n.clientWidth / i), 100);
|
|
599
|
+
for (let s = 0; s < i; s++) {
|
|
600
600
|
const l = document.createElement("col");
|
|
601
|
-
l.setAttribute("width", r),
|
|
601
|
+
l.setAttribute("width", r), o.appendChild(l);
|
|
602
602
|
}
|
|
603
|
-
n.prepend(
|
|
603
|
+
n.prepend(o);
|
|
604
604
|
}
|
|
605
605
|
if (!n.querySelector("thead")) {
|
|
606
606
|
const e = document.createElement("thead"), i = n.querySelector("colgroup");
|
|
607
607
|
i ? i.after(e) : n.prepend(e);
|
|
608
608
|
}
|
|
609
609
|
n.classList.add("nine-table-element"), n.style.display = "table";
|
|
610
|
-
}, "#ensureTableStructure")), d(_,
|
|
611
|
-
const i = Array.from(n.querySelectorAll(e + " tr")),
|
|
612
|
-
if (r === 0 ||
|
|
613
|
-
let
|
|
614
|
-
|
|
615
|
-
|
|
610
|
+
}, "#ensureTableStructure")), d(_, ot, /* @__PURE__ */ h((n, e) => {
|
|
611
|
+
const i = Array.from(n.querySelectorAll(e + " tr")), o = Array.from(n.querySelectorAll(e + " th," + e + " td")), r = i.length;
|
|
612
|
+
if (r === 0 || o.length === 0) return;
|
|
613
|
+
let s = 0;
|
|
614
|
+
o.forEach((c) => {
|
|
615
|
+
s += c.colSpan || 1;
|
|
616
616
|
});
|
|
617
|
-
const l = Array.from(Array(r), () => Array(
|
|
617
|
+
const l = Array.from(Array(r), () => Array(s).fill(null));
|
|
618
618
|
i.forEach((c) => {
|
|
619
619
|
const a = c.sectionRowIndex;
|
|
620
620
|
let f = 0;
|
|
@@ -627,7 +627,7 @@ It = new WeakMap(), st = new WeakMap(), h(_, "TableCompiler"), d(_, It, /* @__PU
|
|
|
627
627
|
const y = g.rowSpan || 1, b = g.colSpan || 1;
|
|
628
628
|
for (let p = 0; p < y; p++)
|
|
629
629
|
for (let v = 0; v < b; v++)
|
|
630
|
-
a + p < r && f + v <
|
|
630
|
+
a + p < r && f + v < s && (l[a + p][f + v] = p === 0 && v === 0 ? "1" : "0");
|
|
631
631
|
});
|
|
632
632
|
}), i.forEach((c) => {
|
|
633
633
|
const a = c.sectionRowIndex;
|
|
@@ -641,7 +641,7 @@ It = new WeakMap(), st = new WeakMap(), h(_, "TableCompiler"), d(_, It, /* @__PU
|
|
|
641
641
|
});
|
|
642
642
|
}, "#resetColIndex"));
|
|
643
643
|
let ee = _;
|
|
644
|
-
var Wt, K, Z, Ot, zt,
|
|
644
|
+
var Wt, K, Z, Ot, zt, st, Bt, Nt;
|
|
645
645
|
const ht = class ht extends HTMLElement {
|
|
646
646
|
constructor() {
|
|
647
647
|
super();
|
|
@@ -657,29 +657,29 @@ const ht = class ht extends HTMLElement {
|
|
|
657
657
|
{ selector: ".ng-container-body", type: null },
|
|
658
658
|
{ selector: ".ng-container-left", type: "left" },
|
|
659
659
|
{ selector: ".ng-container-right", type: "right" }
|
|
660
|
-
].forEach(({ selector: i, type:
|
|
660
|
+
].forEach(({ selector: i, type: o }) => {
|
|
661
661
|
const r = this.querySelector(i);
|
|
662
662
|
if (!r) return;
|
|
663
663
|
r.innerHTML = "";
|
|
664
|
-
const
|
|
665
|
-
|
|
664
|
+
const s = document.createElement("div");
|
|
665
|
+
s.className = "ng-part-header", s.appendChild(t(this, st).call(this, t(this, K), o, "header"));
|
|
666
666
|
const l = document.createElement("div");
|
|
667
667
|
l.className = "ng-part-body";
|
|
668
668
|
const c = document.createElement("div");
|
|
669
|
-
c.className = "ng-scroll-content", c.style.position = "relative", c.style.width = "100%", c.appendChild(t(this,
|
|
669
|
+
c.className = "ng-scroll-content", c.style.position = "relative", c.style.width = "100%", c.appendChild(t(this, st).call(this, t(this, K), o, "body"));
|
|
670
670
|
const a = document.createElement("div");
|
|
671
671
|
a.className = "ng-virtual-spacer", a.style.width = "100%", a.style.pointerEvents = "none", c.appendChild(a), l.appendChild(c);
|
|
672
672
|
const f = document.createElement("div");
|
|
673
|
-
f.className = "ng-part-footer", f.appendChild(t(this,
|
|
673
|
+
f.className = "ng-part-footer", f.appendChild(t(this, st).call(this, t(this, K), o, "footer")), r.appendChild(s), r.appendChild(l), r.appendChild(f);
|
|
674
674
|
});
|
|
675
675
|
}, "#renderSplitContainers"));
|
|
676
676
|
d(this, zt, /* @__PURE__ */ h(() => {
|
|
677
677
|
["left", "right", "body"].forEach((e) => {
|
|
678
|
-
const i = this.querySelector(`.ng-container-${e}`),
|
|
679
|
-
if (!i || !
|
|
678
|
+
const i = this.querySelector(`.ng-container-${e}`), o = i == null ? void 0 : i.querySelectorAll("table");
|
|
679
|
+
if (!i || !o || o.length === 0) return;
|
|
680
680
|
let r = 0;
|
|
681
|
-
|
|
682
|
-
const l = parseInt(
|
|
681
|
+
o[0].querySelectorAll("col").forEach((s) => {
|
|
682
|
+
const l = parseInt(s.getAttribute("width"), 10);
|
|
683
683
|
isNaN(r) || (r += l);
|
|
684
684
|
}), e === "body" ? i.style.flex = "1" : (i.style.flex = `0 0 ${r}px`, i.style.width = `${r}px`);
|
|
685
685
|
});
|
|
@@ -690,14 +690,14 @@ const ht = class ht extends HTMLElement {
|
|
|
690
690
|
(i = this.querySelector("nine-table-hscrollbar")) == null || i.refresh();
|
|
691
691
|
}, 0));
|
|
692
692
|
}, "generate"));
|
|
693
|
-
d(this,
|
|
694
|
-
const r = e.cloneNode(!0),
|
|
695
|
-
if (
|
|
693
|
+
d(this, st, /* @__PURE__ */ h((e, i, o) => {
|
|
694
|
+
const r = e.cloneNode(!0), s = r.querySelector("thead"), l = r.querySelector("tbody"), c = r.querySelector("tfoot");
|
|
695
|
+
if (o === "header") {
|
|
696
696
|
if (l && l.remove(), c && c.remove(), e.querySelector("tbody")) {
|
|
697
697
|
const f = document.createElement("tbody");
|
|
698
698
|
f.className = "fixed-tbody", r.appendChild(f);
|
|
699
699
|
}
|
|
700
|
-
} else
|
|
700
|
+
} else o === "body" ? (s && s.remove(), c && c.remove(), l && (l.className = "bindable-tbody")) : o === "footer" && (s && s.remove(), l && l.remove());
|
|
701
701
|
return i === "left" ? r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((a) => {
|
|
702
702
|
a.getAttribute("fixed") !== "left" && a.remove();
|
|
703
703
|
}) : i === "right" ? r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((a) => {
|
|
@@ -787,6 +787,7 @@ const ht = class ht extends HTMLElement {
|
|
|
787
787
|
overflow-x: auto;
|
|
788
788
|
position: relative;
|
|
789
789
|
scrollbar-width: none;
|
|
790
|
+
overscroll-behavior: none; /* 🎯 양끝에 닿았을 때 덜컥거리며 밀리는 바운스 현상 차단 */
|
|
790
791
|
&::-webkit-scrollbar { display: none; height: 0px; }
|
|
791
792
|
}
|
|
792
793
|
|
|
@@ -869,7 +870,7 @@ const ht = class ht extends HTMLElement {
|
|
|
869
870
|
this.innerHTML = "", dt.log("NineTableSheet destroyed.");
|
|
870
871
|
}
|
|
871
872
|
};
|
|
872
|
-
Wt = new WeakMap(), K = new WeakMap(), Z = new WeakMap(), Ot = new WeakMap(), zt = new WeakMap(),
|
|
873
|
+
Wt = new WeakMap(), K = new WeakMap(), Z = new WeakMap(), Ot = new WeakMap(), zt = new WeakMap(), st = new WeakMap(), Bt = new WeakMap(), Nt = new WeakMap(), h(ht, "NineTableSheet"), E(ht, "SCROLLBAR_SIZE", 16);
|
|
873
874
|
let Rt = ht;
|
|
874
875
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", Rt);
|
|
875
876
|
var Pt, xt;
|
|
@@ -879,13 +880,13 @@ const ge = class ge extends HTMLElement {
|
|
|
879
880
|
d(this, Pt, /* @__PURE__ */ h(() => {
|
|
880
881
|
var e;
|
|
881
882
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (i) => {
|
|
882
|
-
var
|
|
883
|
-
const
|
|
884
|
-
t(this, xt).call(this, r,
|
|
883
|
+
var s;
|
|
884
|
+
const o = i.ctrlKey || i.metaKey || i.shiftKey, r = parseInt((s = i.target.closest(".nine-tab-item")) == null ? void 0 : s.dataset.index, 10);
|
|
885
|
+
t(this, xt).call(this, r, o);
|
|
885
886
|
}), t(this, xt).call(this, 0, !1);
|
|
886
887
|
}, "#init"));
|
|
887
888
|
d(this, xt, /* @__PURE__ */ h((e, i = !1) => {
|
|
888
|
-
const
|
|
889
|
+
const o = /* @__PURE__ */ h(() => {
|
|
889
890
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
890
891
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((b) => b.style.setProperty("display", "none"));
|
|
891
892
|
const y = f.filter((b) => b.classList.contains("active"));
|
|
@@ -893,7 +894,7 @@ const ge = class ge extends HTMLElement {
|
|
|
893
894
|
const p = parseInt(b.getAttribute("data-index"), 10), v = this.querySelector(`nine-splitter[data-split-index="${p}"]`), M = f[p + 1];
|
|
894
895
|
v && M && M.classList.contains("active") && v.style.setProperty("display", "flex");
|
|
895
896
|
});
|
|
896
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"),
|
|
897
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), s = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), c = s.querySelectorAll("nine-table-sheet");
|
|
897
898
|
if (!l[e]) return;
|
|
898
899
|
if (!i)
|
|
899
900
|
l.forEach((f, g) => {
|
|
@@ -907,13 +908,13 @@ const ge = class ge extends HTMLElement {
|
|
|
907
908
|
if (f.classList.contains("active") && g.length <= 1)
|
|
908
909
|
return;
|
|
909
910
|
f.classList.toggle("active");
|
|
910
|
-
const y =
|
|
911
|
+
const y = s.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
911
912
|
y && (y.classList.toggle("active"), y.classList.contains("active") || (y.style.flex = ""));
|
|
912
913
|
}
|
|
913
|
-
const a =
|
|
914
|
+
const a = s.querySelectorAll("nine-table-sheet.active");
|
|
914
915
|
a == null || a.forEach((f) => {
|
|
915
916
|
f.style.flex = a.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
916
|
-
}),
|
|
917
|
+
}), o();
|
|
917
918
|
}, "#switchSheet"));
|
|
918
919
|
}
|
|
919
920
|
connectedCallback() {
|
|
@@ -937,14 +938,14 @@ const ue = class ue {
|
|
|
937
938
|
var c, a;
|
|
938
939
|
const n = Array.from(t(this, k).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
939
940
|
if (n.length === 0) return;
|
|
940
|
-
const e = parseInt(t(this, k).getAttribute("max-display-row"), 10) || 10, i = Math.max(...n.map((f) => f.getRowHeight())),
|
|
941
|
+
const e = parseInt(t(this, k).getAttribute("max-display-row"), 10) || 10, i = Math.max(...n.map((f) => f.getRowHeight())), o = (c = t(this, k).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : c.getBoundingClientRect().height, r = (a = t(this, k).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : a.getBoundingClientRect().height, s = Rt.SCROLLBAR_SIZE, l = e * i + o + r + s;
|
|
941
942
|
t(this, k).style.height = `${l}px`;
|
|
942
943
|
}, "#applyAutoHeight"));
|
|
943
944
|
d(this, Yt, /* @__PURE__ */ h(() => {
|
|
944
|
-
const e = Array.from(t(this, k).children).filter((c) => c.tagName === "TABLE"), i = t(this, k).getAttribute("auto-height") === "true",
|
|
945
|
-
const g = `<nine-table-sheet class="${a === 0 ? "active" : ""}" data-index="${a}"></nine-table-sheet>`, y = a <
|
|
945
|
+
const e = Array.from(t(this, k).children).filter((c) => c.tagName === "TABLE"), i = t(this, k).getAttribute("auto-height") === "true", o = e.length, r = e.map((c, a) => {
|
|
946
|
+
const g = `<nine-table-sheet class="${a === 0 ? "active" : ""}" data-index="${a}"></nine-table-sheet>`, y = a < o - 1 ? `<nine-splitter class="h" data-split-index="${a}"></nine-splitter>` : "";
|
|
946
947
|
return g + y;
|
|
947
|
-
}).join(""),
|
|
948
|
+
}).join(""), s = e.map((c, a) => `<div class="nine-tab-item ${a === 0 ? "active" : ""}" data-index="${a}">Sheet ${a + 1}</div>`).join("");
|
|
948
949
|
t(this, k).shadowRoot.innerHTML = `
|
|
949
950
|
<style>
|
|
950
951
|
:host {
|
|
@@ -1028,7 +1029,7 @@ const ue = class ue {
|
|
|
1028
1029
|
<nine-table-sheets>
|
|
1029
1030
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
1030
1031
|
<nine-table-sheets-footer>
|
|
1031
|
-
<div class="nine-tab-bar">${
|
|
1032
|
+
<div class="nine-tab-bar">${s}</div>
|
|
1032
1033
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
1033
1034
|
</nine-table-sheets-footer>
|
|
1034
1035
|
</nine-table-sheets>
|
|
@@ -1065,7 +1066,7 @@ const be = class be {
|
|
|
1065
1066
|
}
|
|
1066
1067
|
};
|
|
1067
1068
|
wt = new WeakMap(), rt = new WeakMap(), h(be, "ngRow");
|
|
1068
|
-
let
|
|
1069
|
+
let oe = be;
|
|
1069
1070
|
var L, A, C, lt, Ft, D, Vt, G, St, Xt, Ut, at;
|
|
1070
1071
|
const H = class H {
|
|
1071
1072
|
constructor(n, e) {
|
|
@@ -1096,10 +1097,10 @@ const H = class H {
|
|
|
1096
1097
|
if (!i || i.length <= 0) return;
|
|
1097
1098
|
if (n == null) return t(this, at).call(this, i);
|
|
1098
1099
|
if (n < 0 || n >= i.length) return null;
|
|
1099
|
-
const
|
|
1100
|
+
const o = typeof ((r = t(this, L).fields) == null ? void 0 : r.get) == "function" ? t(this, L).fields.get() : [];
|
|
1100
1101
|
if (e != null) {
|
|
1101
|
-
const
|
|
1102
|
-
return
|
|
1102
|
+
const s = o.indexOf(e);
|
|
1103
|
+
return s >= 0 ? i[n].v[s] : null;
|
|
1103
1104
|
}
|
|
1104
1105
|
return t(this, at).call(this, i[n]);
|
|
1105
1106
|
}, "get"));
|
|
@@ -1123,14 +1124,14 @@ const H = class H {
|
|
|
1123
1124
|
t(this, A).rawRecords = [], u(this, C, []), u(this, lt, []), (n = t(this, A).viewRecords) != null && n.reset && t(this, A).viewRecords.reset();
|
|
1124
1125
|
}, "clear"));
|
|
1125
1126
|
d(this, Xt, /* @__PURE__ */ h((n) => {
|
|
1126
|
-
var
|
|
1127
|
+
var o;
|
|
1127
1128
|
Array.isArray(n) || (n = [n]);
|
|
1128
|
-
const e = typeof ((
|
|
1129
|
+
const e = typeof ((o = t(this, L).fields) == null ? void 0 : o.get) == "function" ? t(this, L).fields.get() : Object.keys(n[0] || {}), i = [];
|
|
1129
1130
|
return n.forEach((r) => {
|
|
1130
|
-
const
|
|
1131
|
+
const s = { v: [] };
|
|
1131
1132
|
e.forEach((l) => {
|
|
1132
|
-
|
|
1133
|
-
}), i.push(
|
|
1133
|
+
s.v.push(r[l] !== void 0 && r[l] !== null ? r[l] : "");
|
|
1134
|
+
}), i.push(s);
|
|
1134
1135
|
}), i;
|
|
1135
1136
|
}, "#json2Array"));
|
|
1136
1137
|
d(this, Ut, /* @__PURE__ */ h((n) => (Array.isArray(n) || (n = [n]), n.forEach((e) => {
|
|
@@ -1140,19 +1141,19 @@ const H = class H {
|
|
|
1140
1141
|
n === void 0 && (n = {});
|
|
1141
1142
|
const i = t(this, Xt).call(this, n);
|
|
1142
1143
|
t(this, A).rawRecords = t(this, A).rawRecords.concat(t(this, Ut).call(this, i)), this.resetRecords();
|
|
1143
|
-
const
|
|
1144
|
-
return e || i.forEach((r,
|
|
1145
|
-
const l = t(this, A).rawRecords[
|
|
1144
|
+
const o = this.count() - 1;
|
|
1145
|
+
return e || i.forEach((r, s) => {
|
|
1146
|
+
const l = t(this, A).rawRecords[o - s];
|
|
1146
1147
|
l && (l.__ng.rowState = H.ROW_STATE.EMPTY);
|
|
1147
|
-
}), t(this, G).call(this),
|
|
1148
|
+
}), t(this, G).call(this), o;
|
|
1148
1149
|
}, "add"));
|
|
1149
1150
|
E(this, "delete", /* @__PURE__ */ h((n) => {
|
|
1150
1151
|
let e = [];
|
|
1151
|
-
Array.isArray(n) ? e = n : typeof n > "u" ? e = [t(this, A).host.row.at] : e = [parseInt(n, 10)], e.sort((i,
|
|
1152
|
+
Array.isArray(n) ? e = n : typeof n > "u" ? e = [t(this, A).host.row.at] : e = [parseInt(n, 10)], e.sort((i, o) => o - i).forEach((i) => {
|
|
1152
1153
|
if (t(this, C)[i]) {
|
|
1153
|
-
const
|
|
1154
|
-
t(this, C)[i].__ng.rowState === H.ROW_STATE.INSERT ? t(this, A).rawRecords = t(this, A).rawRecords.filter((r) => r.__ng.rowid !==
|
|
1155
|
-
r.__ng.rowid ===
|
|
1154
|
+
const o = t(this, C)[i].__ng.rowid;
|
|
1155
|
+
t(this, C)[i].__ng.rowState === H.ROW_STATE.INSERT ? t(this, A).rawRecords = t(this, A).rawRecords.filter((r) => r.__ng.rowid !== o) : t(this, A).rawRecords.forEach((r) => {
|
|
1156
|
+
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = H.ROW_STATE.DELETE);
|
|
1156
1157
|
});
|
|
1157
1158
|
}
|
|
1158
1159
|
}), this.resetRecords(), t(this, G).call(this);
|
|
@@ -1162,10 +1163,10 @@ const H = class H {
|
|
|
1162
1163
|
n = parseInt(n, 10);
|
|
1163
1164
|
const r = (typeof ((c = t(this, L).fields) == null ? void 0 : c.get) == "function" ? t(this, L).fields.get() : []).indexOf(e);
|
|
1164
1165
|
if (r < 0) return;
|
|
1165
|
-
const
|
|
1166
|
-
if (!
|
|
1167
|
-
const l =
|
|
1168
|
-
l !== i &&
|
|
1166
|
+
const s = this.getValidData()[n];
|
|
1167
|
+
if (!s) return;
|
|
1168
|
+
const l = s.v[r];
|
|
1169
|
+
l !== i && s.__ng.rowState !== H.ROW_STATE.INSERT && (s.__ng.o.hasOwnProperty(e) || (s.__ng.o[e] = l), s.__ng.rowState = H.ROW_STATE.UPDATE), s.v[r] = i;
|
|
1169
1170
|
}, "setValue"));
|
|
1170
1171
|
E(this, "resetRecords", /* @__PURE__ */ h(() => {
|
|
1171
1172
|
u(this, lt, t(this, A).rawRecords.filter((n) => !n.__ng.deleted)), u(this, C, t(this, A).rawRecords.filter((n) => !n.__ng.deleted && !n.__ng.filtered)), t(this, A).rawRecords.forEach((n, e) => {
|
|
@@ -1176,11 +1177,11 @@ const H = class H {
|
|
|
1176
1177
|
}, "resetRecords"));
|
|
1177
1178
|
E(this, "getValidData", /* @__PURE__ */ h(() => (t(this, C).length === 0 && t(this, A).rawRecords.length > 0 && this.resetRecords(), t(this, C)), "getValidData"));
|
|
1178
1179
|
d(this, at, /* @__PURE__ */ h((n) => {
|
|
1179
|
-
var
|
|
1180
|
+
var s;
|
|
1180
1181
|
if (!n) return n;
|
|
1181
|
-
const e = !Array.isArray(n), i = e ? [n] : n,
|
|
1182
|
+
const e = !Array.isArray(n), i = e ? [n] : n, o = typeof ((s = t(this, L).fields) == null ? void 0 : s.get) == "function" ? t(this, L).fields.get() : [], r = i.filter((l) => !l.__ng.deleted).map((l) => {
|
|
1182
1183
|
const c = {};
|
|
1183
|
-
return
|
|
1184
|
+
return o.forEach((a, f) => {
|
|
1184
1185
|
c[a] = l.v ? l.v[f] : l[a];
|
|
1185
1186
|
}), c.__ng = l.__ng, c;
|
|
1186
1187
|
});
|
|
@@ -1213,25 +1214,25 @@ E(H, "ROW_STATE", {
|
|
|
1213
1214
|
UPDATE: "UPDATE",
|
|
1214
1215
|
DELETE: "DELETE"
|
|
1215
1216
|
});
|
|
1216
|
-
let
|
|
1217
|
+
let se = H;
|
|
1217
1218
|
var J;
|
|
1218
1219
|
const ye = class ye {
|
|
1219
1220
|
constructor(n) {
|
|
1220
1221
|
d(this, J);
|
|
1221
|
-
u(this, J, n), this.row = new
|
|
1222
|
+
u(this, J, n), this.row = new oe(this), this.data = new se(t(this, J), this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1222
1223
|
var e;
|
|
1223
1224
|
(e = t(this, J).view) != null && e.redraw && t(this, J).view.redraw();
|
|
1224
1225
|
}, this.setDataSource = (e) => {
|
|
1225
1226
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1226
1227
|
}, this.getRowState = (e) => {
|
|
1227
|
-
var
|
|
1228
|
+
var o, r;
|
|
1228
1229
|
const i = parseInt(e, 10);
|
|
1229
1230
|
if (!(i >= this.data.count()))
|
|
1230
|
-
return (r = (
|
|
1231
|
+
return (r = (o = this.data.getValidData()[i]) == null ? void 0 : o.__ng) == null ? void 0 : r.rowState;
|
|
1231
1232
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (e) => {
|
|
1232
1233
|
this.row.at = e;
|
|
1233
|
-
}, this.scrollTo_V1 = (e) => (e < 0 && (e = 0), e >= this.rawRecords.length && (e = this.rawRecords.length - 1), this.viewRecords.rawIndex = e, this.viewRecords.reset && this.viewRecords.reset(), !(e <= 0 || e >= this.rawRecords.length - 1)), this.getColumn = (e, i) => this.data.get(e, i), this.setColumn = (e, i,
|
|
1234
|
-
e = parseInt(e, 10), this.data.setValue(e, i,
|
|
1234
|
+
}, this.scrollTo_V1 = (e) => (e < 0 && (e = 0), e >= this.rawRecords.length && (e = this.rawRecords.length - 1), this.viewRecords.rawIndex = e, this.viewRecords.reset && this.viewRecords.reset(), !(e <= 0 || e >= this.rawRecords.length - 1)), this.getColumn = (e, i) => this.data.get(e, i), this.setColumn = (e, i, o) => {
|
|
1235
|
+
e = parseInt(e, 10), this.data.setValue(e, i, o);
|
|
1235
1236
|
}, this.setDataSource([]);
|
|
1236
1237
|
}
|
|
1237
1238
|
};
|
|
@@ -1245,7 +1246,7 @@ const pe = class pe {
|
|
|
1245
1246
|
d(this, q, []);
|
|
1246
1247
|
E(this, "add", /* @__PURE__ */ h((n, e = "string") => {
|
|
1247
1248
|
n.forEach((i) => {
|
|
1248
|
-
t(this, q).some((
|
|
1249
|
+
t(this, q).some((o) => o.name === i) || t(this, q).push({ name: i, type: e });
|
|
1249
1250
|
}), t(this, Et).call(this);
|
|
1250
1251
|
}, "add"));
|
|
1251
1252
|
d(this, Et, /* @__PURE__ */ h(() => {
|
|
@@ -1259,26 +1260,26 @@ const pe = class pe {
|
|
|
1259
1260
|
const n = Array.from(t(this, ct).querySelectorAll("table"));
|
|
1260
1261
|
if (!(!n || n.length === 0)) {
|
|
1261
1262
|
for (const e of n)
|
|
1262
|
-
dt.log(e), $("[data-bind]", e).each((i,
|
|
1263
|
-
const r =
|
|
1264
|
-
r && t(this, q).push({ name: r, type:
|
|
1263
|
+
dt.log(e), $("[data-bind]", e).each((i, o) => {
|
|
1264
|
+
const r = o.dataset.bind, s = o.getAttribute("data-type") || "string";
|
|
1265
|
+
r && t(this, q).push({ name: r, type: s });
|
|
1265
1266
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((i) => {
|
|
1266
|
-
$(`[${i}]`, e).each((
|
|
1267
|
-
var
|
|
1268
|
-
if (
|
|
1269
|
-
const l =
|
|
1267
|
+
$(`[${i}]`, e).each((o, r) => {
|
|
1268
|
+
var s = r.getAttribute(i);
|
|
1269
|
+
if (s.indexOf("data.") < 0) {
|
|
1270
|
+
const l = s.search(/[(]/g);
|
|
1270
1271
|
if (l > 0)
|
|
1271
1272
|
try {
|
|
1272
|
-
|
|
1273
|
+
s = String(window[s.substring(0, l).trim()]);
|
|
1273
1274
|
} catch {
|
|
1274
|
-
|
|
1275
|
+
s = "";
|
|
1275
1276
|
}
|
|
1276
1277
|
}
|
|
1277
|
-
|
|
1278
|
+
s.split("data.").forEach((l) => {
|
|
1278
1279
|
if (l.trim() != "") {
|
|
1279
1280
|
const c = l.search(/[^_A-Za-z0-9]/g);
|
|
1280
1281
|
let a = "";
|
|
1281
|
-
c >= 0 ? a = l.substring(0, c) :
|
|
1282
|
+
c >= 0 ? a = l.substring(0, c) : s.startsWith("data.") && (a = l.replace("data.", "")), a && t(this, q).push({ name: a, type: "string" });
|
|
1282
1283
|
}
|
|
1283
1284
|
});
|
|
1284
1285
|
});
|