@ninebone/table 0.0.154 β 0.0.155
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 +123 -121
- 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
|
@@ -3,7 +3,7 @@ var $e = (w) => {
|
|
|
3
3
|
throw TypeError(w);
|
|
4
4
|
};
|
|
5
5
|
var ze = (w, s, t) => s in w ? Me(w, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : w[s] = t;
|
|
6
|
-
var
|
|
6
|
+
var a = (w, s) => Me(w, "name", { value: s, configurable: !0 });
|
|
7
7
|
var v = (w, s, t) => ze(w, typeof s != "symbol" ? s + "" : s, t), Ie = (w, s, t) => s.has(w) || $e("Cannot " + t);
|
|
8
8
|
var e = (w, s, t) => (Ie(w, s, "read from private field"), t ? t.call(w) : s.get(w)), u = (w, s, t) => s.has(w) ? $e("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(w) : s.set(w, t), p = (w, s, t, i) => (Ie(w, s, "write to private field"), i ? i.call(w, t) : s.set(w, t), t);
|
|
9
9
|
var He = (w, s, t, i) => ({
|
|
@@ -20,7 +20,7 @@ const Re = class Re extends We.constructor {
|
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
a(Re, "Trace");
|
|
24
24
|
let be = Re;
|
|
25
25
|
const J = new be();
|
|
26
26
|
var _, O, y, B, D, N, ee, P, te;
|
|
@@ -33,19 +33,19 @@ const Te = class Te extends HTMLElement {
|
|
|
33
33
|
u(this, B);
|
|
34
34
|
u(this, D);
|
|
35
35
|
u(this, N);
|
|
36
|
-
u(this, ee, /* @__PURE__ */
|
|
36
|
+
u(this, ee, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!e(this, _)) return;
|
|
38
38
|
const t = e(this, _).querySelector(".ng-container-body");
|
|
39
39
|
t && (p(this, N, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), e(this, N).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
|
-
v(this, "refresh", /* @__PURE__ */
|
|
43
|
+
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
44
|
if (!e(this, _) || !e(this, y) || e(this, O)) return;
|
|
45
45
|
const t = e(this, y).container, i = t.querySelector("table");
|
|
46
46
|
if (!i) return;
|
|
47
|
-
const n = e(this, y).track, o = e(this, y).thumb, r = e(this, _).querySelector(".ng-container-bottom"),
|
|
48
|
-
if (
|
|
47
|
+
const n = e(this, y).track, o = e(this, y).thumb, r = e(this, _).querySelector(".ng-container-bottom"), l = t.clientWidth, g = i.scrollWidth;
|
|
48
|
+
if (l !== 0 && g > l)
|
|
49
49
|
r && (r.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
r && (r.style.display = "none");
|
|
@@ -53,7 +53,7 @@ const Te = class Te extends HTMLElement {
|
|
|
53
53
|
}
|
|
54
54
|
const c = n.clientWidth;
|
|
55
55
|
if (c <= 0) return;
|
|
56
|
-
const h = Math.max(Math.min(c * (
|
|
56
|
+
const h = Math.max(Math.min(c * (l / g), c), 20);
|
|
57
57
|
o.style.width = `${h}px`;
|
|
58
58
|
let d = 0;
|
|
59
59
|
const b = i.style.transform;
|
|
@@ -67,21 +67,21 @@ const Te = class Te extends HTMLElement {
|
|
|
67
67
|
const S = c - h;
|
|
68
68
|
f > S && (f = S), o.style.left = `${f}px`, e(this, y).left.disabled = f === 0, e(this, y).right.disabled = f >= S - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
|
-
u(this, P, /* @__PURE__ */
|
|
70
|
+
u(this, P, /* @__PURE__ */ a((t) => {
|
|
71
71
|
if (!e(this, y)) return !1;
|
|
72
72
|
const i = e(this, y).container, n = i.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
74
74
|
const o = e(this, y).track.getBoundingClientRect(), r = e(this, y).thumb.clientWidth;
|
|
75
|
-
let
|
|
76
|
-
|
|
75
|
+
let l = t;
|
|
76
|
+
l < 0 && (l = 0);
|
|
77
77
|
const g = o.width - r;
|
|
78
|
-
|
|
78
|
+
l > g && (l = g), l = parseInt(l, 10), e(this, y).thumb.style.left = `${l}px`, e(this, y).left.disabled = l === 0, e(this, y).right.disabled = l >= g - 1;
|
|
79
79
|
const c = i.clientWidth, h = n.scrollWidth;
|
|
80
|
-
let d = g > 0 ? -
|
|
81
|
-
return -d > h - c && (d = -(h - c)), -d + 5 > h - c && (d = -(h - c)), c >= h && (d = 0), n.style.transform = `translateX(${d}px)`,
|
|
80
|
+
let d = g > 0 ? -l * (h - c) / g : 0;
|
|
81
|
+
return -d > h - c && (d = -(h - c)), -d + 5 > h - c && (d = -(h - c)), c >= h && (d = 0), n.style.transform = `translateX(${d}px)`, l > 0 && l < g - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
|
-
u(this, te, /* @__PURE__ */
|
|
84
|
-
const t = /* @__PURE__ */
|
|
83
|
+
u(this, te, /* @__PURE__ */ a(() => {
|
|
84
|
+
const t = /* @__PURE__ */ a((n) => {
|
|
85
85
|
clearInterval(e(this, B)), clearInterval(e(this, D));
|
|
86
86
|
const o = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
87
87
|
e(this, P).call(this, o + n), p(this, B, setInterval(() => {
|
|
@@ -90,7 +90,7 @@ const Te = class Te extends HTMLElement {
|
|
|
90
90
|
e(this, P).call(this, r + n) || clearInterval(e(this, D));
|
|
91
91
|
}, 50));
|
|
92
92
|
}, 500));
|
|
93
|
-
}, "delayScroll"), i = /* @__PURE__ */
|
|
93
|
+
}, "delayScroll"), i = /* @__PURE__ */ a(() => {
|
|
94
94
|
clearInterval(e(this, B)), clearInterval(e(this, D));
|
|
95
95
|
}, "clearTimer");
|
|
96
96
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
@@ -107,11 +107,11 @@ const Te = class Te extends HTMLElement {
|
|
|
107
107
|
}), e(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
109
|
n.stopPropagation(), n.preventDefault(), p(this, O, !0), this.shiftX = n.clientX - e(this, y).thumb.getBoundingClientRect().left;
|
|
110
|
-
const o = /* @__PURE__ */
|
|
110
|
+
const o = /* @__PURE__ */ a((l) => {
|
|
111
111
|
if (!e(this, O)) return;
|
|
112
112
|
const g = e(this, y).track.getBoundingClientRect();
|
|
113
|
-
e(this, P).call(this,
|
|
114
|
-
}, "onMouseMove"), r = /* @__PURE__ */
|
|
113
|
+
e(this, P).call(this, l.clientX - g.left - this.shiftX);
|
|
114
|
+
}, "onMouseMove"), r = /* @__PURE__ */ a(() => {
|
|
115
115
|
p(this, O, !1), i(), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
116
116
|
}, "onMouseUp");
|
|
117
117
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", r);
|
|
@@ -183,7 +183,7 @@ const Te = class Te extends HTMLElement {
|
|
|
183
183
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
184
184
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
185
185
|
`;
|
|
186
|
-
const t = /* @__PURE__ */
|
|
186
|
+
const t = /* @__PURE__ */ a(() => {
|
|
187
187
|
const i = e(this, _).querySelector(".ng-container-body");
|
|
188
188
|
if (!i) {
|
|
189
189
|
setTimeout(t, 10);
|
|
@@ -203,7 +203,7 @@ const Te = class Te extends HTMLElement {
|
|
|
203
203
|
e(this, N) && e(this, N).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
_ = new WeakMap(), O = new WeakMap(), y = new WeakMap(), B = new WeakMap(), D = new WeakMap(), N = new WeakMap(), ee = new WeakMap(), P = new WeakMap(), te = new WeakMap(),
|
|
206
|
+
_ = new WeakMap(), O = new WeakMap(), y = new WeakMap(), B = new WeakMap(), D = new WeakMap(), N = new WeakMap(), ee = new WeakMap(), P = new WeakMap(), te = new WeakMap(), a(Te, "NineTableHScrollBar");
|
|
207
207
|
let ge = Te;
|
|
208
208
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ge);
|
|
209
209
|
var X, M, q, I, $, H, se, ie;
|
|
@@ -215,13 +215,13 @@ const qe = class qe {
|
|
|
215
215
|
u(this, I, null);
|
|
216
216
|
u(this, $, 0);
|
|
217
217
|
u(this, H, 0);
|
|
218
|
-
u(this, se, /* @__PURE__ */
|
|
218
|
+
u(this, se, /* @__PURE__ */ a(() => {
|
|
219
219
|
e(this, ie).call(this);
|
|
220
220
|
}, "#init"));
|
|
221
221
|
/**
|
|
222
222
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
223
223
|
*/
|
|
224
|
-
u(this, ie, /* @__PURE__ */
|
|
224
|
+
u(this, ie, /* @__PURE__ */ a(() => {
|
|
225
225
|
!e(this, X) || !(e(this, X) instanceof HTMLElement) || (p(this, I, new ResizeObserver((s) => {
|
|
226
226
|
for (const t of s) {
|
|
227
227
|
const i = t.target;
|
|
@@ -231,7 +231,7 @@ const qe = class qe {
|
|
|
231
231
|
if (n > 0) {
|
|
232
232
|
const o = i.clientHeight || i.getBoundingClientRect().height || n;
|
|
233
233
|
let r = 0;
|
|
234
|
-
const
|
|
234
|
+
const l = i.querySelector(".ng-container-body") || i, g = l.querySelector("thead"), c = l.querySelector("tfoot");
|
|
235
235
|
g && (r += g.offsetHeight || g.getBoundingClientRect().height), c && (r += c.offsetHeight || c.getBoundingClientRect().height);
|
|
236
236
|
const h = Math.max(o - r, 100);
|
|
237
237
|
if (e(this, $) !== h && (p(this, $, h), e(this, q) !== null)) {
|
|
@@ -245,33 +245,33 @@ const qe = class qe {
|
|
|
245
245
|
}
|
|
246
246
|
})), e(this, I).observe(e(this, X)));
|
|
247
247
|
}, "#initResizeObserver"));
|
|
248
|
-
v(this, "initTemplate", /* @__PURE__ */
|
|
248
|
+
v(this, "initTemplate", /* @__PURE__ */ a((s) => {
|
|
249
249
|
const t = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
250
250
|
if (!t) return;
|
|
251
251
|
const i = Array.from(t.querySelectorAll("tr")).filter((n) => !n.classList.contains("nodata"));
|
|
252
252
|
p(this, M, i.map((n) => n.cloneNode(!0))), p(this, q, null), console.log(`[RowManager] Template initialized with ${e(this, M).length} row(s).`);
|
|
253
253
|
}, "initTemplate"));
|
|
254
|
-
v(this, "measureAndCacheHeight", /* @__PURE__ */
|
|
254
|
+
v(this, "measureAndCacheHeight", /* @__PURE__ */ a((s) => {
|
|
255
255
|
if (e(this, q) !== null)
|
|
256
256
|
return e(this, q);
|
|
257
257
|
if (e(this, M).length === 0)
|
|
258
258
|
throw new Error("[RowManager] Template TRs are empty.");
|
|
259
259
|
const t = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
260
260
|
if (!t) return 24;
|
|
261
|
-
t.querySelectorAll("tr:not(.nodata)").forEach((
|
|
261
|
+
t.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
262
262
|
const i = t.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
263
|
-
e(this, M).forEach((
|
|
264
|
-
n.appendChild(
|
|
263
|
+
e(this, M).forEach((l) => {
|
|
264
|
+
n.appendChild(l.cloneNode(!0));
|
|
265
265
|
}), i ? i.before(n) : t.appendChild(n);
|
|
266
266
|
let o = 0;
|
|
267
|
-
if (t.querySelectorAll("tr:not(.nodata)").forEach((
|
|
268
|
-
const c =
|
|
267
|
+
if (t.querySelectorAll("tr:not(.nodata)").forEach((l, g) => {
|
|
268
|
+
const c = l.offsetHeight;
|
|
269
269
|
if (c === 0)
|
|
270
270
|
throw new Error(`[RowManager] Rendered TR[${g}] height is 0. Check CSS styles.`);
|
|
271
271
|
o += c;
|
|
272
272
|
}), p(this, q, o), e(this, $) > 0) {
|
|
273
|
-
const
|
|
274
|
-
p(this, H,
|
|
273
|
+
const l = Math.ceil(e(this, $) / e(this, q));
|
|
274
|
+
p(this, H, l + 20);
|
|
275
275
|
}
|
|
276
276
|
return console.log(`[RowManager] Template Height Cached: ${e(this, q)}px | RowCount: ${e(this, H)}`), e(this, q);
|
|
277
277
|
}, "measureAndCacheHeight"));
|
|
@@ -291,19 +291,19 @@ const qe = class qe {
|
|
|
291
291
|
/**
|
|
292
292
|
* π― μΊμλ ν κ°μλ₯Ό κ³§λ°λ‘ κ°μ Έμμ TR λΌλ μ£Όμ
(μ€λ³΅ κ³μ° μ κ±°)
|
|
293
293
|
*/
|
|
294
|
-
v(this, "renderRows", /* @__PURE__ */
|
|
294
|
+
v(this, "renderRows", /* @__PURE__ */ a((s) => {
|
|
295
295
|
if (e(this, M).length === 0) return;
|
|
296
296
|
const t = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
297
297
|
if (!t) return;
|
|
298
298
|
t.querySelectorAll("tr:not(.nodata)").forEach((r) => r.remove());
|
|
299
299
|
const i = t.querySelector("tr.nodata"), n = document.createDocumentFragment(), o = e(this, H);
|
|
300
300
|
for (let r = 0; r < o; r++)
|
|
301
|
-
e(this, M).forEach((
|
|
302
|
-
n.appendChild(
|
|
301
|
+
e(this, M).forEach((l) => {
|
|
302
|
+
n.appendChild(l.cloneNode(!0));
|
|
303
303
|
});
|
|
304
304
|
i ? i.before(n) : t.appendChild(n), console.log(`[RowManager] Rendered ${o} sets into DOM.`);
|
|
305
305
|
}, "renderRows"));
|
|
306
|
-
v(this, "destroy", /* @__PURE__ */
|
|
306
|
+
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
307
307
|
e(this, I) && (e(this, I).disconnect(), p(this, I, null));
|
|
308
308
|
}, "destroy"));
|
|
309
309
|
p(this, X, s), e(this, se).call(this);
|
|
@@ -312,7 +312,7 @@ const qe = class qe {
|
|
|
312
312
|
return e(this, M).length || 1;
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
|
-
X = new WeakMap(), M = new WeakMap(), q = new WeakMap(), I = new WeakMap(), $ = new WeakMap(), H = new WeakMap(), se = new WeakMap(), ie = new WeakMap(),
|
|
315
|
+
X = new WeakMap(), M = new WeakMap(), q = new WeakMap(), I = new WeakMap(), $ = new WeakMap(), H = new WeakMap(), se = new WeakMap(), ie = new WeakMap(), a(qe, "RowManager");
|
|
316
316
|
let pe = qe;
|
|
317
317
|
var L, F, ne;
|
|
318
318
|
const Z = class Z extends HTMLElement {
|
|
@@ -320,18 +320,18 @@ const Z = class Z extends HTMLElement {
|
|
|
320
320
|
super();
|
|
321
321
|
u(this, L, null);
|
|
322
322
|
u(this, F);
|
|
323
|
-
v(this, "init", /* @__PURE__ */
|
|
323
|
+
v(this, "init", /* @__PURE__ */ a((t) => {
|
|
324
324
|
if (!t) return;
|
|
325
|
-
const i = /* @__PURE__ */
|
|
326
|
-
const h = /* @__PURE__ */
|
|
325
|
+
const i = /* @__PURE__ */ a((c) => {
|
|
326
|
+
const h = /* @__PURE__ */ a((b) => {
|
|
327
327
|
if (b.querySelector("colgroup")) return;
|
|
328
|
-
const f = b.querySelector("tbody tr") || b.querySelector("tr"), S = f ? f.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"),
|
|
328
|
+
const f = b.querySelector("tbody tr") || b.querySelector("tr"), S = f ? f.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), C = Math.max(Math.floor((b.clientWidth || 600) / S), 100);
|
|
329
329
|
for (let R = 0; R < S; R++) {
|
|
330
330
|
const ue = document.createElement("col");
|
|
331
|
-
ue.setAttribute("width",
|
|
331
|
+
ue.setAttribute("width", C), x.appendChild(ue);
|
|
332
332
|
}
|
|
333
333
|
b.prepend(x);
|
|
334
|
-
}, "ensureColgroup"), d = /* @__PURE__ */
|
|
334
|
+
}, "ensureColgroup"), d = /* @__PURE__ */ a((b) => {
|
|
335
335
|
if (b.querySelector("thead")) return;
|
|
336
336
|
const f = document.createElement("thead"), S = b.querySelector("colgroup");
|
|
337
337
|
S ? S.after(f) : b.prepend(f);
|
|
@@ -339,14 +339,14 @@ const Z = class Z extends HTMLElement {
|
|
|
339
339
|
return h(c), d(c), c.classList.add("nine-table-element"), c;
|
|
340
340
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
341
341
|
p(this, L, i(n)), e(this, L).style.display = "table", e(this, F).initTemplate(e(this, L));
|
|
342
|
-
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"),
|
|
342
|
+
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"), l = this.querySelector(".ng-container-right"), g = /* @__PURE__ */ a((c, h, d = !1) => {
|
|
343
343
|
const b = c.cloneNode(!0), f = Array.from(b.querySelectorAll("colgroup col")), S = [];
|
|
344
|
-
return f.forEach((x,
|
|
344
|
+
return f.forEach((x, C) => {
|
|
345
345
|
const R = x.getAttribute("fixed");
|
|
346
|
-
(d ? !R || R === "" : R === h) || S.push(
|
|
346
|
+
(d ? !R || R === "" : R === h) || S.push(C);
|
|
347
347
|
}), S.reverse().forEach((x) => {
|
|
348
|
-
f[x] && f[x].remove(), b.querySelectorAll("tr").forEach((
|
|
349
|
-
const R =
|
|
348
|
+
f[x] && f[x].remove(), b.querySelectorAll("tr").forEach((C) => {
|
|
349
|
+
const R = C.querySelectorAll("th, td");
|
|
350
350
|
R[x] && R[x].remove();
|
|
351
351
|
});
|
|
352
352
|
}), b;
|
|
@@ -365,15 +365,15 @@ const Z = class Z extends HTMLElement {
|
|
|
365
365
|
const d = h > 0 ? h : 0;
|
|
366
366
|
o.style.flex = `0 0 ${d}px`, o.style.width = `${d}px`;
|
|
367
367
|
}
|
|
368
|
-
if (
|
|
368
|
+
if (l) {
|
|
369
369
|
const c = g(e(this, L), "right", !1);
|
|
370
370
|
let h = 0;
|
|
371
371
|
c.querySelectorAll("col").forEach((b) => {
|
|
372
372
|
const f = parseInt(b.getAttribute("width"), 10);
|
|
373
373
|
isNaN(f) || (h += f);
|
|
374
|
-
}),
|
|
374
|
+
}), l.innerHTML = "", l.appendChild(c);
|
|
375
375
|
const d = h > 0 ? h : 0;
|
|
376
|
-
|
|
376
|
+
l.style.flex = `0 0 ${d}px`, l.style.width = `${d}px`;
|
|
377
377
|
}
|
|
378
378
|
if (r) {
|
|
379
379
|
const c = this.getRowCount();
|
|
@@ -387,16 +387,16 @@ const Z = class Z extends HTMLElement {
|
|
|
387
387
|
c && typeof c.refresh == "function" && c.refresh();
|
|
388
388
|
}, 0), J.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
389
389
|
}, "init"));
|
|
390
|
-
v(this, "getRowCount", /* @__PURE__ */
|
|
391
|
-
v(this, "scrollToX", /* @__PURE__ */
|
|
390
|
+
v(this, "getRowCount", /* @__PURE__ */ a(() => e(this, L) ? e(this, L).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
391
|
+
v(this, "scrollToX", /* @__PURE__ */ a((t) => {
|
|
392
392
|
const i = this.querySelector(".ng-container-body");
|
|
393
393
|
i && (i.scrollLeft = t);
|
|
394
394
|
}, "scrollToX"));
|
|
395
|
-
v(this, "scrollToY", /* @__PURE__ */
|
|
395
|
+
v(this, "scrollToY", /* @__PURE__ */ a((t) => {
|
|
396
396
|
const i = this.querySelector(".ng-container-body");
|
|
397
397
|
i && (i.scrollTop = t);
|
|
398
398
|
}, "scrollToY"));
|
|
399
|
-
u(this, ne, /* @__PURE__ */
|
|
399
|
+
u(this, ne, /* @__PURE__ */ a(() => {
|
|
400
400
|
const t = Z.SCROLLBAR_SIZE;
|
|
401
401
|
this.innerHTML = `
|
|
402
402
|
<style>
|
|
@@ -522,14 +522,14 @@ const Z = class Z extends HTMLElement {
|
|
|
522
522
|
this.innerHTML = "", J.log("NineTableSheet destroyed.");
|
|
523
523
|
}
|
|
524
524
|
};
|
|
525
|
-
L = new WeakMap(), F = new WeakMap(), ne = new WeakMap(),
|
|
525
|
+
L = new WeakMap(), F = new WeakMap(), ne = new WeakMap(), a(Z, "NineTableSheet"), v(Z, "SCROLLBAR_SIZE", 16);
|
|
526
526
|
let ye = Z;
|
|
527
527
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ye);
|
|
528
528
|
var re;
|
|
529
529
|
const ke = class ke extends HTMLElement {
|
|
530
530
|
constructor() {
|
|
531
531
|
super();
|
|
532
|
-
u(this, re, /* @__PURE__ */
|
|
532
|
+
u(this, re, /* @__PURE__ */ a(() => {
|
|
533
533
|
const t = this.querySelector(".nine-tab-bar");
|
|
534
534
|
t && (t.addEventListener("click", (i) => {
|
|
535
535
|
const n = i.target.closest(".nine-tab-item");
|
|
@@ -538,17 +538,17 @@ const ke = class ke extends HTMLElement {
|
|
|
538
538
|
this.switchSheet(r, o);
|
|
539
539
|
}), this.switchSheet(0, !1));
|
|
540
540
|
}, "#init"));
|
|
541
|
-
v(this, "switchSheet", /* @__PURE__ */
|
|
542
|
-
const n = /* @__PURE__ */
|
|
541
|
+
v(this, "switchSheet", /* @__PURE__ */ a((t, i = !1) => {
|
|
542
|
+
const n = /* @__PURE__ */ a(() => {
|
|
543
543
|
const d = this.querySelector("nine-table-sheets-body");
|
|
544
544
|
d.querySelectorAll("nine-splitter").forEach((f) => {
|
|
545
|
-
const S = parseInt(f.dataset.splitIndex, 10), x = d.querySelector(`nine-table-sheet[data-index="${S - 1}"]`),
|
|
546
|
-
x &&
|
|
545
|
+
const S = parseInt(f.dataset.splitIndex, 10), x = d.querySelector(`nine-table-sheet[data-index="${S - 1}"]`), C = d.querySelector(`nine-table-sheet[data-index="${S}"]`);
|
|
546
|
+
x && C && x.classList.contains("active") && C.classList.contains("active") ? f.classList.add("active") : f.classList.remove("active");
|
|
547
547
|
});
|
|
548
|
-
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"),
|
|
549
|
-
if (!
|
|
548
|
+
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"), g = r.querySelectorAll("nine-table-sheet");
|
|
549
|
+
if (!l[t]) return;
|
|
550
550
|
if (!i)
|
|
551
|
-
|
|
551
|
+
l.forEach((d, b) => {
|
|
552
552
|
d.classList.toggle("active", b === t);
|
|
553
553
|
const f = r.querySelector(`nine-table-sheet[data-index="${b}"]`);
|
|
554
554
|
f && (f.style.flex = "");
|
|
@@ -556,7 +556,7 @@ const ke = class ke extends HTMLElement {
|
|
|
556
556
|
d.classList.toggle("active", b === t);
|
|
557
557
|
});
|
|
558
558
|
else {
|
|
559
|
-
const d =
|
|
559
|
+
const d = l[t], b = o.querySelectorAll(".nine-tab-item.active");
|
|
560
560
|
if (d.classList.contains("active") && b.length <= 1)
|
|
561
561
|
return;
|
|
562
562
|
d.classList.toggle("active");
|
|
@@ -585,27 +585,27 @@ const ke = class ke extends HTMLElement {
|
|
|
585
585
|
e(this, re).call(this);
|
|
586
586
|
}
|
|
587
587
|
};
|
|
588
|
-
re = new WeakMap(),
|
|
588
|
+
re = new WeakMap(), a(ke, "NineTableSheets");
|
|
589
589
|
let we = ke;
|
|
590
590
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", we);
|
|
591
591
|
var k, j, oe, G, le;
|
|
592
|
-
const
|
|
592
|
+
const Ae = class Ae {
|
|
593
593
|
constructor(s) {
|
|
594
594
|
u(this, k);
|
|
595
595
|
u(this, j, null);
|
|
596
|
-
u(this, oe, /* @__PURE__ */
|
|
596
|
+
u(this, oe, /* @__PURE__ */ a(() => {
|
|
597
597
|
const s = e(this, k).host;
|
|
598
598
|
s && (p(this, j, new ResizeObserver((t) => {
|
|
599
599
|
for (let i of t)
|
|
600
600
|
s.getAttribute("auto-height") === "true" && e(this, G).call(this, s);
|
|
601
601
|
})), e(this, j).observe(s));
|
|
602
602
|
}, "#observeResize"));
|
|
603
|
-
u(this, G, /* @__PURE__ */
|
|
604
|
-
var
|
|
605
|
-
const t = (
|
|
603
|
+
u(this, G, /* @__PURE__ */ a((s) => {
|
|
604
|
+
var C, R;
|
|
605
|
+
const t = (C = s.shadowRoot) == null ? void 0 : C.querySelector("nine-table-sheet.active");
|
|
606
606
|
if (!t) return;
|
|
607
|
-
const i = ((R = t.getRowCount) == null ? void 0 : R.call(t)) || 0, n = parseInt(s.getAttribute("max-display-row"), 10) || 10, o = Math.min(i, n), r = t.querySelector("tbody tr") || t.querySelector("tr"),
|
|
608
|
-
s.style.height = `${S}px`, s.style.maxHeight = `${n *
|
|
607
|
+
const i = ((R = t.getRowCount) == null ? void 0 : R.call(t)) || 0, n = parseInt(s.getAttribute("max-display-row"), 10) || 10, o = Math.min(i, n), r = t.querySelector("tbody tr") || t.querySelector("tr"), l = r ? r.getBoundingClientRect().height : 32, g = e(this, k).querySelector("nine-table-header"), c = e(this, k).querySelector("nine-table-sheets-footer"), h = g ? g.getBoundingClientRect().height : 40, d = c ? c.getBoundingClientRect().height : 32, f = h + d + 16, S = o * l + f;
|
|
608
|
+
s.style.height = `${S}px`, s.style.maxHeight = `${n * l + f}px`;
|
|
609
609
|
const x = e(this, k).querySelector("nine-table-sheets-body");
|
|
610
610
|
x && (x.style.overflowY = i > n ? "auto" : "hidden");
|
|
611
611
|
}, "#applyAutoHeight"));
|
|
@@ -615,18 +615,20 @@ const Ce = class Ce {
|
|
|
615
615
|
/**
|
|
616
616
|
* π― 쑰건 λ°μ§μ§ μκ³ μνΈκ° 2κ° μ΄μμ΄λ©΄ μ€ν리ν°λ₯Ό 무쑰건 κ°μ λ‘ λμ°λ νμ€ν λκΈ°ν λ©μλ
|
|
617
617
|
*/
|
|
618
|
-
v(this, "updateSplitters", /* @__PURE__ */
|
|
618
|
+
v(this, "updateSplitters", /* @__PURE__ */ a(() => {
|
|
619
619
|
const s = e(this, k).querySelector("nine-table-sheets-body");
|
|
620
620
|
if (!s) return;
|
|
621
|
-
Array.from(s.querySelectorAll("nine-
|
|
622
|
-
|
|
621
|
+
const t = Array.from(s.querySelectorAll("nine-table-sheet"));
|
|
622
|
+
Array.from(s.querySelectorAll("nine-splitter.h")).forEach((n, o) => {
|
|
623
|
+
const r = t[o], l = t[o + 1];
|
|
624
|
+
r && l && r.classList.contains("active") && l.classList.contains("active") ? n.style.setProperty("display", "block", "important") : n.style.setProperty("display", "none", "important");
|
|
623
625
|
});
|
|
624
626
|
}, "updateSplitters"));
|
|
625
|
-
u(this, le, /* @__PURE__ */
|
|
627
|
+
u(this, le, /* @__PURE__ */ a(() => {
|
|
626
628
|
const s = e(this, k).host, i = Array.from(s.children).filter((c) => c.tagName === "TABLE"), n = s.getAttribute("auto-height") === "true", o = i.length, r = i.map((c, h) => {
|
|
627
629
|
const b = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, f = h < o - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
628
630
|
return b + f;
|
|
629
|
-
}).join(""),
|
|
631
|
+
}).join(""), l = i.map((c, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
630
632
|
e(this, k).innerHTML = `
|
|
631
633
|
<style>
|
|
632
634
|
:host {
|
|
@@ -728,7 +730,7 @@ const Ce = class Ce {
|
|
|
728
730
|
<nine-table-sheets>
|
|
729
731
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
730
732
|
<nine-table-sheets-footer>
|
|
731
|
-
<div class="nine-tab-bar">${
|
|
733
|
+
<div class="nine-tab-bar">${l}</div>
|
|
732
734
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
733
735
|
</nine-table-sheets-footer>
|
|
734
736
|
</nine-table-sheets>
|
|
@@ -746,14 +748,14 @@ const Ce = class Ce {
|
|
|
746
748
|
p(this, k, s), e(this, le).call(this), e(this, oe).call(this);
|
|
747
749
|
}
|
|
748
750
|
};
|
|
749
|
-
k = new WeakMap(), j = new WeakMap(), oe = new WeakMap(), G = new WeakMap(), le = new WeakMap(),
|
|
750
|
-
let me =
|
|
751
|
+
k = new WeakMap(), j = new WeakMap(), oe = new WeakMap(), G = new WeakMap(), le = new WeakMap(), a(Ae, "LayoutManager");
|
|
752
|
+
let me = Ae;
|
|
751
753
|
var z, V;
|
|
752
|
-
const
|
|
754
|
+
const Ce = class Ce {
|
|
753
755
|
constructor(s) {
|
|
754
756
|
u(this, z);
|
|
755
757
|
u(this, V, -1);
|
|
756
|
-
v(this, "count", /* @__PURE__ */
|
|
758
|
+
v(this, "count", /* @__PURE__ */ a(() => e(this, z).rawRecords.length, "count"));
|
|
757
759
|
p(this, z, s);
|
|
758
760
|
}
|
|
759
761
|
get at() {
|
|
@@ -769,18 +771,18 @@ const Ae = class Ae {
|
|
|
769
771
|
});
|
|
770
772
|
}
|
|
771
773
|
};
|
|
772
|
-
z = new WeakMap(), V = new WeakMap(),
|
|
773
|
-
let ve =
|
|
774
|
-
var E, m,
|
|
774
|
+
z = new WeakMap(), V = new WeakMap(), a(Ce, "ngRow");
|
|
775
|
+
let ve = Ce;
|
|
776
|
+
var E, m, A, U, ae, W, ce, Q, he, de, K;
|
|
775
777
|
const T = class T {
|
|
776
778
|
constructor(s, t) {
|
|
777
779
|
u(this, E);
|
|
778
780
|
u(this, m);
|
|
779
|
-
u(this,
|
|
781
|
+
u(this, A, []);
|
|
780
782
|
u(this, U, []);
|
|
781
783
|
u(this, ae, 0);
|
|
782
784
|
u(this, W, []);
|
|
783
|
-
u(this, ce, /* @__PURE__ */
|
|
785
|
+
u(this, ce, /* @__PURE__ */ a(() => {
|
|
784
786
|
p(this, W, []);
|
|
785
787
|
const s = e(this, E).template || [];
|
|
786
788
|
Array.from(s).forEach((t) => {
|
|
@@ -790,10 +792,10 @@ const T = class T {
|
|
|
790
792
|
t.__ng || (t.__ng = e(this, Q).call(this)), t.__ng.height = e(this, W).slice();
|
|
791
793
|
});
|
|
792
794
|
}, "#initialize"));
|
|
793
|
-
v(this, "set", /* @__PURE__ */
|
|
795
|
+
v(this, "set", /* @__PURE__ */ a((s) => {
|
|
794
796
|
this.clear(), this.add(s, !1);
|
|
795
797
|
}, "set"));
|
|
796
|
-
u(this, Q, /* @__PURE__ */
|
|
798
|
+
u(this, Q, /* @__PURE__ */ a(() => ({
|
|
797
799
|
rowState: T.ROW_STATE.EMPTY,
|
|
798
800
|
deleted: !1,
|
|
799
801
|
filtered: !1,
|
|
@@ -802,81 +804,81 @@ const T = class T {
|
|
|
802
804
|
c: {},
|
|
803
805
|
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, W).slice(), -1, {}, {}]
|
|
804
806
|
}), "#getDefaultMeta"));
|
|
805
|
-
v(this, "reset", /* @__PURE__ */
|
|
806
|
-
p(this,
|
|
807
|
+
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
808
|
+
p(this, A, []), p(this, U, []);
|
|
807
809
|
}, "reset"));
|
|
808
|
-
v(this, "clear", /* @__PURE__ */
|
|
810
|
+
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
809
811
|
var s;
|
|
810
|
-
e(this, m).rawRecords = [], p(this,
|
|
812
|
+
e(this, m).rawRecords = [], p(this, A, []), p(this, U, []), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
811
813
|
}, "clear"));
|
|
812
|
-
u(this, he, /* @__PURE__ */
|
|
814
|
+
u(this, he, /* @__PURE__ */ a((s) => {
|
|
813
815
|
var n;
|
|
814
816
|
Array.isArray(s) || (s = [s]);
|
|
815
817
|
const t = typeof ((n = e(this, E).fields) == null ? void 0 : n.get) == "function" ? e(this, E).fields.get() : Object.keys(s[0] || {}), i = [];
|
|
816
818
|
return s.forEach((o) => {
|
|
817
819
|
const r = { v: [] };
|
|
818
|
-
t.forEach((
|
|
819
|
-
r.v.push(o[
|
|
820
|
+
t.forEach((l) => {
|
|
821
|
+
r.v.push(o[l] !== void 0 && o[l] !== null ? o[l] : "");
|
|
820
822
|
}), i.push(r);
|
|
821
823
|
}), i;
|
|
822
824
|
}, "#json2Array"));
|
|
823
|
-
u(this, de, /* @__PURE__ */
|
|
825
|
+
u(this, de, /* @__PURE__ */ a((s) => (Array.isArray(s) || (s = [s]), s.forEach((t) => {
|
|
824
826
|
t.__ng = e(this, Q).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = T.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
825
827
|
}), s), "#defaultInsert"));
|
|
826
|
-
v(this, "add", /* @__PURE__ */
|
|
828
|
+
v(this, "add", /* @__PURE__ */ a((s, t = !0) => {
|
|
827
829
|
var o;
|
|
828
830
|
s === void 0 && (s = {});
|
|
829
831
|
const i = e(this, he).call(this, s);
|
|
830
832
|
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, de).call(this, i)), this.resetRecords();
|
|
831
833
|
const n = this.count() - 1;
|
|
832
|
-
return t || i.forEach((r,
|
|
833
|
-
const g = e(this, m).rawRecords[n -
|
|
834
|
+
return t || i.forEach((r, l) => {
|
|
835
|
+
const g = e(this, m).rawRecords[n - l];
|
|
834
836
|
g && (g.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
835
837
|
}), (o = e(this, m).viewRecords) != null && o.reset && e(this, m).viewRecords.reset(), n;
|
|
836
838
|
}, "add"));
|
|
837
|
-
v(this, "delete", /* @__PURE__ */
|
|
839
|
+
v(this, "delete", /* @__PURE__ */ a((s) => {
|
|
838
840
|
var i;
|
|
839
841
|
let t = [];
|
|
840
842
|
Array.isArray(s) ? t = s : typeof s > "u" ? t = [e(this, m).owner.row.at] : t = [parseInt(s, 10)], t.sort((n, o) => o - n).forEach((n) => {
|
|
841
|
-
if (e(this,
|
|
842
|
-
const o = e(this,
|
|
843
|
-
e(this,
|
|
843
|
+
if (e(this, A)[n]) {
|
|
844
|
+
const o = e(this, A)[n].__ng.rowid;
|
|
845
|
+
e(this, A)[n].__ng.rowState === T.ROW_STATE.INSERT ? e(this, m).rawRecords = e(this, m).rawRecords.filter((r) => r.__ng.rowid !== o) : e(this, m).rawRecords.forEach((r) => {
|
|
844
846
|
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = T.ROW_STATE.DELETE);
|
|
845
847
|
});
|
|
846
848
|
}
|
|
847
849
|
}), this.resetRecords(), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
848
850
|
}, "delete"));
|
|
849
|
-
v(this, "setValue", /* @__PURE__ */
|
|
851
|
+
v(this, "setValue", /* @__PURE__ */ a((s, t, i) => {
|
|
850
852
|
var g;
|
|
851
853
|
s = parseInt(s, 10);
|
|
852
854
|
const o = (typeof ((g = e(this, E).fields) == null ? void 0 : g.get) == "function" ? e(this, E).fields.get() : []).indexOf(t);
|
|
853
855
|
if (o < 0) return;
|
|
854
856
|
const r = this.getValidData()[s];
|
|
855
857
|
if (!r) return;
|
|
856
|
-
const
|
|
857
|
-
|
|
858
|
+
const l = r.v[o];
|
|
859
|
+
l !== i && r.__ng.rowState !== T.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(t) || (r.__ng.o[t] = l), r.__ng.rowState = T.ROW_STATE.UPDATE), r.v[o] = i, e(this, m).owner.refreshData && e(this, m).owner.refreshData(s);
|
|
858
860
|
}, "setValue"));
|
|
859
|
-
v(this, "resetRecords", /* @__PURE__ */
|
|
860
|
-
p(this, U, e(this, m).rawRecords.filter((s) => !s.__ng.deleted)), p(this,
|
|
861
|
+
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
862
|
+
p(this, U, e(this, m).rawRecords.filter((s) => !s.__ng.deleted)), p(this, A, e(this, m).rawRecords.filter((s) => !s.__ng.deleted && !s.__ng.filtered)), e(this, m).rawRecords.forEach((s, t) => {
|
|
861
863
|
s.__ng.rowidx = t;
|
|
862
|
-
}), e(this,
|
|
864
|
+
}), e(this, A).forEach((s, t) => {
|
|
863
865
|
s.__ng.i = t;
|
|
864
866
|
});
|
|
865
867
|
}, "resetRecords"));
|
|
866
|
-
v(this, "getValidData", /* @__PURE__ */
|
|
867
|
-
u(this, K, /* @__PURE__ */
|
|
868
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (e(this, A).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, A)), "getValidData"));
|
|
869
|
+
u(this, K, /* @__PURE__ */ a((s) => {
|
|
868
870
|
var i;
|
|
869
871
|
if (!s) return s;
|
|
870
872
|
const t = typeof ((i = e(this, E).fields) == null ? void 0 : i.get) == "function" ? e(this, E).fields.get() : [];
|
|
871
873
|
return Array.isArray(s) ? s.filter((n) => !n.__ng.deleted).map((n) => {
|
|
872
874
|
const o = {};
|
|
873
|
-
return t.forEach((r,
|
|
874
|
-
o[r] = n.v ? n.v[
|
|
875
|
+
return t.forEach((r, l) => {
|
|
876
|
+
o[r] = n.v ? n.v[l] : n[r];
|
|
875
877
|
}), o.__ng = n.__ng, o;
|
|
876
878
|
}) : s;
|
|
877
879
|
}, "#conv2"));
|
|
878
|
-
v(this, "count", /* @__PURE__ */
|
|
879
|
-
v(this, "get", /* @__PURE__ */
|
|
880
|
+
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
881
|
+
v(this, "get", /* @__PURE__ */ a((s, t) => {
|
|
880
882
|
var o;
|
|
881
883
|
const i = this.getValidData();
|
|
882
884
|
if (!i || i.length <= 0) return;
|
|
@@ -901,7 +903,7 @@ const T = class T {
|
|
|
901
903
|
return ++He(this, ae)._;
|
|
902
904
|
}
|
|
903
905
|
};
|
|
904
|
-
E = new WeakMap(), m = new WeakMap(),
|
|
906
|
+
E = new WeakMap(), m = new WeakMap(), A = new WeakMap(), U = new WeakMap(), ae = new WeakMap(), W = new WeakMap(), ce = new WeakMap(), Q = new WeakMap(), he = new WeakMap(), de = new WeakMap(), K = new WeakMap(), a(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
905
907
|
v(T, "ROW_STATE", {
|
|
906
908
|
EMPTY: "EMPTY",
|
|
907
909
|
NORMAL: "NORMAL",
|
|
@@ -929,7 +931,7 @@ const Le = class Le {
|
|
|
929
931
|
}, this.setDataSource([]);
|
|
930
932
|
}
|
|
931
933
|
};
|
|
932
|
-
|
|
934
|
+
a(Le, "ngDataManager");
|
|
933
935
|
let Se = Le;
|
|
934
936
|
var Y, fe;
|
|
935
937
|
const _e = class _e extends HTMLElement {
|
|
@@ -959,7 +961,7 @@ const _e = class _e extends HTMLElement {
|
|
|
959
961
|
return e(this, Y);
|
|
960
962
|
}
|
|
961
963
|
};
|
|
962
|
-
Y = new WeakMap(), fe = new WeakMap(),
|
|
964
|
+
Y = new WeakMap(), fe = new WeakMap(), a(_e, "NineTable");
|
|
963
965
|
let Ee = _e;
|
|
964
966
|
customElements.get("nine-table") || customElements.define("nine-table", Ee);
|
|
965
967
|
//# sourceMappingURL=nine-table.js.map
|