@ninebone/table 0.0.255 β 0.0.256
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 +190 -188
- 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
|
@@ -4,8 +4,8 @@ var Oe = (m) => {
|
|
|
4
4
|
};
|
|
5
5
|
var Ne = (m, i, t) => i in m ? ze(m, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[i] = t;
|
|
6
6
|
var h = (m, i) => ze(m, "name", { value: i, configurable: !0 });
|
|
7
|
-
var
|
|
8
|
-
var e = (m, i, t) => (Be(m, i, "read from private field"), t ? t.call(m) : i.get(m)),
|
|
7
|
+
var v = (m, i, t) => Ne(m, typeof i != "symbol" ? i + "" : i, t), Be = (m, i, t) => i.has(m) || Oe("Cannot " + t);
|
|
8
|
+
var e = (m, i, t) => (Be(m, i, "read from private field"), t ? t.call(m) : i.get(m)), b = (m, i, t) => i.has(m) ? Oe("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(m) : i.set(m, t), y = (m, i, t, s) => (Be(m, i, "write to private field"), s ? s.call(m, t) : i.set(m, t), t);
|
|
9
9
|
var De = (m, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
11
|
y(m, i, n, t);
|
|
@@ -27,25 +27,25 @@ var C, O, p, B, D, N, ie, P, se;
|
|
|
27
27
|
const ke = class ke extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
b(this, C);
|
|
31
|
+
b(this, O, !1);
|
|
32
|
+
b(this, p);
|
|
33
|
+
b(this, B);
|
|
34
|
+
b(this, D);
|
|
35
|
+
b(this, N);
|
|
36
|
+
b(this, ie, /* @__PURE__ */ h(() => {
|
|
37
37
|
if (!e(this, C)) return;
|
|
38
38
|
const t = e(this, C).querySelector(".ng-container-body");
|
|
39
39
|
t && (y(this, N, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), e(this, N).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
|
-
|
|
43
|
+
v(this, "refresh", /* @__PURE__ */ h(() => {
|
|
44
44
|
if (!e(this, C) || !e(this, p) || e(this, O)) return;
|
|
45
45
|
const t = e(this, p).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = e(this, p).track, r = e(this, p).thumb, o = e(this, C).querySelector(".ng-container-bottom"),
|
|
48
|
-
if (
|
|
47
|
+
const n = e(this, p).track, r = e(this, p).thumb, o = e(this, C).querySelector(".ng-container-bottom"), c = t.clientWidth, d = s.scrollWidth;
|
|
48
|
+
if (c !== 0 && d > c)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
o && (o.style.display = "none");
|
|
@@ -53,28 +53,28 @@ const ke = class ke extends HTMLElement {
|
|
|
53
53
|
}
|
|
54
54
|
const l = n.clientWidth;
|
|
55
55
|
if (l <= 0) return;
|
|
56
|
-
const
|
|
57
|
-
r.style.width = `${
|
|
58
|
-
const f = t.scrollLeft,
|
|
59
|
-
let
|
|
60
|
-
|
|
61
|
-
const S = l -
|
|
62
|
-
|
|
56
|
+
const a = Math.max(Math.min(l * (c / d), l), 20);
|
|
57
|
+
r.style.width = `${a}px`;
|
|
58
|
+
const f = t.scrollLeft, u = d - c;
|
|
59
|
+
let g = 0;
|
|
60
|
+
u > 0 && (g = parseInt(f / u * (l - a), 10)), g < 0 && (g = 0);
|
|
61
|
+
const S = l - a;
|
|
62
|
+
g > S && (g = S), r.style.left = `${g}px`, Y.log(g), e(this, p).left.disabled = g === 0, e(this, p).right.disabled = g >= S - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
|
|
64
|
+
b(this, P, /* @__PURE__ */ h((t) => {
|
|
65
65
|
if (!e(this, p)) return !1;
|
|
66
66
|
const s = e(this, p).container, n = s.querySelector("table");
|
|
67
67
|
if (!n) return !1;
|
|
68
68
|
const r = e(this, p).track.getBoundingClientRect(), o = e(this, p).thumb.clientWidth;
|
|
69
|
-
let
|
|
70
|
-
|
|
69
|
+
let c = t;
|
|
70
|
+
c < 0 && (c = 0);
|
|
71
71
|
const d = r.width - o;
|
|
72
|
-
|
|
73
|
-
const l = s.clientWidth,
|
|
74
|
-
let f = d > 0 ? -
|
|
75
|
-
return -f >
|
|
72
|
+
c > d && (c = d), c = parseInt(c, 10), e(this, p).thumb.style.left = `${c}px`, e(this, p).left.disabled = c === 0, e(this, p).right.disabled = c >= d - 1;
|
|
73
|
+
const l = s.clientWidth, a = n.scrollWidth;
|
|
74
|
+
let f = d > 0 ? -c * (a - l) / d : 0;
|
|
75
|
+
return -f > a - l && (f = -(a - l)), -f + 5 > a - l && (f = -(a - l)), l >= a && (f = 0), n.style.transform = `translateX(${f}px)`, c > 0 && c < d - 1;
|
|
76
76
|
}, "#thumbMoveTo"));
|
|
77
|
-
|
|
77
|
+
b(this, se, /* @__PURE__ */ h(() => {
|
|
78
78
|
const t = /* @__PURE__ */ h((n) => {
|
|
79
79
|
clearInterval(e(this, B)), clearInterval(e(this, D));
|
|
80
80
|
const r = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
@@ -101,10 +101,10 @@ const ke = class ke extends HTMLElement {
|
|
|
101
101
|
}), e(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
102
102
|
if (n.button !== 0) return;
|
|
103
103
|
n.stopPropagation(), n.preventDefault(), y(this, O, !0), this.shiftX = n.clientX - e(this, p).thumb.getBoundingClientRect().left;
|
|
104
|
-
const r = /* @__PURE__ */ h((
|
|
104
|
+
const r = /* @__PURE__ */ h((c) => {
|
|
105
105
|
if (!e(this, O)) return;
|
|
106
106
|
const d = e(this, p).track.getBoundingClientRect();
|
|
107
|
-
e(this, P).call(this,
|
|
107
|
+
e(this, P).call(this, c.clientX - d.left - this.shiftX);
|
|
108
108
|
}, "onMouseMove"), o = /* @__PURE__ */ h(() => {
|
|
109
109
|
y(this, O, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
110
110
|
}, "onMouseUp");
|
|
@@ -203,20 +203,20 @@ customElements.get("nine-table-hscrollbar") || customElements.define("nine-table
|
|
|
203
203
|
var M, _, R, $, I, H, ne, re, oe, le;
|
|
204
204
|
const Le = class Le {
|
|
205
205
|
constructor(i) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
206
|
+
b(this, M);
|
|
207
|
+
b(this, _, []);
|
|
208
|
+
b(this, R, null);
|
|
209
|
+
b(this, $, null);
|
|
210
|
+
b(this, I, 0);
|
|
211
|
+
b(this, H, 0);
|
|
212
|
+
v(this, "getRowHeight", /* @__PURE__ */ h(() => e(this, R), "getRowHeight"));
|
|
213
|
+
b(this, ne, /* @__PURE__ */ h(() => {
|
|
214
214
|
e(this, re).call(this);
|
|
215
215
|
}, "#init"));
|
|
216
216
|
/**
|
|
217
217
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
218
218
|
*/
|
|
219
|
-
|
|
219
|
+
b(this, re, /* @__PURE__ */ h(() => {
|
|
220
220
|
!e(this, M) || !(e(this, M) instanceof HTMLElement) || (y(this, $, new ResizeObserver((i) => {
|
|
221
221
|
for (const t of i) {
|
|
222
222
|
const s = t.target;
|
|
@@ -226,14 +226,14 @@ const Le = class Le {
|
|
|
226
226
|
if (n > 0) {
|
|
227
227
|
const r = s.clientHeight || s.getBoundingClientRect().height || n;
|
|
228
228
|
let o = 0;
|
|
229
|
-
const
|
|
229
|
+
const c = s.querySelector(".ng-container-body") || s, d = c.querySelector("thead"), l = c.querySelector("tfoot");
|
|
230
230
|
d && (o += d.offsetHeight || d.getBoundingClientRect().height), l && (o += l.offsetHeight || l.getBoundingClientRect().height);
|
|
231
|
-
const
|
|
232
|
-
if (e(this, I) !==
|
|
231
|
+
const a = Math.max(r - o, 100);
|
|
232
|
+
if (e(this, I) !== a && (y(this, I, a), e(this, R) !== null)) {
|
|
233
233
|
const f = Math.ceil(e(this, I) / e(this, R));
|
|
234
|
-
y(this, H, f + 20), Y.log(`[RowManager] Resized. Height: ${e(this, I)}px | Target Rows: ${e(this, H)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
235
|
-
const
|
|
236
|
-
|
|
234
|
+
y(this, H, f + 20), Y.log(`[RowManager] Resized. Height: ${e(this, I)}px | Target Rows: ${e(this, H)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((u) => {
|
|
235
|
+
const g = s.querySelector(u);
|
|
236
|
+
g && g.querySelector("tbody") && e(this, le).call(this, g);
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
}
|
|
@@ -241,12 +241,12 @@ const Le = class Le {
|
|
|
241
241
|
})), e(this, $).observe(e(this, M)));
|
|
242
242
|
}, "#initResizeObserver"));
|
|
243
243
|
// π― ν
νλ¦Ώ μΆμΆ, λμ΄ μΈ‘μ , μ΄κΈ° λ λλ§μ μμμ λ§κ² λ΄λΆμμ μΌκ΄ μ²λ¦¬
|
|
244
|
-
|
|
244
|
+
v(this, "initialize", /* @__PURE__ */ h((i) => {
|
|
245
245
|
Y.log(i);
|
|
246
246
|
const t = e(this, M).querySelector(".ng-container-body"), s = i.querySelector("tbody"), n = Array.from(s.querySelectorAll("tr"));
|
|
247
247
|
y(this, _, n.map((r) => r.cloneNode(!0))), y(this, R, null), e(this, oe).call(this, t);
|
|
248
248
|
}, "initialize"));
|
|
249
|
-
|
|
249
|
+
b(this, oe, /* @__PURE__ */ h((i) => {
|
|
250
250
|
if (e(this, R) !== null && e(this, R) > 0)
|
|
251
251
|
return e(this, R);
|
|
252
252
|
if (e(this, _).length === 0)
|
|
@@ -258,13 +258,13 @@ const Le = class Le {
|
|
|
258
258
|
e(this, _).forEach((f) => {
|
|
259
259
|
n.appendChild(f.cloneNode(!0));
|
|
260
260
|
}), s ? s.before(n) : t.appendChild(n);
|
|
261
|
-
const r = i.closest("nine-table-sheet"), o = r ? r.style.display : "",
|
|
261
|
+
const r = i.closest("nine-table-sheet"), o = r ? r.style.display : "", c = r ? r.style.visibility : "", d = r ? r.style.position : "";
|
|
262
262
|
r && (r.style.display === "none" || window.getComputedStyle(r).display === "none") && (r.style.display = "block", r.style.visibility = "hidden", r.style.position = "absolute");
|
|
263
263
|
let l = 0;
|
|
264
|
-
const
|
|
265
|
-
if (
|
|
264
|
+
const a = t.querySelectorAll("tr:not(.nodata)");
|
|
265
|
+
if (a.forEach((f, u) => {
|
|
266
266
|
l += f.offsetHeight || f.getBoundingClientRect().height;
|
|
267
|
-
}),
|
|
267
|
+
}), a.forEach((f) => f.remove()), r && (r.style.display = o, r.style.visibility = c, r.style.position = d), y(this, R, l), e(this, I) > 0) {
|
|
268
268
|
const f = Math.ceil(e(this, I) / e(this, R));
|
|
269
269
|
y(this, H, f + 20);
|
|
270
270
|
} else
|
|
@@ -287,19 +287,19 @@ const Le = class Le {
|
|
|
287
287
|
/**
|
|
288
288
|
* π― μΊμλ ν κ°μλ₯Ό κ³§λ°λ‘ κ°μ Έμμ TR λΌλ μ£Όμ
(μ€λ³΅ κ³μ° μ κ±°)
|
|
289
289
|
*/
|
|
290
|
-
|
|
290
|
+
b(this, le, /* @__PURE__ */ h((i) => {
|
|
291
291
|
if (e(this, _).length === 0) return;
|
|
292
292
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
293
293
|
if (!t) return;
|
|
294
294
|
t.querySelectorAll("tr:not(.nodata)").forEach((o) => o.remove());
|
|
295
295
|
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment(), r = e(this, H);
|
|
296
296
|
for (let o = 0; o < r; o++)
|
|
297
|
-
e(this, _).forEach((
|
|
298
|
-
n.appendChild(
|
|
297
|
+
e(this, _).forEach((c) => {
|
|
298
|
+
n.appendChild(c.cloneNode(!0));
|
|
299
299
|
});
|
|
300
300
|
s ? s.before(n) : t.appendChild(n), console.log(`[RowManager] Rendered ${r} sets into DOM.`);
|
|
301
301
|
}, "#renderRows"));
|
|
302
|
-
|
|
302
|
+
v(this, "destroy", /* @__PURE__ */ h(() => {
|
|
303
303
|
e(this, $) && (e(this, $).disconnect(), y(this, $, null));
|
|
304
304
|
}, "destroy"));
|
|
305
305
|
y(this, M, i), e(this, ne).call(this);
|
|
@@ -314,39 +314,39 @@ var A, F, G, U, ae, ce;
|
|
|
314
314
|
const j = class j extends HTMLElement {
|
|
315
315
|
constructor() {
|
|
316
316
|
super();
|
|
317
|
-
|
|
318
|
-
|
|
317
|
+
b(this, A, null);
|
|
318
|
+
b(this, F);
|
|
319
319
|
/**
|
|
320
320
|
* π― 2μ°¨μ μ
격μ μΈλ±μ€λ₯Ό κ³μ°νμ¬ λ³ν©(`rowSpan`/`colSpan`) μ
μ μ λ μ»¬λΌ μμΉλ₯Ό λΆμ¬
|
|
321
321
|
*/
|
|
322
|
-
|
|
322
|
+
b(this, G, /* @__PURE__ */ h((t, s) => {
|
|
323
323
|
const n = Array.from(t.querySelectorAll(s + " tr")), r = Array.from(t.querySelectorAll(s + " th," + s + " td")), o = n.length;
|
|
324
324
|
if (o === 0 || r.length === 0) return;
|
|
325
|
-
let
|
|
325
|
+
let c = 0;
|
|
326
326
|
r.forEach((l) => {
|
|
327
|
-
|
|
327
|
+
c += l.colSpan || 1;
|
|
328
328
|
});
|
|
329
|
-
const d = Array.from(Array(o), () => Array(
|
|
329
|
+
const d = Array.from(Array(o), () => Array(c).fill(null));
|
|
330
330
|
n.forEach((l) => {
|
|
331
|
-
const
|
|
331
|
+
const a = l.sectionRowIndex;
|
|
332
332
|
let f = 0;
|
|
333
|
-
Array.from(l.querySelectorAll("th,td")).forEach((
|
|
334
|
-
for (let
|
|
335
|
-
if (d[
|
|
336
|
-
f =
|
|
333
|
+
Array.from(l.querySelectorAll("th,td")).forEach((u) => {
|
|
334
|
+
for (let x = 0; x < d[a].length; x++)
|
|
335
|
+
if (d[a][x] === null) {
|
|
336
|
+
f = x;
|
|
337
337
|
break;
|
|
338
338
|
}
|
|
339
|
-
const
|
|
340
|
-
for (let
|
|
339
|
+
const g = u.rowSpan || 1, S = u.colSpan || 1;
|
|
340
|
+
for (let x = 0; x < g; x++)
|
|
341
341
|
for (let L = 0; L < S; L++)
|
|
342
|
-
|
|
342
|
+
a + x < o && f + L < c && (d[a + x][f + L] = x === 0 && L === 0 ? "1" : "0");
|
|
343
343
|
});
|
|
344
344
|
}), n.forEach((l) => {
|
|
345
|
-
const
|
|
345
|
+
const a = l.sectionRowIndex;
|
|
346
346
|
Array.from(l.querySelectorAll("th,td")).forEach((f) => {
|
|
347
|
-
for (let
|
|
348
|
-
if (d[
|
|
349
|
-
f.dataset.col =
|
|
347
|
+
for (let u = 0; u < d[a].length; u++)
|
|
348
|
+
if (d[a][u] === "1") {
|
|
349
|
+
f.dataset.col = u, d[a][u] = "0";
|
|
350
350
|
break;
|
|
351
351
|
}
|
|
352
352
|
});
|
|
@@ -355,72 +355,74 @@ const j = class j extends HTMLElement {
|
|
|
355
355
|
/**
|
|
356
356
|
* π― μλ³Έ ν
μ΄λΈμ λΆμνμ¬ κ³ μ μ»¬λΌ μμλ³(left, body, right)λ‘ μλ²½νκ² μͺΌκ°μ§ ν
μ΄λΈ μμ±
|
|
357
357
|
*/
|
|
358
|
-
|
|
358
|
+
b(this, U, /* @__PURE__ */ h((t, s) => {
|
|
359
359
|
const n = t.cloneNode(!0), r = n.querySelector("colgroup");
|
|
360
360
|
if (!r) return n;
|
|
361
|
-
const o = Array.from(r.querySelectorAll("col")),
|
|
361
|
+
const o = Array.from(r.querySelectorAll("col")), c = [];
|
|
362
362
|
return o.forEach((d, l) => {
|
|
363
|
-
const
|
|
363
|
+
const a = d.getAttribute("fixed");
|
|
364
364
|
let f = !1;
|
|
365
|
-
s === "left" ? f =
|
|
366
|
-
}),
|
|
365
|
+
s === "left" ? f = a === "left" : s === "right" ? f = a === "right" : f = a !== "left" && a !== "right", f || c.push(l);
|
|
366
|
+
}), c.reverse().forEach((d) => {
|
|
367
367
|
o[d] && o[d].remove(), n.querySelectorAll("tr").forEach((l) => {
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
let a = 0;
|
|
369
|
+
Array.from(l.querySelectorAll("th, td")).forEach((u) => {
|
|
370
|
+
const g = u.colSpan || 1, S = a, x = a + g - 1;
|
|
371
|
+
d >= S && d <= x && (g === 1 ? u.remove() : u.colSpan = g - 1), a += g;
|
|
370
372
|
});
|
|
371
373
|
});
|
|
372
374
|
}), n;
|
|
373
375
|
}, "#createSplitTable"));
|
|
374
|
-
|
|
376
|
+
v(this, "generate", /* @__PURE__ */ h((t) => {
|
|
375
377
|
if (!t) return;
|
|
376
378
|
const s = /* @__PURE__ */ h((l) => {
|
|
377
|
-
const
|
|
378
|
-
if (
|
|
379
|
-
const
|
|
379
|
+
const a = /* @__PURE__ */ h((u) => {
|
|
380
|
+
if (u.querySelector("colgroup")) return;
|
|
381
|
+
const g = u.querySelector("tbody tr") || u.querySelector("tr"), S = g ? g.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), L = Math.max(Math.floor(u.clientWidth / S), 100);
|
|
380
382
|
for (let $e = 0; $e < S; $e++) {
|
|
381
383
|
const We = document.createElement("col");
|
|
382
|
-
We.setAttribute("width", L),
|
|
384
|
+
We.setAttribute("width", L), x.appendChild(We);
|
|
383
385
|
}
|
|
384
|
-
|
|
385
|
-
}, "ensureColgroup"), f = /* @__PURE__ */ h((
|
|
386
|
-
if (
|
|
387
|
-
const
|
|
388
|
-
S ? S.after(
|
|
386
|
+
u.prepend(x);
|
|
387
|
+
}, "ensureColgroup"), f = /* @__PURE__ */ h((u) => {
|
|
388
|
+
if (u.querySelector("thead")) return;
|
|
389
|
+
const g = document.createElement("thead"), S = u.querySelector("colgroup");
|
|
390
|
+
S ? S.after(g) : u.prepend(g);
|
|
389
391
|
}, "ensureThead");
|
|
390
|
-
return
|
|
392
|
+
return a(l), f(l), l.classList.add("nine-table-element"), l;
|
|
391
393
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
392
|
-
y(this, A, s(n)), e(this, A).style.display = "table", e(this, G).call(this, e(this, A), "thead"), e(this, G).call(this, e(this, A), "tbody"), Array.from(e(this, A).querySelectorAll("colgroup col")).forEach((l,
|
|
394
|
+
y(this, A, s(n)), e(this, A).style.display = "table", e(this, G).call(this, e(this, A), "thead"), e(this, G).call(this, e(this, A), "tbody"), Array.from(e(this, A).querySelectorAll("colgroup col")).forEach((l, a) => {
|
|
393
395
|
const f = l.getAttribute("fixed");
|
|
394
|
-
f && e(this, A).querySelectorAll(`[data-col="${
|
|
395
|
-
|
|
396
|
+
f && e(this, A).querySelectorAll(`[data-col="${a}"]`).forEach((u) => {
|
|
397
|
+
u.setAttribute("fixed", f);
|
|
396
398
|
});
|
|
397
399
|
}), Y.log(e(this, A));
|
|
398
|
-
const o = this.querySelector(".ng-container-left"),
|
|
399
|
-
if (
|
|
400
|
+
const o = this.querySelector(".ng-container-left"), c = this.querySelector(".ng-container-body"), d = this.querySelector(".ng-container-right");
|
|
401
|
+
if (c) {
|
|
400
402
|
const l = e(this, U).call(this, e(this, A), null);
|
|
401
|
-
|
|
403
|
+
c.innerHTML = "", c.appendChild(l), e(this, F).initialize(e(this, A));
|
|
402
404
|
}
|
|
403
405
|
if (o) {
|
|
404
406
|
const l = e(this, U).call(this, e(this, A), "left");
|
|
405
|
-
let
|
|
406
|
-
l.querySelectorAll("col").forEach((
|
|
407
|
-
const
|
|
408
|
-
isNaN(
|
|
407
|
+
let a = 0;
|
|
408
|
+
l.querySelectorAll("col").forEach((u) => {
|
|
409
|
+
const g = parseInt(u.getAttribute("width"), 10);
|
|
410
|
+
isNaN(g) || (a += g);
|
|
409
411
|
}), o.innerHTML = "", o.appendChild(l);
|
|
410
|
-
const f =
|
|
412
|
+
const f = a > 0 ? a : 0;
|
|
411
413
|
o.style.flex = `0 0 ${f}px`, o.style.width = `${f}px`;
|
|
412
414
|
}
|
|
413
415
|
if (d) {
|
|
414
416
|
const l = e(this, U).call(this, e(this, A), "right");
|
|
415
|
-
let
|
|
416
|
-
l.querySelectorAll("col").forEach((
|
|
417
|
-
const
|
|
418
|
-
isNaN(
|
|
417
|
+
let a = 0;
|
|
418
|
+
l.querySelectorAll("col").forEach((u) => {
|
|
419
|
+
const g = parseInt(u.getAttribute("width"), 10);
|
|
420
|
+
isNaN(g) || (a += g);
|
|
419
421
|
}), d.innerHTML = "", d.appendChild(l);
|
|
420
|
-
const f =
|
|
422
|
+
const f = a > 0 ? a : 0;
|
|
421
423
|
d.style.flex = `0 0 ${f}px`, d.style.width = `${f}px`;
|
|
422
424
|
}
|
|
423
|
-
|
|
425
|
+
c && c.addEventListener("scroll", () => {
|
|
424
426
|
var l;
|
|
425
427
|
(l = this.querySelector("nine-table-hscrollbar")) == null || l.refresh();
|
|
426
428
|
}), setTimeout(() => {
|
|
@@ -428,28 +430,28 @@ const j = class j extends HTMLElement {
|
|
|
428
430
|
(l = this.querySelector("nine-table-hscrollbar")) == null || l.refresh();
|
|
429
431
|
}, 0);
|
|
430
432
|
}, "generate"));
|
|
431
|
-
|
|
432
|
-
|
|
433
|
+
v(this, "getRowHeight", /* @__PURE__ */ h(() => e(this, F).getRowHeight(), "getRowHeight"));
|
|
434
|
+
v(this, "scrollToX", /* @__PURE__ */ h((t) => {
|
|
433
435
|
const s = this.querySelector(".ng-container-body");
|
|
434
436
|
s && (s.scrollLeft = t);
|
|
435
437
|
}, "scrollToX"));
|
|
436
|
-
|
|
438
|
+
v(this, "scrollToY", /* @__PURE__ */ h((t) => {
|
|
437
439
|
const s = this.querySelector(".ng-container-body");
|
|
438
440
|
s && (s.scrollTop = t);
|
|
439
441
|
}, "scrollToY"));
|
|
440
|
-
|
|
442
|
+
b(this, ae, /* @__PURE__ */ h(() => {
|
|
441
443
|
const t = /* @__PURE__ */ h(() => {
|
|
442
|
-
var
|
|
444
|
+
var a, f, u;
|
|
443
445
|
const s = this.querySelector(".ng-container-left table"), n = this.querySelector(".ng-container-body table"), r = this.querySelector(".ng-container-right table");
|
|
444
446
|
if (!n) return;
|
|
445
|
-
const o = s ? Array.from(s.querySelectorAll("tr")) : [],
|
|
446
|
-
for (let
|
|
447
|
+
const o = s ? Array.from(s.querySelectorAll("tr")) : [], c = Array.from(n.querySelectorAll("tr")), d = r ? Array.from(r.querySelectorAll("tr")) : [], l = Math.max(o.length, c.length, d.length);
|
|
448
|
+
for (let g = 0; g < l; g++) {
|
|
447
449
|
const S = [
|
|
448
|
-
((
|
|
449
|
-
((f =
|
|
450
|
-
((
|
|
451
|
-
],
|
|
452
|
-
|
|
450
|
+
((a = o[g]) == null ? void 0 : a.getBoundingClientRect().height) || 0,
|
|
451
|
+
((f = c[g]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
452
|
+
((u = d[g]) == null ? void 0 : u.getBoundingClientRect().height) || 0
|
|
453
|
+
], x = Math.max(...S);
|
|
454
|
+
x > 0 && (o[g] && (o[g].style.height = `${x}px`), c[g] && (c[g].style.height = `${x}px`), d[g] && (d[g].style.height = `${x}px`));
|
|
453
455
|
}
|
|
454
456
|
}, "syncRowHeights");
|
|
455
457
|
e(this, ce).call(this), requestAnimationFrame(() => {
|
|
@@ -459,7 +461,7 @@ const j = class j extends HTMLElement {
|
|
|
459
461
|
n.attributeName === "class" && this.classList.contains("active") && t();
|
|
460
462
|
}).observe(this, { attributes: !0 });
|
|
461
463
|
}, "#init"));
|
|
462
|
-
|
|
464
|
+
b(this, ce, /* @__PURE__ */ h(() => {
|
|
463
465
|
const t = j.SCROLLBAR_SIZE;
|
|
464
466
|
this.innerHTML = `
|
|
465
467
|
<style>
|
|
@@ -592,14 +594,14 @@ const j = class j extends HTMLElement {
|
|
|
592
594
|
this.innerHTML = "", Y.log("NineTableSheet destroyed.");
|
|
593
595
|
}
|
|
594
596
|
};
|
|
595
|
-
A = new WeakMap(), F = new WeakMap(), G = new WeakMap(), U = new WeakMap(), ae = new WeakMap(), ce = new WeakMap(), h(j, "NineTableSheet"),
|
|
597
|
+
A = new WeakMap(), F = new WeakMap(), G = new WeakMap(), U = new WeakMap(), ae = new WeakMap(), ce = new WeakMap(), h(j, "NineTableSheet"), v(j, "SCROLLBAR_SIZE", 16);
|
|
596
598
|
let te = j;
|
|
597
599
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", te);
|
|
598
600
|
var he, J;
|
|
599
601
|
const Ce = class Ce extends HTMLElement {
|
|
600
602
|
constructor() {
|
|
601
603
|
super();
|
|
602
|
-
|
|
604
|
+
b(this, he, /* @__PURE__ */ h(() => {
|
|
603
605
|
var t;
|
|
604
606
|
(t = this.querySelector(".nine-tab-bar")) == null || t.addEventListener("click", (s) => {
|
|
605
607
|
var o;
|
|
@@ -607,35 +609,35 @@ const Ce = class Ce extends HTMLElement {
|
|
|
607
609
|
e(this, J).call(this, r, n);
|
|
608
610
|
}), e(this, J).call(this, 0, !1);
|
|
609
611
|
}, "#init"));
|
|
610
|
-
|
|
612
|
+
b(this, J, /* @__PURE__ */ h((t, s = !1) => {
|
|
611
613
|
const n = /* @__PURE__ */ h(() => {
|
|
612
|
-
const
|
|
613
|
-
Array.from(this.querySelectorAll("nine-splitter")).forEach((
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
const S = parseInt(
|
|
617
|
-
|
|
614
|
+
const a = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
615
|
+
Array.from(this.querySelectorAll("nine-splitter")).forEach((g) => g.style.setProperty("display", "none"));
|
|
616
|
+
const u = a.filter((g) => g.classList.contains("active"));
|
|
617
|
+
u.length < 2 || u.forEach((g) => {
|
|
618
|
+
const S = parseInt(g.getAttribute("data-index"), 10), x = this.querySelector(`nine-splitter[data-split-index="${S}"]`), L = a[S + 1];
|
|
619
|
+
x && L && L.classList.contains("active") && x.style.setProperty("display", "flex");
|
|
618
620
|
});
|
|
619
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"),
|
|
620
|
-
if (!
|
|
621
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), c = r.querySelectorAll(".nine-tab-item"), d = o.querySelectorAll("nine-table-sheet");
|
|
622
|
+
if (!c[t]) return;
|
|
621
623
|
if (!s)
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
}), d.forEach((
|
|
625
|
-
const
|
|
626
|
-
|
|
624
|
+
c.forEach((a, f) => {
|
|
625
|
+
a.classList.toggle("active", f === t);
|
|
626
|
+
}), d.forEach((a, f) => {
|
|
627
|
+
const u = f === t;
|
|
628
|
+
a.classList.toggle("active", u), a.style.flex = u ? "1 1 100%" : "";
|
|
627
629
|
});
|
|
628
630
|
else {
|
|
629
|
-
const
|
|
630
|
-
if (
|
|
631
|
+
const a = c[t], f = r.querySelectorAll(".nine-tab-item.active");
|
|
632
|
+
if (a.classList.contains("active") && f.length <= 1)
|
|
631
633
|
return;
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
|
|
634
|
+
a.classList.toggle("active");
|
|
635
|
+
const u = o.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
636
|
+
u && (u.classList.toggle("active"), u.classList.contains("active") || (u.style.flex = ""));
|
|
635
637
|
}
|
|
636
638
|
const l = o.querySelectorAll("nine-table-sheet.active");
|
|
637
|
-
l == null || l.forEach((
|
|
638
|
-
|
|
639
|
+
l == null || l.forEach((a) => {
|
|
640
|
+
a.style.flex = l.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
639
641
|
}), n();
|
|
640
642
|
}, "#switchSheet"));
|
|
641
643
|
}
|
|
@@ -649,24 +651,24 @@ customElements.get("nine-table-sheets") || customElements.define("nine-table-she
|
|
|
649
651
|
var E, de, Q, fe;
|
|
650
652
|
const _e = class _e {
|
|
651
653
|
constructor(i) {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
+
b(this, E);
|
|
655
|
+
b(this, de, /* @__PURE__ */ h(() => {
|
|
654
656
|
e(this, fe).call(this), new ResizeObserver((i) => {
|
|
655
657
|
for (let t of i)
|
|
656
658
|
e(this, E).getAttribute("auto-height") === "true" && e(this, Q).call(this);
|
|
657
659
|
}).observe(e(this, E));
|
|
658
660
|
}, "#init"));
|
|
659
|
-
|
|
661
|
+
b(this, Q, /* @__PURE__ */ h(() => {
|
|
660
662
|
var d, l;
|
|
661
663
|
const i = Array.from(e(this, E).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
662
664
|
if (i.length === 0) return;
|
|
663
|
-
const t = parseInt(e(this, E).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((
|
|
664
|
-
e(this, E).style.height = `${
|
|
665
|
+
const t = parseInt(e(this, E).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((a) => a.getRowHeight())), n = (d = e(this, E).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : d.getBoundingClientRect().height, r = (l = e(this, E).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, o = te.SCROLLBAR_SIZE, c = t * s + n + r + o;
|
|
666
|
+
e(this, E).style.height = `${c}px`;
|
|
665
667
|
}, "#applyAutoHeight"));
|
|
666
|
-
|
|
668
|
+
b(this, fe, /* @__PURE__ */ h(() => {
|
|
667
669
|
const t = Array.from(e(this, E).children).filter((d) => d.tagName === "TABLE"), s = e(this, E).getAttribute("auto-height") === "true", n = t.length, r = t.map((d, l) => {
|
|
668
|
-
const f = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`,
|
|
669
|
-
return f +
|
|
670
|
+
const f = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`, u = l < n - 1 ? `<nine-splitter class="h" data-split-index="${l}"></nine-splitter>` : "";
|
|
671
|
+
return f + u;
|
|
670
672
|
}).join(""), o = t.map((d, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
671
673
|
e(this, E).shadowRoot.innerHTML = `
|
|
672
674
|
<style>
|
|
@@ -767,8 +769,8 @@ const _e = class _e {
|
|
|
767
769
|
</nine-table-body>
|
|
768
770
|
<nine-table-footer></nine-table-footer>
|
|
769
771
|
`;
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
+
const c = e(this, E).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
773
|
+
c == null || c.forEach((d, l) => {
|
|
772
774
|
t[l] && setTimeout(() => {
|
|
773
775
|
d.generate(t[l]), s && e(this, Q).call(this);
|
|
774
776
|
});
|
|
@@ -782,9 +784,9 @@ let Se = _e;
|
|
|
782
784
|
var W, V;
|
|
783
785
|
const Ie = class Ie {
|
|
784
786
|
constructor(i) {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
787
|
+
b(this, W);
|
|
788
|
+
b(this, V, -1);
|
|
789
|
+
v(this, "count", /* @__PURE__ */ h(() => e(this, W).rawRecords.length, "count"));
|
|
788
790
|
y(this, W, i);
|
|
789
791
|
}
|
|
790
792
|
get at() {
|
|
@@ -805,13 +807,13 @@ let Ee = Ie;
|
|
|
805
807
|
var T, w, q, K, ue, z, ge, ee, be, ye, Z;
|
|
806
808
|
const k = class k {
|
|
807
809
|
constructor(i, t) {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
810
|
+
b(this, T);
|
|
811
|
+
b(this, w);
|
|
812
|
+
b(this, q, []);
|
|
813
|
+
b(this, K, []);
|
|
814
|
+
b(this, ue, 0);
|
|
815
|
+
b(this, z, []);
|
|
816
|
+
b(this, ge, /* @__PURE__ */ h(() => {
|
|
815
817
|
y(this, z, []);
|
|
816
818
|
const i = e(this, T).template || [];
|
|
817
819
|
Array.from(i).forEach((t) => {
|
|
@@ -821,10 +823,10 @@ const k = class k {
|
|
|
821
823
|
t.__ng || (t.__ng = e(this, ee).call(this)), t.__ng.height = e(this, z).slice();
|
|
822
824
|
});
|
|
823
825
|
}, "#initialize"));
|
|
824
|
-
|
|
826
|
+
v(this, "set", /* @__PURE__ */ h((i) => {
|
|
825
827
|
this.clear(), this.add(i, !1);
|
|
826
828
|
}, "set"));
|
|
827
|
-
|
|
829
|
+
b(this, ee, /* @__PURE__ */ h(() => ({
|
|
828
830
|
rowState: k.ROW_STATE.EMPTY,
|
|
829
831
|
deleted: !1,
|
|
830
832
|
filtered: !1,
|
|
@@ -833,39 +835,39 @@ const k = class k {
|
|
|
833
835
|
c: {},
|
|
834
836
|
_: [0, 0, 0, 0, k.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, z).slice(), -1, {}, {}]
|
|
835
837
|
}), "#getDefaultMeta"));
|
|
836
|
-
|
|
838
|
+
v(this, "reset", /* @__PURE__ */ h(() => {
|
|
837
839
|
y(this, q, []), y(this, K, []);
|
|
838
840
|
}, "reset"));
|
|
839
|
-
|
|
841
|
+
v(this, "clear", /* @__PURE__ */ h(() => {
|
|
840
842
|
var i;
|
|
841
843
|
e(this, w).rawRecords = [], y(this, q, []), y(this, K, []), (i = e(this, w).viewRecords) != null && i.reset && e(this, w).viewRecords.reset();
|
|
842
844
|
}, "clear"));
|
|
843
|
-
|
|
845
|
+
b(this, be, /* @__PURE__ */ h((i) => {
|
|
844
846
|
var n;
|
|
845
847
|
Array.isArray(i) || (i = [i]);
|
|
846
848
|
const t = typeof ((n = e(this, T).fields) == null ? void 0 : n.get) == "function" ? e(this, T).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
847
849
|
return i.forEach((r) => {
|
|
848
850
|
const o = { v: [] };
|
|
849
|
-
t.forEach((
|
|
850
|
-
o.v.push(r[
|
|
851
|
+
t.forEach((c) => {
|
|
852
|
+
o.v.push(r[c] !== void 0 && r[c] !== null ? r[c] : "");
|
|
851
853
|
}), s.push(o);
|
|
852
854
|
}), s;
|
|
853
855
|
}, "#json2Array"));
|
|
854
|
-
|
|
856
|
+
b(this, ye, /* @__PURE__ */ h((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
855
857
|
t.__ng = e(this, ee).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = k.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
856
858
|
}), i), "#defaultInsert"));
|
|
857
|
-
|
|
859
|
+
v(this, "add", /* @__PURE__ */ h((i, t = !0) => {
|
|
858
860
|
var r;
|
|
859
861
|
i === void 0 && (i = {});
|
|
860
862
|
const s = e(this, be).call(this, i);
|
|
861
863
|
e(this, w).rawRecords = e(this, w).rawRecords.concat(e(this, ye).call(this, s)), this.resetRecords();
|
|
862
864
|
const n = this.count() - 1;
|
|
863
|
-
return t || s.forEach((o,
|
|
864
|
-
const d = e(this, w).rawRecords[n -
|
|
865
|
+
return t || s.forEach((o, c) => {
|
|
866
|
+
const d = e(this, w).rawRecords[n - c];
|
|
865
867
|
d && (d.__ng.rowState = k.ROW_STATE.EMPTY);
|
|
866
868
|
}), (r = e(this, w).viewRecords) != null && r.reset && e(this, w).viewRecords.reset(), n;
|
|
867
869
|
}, "add"));
|
|
868
|
-
|
|
870
|
+
v(this, "delete", /* @__PURE__ */ h((i) => {
|
|
869
871
|
var s;
|
|
870
872
|
let t = [];
|
|
871
873
|
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, w).owner.row.at] : t = [parseInt(i, 10)], t.sort((n, r) => r - n).forEach((n) => {
|
|
@@ -877,37 +879,37 @@ const k = class k {
|
|
|
877
879
|
}
|
|
878
880
|
}), this.resetRecords(), (s = e(this, w).viewRecords) != null && s.reset && e(this, w).viewRecords.reset();
|
|
879
881
|
}, "delete"));
|
|
880
|
-
|
|
882
|
+
v(this, "setValue", /* @__PURE__ */ h((i, t, s) => {
|
|
881
883
|
var d;
|
|
882
884
|
i = parseInt(i, 10);
|
|
883
885
|
const r = (typeof ((d = e(this, T).fields) == null ? void 0 : d.get) == "function" ? e(this, T).fields.get() : []).indexOf(t);
|
|
884
886
|
if (r < 0) return;
|
|
885
887
|
const o = this.getValidData()[i];
|
|
886
888
|
if (!o) return;
|
|
887
|
-
const
|
|
888
|
-
|
|
889
|
+
const c = o.v[r];
|
|
890
|
+
c !== s && o.__ng.rowState !== k.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(t) || (o.__ng.o[t] = c), o.__ng.rowState = k.ROW_STATE.UPDATE), o.v[r] = s, e(this, w).owner.refreshData && e(this, w).owner.refreshData(i);
|
|
889
891
|
}, "setValue"));
|
|
890
|
-
|
|
892
|
+
v(this, "resetRecords", /* @__PURE__ */ h(() => {
|
|
891
893
|
y(this, K, e(this, w).rawRecords.filter((i) => !i.__ng.deleted)), y(this, q, e(this, w).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, w).rawRecords.forEach((i, t) => {
|
|
892
894
|
i.__ng.rowidx = t;
|
|
893
895
|
}), e(this, q).forEach((i, t) => {
|
|
894
896
|
i.__ng.i = t;
|
|
895
897
|
});
|
|
896
898
|
}, "resetRecords"));
|
|
897
|
-
|
|
898
|
-
|
|
899
|
+
v(this, "getValidData", /* @__PURE__ */ h(() => (e(this, q).length === 0 && e(this, w).rawRecords.length > 0 && this.resetRecords(), e(this, q)), "getValidData"));
|
|
900
|
+
b(this, Z, /* @__PURE__ */ h((i) => {
|
|
899
901
|
var s;
|
|
900
902
|
if (!i) return i;
|
|
901
903
|
const t = typeof ((s = e(this, T).fields) == null ? void 0 : s.get) == "function" ? e(this, T).fields.get() : [];
|
|
902
904
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
903
905
|
const r = {};
|
|
904
|
-
return t.forEach((o,
|
|
905
|
-
r[o] = n.v ? n.v[
|
|
906
|
+
return t.forEach((o, c) => {
|
|
907
|
+
r[o] = n.v ? n.v[c] : n[o];
|
|
906
908
|
}), r.__ng = n.__ng, r;
|
|
907
909
|
}) : i;
|
|
908
910
|
}, "#conv2"));
|
|
909
|
-
|
|
910
|
-
|
|
911
|
+
v(this, "count", /* @__PURE__ */ h(() => this.getValidData().length, "count"));
|
|
912
|
+
v(this, "get", /* @__PURE__ */ h((i, t) => {
|
|
911
913
|
var r;
|
|
912
914
|
const s = this.getValidData();
|
|
913
915
|
if (!s || s.length <= 0) return;
|
|
@@ -939,7 +941,7 @@ const k = class k {
|
|
|
939
941
|
}
|
|
940
942
|
};
|
|
941
943
|
T = new WeakMap(), w = new WeakMap(), q = new WeakMap(), K = new WeakMap(), ue = new WeakMap(), z = new WeakMap(), ge = new WeakMap(), ee = new WeakMap(), be = new WeakMap(), ye = new WeakMap(), Z = new WeakMap(), h(k, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
942
|
-
|
|
944
|
+
v(k, "ROW_STATE", {
|
|
943
945
|
EMPTY: "EMPTY",
|
|
944
946
|
NORMAL: "NORMAL",
|
|
945
947
|
INSERT: "INSERT",
|
|
@@ -973,8 +975,8 @@ const Me = class Me extends HTMLElement {
|
|
|
973
975
|
constructor() {
|
|
974
976
|
super();
|
|
975
977
|
//#created = false;
|
|
976
|
-
|
|
977
|
-
|
|
978
|
+
b(this, X);
|
|
979
|
+
b(this, pe);
|
|
978
980
|
this.attachShadow({ mode: "open" }), y(this, X, new Ae(this));
|
|
979
981
|
}
|
|
980
982
|
connectedCallback() {
|