@ninebone/table 0.0.152 β 0.0.154
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 +124 -123
- 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 l = (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
|
+
l(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__ */ l(() => {
|
|
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__ */ l(() => {
|
|
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"), a = t.clientWidth, g = i.scrollWidth;
|
|
48
|
+
if (a !== 0 && g > a)
|
|
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 * (a / 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__ */ l((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 a = t;
|
|
76
|
+
a < 0 && (a = 0);
|
|
77
77
|
const g = o.width - r;
|
|
78
|
-
|
|
78
|
+
a > g && (a = g), a = parseInt(a, 10), e(this, y).thumb.style.left = `${a}px`, e(this, y).left.disabled = a === 0, e(this, y).right.disabled = a >= 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 ? -a * (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)`, a > 0 && a < g - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
|
-
u(this, te, /* @__PURE__ */
|
|
84
|
-
const t = /* @__PURE__ */
|
|
83
|
+
u(this, te, /* @__PURE__ */ l(() => {
|
|
84
|
+
const t = /* @__PURE__ */ l((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__ */ l(() => {
|
|
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__ */ l((a) => {
|
|
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, a.clientX - g.left - this.shiftX);
|
|
114
|
+
}, "onMouseMove"), r = /* @__PURE__ */ l(() => {
|
|
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__ */ l(() => {
|
|
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(), l(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__ */ l(() => {
|
|
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__ */ l(() => {
|
|
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 a = i.querySelector(".ng-container-body") || i, g = a.querySelector("thead"), c = a.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__ */ l((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__ */ l((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((a) => a.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((a) => {
|
|
264
|
+
n.appendChild(a.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((a, g) => {
|
|
268
|
+
const c = a.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 a = Math.ceil(e(this, $) / e(this, q));
|
|
274
|
+
p(this, H, a + 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__ */ l((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((a) => {
|
|
302
|
+
n.appendChild(a.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__ */ l(() => {
|
|
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(), l(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__ */ l((t) => {
|
|
324
324
|
if (!t) return;
|
|
325
|
-
const i = /* @__PURE__ */
|
|
326
|
-
const h = /* @__PURE__ */
|
|
325
|
+
const i = /* @__PURE__ */ l((c) => {
|
|
326
|
+
const h = /* @__PURE__ */ l((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"), A = 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", A), x.appendChild(ue);
|
|
332
332
|
}
|
|
333
333
|
b.prepend(x);
|
|
334
|
-
}, "ensureColgroup"), d = /* @__PURE__ */
|
|
334
|
+
}, "ensureColgroup"), d = /* @__PURE__ */ l((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"), a = this.querySelector(".ng-container-right"), g = /* @__PURE__ */ l((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, A) => {
|
|
345
345
|
const R = x.getAttribute("fixed");
|
|
346
|
-
(d ? !R || R === "" : R === h) || S.push(
|
|
346
|
+
(d ? !R || R === "" : R === h) || S.push(A);
|
|
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((A) => {
|
|
349
|
+
const R = A.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 (a) {
|
|
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
|
+
}), a.innerHTML = "", a.appendChild(c);
|
|
375
375
|
const d = h > 0 ? h : 0;
|
|
376
|
-
|
|
376
|
+
a.style.flex = `0 0 ${d}px`, a.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__ */ l(() => e(this, L) ? e(this, L).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
391
|
+
v(this, "scrollToX", /* @__PURE__ */ l((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__ */ l((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__ */ l(() => {
|
|
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(), l(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__ */ l(() => {
|
|
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__ */ l((t, i = !1) => {
|
|
542
|
+
const n = /* @__PURE__ */ l(() => {
|
|
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}"]`), A = d.querySelector(`nine-table-sheet[data-index="${S}"]`);
|
|
546
|
+
x && A && x.classList.contains("active") && A.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"), a = o.querySelectorAll(".nine-tab-item"), g = r.querySelectorAll("nine-table-sheet");
|
|
549
|
+
if (!a[t]) return;
|
|
550
550
|
if (!i)
|
|
551
|
-
|
|
551
|
+
a.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 = a[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,47 +585,48 @@ 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(), l(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 Ce = class Ce {
|
|
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__ */ l(() => {
|
|
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__ */ l((s) => {
|
|
604
|
+
var A, R;
|
|
605
|
+
const t = (A = s.shadowRoot) == null ? void 0 : A.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"), a = 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 * a + f;
|
|
608
|
+
s.style.height = `${S}px`, s.style.maxHeight = `${n * a + 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"));
|
|
612
612
|
/**
|
|
613
613
|
* π― νμ± μνΈ μνμ λ°λΌ μ€ν리ν°(.h)λ₯Ό μ§μ νμν΄ λ³΄μ¬μ£Όκ±°λ μ¨κΈ°λ μ§κ΄μ λ©μλ
|
|
614
614
|
*/
|
|
615
|
-
|
|
615
|
+
/**
|
|
616
|
+
* π― 쑰건 λ°μ§μ§ μκ³ μνΈκ° 2κ° μ΄μμ΄λ©΄ μ€ν리ν°λ₯Ό 무쑰건 κ°μ λ‘ λμ°λ νμ€ν λκΈ°ν λ©μλ
|
|
617
|
+
*/
|
|
618
|
+
v(this, "updateSplitters", /* @__PURE__ */ l(() => {
|
|
616
619
|
const s = e(this, k).querySelector("nine-table-sheets-body");
|
|
617
620
|
if (!s) return;
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
const r = t[o], l = t[o + 1];
|
|
621
|
-
r && l && r.classList.contains("active") && l.classList.contains("active") ? n.style.display = "block" : n.style.display = "none";
|
|
621
|
+
Array.from(s.querySelectorAll("nine-splitter.h")).forEach((i) => {
|
|
622
|
+
i.style.setProperty("display", "block", "important");
|
|
622
623
|
});
|
|
623
624
|
}, "updateSplitters"));
|
|
624
|
-
u(this, le, /* @__PURE__ */
|
|
625
|
+
u(this, le, /* @__PURE__ */ l(() => {
|
|
625
626
|
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) => {
|
|
626
627
|
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>` : "";
|
|
627
628
|
return b + f;
|
|
628
|
-
}).join(""),
|
|
629
|
+
}).join(""), a = i.map((c, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
629
630
|
e(this, k).innerHTML = `
|
|
630
631
|
<style>
|
|
631
632
|
:host {
|
|
@@ -727,7 +728,7 @@ const Ae = class Ae {
|
|
|
727
728
|
<nine-table-sheets>
|
|
728
729
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
729
730
|
<nine-table-sheets-footer>
|
|
730
|
-
<div class="nine-tab-bar">${
|
|
731
|
+
<div class="nine-tab-bar">${a}</div>
|
|
731
732
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
732
733
|
</nine-table-sheets-footer>
|
|
733
734
|
</nine-table-sheets>
|
|
@@ -745,14 +746,14 @@ const Ae = class Ae {
|
|
|
745
746
|
p(this, k, s), e(this, le).call(this), e(this, oe).call(this);
|
|
746
747
|
}
|
|
747
748
|
};
|
|
748
|
-
k = new WeakMap(), j = new WeakMap(), oe = new WeakMap(), G = new WeakMap(), le = new WeakMap(),
|
|
749
|
-
let me =
|
|
749
|
+
k = new WeakMap(), j = new WeakMap(), oe = new WeakMap(), G = new WeakMap(), le = new WeakMap(), l(Ce, "LayoutManager");
|
|
750
|
+
let me = Ce;
|
|
750
751
|
var z, V;
|
|
751
|
-
const
|
|
752
|
+
const Ae = class Ae {
|
|
752
753
|
constructor(s) {
|
|
753
754
|
u(this, z);
|
|
754
755
|
u(this, V, -1);
|
|
755
|
-
v(this, "count", /* @__PURE__ */
|
|
756
|
+
v(this, "count", /* @__PURE__ */ l(() => e(this, z).rawRecords.length, "count"));
|
|
756
757
|
p(this, z, s);
|
|
757
758
|
}
|
|
758
759
|
get at() {
|
|
@@ -768,18 +769,18 @@ const Ce = class Ce {
|
|
|
768
769
|
});
|
|
769
770
|
}
|
|
770
771
|
};
|
|
771
|
-
z = new WeakMap(), V = new WeakMap(),
|
|
772
|
-
let ve =
|
|
773
|
-
var E, m,
|
|
772
|
+
z = new WeakMap(), V = new WeakMap(), l(Ae, "ngRow");
|
|
773
|
+
let ve = Ae;
|
|
774
|
+
var E, m, C, U, ae, W, ce, Q, he, de, K;
|
|
774
775
|
const T = class T {
|
|
775
776
|
constructor(s, t) {
|
|
776
777
|
u(this, E);
|
|
777
778
|
u(this, m);
|
|
778
|
-
u(this,
|
|
779
|
+
u(this, C, []);
|
|
779
780
|
u(this, U, []);
|
|
780
781
|
u(this, ae, 0);
|
|
781
782
|
u(this, W, []);
|
|
782
|
-
u(this, ce, /* @__PURE__ */
|
|
783
|
+
u(this, ce, /* @__PURE__ */ l(() => {
|
|
783
784
|
p(this, W, []);
|
|
784
785
|
const s = e(this, E).template || [];
|
|
785
786
|
Array.from(s).forEach((t) => {
|
|
@@ -789,10 +790,10 @@ const T = class T {
|
|
|
789
790
|
t.__ng || (t.__ng = e(this, Q).call(this)), t.__ng.height = e(this, W).slice();
|
|
790
791
|
});
|
|
791
792
|
}, "#initialize"));
|
|
792
|
-
v(this, "set", /* @__PURE__ */
|
|
793
|
+
v(this, "set", /* @__PURE__ */ l((s) => {
|
|
793
794
|
this.clear(), this.add(s, !1);
|
|
794
795
|
}, "set"));
|
|
795
|
-
u(this, Q, /* @__PURE__ */
|
|
796
|
+
u(this, Q, /* @__PURE__ */ l(() => ({
|
|
796
797
|
rowState: T.ROW_STATE.EMPTY,
|
|
797
798
|
deleted: !1,
|
|
798
799
|
filtered: !1,
|
|
@@ -801,81 +802,81 @@ const T = class T {
|
|
|
801
802
|
c: {},
|
|
802
803
|
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, W).slice(), -1, {}, {}]
|
|
803
804
|
}), "#getDefaultMeta"));
|
|
804
|
-
v(this, "reset", /* @__PURE__ */
|
|
805
|
-
p(this,
|
|
805
|
+
v(this, "reset", /* @__PURE__ */ l(() => {
|
|
806
|
+
p(this, C, []), p(this, U, []);
|
|
806
807
|
}, "reset"));
|
|
807
|
-
v(this, "clear", /* @__PURE__ */
|
|
808
|
+
v(this, "clear", /* @__PURE__ */ l(() => {
|
|
808
809
|
var s;
|
|
809
|
-
e(this, m).rawRecords = [], p(this,
|
|
810
|
+
e(this, m).rawRecords = [], p(this, C, []), p(this, U, []), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
810
811
|
}, "clear"));
|
|
811
|
-
u(this, he, /* @__PURE__ */
|
|
812
|
+
u(this, he, /* @__PURE__ */ l((s) => {
|
|
812
813
|
var n;
|
|
813
814
|
Array.isArray(s) || (s = [s]);
|
|
814
815
|
const t = typeof ((n = e(this, E).fields) == null ? void 0 : n.get) == "function" ? e(this, E).fields.get() : Object.keys(s[0] || {}), i = [];
|
|
815
816
|
return s.forEach((o) => {
|
|
816
817
|
const r = { v: [] };
|
|
817
|
-
t.forEach((
|
|
818
|
-
r.v.push(o[
|
|
818
|
+
t.forEach((a) => {
|
|
819
|
+
r.v.push(o[a] !== void 0 && o[a] !== null ? o[a] : "");
|
|
819
820
|
}), i.push(r);
|
|
820
821
|
}), i;
|
|
821
822
|
}, "#json2Array"));
|
|
822
|
-
u(this, de, /* @__PURE__ */
|
|
823
|
+
u(this, de, /* @__PURE__ */ l((s) => (Array.isArray(s) || (s = [s]), s.forEach((t) => {
|
|
823
824
|
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;
|
|
824
825
|
}), s), "#defaultInsert"));
|
|
825
|
-
v(this, "add", /* @__PURE__ */
|
|
826
|
+
v(this, "add", /* @__PURE__ */ l((s, t = !0) => {
|
|
826
827
|
var o;
|
|
827
828
|
s === void 0 && (s = {});
|
|
828
829
|
const i = e(this, he).call(this, s);
|
|
829
830
|
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, de).call(this, i)), this.resetRecords();
|
|
830
831
|
const n = this.count() - 1;
|
|
831
|
-
return t || i.forEach((r,
|
|
832
|
-
const g = e(this, m).rawRecords[n -
|
|
832
|
+
return t || i.forEach((r, a) => {
|
|
833
|
+
const g = e(this, m).rawRecords[n - a];
|
|
833
834
|
g && (g.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
834
835
|
}), (o = e(this, m).viewRecords) != null && o.reset && e(this, m).viewRecords.reset(), n;
|
|
835
836
|
}, "add"));
|
|
836
|
-
v(this, "delete", /* @__PURE__ */
|
|
837
|
+
v(this, "delete", /* @__PURE__ */ l((s) => {
|
|
837
838
|
var i;
|
|
838
839
|
let t = [];
|
|
839
840
|
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) => {
|
|
840
|
-
if (e(this,
|
|
841
|
-
const o = e(this,
|
|
842
|
-
e(this,
|
|
841
|
+
if (e(this, C)[n]) {
|
|
842
|
+
const o = e(this, C)[n].__ng.rowid;
|
|
843
|
+
e(this, C)[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) => {
|
|
843
844
|
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = T.ROW_STATE.DELETE);
|
|
844
845
|
});
|
|
845
846
|
}
|
|
846
847
|
}), this.resetRecords(), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
847
848
|
}, "delete"));
|
|
848
|
-
v(this, "setValue", /* @__PURE__ */
|
|
849
|
+
v(this, "setValue", /* @__PURE__ */ l((s, t, i) => {
|
|
849
850
|
var g;
|
|
850
851
|
s = parseInt(s, 10);
|
|
851
852
|
const o = (typeof ((g = e(this, E).fields) == null ? void 0 : g.get) == "function" ? e(this, E).fields.get() : []).indexOf(t);
|
|
852
853
|
if (o < 0) return;
|
|
853
854
|
const r = this.getValidData()[s];
|
|
854
855
|
if (!r) return;
|
|
855
|
-
const
|
|
856
|
-
|
|
856
|
+
const a = r.v[o];
|
|
857
|
+
a !== i && r.__ng.rowState !== T.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(t) || (r.__ng.o[t] = a), r.__ng.rowState = T.ROW_STATE.UPDATE), r.v[o] = i, e(this, m).owner.refreshData && e(this, m).owner.refreshData(s);
|
|
857
858
|
}, "setValue"));
|
|
858
|
-
v(this, "resetRecords", /* @__PURE__ */
|
|
859
|
-
p(this, U, e(this, m).rawRecords.filter((s) => !s.__ng.deleted)), p(this,
|
|
859
|
+
v(this, "resetRecords", /* @__PURE__ */ l(() => {
|
|
860
|
+
p(this, U, e(this, m).rawRecords.filter((s) => !s.__ng.deleted)), p(this, C, e(this, m).rawRecords.filter((s) => !s.__ng.deleted && !s.__ng.filtered)), e(this, m).rawRecords.forEach((s, t) => {
|
|
860
861
|
s.__ng.rowidx = t;
|
|
861
|
-
}), e(this,
|
|
862
|
+
}), e(this, C).forEach((s, t) => {
|
|
862
863
|
s.__ng.i = t;
|
|
863
864
|
});
|
|
864
865
|
}, "resetRecords"));
|
|
865
|
-
v(this, "getValidData", /* @__PURE__ */
|
|
866
|
-
u(this, K, /* @__PURE__ */
|
|
866
|
+
v(this, "getValidData", /* @__PURE__ */ l(() => (e(this, C).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, C)), "getValidData"));
|
|
867
|
+
u(this, K, /* @__PURE__ */ l((s) => {
|
|
867
868
|
var i;
|
|
868
869
|
if (!s) return s;
|
|
869
870
|
const t = typeof ((i = e(this, E).fields) == null ? void 0 : i.get) == "function" ? e(this, E).fields.get() : [];
|
|
870
871
|
return Array.isArray(s) ? s.filter((n) => !n.__ng.deleted).map((n) => {
|
|
871
872
|
const o = {};
|
|
872
|
-
return t.forEach((r,
|
|
873
|
-
o[r] = n.v ? n.v[
|
|
873
|
+
return t.forEach((r, a) => {
|
|
874
|
+
o[r] = n.v ? n.v[a] : n[r];
|
|
874
875
|
}), o.__ng = n.__ng, o;
|
|
875
876
|
}) : s;
|
|
876
877
|
}, "#conv2"));
|
|
877
|
-
v(this, "count", /* @__PURE__ */
|
|
878
|
-
v(this, "get", /* @__PURE__ */
|
|
878
|
+
v(this, "count", /* @__PURE__ */ l(() => this.getValidData().length, "count"));
|
|
879
|
+
v(this, "get", /* @__PURE__ */ l((s, t) => {
|
|
879
880
|
var o;
|
|
880
881
|
const i = this.getValidData();
|
|
881
882
|
if (!i || i.length <= 0) return;
|
|
@@ -900,7 +901,7 @@ const T = class T {
|
|
|
900
901
|
return ++He(this, ae)._;
|
|
901
902
|
}
|
|
902
903
|
};
|
|
903
|
-
E = new WeakMap(), m = new WeakMap(),
|
|
904
|
+
E = new WeakMap(), m = new WeakMap(), C = 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(), l(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
904
905
|
v(T, "ROW_STATE", {
|
|
905
906
|
EMPTY: "EMPTY",
|
|
906
907
|
NORMAL: "NORMAL",
|
|
@@ -928,7 +929,7 @@ const Le = class Le {
|
|
|
928
929
|
}, this.setDataSource([]);
|
|
929
930
|
}
|
|
930
931
|
};
|
|
931
|
-
|
|
932
|
+
l(Le, "ngDataManager");
|
|
932
933
|
let Se = Le;
|
|
933
934
|
var Y, fe;
|
|
934
935
|
const _e = class _e extends HTMLElement {
|
|
@@ -958,7 +959,7 @@ const _e = class _e extends HTMLElement {
|
|
|
958
959
|
return e(this, Y);
|
|
959
960
|
}
|
|
960
961
|
};
|
|
961
|
-
Y = new WeakMap(), fe = new WeakMap(),
|
|
962
|
+
Y = new WeakMap(), fe = new WeakMap(), l(_e, "NineTable");
|
|
962
963
|
let Ee = _e;
|
|
963
964
|
customElements.get("nine-table") || customElements.define("nine-table", Ee);
|
|
964
965
|
//# sourceMappingURL=nine-table.js.map
|