@ninebone/table 0.0.122 β 0.0.123
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 +96 -98
- 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
|
@@ -22,8 +22,8 @@ const me = class me extends Ie.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
c(me, "Trace");
|
|
24
24
|
let ce = me;
|
|
25
|
-
const
|
|
26
|
-
var I, W, p, O, z,
|
|
25
|
+
const U = new ce();
|
|
26
|
+
var I, W, p, O, z, B, G, D, J;
|
|
27
27
|
const ve = class ve extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
@@ -32,20 +32,20 @@ const ve = class ve extends HTMLElement {
|
|
|
32
32
|
f(this, p);
|
|
33
33
|
f(this, O);
|
|
34
34
|
f(this, z);
|
|
35
|
-
f(this,
|
|
35
|
+
f(this, B);
|
|
36
36
|
f(this, G, /* @__PURE__ */ c(() => {
|
|
37
37
|
if (!e(this, I)) return;
|
|
38
38
|
const t = e(this, I).querySelector(".ng-container-body");
|
|
39
|
-
t && (y(this,
|
|
39
|
+
t && (y(this, B, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), e(this,
|
|
41
|
+
})), e(this, B).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ c(() => {
|
|
44
44
|
if (!e(this, I) || !e(this, p) || e(this, W)) return;
|
|
45
45
|
const t = e(this, p).container, i = t.querySelector("table");
|
|
46
46
|
if (!i) return;
|
|
47
|
-
const n = e(this, p).track, o = e(this, p).thumb, r = e(this, I).querySelector(".ng-container-bottom"), l = t.clientWidth,
|
|
48
|
-
if (l !== 0 &&
|
|
47
|
+
const n = e(this, p).track, o = e(this, p).thumb, r = e(this, I).querySelector(".ng-container-bottom"), l = t.clientWidth, h = i.scrollWidth;
|
|
48
|
+
if (l !== 0 && h > l)
|
|
49
49
|
r && (r.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
r && (r.style.display = "none");
|
|
@@ -53,41 +53,41 @@ const ve = class ve extends HTMLElement {
|
|
|
53
53
|
}
|
|
54
54
|
const a = n.clientWidth;
|
|
55
55
|
if (a <= 0) return;
|
|
56
|
-
const g = Math.max(Math.min(a * (l /
|
|
56
|
+
const g = Math.max(Math.min(a * (l / h), a), 20);
|
|
57
57
|
o.style.width = `${g}px`;
|
|
58
|
-
let
|
|
58
|
+
let d = 0;
|
|
59
59
|
const u = i.style.transform;
|
|
60
60
|
if (u && u.includes("translateX")) {
|
|
61
61
|
const R = u.match(/translateX\(([-\d.]+)px\)/);
|
|
62
|
-
R && R[1] && (
|
|
62
|
+
R && R[1] && (d = parseFloat(R[1]));
|
|
63
63
|
} else
|
|
64
|
-
|
|
65
|
-
let b = parseInt(Math.abs(
|
|
64
|
+
d = parseInt(i.style.left || 0, 10);
|
|
65
|
+
let b = parseInt(Math.abs(d) * a / h, 10);
|
|
66
66
|
b < 0 && (b = 0);
|
|
67
67
|
const x = a - g;
|
|
68
68
|
b > x && (b = x), o.style.left = `${b}px`, e(this, p).left.disabled = b === 0, e(this, p).right.disabled = b >= x - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
|
-
f(this,
|
|
70
|
+
f(this, D, /* @__PURE__ */ c((t) => {
|
|
71
71
|
if (!e(this, p)) return !1;
|
|
72
72
|
const i = e(this, p).container, n = i.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
74
74
|
const o = e(this, p).track.getBoundingClientRect(), r = e(this, p).thumb.clientWidth;
|
|
75
75
|
let l = t;
|
|
76
76
|
l < 0 && (l = 0);
|
|
77
|
-
const
|
|
78
|
-
l >
|
|
77
|
+
const h = o.width - r;
|
|
78
|
+
l > h && (l = h), l = parseInt(l, 10), e(this, p).thumb.style.left = `${l}px`, e(this, p).left.disabled = l === 0, e(this, p).right.disabled = l >= h - 1;
|
|
79
79
|
const a = i.clientWidth, g = n.scrollWidth;
|
|
80
|
-
let
|
|
81
|
-
return -
|
|
80
|
+
let d = h > 0 ? -l * (g - a) / h : 0;
|
|
81
|
+
return -d > g - a && (d = -(g - a)), -d + 5 > g - a && (d = -(g - a)), a >= g && (d = 0), n.style.transform = `translateX(${d}px)`, l > 0 && l < h - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
83
|
f(this, J, /* @__PURE__ */ c(() => {
|
|
84
84
|
const t = /* @__PURE__ */ c((n) => {
|
|
85
85
|
clearInterval(e(this, O)), clearInterval(e(this, z));
|
|
86
86
|
const o = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
87
|
-
e(this,
|
|
87
|
+
e(this, D).call(this, o + n), y(this, O, setInterval(() => {
|
|
88
88
|
clearInterval(e(this, O)), y(this, z, setInterval(() => {
|
|
89
89
|
const r = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
90
|
-
e(this,
|
|
90
|
+
e(this, D).call(this, r + n) || clearInterval(e(this, z));
|
|
91
91
|
}, 50));
|
|
92
92
|
}, 500));
|
|
93
93
|
}, "delayScroll"), i = /* @__PURE__ */ c(() => {
|
|
@@ -103,14 +103,14 @@ const ve = class ve extends HTMLElement {
|
|
|
103
103
|
if (n.button !== 0) return;
|
|
104
104
|
n.preventDefault();
|
|
105
105
|
const o = e(this, p).track.getBoundingClientRect(), r = e(this, p).thumb.clientWidth;
|
|
106
|
-
e(this,
|
|
106
|
+
e(this, D).call(this, n.clientX - o.left - r / 2);
|
|
107
107
|
}), e(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
109
|
n.stopPropagation(), n.preventDefault(), y(this, W, !0), this.shiftX = n.clientX - e(this, p).thumb.getBoundingClientRect().left;
|
|
110
110
|
const o = /* @__PURE__ */ c((l) => {
|
|
111
111
|
if (!e(this, W)) return;
|
|
112
|
-
const
|
|
113
|
-
e(this,
|
|
112
|
+
const h = e(this, p).track.getBoundingClientRect();
|
|
113
|
+
e(this, D).call(this, l.clientX - h.left - this.shiftX);
|
|
114
114
|
}, "onMouseMove"), r = /* @__PURE__ */ c(() => {
|
|
115
115
|
y(this, W, !1), i(), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
116
116
|
}, "onMouseUp");
|
|
@@ -200,16 +200,16 @@ const ve = class ve extends HTMLElement {
|
|
|
200
200
|
t();
|
|
201
201
|
}
|
|
202
202
|
disconnectedCallback() {
|
|
203
|
-
e(this,
|
|
203
|
+
e(this, B) && e(this, B).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
I = new WeakMap(), W = new WeakMap(), p = new WeakMap(), O = new WeakMap(), z = new WeakMap(),
|
|
206
|
+
I = new WeakMap(), W = new WeakMap(), p = new WeakMap(), O = new WeakMap(), z = new WeakMap(), B = new WeakMap(), G = new WeakMap(), D = new WeakMap(), J = new WeakMap(), c(ve, "NineTableHScrollBar");
|
|
207
207
|
let he = ve;
|
|
208
208
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", he);
|
|
209
|
-
var
|
|
209
|
+
var V, M, C;
|
|
210
210
|
const xe = class xe {
|
|
211
211
|
constructor(s) {
|
|
212
|
-
f(this,
|
|
212
|
+
f(this, V);
|
|
213
213
|
f(this, M, []);
|
|
214
214
|
f(this, C, null);
|
|
215
215
|
v(this, "initTemplate", /* @__PURE__ */ c((s) => {
|
|
@@ -231,21 +231,19 @@ const xe = class xe {
|
|
|
231
231
|
n.appendChild(l.cloneNode(!0));
|
|
232
232
|
}), i ? i.before(n) : t.appendChild(n);
|
|
233
233
|
let o = 0;
|
|
234
|
-
return t.querySelectorAll("tr:not(.nodata)").forEach((l,
|
|
234
|
+
return t.querySelectorAll("tr:not(.nodata)").forEach((l, h) => {
|
|
235
235
|
const a = l.offsetHeight;
|
|
236
236
|
if (a === 0)
|
|
237
|
-
throw new Error(`[RowManager] Rendered TR[${
|
|
238
|
-
o += a,
|
|
237
|
+
throw new Error(`[RowManager] Rendered TR[${h}] height is 0. Check CSS styles.`);
|
|
238
|
+
o += a, U.log(`[RowManager] Measured TR[${h}] height: ${a}px`);
|
|
239
239
|
}), y(this, C, o), console.log(`[RowManager] Template Height Cached Successfully: ${e(this, C)}px`), e(this, C);
|
|
240
240
|
}, "measureAndCacheHeight"));
|
|
241
241
|
/**
|
|
242
242
|
* π― nine-table-sheet μ 체 λμ΄λ₯Ό κΈ°μ€μΌλ‘ νμν ν κ°―μ μ°μ
|
|
243
243
|
*/
|
|
244
244
|
v(this, "calculateRequiredRowCount", /* @__PURE__ */ c((s) => {
|
|
245
|
-
const t = e(this,
|
|
246
|
-
|
|
247
|
-
const n = e(this, C) !== null ? e(this, C) : this.measureAndCacheHeight(s), l = Math.ceil(i / n) + 20;
|
|
248
|
-
return console.log(`[RowManager] NineTableSheet Height: ${i}px | Template Height: ${n}px | Target Rows: ${l}`), l;
|
|
245
|
+
const t = e(this, V) instanceof HTMLElement ? e(this, V) : s, i = t.querySelector(".ng-container-top") || t, n = i.clientHeight || i.getBoundingClientRect().height, o = n > 0 ? n : s.clientHeight || 400, r = e(this, C) !== null ? e(this, C) : this.measureAndCacheHeight(s), a = Math.ceil(o / r) + 20;
|
|
246
|
+
return console.log(`[RowManager] Viewport Height: ${o}px | Template Height: ${r}px | Target Rows: ${a}`), a;
|
|
249
247
|
}, "calculateRequiredRowCount"));
|
|
250
248
|
v(this, "renderRows", /* @__PURE__ */ c((s, t = null) => {
|
|
251
249
|
if (e(this, M).length === 0) return;
|
|
@@ -255,21 +253,21 @@ const xe = class xe {
|
|
|
255
253
|
const n = i.querySelector("tr.nodata"), o = document.createDocumentFragment(), r = t !== null ? t : this.calculateRequiredRowCount(s);
|
|
256
254
|
console.log(`[RowManager] Rendering ${r} row sets into container...`);
|
|
257
255
|
for (let l = 0; l < r; l++)
|
|
258
|
-
e(this, M).forEach((
|
|
259
|
-
o.appendChild(
|
|
256
|
+
e(this, M).forEach((h) => {
|
|
257
|
+
o.appendChild(h.cloneNode(!0));
|
|
260
258
|
});
|
|
261
259
|
n ? n.before(o) : i.appendChild(o), console.log(`[RowManager] Successfully rendered. Total DOM tr count: ${i.querySelectorAll("tr:not(.nodata)").length}`);
|
|
262
260
|
}, "renderRows"));
|
|
263
|
-
y(this,
|
|
261
|
+
y(this, V, s);
|
|
264
262
|
}
|
|
265
263
|
get templateLength() {
|
|
266
264
|
return e(this, M).length || 1;
|
|
267
265
|
}
|
|
268
266
|
};
|
|
269
|
-
|
|
267
|
+
V = new WeakMap(), M = new WeakMap(), C = new WeakMap(), c(xe, "RowManager");
|
|
270
268
|
let de = xe;
|
|
271
269
|
var k, L, Q;
|
|
272
|
-
const
|
|
270
|
+
const Y = class Y extends HTMLElement {
|
|
273
271
|
constructor() {
|
|
274
272
|
super();
|
|
275
273
|
f(this, k, null);
|
|
@@ -285,19 +283,19 @@ const U = class U extends HTMLElement {
|
|
|
285
283
|
ae.setAttribute("width", A), R.appendChild(ae);
|
|
286
284
|
}
|
|
287
285
|
u.prepend(R);
|
|
288
|
-
}, "ensureColgroup"),
|
|
286
|
+
}, "ensureColgroup"), d = /* @__PURE__ */ c((u) => {
|
|
289
287
|
if (u.querySelector("thead")) return;
|
|
290
288
|
const b = document.createElement("thead"), x = u.querySelector("colgroup");
|
|
291
289
|
x ? x.after(b) : u.prepend(b);
|
|
292
290
|
}, "ensureThead");
|
|
293
|
-
return g(a),
|
|
291
|
+
return g(a), d(a), a.classList.add("nine-table-element"), a;
|
|
294
292
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
295
293
|
y(this, k, i(n)), e(this, k).style.display = "table", e(this, L).initTemplate(e(this, k));
|
|
296
|
-
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"), l = this.querySelector(".ng-container-right"),
|
|
294
|
+
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"), l = this.querySelector(".ng-container-right"), h = /* @__PURE__ */ c((a, g, d = !1) => {
|
|
297
295
|
const u = a.cloneNode(!0), b = Array.from(u.querySelectorAll("colgroup col")), x = [];
|
|
298
296
|
return b.forEach((R, A) => {
|
|
299
297
|
const E = R.getAttribute("fixed");
|
|
300
|
-
(
|
|
298
|
+
(d ? !E || E === "" : E === g) || x.push(A);
|
|
301
299
|
}), x.reverse().forEach((R) => {
|
|
302
300
|
b[R] && b[R].remove(), u.querySelectorAll("tr").forEach((A) => {
|
|
303
301
|
const E = A.querySelectorAll("th, td");
|
|
@@ -306,30 +304,30 @@ const U = class U extends HTMLElement {
|
|
|
306
304
|
}), u;
|
|
307
305
|
}, "filterTableByFixed");
|
|
308
306
|
if (r) {
|
|
309
|
-
const a =
|
|
307
|
+
const a = h(e(this, k), null, !0);
|
|
310
308
|
r.innerHTML = "", r.appendChild(a), e(this, L).measureAndCacheHeight(r), e(this, L).renderRows(r);
|
|
311
309
|
}
|
|
312
310
|
if (o) {
|
|
313
|
-
const a =
|
|
311
|
+
const a = h(e(this, k), "left", !1);
|
|
314
312
|
let g = 0;
|
|
315
313
|
a.querySelectorAll("col").forEach((b) => {
|
|
316
314
|
const x = parseInt(b.getAttribute("width"), 10);
|
|
317
315
|
isNaN(x) || (g += x);
|
|
318
316
|
}), o.innerHTML = "", o.appendChild(a);
|
|
319
|
-
const
|
|
320
|
-
e(this, L).renderRows(o,
|
|
317
|
+
const d = e(this, L).calculateRequiredRowCount(o);
|
|
318
|
+
e(this, L).renderRows(o, d);
|
|
321
319
|
const u = g > 0 ? g : 0;
|
|
322
320
|
o.style.flex = `0 0 ${u}px`, o.style.width = `${u}px`;
|
|
323
321
|
}
|
|
324
322
|
if (l) {
|
|
325
|
-
const a =
|
|
323
|
+
const a = h(e(this, k), "right", !1);
|
|
326
324
|
let g = 0;
|
|
327
325
|
a.querySelectorAll("col").forEach((b) => {
|
|
328
326
|
const x = parseInt(b.getAttribute("width"), 10);
|
|
329
327
|
isNaN(x) || (g += x);
|
|
330
328
|
}), l.innerHTML = "", l.appendChild(a);
|
|
331
|
-
const
|
|
332
|
-
e(this, L).renderRows(l,
|
|
329
|
+
const d = e(this, L).calculateRequiredRowCount(l);
|
|
330
|
+
e(this, L).renderRows(l, d);
|
|
333
331
|
const u = g > 0 ? g : 0;
|
|
334
332
|
l.style.flex = `0 0 ${u}px`, l.style.width = `${u}px`;
|
|
335
333
|
}
|
|
@@ -343,7 +341,7 @@ const U = class U extends HTMLElement {
|
|
|
343
341
|
setTimeout(() => {
|
|
344
342
|
const a = this.querySelector("nine-table-hscrollbar");
|
|
345
343
|
a && typeof a.refresh == "function" && a.refresh();
|
|
346
|
-
}, 0),
|
|
344
|
+
}, 0), U.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
347
345
|
}, "init"));
|
|
348
346
|
v(this, "getRowCount", /* @__PURE__ */ c(() => e(this, k) ? e(this, k).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
349
347
|
v(this, "scrollToX", /* @__PURE__ */ c((t) => {
|
|
@@ -355,7 +353,7 @@ const U = class U extends HTMLElement {
|
|
|
355
353
|
i && (i.scrollTop = t);
|
|
356
354
|
}, "scrollToY"));
|
|
357
355
|
f(this, Q, /* @__PURE__ */ c(() => {
|
|
358
|
-
const t =
|
|
356
|
+
const t = Y.SCROLLBAR_SIZE;
|
|
359
357
|
this.innerHTML = `
|
|
360
358
|
<style>
|
|
361
359
|
nine-table-sheet {
|
|
@@ -477,11 +475,11 @@ const U = class U extends HTMLElement {
|
|
|
477
475
|
e(this, Q).call(this);
|
|
478
476
|
}
|
|
479
477
|
disconnectedCallback() {
|
|
480
|
-
this.innerHTML = "",
|
|
478
|
+
this.innerHTML = "", U.log("NineTableSheet destroyed.");
|
|
481
479
|
}
|
|
482
480
|
};
|
|
483
|
-
k = new WeakMap(), L = new WeakMap(), Q = new WeakMap(), c(
|
|
484
|
-
let fe =
|
|
481
|
+
k = new WeakMap(), L = new WeakMap(), Q = new WeakMap(), c(Y, "NineTableSheet"), v(Y, "SCROLLBAR_SIZE", 16);
|
|
482
|
+
let fe = Y;
|
|
485
483
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", fe);
|
|
486
484
|
var ee;
|
|
487
485
|
const Re = class Re extends HTMLElement {
|
|
@@ -498,44 +496,44 @@ const Re = class Re extends HTMLElement {
|
|
|
498
496
|
}, "#init"));
|
|
499
497
|
v(this, "switchSheet", /* @__PURE__ */ c((t, i = !1) => {
|
|
500
498
|
const n = /* @__PURE__ */ c(() => {
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
const x = parseInt(b.dataset.splitIndex, 10), R =
|
|
499
|
+
const d = this.querySelector("nine-table-sheets-body");
|
|
500
|
+
d.querySelectorAll("nine-splitter").forEach((b) => {
|
|
501
|
+
const x = parseInt(b.dataset.splitIndex, 10), R = d.querySelector(`nine-table-sheet[data-index="${x - 1}"]`), A = d.querySelector(`nine-table-sheet[data-index="${x}"]`);
|
|
504
502
|
R && A && R.classList.contains("active") && A.classList.contains("active") ? b.classList.add("active") : b.classList.remove("active");
|
|
505
503
|
});
|
|
506
|
-
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"),
|
|
504
|
+
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"), h = r.querySelectorAll("nine-table-sheet");
|
|
507
505
|
if (!l[t]) return;
|
|
508
506
|
if (!i)
|
|
509
|
-
l.forEach((
|
|
510
|
-
|
|
507
|
+
l.forEach((d, u) => {
|
|
508
|
+
d.classList.toggle("active", u === t);
|
|
511
509
|
const b = r.querySelector(`nine-table-sheet[data-index="${u}"]`);
|
|
512
510
|
b && (b.style.flex = "");
|
|
513
|
-
}),
|
|
514
|
-
|
|
511
|
+
}), h.forEach((d, u) => {
|
|
512
|
+
d.classList.toggle("active", u === t);
|
|
515
513
|
});
|
|
516
514
|
else {
|
|
517
|
-
const
|
|
518
|
-
if (
|
|
515
|
+
const d = l[t], u = o.querySelectorAll(".nine-tab-item.active");
|
|
516
|
+
if (d.classList.contains("active") && u.length <= 1)
|
|
519
517
|
return;
|
|
520
|
-
|
|
518
|
+
d.classList.toggle("active");
|
|
521
519
|
const b = r.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
522
520
|
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
523
521
|
}
|
|
524
522
|
const a = Array.from(r.querySelectorAll("nine-table-sheet.active"));
|
|
525
523
|
if (a.length > 1) {
|
|
526
|
-
const
|
|
524
|
+
const d = 1 / a.length;
|
|
527
525
|
a.forEach((u) => {
|
|
528
|
-
(!u.style.flex || u.style.flex === "1 1 100%") && (u.style.flex = `${
|
|
526
|
+
(!u.style.flex || u.style.flex === "1 1 100%") && (u.style.flex = `${d} ${d} 0px`);
|
|
529
527
|
});
|
|
530
528
|
} else
|
|
531
|
-
a.forEach((
|
|
532
|
-
|
|
529
|
+
a.forEach((d) => {
|
|
530
|
+
d.style.flex = "1 1 100%";
|
|
533
531
|
});
|
|
534
532
|
n();
|
|
535
533
|
const g = r.querySelector("nine-table-sheet.active");
|
|
536
534
|
if (g && typeof g.getRowCount == "function") {
|
|
537
|
-
const
|
|
538
|
-
|
|
535
|
+
const d = this.querySelector("#row-count");
|
|
536
|
+
d && (d.textContent = g.getRowCount().toLocaleString());
|
|
539
537
|
}
|
|
540
538
|
}, "switchSheet"));
|
|
541
539
|
}
|
|
@@ -562,13 +560,13 @@ const Se = class Se {
|
|
|
562
560
|
var A, E;
|
|
563
561
|
const t = (A = s.shadowRoot) == null ? void 0 : A.querySelector("nine-table-sheet.active");
|
|
564
562
|
if (!t) return;
|
|
565
|
-
const i = ((E = t.getRowCount) == null ? void 0 : E.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,
|
|
563
|
+
const i = ((E = t.getRowCount) == null ? void 0 : E.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, h = e(this, _).querySelector("nine-table-header"), a = e(this, _).querySelector("nine-table-sheets-footer"), g = h ? h.getBoundingClientRect().height : 40, d = a ? a.getBoundingClientRect().height : 32, b = g + d + 16, x = o * l + b;
|
|
566
564
|
s.style.height = `${x}px`, s.style.maxHeight = `${n * l + b}px`;
|
|
567
565
|
const R = e(this, _).querySelector("nine-table-sheets-body");
|
|
568
566
|
R && (R.style.overflowY = i > n ? "auto" : "hidden");
|
|
569
567
|
}, "#applyAutoHeight"));
|
|
570
568
|
f(this, se, /* @__PURE__ */ c(() => {
|
|
571
|
-
const s = e(this, _).host, i = Array.from(s.children).filter((
|
|
569
|
+
const s = e(this, _).host, i = Array.from(s.children).filter((h) => h.tagName === "TABLE"), n = s.getAttribute("auto-height") === "true", o = i.map((h, a) => `<nine-table-sheet class="${a === 0 ? "active" : ""}" data-index="${a}"></nine-table-sheet>`).join(""), r = i.map((h, a) => `<div class="nine-tab-item ${a === 0 ? "active" : ""}" data-index="${a}">Sheet ${a + 1}</div>`).join("");
|
|
572
570
|
e(this, _).innerHTML = `
|
|
573
571
|
<style>
|
|
574
572
|
:host {
|
|
@@ -668,9 +666,9 @@ const Se = class Se {
|
|
|
668
666
|
<nine-table-footer></nine-table-footer>
|
|
669
667
|
`;
|
|
670
668
|
const l = e(this, _).querySelectorAll("nine-table-sheet");
|
|
671
|
-
l == null || l.forEach((
|
|
669
|
+
l == null || l.forEach((h, a) => {
|
|
672
670
|
i[a] && setTimeout(() => {
|
|
673
|
-
|
|
671
|
+
h.init(i[a]), n && e(this, K).call(this, s);
|
|
674
672
|
});
|
|
675
673
|
});
|
|
676
674
|
}, "#render"));
|
|
@@ -679,36 +677,36 @@ const Se = class Se {
|
|
|
679
677
|
};
|
|
680
678
|
_ = new WeakMap(), Z = new WeakMap(), te = new WeakMap(), K = new WeakMap(), se = new WeakMap(), c(Se, "LayoutManager");
|
|
681
679
|
let be = Se;
|
|
682
|
-
var $,
|
|
680
|
+
var $, N;
|
|
683
681
|
const Ee = class Ee {
|
|
684
682
|
constructor(s) {
|
|
685
683
|
f(this, $);
|
|
686
|
-
f(this,
|
|
684
|
+
f(this, N, -1);
|
|
687
685
|
v(this, "count", /* @__PURE__ */ c(() => e(this, $).rawRecords.length, "count"));
|
|
688
686
|
y(this, $, s);
|
|
689
687
|
}
|
|
690
688
|
get at() {
|
|
691
|
-
return e(this,
|
|
689
|
+
return e(this, N);
|
|
692
690
|
}
|
|
693
691
|
set at(s) {
|
|
694
692
|
var i, n;
|
|
695
|
-
y(this,
|
|
693
|
+
y(this, N, parseInt(s, 10));
|
|
696
694
|
const t = ((n = (i = e(this, $).owner).querySelector) == null ? void 0 : n.call(i, ".ng-container-body")) || e(this, $).owner.body;
|
|
697
|
-
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this,
|
|
695
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, N)}"]`) && setTimeout(() => {
|
|
698
696
|
var o, r;
|
|
699
|
-
(r = (o = e(this, $).owner).scrollTo_V1) == null || r.call(o, e(this,
|
|
697
|
+
(r = (o = e(this, $).owner).scrollTo_V1) == null || r.call(o, e(this, N));
|
|
700
698
|
});
|
|
701
699
|
}
|
|
702
700
|
};
|
|
703
|
-
$ = new WeakMap(),
|
|
701
|
+
$ = new WeakMap(), N = new WeakMap(), c(Ee, "ngRow");
|
|
704
702
|
let ge = Ee;
|
|
705
|
-
var S, m, q,
|
|
703
|
+
var S, m, q, X, ie, H, ne, j, re, oe, F;
|
|
706
704
|
const T = class T {
|
|
707
705
|
constructor(s, t) {
|
|
708
706
|
f(this, S);
|
|
709
707
|
f(this, m);
|
|
710
708
|
f(this, q, []);
|
|
711
|
-
f(this,
|
|
709
|
+
f(this, X, []);
|
|
712
710
|
f(this, ie, 0);
|
|
713
711
|
f(this, H, []);
|
|
714
712
|
f(this, ne, /* @__PURE__ */ c(() => {
|
|
@@ -734,11 +732,11 @@ const T = class T {
|
|
|
734
732
|
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, H).slice(), -1, {}, {}]
|
|
735
733
|
}), "#getDefaultMeta"));
|
|
736
734
|
v(this, "reset", /* @__PURE__ */ c(() => {
|
|
737
|
-
y(this, q, []), y(this,
|
|
735
|
+
y(this, q, []), y(this, X, []);
|
|
738
736
|
}, "reset"));
|
|
739
737
|
v(this, "clear", /* @__PURE__ */ c(() => {
|
|
740
738
|
var s;
|
|
741
|
-
e(this, m).rawRecords = [], y(this, q, []), y(this,
|
|
739
|
+
e(this, m).rawRecords = [], y(this, q, []), y(this, X, []), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
742
740
|
}, "clear"));
|
|
743
741
|
f(this, re, /* @__PURE__ */ c((s) => {
|
|
744
742
|
var n;
|
|
@@ -761,8 +759,8 @@ const T = class T {
|
|
|
761
759
|
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, oe).call(this, i)), this.resetRecords();
|
|
762
760
|
const n = this.count() - 1;
|
|
763
761
|
return t || i.forEach((r, l) => {
|
|
764
|
-
const
|
|
765
|
-
|
|
762
|
+
const h = e(this, m).rawRecords[n - l];
|
|
763
|
+
h && (h.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
766
764
|
}), (o = e(this, m).viewRecords) != null && o.reset && e(this, m).viewRecords.reset(), n;
|
|
767
765
|
}, "add"));
|
|
768
766
|
v(this, "delete", /* @__PURE__ */ c((s) => {
|
|
@@ -778,9 +776,9 @@ const T = class T {
|
|
|
778
776
|
}), this.resetRecords(), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
779
777
|
}, "delete"));
|
|
780
778
|
v(this, "setValue", /* @__PURE__ */ c((s, t, i) => {
|
|
781
|
-
var
|
|
779
|
+
var h;
|
|
782
780
|
s = parseInt(s, 10);
|
|
783
|
-
const o = (typeof ((
|
|
781
|
+
const o = (typeof ((h = e(this, S).fields) == null ? void 0 : h.get) == "function" ? e(this, S).fields.get() : []).indexOf(t);
|
|
784
782
|
if (o < 0) return;
|
|
785
783
|
const r = this.getValidData()[s];
|
|
786
784
|
if (!r) return;
|
|
@@ -788,14 +786,14 @@ const T = class T {
|
|
|
788
786
|
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);
|
|
789
787
|
}, "setValue"));
|
|
790
788
|
v(this, "resetRecords", /* @__PURE__ */ c(() => {
|
|
791
|
-
y(this,
|
|
789
|
+
y(this, X, e(this, m).rawRecords.filter((s) => !s.__ng.deleted)), y(this, q, e(this, m).rawRecords.filter((s) => !s.__ng.deleted && !s.__ng.filtered)), e(this, m).rawRecords.forEach((s, t) => {
|
|
792
790
|
s.__ng.rowidx = t;
|
|
793
791
|
}), e(this, q).forEach((s, t) => {
|
|
794
792
|
s.__ng.i = t;
|
|
795
793
|
});
|
|
796
794
|
}, "resetRecords"));
|
|
797
795
|
v(this, "getValidData", /* @__PURE__ */ c(() => (e(this, q).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, q)), "getValidData"));
|
|
798
|
-
f(this,
|
|
796
|
+
f(this, F, /* @__PURE__ */ c((s) => {
|
|
799
797
|
var i;
|
|
800
798
|
if (!s) return s;
|
|
801
799
|
const t = typeof ((i = e(this, S).fields) == null ? void 0 : i.get) == "function" ? e(this, S).fields.get() : [];
|
|
@@ -811,19 +809,19 @@ const T = class T {
|
|
|
811
809
|
var o;
|
|
812
810
|
const i = this.getValidData();
|
|
813
811
|
if (!i || i.length <= 0) return;
|
|
814
|
-
if (s == null) return e(this,
|
|
812
|
+
if (s == null) return e(this, F).call(this, i);
|
|
815
813
|
if (s < 0 || s >= i.length) return null;
|
|
816
814
|
const n = typeof ((o = e(this, S).fields) == null ? void 0 : o.get) == "function" ? e(this, S).fields.get() : [];
|
|
817
815
|
if (t != null) {
|
|
818
816
|
const r = n.indexOf(t);
|
|
819
817
|
return r >= 0 ? i[s].v[r] : null;
|
|
820
818
|
}
|
|
821
|
-
return e(this,
|
|
819
|
+
return e(this, F).call(this, i[s]);
|
|
822
820
|
}, "get"));
|
|
823
821
|
y(this, S, s), y(this, m, t), e(this, ne).call(this);
|
|
824
822
|
}
|
|
825
823
|
get source() {
|
|
826
|
-
return e(this,
|
|
824
|
+
return e(this, F).call(this, e(this, m).rawRecords);
|
|
827
825
|
}
|
|
828
826
|
set source(s) {
|
|
829
827
|
this.clear(), this.add(s, !1);
|
|
@@ -832,7 +830,7 @@ const T = class T {
|
|
|
832
830
|
return ++Le(this, ie)._;
|
|
833
831
|
}
|
|
834
832
|
};
|
|
835
|
-
S = new WeakMap(), m = new WeakMap(), q = new WeakMap(),
|
|
833
|
+
S = new WeakMap(), m = new WeakMap(), q = new WeakMap(), X = new WeakMap(), ie = new WeakMap(), H = new WeakMap(), ne = new WeakMap(), j = new WeakMap(), re = new WeakMap(), oe = new WeakMap(), F = new WeakMap(), c(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
836
834
|
v(T, "ROW_STATE", {
|
|
837
835
|
EMPTY: "EMPTY",
|
|
838
836
|
NORMAL: "NORMAL",
|
|
@@ -872,10 +870,10 @@ const qe = class qe extends HTMLElement {
|
|
|
872
870
|
this.attachShadow({ mode: "open" }), y(this, P, new ye(this));
|
|
873
871
|
}
|
|
874
872
|
connectedCallback() {
|
|
875
|
-
y(this, le, new be(this.shadowRoot)),
|
|
873
|
+
y(this, le, new be(this.shadowRoot)), U.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
876
874
|
}
|
|
877
875
|
disconnectedCallback() {
|
|
878
|
-
|
|
876
|
+
U.log("NineTable disconnected.");
|
|
879
877
|
}
|
|
880
878
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
881
879
|
get data() {
|