@ninebone/table 0.0.531 → 0.0.532
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 +369 -367
- 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
|
@@ -2,16 +2,16 @@ var Fe = Object.defineProperty;
|
|
|
2
2
|
var Ve = (R) => {
|
|
3
3
|
throw TypeError(R);
|
|
4
4
|
};
|
|
5
|
-
var Xe = (R,
|
|
6
|
-
var h = (R,
|
|
7
|
-
var A = (R,
|
|
8
|
-
var t = (R,
|
|
9
|
-
var Ue = (R,
|
|
10
|
-
set _(
|
|
11
|
-
y(R,
|
|
5
|
+
var Xe = (R, r, e) => r in R ? Fe(R, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : R[r] = e;
|
|
6
|
+
var h = (R, r) => Fe(R, "name", { value: r, configurable: !0 });
|
|
7
|
+
var A = (R, r, e) => Xe(R, typeof r != "symbol" ? r + "" : r, e), Ye = (R, r, e) => r.has(R) || Ve("Cannot " + e);
|
|
8
|
+
var t = (R, r, e) => (Ye(R, r, "read from private field"), e ? e.call(R) : r.get(R)), d = (R, r, e) => r.has(R) ? Ve("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(R) : r.set(R, e), y = (R, r, e, s) => (Ye(R, r, "write to private field"), s ? s.call(R, e) : r.set(R, e), e);
|
|
9
|
+
var Ue = (R, r, e, s) => ({
|
|
10
|
+
set _(i) {
|
|
11
|
+
y(R, r, i, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return t(R,
|
|
14
|
+
return t(R, r, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
import { trace as Ke } from "@ninebone/util";
|
|
@@ -44,66 +44,66 @@ const Me = class Me extends HTMLElement {
|
|
|
44
44
|
if (!t(this, z) || !t(this, w) || t(this, j)) return;
|
|
45
45
|
const e = t(this, w).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const
|
|
48
|
-
if (o !== 0 &&
|
|
47
|
+
const i = t(this, w).track, n = t(this, w).thumb, a = t(this, z).querySelector(".ng-container-bottom"), o = e.clientWidth, c = s.scrollWidth;
|
|
48
|
+
if (o !== 0 && c > o)
|
|
49
49
|
a && (a.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
a && (a.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const f = Math.max(Math.min(
|
|
54
|
+
const l = i.clientWidth;
|
|
55
|
+
if (l <= 0) return;
|
|
56
|
+
const f = Math.max(Math.min(l * (o / c), l), 20);
|
|
57
57
|
n.style.width = `${f}px`;
|
|
58
|
-
const u = e.scrollLeft,
|
|
59
|
-
let
|
|
60
|
-
|
|
61
|
-
const m =
|
|
62
|
-
|
|
58
|
+
const u = e.scrollLeft, b = c - o;
|
|
59
|
+
let g = 0;
|
|
60
|
+
b > 0 && (g = parseInt(u / b * (l - f), 10)), g < 0 && (g = 0);
|
|
61
|
+
const m = l - f;
|
|
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__ */ h((e) => {
|
|
65
65
|
if (!t(this, w)) return !1;
|
|
66
|
-
const s = t(this, w).container,
|
|
67
|
-
if (!
|
|
66
|
+
const s = t(this, w).container, i = s.querySelector("table");
|
|
67
|
+
if (!i) return !1;
|
|
68
68
|
const n = t(this, w).track.getBoundingClientRect(), a = t(this, w).thumb.clientWidth;
|
|
69
69
|
let o = e;
|
|
70
70
|
o < 0 && (o = 0);
|
|
71
|
-
const
|
|
72
|
-
o >
|
|
73
|
-
const
|
|
74
|
-
return
|
|
71
|
+
const c = n.width - a;
|
|
72
|
+
o > c && (o = c), o = parseInt(o, 10), t(this, w).thumb.style.left = `${o}px`, t(this, w).left.disabled = o === 0, t(this, w).right.disabled = o >= c - 1;
|
|
73
|
+
const l = s.clientWidth, u = i.scrollWidth - l;
|
|
74
|
+
return c > 0 && u > 0 && (s.scrollLeft = o / c * u), o > 0 && o < c - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
d(this, Nt, /* @__PURE__ */ h(() => {
|
|
77
|
-
const e = /* @__PURE__ */ h((
|
|
77
|
+
const e = /* @__PURE__ */ h((i) => {
|
|
78
78
|
clearInterval(t(this, X)), clearInterval(t(this, K));
|
|
79
79
|
const n = parseInt(t(this, w).thumb.style.left || 0, 10);
|
|
80
|
-
t(this, G).call(this, n +
|
|
80
|
+
t(this, G).call(this, n + i), y(this, X, setInterval(() => {
|
|
81
81
|
clearInterval(t(this, X)), y(this, K, setInterval(() => {
|
|
82
82
|
const a = parseInt(t(this, w).thumb.style.left || 0, 10);
|
|
83
|
-
t(this, G).call(this, a +
|
|
83
|
+
t(this, G).call(this, a + i) || clearInterval(t(this, K));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ h(() => {
|
|
87
87
|
clearInterval(t(this, X)), clearInterval(t(this, K));
|
|
88
88
|
}, "clearTimer");
|
|
89
|
-
["mouseup", "mouseleave", "touchend"].forEach((
|
|
90
|
-
t(this, w).left.addEventListener(
|
|
91
|
-
}), t(this, w).left.addEventListener("mousedown", (
|
|
92
|
-
|
|
93
|
-
}), t(this, w).right.addEventListener("mousedown", (
|
|
94
|
-
|
|
95
|
-
}), t(this, w).left.addEventListener("touchstart", () => e(-20)), t(this, w).right.addEventListener("touchstart", () => e(20)), t(this, w).track.addEventListener("mousedown", (
|
|
96
|
-
if (
|
|
97
|
-
|
|
89
|
+
["mouseup", "mouseleave", "touchend"].forEach((i) => {
|
|
90
|
+
t(this, w).left.addEventListener(i, s), t(this, w).right.addEventListener(i, s), t(this, w).track.addEventListener(i, s);
|
|
91
|
+
}), t(this, w).left.addEventListener("mousedown", (i) => {
|
|
92
|
+
i.button === 0 && e(-20);
|
|
93
|
+
}), t(this, w).right.addEventListener("mousedown", (i) => {
|
|
94
|
+
i.button === 0 && e(20);
|
|
95
|
+
}), t(this, w).left.addEventListener("touchstart", () => e(-20)), t(this, w).right.addEventListener("touchstart", () => e(20)), t(this, w).track.addEventListener("mousedown", (i) => {
|
|
96
|
+
if (i.button !== 0) return;
|
|
97
|
+
i.preventDefault();
|
|
98
98
|
const n = t(this, w).track.getBoundingClientRect(), a = t(this, w).thumb.clientWidth;
|
|
99
|
-
t(this, G).call(this,
|
|
100
|
-
}), t(this, w).thumb.addEventListener("mousedown", (
|
|
101
|
-
if (
|
|
102
|
-
|
|
99
|
+
t(this, G).call(this, i.clientX - n.left - a / 2);
|
|
100
|
+
}), t(this, w).thumb.addEventListener("mousedown", (i) => {
|
|
101
|
+
if (i.button !== 0) return;
|
|
102
|
+
i.stopPropagation(), i.preventDefault(), y(this, j, !0), this.shiftX = i.clientX - t(this, w).thumb.getBoundingClientRect().left;
|
|
103
103
|
const n = /* @__PURE__ */ h((o) => {
|
|
104
104
|
if (!t(this, j)) return;
|
|
105
|
-
const
|
|
106
|
-
t(this, G).call(this, o.clientX -
|
|
105
|
+
const c = t(this, w).track.getBoundingClientRect();
|
|
106
|
+
t(this, G).call(this, o.clientX - c.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), a = /* @__PURE__ */ h(() => {
|
|
108
108
|
y(this, j, !1), s(), document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", a), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
@@ -214,21 +214,21 @@ const $e = class $e extends HTMLElement {
|
|
|
214
214
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
215
215
|
if (!t(this, F) || !t(this, q)) return;
|
|
216
216
|
H.log("nine-table-vscrollbar.refresh");
|
|
217
|
-
const e = t(this, q).container, s = t(this, q).track,
|
|
218
|
-
if (
|
|
219
|
-
|
|
217
|
+
const e = t(this, q).container, s = t(this, q).track, i = t(this, q).thumb, n = e.clientHeight, o = (t(this, F).data.get() || []).length, c = t(this, ot).getRowHeight(), l = o * c;
|
|
218
|
+
if (l <= n) {
|
|
219
|
+
i.style.display = "none", t(this, q).top.disabled = !0, t(this, q).bottom.disabled = !0;
|
|
220
220
|
return;
|
|
221
221
|
} else
|
|
222
|
-
|
|
222
|
+
i.style.display = "block";
|
|
223
223
|
const f = s.clientHeight;
|
|
224
224
|
if (f <= 0) return;
|
|
225
|
-
const u = Math.max(Math.min(f * (n /
|
|
226
|
-
|
|
227
|
-
const
|
|
225
|
+
const u = Math.max(Math.min(f * (n / l), f), 20);
|
|
226
|
+
i.style.height = `${u}px`;
|
|
227
|
+
const b = e.scrollTop, g = Math.max(l - n, 1);
|
|
228
228
|
let m = 0;
|
|
229
|
-
|
|
229
|
+
g > 0 && (m = b / g * (f - u));
|
|
230
230
|
const v = f - u;
|
|
231
|
-
m < 0 && (m = 0), m > v && (m = v),
|
|
231
|
+
m < 0 && (m = 0), m > v && (m = v), i.style.top = `${m}px`, t(this, q).top.disabled = b <= 0, t(this, q).bottom.disabled = b >= g - 1;
|
|
232
232
|
}, "refresh"));
|
|
233
233
|
d(this, Wt, /* @__PURE__ */ h(() => {
|
|
234
234
|
H.log("nine-table-vscrollbar.#init");
|
|
@@ -238,16 +238,16 @@ const $e = class $e extends HTMLElement {
|
|
|
238
238
|
}, "getContentHeight");
|
|
239
239
|
e.addEventListener("scroll", () => {
|
|
240
240
|
t(this, J) || this.refresh();
|
|
241
|
-
}), t(this, q).thumb.addEventListener("mousedown", (
|
|
242
|
-
if (
|
|
243
|
-
|
|
241
|
+
}), t(this, q).thumb.addEventListener("mousedown", (i) => {
|
|
242
|
+
if (i.button !== 0) return;
|
|
243
|
+
i.stopPropagation(), i.preventDefault(), y(this, J, !0), y(this, xt, i.clientY), y(this, vt, e.scrollTop);
|
|
244
244
|
const n = /* @__PURE__ */ h((o) => {
|
|
245
245
|
if (!t(this, J)) return;
|
|
246
|
-
const
|
|
246
|
+
const c = t(this, q).track.getBoundingClientRect(), l = t(this, q).thumb.clientHeight, u = c.height - l, b = o.clientY - t(this, xt), g = e.clientHeight, m = s(), v = Math.max(m - g, 1);
|
|
247
247
|
if (u > 0 && v > 0) {
|
|
248
|
-
const E =
|
|
248
|
+
const E = b / u * v;
|
|
249
249
|
let x = t(this, vt) + E;
|
|
250
|
-
const M = Math.max(0, m -
|
|
250
|
+
const M = Math.max(0, m - g);
|
|
251
251
|
x < 0 && (x = 0), x > M && (x = M), e.scrollTop = x;
|
|
252
252
|
}
|
|
253
253
|
this.refresh();
|
|
@@ -255,12 +255,12 @@ const $e = class $e extends HTMLElement {
|
|
|
255
255
|
y(this, J, !1), document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", a), this.refresh();
|
|
256
256
|
}, "onMouseUp");
|
|
257
257
|
document.addEventListener("mousemove", n), document.addEventListener("mouseup", a);
|
|
258
|
-
}), t(this, q).track.addEventListener("mousedown", (
|
|
259
|
-
if (
|
|
260
|
-
const n = t(this, q).track.getBoundingClientRect(), a = t(this, q).thumb.clientHeight, o =
|
|
261
|
-
if (
|
|
262
|
-
const
|
|
263
|
-
e.scrollTop =
|
|
258
|
+
}), t(this, q).track.addEventListener("mousedown", (i) => {
|
|
259
|
+
if (i.button !== 0 || i.target === t(this, q).thumb) return;
|
|
260
|
+
const n = t(this, q).track.getBoundingClientRect(), a = t(this, q).thumb.clientHeight, o = i.clientY - n.top - a / 2, l = n.height - a, f = e.clientHeight, u = s(), b = Math.max(u - f, 1);
|
|
261
|
+
if (l > 0 && b > 0) {
|
|
262
|
+
const g = Math.max(0, Math.min(1, o / l));
|
|
263
|
+
e.scrollTop = g * b;
|
|
264
264
|
}
|
|
265
265
|
this.refresh();
|
|
266
266
|
}), t(this, q).top.addEventListener("click", () => {
|
|
@@ -357,7 +357,7 @@ let ce = $e;
|
|
|
357
357
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", ce);
|
|
358
358
|
var P, S, wt, D, I, V, Q, St, Ee, at, Ot, Bt, zt, Et, At, Dt, Pt, Rt, Ae, lt, qt, jt;
|
|
359
359
|
const Ie = class Ie {
|
|
360
|
-
constructor(
|
|
360
|
+
constructor(r) {
|
|
361
361
|
d(this, P);
|
|
362
362
|
d(this, S);
|
|
363
363
|
d(this, wt);
|
|
@@ -371,172 +371,174 @@ const Ie = class Ie {
|
|
|
371
371
|
d(this, Ot, 3);
|
|
372
372
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
373
373
|
H.log("rowManager.refresh");
|
|
374
|
-
const
|
|
375
|
-
|
|
374
|
+
const r = t(this, S).querySelector(".ng-container-body .ng-part-body");
|
|
375
|
+
r && (t(this, Et).call(this), t(this, lt).call(this, r.scrollTop));
|
|
376
376
|
}, "refresh"));
|
|
377
377
|
A(this, "initialize", /* @__PURE__ */ h(() => {
|
|
378
|
-
H.log("rowManager.initialize")
|
|
378
|
+
H.log("rowManager.initialize");
|
|
379
|
+
const r = t(this, S).querySelector(".ng-container-body"), e = r == null ? void 0 : r.querySelector(".ng-part-body tbody.bindable-tbody tr:not(.nodata)");
|
|
380
|
+
H.log(e), y(this, wt, {
|
|
379
381
|
scrollTables: t(this, S).querySelectorAll(".ng-part-body table")
|
|
380
|
-
}), y(this, I, null), t(this, D).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
381
|
-
const
|
|
382
|
-
if (!o) return;
|
|
383
|
-
const l = o.querySelector(".ng-part-body table");
|
|
382
|
+
}), y(this, I, null), t(this, D).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((c) => {
|
|
383
|
+
const l = t(this, S).querySelector(c);
|
|
384
384
|
if (!l) return;
|
|
385
|
-
const
|
|
386
|
-
if (!
|
|
387
|
-
const u =
|
|
388
|
-
|
|
385
|
+
const f = l.querySelector(".ng-part-body table");
|
|
386
|
+
if (!f) return;
|
|
387
|
+
const u = f.querySelector("tbody.bindable-tbody");
|
|
388
|
+
if (!u) return;
|
|
389
|
+
const g = Array.from(u.querySelectorAll("tr")).map((m) => m.cloneNode(!0));
|
|
390
|
+
t(this, D).set(c, g);
|
|
389
391
|
});
|
|
390
|
-
const
|
|
391
|
-
if (
|
|
392
|
-
t(this, zt).call(this,
|
|
393
|
-
let
|
|
394
|
-
const
|
|
395
|
-
var
|
|
396
|
-
|
|
392
|
+
const s = t(this, S).querySelector(".ng-container-body .ng-part-body"), i = t(this, S).querySelector(".ng-container-left .ng-part-body"), n = t(this, S).querySelector(".ng-container-right .ng-part-body"), a = t(this, S).querySelector(".ng-container-body .ng-part-header"), o = t(this, S).querySelector(".ng-container-body .ng-part-footer");
|
|
393
|
+
if (s) {
|
|
394
|
+
t(this, zt).call(this, s), t(this, Rt).call(this), t(this, Et).call(this), t(this, lt).call(this, s.scrollTop);
|
|
395
|
+
let c = !1;
|
|
396
|
+
const l = /* @__PURE__ */ h((f, u, b) => {
|
|
397
|
+
var g;
|
|
398
|
+
c || (c = !0, s && s.scrollTop !== f && (s.scrollTop = f), i && i.scrollTop !== f && (i.scrollTop = f), n && n.scrollTop !== f && (n.scrollTop = f), a && a.scrollLeft !== u && (a.scrollLeft = u), o && o.scrollLeft !== u && (o.scrollLeft = u), t(this, lt).call(this, f), (g = t(this, S).querySelector("nine-table-vscrollbar")) == null || g.refresh(), c = !1);
|
|
397
399
|
}, "syncScroll");
|
|
398
|
-
[
|
|
399
|
-
|
|
400
|
+
[s, i, n].forEach((f) => {
|
|
401
|
+
f && f.addEventListener("scroll", () => {
|
|
400
402
|
t(this, at) || (y(this, at, !0), requestAnimationFrame(() => {
|
|
401
|
-
|
|
403
|
+
l(f.scrollTop, f.scrollLeft), y(this, at, !1);
|
|
402
404
|
}));
|
|
403
405
|
});
|
|
404
406
|
});
|
|
405
407
|
}
|
|
406
408
|
}, "initialize"));
|
|
407
|
-
d(this, Bt, /* @__PURE__ */ h((
|
|
409
|
+
d(this, Bt, /* @__PURE__ */ h((r, e) => {
|
|
408
410
|
H.log("rowManager.#renderRows");
|
|
409
411
|
const s = t(this, D).get(e);
|
|
410
412
|
if (!s || s.length === 0) return;
|
|
411
|
-
const
|
|
412
|
-
if (!
|
|
413
|
-
|
|
414
|
-
const n =
|
|
413
|
+
const i = r.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
414
|
+
if (!i) return;
|
|
415
|
+
i.querySelectorAll("tr:not(.nodata)").forEach((o) => o.remove());
|
|
416
|
+
const n = i.querySelector("tr.nodata"), a = document.createDocumentFragment();
|
|
415
417
|
for (let o = 0; o < t(this, St); o++)
|
|
416
|
-
s.forEach((
|
|
417
|
-
a.appendChild(
|
|
418
|
+
s.forEach((c) => {
|
|
419
|
+
a.appendChild(c.cloneNode(!0));
|
|
418
420
|
});
|
|
419
|
-
n ? n.before(a) :
|
|
421
|
+
n ? n.before(a) : i.appendChild(a);
|
|
420
422
|
}, "#renderRows"));
|
|
421
|
-
d(this, zt, /* @__PURE__ */ h((
|
|
423
|
+
d(this, zt, /* @__PURE__ */ h((r) => {
|
|
422
424
|
if (H.log("rowManager.#measureAndCacheHeight"), t(this, I) !== null && t(this, I) > 0)
|
|
423
425
|
return t(this, I);
|
|
424
426
|
H.log("#measureAndCacheHeight");
|
|
425
427
|
const e = t(this, D).get(".ng-container-body");
|
|
426
428
|
if (!e || e.length === 0) return 24;
|
|
427
|
-
const s =
|
|
429
|
+
const s = r.querySelector("tbody.bindable-tbody");
|
|
428
430
|
if (!s) return 24;
|
|
429
|
-
s.querySelectorAll("tr:not(.nodata)").forEach((
|
|
430
|
-
const
|
|
431
|
-
e.forEach((
|
|
432
|
-
n.appendChild(
|
|
433
|
-
}),
|
|
434
|
-
const a = t(this, S), o = a.style.display,
|
|
431
|
+
s.querySelectorAll("tr:not(.nodata)").forEach((b) => b.remove());
|
|
432
|
+
const i = s.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
433
|
+
e.forEach((b) => {
|
|
434
|
+
n.appendChild(b.cloneNode(!0));
|
|
435
|
+
}), i ? i.before(n) : s.appendChild(n);
|
|
436
|
+
const a = t(this, S), o = a.style.display, c = a.style.visibility, l = a.style.position;
|
|
435
437
|
(o === "none" || window.getComputedStyle(a).display === "none") && (a.style.display = "block", a.style.visibility = "hidden", a.style.position = "absolute");
|
|
436
438
|
let f = 0;
|
|
437
439
|
const u = s.querySelectorAll("tr:not(.nodata)");
|
|
438
|
-
return u.forEach((
|
|
439
|
-
f +=
|
|
440
|
-
}), u.forEach((
|
|
440
|
+
return u.forEach((b) => {
|
|
441
|
+
f += b.offsetHeight || b.getBoundingClientRect().height;
|
|
442
|
+
}), u.forEach((b) => b.remove()), a.style.display = o, a.style.visibility = c, a.style.position = l, y(this, I, f > 0 ? f : 24), t(this, At).call(this), t(this, I);
|
|
441
443
|
}, "#measureAndCacheHeight"));
|
|
442
444
|
d(this, Et, /* @__PURE__ */ h(() => {
|
|
443
445
|
H.log("rowManager.#updateVirtualScrollHeight");
|
|
444
|
-
const e = (t(this, P).data.get() || []).length, s = t(this, I),
|
|
446
|
+
const e = (t(this, P).data.get() || []).length, s = t(this, I), i = e * s;
|
|
445
447
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
446
448
|
const a = t(this, S).querySelector(n);
|
|
447
449
|
if (!a) return;
|
|
448
450
|
const o = a.querySelector(".ng-part-body .ng-virtual-spacer");
|
|
449
|
-
o && (o.style.height = `${
|
|
451
|
+
o && (o.style.height = `${i}px`);
|
|
450
452
|
});
|
|
451
453
|
}, "#updateVirtualScrollHeight"));
|
|
452
454
|
d(this, At, /* @__PURE__ */ h(() => {
|
|
453
455
|
if (t(this, Q) > 0 && t(this, I) > 0) {
|
|
454
|
-
const
|
|
455
|
-
y(this, St,
|
|
456
|
+
const r = Math.ceil(t(this, Q) / t(this, I));
|
|
457
|
+
y(this, St, r + t(this, Ot));
|
|
456
458
|
}
|
|
457
459
|
}, "#updateRowCount"));
|
|
458
460
|
d(this, Dt, /* @__PURE__ */ h(() => {
|
|
459
|
-
var o,
|
|
460
|
-
const
|
|
461
|
+
var o, c, l, f, u, b;
|
|
462
|
+
const r = t(this, S).querySelector(".ng-container-left .ng-part-body table"), e = t(this, S).querySelector(".ng-container-body .ng-part-body table"), s = t(this, S).querySelector(".ng-container-right .ng-part-body table");
|
|
461
463
|
if (e) {
|
|
462
|
-
const
|
|
464
|
+
const g = r ? Array.from(r.querySelectorAll("tbody tr")) : [], m = Array.from(e.querySelectorAll("tbody tr")), v = s ? Array.from(s.querySelectorAll("tbody tr")) : [], E = Math.max(g.length, m.length, v.length);
|
|
463
465
|
for (let x = 0; x < E; x++) {
|
|
464
466
|
const M = [
|
|
465
|
-
((o =
|
|
466
|
-
((
|
|
467
|
-
((
|
|
467
|
+
((o = g[x]) == null ? void 0 : o.getBoundingClientRect().height) || 0,
|
|
468
|
+
((c = m[x]) == null ? void 0 : c.getBoundingClientRect().height) || 0,
|
|
469
|
+
((l = v[x]) == null ? void 0 : l.getBoundingClientRect().height) || 0
|
|
468
470
|
], k = Math.max(...M);
|
|
469
|
-
k > 0 && (
|
|
471
|
+
k > 0 && (g[x] && (g[x].style.height = `${k}px`), m[x] && (m[x].style.height = `${k}px`), v[x] && (v[x].style.height = `${k}px`));
|
|
470
472
|
}
|
|
471
473
|
}
|
|
472
|
-
const
|
|
474
|
+
const i = t(this, S).querySelector(".ng-container-left .ng-part-footer table"), n = t(this, S).querySelector(".ng-container-body .ng-part-footer table"), a = t(this, S).querySelector(".ng-container-right .ng-part-footer table");
|
|
473
475
|
if (n) {
|
|
474
|
-
const
|
|
476
|
+
const g = i ? Array.from(i.querySelectorAll("tfoot tr")) : [], m = Array.from(n.querySelectorAll("tfoot tr")), v = a ? Array.from(a.querySelectorAll("tfoot tr")) : [], E = Math.max(g.length, m.length, v.length);
|
|
475
477
|
for (let x = 0; x < E; x++) {
|
|
476
478
|
const M = [
|
|
477
|
-
((f =
|
|
479
|
+
((f = g[x]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
478
480
|
((u = m[x]) == null ? void 0 : u.getBoundingClientRect().height) || 0,
|
|
479
|
-
((
|
|
481
|
+
((b = v[x]) == null ? void 0 : b.getBoundingClientRect().height) || 0
|
|
480
482
|
], k = Math.max(...M);
|
|
481
|
-
k > 0 && (
|
|
483
|
+
k > 0 && (g[x] && (g[x].style.height = `${k}px`), m[x] && (m[x].style.height = `${k}px`), v[x] && (v[x].style.height = `${k}px`));
|
|
482
484
|
}
|
|
483
485
|
}
|
|
484
486
|
}, "#syncRowHeights"));
|
|
485
487
|
d(this, Pt, /* @__PURE__ */ h(() => {
|
|
486
|
-
!t(this, S) || !(t(this, S) instanceof HTMLElement) || (y(this, V, new ResizeObserver((
|
|
487
|
-
for (const e of
|
|
488
|
+
!t(this, S) || !(t(this, S) instanceof HTMLElement) || (y(this, V, new ResizeObserver((r) => {
|
|
489
|
+
for (const e of r) {
|
|
488
490
|
const s = e.target;
|
|
489
491
|
if (!s.classList.contains("active")) continue;
|
|
490
|
-
const
|
|
491
|
-
if (
|
|
492
|
+
const i = e.contentRect.height;
|
|
493
|
+
if (i > 0) {
|
|
492
494
|
let n = 0;
|
|
493
495
|
const a = s.querySelector(".ng-part-header"), o = s.querySelector(".ng-part-footer");
|
|
494
496
|
a && (n += a.offsetHeight), o && (n += o.offsetHeight);
|
|
495
|
-
const
|
|
496
|
-
t(this, Q) !==
|
|
497
|
+
const c = Math.max(i - n, 100);
|
|
498
|
+
t(this, Q) !== c && (y(this, Q, c), t(this, At).call(this), t(this, I) !== null && (t(this, Rt).call(this), this.refresh()));
|
|
497
499
|
}
|
|
498
500
|
}
|
|
499
501
|
})), t(this, V).observe(t(this, S)));
|
|
500
502
|
}, "#initResizeObserver"));
|
|
501
503
|
d(this, Rt, /* @__PURE__ */ h(() => {
|
|
502
|
-
H.log("rowManager.#renderAllContainers"), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
503
|
-
const e = t(this, S).querySelector(
|
|
504
|
-
e && e.querySelector(".ng-part-body tbody.bindable-tbody") && t(this, Bt).call(this, e,
|
|
504
|
+
H.log("rowManager.#renderAllContainers"), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((r) => {
|
|
505
|
+
const e = t(this, S).querySelector(r);
|
|
506
|
+
e && e.querySelector(".ng-part-body tbody.bindable-tbody") && t(this, Bt).call(this, e, r);
|
|
505
507
|
}), t(this, jt).call(this), t(this, Dt).call(this);
|
|
506
508
|
}, "#renderAllContainers"));
|
|
507
|
-
d(this, Ae, /* @__PURE__ */ h((
|
|
509
|
+
d(this, Ae, /* @__PURE__ */ h((r) => {
|
|
508
510
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
509
|
-
var
|
|
511
|
+
var l;
|
|
510
512
|
const s = t(this, S).querySelector(e);
|
|
511
513
|
if (!s) return;
|
|
512
|
-
const
|
|
513
|
-
if (!
|
|
514
|
-
const n = Array.from(
|
|
514
|
+
const i = s.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
515
|
+
if (!i) return;
|
|
516
|
+
const n = Array.from(i.querySelectorAll("tr:not(.nodata)")), a = ((l = t(this, D).get(e)) == null ? void 0 : l.length) || 1, c = (t(this, P).data.get() || []).length;
|
|
515
517
|
n.forEach((f, u) => {
|
|
516
|
-
const
|
|
517
|
-
if (
|
|
518
|
+
const b = r + Math.floor(u / a);
|
|
519
|
+
if (b >= c) {
|
|
518
520
|
f.style.display = "none";
|
|
519
521
|
return;
|
|
520
522
|
}
|
|
521
|
-
const
|
|
522
|
-
f.style.display = "", t(this, qt).call(this, f,
|
|
523
|
+
const g = t(this, P).data.get(b);
|
|
524
|
+
f.style.display = "", t(this, qt).call(this, f, g, b);
|
|
523
525
|
});
|
|
524
526
|
});
|
|
525
527
|
}, "#adjustBufferRows"));
|
|
526
|
-
d(this, lt, /* @__PURE__ */ h((
|
|
528
|
+
d(this, lt, /* @__PURE__ */ h((r) => {
|
|
527
529
|
var f, u;
|
|
528
530
|
const e = t(this, I);
|
|
529
531
|
if (!e || e <= 0) return;
|
|
530
|
-
const s = t(this, P).data.length,
|
|
531
|
-
(u = t(this, wt)) == null || u.scrollTables.forEach((
|
|
532
|
-
|
|
533
|
-
}),
|
|
534
|
-
const
|
|
535
|
-
if (!
|
|
536
|
-
const m =
|
|
532
|
+
const s = t(this, P).data.length, i = Math.max(0, Math.floor(r / e)), n = i * e, a = ((f = t(this, D).get(".ng-container-body")) == null ? void 0 : f.length) || 1, o = t(this, S).querySelector(".ng-container-body"), c = o == null ? void 0 : o.querySelector(".ng-part-body tbody.bindable-tbody tr:not(.nodata)"), l = c && c.dataset.row !== void 0 ? parseInt(c.dataset.row, 10) : -1;
|
|
533
|
+
(u = t(this, wt)) == null || u.scrollTables.forEach((b) => {
|
|
534
|
+
b.style.transform = `translateY(${n}px)`;
|
|
535
|
+
}), l !== i && [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((b) => {
|
|
536
|
+
const g = t(this, S).querySelector(b);
|
|
537
|
+
if (!g) return;
|
|
538
|
+
const m = g.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
537
539
|
if (!m) return;
|
|
538
540
|
Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((E, x) => {
|
|
539
|
-
const M =
|
|
541
|
+
const M = i + Math.floor(x / a);
|
|
540
542
|
if (M >= s) {
|
|
541
543
|
E.style.display = "none";
|
|
542
544
|
return;
|
|
@@ -560,39 +562,39 @@ const Ie = class Ie {
|
|
|
560
562
|
cell.dataset.row = dataIndex;
|
|
561
563
|
});
|
|
562
564
|
}; */
|
|
563
|
-
d(this, qt, /* @__PURE__ */ h((
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
const a = Array.from(
|
|
565
|
+
d(this, qt, /* @__PURE__ */ h((r, e, s) => {
|
|
566
|
+
r.dataset.row = s, r.data = e, Array.from(r.cells).forEach((i, n) => {
|
|
567
|
+
i.dataset.row = s;
|
|
568
|
+
const a = Array.from(i.children).find((o) => o.tagName.toLowerCase().startsWith("cell-") || typeof o.refresh == "function");
|
|
567
569
|
a && typeof a.refresh == "function" && a.refresh();
|
|
568
570
|
});
|
|
569
571
|
}, "#bindRowData"));
|
|
570
572
|
d(this, jt, /* @__PURE__ */ h(() => {
|
|
571
|
-
var
|
|
573
|
+
var c, l, f;
|
|
572
574
|
H.log("rowManager.#syncHeaderHeights");
|
|
573
|
-
const
|
|
575
|
+
const r = t(this, S).querySelector(".ng-container-left .ng-part-header table"), e = t(this, S).querySelector(".ng-container-body .ng-part-header table"), s = t(this, S).querySelector(".ng-container-right .ng-part-header table");
|
|
574
576
|
if (!e) return;
|
|
575
|
-
const
|
|
577
|
+
const i = r ? Array.from(r.querySelectorAll("tr")) : [], n = Array.from(e.querySelectorAll("tr")), a = s ? Array.from(s.querySelectorAll("tr")) : [], o = Math.max(i.length, n.length, a.length);
|
|
576
578
|
for (let u = 0; u < o; u++) {
|
|
577
|
-
const
|
|
578
|
-
((
|
|
579
|
-
((
|
|
579
|
+
const b = [
|
|
580
|
+
((c = i[u]) == null ? void 0 : c.getBoundingClientRect().height) || 0,
|
|
581
|
+
((l = n[u]) == null ? void 0 : l.getBoundingClientRect().height) || 0,
|
|
580
582
|
((f = a[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
581
|
-
],
|
|
582
|
-
|
|
583
|
+
], g = Math.max(...b);
|
|
584
|
+
g > 0 && (i[u] && (i[u].style.height = `${g}px`), n[u] && (n[u].style.height = `${g}px`), a[u] && (a[u].style.height = `${g}px`));
|
|
583
585
|
}
|
|
584
586
|
}, "#syncHeaderHeights"));
|
|
585
587
|
A(this, "destroy", /* @__PURE__ */ h(() => {
|
|
586
588
|
t(this, V) && (t(this, V).disconnect(), y(this, V, null));
|
|
587
589
|
}, "destroy"));
|
|
588
|
-
y(this, P,
|
|
590
|
+
y(this, P, r.getRootNode().host), y(this, S, r), t(this, Pt).call(this);
|
|
589
591
|
}
|
|
590
592
|
getRowHeight() {
|
|
591
593
|
return t(this, I);
|
|
592
594
|
}
|
|
593
|
-
templateLength(
|
|
595
|
+
templateLength(r = ".ng-container-body") {
|
|
594
596
|
var e;
|
|
595
|
-
return ((e = t(this, D).get(
|
|
597
|
+
return ((e = t(this, D).get(r)) == null ? void 0 : e.length) || 1;
|
|
596
598
|
}
|
|
597
599
|
};
|
|
598
600
|
P = new WeakMap(), S = new WeakMap(), wt = new WeakMap(), D = new WeakMap(), I = new WeakMap(), V = new WeakMap(), Q = new WeakMap(), St = new WeakMap(), Ee = new WeakMap(), at = new WeakMap(), Ot = new WeakMap(), Bt = new WeakMap(), zt = new WeakMap(), Et = new WeakMap(), At = new WeakMap(), Dt = new WeakMap(), Pt = new WeakMap(), Rt = new WeakMap(), Ae = new WeakMap(), lt = new WeakMap(), qt = new WeakMap(), jt = new WeakMap(), h(Ie, "RowManager");
|
|
@@ -601,74 +603,74 @@ const Ft = class Ft {
|
|
|
601
603
|
/**
|
|
602
604
|
* 🎯 레이아웃 내의 여러 rawTables 배열을 일괄로 받아 단일 마스터 템플릿으로 사전 컴파일합니다.
|
|
603
605
|
*/
|
|
604
|
-
static compileAll(
|
|
605
|
-
return Array.isArray(
|
|
606
|
+
static compileAll(r) {
|
|
607
|
+
return Array.isArray(r) ? r.map((e) => Ft.compile(e)) : [];
|
|
606
608
|
}
|
|
607
609
|
/**
|
|
608
610
|
* 🎯 단일 원본 테이블을 받아 기본 구조 보정 및 2차원 격자 인덱스 사전 부여 완료된 마스터 테이블 반환
|
|
609
611
|
*/
|
|
610
|
-
static compile(
|
|
611
|
-
if (!
|
|
612
|
+
static compile(r) {
|
|
613
|
+
if (!r) return null;
|
|
612
614
|
const e = /* @__PURE__ */ h((o) => {
|
|
613
|
-
o.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach((
|
|
614
|
-
const f =
|
|
615
|
-
if (
|
|
615
|
+
o.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach((l) => {
|
|
616
|
+
const f = l.getAttribute("cell-type") || "renderer";
|
|
617
|
+
if (l.children.length > 0 && l.firstElementChild.tagName.includes("-")) return;
|
|
616
618
|
let u = `cell-${f}`;
|
|
617
|
-
const
|
|
619
|
+
const b = l.getAttribute("data-bind"), g = l.getAttribute("data-expr"), m = l.getAttribute("maxbyte"), v = l.getAttribute("type");
|
|
618
620
|
let E = [];
|
|
619
|
-
|
|
621
|
+
b && E.push(`data-bind="${b}"`), g && E.push(`data-expr="${g}"`), m && E.push(`maxbyte="${m}"`), v && E.push(`type="${v}"`), l.innerHTML = `<${u} ${E.join(" ")}></${u}>`;
|
|
620
622
|
});
|
|
621
623
|
}, "processCellTypes"), s = /* @__PURE__ */ h((o) => {
|
|
622
624
|
if (!o.querySelector("colgroup")) {
|
|
623
|
-
const
|
|
624
|
-
for (let
|
|
625
|
-
const
|
|
626
|
-
|
|
625
|
+
const c = o.querySelector("tbody tr") || o.querySelector("tr"), l = c ? c.querySelectorAll("th, td").length : 1, f = document.createElement("colgroup"), u = Math.max(Math.floor(o.clientWidth / l), 100);
|
|
626
|
+
for (let b = 0; b < l; b++) {
|
|
627
|
+
const g = document.createElement("col");
|
|
628
|
+
g.setAttribute("width", u), f.appendChild(g);
|
|
627
629
|
}
|
|
628
630
|
o.prepend(f);
|
|
629
631
|
}
|
|
630
632
|
if (!o.querySelector("thead")) {
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
+
const c = document.createElement("thead"), l = o.querySelector("colgroup");
|
|
634
|
+
l ? l.after(c) : o.prepend(c);
|
|
633
635
|
}
|
|
634
636
|
o.classList.add("nine-table-element"), o.style.display = "table";
|
|
635
|
-
}, "ensureTableStructure"),
|
|
636
|
-
const
|
|
637
|
+
}, "ensureTableStructure"), i = /* @__PURE__ */ h((o, c) => {
|
|
638
|
+
const l = Array.from(o.querySelectorAll(c + " tr")), f = Array.from(o.querySelectorAll(c + " th," + c + " td")), u = l.length;
|
|
637
639
|
if (u === 0 || f.length === 0) return;
|
|
638
|
-
let
|
|
640
|
+
let b = 0;
|
|
639
641
|
f.forEach((m) => {
|
|
640
|
-
|
|
642
|
+
b += m.colSpan || 1;
|
|
641
643
|
});
|
|
642
|
-
const
|
|
643
|
-
|
|
644
|
+
const g = Array.from(Array(u), () => Array(b).fill(null));
|
|
645
|
+
l.forEach((m) => {
|
|
644
646
|
const v = m.sectionRowIndex;
|
|
645
647
|
let E = 0;
|
|
646
648
|
Array.from(m.querySelectorAll("th,td")).forEach((x) => {
|
|
647
|
-
for (let B = 0; B <
|
|
648
|
-
if (
|
|
649
|
+
for (let B = 0; B < g[v].length; B++)
|
|
650
|
+
if (g[v][B] === null) {
|
|
649
651
|
E = B;
|
|
650
652
|
break;
|
|
651
653
|
}
|
|
652
654
|
const M = x.rowSpan || 1, k = x.colSpan || 1;
|
|
653
655
|
for (let B = 0; B < M; B++)
|
|
654
656
|
for (let yt = 0; yt < k; yt++)
|
|
655
|
-
v + B < u && E + yt <
|
|
657
|
+
v + B < u && E + yt < b && (g[v + B][E + yt] = B === 0 && yt === 0 ? "1" : "0");
|
|
656
658
|
});
|
|
657
|
-
}),
|
|
659
|
+
}), l.forEach((m) => {
|
|
658
660
|
const v = m.sectionRowIndex;
|
|
659
661
|
Array.from(m.querySelectorAll("th,td")).forEach((E) => {
|
|
660
|
-
for (let x = 0; x <
|
|
661
|
-
if (
|
|
662
|
-
E.dataset.col = x,
|
|
662
|
+
for (let x = 0; x < g[v].length; x++)
|
|
663
|
+
if (g[v][x] === "1") {
|
|
664
|
+
E.dataset.col = x, g[v][x] = "0";
|
|
663
665
|
break;
|
|
664
666
|
}
|
|
665
667
|
});
|
|
666
668
|
});
|
|
667
|
-
}, "resetColIndex"), n =
|
|
668
|
-
return s(n), e(n),
|
|
669
|
-
const
|
|
670
|
-
|
|
671
|
-
f.setAttribute("fixed",
|
|
669
|
+
}, "resetColIndex"), n = r.cloneNode(!0);
|
|
670
|
+
return s(n), e(n), i(n, "thead"), i(n, "tbody"), i(n, "tfoot"), Array.from(n.querySelectorAll("colgroup col")).forEach((o, c) => {
|
|
671
|
+
const l = o.getAttribute("fixed");
|
|
672
|
+
l && n.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach((f) => {
|
|
673
|
+
f.setAttribute("fixed", l);
|
|
672
674
|
});
|
|
673
675
|
}), n;
|
|
674
676
|
}
|
|
@@ -691,28 +693,28 @@ const pt = class pt extends HTMLElement {
|
|
|
691
693
|
{ selector: ".ng-container-body", type: null },
|
|
692
694
|
{ selector: ".ng-container-left", type: "left" },
|
|
693
695
|
{ selector: ".ng-container-right", type: "right" }
|
|
694
|
-
].forEach(({ selector: s, type:
|
|
696
|
+
].forEach(({ selector: s, type: i }) => {
|
|
695
697
|
const n = this.querySelector(s);
|
|
696
698
|
if (!n) return;
|
|
697
699
|
n.innerHTML = "";
|
|
698
700
|
const a = document.createElement("div");
|
|
699
|
-
a.className = "ng-part-header", a.appendChild(t(this, ct).call(this, t(this, tt),
|
|
701
|
+
a.className = "ng-part-header", a.appendChild(t(this, ct).call(this, t(this, tt), i, "header"));
|
|
700
702
|
const o = document.createElement("div");
|
|
701
703
|
o.className = "ng-part-body";
|
|
702
|
-
const l = document.createElement("div");
|
|
703
|
-
l.className = "ng-scroll-content", l.style.position = "relative", l.style.width = "100%", l.appendChild(t(this, ct).call(this, t(this, tt), r, "body"));
|
|
704
704
|
const c = document.createElement("div");
|
|
705
|
-
c.className = "ng-
|
|
705
|
+
c.className = "ng-scroll-content", c.style.position = "relative", c.style.width = "100%", c.appendChild(t(this, ct).call(this, t(this, tt), i, "body"));
|
|
706
|
+
const l = document.createElement("div");
|
|
707
|
+
l.className = "ng-virtual-spacer", l.style.width = "100%", l.style.pointerEvents = "none", c.appendChild(l), o.appendChild(c);
|
|
706
708
|
const f = document.createElement("div");
|
|
707
|
-
f.className = "ng-part-footer", f.appendChild(t(this, ct).call(this, t(this, tt),
|
|
709
|
+
f.className = "ng-part-footer", f.appendChild(t(this, ct).call(this, t(this, tt), i, "footer")), n.appendChild(a), n.appendChild(o), n.appendChild(f);
|
|
708
710
|
});
|
|
709
711
|
}, "#renderSplitContainers"));
|
|
710
712
|
d(this, Ut, /* @__PURE__ */ h(() => {
|
|
711
713
|
["left", "right", "body"].forEach((e) => {
|
|
712
|
-
const s = this.querySelector(`.ng-container-${e}`),
|
|
713
|
-
if (!s || !
|
|
714
|
+
const s = this.querySelector(`.ng-container-${e}`), i = s == null ? void 0 : s.querySelectorAll("table");
|
|
715
|
+
if (!s || !i || i.length === 0) return;
|
|
714
716
|
let n = 0;
|
|
715
|
-
|
|
717
|
+
i[0].querySelectorAll("col").forEach((a) => {
|
|
716
718
|
const o = parseInt(a.getAttribute("width"), 10);
|
|
717
719
|
isNaN(n) || (n += o);
|
|
718
720
|
}), e === "body" ? s.style.flex = "1" : (s.style.flex = `0 0 ${n}px`, s.style.width = `${n}px`);
|
|
@@ -724,20 +726,20 @@ const pt = class pt extends HTMLElement {
|
|
|
724
726
|
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
725
727
|
}, 0));
|
|
726
728
|
}, "generate"));
|
|
727
|
-
d(this, ct, /* @__PURE__ */ h((e, s,
|
|
728
|
-
const n = e.cloneNode(!0), a = n.querySelector("thead"), o = n.querySelector("tbody"),
|
|
729
|
-
if (
|
|
730
|
-
if (o && o.remove(),
|
|
729
|
+
d(this, ct, /* @__PURE__ */ h((e, s, i) => {
|
|
730
|
+
const n = e.cloneNode(!0), a = n.querySelector("thead"), o = n.querySelector("tbody"), c = n.querySelector("tfoot");
|
|
731
|
+
if (i === "header") {
|
|
732
|
+
if (o && o.remove(), c && c.remove(), e.querySelector("tbody")) {
|
|
731
733
|
const f = document.createElement("tbody");
|
|
732
734
|
f.className = "fixed-tbody", n.appendChild(f);
|
|
733
735
|
}
|
|
734
|
-
} else
|
|
735
|
-
return s === "left" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((
|
|
736
|
-
|
|
737
|
-
}) : s === "right" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((
|
|
738
|
-
|
|
739
|
-
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((
|
|
740
|
-
|
|
736
|
+
} else i === "body" ? (a && a.remove(), c && c.remove(), o && (o.className = "bindable-tbody")) : i === "footer" && (a && a.remove(), o && o.remove());
|
|
737
|
+
return s === "left" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((l) => {
|
|
738
|
+
l.getAttribute("fixed") !== "left" && l.remove();
|
|
739
|
+
}) : s === "right" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((l) => {
|
|
740
|
+
l.getAttribute("fixed") !== "right" && l.remove();
|
|
741
|
+
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((l) => {
|
|
742
|
+
l.remove();
|
|
741
743
|
}), n;
|
|
742
744
|
}, "#createSplitTable"));
|
|
743
745
|
A(this, "getRowHeight", /* @__PURE__ */ h(() => t(this, et).getRowHeight(), "getRowHeight"));
|
|
@@ -915,40 +917,40 @@ const _e = class _e extends HTMLElement {
|
|
|
915
917
|
var e;
|
|
916
918
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
917
919
|
var a;
|
|
918
|
-
const
|
|
919
|
-
t(this, kt).call(this, n,
|
|
920
|
+
const i = s.ctrlKey || s.metaKey || s.shiftKey, n = parseInt((a = s.target.closest(".nine-tab-item")) == null ? void 0 : a.dataset.index, 10);
|
|
921
|
+
t(this, kt).call(this, n, i);
|
|
920
922
|
}), t(this, kt).call(this, 0, !1);
|
|
921
923
|
}, "#init"));
|
|
922
924
|
d(this, kt, /* @__PURE__ */ h((e, s = !1) => {
|
|
923
|
-
const
|
|
925
|
+
const i = /* @__PURE__ */ h(() => {
|
|
924
926
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
925
|
-
Array.from(this.querySelectorAll("nine-splitter")).forEach((
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
const m = parseInt(
|
|
927
|
+
Array.from(this.querySelectorAll("nine-splitter")).forEach((g) => g.style.setProperty("display", "none"));
|
|
928
|
+
const b = f.filter((g) => g.classList.contains("active"));
|
|
929
|
+
b.length < 2 || b.forEach((g) => {
|
|
930
|
+
const m = parseInt(g.getAttribute("data-index"), 10), v = this.querySelector(`nine-splitter[data-split-index="${m}"]`), E = f[m + 1];
|
|
929
931
|
v && E && E.classList.contains("active") && v.style.setProperty("display", "flex");
|
|
930
932
|
});
|
|
931
|
-
}, "updateSplitters"), n = this.querySelector(".nine-tab-bar"), a = this.querySelector("nine-table-sheets-body"), o = n.querySelectorAll(".nine-tab-item"),
|
|
933
|
+
}, "updateSplitters"), n = this.querySelector(".nine-tab-bar"), a = this.querySelector("nine-table-sheets-body"), o = n.querySelectorAll(".nine-tab-item"), c = a.querySelectorAll("nine-table-sheet");
|
|
932
934
|
if (!o[e]) return;
|
|
933
935
|
if (!s)
|
|
934
936
|
o.forEach((f, u) => {
|
|
935
937
|
f.classList.toggle("active", u === e);
|
|
936
|
-
}),
|
|
937
|
-
const
|
|
938
|
-
f.classList.toggle("active",
|
|
938
|
+
}), c.forEach((f, u) => {
|
|
939
|
+
const b = u === e;
|
|
940
|
+
f.classList.toggle("active", b), f.style.flex = b ? "1 1 100%" : "";
|
|
939
941
|
});
|
|
940
942
|
else {
|
|
941
943
|
const f = o[e], u = n.querySelectorAll(".nine-tab-item.active");
|
|
942
944
|
if (f.classList.contains("active") && u.length <= 1)
|
|
943
945
|
return;
|
|
944
946
|
f.classList.toggle("active");
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
+
const b = a.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
948
|
+
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
947
949
|
}
|
|
948
|
-
const
|
|
949
|
-
|
|
950
|
-
f.style.flex =
|
|
951
|
-
}),
|
|
950
|
+
const l = a.querySelectorAll("nine-table-sheet.active");
|
|
951
|
+
l == null || l.forEach((f) => {
|
|
952
|
+
f.style.flex = l.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
953
|
+
}), i();
|
|
952
954
|
}, "#switchSheet"));
|
|
953
955
|
}
|
|
954
956
|
connectedCallback() {
|
|
@@ -960,26 +962,26 @@ let fe = _e;
|
|
|
960
962
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", fe);
|
|
961
963
|
var _, Gt, Tt, Jt;
|
|
962
964
|
const Ne = class Ne {
|
|
963
|
-
constructor(
|
|
965
|
+
constructor(r) {
|
|
964
966
|
d(this, _);
|
|
965
967
|
d(this, Gt, /* @__PURE__ */ h(() => {
|
|
966
|
-
t(this, Jt).call(this), new ResizeObserver((
|
|
967
|
-
for (let e of
|
|
968
|
+
t(this, Jt).call(this), new ResizeObserver((r) => {
|
|
969
|
+
for (let e of r)
|
|
968
970
|
t(this, _).getAttribute("auto-height") === "true" && t(this, Tt).call(this);
|
|
969
971
|
}).observe(t(this, _));
|
|
970
972
|
}, "#init"));
|
|
971
973
|
d(this, Tt, /* @__PURE__ */ h(() => {
|
|
972
|
-
var
|
|
973
|
-
const
|
|
974
|
-
if (
|
|
975
|
-
const e = parseInt(t(this, _).getAttribute("max-display-row"), 10) || 10, s = Math.max(...
|
|
974
|
+
var c, l;
|
|
975
|
+
const r = Array.from(t(this, _).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
976
|
+
if (r.length === 0) return;
|
|
977
|
+
const e = parseInt(t(this, _).getAttribute("max-display-row"), 10) || 10, s = Math.max(...r.map((f) => f.getRowHeight())), i = (c = t(this, _).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : c.getBoundingClientRect().height, n = (l = t(this, _).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, a = It.SCROLLBAR_SIZE, o = e * s + i + n + a;
|
|
976
978
|
t(this, _).style.height = `${o}px`;
|
|
977
979
|
}, "#applyAutoHeight"));
|
|
978
980
|
d(this, Jt, /* @__PURE__ */ h(() => {
|
|
979
|
-
const e = Array.from(t(this, _).children).filter((
|
|
980
|
-
const u = `<nine-table-sheet class="${
|
|
981
|
-
return u +
|
|
982
|
-
}).join(""), a = e.map((
|
|
981
|
+
const e = Array.from(t(this, _).children).filter((c) => c.tagName === "TABLE"), s = t(this, _).getAttribute("auto-height") === "true", i = e.length, n = e.map((c, l) => {
|
|
982
|
+
const u = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`, b = l < i - 1 ? `<nine-splitter class="h" data-split-index="${l}"></nine-splitter>` : "";
|
|
983
|
+
return u + b;
|
|
984
|
+
}).join(""), a = e.map((c, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
983
985
|
t(this, _).shadowRoot.innerHTML = `
|
|
984
986
|
<style>
|
|
985
987
|
:host {
|
|
@@ -1072,30 +1074,30 @@ const Ne = class Ne {
|
|
|
1072
1074
|
<nine-table-footer></nine-table-footer>
|
|
1073
1075
|
`;
|
|
1074
1076
|
const o = t(this, _).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1075
|
-
o == null || o.forEach((
|
|
1076
|
-
e[
|
|
1077
|
-
|
|
1077
|
+
o == null || o.forEach((c, l) => {
|
|
1078
|
+
e[l] && setTimeout(() => {
|
|
1079
|
+
c.generate(e[l]), s && t(this, Tt).call(this);
|
|
1078
1080
|
});
|
|
1079
1081
|
});
|
|
1080
1082
|
}, "#render"));
|
|
1081
|
-
y(this, _,
|
|
1083
|
+
y(this, _, r), t(this, Gt).call(this);
|
|
1082
1084
|
}
|
|
1083
1085
|
};
|
|
1084
1086
|
_ = new WeakMap(), Gt = new WeakMap(), Tt = new WeakMap(), Jt = new WeakMap(), h(Ne, "LayoutManager");
|
|
1085
1087
|
let ue = Ne;
|
|
1086
1088
|
var Ct, ht;
|
|
1087
1089
|
const We = class We {
|
|
1088
|
-
constructor(
|
|
1090
|
+
constructor(r) {
|
|
1089
1091
|
d(this, Ct);
|
|
1090
1092
|
d(this, ht, -1);
|
|
1091
1093
|
A(this, "count", /* @__PURE__ */ h(() => t(this, Ct).rawRecords.length, "count"));
|
|
1092
|
-
y(this, Ct,
|
|
1094
|
+
y(this, Ct, r);
|
|
1093
1095
|
}
|
|
1094
1096
|
get at() {
|
|
1095
1097
|
return t(this, ht);
|
|
1096
1098
|
}
|
|
1097
|
-
set at(
|
|
1098
|
-
y(this, ht, parseInt(
|
|
1099
|
+
set at(r) {
|
|
1100
|
+
y(this, ht, parseInt(r, 10)), body && !body.querySelector(`tbody.bindable tr[data-row="${t(this, ht)}"]`) && setTimeout(() => {
|
|
1099
1101
|
});
|
|
1100
1102
|
}
|
|
1101
1103
|
};
|
|
@@ -1103,7 +1105,7 @@ Ct = new WeakMap(), ht = new WeakMap(), h(We, "ngRow");
|
|
|
1103
1105
|
let ge = We;
|
|
1104
1106
|
var N, T, W, dt, Qt, Y, te, st, Lt, ee, se, ft;
|
|
1105
1107
|
const O = class O {
|
|
1106
|
-
constructor(
|
|
1108
|
+
constructor(r, e) {
|
|
1107
1109
|
d(this, N);
|
|
1108
1110
|
d(this, T);
|
|
1109
1111
|
d(this, W, []);
|
|
@@ -1112,8 +1114,8 @@ const O = class O {
|
|
|
1112
1114
|
d(this, Y, []);
|
|
1113
1115
|
d(this, te, /* @__PURE__ */ h(() => {
|
|
1114
1116
|
y(this, Y, []);
|
|
1115
|
-
const
|
|
1116
|
-
Array.from(
|
|
1117
|
+
const r = t(this, N).template || [];
|
|
1118
|
+
Array.from(r).forEach((e) => {
|
|
1117
1119
|
var s;
|
|
1118
1120
|
t(this, Y).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1119
1121
|
}), (t(this, T).rawRecords || []).forEach((e) => {
|
|
@@ -1121,25 +1123,25 @@ const O = class O {
|
|
|
1121
1123
|
});
|
|
1122
1124
|
}, "#initialize"));
|
|
1123
1125
|
d(this, st, /* @__PURE__ */ h(() => {
|
|
1124
|
-
t(this, N).shadowRoot.querySelectorAll("nine-table-sheet").forEach((
|
|
1125
|
-
|
|
1126
|
+
t(this, N).shadowRoot.querySelectorAll("nine-table-sheet").forEach((r) => {
|
|
1127
|
+
r.invalidate();
|
|
1126
1128
|
});
|
|
1127
1129
|
}, "#invalidate"));
|
|
1128
|
-
A(this, "get", /* @__PURE__ */ h((
|
|
1130
|
+
A(this, "get", /* @__PURE__ */ h((r, e) => {
|
|
1129
1131
|
var n;
|
|
1130
1132
|
const s = this.getValidData();
|
|
1131
1133
|
if (!s || s.length <= 0) return;
|
|
1132
|
-
if (
|
|
1133
|
-
if (
|
|
1134
|
-
const
|
|
1134
|
+
if (r == null) return t(this, ft).call(this, s);
|
|
1135
|
+
if (r < 0 || r >= s.length) return null;
|
|
1136
|
+
const i = typeof ((n = t(this, N).fields) == null ? void 0 : n.get) == "function" ? t(this, N).fields.get() : [];
|
|
1135
1137
|
if (e != null) {
|
|
1136
|
-
const a =
|
|
1137
|
-
return a >= 0 ? s[
|
|
1138
|
+
const a = i.indexOf(e);
|
|
1139
|
+
return a >= 0 ? s[r].v[a] : null;
|
|
1138
1140
|
}
|
|
1139
|
-
return t(this, ft).call(this, s[
|
|
1141
|
+
return t(this, ft).call(this, s[r]);
|
|
1140
1142
|
}, "get"));
|
|
1141
|
-
A(this, "set", /* @__PURE__ */ h((
|
|
1142
|
-
this.clear(), this.add(
|
|
1143
|
+
A(this, "set", /* @__PURE__ */ h((r) => {
|
|
1144
|
+
this.clear(), this.add(r, !1), t(this, st).call(this);
|
|
1143
1145
|
}, "set"));
|
|
1144
1146
|
d(this, Lt, /* @__PURE__ */ h(() => ({
|
|
1145
1147
|
rowState: O.ROW_STATE.EMPTY,
|
|
@@ -1154,81 +1156,81 @@ const O = class O {
|
|
|
1154
1156
|
y(this, W, []), y(this, dt, []), t(this, st).call(this);
|
|
1155
1157
|
}, "reset"));
|
|
1156
1158
|
A(this, "clear", /* @__PURE__ */ h(() => {
|
|
1157
|
-
var i;
|
|
1158
|
-
t(this, T).rawRecords = [], y(this, W, []), y(this, dt, []), (i = t(this, T).viewRecords) != null && i.reset && t(this, T).viewRecords.reset();
|
|
1159
|
-
}, "clear"));
|
|
1160
|
-
d(this, ee, /* @__PURE__ */ h((i) => {
|
|
1161
1159
|
var r;
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1160
|
+
t(this, T).rawRecords = [], y(this, W, []), y(this, dt, []), (r = t(this, T).viewRecords) != null && r.reset && t(this, T).viewRecords.reset();
|
|
1161
|
+
}, "clear"));
|
|
1162
|
+
d(this, ee, /* @__PURE__ */ h((r) => {
|
|
1163
|
+
var i;
|
|
1164
|
+
Array.isArray(r) || (r = [r]);
|
|
1165
|
+
const e = typeof ((i = t(this, N).fields) == null ? void 0 : i.get) == "function" ? t(this, N).fields.get() : Object.keys(r[0] || {}), s = [];
|
|
1166
|
+
return r.forEach((n) => {
|
|
1165
1167
|
const a = { v: [] };
|
|
1166
1168
|
e.forEach((o) => {
|
|
1167
1169
|
a.v.push(n[o] !== void 0 && n[o] !== null ? n[o] : "");
|
|
1168
1170
|
}), s.push(a);
|
|
1169
1171
|
}), s;
|
|
1170
1172
|
}, "#json2Array"));
|
|
1171
|
-
d(this, se, /* @__PURE__ */ h((
|
|
1173
|
+
d(this, se, /* @__PURE__ */ h((r) => (Array.isArray(r) || (r = [r]), r.forEach((e) => {
|
|
1172
1174
|
e.__ng = t(this, Lt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = O.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1173
|
-
}),
|
|
1174
|
-
A(this, "add", /* @__PURE__ */ h((
|
|
1175
|
-
|
|
1176
|
-
const s = t(this, ee).call(this,
|
|
1175
|
+
}), r), "#defaultInsert"));
|
|
1176
|
+
A(this, "add", /* @__PURE__ */ h((r, e = !0) => {
|
|
1177
|
+
r === void 0 && (r = {});
|
|
1178
|
+
const s = t(this, ee).call(this, r);
|
|
1177
1179
|
t(this, T).rawRecords = t(this, T).rawRecords.concat(t(this, se).call(this, s)), this.resetRecords();
|
|
1178
|
-
const
|
|
1180
|
+
const i = this.count() - 1;
|
|
1179
1181
|
return e || s.forEach((n, a) => {
|
|
1180
|
-
const o = t(this, T).rawRecords[
|
|
1182
|
+
const o = t(this, T).rawRecords[i - a];
|
|
1181
1183
|
o && (o.__ng.rowState = O.ROW_STATE.EMPTY);
|
|
1182
|
-
}), t(this, st).call(this),
|
|
1184
|
+
}), t(this, st).call(this), i;
|
|
1183
1185
|
}, "add"));
|
|
1184
|
-
A(this, "delete", /* @__PURE__ */ h((
|
|
1186
|
+
A(this, "delete", /* @__PURE__ */ h((r) => {
|
|
1185
1187
|
let e = [];
|
|
1186
|
-
Array.isArray(
|
|
1188
|
+
Array.isArray(r) ? e = r : typeof r > "u" ? e = [t(this, T).host.row.at] : e = [parseInt(r, 10)], e.sort((s, i) => i - s).forEach((s) => {
|
|
1187
1189
|
if (t(this, W)[s]) {
|
|
1188
|
-
const
|
|
1189
|
-
t(this, W)[s].__ng.rowState === O.ROW_STATE.INSERT ? t(this, T).rawRecords = t(this, T).rawRecords.filter((n) => n.__ng.rowid !==
|
|
1190
|
-
n.__ng.rowid ===
|
|
1190
|
+
const i = t(this, W)[s].__ng.rowid;
|
|
1191
|
+
t(this, W)[s].__ng.rowState === O.ROW_STATE.INSERT ? t(this, T).rawRecords = t(this, T).rawRecords.filter((n) => n.__ng.rowid !== i) : t(this, T).rawRecords.forEach((n) => {
|
|
1192
|
+
n.__ng.rowid === i && (n.__ng.deleted = !0, n.__ng.rowState = O.ROW_STATE.DELETE);
|
|
1191
1193
|
});
|
|
1192
1194
|
}
|
|
1193
1195
|
}), this.resetRecords(), t(this, st).call(this);
|
|
1194
1196
|
}, "delete"));
|
|
1195
|
-
A(this, "setValue", /* @__PURE__ */ h((
|
|
1196
|
-
var
|
|
1197
|
-
|
|
1198
|
-
const n = (typeof ((
|
|
1197
|
+
A(this, "setValue", /* @__PURE__ */ h((r, e, s) => {
|
|
1198
|
+
var c;
|
|
1199
|
+
r = parseInt(r, 10);
|
|
1200
|
+
const n = (typeof ((c = t(this, N).fields) == null ? void 0 : c.get) == "function" ? t(this, N).fields.get() : []).indexOf(e);
|
|
1199
1201
|
if (n < 0) return;
|
|
1200
|
-
const a = this.getValidData()[
|
|
1202
|
+
const a = this.getValidData()[r];
|
|
1201
1203
|
if (!a) return;
|
|
1202
1204
|
const o = a.v[n];
|
|
1203
1205
|
o !== s && a.__ng.rowState !== O.ROW_STATE.INSERT && (a.__ng.o.hasOwnProperty(e) || (a.__ng.o[e] = o), a.__ng.rowState = O.ROW_STATE.UPDATE), a.v[n] = s;
|
|
1204
1206
|
}, "setValue"));
|
|
1205
1207
|
A(this, "resetRecords", /* @__PURE__ */ h(() => {
|
|
1206
|
-
y(this, dt, t(this, T).rawRecords.filter((
|
|
1207
|
-
|
|
1208
|
-
}), t(this, W).forEach((
|
|
1209
|
-
|
|
1208
|
+
y(this, dt, t(this, T).rawRecords.filter((r) => !r.__ng.deleted)), y(this, W, t(this, T).rawRecords.filter((r) => !r.__ng.deleted && !r.__ng.filtered)), t(this, T).rawRecords.forEach((r, e) => {
|
|
1209
|
+
r.__ng.rowidx = e;
|
|
1210
|
+
}), t(this, W).forEach((r, e) => {
|
|
1211
|
+
r.__ng.i = e;
|
|
1210
1212
|
});
|
|
1211
1213
|
}, "resetRecords"));
|
|
1212
1214
|
A(this, "getValidData", /* @__PURE__ */ h(() => (t(this, W).length === 0 && t(this, T).rawRecords.length > 0 && this.resetRecords(), t(this, W)), "getValidData"));
|
|
1213
|
-
d(this, ft, /* @__PURE__ */ h((
|
|
1215
|
+
d(this, ft, /* @__PURE__ */ h((r) => {
|
|
1214
1216
|
var a;
|
|
1215
|
-
if (!
|
|
1216
|
-
const e = !Array.isArray(
|
|
1217
|
-
const
|
|
1218
|
-
return
|
|
1219
|
-
l
|
|
1220
|
-
}),
|
|
1217
|
+
if (!r) return r;
|
|
1218
|
+
const e = !Array.isArray(r), s = e ? [r] : r, i = typeof ((a = t(this, N).fields) == null ? void 0 : a.get) == "function" ? t(this, N).fields.get() : [], n = s.filter((o) => !o.__ng.deleted).map((o) => {
|
|
1219
|
+
const c = {};
|
|
1220
|
+
return i.forEach((l, f) => {
|
|
1221
|
+
c[l] = o.v ? o.v[f] : o[l];
|
|
1222
|
+
}), c.__ng = o.__ng, c;
|
|
1221
1223
|
});
|
|
1222
1224
|
return e ? n[0] : n;
|
|
1223
1225
|
}, "#conv"));
|
|
1224
1226
|
A(this, "count", /* @__PURE__ */ h(() => this.getValidData().length, "count"));
|
|
1225
|
-
y(this, N,
|
|
1227
|
+
y(this, N, r), y(this, T, e), t(this, te).call(this);
|
|
1226
1228
|
}
|
|
1227
1229
|
get source() {
|
|
1228
1230
|
return t(this, ft).call(this, t(this, T).rawRecords);
|
|
1229
1231
|
}
|
|
1230
|
-
set source(
|
|
1231
|
-
this.clear(), this.add(
|
|
1232
|
+
set source(r) {
|
|
1233
|
+
this.clear(), this.add(r, !1);
|
|
1232
1234
|
}
|
|
1233
1235
|
get nextId() {
|
|
1234
1236
|
return ++Ue(this, Qt)._;
|
|
@@ -1252,56 +1254,56 @@ A(O, "ROW_STATE", {
|
|
|
1252
1254
|
DELETE: "DELETE"
|
|
1253
1255
|
});
|
|
1254
1256
|
let be = O;
|
|
1255
|
-
var
|
|
1257
|
+
var rt;
|
|
1256
1258
|
const Oe = class Oe {
|
|
1257
|
-
constructor(
|
|
1258
|
-
d(this,
|
|
1259
|
-
y(this,
|
|
1259
|
+
constructor(r) {
|
|
1260
|
+
d(this, rt);
|
|
1261
|
+
y(this, rt, r), this.row = new ge(this), this.data = new be(t(this, rt), this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1260
1262
|
var e;
|
|
1261
|
-
(e = t(this,
|
|
1263
|
+
(e = t(this, rt).view) != null && e.redraw && t(this, rt).view.redraw();
|
|
1262
1264
|
}, this.setDataSource = (e) => {
|
|
1263
1265
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1264
1266
|
}, this.getRowState = (e) => {
|
|
1265
|
-
var
|
|
1267
|
+
var i, n;
|
|
1266
1268
|
const s = parseInt(e, 10);
|
|
1267
1269
|
if (!(s >= this.data.count()))
|
|
1268
|
-
return (n = (
|
|
1270
|
+
return (n = (i = this.data.getValidData()[s]) == null ? void 0 : i.__ng) == null ? void 0 : n.rowState;
|
|
1269
1271
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (e) => {
|
|
1270
1272
|
this.row.at = e;
|
|
1271
|
-
}, 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, s) => this.data.get(e, s), this.setColumn = (e, s,
|
|
1272
|
-
e = parseInt(e, 10), this.data.setValue(e, s,
|
|
1273
|
+
}, 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, s) => this.data.get(e, s), this.setColumn = (e, s, i) => {
|
|
1274
|
+
e = parseInt(e, 10), this.data.setValue(e, s, i);
|
|
1273
1275
|
}, this.setDataSource([]);
|
|
1274
1276
|
}
|
|
1275
1277
|
};
|
|
1276
|
-
|
|
1278
|
+
rt = new WeakMap(), h(Oe, "ngDataManager");
|
|
1277
1279
|
let ye = Oe;
|
|
1278
|
-
var ut, L, Ht,
|
|
1280
|
+
var ut, L, Ht, re;
|
|
1279
1281
|
const Be = class Be {
|
|
1280
1282
|
// 🎯 이제 { name: string, type: string } 객체들의 배열로 관리합니다.
|
|
1281
|
-
constructor(
|
|
1283
|
+
constructor(r) {
|
|
1282
1284
|
d(this, ut);
|
|
1283
1285
|
d(this, L, []);
|
|
1284
|
-
A(this, "add", /* @__PURE__ */ h((
|
|
1285
|
-
|
|
1286
|
-
t(this, L).some((
|
|
1286
|
+
A(this, "add", /* @__PURE__ */ h((r, e = "string") => {
|
|
1287
|
+
r.forEach((s) => {
|
|
1288
|
+
t(this, L).some((i) => i.name === s) || t(this, L).push({ name: s, type: e });
|
|
1287
1289
|
}), t(this, Ht).call(this);
|
|
1288
1290
|
}, "add"));
|
|
1289
1291
|
d(this, Ht, /* @__PURE__ */ h(() => {
|
|
1290
|
-
const
|
|
1292
|
+
const r = /* @__PURE__ */ new Map();
|
|
1291
1293
|
t(this, L).forEach((e) => {
|
|
1292
|
-
|
|
1293
|
-
}), y(this, L, Array.from(
|
|
1294
|
+
r.set(e.name, e.type);
|
|
1295
|
+
}), y(this, L, Array.from(r, ([e, s]) => ({ name: e, type: s }))), y(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);
|
|
1294
1296
|
}, "#adjust"));
|
|
1295
|
-
d(this,
|
|
1297
|
+
d(this, re, /* @__PURE__ */ h(() => {
|
|
1296
1298
|
y(this, L, []), H.log(t(this, ut).querySelectorAll("table"));
|
|
1297
|
-
const
|
|
1298
|
-
if (!(!
|
|
1299
|
-
for (const e of
|
|
1300
|
-
H.log(e), $("[data-bind]", e).each((s,
|
|
1301
|
-
const n =
|
|
1299
|
+
const r = Array.from(t(this, ut).querySelectorAll("table"));
|
|
1300
|
+
if (!(!r || r.length === 0)) {
|
|
1301
|
+
for (const e of r)
|
|
1302
|
+
H.log(e), $("[data-bind]", e).each((s, i) => {
|
|
1303
|
+
const n = i.dataset.bind, a = i.getAttribute("data-type") || "string";
|
|
1302
1304
|
n && t(this, L).push({ name: n, type: a });
|
|
1303
1305
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
1304
|
-
$(`[${s}]`, e).each((
|
|
1306
|
+
$(`[${s}]`, e).each((i, n) => {
|
|
1305
1307
|
var a = n.getAttribute(s);
|
|
1306
1308
|
if (a.indexOf("data.") < 0) {
|
|
1307
1309
|
const o = a.search(/[(]/g);
|
|
@@ -1314,9 +1316,9 @@ const Be = class Be {
|
|
|
1314
1316
|
}
|
|
1315
1317
|
a.split("data.").forEach((o) => {
|
|
1316
1318
|
if (o.trim() != "") {
|
|
1317
|
-
const
|
|
1318
|
-
let
|
|
1319
|
-
|
|
1319
|
+
const c = o.search(/[^_A-Za-z0-9]/g);
|
|
1320
|
+
let l = "";
|
|
1321
|
+
c >= 0 ? l = o.substring(0, c) : a.startsWith("data.") && (l = o.replace("data.", "")), l && t(this, L).push({ name: l, type: "string" });
|
|
1320
1322
|
}
|
|
1321
1323
|
});
|
|
1322
1324
|
});
|
|
@@ -1324,41 +1326,41 @@ const Be = class Be {
|
|
|
1324
1326
|
t(this, Ht).call(this);
|
|
1325
1327
|
}
|
|
1326
1328
|
}, "#init"));
|
|
1327
|
-
y(this, ut,
|
|
1329
|
+
y(this, ut, r), t(this, re).call(this);
|
|
1328
1330
|
}
|
|
1329
1331
|
// 🎯 기존에 필드 이름만 쓰던 곳들과의 호환을 위해 이름 배열만 리턴하는 메서드 유지
|
|
1330
1332
|
get() {
|
|
1331
|
-
return t(this, L).map((
|
|
1333
|
+
return t(this, L).map((r) => r.name);
|
|
1332
1334
|
}
|
|
1333
1335
|
// 🎯 내부 객체 통째로 얻기
|
|
1334
1336
|
getFields() {
|
|
1335
1337
|
return t(this, L);
|
|
1336
1338
|
}
|
|
1337
1339
|
// 🎯 특정 필드의 데이터 타입 조회
|
|
1338
|
-
getType(
|
|
1339
|
-
const e = t(this, L).find((s) => s.name ===
|
|
1340
|
+
getType(r) {
|
|
1341
|
+
const e = t(this, L).find((s) => s.name === r);
|
|
1340
1342
|
return e ? e.type : "string";
|
|
1341
1343
|
}
|
|
1342
|
-
indexOf(
|
|
1343
|
-
return t(this, L).findIndex((e) => e.name ===
|
|
1344
|
+
indexOf(r) {
|
|
1345
|
+
return t(this, L).findIndex((e) => e.name === r);
|
|
1344
1346
|
}
|
|
1345
|
-
includes(
|
|
1346
|
-
return t(this, L).some((e) => e.name ===
|
|
1347
|
+
includes(r) {
|
|
1348
|
+
return t(this, L).some((e) => e.name === r);
|
|
1347
1349
|
}
|
|
1348
1350
|
};
|
|
1349
|
-
ut = new WeakMap(), L = new WeakMap(), Ht = new WeakMap(),
|
|
1351
|
+
ut = new WeakMap(), L = new WeakMap(), Ht = new WeakMap(), re = new WeakMap(), h(Be, "ngFields");
|
|
1350
1352
|
let pe = Be;
|
|
1351
|
-
var
|
|
1353
|
+
var it, ie, ne;
|
|
1352
1354
|
const ze = class ze extends HTMLElement {
|
|
1353
1355
|
constructor() {
|
|
1354
1356
|
super();
|
|
1355
1357
|
//#created = false;
|
|
1356
|
-
d(this,
|
|
1357
|
-
d(this,
|
|
1358
|
+
d(this, it);
|
|
1359
|
+
d(this, ie);
|
|
1358
1360
|
d(this, ne, /* @__PURE__ */ h(() => {
|
|
1359
|
-
this.fields = new pe(this), y(this,
|
|
1361
|
+
this.fields = new pe(this), y(this, ie, new ue(this)), H.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1360
1362
|
}, "#init"));
|
|
1361
|
-
this.attachShadow({ mode: "open" }), y(this,
|
|
1363
|
+
this.attachShadow({ mode: "open" }), y(this, it, new ye(this));
|
|
1362
1364
|
}
|
|
1363
1365
|
connectedCallback() {
|
|
1364
1366
|
t(this, ne).call(this);
|
|
@@ -1368,18 +1370,18 @@ const ze = class ze extends HTMLElement {
|
|
|
1368
1370
|
}
|
|
1369
1371
|
// 🎯 외부에서 grid.data.set(...) 형태로 접근할 수 있도록 데이터 매니저 오픈
|
|
1370
1372
|
get data() {
|
|
1371
|
-
return t(this,
|
|
1373
|
+
return t(this, it).data;
|
|
1372
1374
|
}
|
|
1373
1375
|
// 🎯 행(row) 관련 제어 접근자 오픈
|
|
1374
1376
|
get row() {
|
|
1375
|
-
return t(this,
|
|
1377
|
+
return t(this, it).row;
|
|
1376
1378
|
}
|
|
1377
1379
|
// 🎯 전체 데이터 매니저 접근 필요할 경우
|
|
1378
1380
|
get dataManager() {
|
|
1379
|
-
return t(this,
|
|
1381
|
+
return t(this, it);
|
|
1380
1382
|
}
|
|
1381
1383
|
};
|
|
1382
|
-
|
|
1384
|
+
it = new WeakMap(), ie = new WeakMap(), ne = new WeakMap(), h(ze, "NineTable");
|
|
1383
1385
|
let me = ze;
|
|
1384
1386
|
customElements.get("nine-table") || customElements.define("nine-table", me);
|
|
1385
1387
|
const mt = class mt extends HTMLElement {
|
|
@@ -1409,13 +1411,13 @@ const De = class De extends xe {
|
|
|
1409
1411
|
A(this, "getDisplayText", /* @__PURE__ */ h((e) => {
|
|
1410
1412
|
if (t(this, p))
|
|
1411
1413
|
if (t(this, p).closest("tbody")) {
|
|
1412
|
-
const s = t(this, p).closest("tr").data,
|
|
1414
|
+
const s = t(this, p).closest("tr").data, i = parseInt(t(this, p).dataset.row);
|
|
1413
1415
|
if (!s) return "";
|
|
1414
1416
|
if (ninegrid.isNull(t(this, p).dataset.expr)) {
|
|
1415
1417
|
if (!ninegrid.isNull(t(this, p).dataset.bind))
|
|
1416
1418
|
return s[t(this, p).dataset.bind] || ninegrid.nvl(e, "");
|
|
1417
1419
|
} else try {
|
|
1418
|
-
return this.getExprValue(t(this, p).dataset.expr, s,
|
|
1420
|
+
return this.getExprValue(t(this, p).dataset.expr, s, i, t(this, p));
|
|
1419
1421
|
} catch {
|
|
1420
1422
|
console.error(t(this, p).dataset.expr, s, t(this, p).dataset.row);
|
|
1421
1423
|
}
|
|
@@ -1430,19 +1432,19 @@ const De = class De extends xe {
|
|
|
1430
1432
|
if (!(!t(this, C) || !t(this, C).template || !t(this, p).closest("tbody.bindable"))) {
|
|
1431
1433
|
var e = ninegrid.j.querySelectorAll(t(this, p)).attr("suppress");
|
|
1432
1434
|
if (e && (e = parseInt(e)), e && !isNaN(e)) {
|
|
1433
|
-
var s = t(this, p).closest("tr"),
|
|
1435
|
+
var s = t(this, p).closest("tr"), i = [];
|
|
1434
1436
|
$("th,td", s).each((x, M) => {
|
|
1435
1437
|
var k = ninegrid.j.querySelectorAll(M).attr("suppress");
|
|
1436
|
-
k && M.dataset.row && (k = parseInt(k), !isNaN(k) && k <= e &&
|
|
1437
|
-
}),
|
|
1438
|
+
k && M.dataset.row && (k = parseInt(k), !isNaN(k) && k <= e && i.push(k));
|
|
1439
|
+
}), i.sort();
|
|
1438
1440
|
var n = !1;
|
|
1439
1441
|
if (parseInt(s.sectionRowIndex / t(this, C).template.length) > 0)
|
|
1440
|
-
for (var a of
|
|
1442
|
+
for (var a of i) {
|
|
1441
1443
|
if (a > e) break;
|
|
1442
|
-
var o = parseInt(t(this, p).dataset.row),
|
|
1444
|
+
var o = parseInt(t(this, p).dataset.row), c = o - 1, l = t(this, p).closest("tr").data, f = t(this, C).data.get(c);
|
|
1443
1445
|
t(this, p).dataset.matrixRow;
|
|
1444
|
-
var u = t(this, C).body.querySelector(`tbody.bindable [suppress="${a}"][data-matrix-row="${t(this, p).dataset.matrixRow}"]`),
|
|
1445
|
-
if (
|
|
1446
|
+
var u = t(this, C).body.querySelector(`tbody.bindable [suppress="${a}"][data-matrix-row="${t(this, p).dataset.matrixRow}"]`), b = u.dataset.expr ? this.getExprValue(u.dataset.expr, l, o) : l[u.dataset.bind], g = u.dataset.expr ? this.getExprValue(u.dataset.expr, f, c) : f[u.dataset.bind];
|
|
1447
|
+
if (b != g) {
|
|
1446
1448
|
n = !0;
|
|
1447
1449
|
break;
|
|
1448
1450
|
}
|
|
@@ -1455,12 +1457,12 @@ const De = class De extends xe {
|
|
|
1455
1457
|
}
|
|
1456
1458
|
}
|
|
1457
1459
|
}, "#resetSuppress"));
|
|
1458
|
-
A(this, "getExprValue", /* @__PURE__ */ h((e, s,
|
|
1460
|
+
A(this, "getExprValue", /* @__PURE__ */ h((e, s, i, n) => {
|
|
1459
1461
|
if (typeof e < "u")
|
|
1460
1462
|
try {
|
|
1461
|
-
|
|
1463
|
+
i = parseInt(i);
|
|
1462
1464
|
const a = e.replace("()", "");
|
|
1463
|
-
return t(this, C)[a] ? t(this, C)[a].call(this, s,
|
|
1465
|
+
return t(this, C)[a] ? t(this, C)[a].call(this, s, i, t(this, p)) : t(this, C).exprFunction(e).call(this, s, i, t(this, C).data);
|
|
1464
1466
|
} catch {
|
|
1465
1467
|
return ["NG-COMBO"].includes(this.tagName) ? "" : e;
|
|
1466
1468
|
}
|
|
@@ -1477,8 +1479,8 @@ const De = class De extends xe {
|
|
|
1477
1479
|
}
|
|
1478
1480
|
set value(e) {
|
|
1479
1481
|
var s = parseInt(t(this, p).dataset.row);
|
|
1480
|
-
const
|
|
1481
|
-
s < 0 ? t(this, C).data.setValueNF(parseInt(t(this, p).dataset.index), t(this, p).dataset.bind, e,
|
|
1482
|
+
const i = this.getAttribute("update-row-state") != "false";
|
|
1483
|
+
s < 0 ? t(this, C).data.setValueNF(parseInt(t(this, p).dataset.index), t(this, p).dataset.bind, e, i) : t(this, C).data.setValue(s, t(this, p).dataset.bind, e, i);
|
|
1482
1484
|
}
|
|
1483
1485
|
get row() {
|
|
1484
1486
|
return parseInt(t(this, p).dataset.row);
|
|
@@ -1555,9 +1557,9 @@ const je = class je extends we {
|
|
|
1555
1557
|
if (t(this, nt) == "number") {
|
|
1556
1558
|
let n = [];
|
|
1557
1559
|
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) {
|
|
1558
|
-
var s = e.target.value,
|
|
1559
|
-
if (
|
|
1560
|
-
var s = s.substr(
|
|
1560
|
+
var s = e.target.value, i = s.indexOf(".");
|
|
1561
|
+
if (i >= 0) {
|
|
1562
|
+
var s = s.substr(i + 1, s.length);
|
|
1561
1563
|
s.length >= Number(t(this, U)) && e.preventDefault();
|
|
1562
1564
|
}
|
|
1563
1565
|
}
|