@ninebone/table 0.0.338 β 0.0.339
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 +239 -239
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +4 -4
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -7,8 +7,8 @@ var c = (m, i) => se(m, "name", { value: i, configurable: !0 });
|
|
|
7
7
|
var x = (m, i, e) => le(m, typeof i != "symbol" ? i + "" : i, e), oe = (m, i, e) => i.has(m) || ne("Cannot " + e);
|
|
8
8
|
var t = (m, i, e) => (oe(m, i, "read from private field"), e ? e.call(m) : i.get(m)), a = (m, i, e) => i.has(m) ? ne("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(m) : i.set(m, e), g = (m, i, e, s) => (oe(m, i, "write to private field"), s ? s.call(m, e) : i.set(m, e), e);
|
|
9
9
|
var re = (m, i, e, s) => ({
|
|
10
|
-
set _(
|
|
11
|
-
g(m, i,
|
|
10
|
+
set _(o) {
|
|
11
|
+
g(m, i, o, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
14
|
return t(m, i, s);
|
|
@@ -22,13 +22,13 @@ const Kt = class Kt extends ce.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
c(Kt, "Trace");
|
|
24
24
|
let zt = Kt;
|
|
25
|
-
const
|
|
26
|
-
var C,
|
|
25
|
+
const z = new zt();
|
|
26
|
+
var C, M, y, O, D, N, bt, B, gt;
|
|
27
27
|
const jt = class jt extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
a(this, C);
|
|
31
|
-
a(this,
|
|
31
|
+
a(this, M, !1);
|
|
32
32
|
a(this, y);
|
|
33
33
|
a(this, O);
|
|
34
34
|
a(this, D);
|
|
@@ -41,17 +41,17 @@ const jt = class jt extends HTMLElement {
|
|
|
41
41
|
})), t(this, N).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
x(this, "refresh", /* @__PURE__ */ c(() => {
|
|
44
|
-
if (!t(this, C) || !t(this, y) || t(this,
|
|
44
|
+
if (!t(this, C) || !t(this, y) || t(this, M)) return;
|
|
45
45
|
const e = t(this, y).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const
|
|
47
|
+
const o = t(this, y).track, r = t(this, y).thumb, n = t(this, C).querySelector(".ng-container-bottom"), l = e.clientWidth, h = s.scrollWidth;
|
|
48
48
|
if (l !== 0 && h > l)
|
|
49
|
-
|
|
49
|
+
n && (n.style.display = "flex");
|
|
50
50
|
else {
|
|
51
|
-
|
|
51
|
+
n && (n.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const d =
|
|
54
|
+
const d = o.clientWidth;
|
|
55
55
|
if (d <= 0) return;
|
|
56
56
|
const f = Math.max(Math.min(d * (l / h), d), 20);
|
|
57
57
|
r.style.width = `${f}px`;
|
|
@@ -59,55 +59,55 @@ const jt = class jt extends HTMLElement {
|
|
|
59
59
|
let p = 0;
|
|
60
60
|
b > 0 && (p = parseInt(u / b * (d - f), 10)), p < 0 && (p = 0);
|
|
61
61
|
const E = d - f;
|
|
62
|
-
p > E && (p = E), r.style.left = `${p}px`,
|
|
62
|
+
p > E && (p = E), r.style.left = `${p}px`, z.log(p), t(this, y).left.disabled = p === 0, t(this, y).right.disabled = p >= E - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
a(this, B, /* @__PURE__ */ c((e) => {
|
|
65
65
|
if (!t(this, y)) return !1;
|
|
66
|
-
const s = t(this, y).container,
|
|
67
|
-
if (!
|
|
68
|
-
const r = t(this, y).track.getBoundingClientRect(),
|
|
66
|
+
const s = t(this, y).container, o = s.querySelector("table");
|
|
67
|
+
if (!o) return !1;
|
|
68
|
+
const r = t(this, y).track.getBoundingClientRect(), n = t(this, y).thumb.clientWidth;
|
|
69
69
|
let l = e;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
|
-
const h = r.width -
|
|
71
|
+
const h = r.width - n;
|
|
72
72
|
l > h && (l = h), l = parseInt(l, 10), t(this, y).thumb.style.left = `${l}px`, t(this, y).left.disabled = l === 0, t(this, y).right.disabled = l >= h - 1;
|
|
73
|
-
const d = s.clientWidth, u =
|
|
73
|
+
const d = s.clientWidth, u = o.scrollWidth - d;
|
|
74
74
|
return h > 0 && u > 0 && (s.scrollLeft = l / h * u), l > 0 && l < h - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
a(this, gt, /* @__PURE__ */ c(() => {
|
|
77
|
-
const e = /* @__PURE__ */ c((
|
|
77
|
+
const e = /* @__PURE__ */ c((o) => {
|
|
78
78
|
clearInterval(t(this, O)), clearInterval(t(this, D));
|
|
79
79
|
const r = parseInt(t(this, y).thumb.style.left || 0, 10);
|
|
80
|
-
t(this, B).call(this, r +
|
|
80
|
+
t(this, B).call(this, r + o), g(this, O, setInterval(() => {
|
|
81
81
|
clearInterval(t(this, O)), g(this, D, setInterval(() => {
|
|
82
|
-
const
|
|
83
|
-
t(this, B).call(this,
|
|
82
|
+
const n = parseInt(t(this, y).thumb.style.left || 0, 10);
|
|
83
|
+
t(this, B).call(this, n + o) || clearInterval(t(this, D));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ c(() => {
|
|
87
87
|
clearInterval(t(this, O)), clearInterval(t(this, D));
|
|
88
88
|
}, "clearTimer");
|
|
89
|
-
["mouseup", "mouseleave", "touchend"].forEach((
|
|
90
|
-
t(this, y).left.addEventListener(
|
|
91
|
-
}), t(this, y).left.addEventListener("mousedown", (
|
|
92
|
-
|
|
93
|
-
}), t(this, y).right.addEventListener("mousedown", (
|
|
94
|
-
|
|
95
|
-
}), t(this, y).left.addEventListener("touchstart", () => e(-20)), t(this, y).right.addEventListener("touchstart", () => e(20)), t(this, y).track.addEventListener("mousedown", (
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
const r = t(this, y).track.getBoundingClientRect(),
|
|
99
|
-
t(this, B).call(this,
|
|
100
|
-
}), t(this, y).thumb.addEventListener("mousedown", (
|
|
101
|
-
if (
|
|
102
|
-
|
|
89
|
+
["mouseup", "mouseleave", "touchend"].forEach((o) => {
|
|
90
|
+
t(this, y).left.addEventListener(o, s), t(this, y).right.addEventListener(o, s), t(this, y).track.addEventListener(o, s);
|
|
91
|
+
}), t(this, y).left.addEventListener("mousedown", (o) => {
|
|
92
|
+
o.button === 0 && e(-20);
|
|
93
|
+
}), t(this, y).right.addEventListener("mousedown", (o) => {
|
|
94
|
+
o.button === 0 && e(20);
|
|
95
|
+
}), t(this, y).left.addEventListener("touchstart", () => e(-20)), t(this, y).right.addEventListener("touchstart", () => e(20)), t(this, y).track.addEventListener("mousedown", (o) => {
|
|
96
|
+
if (o.button !== 0) return;
|
|
97
|
+
o.preventDefault();
|
|
98
|
+
const r = t(this, y).track.getBoundingClientRect(), n = t(this, y).thumb.clientWidth;
|
|
99
|
+
t(this, B).call(this, o.clientX - r.left - n / 2);
|
|
100
|
+
}), t(this, y).thumb.addEventListener("mousedown", (o) => {
|
|
101
|
+
if (o.button !== 0) return;
|
|
102
|
+
o.stopPropagation(), o.preventDefault(), g(this, M, !0), this.shiftX = o.clientX - t(this, y).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ c((l) => {
|
|
104
|
-
if (!t(this,
|
|
104
|
+
if (!t(this, M)) return;
|
|
105
105
|
const h = t(this, y).track.getBoundingClientRect();
|
|
106
106
|
t(this, B).call(this, l.clientX - h.left - this.shiftX);
|
|
107
|
-
}, "onMouseMove"),
|
|
108
|
-
g(this,
|
|
107
|
+
}, "onMouseMove"), n = /* @__PURE__ */ c(() => {
|
|
108
|
+
g(this, M, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", n), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup",
|
|
110
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", n);
|
|
111
111
|
});
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
@@ -189,7 +189,7 @@ const jt = class jt extends HTMLElement {
|
|
|
189
189
|
left: this.querySelector(".ng-scroll-left"),
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), s.addEventListener("scroll", () => {
|
|
192
|
-
t(this,
|
|
192
|
+
t(this, M) || this.refresh();
|
|
193
193
|
}), t(this, gt).call(this), t(this, bt).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
@@ -198,15 +198,15 @@ const jt = class jt extends HTMLElement {
|
|
|
198
198
|
t(this, N) && t(this, N).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
C = new WeakMap(),
|
|
201
|
+
C = new WeakMap(), M = new WeakMap(), y = new WeakMap(), O = new WeakMap(), D = new WeakMap(), N = new WeakMap(), bt = new WeakMap(), B = new WeakMap(), gt = new WeakMap(), c(jt, "NineTableHScrollBar");
|
|
202
202
|
let Ot = jt;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Ot);
|
|
204
|
-
var P,
|
|
204
|
+
var P, I, v, st, nt, yt;
|
|
205
205
|
const Zt = class Zt extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
208
|
a(this, P);
|
|
209
|
-
a(this,
|
|
209
|
+
a(this, I, !1);
|
|
210
210
|
a(this, v);
|
|
211
211
|
a(this, st, 0);
|
|
212
212
|
a(this, nt, 0);
|
|
@@ -214,20 +214,20 @@ const Zt = class Zt extends HTMLElement {
|
|
|
214
214
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
215
215
|
*/
|
|
216
216
|
x(this, "refresh", /* @__PURE__ */ c(() => {
|
|
217
|
-
if (!t(this, P) || !t(this, v) || t(this,
|
|
217
|
+
if (!t(this, P) || !t(this, v) || t(this, I)) return;
|
|
218
218
|
const e = t(this, v).container, s = e.querySelector("table");
|
|
219
219
|
if (!s) return;
|
|
220
|
-
const
|
|
221
|
-
if (l <=
|
|
220
|
+
const o = t(this, v).track, r = t(this, v).thumb, n = e.clientHeight, l = s.scrollHeight;
|
|
221
|
+
if (l <= n) {
|
|
222
222
|
r.style.display = "none", t(this, v).top.disabled = !0, t(this, v).bottom.disabled = !0;
|
|
223
223
|
return;
|
|
224
224
|
} else
|
|
225
225
|
r.style.display = "block";
|
|
226
|
-
const h =
|
|
226
|
+
const h = o.clientHeight;
|
|
227
227
|
if (h <= 0) return;
|
|
228
|
-
const d = Math.max(Math.min(h * (
|
|
228
|
+
const d = Math.max(Math.min(h * (n / l), h), 20);
|
|
229
229
|
r.style.height = `${d}px`;
|
|
230
|
-
const f = e.scrollTop, u = l -
|
|
230
|
+
const f = e.scrollTop, u = l - n;
|
|
231
231
|
let b = 0;
|
|
232
232
|
u > 0 && (b = f / u * (h - d));
|
|
233
233
|
const p = h - d;
|
|
@@ -236,14 +236,14 @@ const Zt = class Zt extends HTMLElement {
|
|
|
236
236
|
a(this, yt, /* @__PURE__ */ c(() => {
|
|
237
237
|
const e = t(this, v).container;
|
|
238
238
|
e.addEventListener("scroll", () => {
|
|
239
|
-
t(this,
|
|
239
|
+
t(this, I) || this.refresh();
|
|
240
240
|
}), t(this, v).thumb.addEventListener("mousedown", (s) => {
|
|
241
241
|
if (s.button !== 0) return;
|
|
242
|
-
s.stopPropagation(), s.preventDefault(), g(this,
|
|
243
|
-
const
|
|
244
|
-
if (!t(this,
|
|
245
|
-
const l = t(this, v).track.getBoundingClientRect(), h = t(this, v).thumb.clientHeight, f = l.height - h, u =
|
|
246
|
-
|
|
242
|
+
s.stopPropagation(), s.preventDefault(), g(this, I, !0), g(this, st, s.clientY), g(this, nt, e.scrollTop);
|
|
243
|
+
const o = /* @__PURE__ */ c((n) => {
|
|
244
|
+
if (!t(this, I)) return;
|
|
245
|
+
const l = t(this, v).track.getBoundingClientRect(), h = t(this, v).thumb.clientHeight, f = l.height - h, u = n.clientY - t(this, st), b = e.clientHeight, p = e.querySelector("table");
|
|
246
|
+
z.log(p), z.log(p.scrollHeight);
|
|
247
247
|
const L = p.scrollHeight - b;
|
|
248
248
|
if (f > 0 && L > 0) {
|
|
249
249
|
const ft = u / f * L;
|
|
@@ -251,14 +251,14 @@ const Zt = class Zt extends HTMLElement {
|
|
|
251
251
|
}
|
|
252
252
|
this.refresh();
|
|
253
253
|
}, "onMouseMove"), r = /* @__PURE__ */ c(() => {
|
|
254
|
-
g(this,
|
|
254
|
+
g(this, I, !1), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
255
255
|
}, "onMouseUp");
|
|
256
|
-
document.addEventListener("mousemove",
|
|
256
|
+
document.addEventListener("mousemove", o), document.addEventListener("mouseup", r);
|
|
257
257
|
}), t(this, v).track.addEventListener("mousedown", (s) => {
|
|
258
258
|
if (s.button !== 0 || s.target === t(this, v).thumb) return;
|
|
259
|
-
const
|
|
259
|
+
const o = t(this, v).track.getBoundingClientRect(), r = t(this, v).thumb.clientHeight, n = s.clientY - o.top - r / 2, h = o.height - r, d = e.clientHeight, u = e.querySelector("table").scrollHeight - d;
|
|
260
260
|
if (h > 0 && u > 0) {
|
|
261
|
-
const b = Math.max(0, Math.min(1,
|
|
261
|
+
const b = Math.max(0, Math.min(1, n / h));
|
|
262
262
|
e.scrollTop = b * u;
|
|
263
263
|
}
|
|
264
264
|
this.refresh();
|
|
@@ -351,10 +351,10 @@ const Zt = class Zt extends HTMLElement {
|
|
|
351
351
|
e();
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
|
-
P = new WeakMap(),
|
|
354
|
+
P = new WeakMap(), I = new WeakMap(), v = new WeakMap(), st = new WeakMap(), nt = new WeakMap(), yt = new WeakMap(), c(Zt, "NineTableVScrollBar");
|
|
355
355
|
let Dt = Zt;
|
|
356
356
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", Dt);
|
|
357
|
-
var pt,
|
|
357
|
+
var pt, j;
|
|
358
358
|
const H = class H {
|
|
359
359
|
/**
|
|
360
360
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
@@ -366,10 +366,10 @@ const H = class H {
|
|
|
366
366
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
367
367
|
*/
|
|
368
368
|
static compile(i) {
|
|
369
|
-
var
|
|
369
|
+
var o, r, n, l;
|
|
370
370
|
if (!i) return null;
|
|
371
371
|
const e = i.cloneNode(!0);
|
|
372
|
-
return t(
|
|
372
|
+
return t(o = H, pt).call(o, e), t(r = H, j).call(r, e, "thead"), t(n = H, j).call(n, e, "tbody"), t(l = H, j).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((h, d) => {
|
|
373
373
|
const f = h.getAttribute("fixed");
|
|
374
374
|
f && e.querySelectorAll(`thead [data-col="${d}"], tbody [data-col="${d}"], tfoot [data-col="${d}"]`).forEach((u) => {
|
|
375
375
|
u.setAttribute("fixed", f);
|
|
@@ -377,28 +377,28 @@ const H = class H {
|
|
|
377
377
|
}), e;
|
|
378
378
|
}
|
|
379
379
|
};
|
|
380
|
-
pt = new WeakMap(),
|
|
380
|
+
pt = new WeakMap(), j = new WeakMap(), c(H, "TableCompiler"), a(H, pt, /* @__PURE__ */ c((i) => {
|
|
381
381
|
if (!i.querySelector("colgroup")) {
|
|
382
|
-
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1,
|
|
383
|
-
for (let
|
|
382
|
+
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, o = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
383
|
+
for (let n = 0; n < s; n++) {
|
|
384
384
|
const l = document.createElement("col");
|
|
385
|
-
l.setAttribute("width", r),
|
|
385
|
+
l.setAttribute("width", r), o.appendChild(l);
|
|
386
386
|
}
|
|
387
|
-
i.prepend(
|
|
387
|
+
i.prepend(o);
|
|
388
388
|
}
|
|
389
389
|
if (!i.querySelector("thead")) {
|
|
390
390
|
const e = document.createElement("thead"), s = i.querySelector("colgroup");
|
|
391
391
|
s ? s.after(e) : i.prepend(e);
|
|
392
392
|
}
|
|
393
393
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
394
|
-
}, "#ensureTableStructure")), a(H,
|
|
395
|
-
const s = Array.from(i.querySelectorAll(e + " tr")),
|
|
396
|
-
if (r === 0 ||
|
|
397
|
-
let
|
|
398
|
-
|
|
399
|
-
|
|
394
|
+
}, "#ensureTableStructure")), a(H, j, /* @__PURE__ */ c((i, e) => {
|
|
395
|
+
const s = Array.from(i.querySelectorAll(e + " tr")), o = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
396
|
+
if (r === 0 || o.length === 0) return;
|
|
397
|
+
let n = 0;
|
|
398
|
+
o.forEach((h) => {
|
|
399
|
+
n += h.colSpan || 1;
|
|
400
400
|
});
|
|
401
|
-
const l = Array.from(Array(r), () => Array(
|
|
401
|
+
const l = Array.from(Array(r), () => Array(n).fill(null));
|
|
402
402
|
s.forEach((h) => {
|
|
403
403
|
const d = h.sectionRowIndex;
|
|
404
404
|
let f = 0;
|
|
@@ -411,7 +411,7 @@ pt = new WeakMap(), Z = new WeakMap(), c(H, "TableCompiler"), a(H, pt, /* @__PUR
|
|
|
411
411
|
const b = u.rowSpan || 1, p = u.colSpan || 1;
|
|
412
412
|
for (let E = 0; E < b; E++)
|
|
413
413
|
for (let L = 0; L < p; L++)
|
|
414
|
-
d + E < r && f + L <
|
|
414
|
+
d + E < r && f + L < n && (l[d + E][f + L] = E === 0 && L === 0 ? "1" : "0");
|
|
415
415
|
});
|
|
416
416
|
}), s.forEach((h) => {
|
|
417
417
|
const d = h.sectionRowIndex;
|
|
@@ -425,123 +425,123 @@ pt = new WeakMap(), Z = new WeakMap(), c(H, "TableCompiler"), a(H, pt, /* @__PUR
|
|
|
425
425
|
});
|
|
426
426
|
}, "#resetColIndex"));
|
|
427
427
|
let Nt = H;
|
|
428
|
-
var Y, w,
|
|
428
|
+
var Y, w, _, R, $, V, Z, mt, xt, ot, rt, vt, wt, lt, G, St;
|
|
429
429
|
const Gt = class Gt {
|
|
430
430
|
constructor(i) {
|
|
431
431
|
a(this, Y);
|
|
432
432
|
a(this, w);
|
|
433
|
-
a(this,
|
|
433
|
+
a(this, _, /* @__PURE__ */ new Map());
|
|
434
434
|
a(this, R, null);
|
|
435
|
-
a(this,
|
|
435
|
+
a(this, $, null);
|
|
436
436
|
a(this, V, 0);
|
|
437
|
-
a(this,
|
|
437
|
+
a(this, Z, 40);
|
|
438
438
|
x(this, "refresh", /* @__PURE__ */ c(() => {
|
|
439
439
|
var e;
|
|
440
440
|
const i = t(this, w).querySelector(".ng-container-body");
|
|
441
|
-
i && (t(this, ot).call(this), t(this,
|
|
441
|
+
i && (t(this, ot).call(this), t(this, G).call(this, i.scrollTop), (e = t(this, w).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
442
442
|
}, "refresh"));
|
|
443
443
|
x(this, "initialize", /* @__PURE__ */ c(() => {
|
|
444
|
-
g(this, R, null), t(this,
|
|
445
|
-
const r = t(this, w).querySelector(
|
|
444
|
+
g(this, R, null), t(this, _).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
445
|
+
const r = t(this, w).querySelector(o);
|
|
446
446
|
if (!r) return;
|
|
447
|
-
const
|
|
448
|
-
if (!
|
|
449
|
-
const l =
|
|
447
|
+
const n = r.querySelector("table");
|
|
448
|
+
if (!n) return;
|
|
449
|
+
const l = n.querySelector("tbody.bindable-tbody");
|
|
450
450
|
if (!l) return;
|
|
451
451
|
const d = Array.from(l.querySelectorAll("tr")).map((f) => f.cloneNode(!0));
|
|
452
|
-
t(this,
|
|
452
|
+
t(this, _).set(o, d);
|
|
453
453
|
});
|
|
454
454
|
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");
|
|
455
455
|
if (i) {
|
|
456
|
-
t(this, xt).call(this, i), t(this, lt).call(this), t(this, ot).call(this), t(this,
|
|
457
|
-
let
|
|
458
|
-
const r = /* @__PURE__ */ c((
|
|
456
|
+
t(this, xt).call(this, i), t(this, lt).call(this), t(this, ot).call(this), t(this, G).call(this, i.scrollTop);
|
|
457
|
+
let o = i.scrollTop;
|
|
458
|
+
const r = /* @__PURE__ */ c((n) => {
|
|
459
459
|
var l;
|
|
460
|
-
e && e.scrollTop !==
|
|
460
|
+
e && e.scrollTop !== n && (e.scrollTop = n), s && s.scrollTop !== n && (s.scrollTop = n), t(this, G).call(this, n), (l = t(this, w).querySelector("nine-table-vscrollbar")) == null || l.refresh();
|
|
461
461
|
}, "syncScroll");
|
|
462
462
|
i.addEventListener("scroll", () => {
|
|
463
|
-
const
|
|
464
|
-
|
|
463
|
+
const n = i.scrollTop;
|
|
464
|
+
o !== n && (o = n, r(n));
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
}, "initialize"));
|
|
468
468
|
a(this, mt, /* @__PURE__ */ c((i, e) => {
|
|
469
|
-
const s = t(this,
|
|
469
|
+
const s = t(this, _).get(e);
|
|
470
470
|
if (!s || s.length === 0) return;
|
|
471
|
-
const
|
|
472
|
-
if (!
|
|
473
|
-
|
|
474
|
-
const r =
|
|
475
|
-
for (let l = 0; l < t(this,
|
|
471
|
+
const o = i.querySelector("tbody.bindable-tbody");
|
|
472
|
+
if (!o) return;
|
|
473
|
+
o.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
474
|
+
const r = o.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
475
|
+
for (let l = 0; l < t(this, Z); l++)
|
|
476
476
|
s.forEach((h) => {
|
|
477
|
-
|
|
477
|
+
n.appendChild(h.cloneNode(!0));
|
|
478
478
|
});
|
|
479
|
-
r ? r.before(
|
|
479
|
+
r ? r.before(n) : o.appendChild(n);
|
|
480
480
|
}, "#renderRows"));
|
|
481
481
|
a(this, xt, /* @__PURE__ */ c((i) => {
|
|
482
482
|
if (t(this, R) !== null && t(this, R) > 0)
|
|
483
483
|
return t(this, R);
|
|
484
|
-
const e = t(this,
|
|
484
|
+
const e = t(this, _).get(".ng-container-body");
|
|
485
485
|
if (!e || e.length === 0) return 24;
|
|
486
486
|
const s = i.querySelector("tbody.bindable-tbody") || i.querySelector("tbody.bindable-tbody:last-of-type");
|
|
487
487
|
if (!s) return 24;
|
|
488
488
|
s.querySelectorAll("tr:not(.nodata)").forEach((b) => b.remove());
|
|
489
|
-
const
|
|
489
|
+
const o = s.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
490
490
|
e.forEach((b) => {
|
|
491
491
|
r.appendChild(b.cloneNode(!0));
|
|
492
|
-
}),
|
|
493
|
-
const
|
|
494
|
-
(l === "none" || window.getComputedStyle(
|
|
492
|
+
}), o ? o.before(r) : s.appendChild(r);
|
|
493
|
+
const n = t(this, w), l = n.style.display, h = n.style.visibility, d = n.style.position;
|
|
494
|
+
(l === "none" || window.getComputedStyle(n).display === "none") && (n.style.display = "block", n.style.visibility = "hidden", n.style.position = "absolute");
|
|
495
495
|
let f = 0;
|
|
496
496
|
const u = s.querySelectorAll("tr:not(.nodata)");
|
|
497
497
|
return u.forEach((b) => {
|
|
498
498
|
f += b.offsetHeight || b.getBoundingClientRect().height;
|
|
499
|
-
}), u.forEach((b) => b.remove()),
|
|
499
|
+
}), u.forEach((b) => b.remove()), n.style.display = l, n.style.visibility = h, n.style.position = d, g(this, R, f > 0 ? f : 24), t(this, rt).call(this), t(this, R);
|
|
500
500
|
}, "#measureAndCacheHeight"));
|
|
501
501
|
a(this, ot, /* @__PURE__ */ c(() => {
|
|
502
502
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
503
|
-
const e = t(this, Y).data.get() || [], s = e.length > 0 ? e.length : 100,
|
|
504
|
-
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
505
|
-
const l = t(this, w).querySelector(
|
|
503
|
+
const e = t(this, Y).data.get() || [], s = e.length > 0 ? e.length : 100, o = t(this, R), r = s * o;
|
|
504
|
+
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
505
|
+
const l = t(this, w).querySelector(n), h = l == null ? void 0 : l.querySelector("table");
|
|
506
506
|
h && (h.style.height = `${r}px`);
|
|
507
507
|
});
|
|
508
508
|
}, "#updateVirtualScrollHeight"));
|
|
509
509
|
a(this, rt, /* @__PURE__ */ c(() => {
|
|
510
510
|
if (t(this, V) > 0 && t(this, R) > 0) {
|
|
511
511
|
const i = Math.ceil(t(this, V) / t(this, R));
|
|
512
|
-
g(this,
|
|
512
|
+
g(this, Z, i + 20);
|
|
513
513
|
} else
|
|
514
|
-
g(this,
|
|
514
|
+
g(this, Z, 40);
|
|
515
515
|
}, "#updateRowCount"));
|
|
516
516
|
a(this, vt, /* @__PURE__ */ c(() => {
|
|
517
517
|
var h, d, f;
|
|
518
518
|
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");
|
|
519
519
|
if (!e) return;
|
|
520
|
-
const
|
|
520
|
+
const o = i ? Array.from(i.querySelectorAll("tr")) : [], r = Array.from(e.querySelectorAll("tr")), n = s ? Array.from(s.querySelectorAll("tr")) : [], l = Math.max(o.length, r.length, n.length);
|
|
521
521
|
for (let u = 0; u < l; u++) {
|
|
522
522
|
const b = [
|
|
523
|
-
((h =
|
|
523
|
+
((h = o[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
524
524
|
((d = r[u]) == null ? void 0 : d.getBoundingClientRect().height) || 0,
|
|
525
|
-
((f =
|
|
525
|
+
((f = n[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
526
526
|
], p = Math.max(...b);
|
|
527
|
-
p > 0 && (
|
|
527
|
+
p > 0 && (o[u] && (o[u].style.height = `${p}px`), r[u] && (r[u].style.height = `${p}px`), n[u] && (n[u].style.height = `${p}px`));
|
|
528
528
|
}
|
|
529
529
|
}, "#syncRowHeights"));
|
|
530
530
|
a(this, wt, /* @__PURE__ */ c(() => {
|
|
531
|
-
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (g(this,
|
|
531
|
+
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (g(this, $, new ResizeObserver((i) => {
|
|
532
532
|
for (const e of i) {
|
|
533
533
|
const s = e.target;
|
|
534
534
|
if (!s.classList.contains("active")) continue;
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
535
|
+
const o = e.contentRect.height;
|
|
536
|
+
if (o > 0) {
|
|
537
537
|
let r = 0;
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
const l = Math.max(
|
|
538
|
+
const n = s.querySelector("thead");
|
|
539
|
+
n && (r += n.offsetHeight || n.getBoundingClientRect().height);
|
|
540
|
+
const l = Math.max(o - r, 100);
|
|
541
541
|
t(this, V) !== l && (g(this, V, l), t(this, rt).call(this), t(this, R) !== null && t(this, lt).call(this));
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
})), t(this,
|
|
544
|
+
})), t(this, $).observe(t(this, w)));
|
|
545
545
|
}, "#initResizeObserver"));
|
|
546
546
|
a(this, lt, /* @__PURE__ */ c(() => {
|
|
547
547
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
@@ -549,30 +549,30 @@ const Gt = class Gt {
|
|
|
549
549
|
e && e.querySelector("tbody.bindable-tbody") && t(this, mt).call(this, e, i);
|
|
550
550
|
}), t(this, vt).call(this);
|
|
551
551
|
}, "#renderAllContainers"));
|
|
552
|
-
a(this,
|
|
552
|
+
a(this, G, /* @__PURE__ */ c((i) => {
|
|
553
553
|
var r;
|
|
554
554
|
const e = t(this, R);
|
|
555
555
|
if (!e || e <= 0) return;
|
|
556
|
-
const s = Math.max(0, Math.floor(i / e)),
|
|
557
|
-
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
558
|
-
const l = t(this, w).querySelector(
|
|
556
|
+
const s = Math.max(0, Math.floor(i / e)), o = ((r = t(this, _).get(".ng-container-body")) == null ? void 0 : r.length) || 1;
|
|
557
|
+
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
558
|
+
const l = t(this, w).querySelector(n);
|
|
559
559
|
if (!l) return;
|
|
560
560
|
const h = l.querySelector("tbody.bindable-tbody");
|
|
561
561
|
if (!h) return;
|
|
562
562
|
Array.from(h.querySelectorAll("tr:not(.nodata)")).forEach((f, u) => {
|
|
563
|
-
const b = s + Math.floor(u /
|
|
564
|
-
|
|
563
|
+
const b = s + Math.floor(u / o), p = t(this, Y).data.get(b);
|
|
564
|
+
z.log("--", t(this, Y).data.get(0)), f.style.display = "", t(this, St).call(this, f, p, b);
|
|
565
565
|
});
|
|
566
566
|
});
|
|
567
567
|
}, "#handleScroll"));
|
|
568
568
|
a(this, St, /* @__PURE__ */ c((i, e, s) => {
|
|
569
|
-
i.dataset.row = s,
|
|
570
|
-
const
|
|
571
|
-
|
|
569
|
+
i.dataset.row = s, z.log(i, e, s), Array.from(i.cells).forEach((o, r) => {
|
|
570
|
+
const n = o.dataset.bind;
|
|
571
|
+
n && e && e[n] !== void 0 ? o.textContent = e[n] : o.textContent = e ? e[Object.keys(e)[r]] ?? `R${s}C${r}` : `ν ${s + 1}`, o.dataset.row = s;
|
|
572
572
|
});
|
|
573
573
|
}, "#bindRowData"));
|
|
574
574
|
x(this, "destroy", /* @__PURE__ */ c(() => {
|
|
575
|
-
t(this,
|
|
575
|
+
t(this, $) && (t(this, $).disconnect(), g(this, $, null));
|
|
576
576
|
}, "destroy"));
|
|
577
577
|
g(this, Y, i.getRootNode().host), g(this, w, i), t(this, wt).call(this);
|
|
578
578
|
}
|
|
@@ -581,17 +581,17 @@ const Gt = class Gt {
|
|
|
581
581
|
}
|
|
582
582
|
templateLength(i = ".ng-container-body") {
|
|
583
583
|
var e;
|
|
584
|
-
return ((e = t(this,
|
|
584
|
+
return ((e = t(this, _).get(i)) == null ? void 0 : e.length) || 1;
|
|
585
585
|
}
|
|
586
586
|
};
|
|
587
|
-
Y = new WeakMap(), w = new WeakMap(),
|
|
587
|
+
Y = new WeakMap(), w = new WeakMap(), _ = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), V = new WeakMap(), Z = new WeakMap(), mt = new WeakMap(), xt = new WeakMap(), ot = new WeakMap(), rt = new WeakMap(), vt = new WeakMap(), wt = new WeakMap(), lt = new WeakMap(), G = new WeakMap(), St = new WeakMap(), c(Gt, "RowManager");
|
|
588
588
|
let Bt = Gt;
|
|
589
|
-
var Et,
|
|
589
|
+
var Et, J, X, Rt, kt, qt, At, Tt;
|
|
590
590
|
const it = class it extends HTMLElement {
|
|
591
591
|
constructor() {
|
|
592
592
|
super();
|
|
593
593
|
a(this, Et);
|
|
594
|
-
a(this,
|
|
594
|
+
a(this, J, null);
|
|
595
595
|
a(this, X);
|
|
596
596
|
/**
|
|
597
597
|
* data.set, add, delete
|
|
@@ -605,28 +605,28 @@ const it = class it extends HTMLElement {
|
|
|
605
605
|
{ selector: ".ng-container-body", type: null },
|
|
606
606
|
{ selector: ".ng-container-left", type: "left" },
|
|
607
607
|
{ selector: ".ng-container-right", type: "right" }
|
|
608
|
-
].forEach(({ selector: s, type:
|
|
608
|
+
].forEach(({ selector: s, type: o }) => {
|
|
609
609
|
const r = this.querySelector(s);
|
|
610
610
|
if (!r) return;
|
|
611
|
-
const
|
|
612
|
-
r.innerHTML = "", r.appendChild(
|
|
611
|
+
const n = t(this, qt).call(this, t(this, J), o);
|
|
612
|
+
r.innerHTML = "", r.appendChild(n);
|
|
613
613
|
});
|
|
614
614
|
}, "#renderSplitContainers"));
|
|
615
615
|
a(this, kt, /* @__PURE__ */ c(() => {
|
|
616
616
|
["left", "right"].forEach((e) => {
|
|
617
|
-
const s = this.querySelector(`.ng-container-${e}`),
|
|
618
|
-
if (!s || !
|
|
617
|
+
const s = this.querySelector(`.ng-container-${e}`), o = s == null ? void 0 : s.querySelector("table");
|
|
618
|
+
if (!s || !o) return;
|
|
619
619
|
let r = 0;
|
|
620
|
-
|
|
621
|
-
const l = parseInt(
|
|
620
|
+
o.querySelectorAll("col").forEach((n) => {
|
|
621
|
+
const l = parseInt(n.getAttribute("width"), 10);
|
|
622
622
|
isNaN(r) || (r += l);
|
|
623
623
|
}), s.style.flex = `0 0 ${r}px`, s.style.width = `${r}px`;
|
|
624
624
|
});
|
|
625
625
|
}, "#updateContainerWidths"));
|
|
626
626
|
x(this, "generate", /* @__PURE__ */ c((e) => {
|
|
627
|
-
e && (g(this,
|
|
628
|
-
var
|
|
629
|
-
const s = (
|
|
627
|
+
e && (g(this, J, Nt.compile(e)), t(this, J).style.display = "table", t(this, Rt).call(this), t(this, kt).call(this), requestAnimationFrame(() => {
|
|
628
|
+
var o;
|
|
629
|
+
const s = (o = this.querySelector("thead")) == null ? void 0 : o.getBoundingClientRect().height;
|
|
630
630
|
this.querySelectorAll("tbody.fixed-tbody").forEach((r) => {
|
|
631
631
|
r.style.top = `${s}px`;
|
|
632
632
|
});
|
|
@@ -639,18 +639,18 @@ const it = class it extends HTMLElement {
|
|
|
639
639
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
640
640
|
*/
|
|
641
641
|
a(this, qt, /* @__PURE__ */ c((e, s) => {
|
|
642
|
-
const
|
|
642
|
+
const o = e.cloneNode(!0), r = o.querySelector("tbody");
|
|
643
643
|
if (r) {
|
|
644
|
-
const
|
|
645
|
-
|
|
644
|
+
const n = document.createElement("tbody");
|
|
645
|
+
n.className = "fixed-tbody", r.className = "bindable-tbody", r.before(n);
|
|
646
646
|
}
|
|
647
|
-
return s === "left" ?
|
|
648
|
-
|
|
649
|
-
}) : s === "right" ?
|
|
650
|
-
|
|
651
|
-
}) :
|
|
652
|
-
|
|
653
|
-
}),
|
|
647
|
+
return s === "left" ? o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((n) => {
|
|
648
|
+
n.getAttribute("fixed") !== "left" && n.remove();
|
|
649
|
+
}) : s === "right" ? o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((n) => {
|
|
650
|
+
n.getAttribute("fixed") !== "right" && n.remove();
|
|
651
|
+
}) : o.querySelectorAll("[fixed=left], [fixed=right]").forEach((n) => {
|
|
652
|
+
n.remove();
|
|
653
|
+
}), o;
|
|
654
654
|
}, "#createSplitTable"));
|
|
655
655
|
x(this, "getRowHeight", /* @__PURE__ */ c(() => t(this, X).getRowHeight(), "getRowHeight"));
|
|
656
656
|
x(this, "scrollToX", /* @__PURE__ */ c((e) => {
|
|
@@ -817,10 +817,10 @@ const it = class it extends HTMLElement {
|
|
|
817
817
|
t(this, At).call(this);
|
|
818
818
|
}
|
|
819
819
|
disconnectedCallback() {
|
|
820
|
-
this.innerHTML = "",
|
|
820
|
+
this.innerHTML = "", z.log("NineTableSheet destroyed.");
|
|
821
821
|
}
|
|
822
822
|
};
|
|
823
|
-
Et = new WeakMap(),
|
|
823
|
+
Et = new WeakMap(), J = new WeakMap(), X = new WeakMap(), Rt = new WeakMap(), kt = new WeakMap(), qt = new WeakMap(), At = new WeakMap(), Tt = new WeakMap(), c(it, "NineTableSheet"), x(it, "SCROLLBAR_SIZE", 16);
|
|
824
824
|
let ut = it;
|
|
825
825
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ut);
|
|
826
826
|
var Lt, ct;
|
|
@@ -830,13 +830,13 @@ const Jt = class Jt extends HTMLElement {
|
|
|
830
830
|
a(this, Lt, /* @__PURE__ */ c(() => {
|
|
831
831
|
var e;
|
|
832
832
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
833
|
-
var
|
|
834
|
-
const
|
|
835
|
-
t(this, ct).call(this, r,
|
|
833
|
+
var n;
|
|
834
|
+
const o = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((n = s.target.closest(".nine-tab-item")) == null ? void 0 : n.dataset.index, 10);
|
|
835
|
+
t(this, ct).call(this, r, o);
|
|
836
836
|
}), t(this, ct).call(this, 0, !1);
|
|
837
837
|
}, "#init"));
|
|
838
838
|
a(this, ct, /* @__PURE__ */ c((e, s = !1) => {
|
|
839
|
-
const
|
|
839
|
+
const o = /* @__PURE__ */ c(() => {
|
|
840
840
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
841
841
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((p) => p.style.setProperty("display", "none"));
|
|
842
842
|
const b = f.filter((p) => p.classList.contains("active"));
|
|
@@ -844,7 +844,7 @@ const Jt = class Jt extends HTMLElement {
|
|
|
844
844
|
const E = parseInt(p.getAttribute("data-index"), 10), L = this.querySelector(`nine-splitter[data-split-index="${E}"]`), ft = f[E + 1];
|
|
845
845
|
L && ft && ft.classList.contains("active") && L.style.setProperty("display", "flex");
|
|
846
846
|
});
|
|
847
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"),
|
|
847
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), n = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), h = n.querySelectorAll("nine-table-sheet");
|
|
848
848
|
if (!l[e]) return;
|
|
849
849
|
if (!s)
|
|
850
850
|
l.forEach((f, u) => {
|
|
@@ -858,13 +858,13 @@ const Jt = class Jt extends HTMLElement {
|
|
|
858
858
|
if (f.classList.contains("active") && u.length <= 1)
|
|
859
859
|
return;
|
|
860
860
|
f.classList.toggle("active");
|
|
861
|
-
const b =
|
|
861
|
+
const b = n.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
862
862
|
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
863
863
|
}
|
|
864
|
-
const d =
|
|
864
|
+
const d = n.querySelectorAll("nine-table-sheet.active");
|
|
865
865
|
d == null || d.forEach((f) => {
|
|
866
866
|
f.style.flex = d.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
867
|
-
}),
|
|
867
|
+
}), o();
|
|
868
868
|
}, "#switchSheet"));
|
|
869
869
|
}
|
|
870
870
|
connectedCallback() {
|
|
@@ -888,14 +888,14 @@ const Qt = class Qt {
|
|
|
888
888
|
var h, d;
|
|
889
889
|
const i = Array.from(t(this, k).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
890
890
|
if (i.length === 0) return;
|
|
891
|
-
const e = parseInt(t(this, k).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())),
|
|
891
|
+
const e = parseInt(t(this, k).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), o = (h = t(this, k).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : h.getBoundingClientRect().height, r = (d = t(this, k).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : d.getBoundingClientRect().height, n = ut.SCROLLBAR_SIZE, l = e * s + o + r + n;
|
|
892
892
|
t(this, k).style.height = `${l}px`;
|
|
893
893
|
}, "#applyAutoHeight"));
|
|
894
894
|
a(this, Ct, /* @__PURE__ */ c(() => {
|
|
895
|
-
const e = Array.from(t(this, k).children).filter((h) => h.tagName === "TABLE"), s = t(this, k).getAttribute("auto-height") === "true",
|
|
896
|
-
const u = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`, b = d <
|
|
895
|
+
const e = Array.from(t(this, k).children).filter((h) => h.tagName === "TABLE"), s = t(this, k).getAttribute("auto-height") === "true", o = e.length, r = e.map((h, d) => {
|
|
896
|
+
const u = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`, b = d < o - 1 ? `<nine-splitter class="h" data-split-index="${d}"></nine-splitter>` : "";
|
|
897
897
|
return u + b;
|
|
898
|
-
}).join(""),
|
|
898
|
+
}).join(""), n = e.map((h, d) => `<div class="nine-tab-item ${d === 0 ? "active" : ""}" data-index="${d}">Sheet ${d + 1}</div>`).join("");
|
|
899
899
|
t(this, k).shadowRoot.innerHTML = `
|
|
900
900
|
<style>
|
|
901
901
|
:host {
|
|
@@ -987,7 +987,7 @@ const Qt = class Qt {
|
|
|
987
987
|
<nine-table-sheets>
|
|
988
988
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
989
989
|
<nine-table-sheets-footer>
|
|
990
|
-
<div class="nine-tab-bar">${
|
|
990
|
+
<div class="nine-tab-bar">${n}</div>
|
|
991
991
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
992
992
|
</nine-table-sheets-footer>
|
|
993
993
|
</nine-table-sheets>
|
|
@@ -1007,41 +1007,41 @@ const Qt = class Qt {
|
|
|
1007
1007
|
};
|
|
1008
1008
|
k = new WeakMap(), Ht = new WeakMap(), at = new WeakMap(), Ct = new WeakMap(), c(Qt, "LayoutManager");
|
|
1009
1009
|
let Yt = Qt;
|
|
1010
|
-
var ht,
|
|
1010
|
+
var ht, Q;
|
|
1011
1011
|
const te = class te {
|
|
1012
1012
|
constructor(i) {
|
|
1013
1013
|
a(this, ht);
|
|
1014
|
-
a(this,
|
|
1014
|
+
a(this, Q, -1);
|
|
1015
1015
|
x(this, "count", /* @__PURE__ */ c(() => t(this, ht).rawRecords.length, "count"));
|
|
1016
1016
|
g(this, ht, i);
|
|
1017
1017
|
}
|
|
1018
1018
|
get at() {
|
|
1019
|
-
return t(this,
|
|
1019
|
+
return t(this, Q);
|
|
1020
1020
|
}
|
|
1021
1021
|
set at(i) {
|
|
1022
|
-
g(this,
|
|
1022
|
+
g(this, Q, parseInt(i, 10)), body && !body.querySelector(`tbody.bindable tr[data-row="${t(this, Q)}"]`) && setTimeout(() => {
|
|
1023
1023
|
});
|
|
1024
1024
|
}
|
|
1025
1025
|
};
|
|
1026
|
-
ht = new WeakMap(),
|
|
1026
|
+
ht = new WeakMap(), Q = new WeakMap(), c(te, "ngRow");
|
|
1027
1027
|
let Vt = te;
|
|
1028
|
-
var q, S, A,
|
|
1028
|
+
var q, S, A, tt, _t, W, Mt, U, dt, It, $t, et;
|
|
1029
1029
|
const T = class T {
|
|
1030
1030
|
constructor(i, e) {
|
|
1031
1031
|
a(this, q);
|
|
1032
1032
|
a(this, S);
|
|
1033
1033
|
a(this, A, []);
|
|
1034
|
-
a(this,
|
|
1034
|
+
a(this, tt, []);
|
|
1035
1035
|
a(this, _t, 0);
|
|
1036
|
-
a(this,
|
|
1036
|
+
a(this, W, []);
|
|
1037
1037
|
a(this, Mt, /* @__PURE__ */ c(() => {
|
|
1038
|
-
g(this,
|
|
1038
|
+
g(this, W, []);
|
|
1039
1039
|
const i = t(this, q).template || [];
|
|
1040
1040
|
Array.from(i).forEach((e) => {
|
|
1041
1041
|
var s;
|
|
1042
|
-
t(this,
|
|
1042
|
+
t(this, W).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1043
1043
|
}), (t(this, S).rawRecords || []).forEach((e) => {
|
|
1044
|
-
e.__ng || (e.__ng = t(this, dt).call(this)), e.__ng.height = t(this,
|
|
1044
|
+
e.__ng || (e.__ng = t(this, dt).call(this)), e.__ng.height = t(this, W).slice();
|
|
1045
1045
|
});
|
|
1046
1046
|
}, "#initialize"));
|
|
1047
1047
|
a(this, U, /* @__PURE__ */ c(() => {
|
|
@@ -1053,14 +1053,14 @@ const T = class T {
|
|
|
1053
1053
|
var r;
|
|
1054
1054
|
const s = this.getValidData();
|
|
1055
1055
|
if (!s || s.length <= 0) return;
|
|
1056
|
-
if (i == null) return t(this,
|
|
1056
|
+
if (i == null) return t(this, et).call(this, s);
|
|
1057
1057
|
if (i < 0 || i >= s.length) return null;
|
|
1058
|
-
const
|
|
1058
|
+
const o = typeof ((r = t(this, q).fields) == null ? void 0 : r.get) == "function" ? t(this, q).fields.get() : [];
|
|
1059
1059
|
if (e != null) {
|
|
1060
|
-
const
|
|
1061
|
-
return
|
|
1060
|
+
const n = o.indexOf(e);
|
|
1061
|
+
return n >= 0 ? s[i].v[n] : null;
|
|
1062
1062
|
}
|
|
1063
|
-
return
|
|
1063
|
+
return t(this, et).call(this, s[i]);
|
|
1064
1064
|
}, "get"));
|
|
1065
1065
|
x(this, "set", /* @__PURE__ */ c((i) => {
|
|
1066
1066
|
this.clear(), this.add(i, !1), t(this, U).call(this);
|
|
@@ -1069,27 +1069,27 @@ const T = class T {
|
|
|
1069
1069
|
rowState: T.ROW_STATE.EMPTY,
|
|
1070
1070
|
deleted: !1,
|
|
1071
1071
|
filtered: !1,
|
|
1072
|
-
height: t(this,
|
|
1072
|
+
height: t(this, W).slice(),
|
|
1073
1073
|
o: {},
|
|
1074
1074
|
c: {},
|
|
1075
|
-
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this,
|
|
1075
|
+
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, W).slice(), -1, {}, {}]
|
|
1076
1076
|
}), "#getDefaultMeta"));
|
|
1077
1077
|
x(this, "reset", /* @__PURE__ */ c(() => {
|
|
1078
|
-
g(this, A, []), g(this,
|
|
1078
|
+
g(this, A, []), g(this, tt, []), t(this, U).call(this);
|
|
1079
1079
|
}, "reset"));
|
|
1080
1080
|
x(this, "clear", /* @__PURE__ */ c(() => {
|
|
1081
1081
|
var i;
|
|
1082
|
-
t(this, S).rawRecords = [], g(this, A, []), g(this,
|
|
1082
|
+
t(this, S).rawRecords = [], g(this, A, []), g(this, tt, []), (i = t(this, S).viewRecords) != null && i.reset && t(this, S).viewRecords.reset();
|
|
1083
1083
|
}, "clear"));
|
|
1084
1084
|
a(this, It, /* @__PURE__ */ c((i) => {
|
|
1085
|
-
var
|
|
1085
|
+
var o;
|
|
1086
1086
|
Array.isArray(i) || (i = [i]);
|
|
1087
|
-
const e = typeof ((
|
|
1087
|
+
const e = typeof ((o = t(this, q).fields) == null ? void 0 : o.get) == "function" ? t(this, q).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1088
1088
|
return i.forEach((r) => {
|
|
1089
|
-
const
|
|
1089
|
+
const n = { v: [] };
|
|
1090
1090
|
e.forEach((l) => {
|
|
1091
|
-
|
|
1092
|
-
}), s.push(
|
|
1091
|
+
n.v.push(r[l] !== void 0 && r[l] !== null ? r[l] : "");
|
|
1092
|
+
}), s.push(n);
|
|
1093
1093
|
}), s;
|
|
1094
1094
|
}, "#json2Array"));
|
|
1095
1095
|
a(this, $t, /* @__PURE__ */ c((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
@@ -1099,19 +1099,19 @@ const T = class T {
|
|
|
1099
1099
|
i === void 0 && (i = {});
|
|
1100
1100
|
const s = t(this, It).call(this, i);
|
|
1101
1101
|
t(this, S).rawRecords = t(this, S).rawRecords.concat(t(this, $t).call(this, s)), this.resetRecords();
|
|
1102
|
-
const
|
|
1103
|
-
return e || s.forEach((r,
|
|
1104
|
-
const l = t(this, S).rawRecords[
|
|
1102
|
+
const o = this.count() - 1;
|
|
1103
|
+
return e || s.forEach((r, n) => {
|
|
1104
|
+
const l = t(this, S).rawRecords[o - n];
|
|
1105
1105
|
l && (l.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
1106
|
-
}), t(this, U).call(this),
|
|
1106
|
+
}), t(this, U).call(this), o;
|
|
1107
1107
|
}, "add"));
|
|
1108
1108
|
x(this, "delete", /* @__PURE__ */ c((i) => {
|
|
1109
1109
|
let e = [];
|
|
1110
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, S).host.row.at] : e = [parseInt(i, 10)], e.sort((s,
|
|
1110
|
+
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, S).host.row.at] : e = [parseInt(i, 10)], e.sort((s, o) => o - s).forEach((s) => {
|
|
1111
1111
|
if (t(this, A)[s]) {
|
|
1112
|
-
const
|
|
1113
|
-
t(this, A)[s].__ng.rowState === T.ROW_STATE.INSERT ? t(this, S).rawRecords = t(this, S).rawRecords.filter((r) => r.__ng.rowid !==
|
|
1114
|
-
r.__ng.rowid ===
|
|
1112
|
+
const o = t(this, A)[s].__ng.rowid;
|
|
1113
|
+
t(this, A)[s].__ng.rowState === T.ROW_STATE.INSERT ? t(this, S).rawRecords = t(this, S).rawRecords.filter((r) => r.__ng.rowid !== o) : t(this, S).rawRecords.forEach((r) => {
|
|
1114
|
+
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = T.ROW_STATE.DELETE);
|
|
1115
1115
|
});
|
|
1116
1116
|
}
|
|
1117
1117
|
}), this.resetRecords(), t(this, U).call(this);
|
|
@@ -1121,35 +1121,35 @@ const T = class T {
|
|
|
1121
1121
|
i = parseInt(i, 10);
|
|
1122
1122
|
const r = (typeof ((h = t(this, q).fields) == null ? void 0 : h.get) == "function" ? t(this, q).fields.get() : []).indexOf(e);
|
|
1123
1123
|
if (r < 0) return;
|
|
1124
|
-
const
|
|
1125
|
-
if (!
|
|
1126
|
-
const l =
|
|
1127
|
-
l !== s &&
|
|
1124
|
+
const n = this.getValidData()[i];
|
|
1125
|
+
if (!n) return;
|
|
1126
|
+
const l = n.v[r];
|
|
1127
|
+
l !== s && n.__ng.rowState !== T.ROW_STATE.INSERT && (n.__ng.o.hasOwnProperty(e) || (n.__ng.o[e] = l), n.__ng.rowState = T.ROW_STATE.UPDATE), n.v[r] = s;
|
|
1128
1128
|
}, "setValue"));
|
|
1129
1129
|
x(this, "resetRecords", /* @__PURE__ */ c(() => {
|
|
1130
|
-
g(this,
|
|
1130
|
+
g(this, tt, t(this, S).rawRecords.filter((i) => !i.__ng.deleted)), g(this, A, t(this, S).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, S).rawRecords.forEach((i, e) => {
|
|
1131
1131
|
i.__ng.rowidx = e;
|
|
1132
1132
|
}), t(this, A).forEach((i, e) => {
|
|
1133
1133
|
i.__ng.i = e;
|
|
1134
1134
|
});
|
|
1135
1135
|
}, "resetRecords"));
|
|
1136
1136
|
x(this, "getValidData", /* @__PURE__ */ c(() => (t(this, A).length === 0 && t(this, S).rawRecords.length > 0 && this.resetRecords(), t(this, A)), "getValidData"));
|
|
1137
|
-
a(this,
|
|
1138
|
-
var
|
|
1137
|
+
a(this, et, /* @__PURE__ */ c((i) => {
|
|
1138
|
+
var r;
|
|
1139
1139
|
if (!i) return i;
|
|
1140
|
-
const e = typeof ((
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
}, "#
|
|
1140
|
+
const e = Array.isArray(i) ? i : [i], s = typeof ((r = t(this, q).fields) == null ? void 0 : r.get) == "function" ? t(this, q).fields.get() : [], o = e.filter((n) => !n.__ng.deleted).map((n) => {
|
|
1141
|
+
const l = {};
|
|
1142
|
+
return s.forEach((h, d) => {
|
|
1143
|
+
l[h] = n.v ? n.v[d] : n[h];
|
|
1144
|
+
}), l.__ng = n.__ng, l;
|
|
1145
|
+
});
|
|
1146
|
+
return isSingle ? o[0] : o;
|
|
1147
|
+
}, "#conv"));
|
|
1148
1148
|
x(this, "count", /* @__PURE__ */ c(() => this.getValidData().length, "count"));
|
|
1149
1149
|
g(this, q, i), g(this, S, e), t(this, Mt).call(this);
|
|
1150
1150
|
}
|
|
1151
1151
|
get source() {
|
|
1152
|
-
return t(this,
|
|
1152
|
+
return t(this, et).call(this, t(this, S).rawRecords);
|
|
1153
1153
|
}
|
|
1154
1154
|
set source(i) {
|
|
1155
1155
|
this.clear(), this.add(i, !1);
|
|
@@ -1164,7 +1164,7 @@ const T = class T {
|
|
|
1164
1164
|
return this.length;
|
|
1165
1165
|
}
|
|
1166
1166
|
};
|
|
1167
|
-
q = new WeakMap(), S = new WeakMap(), A = new WeakMap(),
|
|
1167
|
+
q = new WeakMap(), S = new WeakMap(), A = new WeakMap(), tt = new WeakMap(), _t = new WeakMap(), W = new WeakMap(), Mt = new WeakMap(), U = new WeakMap(), dt = new WeakMap(), It = new WeakMap(), $t = new WeakMap(), et = new WeakMap(), c(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1168
1168
|
x(T, "ROW_STATE", {
|
|
1169
1169
|
EMPTY: "EMPTY",
|
|
1170
1170
|
NORMAL: "NORMAL",
|
|
@@ -1173,58 +1173,58 @@ x(T, "ROW_STATE", {
|
|
|
1173
1173
|
DELETE: "DELETE"
|
|
1174
1174
|
});
|
|
1175
1175
|
let Xt = T;
|
|
1176
|
-
var
|
|
1176
|
+
var F;
|
|
1177
1177
|
const ee = class ee {
|
|
1178
1178
|
constructor(i) {
|
|
1179
|
-
a(this,
|
|
1180
|
-
g(this,
|
|
1179
|
+
a(this, F);
|
|
1180
|
+
g(this, F, i), this.row = new Vt(this), this.data = new Xt(t(this, F), this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1181
1181
|
var e;
|
|
1182
|
-
(e = t(this,
|
|
1182
|
+
(e = t(this, F).view) != null && e.redraw && t(this, F).view.redraw();
|
|
1183
1183
|
}, this.setDataSource = (e) => {
|
|
1184
1184
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1185
1185
|
}, this.getRowState = (e) => {
|
|
1186
|
-
var
|
|
1186
|
+
var o, r;
|
|
1187
1187
|
const s = parseInt(e, 10);
|
|
1188
1188
|
if (!(s >= this.data.count()))
|
|
1189
|
-
return (r = (
|
|
1189
|
+
return (r = (o = this.data.getValidData()[s]) == null ? void 0 : o.__ng) == null ? void 0 : r.rowState;
|
|
1190
1190
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (e) => {
|
|
1191
1191
|
this.row.at = e;
|
|
1192
|
-
}, 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,
|
|
1193
|
-
e = parseInt(e, 10), this.data.setValue(e, s,
|
|
1192
|
+
}, 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, o) => {
|
|
1193
|
+
e = parseInt(e, 10), this.data.setValue(e, s, o);
|
|
1194
1194
|
}, this.setDataSource([]);
|
|
1195
1195
|
}
|
|
1196
1196
|
};
|
|
1197
|
-
|
|
1197
|
+
F = new WeakMap(), c(ee, "ngDataManager");
|
|
1198
1198
|
let Ut = ee;
|
|
1199
|
-
var
|
|
1199
|
+
var K, Wt;
|
|
1200
1200
|
const ie = class ie extends HTMLElement {
|
|
1201
1201
|
constructor() {
|
|
1202
1202
|
super();
|
|
1203
1203
|
//#created = false;
|
|
1204
|
-
a(this,
|
|
1204
|
+
a(this, K);
|
|
1205
1205
|
a(this, Wt);
|
|
1206
|
-
this.attachShadow({ mode: "open" }), g(this,
|
|
1206
|
+
this.attachShadow({ mode: "open" }), g(this, K, new Ut(this));
|
|
1207
1207
|
}
|
|
1208
1208
|
connectedCallback() {
|
|
1209
|
-
g(this, Wt, new Yt(this)),
|
|
1209
|
+
g(this, Wt, new Yt(this)), z.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1210
1210
|
}
|
|
1211
1211
|
disconnectedCallback() {
|
|
1212
|
-
|
|
1212
|
+
z.log("NineTable disconnected.");
|
|
1213
1213
|
}
|
|
1214
1214
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1215
1215
|
get data() {
|
|
1216
|
-
return t(this,
|
|
1216
|
+
return t(this, K).data;
|
|
1217
1217
|
}
|
|
1218
1218
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
1219
1219
|
get row() {
|
|
1220
|
-
return t(this,
|
|
1220
|
+
return t(this, K).row;
|
|
1221
1221
|
}
|
|
1222
1222
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
1223
1223
|
get dataManager() {
|
|
1224
|
-
return t(this,
|
|
1224
|
+
return t(this, K);
|
|
1225
1225
|
}
|
|
1226
1226
|
};
|
|
1227
|
-
|
|
1227
|
+
K = new WeakMap(), Wt = new WeakMap(), c(ie, "NineTable");
|
|
1228
1228
|
let Ft = ie;
|
|
1229
1229
|
customElements.get("nine-table") || customElements.define("nine-table", Ft);
|
|
1230
1230
|
//# sourceMappingURL=nine-table.js.map
|