@ninebone/table 0.0.380 β 0.0.382
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 +291 -291
- 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
|
@@ -7,8 +7,8 @@ var a = (x, i) => xe(x, "name", { value: i, configurable: !0 });
|
|
|
7
7
|
var v = (x, i, e) => Ee(x, typeof i != "symbol" ? i + "" : i, e), we = (x, i, e) => i.has(x) || ve("Cannot " + e);
|
|
8
8
|
var t = (x, i, e) => (we(x, i, "read from private field"), e ? e.call(x) : i.get(x)), c = (x, i, e) => i.has(x) ? ve("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(x) : i.set(x, e), g = (x, i, e, s) => (we(x, i, "write to private field"), s ? s.call(x, e) : i.set(x, e), e);
|
|
9
9
|
var Se = (x, i, e, s) => ({
|
|
10
|
-
set _(
|
|
11
|
-
g(x, i,
|
|
10
|
+
set _(n) {
|
|
11
|
+
g(x, i, n, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
14
|
return t(x, i, s);
|
|
@@ -22,7 +22,7 @@ const ne = class ne extends Re.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(ne, "Trace");
|
|
24
24
|
let Ut = ne;
|
|
25
|
-
const
|
|
25
|
+
const z = new Ut();
|
|
26
26
|
var I, D, p, Y, X, U, vt, F, wt;
|
|
27
27
|
const oe = class oe extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -44,70 +44,70 @@ const oe = class oe extends HTMLElement {
|
|
|
44
44
|
if (!t(this, I) || !t(this, p) || t(this, D)) return;
|
|
45
45
|
const e = t(this, p).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const
|
|
48
|
-
if (l !== 0 &&
|
|
49
|
-
|
|
47
|
+
const n = t(this, p).track, r = t(this, p).thumb, o = t(this, I).querySelector(".ng-container-bottom"), l = e.clientWidth, d = s.scrollWidth;
|
|
48
|
+
if (l !== 0 && d > l)
|
|
49
|
+
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
51
|
-
|
|
51
|
+
o && (o.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const f = Math.max(Math.min(
|
|
54
|
+
const h = n.clientWidth;
|
|
55
|
+
if (h <= 0) return;
|
|
56
|
+
const f = Math.max(Math.min(h * (l / d), h), 20);
|
|
57
57
|
r.style.width = `${f}px`;
|
|
58
|
-
const u = e.scrollLeft, b =
|
|
58
|
+
const u = e.scrollLeft, b = d - l;
|
|
59
59
|
let y = 0;
|
|
60
|
-
b > 0 && (y = parseInt(u / b * (
|
|
61
|
-
const m =
|
|
62
|
-
y > m && (y = m), r.style.left = `${y}px`,
|
|
60
|
+
b > 0 && (y = parseInt(u / b * (h - f), 10)), y < 0 && (y = 0);
|
|
61
|
+
const m = h - f;
|
|
62
|
+
y > m && (y = m), r.style.left = `${y}px`, z.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
c(this, F, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
66
|
-
const s = t(this, p).container,
|
|
67
|
-
if (!
|
|
68
|
-
const r = t(this, p).track.getBoundingClientRect(),
|
|
66
|
+
const s = t(this, p).container, n = s.querySelector("table");
|
|
67
|
+
if (!n) return !1;
|
|
68
|
+
const r = t(this, p).track.getBoundingClientRect(), o = t(this, p).thumb.clientWidth;
|
|
69
69
|
let l = e;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
|
-
const
|
|
72
|
-
l >
|
|
73
|
-
const
|
|
74
|
-
return
|
|
71
|
+
const d = r.width - o;
|
|
72
|
+
l > d && (l = d), l = parseInt(l, 10), t(this, p).thumb.style.left = `${l}px`, t(this, p).left.disabled = l === 0, t(this, p).right.disabled = l >= d - 1;
|
|
73
|
+
const h = s.clientWidth, u = n.scrollWidth - h;
|
|
74
|
+
return d > 0 && u > 0 && (s.scrollLeft = l / d * u), l > 0 && l < d - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
c(this, wt, /* @__PURE__ */ a(() => {
|
|
77
|
-
const e = /* @__PURE__ */ a((
|
|
77
|
+
const e = /* @__PURE__ */ a((n) => {
|
|
78
78
|
clearInterval(t(this, Y)), clearInterval(t(this, X));
|
|
79
79
|
const r = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
80
|
-
t(this, F).call(this, r +
|
|
80
|
+
t(this, F).call(this, r + n), g(this, Y, setInterval(() => {
|
|
81
81
|
clearInterval(t(this, Y)), g(this, X, setInterval(() => {
|
|
82
|
-
const
|
|
83
|
-
t(this, F).call(this,
|
|
82
|
+
const o = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
83
|
+
t(this, F).call(this, o + n) || clearInterval(t(this, X));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
87
87
|
clearInterval(t(this, Y)), clearInterval(t(this, X));
|
|
88
88
|
}, "clearTimer");
|
|
89
|
-
["mouseup", "mouseleave", "touchend"].forEach((
|
|
90
|
-
t(this, p).left.addEventListener(
|
|
91
|
-
}), t(this, p).left.addEventListener("mousedown", (
|
|
92
|
-
|
|
93
|
-
}), t(this, p).right.addEventListener("mousedown", (
|
|
94
|
-
|
|
95
|
-
}), t(this, p).left.addEventListener("touchstart", () => e(-20)), t(this, p).right.addEventListener("touchstart", () => e(20)), t(this, p).track.addEventListener("mousedown", (
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
const r = t(this, p).track.getBoundingClientRect(),
|
|
99
|
-
t(this, F).call(this,
|
|
100
|
-
}), t(this, p).thumb.addEventListener("mousedown", (
|
|
101
|
-
if (
|
|
102
|
-
|
|
89
|
+
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
90
|
+
t(this, p).left.addEventListener(n, s), t(this, p).right.addEventListener(n, s), t(this, p).track.addEventListener(n, s);
|
|
91
|
+
}), t(this, p).left.addEventListener("mousedown", (n) => {
|
|
92
|
+
n.button === 0 && e(-20);
|
|
93
|
+
}), t(this, p).right.addEventListener("mousedown", (n) => {
|
|
94
|
+
n.button === 0 && e(20);
|
|
95
|
+
}), t(this, p).left.addEventListener("touchstart", () => e(-20)), t(this, p).right.addEventListener("touchstart", () => e(20)), t(this, p).track.addEventListener("mousedown", (n) => {
|
|
96
|
+
if (n.button !== 0) return;
|
|
97
|
+
n.preventDefault();
|
|
98
|
+
const r = t(this, p).track.getBoundingClientRect(), o = t(this, p).thumb.clientWidth;
|
|
99
|
+
t(this, F).call(this, n.clientX - r.left - o / 2);
|
|
100
|
+
}), t(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
101
|
+
if (n.button !== 0) return;
|
|
102
|
+
n.stopPropagation(), n.preventDefault(), g(this, D, !0), this.shiftX = n.clientX - t(this, p).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ a((l) => {
|
|
104
104
|
if (!t(this, D)) return;
|
|
105
|
-
const
|
|
106
|
-
t(this, F).call(this, l.clientX -
|
|
107
|
-
}, "onMouseMove"),
|
|
108
|
-
g(this, D, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup",
|
|
105
|
+
const d = t(this, p).track.getBoundingClientRect();
|
|
106
|
+
t(this, F).call(this, l.clientX - d.left - this.shiftX);
|
|
107
|
+
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
108
|
+
g(this, D, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup",
|
|
110
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
111
111
|
});
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
@@ -214,53 +214,53 @@ const re = class re extends HTMLElement {
|
|
|
214
214
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
215
215
|
*/
|
|
216
216
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
217
|
-
var
|
|
217
|
+
var O, ge, be, ye, pe, me;
|
|
218
218
|
if (!t(this, L) || !t(this, S) || t(this, B)) return;
|
|
219
|
-
const e = t(this, S).container, s = t(this, S).track,
|
|
220
|
-
(
|
|
221
|
-
|
|
222
|
-
if (d <= r) {
|
|
223
|
-
o.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
219
|
+
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, o = ((ge = (O = t(this, L).host) == null ? void 0 : O.data) == null ? void 0 : ge.get()) || ((ye = (be = t(this, L)._host) == null ? void 0 : be.data) == null ? void 0 : ye.get()) || [], l = o.length > 0 ? o.length : 61, d = ((me = (pe = t(this, L)).getRowHeight) == null ? void 0 : me.call(pe)) || 85, h = l * d;
|
|
220
|
+
if (h <= r) {
|
|
221
|
+
n.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
224
222
|
return;
|
|
225
223
|
} else
|
|
226
|
-
|
|
224
|
+
n.style.display = "block";
|
|
227
225
|
const f = s.clientHeight;
|
|
228
226
|
if (f <= 0) return;
|
|
229
|
-
const u = Math.max(Math.min(f * (r /
|
|
230
|
-
|
|
231
|
-
const b = e.scrollTop, y =
|
|
227
|
+
const u = Math.max(Math.min(f * (r / h), f), 20);
|
|
228
|
+
n.style.height = `${u}px`;
|
|
229
|
+
const b = e.scrollTop, y = h - r;
|
|
232
230
|
let m = 0;
|
|
233
231
|
y > 0 && (m = b / y * (f - u));
|
|
234
232
|
const R = f - u;
|
|
235
|
-
m < 0 && (m = 0), m > R && (m = R),
|
|
233
|
+
m < 0 && (m = 0), m > R && (m = R), n.style.top = `${m}px`, t(this, S).top.disabled = b <= 0, t(this, S).bottom.disabled = b >= y - 1;
|
|
236
234
|
}, "refresh"));
|
|
237
235
|
c(this, St, /* @__PURE__ */ a(() => {
|
|
238
|
-
const e = t(this, S).container
|
|
236
|
+
const e = t(this, S).container, s = /* @__PURE__ */ a(() => {
|
|
237
|
+
var l, d, h, f, u, b;
|
|
238
|
+
const n = ((d = (l = t(this, L).host) == null ? void 0 : l.data) == null ? void 0 : d.get()) || ((f = (h = t(this, L)._host) == null ? void 0 : h.data) == null ? void 0 : f.get()) || [], r = n.length > 0 ? n.length : 61, o = ((b = (u = t(this, L)).getRowHeight) == null ? void 0 : b.call(u)) || 85;
|
|
239
|
+
return r * o;
|
|
240
|
+
}, "getContentHeight");
|
|
239
241
|
e.addEventListener("scroll", () => {
|
|
240
242
|
t(this, B) || this.refresh();
|
|
241
|
-
}), t(this, S).thumb.addEventListener("mousedown", (
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
-
const
|
|
243
|
+
}), t(this, S).thumb.addEventListener("mousedown", (n) => {
|
|
244
|
+
if (n.button !== 0) return;
|
|
245
|
+
n.stopPropagation(), n.preventDefault(), g(this, B, !0), g(this, at, n.clientY), g(this, ct, e.scrollTop);
|
|
246
|
+
const r = /* @__PURE__ */ a((l) => {
|
|
245
247
|
if (!t(this, B)) return;
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
const z = u / f * R;
|
|
251
|
-
e.scrollTop = t(this, ct) + z;
|
|
248
|
+
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h, b = l.clientY - t(this, at), y = e.clientHeight, R = s() - y;
|
|
249
|
+
if (u > 0 && R > 0) {
|
|
250
|
+
const O = b / u * R;
|
|
251
|
+
e.scrollTop = t(this, ct) + O;
|
|
252
252
|
}
|
|
253
253
|
this.refresh();
|
|
254
|
-
}, "onMouseMove"),
|
|
255
|
-
g(this, B, !1), document.removeEventListener("mousemove",
|
|
254
|
+
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
255
|
+
g(this, B, !1), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
256
256
|
}, "onMouseUp");
|
|
257
|
-
document.addEventListener("mousemove",
|
|
258
|
-
}), t(this, S).track.addEventListener("mousedown", (
|
|
259
|
-
if (
|
|
260
|
-
const
|
|
261
|
-
if (h > 0 &&
|
|
262
|
-
const
|
|
263
|
-
e.scrollTop =
|
|
257
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
258
|
+
}), t(this, S).track.addEventListener("mousedown", (n) => {
|
|
259
|
+
if (n.button !== 0 || n.target === t(this, S).thumb) return;
|
|
260
|
+
const r = t(this, S).track.getBoundingClientRect(), o = t(this, S).thumb.clientHeight, l = n.clientY - r.top - o / 2, h = r.height - o, f = e.clientHeight, b = s() - f;
|
|
261
|
+
if (h > 0 && b > 0) {
|
|
262
|
+
const y = Math.max(0, Math.min(1, l / h));
|
|
263
|
+
e.scrollTop = y * b;
|
|
264
264
|
}
|
|
265
265
|
this.refresh();
|
|
266
266
|
}), t(this, S).top.addEventListener("click", () => {
|
|
@@ -356,83 +356,83 @@ L = new WeakMap(), B = new WeakMap(), S = new WeakMap(), at = new WeakMap(), ct
|
|
|
356
356
|
let jt = re;
|
|
357
357
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", jt);
|
|
358
358
|
var Et, Q;
|
|
359
|
-
const
|
|
359
|
+
const _ = class _ {
|
|
360
360
|
/**
|
|
361
361
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
362
362
|
*/
|
|
363
363
|
static compileAll(i) {
|
|
364
|
-
return Array.isArray(i) ? i.map((e) =>
|
|
364
|
+
return Array.isArray(i) ? i.map((e) => _.compile(e)) : [];
|
|
365
365
|
}
|
|
366
366
|
/**
|
|
367
367
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
368
368
|
*/
|
|
369
369
|
static compile(i) {
|
|
370
|
-
var
|
|
370
|
+
var n, r, o, l;
|
|
371
371
|
if (!i) return null;
|
|
372
372
|
const e = i.cloneNode(!0);
|
|
373
|
-
return t(
|
|
374
|
-
const f =
|
|
375
|
-
f && e.querySelectorAll(`thead [data-col="${
|
|
373
|
+
return t(n = _, Et).call(n, e), t(r = _, Q).call(r, e, "thead"), t(o = _, Q).call(o, e, "tbody"), t(l = _, Q).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((d, h) => {
|
|
374
|
+
const f = d.getAttribute("fixed");
|
|
375
|
+
f && e.querySelectorAll(`thead [data-col="${h}"], tbody [data-col="${h}"], tfoot [data-col="${h}"]`).forEach((u) => {
|
|
376
376
|
u.setAttribute("fixed", f);
|
|
377
377
|
});
|
|
378
378
|
}), e;
|
|
379
379
|
}
|
|
380
380
|
};
|
|
381
|
-
Et = new WeakMap(), Q = new WeakMap(), a(
|
|
381
|
+
Et = new WeakMap(), Q = new WeakMap(), a(_, "TableCompiler"), c(_, Et, /* @__PURE__ */ a((i) => {
|
|
382
382
|
if (!i.querySelector("colgroup")) {
|
|
383
|
-
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1,
|
|
384
|
-
for (let
|
|
383
|
+
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
384
|
+
for (let o = 0; o < s; o++) {
|
|
385
385
|
const l = document.createElement("col");
|
|
386
|
-
l.setAttribute("width", r),
|
|
386
|
+
l.setAttribute("width", r), n.appendChild(l);
|
|
387
387
|
}
|
|
388
|
-
i.prepend(
|
|
388
|
+
i.prepend(n);
|
|
389
389
|
}
|
|
390
390
|
if (!i.querySelector("thead")) {
|
|
391
391
|
const e = document.createElement("thead"), s = i.querySelector("colgroup");
|
|
392
392
|
s ? s.after(e) : i.prepend(e);
|
|
393
393
|
}
|
|
394
394
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
395
|
-
}, "#ensureTableStructure")), c(
|
|
396
|
-
const s = Array.from(i.querySelectorAll(e + " tr")),
|
|
397
|
-
if (r === 0 ||
|
|
398
|
-
let
|
|
399
|
-
|
|
400
|
-
|
|
395
|
+
}, "#ensureTableStructure")), c(_, Q, /* @__PURE__ */ a((i, e) => {
|
|
396
|
+
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
397
|
+
if (r === 0 || n.length === 0) return;
|
|
398
|
+
let o = 0;
|
|
399
|
+
n.forEach((d) => {
|
|
400
|
+
o += d.colSpan || 1;
|
|
401
401
|
});
|
|
402
|
-
const l = Array.from(Array(r), () => Array(
|
|
403
|
-
s.forEach((
|
|
404
|
-
const
|
|
402
|
+
const l = Array.from(Array(r), () => Array(o).fill(null));
|
|
403
|
+
s.forEach((d) => {
|
|
404
|
+
const h = d.sectionRowIndex;
|
|
405
405
|
let f = 0;
|
|
406
|
-
Array.from(
|
|
407
|
-
for (let m = 0; m < l[
|
|
408
|
-
if (l[
|
|
406
|
+
Array.from(d.querySelectorAll("th,td")).forEach((u) => {
|
|
407
|
+
for (let m = 0; m < l[h].length; m++)
|
|
408
|
+
if (l[h][m] === null) {
|
|
409
409
|
f = m;
|
|
410
410
|
break;
|
|
411
411
|
}
|
|
412
412
|
const b = u.rowSpan || 1, y = u.colSpan || 1;
|
|
413
413
|
for (let m = 0; m < b; m++)
|
|
414
414
|
for (let R = 0; R < y; R++)
|
|
415
|
-
|
|
415
|
+
h + m < r && f + R < o && (l[h + m][f + R] = m === 0 && R === 0 ? "1" : "0");
|
|
416
416
|
});
|
|
417
|
-
}), s.forEach((
|
|
418
|
-
const
|
|
419
|
-
Array.from(
|
|
420
|
-
for (let u = 0; u < l[
|
|
421
|
-
if (l[
|
|
422
|
-
f.dataset.col = u, l[
|
|
417
|
+
}), s.forEach((d) => {
|
|
418
|
+
const h = d.sectionRowIndex;
|
|
419
|
+
Array.from(d.querySelectorAll("th,td")).forEach((f) => {
|
|
420
|
+
for (let u = 0; u < l[h].length; u++)
|
|
421
|
+
if (l[h][u] === "1") {
|
|
422
|
+
f.dataset.col = u, l[h][u] = "0";
|
|
423
423
|
break;
|
|
424
424
|
}
|
|
425
425
|
});
|
|
426
426
|
});
|
|
427
427
|
}, "#resetColIndex"));
|
|
428
|
-
let Kt =
|
|
429
|
-
var
|
|
428
|
+
let Kt = _;
|
|
429
|
+
var M, w, W, T, N, j, P, tt, Rt, At, Tt, ht, dt, qt, kt, ft, Lt, et, ut;
|
|
430
430
|
const le = class le {
|
|
431
431
|
constructor(i) {
|
|
432
|
-
c(this,
|
|
432
|
+
c(this, M);
|
|
433
433
|
c(this, w);
|
|
434
|
-
c(this,
|
|
435
|
-
c(this,
|
|
434
|
+
c(this, W, /* @__PURE__ */ new Map());
|
|
435
|
+
c(this, T, null);
|
|
436
436
|
c(this, N, null);
|
|
437
437
|
c(this, j, 0);
|
|
438
438
|
c(this, P, 40);
|
|
@@ -444,89 +444,89 @@ const le = class le {
|
|
|
444
444
|
i && (t(this, ht).call(this), t(this, et).call(this, i.scrollTop), (e = t(this, w).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
445
445
|
}, "refresh"));
|
|
446
446
|
v(this, "initialize", /* @__PURE__ */ a(() => {
|
|
447
|
-
g(this,
|
|
448
|
-
const r = t(this, w).querySelector(
|
|
447
|
+
g(this, T, null), t(this, W).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
448
|
+
const r = t(this, w).querySelector(n);
|
|
449
449
|
if (!r) return;
|
|
450
|
-
const
|
|
451
|
-
if (!
|
|
452
|
-
const l =
|
|
450
|
+
const o = r.querySelector("table");
|
|
451
|
+
if (!o) return;
|
|
452
|
+
const l = o.querySelector("tbody.bindable-tbody");
|
|
453
453
|
if (!l) return;
|
|
454
|
-
const
|
|
455
|
-
t(this,
|
|
454
|
+
const h = Array.from(l.querySelectorAll("tr")).map((f) => f.cloneNode(!0));
|
|
455
|
+
t(this, W).set(n, h);
|
|
456
456
|
});
|
|
457
457
|
const i = t(this, w).querySelector(".ng-container-body"), e = t(this, w).querySelector(".ng-container-left"), s = t(this, w).querySelector(".ng-container-right");
|
|
458
458
|
if (i) {
|
|
459
|
-
t(this,
|
|
460
|
-
let
|
|
461
|
-
const r = /* @__PURE__ */ a((
|
|
459
|
+
t(this, Tt).call(this, i), t(this, ft).call(this), t(this, ht).call(this), t(this, et).call(this, i.scrollTop);
|
|
460
|
+
let n = i.scrollTop;
|
|
461
|
+
const r = /* @__PURE__ */ a((o) => {
|
|
462
462
|
var l;
|
|
463
|
-
e && e.scrollTop !==
|
|
463
|
+
e && e.scrollTop !== o && (e.scrollTop = o), s && s.scrollTop !== o && (s.scrollTop = o), t(this, et).call(this, o), (l = t(this, w).querySelector("nine-table-vscrollbar")) == null || l.refresh();
|
|
464
464
|
}, "syncScroll");
|
|
465
465
|
i.addEventListener("scroll", () => {
|
|
466
|
-
const
|
|
467
|
-
|
|
466
|
+
const o = i.scrollTop;
|
|
467
|
+
n !== o && (n = o, r(o));
|
|
468
468
|
});
|
|
469
469
|
}
|
|
470
470
|
}, "initialize"));
|
|
471
471
|
c(this, At, /* @__PURE__ */ a((i, e) => {
|
|
472
|
-
const s = t(this,
|
|
472
|
+
const s = t(this, W).get(e);
|
|
473
473
|
if (!s || s.length === 0) return;
|
|
474
|
-
const
|
|
475
|
-
if (!
|
|
476
|
-
|
|
477
|
-
const r =
|
|
474
|
+
const n = i.querySelector("tbody.bindable-tbody");
|
|
475
|
+
if (!n) return;
|
|
476
|
+
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
477
|
+
const r = n.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
478
478
|
for (let l = 0; l < t(this, P); l++)
|
|
479
|
-
s.forEach((
|
|
480
|
-
|
|
479
|
+
s.forEach((d) => {
|
|
480
|
+
o.appendChild(d.cloneNode(!0));
|
|
481
481
|
});
|
|
482
|
-
r ? r.before(
|
|
482
|
+
r ? r.before(o) : n.appendChild(o);
|
|
483
483
|
}, "#renderRows"));
|
|
484
|
-
c(this,
|
|
485
|
-
if (t(this,
|
|
486
|
-
return t(this,
|
|
487
|
-
const e = t(this,
|
|
484
|
+
c(this, Tt, /* @__PURE__ */ a((i) => {
|
|
485
|
+
if (t(this, T) !== null && t(this, T) > 0)
|
|
486
|
+
return t(this, T);
|
|
487
|
+
const e = t(this, W).get(".ng-container-body");
|
|
488
488
|
if (!e || e.length === 0) return 24;
|
|
489
489
|
const s = i.querySelector("tbody.bindable-tbody") || i.querySelector("tbody.bindable-tbody:last-of-type");
|
|
490
490
|
if (!s) return 24;
|
|
491
491
|
s.querySelectorAll("tr:not(.nodata)").forEach((b) => b.remove());
|
|
492
|
-
const
|
|
492
|
+
const n = s.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
493
493
|
e.forEach((b) => {
|
|
494
494
|
r.appendChild(b.cloneNode(!0));
|
|
495
|
-
}),
|
|
496
|
-
const
|
|
497
|
-
(l === "none" || window.getComputedStyle(
|
|
495
|
+
}), n ? n.before(r) : s.appendChild(r);
|
|
496
|
+
const o = t(this, w), l = o.style.display, d = o.style.visibility, h = o.style.position;
|
|
497
|
+
(l === "none" || window.getComputedStyle(o).display === "none") && (o.style.display = "block", o.style.visibility = "hidden", o.style.position = "absolute");
|
|
498
498
|
let f = 0;
|
|
499
499
|
const u = s.querySelectorAll("tr:not(.nodata)");
|
|
500
500
|
return u.forEach((b) => {
|
|
501
501
|
f += b.offsetHeight || b.getBoundingClientRect().height;
|
|
502
|
-
}), u.forEach((b) => b.remove()),
|
|
502
|
+
}), u.forEach((b) => b.remove()), o.style.display = l, o.style.visibility = d, o.style.position = h, g(this, T, f > 0 ? f : 24), t(this, dt).call(this), t(this, T);
|
|
503
503
|
}, "#measureAndCacheHeight"));
|
|
504
504
|
c(this, ht, /* @__PURE__ */ a(() => {
|
|
505
505
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
506
|
-
const s = (t(this,
|
|
507
|
-
|
|
508
|
-
const l = t(this, w).querySelector(
|
|
509
|
-
|
|
506
|
+
const s = (t(this, M).data.get() || []).length, n = t(this, T) || 24, r = s * n;
|
|
507
|
+
z.log(`[VirtualHeight] totalCount: ${s}, rowHeight: ${n}, totalVirtualHeight: ${r}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
508
|
+
const l = t(this, w).querySelector(o), d = l == null ? void 0 : l.querySelector("table");
|
|
509
|
+
d && (d.style.height = `${r}px`);
|
|
510
510
|
});
|
|
511
511
|
}, "#updateVirtualScrollHeight"));
|
|
512
512
|
c(this, dt, /* @__PURE__ */ a(() => {
|
|
513
|
-
if ((t(this,
|
|
514
|
-
const e = Math.ceil(t(this, j) / t(this,
|
|
515
|
-
g(this, P, e + t(this, Rt)),
|
|
513
|
+
if ((t(this, M).data.get() || []).length, t(this, j) > 0 && t(this, T) > 0) {
|
|
514
|
+
const e = Math.ceil(t(this, j) / t(this, T));
|
|
515
|
+
g(this, P, e + t(this, Rt)), z.log("visibleRows:", e, "cachedRowCount:", t(this, P));
|
|
516
516
|
}
|
|
517
517
|
}, "#updateRowCount"));
|
|
518
|
-
c(this,
|
|
519
|
-
var
|
|
518
|
+
c(this, qt, /* @__PURE__ */ a(() => {
|
|
519
|
+
var d, h, f;
|
|
520
520
|
const i = t(this, w).querySelector(".ng-container-left table"), e = t(this, w).querySelector(".ng-container-body table"), s = t(this, w).querySelector(".ng-container-right table");
|
|
521
521
|
if (!e) return;
|
|
522
|
-
const
|
|
522
|
+
const n = i ? Array.from(i.querySelectorAll("tr")) : [], r = Array.from(e.querySelectorAll("tr")), o = s ? Array.from(s.querySelectorAll("tr")) : [], l = Math.max(n.length, r.length, o.length);
|
|
523
523
|
for (let u = 0; u < l; u++) {
|
|
524
524
|
const b = [
|
|
525
|
-
((
|
|
526
|
-
((
|
|
527
|
-
((f =
|
|
525
|
+
((d = n[u]) == null ? void 0 : d.getBoundingClientRect().height) || 0,
|
|
526
|
+
((h = r[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
527
|
+
((f = o[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
528
528
|
], y = Math.max(...b);
|
|
529
|
-
y > 0 && (
|
|
529
|
+
y > 0 && (n[u] && (n[u].style.height = `${y}px`), r[u] && (r[u].style.height = `${y}px`), o[u] && (o[u].style.height = `${y}px`));
|
|
530
530
|
}
|
|
531
531
|
}, "#syncRowHeights"));
|
|
532
532
|
c(this, kt, /* @__PURE__ */ a(() => {
|
|
@@ -534,13 +534,13 @@ const le = class le {
|
|
|
534
534
|
for (const e of i) {
|
|
535
535
|
const s = e.target;
|
|
536
536
|
if (!s.classList.contains("active")) continue;
|
|
537
|
-
const
|
|
538
|
-
if (
|
|
537
|
+
const n = e.contentRect.height;
|
|
538
|
+
if (n > 0) {
|
|
539
539
|
let r = 0;
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
const l = Math.max(
|
|
543
|
-
t(this, j) !== l && (g(this, j, l), t(this, dt).call(this), t(this,
|
|
540
|
+
const o = s.querySelector("thead");
|
|
541
|
+
o && (r += o.offsetHeight || o.getBoundingClientRect().height);
|
|
542
|
+
const l = Math.max(n - r, 100);
|
|
543
|
+
t(this, j) !== l && (g(this, j, l), t(this, dt).call(this), t(this, T) !== null && t(this, ft).call(this));
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
})), t(this, N).observe(t(this, w)));
|
|
@@ -549,72 +549,72 @@ const le = class le {
|
|
|
549
549
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
550
550
|
const e = t(this, w).querySelector(i);
|
|
551
551
|
e && e.querySelector("tbody.bindable-tbody") && t(this, At).call(this, e, i);
|
|
552
|
-
}), t(this,
|
|
552
|
+
}), t(this, qt).call(this);
|
|
553
553
|
}, "#renderAllContainers"));
|
|
554
554
|
c(this, Lt, /* @__PURE__ */ a((i) => {
|
|
555
555
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
556
|
-
var
|
|
556
|
+
var h;
|
|
557
557
|
const s = t(this, w).querySelector(e);
|
|
558
558
|
if (!s) return;
|
|
559
|
-
const
|
|
560
|
-
if (!
|
|
561
|
-
const r = Array.from(
|
|
559
|
+
const n = s.querySelector("tbody.bindable-tbody");
|
|
560
|
+
if (!n) return;
|
|
561
|
+
const r = Array.from(n.querySelectorAll("tr:not(.nodata)")), o = ((h = t(this, W).get(e)) == null ? void 0 : h.length) || 1, d = (t(this, M).data.get() || []).length;
|
|
562
562
|
r.forEach((f, u) => {
|
|
563
|
-
const b = i + Math.floor(u /
|
|
564
|
-
if (b >=
|
|
563
|
+
const b = i + Math.floor(u / o);
|
|
564
|
+
if (b >= d) {
|
|
565
565
|
f.style.display = "none";
|
|
566
566
|
return;
|
|
567
567
|
}
|
|
568
|
-
const y = t(this,
|
|
568
|
+
const y = t(this, M).data.get(b);
|
|
569
569
|
f.style.display = "", t(this, ut).call(this, f, y, b);
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
572
|
}, "#adjustBufferRows"));
|
|
573
573
|
c(this, et, /* @__PURE__ */ a((i) => {
|
|
574
|
-
var
|
|
575
|
-
const e = t(this,
|
|
574
|
+
var d;
|
|
575
|
+
const e = t(this, T);
|
|
576
576
|
if (!e || e <= 0) return;
|
|
577
|
-
const
|
|
578
|
-
|
|
579
|
-
const f = t(this, w).querySelector(
|
|
577
|
+
const n = (t(this, M).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, W).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this, P);
|
|
578
|
+
z.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, P)}, targetDataIndex range: ${r} ~ ${l} (Total: ${n})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
579
|
+
const f = t(this, w).querySelector(h);
|
|
580
580
|
if (!f) return;
|
|
581
581
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
582
582
|
if (!u) return;
|
|
583
583
|
Array.from(u.querySelectorAll("tr:not(.nodata)")).forEach((y, m) => {
|
|
584
|
-
const R = r + Math.floor(m /
|
|
585
|
-
if (R >=
|
|
584
|
+
const R = r + Math.floor(m / o);
|
|
585
|
+
if (R >= n) {
|
|
586
586
|
y.style.display = "none";
|
|
587
587
|
return;
|
|
588
588
|
}
|
|
589
|
-
const
|
|
590
|
-
y.style.display = "", t(this, ut).call(this, y,
|
|
589
|
+
const O = t(this, M).data.get(R);
|
|
590
|
+
y.style.display = "", t(this, ut).call(this, y, O, R);
|
|
591
591
|
});
|
|
592
592
|
}), t(this, tt) || (g(this, tt, !0), setTimeout(() => {
|
|
593
593
|
t(this, Lt).call(this, r), g(this, tt, !1);
|
|
594
594
|
}, 0));
|
|
595
595
|
}, "#handleScroll"));
|
|
596
596
|
c(this, ut, /* @__PURE__ */ a((i, e, s) => {
|
|
597
|
-
i.dataset.row = s, Array.from(i.cells).forEach((
|
|
598
|
-
const
|
|
599
|
-
|
|
597
|
+
i.dataset.row = s, Array.from(i.cells).forEach((n, r) => {
|
|
598
|
+
const o = n.dataset.bind;
|
|
599
|
+
o && e && e[o] !== void 0 ? n.textContent = e[o] : n.textContent = e ? e[Object.keys(e)[r]] ?? `R${s}C${r}` : `ν ${s + 1}`, n.dataset.row = s;
|
|
600
600
|
});
|
|
601
601
|
}, "#bindRowData"));
|
|
602
602
|
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
603
603
|
t(this, N) && (t(this, N).disconnect(), g(this, N, null));
|
|
604
604
|
}, "destroy"));
|
|
605
|
-
g(this,
|
|
605
|
+
g(this, M, i.getRootNode().host), g(this, w, i), t(this, kt).call(this);
|
|
606
606
|
}
|
|
607
607
|
getRowHeight() {
|
|
608
|
-
return t(this,
|
|
608
|
+
return t(this, T);
|
|
609
609
|
}
|
|
610
610
|
templateLength(i = ".ng-container-body") {
|
|
611
611
|
var e;
|
|
612
|
-
return ((e = t(this,
|
|
612
|
+
return ((e = t(this, W).get(i)) == null ? void 0 : e.length) || 1;
|
|
613
613
|
}
|
|
614
614
|
};
|
|
615
|
-
|
|
615
|
+
M = new WeakMap(), w = new WeakMap(), W = new WeakMap(), T = new WeakMap(), N = new WeakMap(), j = new WeakMap(), P = new WeakMap(), tt = new WeakMap(), Rt = new WeakMap(), At = new WeakMap(), Tt = new WeakMap(), ht = new WeakMap(), dt = new WeakMap(), qt = new WeakMap(), kt = new WeakMap(), ft = new WeakMap(), Lt = new WeakMap(), et = new WeakMap(), ut = new WeakMap(), a(le, "RowManager");
|
|
616
616
|
let Zt = le;
|
|
617
|
-
var Ht, it, K, Ct, _t, $t,
|
|
617
|
+
var Ht, it, K, Ct, _t, $t, It, Mt;
|
|
618
618
|
const lt = class lt extends HTMLElement {
|
|
619
619
|
constructor() {
|
|
620
620
|
super();
|
|
@@ -633,28 +633,28 @@ const lt = class lt extends HTMLElement {
|
|
|
633
633
|
{ selector: ".ng-container-body", type: null },
|
|
634
634
|
{ selector: ".ng-container-left", type: "left" },
|
|
635
635
|
{ selector: ".ng-container-right", type: "right" }
|
|
636
|
-
].forEach(({ selector: s, type:
|
|
636
|
+
].forEach(({ selector: s, type: n }) => {
|
|
637
637
|
const r = this.querySelector(s);
|
|
638
638
|
if (!r) return;
|
|
639
|
-
const
|
|
640
|
-
r.innerHTML = "", r.appendChild(
|
|
639
|
+
const o = t(this, $t).call(this, t(this, it), n);
|
|
640
|
+
r.innerHTML = "", r.appendChild(o);
|
|
641
641
|
});
|
|
642
642
|
}, "#renderSplitContainers"));
|
|
643
643
|
c(this, _t, /* @__PURE__ */ a(() => {
|
|
644
644
|
["left", "right"].forEach((e) => {
|
|
645
|
-
const s = this.querySelector(`.ng-container-${e}`),
|
|
646
|
-
if (!s || !
|
|
645
|
+
const s = this.querySelector(`.ng-container-${e}`), n = s == null ? void 0 : s.querySelector("table");
|
|
646
|
+
if (!s || !n) return;
|
|
647
647
|
let r = 0;
|
|
648
|
-
|
|
649
|
-
const l = parseInt(
|
|
648
|
+
n.querySelectorAll("col").forEach((o) => {
|
|
649
|
+
const l = parseInt(o.getAttribute("width"), 10);
|
|
650
650
|
isNaN(r) || (r += l);
|
|
651
651
|
}), s.style.flex = `0 0 ${r}px`, s.style.width = `${r}px`;
|
|
652
652
|
});
|
|
653
653
|
}, "#updateContainerWidths"));
|
|
654
654
|
v(this, "generate", /* @__PURE__ */ a((e) => {
|
|
655
655
|
e && (g(this, it, Kt.compile(e)), t(this, it).style.display = "table", t(this, Ct).call(this), t(this, _t).call(this), requestAnimationFrame(() => {
|
|
656
|
-
var
|
|
657
|
-
const s = (
|
|
656
|
+
var n;
|
|
657
|
+
const s = (n = this.querySelector("thead")) == null ? void 0 : n.getBoundingClientRect().height;
|
|
658
658
|
this.querySelectorAll("tbody.fixed-tbody").forEach((r) => {
|
|
659
659
|
r.style.top = `${s}px`;
|
|
660
660
|
});
|
|
@@ -667,18 +667,18 @@ const lt = class lt extends HTMLElement {
|
|
|
667
667
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
668
668
|
*/
|
|
669
669
|
c(this, $t, /* @__PURE__ */ a((e, s) => {
|
|
670
|
-
const
|
|
670
|
+
const n = e.cloneNode(!0), r = n.querySelector("tbody");
|
|
671
671
|
if (r) {
|
|
672
|
-
const
|
|
673
|
-
|
|
672
|
+
const o = document.createElement("tbody");
|
|
673
|
+
o.className = "fixed-tbody", r.className = "bindable-tbody", r.before(o);
|
|
674
674
|
}
|
|
675
|
-
return s === "left" ?
|
|
676
|
-
|
|
677
|
-
}) : s === "right" ?
|
|
678
|
-
|
|
679
|
-
}) :
|
|
680
|
-
|
|
681
|
-
}),
|
|
675
|
+
return s === "left" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((o) => {
|
|
676
|
+
o.getAttribute("fixed") !== "left" && o.remove();
|
|
677
|
+
}) : s === "right" ? n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((o) => {
|
|
678
|
+
o.getAttribute("fixed") !== "right" && o.remove();
|
|
679
|
+
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((o) => {
|
|
680
|
+
o.remove();
|
|
681
|
+
}), n;
|
|
682
682
|
}, "#createSplitTable"));
|
|
683
683
|
v(this, "getRowHeight", /* @__PURE__ */ a(() => t(this, K).getRowHeight(), "getRowHeight"));
|
|
684
684
|
v(this, "scrollToX", /* @__PURE__ */ a((e) => {
|
|
@@ -689,10 +689,10 @@ const lt = class lt extends HTMLElement {
|
|
|
689
689
|
const s = this.querySelector(".ng-container-body");
|
|
690
690
|
s && (s.scrollTop = e);
|
|
691
691
|
}, "scrollToY"));
|
|
692
|
-
c(this, Mt, /* @__PURE__ */ a(() => {
|
|
693
|
-
t(this, It).call(this);
|
|
694
|
-
}, "#init"));
|
|
695
692
|
c(this, It, /* @__PURE__ */ a(() => {
|
|
693
|
+
t(this, Mt).call(this);
|
|
694
|
+
}, "#init"));
|
|
695
|
+
c(this, Mt, /* @__PURE__ */ a(() => {
|
|
696
696
|
const e = lt.SCROLLBAR_SIZE;
|
|
697
697
|
this.innerHTML = `
|
|
698
698
|
<style>
|
|
@@ -842,13 +842,13 @@ const lt = class lt extends HTMLElement {
|
|
|
842
842
|
g(this, K, new Zt(this)), g(this, Ht, this.getRootNode().host);
|
|
843
843
|
}
|
|
844
844
|
connectedCallback() {
|
|
845
|
-
t(this,
|
|
845
|
+
t(this, It).call(this);
|
|
846
846
|
}
|
|
847
847
|
disconnectedCallback() {
|
|
848
|
-
this.innerHTML = "",
|
|
848
|
+
this.innerHTML = "", z.log("NineTableSheet destroyed.");
|
|
849
849
|
}
|
|
850
850
|
};
|
|
851
|
-
Ht = new WeakMap(), it = new WeakMap(), K = new WeakMap(), Ct = new WeakMap(), _t = new WeakMap(), $t = new WeakMap(),
|
|
851
|
+
Ht = new WeakMap(), it = new WeakMap(), K = new WeakMap(), Ct = new WeakMap(), _t = new WeakMap(), $t = new WeakMap(), It = new WeakMap(), Mt = new WeakMap(), a(lt, "NineTableSheet"), v(lt, "SCROLLBAR_SIZE", 16);
|
|
852
852
|
let xt = lt;
|
|
853
853
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", xt);
|
|
854
854
|
var Wt, gt;
|
|
@@ -858,26 +858,26 @@ const ae = class ae extends HTMLElement {
|
|
|
858
858
|
c(this, Wt, /* @__PURE__ */ a(() => {
|
|
859
859
|
var e;
|
|
860
860
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
861
|
-
var
|
|
862
|
-
const
|
|
863
|
-
t(this, gt).call(this, r,
|
|
861
|
+
var o;
|
|
862
|
+
const n = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((o = s.target.closest(".nine-tab-item")) == null ? void 0 : o.dataset.index, 10);
|
|
863
|
+
t(this, gt).call(this, r, n);
|
|
864
864
|
}), t(this, gt).call(this, 0, !1);
|
|
865
865
|
}, "#init"));
|
|
866
866
|
c(this, gt, /* @__PURE__ */ a((e, s = !1) => {
|
|
867
|
-
const
|
|
867
|
+
const n = /* @__PURE__ */ a(() => {
|
|
868
868
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
869
869
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((y) => y.style.setProperty("display", "none"));
|
|
870
870
|
const b = f.filter((y) => y.classList.contains("active"));
|
|
871
871
|
b.length < 2 || b.forEach((y) => {
|
|
872
|
-
const m = parseInt(y.getAttribute("data-index"), 10), R = this.querySelector(`nine-splitter[data-split-index="${m}"]`),
|
|
873
|
-
R &&
|
|
872
|
+
const m = parseInt(y.getAttribute("data-index"), 10), R = this.querySelector(`nine-splitter[data-split-index="${m}"]`), O = f[m + 1];
|
|
873
|
+
R && O && O.classList.contains("active") && R.style.setProperty("display", "flex");
|
|
874
874
|
});
|
|
875
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"),
|
|
875
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), d = o.querySelectorAll("nine-table-sheet");
|
|
876
876
|
if (!l[e]) return;
|
|
877
877
|
if (!s)
|
|
878
878
|
l.forEach((f, u) => {
|
|
879
879
|
f.classList.toggle("active", u === e);
|
|
880
|
-
}),
|
|
880
|
+
}), d.forEach((f, u) => {
|
|
881
881
|
const b = u === e;
|
|
882
882
|
f.classList.toggle("active", b), f.style.flex = b ? "1 1 100%" : "";
|
|
883
883
|
});
|
|
@@ -886,13 +886,13 @@ const ae = class ae extends HTMLElement {
|
|
|
886
886
|
if (f.classList.contains("active") && u.length <= 1)
|
|
887
887
|
return;
|
|
888
888
|
f.classList.toggle("active");
|
|
889
|
-
const b =
|
|
889
|
+
const b = o.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
890
890
|
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
891
891
|
}
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
f.style.flex =
|
|
895
|
-
}),
|
|
892
|
+
const h = o.querySelectorAll("nine-table-sheet.active");
|
|
893
|
+
h == null || h.forEach((f) => {
|
|
894
|
+
f.style.flex = h.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
895
|
+
}), n();
|
|
896
896
|
}, "#switchSheet"));
|
|
897
897
|
}
|
|
898
898
|
connectedCallback() {
|
|
@@ -902,29 +902,29 @@ const ae = class ae extends HTMLElement {
|
|
|
902
902
|
Wt = new WeakMap(), gt = new WeakMap(), a(ae, "NineTableSheets");
|
|
903
903
|
let Gt = ae;
|
|
904
904
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Gt);
|
|
905
|
-
var
|
|
905
|
+
var q, Ot, bt, zt;
|
|
906
906
|
const ce = class ce {
|
|
907
907
|
constructor(i) {
|
|
908
|
-
c(this,
|
|
908
|
+
c(this, q);
|
|
909
909
|
c(this, Ot, /* @__PURE__ */ a(() => {
|
|
910
910
|
t(this, zt).call(this), new ResizeObserver((i) => {
|
|
911
911
|
for (let e of i)
|
|
912
|
-
t(this,
|
|
913
|
-
}).observe(t(this,
|
|
912
|
+
t(this, q).getAttribute("auto-height") === "true" && t(this, bt).call(this);
|
|
913
|
+
}).observe(t(this, q));
|
|
914
914
|
}, "#init"));
|
|
915
915
|
c(this, bt, /* @__PURE__ */ a(() => {
|
|
916
|
-
var
|
|
917
|
-
const i = Array.from(t(this,
|
|
916
|
+
var d, h;
|
|
917
|
+
const i = Array.from(t(this, q).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
918
918
|
if (i.length === 0) return;
|
|
919
|
-
const e = parseInt(t(this,
|
|
920
|
-
t(this,
|
|
919
|
+
const e = parseInt(t(this, q).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), n = (d = t(this, q).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : d.getBoundingClientRect().height, r = (h = t(this, q).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : h.getBoundingClientRect().height, o = xt.SCROLLBAR_SIZE, l = e * s + n + r + o;
|
|
920
|
+
t(this, q).style.height = `${l}px`;
|
|
921
921
|
}, "#applyAutoHeight"));
|
|
922
922
|
c(this, zt, /* @__PURE__ */ a(() => {
|
|
923
|
-
const e = Array.from(t(this,
|
|
924
|
-
const u = `<nine-table-sheet class="${
|
|
923
|
+
const e = Array.from(t(this, q).children).filter((d) => d.tagName === "TABLE"), s = t(this, q).getAttribute("auto-height") === "true", n = e.length, r = e.map((d, h) => {
|
|
924
|
+
const u = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, b = h < n - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
925
925
|
return u + b;
|
|
926
|
-
}).join(""),
|
|
927
|
-
t(this,
|
|
926
|
+
}).join(""), o = e.map((d, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
927
|
+
t(this, q).shadowRoot.innerHTML = `
|
|
928
928
|
<style>
|
|
929
929
|
:host {
|
|
930
930
|
display: flex;
|
|
@@ -1007,7 +1007,7 @@ const ce = class ce {
|
|
|
1007
1007
|
<nine-table-sheets>
|
|
1008
1008
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
1009
1009
|
<nine-table-sheets-footer>
|
|
1010
|
-
<div class="nine-tab-bar">${
|
|
1010
|
+
<div class="nine-tab-bar">${o}</div>
|
|
1011
1011
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
1012
1012
|
</nine-table-sheets-footer>
|
|
1013
1013
|
</nine-table-sheets>
|
|
@@ -1015,17 +1015,17 @@ const ce = class ce {
|
|
|
1015
1015
|
</nine-table-body>
|
|
1016
1016
|
<nine-table-footer></nine-table-footer>
|
|
1017
1017
|
`;
|
|
1018
|
-
const l = t(this,
|
|
1019
|
-
l == null || l.forEach((
|
|
1020
|
-
e[
|
|
1021
|
-
|
|
1018
|
+
const l = t(this, q).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1019
|
+
l == null || l.forEach((d, h) => {
|
|
1020
|
+
e[h] && setTimeout(() => {
|
|
1021
|
+
d.generate(e[h]), s && t(this, bt).call(this);
|
|
1022
1022
|
});
|
|
1023
1023
|
});
|
|
1024
1024
|
}, "#render"));
|
|
1025
|
-
g(this,
|
|
1025
|
+
g(this, q, i), t(this, Ot).call(this);
|
|
1026
1026
|
}
|
|
1027
1027
|
};
|
|
1028
|
-
|
|
1028
|
+
q = new WeakMap(), Ot = new WeakMap(), bt = new WeakMap(), zt = new WeakMap(), a(ce, "LayoutManager");
|
|
1029
1029
|
let Jt = ce;
|
|
1030
1030
|
var yt, st;
|
|
1031
1031
|
const he = class he {
|
|
@@ -1075,10 +1075,10 @@ const C = class C {
|
|
|
1075
1075
|
if (!s || s.length <= 0) return;
|
|
1076
1076
|
if (i == null) return t(this, ot).call(this, s);
|
|
1077
1077
|
if (i < 0 || i >= s.length) return null;
|
|
1078
|
-
const
|
|
1078
|
+
const n = typeof ((r = t(this, k).fields) == null ? void 0 : r.get) == "function" ? t(this, k).fields.get() : [];
|
|
1079
1079
|
if (e != null) {
|
|
1080
|
-
const
|
|
1081
|
-
return
|
|
1080
|
+
const o = n.indexOf(e);
|
|
1081
|
+
return o >= 0 ? s[i].v[o] : null;
|
|
1082
1082
|
}
|
|
1083
1083
|
return t(this, ot).call(this, s[i]);
|
|
1084
1084
|
}, "get"));
|
|
@@ -1102,14 +1102,14 @@ const C = class C {
|
|
|
1102
1102
|
t(this, E).rawRecords = [], g(this, H, []), g(this, nt, []), (i = t(this, E).viewRecords) != null && i.reset && t(this, E).viewRecords.reset();
|
|
1103
1103
|
}, "clear"));
|
|
1104
1104
|
c(this, Nt, /* @__PURE__ */ a((i) => {
|
|
1105
|
-
var
|
|
1105
|
+
var n;
|
|
1106
1106
|
Array.isArray(i) || (i = [i]);
|
|
1107
|
-
const e = typeof ((
|
|
1107
|
+
const e = typeof ((n = t(this, k).fields) == null ? void 0 : n.get) == "function" ? t(this, k).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1108
1108
|
return i.forEach((r) => {
|
|
1109
|
-
const
|
|
1109
|
+
const o = { v: [] };
|
|
1110
1110
|
e.forEach((l) => {
|
|
1111
|
-
|
|
1112
|
-
}), s.push(
|
|
1111
|
+
o.v.push(r[l] !== void 0 && r[l] !== null ? r[l] : "");
|
|
1112
|
+
}), s.push(o);
|
|
1113
1113
|
}), s;
|
|
1114
1114
|
}, "#json2Array"));
|
|
1115
1115
|
c(this, Pt, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
@@ -1119,32 +1119,32 @@ const C = class C {
|
|
|
1119
1119
|
i === void 0 && (i = {});
|
|
1120
1120
|
const s = t(this, Nt).call(this, i);
|
|
1121
1121
|
t(this, E).rawRecords = t(this, E).rawRecords.concat(t(this, Pt).call(this, s)), this.resetRecords();
|
|
1122
|
-
const
|
|
1123
|
-
return e || s.forEach((r,
|
|
1124
|
-
const l = t(this, E).rawRecords[
|
|
1122
|
+
const n = this.count() - 1;
|
|
1123
|
+
return e || s.forEach((r, o) => {
|
|
1124
|
+
const l = t(this, E).rawRecords[n - o];
|
|
1125
1125
|
l && (l.__ng.rowState = C.ROW_STATE.EMPTY);
|
|
1126
|
-
}), t(this, Z).call(this),
|
|
1126
|
+
}), t(this, Z).call(this), n;
|
|
1127
1127
|
}, "add"));
|
|
1128
1128
|
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
1129
1129
|
let e = [];
|
|
1130
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s,
|
|
1130
|
+
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s, n) => n - s).forEach((s) => {
|
|
1131
1131
|
if (t(this, H)[s]) {
|
|
1132
|
-
const
|
|
1133
|
-
t(this, H)[s].__ng.rowState === C.ROW_STATE.INSERT ? t(this, E).rawRecords = t(this, E).rawRecords.filter((r) => r.__ng.rowid !==
|
|
1134
|
-
r.__ng.rowid ===
|
|
1132
|
+
const n = t(this, H)[s].__ng.rowid;
|
|
1133
|
+
t(this, H)[s].__ng.rowState === C.ROW_STATE.INSERT ? t(this, E).rawRecords = t(this, E).rawRecords.filter((r) => r.__ng.rowid !== n) : t(this, E).rawRecords.forEach((r) => {
|
|
1134
|
+
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState = C.ROW_STATE.DELETE);
|
|
1135
1135
|
});
|
|
1136
1136
|
}
|
|
1137
1137
|
}), this.resetRecords(), t(this, Z).call(this);
|
|
1138
1138
|
}, "delete"));
|
|
1139
1139
|
v(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
|
|
1140
|
-
var
|
|
1140
|
+
var d;
|
|
1141
1141
|
i = parseInt(i, 10);
|
|
1142
|
-
const r = (typeof ((
|
|
1142
|
+
const r = (typeof ((d = t(this, k).fields) == null ? void 0 : d.get) == "function" ? t(this, k).fields.get() : []).indexOf(e);
|
|
1143
1143
|
if (r < 0) return;
|
|
1144
|
-
const
|
|
1145
|
-
if (!
|
|
1146
|
-
const l =
|
|
1147
|
-
l !== s &&
|
|
1144
|
+
const o = this.getValidData()[i];
|
|
1145
|
+
if (!o) return;
|
|
1146
|
+
const l = o.v[r];
|
|
1147
|
+
l !== s && o.__ng.rowState !== C.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = l), o.__ng.rowState = C.ROW_STATE.UPDATE), o.v[r] = s;
|
|
1148
1148
|
}, "setValue"));
|
|
1149
1149
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1150
1150
|
g(this, nt, t(this, E).rawRecords.filter((i) => !i.__ng.deleted)), g(this, H, t(this, E).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, E).rawRecords.forEach((i, e) => {
|
|
@@ -1155,13 +1155,13 @@ const C = class C {
|
|
|
1155
1155
|
}, "resetRecords"));
|
|
1156
1156
|
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this, H).length === 0 && t(this, E).rawRecords.length > 0 && this.resetRecords(), t(this, H)), "getValidData"));
|
|
1157
1157
|
c(this, ot, /* @__PURE__ */ a((i) => {
|
|
1158
|
-
var
|
|
1158
|
+
var o;
|
|
1159
1159
|
if (!i) return i;
|
|
1160
|
-
const e = !Array.isArray(i), s = e ? [i] : i,
|
|
1161
|
-
const
|
|
1162
|
-
return
|
|
1163
|
-
h
|
|
1164
|
-
}),
|
|
1160
|
+
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this, k).fields) == null ? void 0 : o.get) == "function" ? t(this, k).fields.get() : [], r = s.filter((l) => !l.__ng.deleted).map((l) => {
|
|
1161
|
+
const d = {};
|
|
1162
|
+
return n.forEach((h, f) => {
|
|
1163
|
+
d[h] = l.v ? l.v[f] : l[h];
|
|
1164
|
+
}), d.__ng = l.__ng, d;
|
|
1165
1165
|
});
|
|
1166
1166
|
return e ? r[0] : r;
|
|
1167
1167
|
}, "#conv"));
|
|
@@ -1203,14 +1203,14 @@ const de = class de {
|
|
|
1203
1203
|
}, this.setDataSource = (e) => {
|
|
1204
1204
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1205
1205
|
}, this.getRowState = (e) => {
|
|
1206
|
-
var
|
|
1206
|
+
var n, r;
|
|
1207
1207
|
const s = parseInt(e, 10);
|
|
1208
1208
|
if (!(s >= this.data.count()))
|
|
1209
|
-
return (r = (
|
|
1209
|
+
return (r = (n = this.data.getValidData()[s]) == null ? void 0 : n.__ng) == null ? void 0 : r.rowState;
|
|
1210
1210
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (e) => {
|
|
1211
1211
|
this.row.at = e;
|
|
1212
|
-
}, 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,
|
|
1213
|
-
e = parseInt(e, 10), this.data.setValue(e, s,
|
|
1212
|
+
}, 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, n) => {
|
|
1213
|
+
e = parseInt(e, 10), this.data.setValue(e, s, n);
|
|
1214
1214
|
}, this.setDataSource([]);
|
|
1215
1215
|
}
|
|
1216
1216
|
};
|
|
@@ -1224,7 +1224,7 @@ const fe = class fe {
|
|
|
1224
1224
|
c(this, A, []);
|
|
1225
1225
|
v(this, "add", /* @__PURE__ */ a((i, e = "string") => {
|
|
1226
1226
|
i.forEach((s) => {
|
|
1227
|
-
t(this, A).some((
|
|
1227
|
+
t(this, A).some((n) => n.name === s) || t(this, A).push({ name: s, type: e });
|
|
1228
1228
|
}), t(this, mt).call(this);
|
|
1229
1229
|
}, "add"));
|
|
1230
1230
|
c(this, mt, /* @__PURE__ */ a(() => {
|
|
@@ -1234,30 +1234,30 @@ const fe = class fe {
|
|
|
1234
1234
|
}), g(this, A, Array.from(i, ([e, s]) => ({ name: e, type: s }))), g(this, A, t(this, A).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, A).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1235
1235
|
}, "#adjust"));
|
|
1236
1236
|
c(this, Vt, /* @__PURE__ */ a(() => {
|
|
1237
|
-
g(this, A, []),
|
|
1237
|
+
g(this, A, []), z.log(t(this, rt).querySelectorAll("table"));
|
|
1238
1238
|
const i = Array.from(t(this, rt).querySelectorAll("table"));
|
|
1239
1239
|
if (!(!i || i.length === 0)) {
|
|
1240
1240
|
for (const e of i)
|
|
1241
|
-
|
|
1242
|
-
const r =
|
|
1243
|
-
r && t(this, A).push({ name: r, type:
|
|
1241
|
+
z.log(e), $("[data-bind]", e).each((s, n) => {
|
|
1242
|
+
const r = n.dataset.bind, o = n.getAttribute("data-type") || "string";
|
|
1243
|
+
r && t(this, A).push({ name: r, type: o });
|
|
1244
1244
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
1245
|
-
$(`[${s}]`, e).each((
|
|
1246
|
-
var
|
|
1247
|
-
if (
|
|
1248
|
-
const l =
|
|
1245
|
+
$(`[${s}]`, e).each((n, r) => {
|
|
1246
|
+
var o = r.getAttribute(s);
|
|
1247
|
+
if (o.indexOf("data.") < 0) {
|
|
1248
|
+
const l = o.search(/[(]/g);
|
|
1249
1249
|
if (l > 0)
|
|
1250
1250
|
try {
|
|
1251
|
-
|
|
1251
|
+
o = String(window[o.substring(0, l).trim()]);
|
|
1252
1252
|
} catch {
|
|
1253
|
-
|
|
1253
|
+
o = "";
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
|
-
|
|
1256
|
+
o.split("data.").forEach((l) => {
|
|
1257
1257
|
if (l.trim() != "") {
|
|
1258
|
-
const
|
|
1259
|
-
let
|
|
1260
|
-
|
|
1258
|
+
const d = l.search(/[^_A-Za-z0-9]/g);
|
|
1259
|
+
let h = "";
|
|
1260
|
+
d >= 0 ? h = l.substring(0, d) : o.startsWith("data.") && (h = l.replace("data.", "")), h && t(this, A).push({ name: h, type: "string" });
|
|
1261
1261
|
}
|
|
1262
1262
|
});
|
|
1263
1263
|
});
|
|
@@ -1297,7 +1297,7 @@ const ue = class ue extends HTMLElement {
|
|
|
1297
1297
|
c(this, J);
|
|
1298
1298
|
c(this, Yt);
|
|
1299
1299
|
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1300
|
-
this.fields = new ie(this), g(this, Yt, new Jt(this)),
|
|
1300
|
+
this.fields = new ie(this), g(this, Yt, new Jt(this)), z.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1301
1301
|
}, "#init"));
|
|
1302
1302
|
this.attachShadow({ mode: "open" }), g(this, J, new ee(this));
|
|
1303
1303
|
}
|
|
@@ -1305,7 +1305,7 @@ const ue = class ue extends HTMLElement {
|
|
|
1305
1305
|
t(this, Xt).call(this);
|
|
1306
1306
|
}
|
|
1307
1307
|
disconnectedCallback() {
|
|
1308
|
-
|
|
1308
|
+
z.log("NineTable disconnected.");
|
|
1309
1309
|
}
|
|
1310
1310
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1311
1311
|
get data() {
|