@ninebone/table 0.0.365 β 0.0.367
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 +244 -234
- 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
|
@@ -22,29 +22,29 @@ const ne = class ne extends xe.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(ne, "Trace");
|
|
24
24
|
let Ut = ne;
|
|
25
|
-
const
|
|
26
|
-
var _,
|
|
25
|
+
const W = new Ut();
|
|
26
|
+
var _, O, p, N, P, Y, vt, V, wt;
|
|
27
27
|
const oe = class oe extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
c(this, _);
|
|
31
|
-
c(this,
|
|
32
|
-
c(this,
|
|
33
|
-
c(this, D);
|
|
31
|
+
c(this, O, !1);
|
|
32
|
+
c(this, p);
|
|
34
33
|
c(this, N);
|
|
35
34
|
c(this, P);
|
|
35
|
+
c(this, Y);
|
|
36
36
|
c(this, vt, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!t(this, _)) return;
|
|
38
38
|
const e = t(this, _).querySelector(".ng-container-body");
|
|
39
|
-
e && (b(this,
|
|
39
|
+
e && (b(this, Y, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), t(this,
|
|
41
|
+
})), t(this, Y).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
x(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!t(this, _) || !t(this,
|
|
45
|
-
const e = t(this,
|
|
44
|
+
if (!t(this, _) || !t(this, p) || t(this, O)) return;
|
|
45
|
+
const e = t(this, p).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const o = t(this,
|
|
47
|
+
const o = t(this, p).track, r = t(this, p).thumb, n = t(this, _).querySelector(".ng-container-bottom"), l = e.clientWidth, h = s.scrollWidth;
|
|
48
48
|
if (l !== 0 && h > l)
|
|
49
49
|
n && (n.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -56,56 +56,56 @@ const oe = class oe extends HTMLElement {
|
|
|
56
56
|
const f = Math.max(Math.min(d * (l / h), d), 20);
|
|
57
57
|
r.style.width = `${f}px`;
|
|
58
58
|
const u = e.scrollLeft, g = h - l;
|
|
59
|
-
let
|
|
60
|
-
g > 0 && (
|
|
61
|
-
const
|
|
62
|
-
|
|
59
|
+
let y = 0;
|
|
60
|
+
g > 0 && (y = parseInt(u / g * (d - f), 10)), y < 0 && (y = 0);
|
|
61
|
+
const w = d - f;
|
|
62
|
+
y > w && (y = w), r.style.left = `${y}px`, W.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= w - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
c(this,
|
|
65
|
-
if (!t(this,
|
|
66
|
-
const s = t(this,
|
|
64
|
+
c(this, V, /* @__PURE__ */ a((e) => {
|
|
65
|
+
if (!t(this, p)) return !1;
|
|
66
|
+
const s = t(this, p).container, o = s.querySelector("table");
|
|
67
67
|
if (!o) return !1;
|
|
68
|
-
const r = t(this,
|
|
68
|
+
const r = t(this, p).track.getBoundingClientRect(), n = t(this, p).thumb.clientWidth;
|
|
69
69
|
let l = e;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
71
|
const h = r.width - n;
|
|
72
|
-
l > h && (l = h), l = parseInt(l, 10), t(this,
|
|
72
|
+
l > h && (l = h), l = parseInt(l, 10), t(this, p).thumb.style.left = `${l}px`, t(this, p).left.disabled = l === 0, t(this, p).right.disabled = l >= h - 1;
|
|
73
73
|
const d = s.clientWidth, u = o.scrollWidth - d;
|
|
74
74
|
return h > 0 && u > 0 && (s.scrollLeft = l / h * u), l > 0 && l < h - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
c(this, wt, /* @__PURE__ */ a(() => {
|
|
77
77
|
const e = /* @__PURE__ */ a((o) => {
|
|
78
|
-
clearInterval(t(this,
|
|
79
|
-
const r = parseInt(t(this,
|
|
80
|
-
t(this,
|
|
81
|
-
clearInterval(t(this,
|
|
82
|
-
const n = parseInt(t(this,
|
|
83
|
-
t(this,
|
|
78
|
+
clearInterval(t(this, N)), clearInterval(t(this, P));
|
|
79
|
+
const r = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
80
|
+
t(this, V).call(this, r + o), b(this, N, setInterval(() => {
|
|
81
|
+
clearInterval(t(this, N)), b(this, P, setInterval(() => {
|
|
82
|
+
const n = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
83
|
+
t(this, V).call(this, n + o) || clearInterval(t(this, P));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
87
|
-
clearInterval(t(this,
|
|
87
|
+
clearInterval(t(this, N)), clearInterval(t(this, P));
|
|
88
88
|
}, "clearTimer");
|
|
89
89
|
["mouseup", "mouseleave", "touchend"].forEach((o) => {
|
|
90
|
-
t(this,
|
|
91
|
-
}), t(this,
|
|
90
|
+
t(this, p).left.addEventListener(o, s), t(this, p).right.addEventListener(o, s), t(this, p).track.addEventListener(o, s);
|
|
91
|
+
}), t(this, p).left.addEventListener("mousedown", (o) => {
|
|
92
92
|
o.button === 0 && e(-20);
|
|
93
|
-
}), t(this,
|
|
93
|
+
}), t(this, p).right.addEventListener("mousedown", (o) => {
|
|
94
94
|
o.button === 0 && e(20);
|
|
95
|
-
}), t(this,
|
|
95
|
+
}), t(this, p).left.addEventListener("touchstart", () => e(-20)), t(this, p).right.addEventListener("touchstart", () => e(20)), t(this, p).track.addEventListener("mousedown", (o) => {
|
|
96
96
|
if (o.button !== 0) return;
|
|
97
97
|
o.preventDefault();
|
|
98
|
-
const r = t(this,
|
|
99
|
-
t(this,
|
|
100
|
-
}), t(this,
|
|
98
|
+
const r = t(this, p).track.getBoundingClientRect(), n = t(this, p).thumb.clientWidth;
|
|
99
|
+
t(this, V).call(this, o.clientX - r.left - n / 2);
|
|
100
|
+
}), t(this, p).thumb.addEventListener("mousedown", (o) => {
|
|
101
101
|
if (o.button !== 0) return;
|
|
102
|
-
o.stopPropagation(), o.preventDefault(), b(this,
|
|
102
|
+
o.stopPropagation(), o.preventDefault(), b(this, O, !0), this.shiftX = o.clientX - t(this, p).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ a((l) => {
|
|
104
|
-
if (!t(this,
|
|
105
|
-
const h = t(this,
|
|
106
|
-
t(this,
|
|
104
|
+
if (!t(this, O)) return;
|
|
105
|
+
const h = t(this, p).track.getBoundingClientRect();
|
|
106
|
+
t(this, V).call(this, l.clientX - h.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), n = /* @__PURE__ */ a(() => {
|
|
108
|
-
b(this,
|
|
108
|
+
b(this, O, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", n), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
110
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", n);
|
|
111
111
|
});
|
|
@@ -182,44 +182,44 @@ const oe = class oe extends HTMLElement {
|
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
b(this,
|
|
185
|
+
b(this, p, {
|
|
186
186
|
container: s,
|
|
187
187
|
track: this.querySelector(".ng-scroll-track"),
|
|
188
188
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
189
189
|
left: this.querySelector(".ng-scroll-left"),
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), s.addEventListener("scroll", () => {
|
|
192
|
-
t(this,
|
|
192
|
+
t(this, O) || this.refresh();
|
|
193
193
|
}), t(this, wt).call(this), t(this, vt).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
196
196
|
}
|
|
197
197
|
disconnectedCallback() {
|
|
198
|
-
t(this,
|
|
198
|
+
t(this, Y) && t(this, Y).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
_ = new WeakMap(),
|
|
201
|
+
_ = new WeakMap(), O = new WeakMap(), p = new WeakMap(), N = new WeakMap(), P = new WeakMap(), Y = new WeakMap(), vt = new WeakMap(), V = new WeakMap(), wt = new WeakMap(), a(oe, "NineTableHScrollBar");
|
|
202
202
|
let Ft = oe;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Ft);
|
|
204
|
-
var
|
|
204
|
+
var X, z, S, lt, at, St;
|
|
205
205
|
const re = class re extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
|
-
c(this,
|
|
209
|
-
c(this,
|
|
210
|
-
c(this,
|
|
211
|
-
c(this, rt, 0);
|
|
208
|
+
c(this, X);
|
|
209
|
+
c(this, z, !1);
|
|
210
|
+
c(this, S);
|
|
212
211
|
c(this, lt, 0);
|
|
212
|
+
c(this, at, 0);
|
|
213
213
|
/**
|
|
214
214
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
215
215
|
*/
|
|
216
216
|
x(this, "refresh", /* @__PURE__ */ a(() => {
|
|
217
|
-
if (!t(this,
|
|
218
|
-
const e = t(this,
|
|
217
|
+
if (!t(this, X) || !t(this, S) || t(this, z)) return;
|
|
218
|
+
const e = t(this, S).container, s = e.querySelector("table");
|
|
219
219
|
if (!s) return;
|
|
220
|
-
const o = t(this,
|
|
220
|
+
const o = t(this, S).track, r = t(this, S).thumb, n = e.clientHeight, l = s.scrollHeight;
|
|
221
221
|
if (l <= n) {
|
|
222
|
-
r.style.display = "none", t(this,
|
|
222
|
+
r.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
223
223
|
return;
|
|
224
224
|
} else
|
|
225
225
|
r.style.display = "block";
|
|
@@ -230,47 +230,47 @@ const re = class re extends HTMLElement {
|
|
|
230
230
|
const f = e.scrollTop, u = l - n;
|
|
231
231
|
let g = 0;
|
|
232
232
|
u > 0 && (g = f / u * (h - d));
|
|
233
|
-
const
|
|
234
|
-
g < 0 && (g = 0), g >
|
|
233
|
+
const y = h - d;
|
|
234
|
+
g < 0 && (g = 0), g > y && (g = y), r.style.top = `${g}px`, t(this, S).top.disabled = f <= 0, t(this, S).bottom.disabled = f >= u - 1;
|
|
235
235
|
}, "refresh"));
|
|
236
236
|
c(this, St, /* @__PURE__ */ a(() => {
|
|
237
|
-
const e = t(this,
|
|
237
|
+
const e = t(this, S).container;
|
|
238
238
|
e.addEventListener("scroll", () => {
|
|
239
|
-
t(this,
|
|
240
|
-
}), t(this,
|
|
239
|
+
t(this, z) || this.refresh();
|
|
240
|
+
}), t(this, S).thumb.addEventListener("mousedown", (s) => {
|
|
241
241
|
if (s.button !== 0) return;
|
|
242
|
-
s.stopPropagation(), s.preventDefault(), b(this,
|
|
242
|
+
s.stopPropagation(), s.preventDefault(), b(this, z, !0), b(this, lt, s.clientY), b(this, at, e.scrollTop);
|
|
243
243
|
const o = /* @__PURE__ */ a((n) => {
|
|
244
|
-
if (!t(this,
|
|
245
|
-
const l = t(this,
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
if (f > 0 &&
|
|
249
|
-
const
|
|
250
|
-
e.scrollTop = t(this,
|
|
244
|
+
if (!t(this, z)) return;
|
|
245
|
+
const l = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, f = l.height - h, u = n.clientY - t(this, lt), g = e.clientHeight, y = e.querySelector("table");
|
|
246
|
+
W.log(y), W.log(y.scrollHeight);
|
|
247
|
+
const A = y.scrollHeight - g;
|
|
248
|
+
if (f > 0 && A > 0) {
|
|
249
|
+
const G = u / f * A;
|
|
250
|
+
e.scrollTop = t(this, at) + G;
|
|
251
251
|
}
|
|
252
252
|
this.refresh();
|
|
253
253
|
}, "onMouseMove"), r = /* @__PURE__ */ a(() => {
|
|
254
|
-
b(this,
|
|
254
|
+
b(this, z, !1), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
255
255
|
}, "onMouseUp");
|
|
256
256
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", r);
|
|
257
|
-
}), t(this,
|
|
258
|
-
if (s.button !== 0 || s.target === t(this,
|
|
259
|
-
const o = t(this,
|
|
257
|
+
}), t(this, S).track.addEventListener("mousedown", (s) => {
|
|
258
|
+
if (s.button !== 0 || s.target === t(this, S).thumb) return;
|
|
259
|
+
const o = t(this, S).track.getBoundingClientRect(), r = t(this, S).thumb.clientHeight, n = s.clientY - o.top - r / 2, h = o.height - r, d = e.clientHeight, u = e.querySelector("table").scrollHeight - d;
|
|
260
260
|
if (h > 0 && u > 0) {
|
|
261
261
|
const g = Math.max(0, Math.min(1, n / h));
|
|
262
262
|
e.scrollTop = g * u;
|
|
263
263
|
}
|
|
264
264
|
this.refresh();
|
|
265
|
-
}), t(this,
|
|
265
|
+
}), t(this, S).top.addEventListener("click", () => {
|
|
266
266
|
e.scrollTop -= 40;
|
|
267
|
-
}), t(this,
|
|
267
|
+
}), t(this, S).bottom.addEventListener("click", () => {
|
|
268
268
|
e.scrollTop += 40;
|
|
269
269
|
});
|
|
270
270
|
}, "#init"));
|
|
271
271
|
}
|
|
272
272
|
connectedCallback() {
|
|
273
|
-
if (b(this,
|
|
273
|
+
if (b(this, X, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, X)) return;
|
|
274
274
|
this.innerHTML = `
|
|
275
275
|
<style>
|
|
276
276
|
nine-table-vscrollbar {
|
|
@@ -335,12 +335,12 @@ const re = class re extends HTMLElement {
|
|
|
335
335
|
<button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
|
|
336
336
|
`;
|
|
337
337
|
const e = /* @__PURE__ */ a(() => {
|
|
338
|
-
const s = t(this,
|
|
338
|
+
const s = t(this, X).querySelector(".ng-container-body");
|
|
339
339
|
if (!s) {
|
|
340
340
|
setTimeout(e, 10);
|
|
341
341
|
return;
|
|
342
342
|
}
|
|
343
|
-
b(this,
|
|
343
|
+
b(this, S, {
|
|
344
344
|
container: s,
|
|
345
345
|
track: this.querySelector(".ng-scroll-track"),
|
|
346
346
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
@@ -351,10 +351,10 @@ const re = class re extends HTMLElement {
|
|
|
351
351
|
e();
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
|
-
|
|
354
|
+
X = new WeakMap(), z = new WeakMap(), S = new WeakMap(), lt = new WeakMap(), at = new WeakMap(), St = new WeakMap(), a(re, "NineTableVScrollBar");
|
|
355
355
|
let jt = re;
|
|
356
356
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", jt);
|
|
357
|
-
var Et,
|
|
357
|
+
var Et, J;
|
|
358
358
|
const C = class C {
|
|
359
359
|
/**
|
|
360
360
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
@@ -369,7 +369,7 @@ const C = class C {
|
|
|
369
369
|
var o, r, n, l;
|
|
370
370
|
if (!i) return null;
|
|
371
371
|
const e = i.cloneNode(!0);
|
|
372
|
-
return t(o = C, Et).call(o, e), t(r = C,
|
|
372
|
+
return t(o = C, Et).call(o, e), t(r = C, J).call(r, e, "thead"), t(n = C, J).call(n, e, "tbody"), t(l = C, J).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((h, d) => {
|
|
373
373
|
const f = h.getAttribute("fixed");
|
|
374
374
|
f && e.querySelectorAll(`thead [data-col="${d}"], tbody [data-col="${d}"], tfoot [data-col="${d}"]`).forEach((u) => {
|
|
375
375
|
u.setAttribute("fixed", f);
|
|
@@ -377,7 +377,7 @@ const C = class C {
|
|
|
377
377
|
}), e;
|
|
378
378
|
}
|
|
379
379
|
};
|
|
380
|
-
Et = new WeakMap(),
|
|
380
|
+
Et = new WeakMap(), J = new WeakMap(), a(C, "TableCompiler"), c(C, Et, /* @__PURE__ */ a((i) => {
|
|
381
381
|
if (!i.querySelector("colgroup")) {
|
|
382
382
|
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, o = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
383
383
|
for (let n = 0; n < s; n++) {
|
|
@@ -391,7 +391,7 @@ Et = new WeakMap(), G = new WeakMap(), a(C, "TableCompiler"), c(C, Et, /* @__PUR
|
|
|
391
391
|
s ? s.after(e) : i.prepend(e);
|
|
392
392
|
}
|
|
393
393
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
394
|
-
}, "#ensureTableStructure")), c(C,
|
|
394
|
+
}, "#ensureTableStructure")), c(C, J, /* @__PURE__ */ a((i, e) => {
|
|
395
395
|
const s = Array.from(i.querySelectorAll(e + " tr")), o = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
396
396
|
if (r === 0 || o.length === 0) return;
|
|
397
397
|
let n = 0;
|
|
@@ -403,15 +403,15 @@ Et = new WeakMap(), G = new WeakMap(), a(C, "TableCompiler"), c(C, Et, /* @__PUR
|
|
|
403
403
|
const d = h.sectionRowIndex;
|
|
404
404
|
let f = 0;
|
|
405
405
|
Array.from(h.querySelectorAll("th,td")).forEach((u) => {
|
|
406
|
-
for (let
|
|
407
|
-
if (l[d][
|
|
408
|
-
f =
|
|
406
|
+
for (let w = 0; w < l[d].length; w++)
|
|
407
|
+
if (l[d][w] === null) {
|
|
408
|
+
f = w;
|
|
409
409
|
break;
|
|
410
410
|
}
|
|
411
|
-
const g = u.rowSpan || 1,
|
|
412
|
-
for (let
|
|
413
|
-
for (let
|
|
414
|
-
d +
|
|
411
|
+
const g = u.rowSpan || 1, y = u.colSpan || 1;
|
|
412
|
+
for (let w = 0; w < g; w++)
|
|
413
|
+
for (let A = 0; A < y; A++)
|
|
414
|
+
d + w < r && f + A < n && (l[d + w][f + A] = w === 0 && A === 0 ? "1" : "0");
|
|
415
415
|
});
|
|
416
416
|
}), s.forEach((h) => {
|
|
417
417
|
const d = h.sectionRowIndex;
|
|
@@ -425,25 +425,25 @@ Et = new WeakMap(), G = new WeakMap(), a(C, "TableCompiler"), c(C, Et, /* @__PUR
|
|
|
425
425
|
});
|
|
426
426
|
}, "#resetColIndex"));
|
|
427
427
|
let Kt = C;
|
|
428
|
-
var
|
|
428
|
+
var I, v, M, q, B, U, ct, Q, Rt, At, qt, ht, dt, Tt, kt, ft, Lt, tt, ut;
|
|
429
429
|
const le = class le {
|
|
430
430
|
constructor(i) {
|
|
431
|
-
c(this,
|
|
431
|
+
c(this, I);
|
|
432
432
|
c(this, v);
|
|
433
433
|
c(this, M, /* @__PURE__ */ new Map());
|
|
434
|
-
c(this,
|
|
435
|
-
c(this,
|
|
434
|
+
c(this, q, null);
|
|
435
|
+
c(this, B, null);
|
|
436
436
|
c(this, U, 0);
|
|
437
|
-
c(this,
|
|
438
|
-
c(this,
|
|
437
|
+
c(this, ct, 40);
|
|
438
|
+
c(this, Q, !1);
|
|
439
439
|
c(this, Rt, 3);
|
|
440
440
|
x(this, "refresh", /* @__PURE__ */ a(() => {
|
|
441
441
|
var e;
|
|
442
442
|
const i = t(this, v).querySelector(".ng-container-body");
|
|
443
|
-
i && (t(this,
|
|
443
|
+
i && (t(this, ht).call(this), t(this, tt).call(this, i.scrollTop), (e = t(this, v).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
444
444
|
}, "refresh"));
|
|
445
445
|
x(this, "initialize", /* @__PURE__ */ a(() => {
|
|
446
|
-
b(this,
|
|
446
|
+
b(this, q, null), t(this, M).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
447
447
|
const r = t(this, v).querySelector(o);
|
|
448
448
|
if (!r) return;
|
|
449
449
|
const n = r.querySelector("table");
|
|
@@ -455,11 +455,11 @@ const le = class le {
|
|
|
455
455
|
});
|
|
456
456
|
const i = t(this, v).querySelector(".ng-container-body"), e = t(this, v).querySelector(".ng-container-left"), s = t(this, v).querySelector(".ng-container-right");
|
|
457
457
|
if (i) {
|
|
458
|
-
t(this, qt).call(this, i), t(this,
|
|
458
|
+
t(this, qt).call(this, i), t(this, ft).call(this), t(this, ht).call(this), t(this, tt).call(this, i.scrollTop);
|
|
459
459
|
let o = i.scrollTop;
|
|
460
460
|
const r = /* @__PURE__ */ a((n) => {
|
|
461
461
|
var l;
|
|
462
|
-
e && e.scrollTop !== n && (e.scrollTop = n), s && s.scrollTop !== n && (s.scrollTop = n), t(this,
|
|
462
|
+
e && e.scrollTop !== n && (e.scrollTop = n), s && s.scrollTop !== n && (s.scrollTop = n), t(this, tt).call(this, n), (l = t(this, v).querySelector("nine-table-vscrollbar")) == null || l.refresh();
|
|
463
463
|
}, "syncScroll");
|
|
464
464
|
i.addEventListener("scroll", () => {
|
|
465
465
|
const n = i.scrollTop;
|
|
@@ -474,15 +474,15 @@ const le = class le {
|
|
|
474
474
|
if (!o) return;
|
|
475
475
|
o.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
476
476
|
const r = o.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
477
|
-
for (let l = 0; l < t(this,
|
|
477
|
+
for (let l = 0; l < t(this, ct); l++)
|
|
478
478
|
s.forEach((h) => {
|
|
479
479
|
n.appendChild(h.cloneNode(!0));
|
|
480
480
|
});
|
|
481
481
|
r ? r.before(n) : o.appendChild(n);
|
|
482
482
|
}, "#renderRows"));
|
|
483
483
|
c(this, qt, /* @__PURE__ */ a((i) => {
|
|
484
|
-
if (t(this,
|
|
485
|
-
return t(this,
|
|
484
|
+
if (t(this, q) !== null && t(this, q) > 0)
|
|
485
|
+
return t(this, q);
|
|
486
486
|
const e = t(this, M).get(".ng-container-body");
|
|
487
487
|
if (!e || e.length === 0) return 24;
|
|
488
488
|
const s = i.querySelector("tbody.bindable-tbody") || i.querySelector("tbody.bindable-tbody:last-of-type");
|
|
@@ -498,20 +498,20 @@ const le = class le {
|
|
|
498
498
|
const u = s.querySelectorAll("tr:not(.nodata)");
|
|
499
499
|
return u.forEach((g) => {
|
|
500
500
|
f += g.offsetHeight || g.getBoundingClientRect().height;
|
|
501
|
-
}), u.forEach((g) => g.remove()), n.style.display = l, n.style.visibility = h, n.style.position = d, b(this,
|
|
501
|
+
}), u.forEach((g) => g.remove()), n.style.display = l, n.style.visibility = h, n.style.position = d, b(this, q, f > 0 ? f : 24), t(this, dt).call(this), t(this, q);
|
|
502
502
|
}, "#measureAndCacheHeight"));
|
|
503
|
-
c(this,
|
|
503
|
+
c(this, ht, /* @__PURE__ */ a(() => {
|
|
504
504
|
if (!t(this, v).querySelector(".ng-container-body")) return;
|
|
505
|
-
const e = t(this,
|
|
506
|
-
|
|
505
|
+
const e = t(this, I).data.get() || [], s = e.length > 0 ? e.length : 100, o = t(this, q), r = s * o;
|
|
506
|
+
W.log(":", s, r), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
507
507
|
const l = t(this, v).querySelector(n), h = l == null ? void 0 : l.querySelector("table");
|
|
508
508
|
h && (h.style.height = `${r}px`);
|
|
509
509
|
});
|
|
510
510
|
}, "#updateVirtualScrollHeight"));
|
|
511
|
-
c(this,
|
|
512
|
-
if (t(this, U) > 0 && t(this,
|
|
513
|
-
const i = Math.ceil(t(this, U) / t(this,
|
|
514
|
-
b(this,
|
|
511
|
+
c(this, dt, /* @__PURE__ */ a(() => {
|
|
512
|
+
if (t(this, U) > 0 && t(this, q) > 0) {
|
|
513
|
+
const i = Math.ceil(t(this, U) / t(this, q));
|
|
514
|
+
b(this, ct, i + t(this, Rt));
|
|
515
515
|
}
|
|
516
516
|
}, "#updateRowCount"));
|
|
517
517
|
c(this, Tt, /* @__PURE__ */ a(() => {
|
|
@@ -524,12 +524,12 @@ const le = class le {
|
|
|
524
524
|
((h = o[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
525
525
|
((d = r[u]) == null ? void 0 : d.getBoundingClientRect().height) || 0,
|
|
526
526
|
((f = n[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
527
|
-
],
|
|
528
|
-
|
|
527
|
+
], y = Math.max(...g);
|
|
528
|
+
y > 0 && (o[u] && (o[u].style.height = `${y}px`), r[u] && (r[u].style.height = `${y}px`), n[u] && (n[u].style.height = `${y}px`));
|
|
529
529
|
}
|
|
530
530
|
}, "#syncRowHeights"));
|
|
531
531
|
c(this, kt, /* @__PURE__ */ a(() => {
|
|
532
|
-
!t(this, v) || !(t(this, v) instanceof HTMLElement) || (b(this,
|
|
532
|
+
!t(this, v) || !(t(this, v) instanceof HTMLElement) || (b(this, B, new ResizeObserver((i) => {
|
|
533
533
|
for (const e of i) {
|
|
534
534
|
const s = e.target;
|
|
535
535
|
if (!s.classList.contains("active")) continue;
|
|
@@ -539,12 +539,12 @@ const le = class le {
|
|
|
539
539
|
const n = s.querySelector("thead");
|
|
540
540
|
n && (r += n.offsetHeight || n.getBoundingClientRect().height);
|
|
541
541
|
const l = Math.max(o - r, 100);
|
|
542
|
-
t(this, U) !== l && (b(this, U, l), t(this,
|
|
542
|
+
t(this, U) !== l && (b(this, U, l), t(this, dt).call(this), t(this, q) !== null && t(this, ft).call(this));
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
|
-
})), t(this,
|
|
545
|
+
})), t(this, B).observe(t(this, v)));
|
|
546
546
|
}, "#initResizeObserver"));
|
|
547
|
-
c(this,
|
|
547
|
+
c(this, ft, /* @__PURE__ */ a(() => {
|
|
548
548
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
549
549
|
const e = t(this, v).querySelector(i);
|
|
550
550
|
e && e.querySelector("tbody.bindable-tbody") && t(this, At).call(this, e, i);
|
|
@@ -552,63 +552,73 @@ const le = class le {
|
|
|
552
552
|
}, "#renderAllContainers"));
|
|
553
553
|
c(this, Lt, /* @__PURE__ */ a((i) => {
|
|
554
554
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
555
|
-
var
|
|
555
|
+
var d;
|
|
556
556
|
const s = t(this, v).querySelector(e);
|
|
557
557
|
if (!s) return;
|
|
558
558
|
const o = s.querySelector("tbody.bindable-tbody");
|
|
559
559
|
if (!o) return;
|
|
560
|
-
const r = Array.from(o.querySelectorAll("tr:not(.nodata)")), n = ((
|
|
561
|
-
r.forEach((
|
|
562
|
-
const
|
|
563
|
-
|
|
560
|
+
const r = Array.from(o.querySelectorAll("tr:not(.nodata)")), n = ((d = t(this, M).get(e)) == null ? void 0 : d.length) || 1, h = (t(this, I).data.get() || []).length;
|
|
561
|
+
r.forEach((f, u) => {
|
|
562
|
+
const g = i + Math.floor(u / n), y = h - 1 - g;
|
|
563
|
+
if (y < 0 || y >= h) {
|
|
564
|
+
f.style.display = "none";
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
const w = t(this, I).data.get(y);
|
|
568
|
+
f.style.display = "", t(this, ut).call(this, f, w, y);
|
|
564
569
|
});
|
|
565
570
|
});
|
|
566
571
|
}, "#adjustBufferRows"));
|
|
567
|
-
c(this,
|
|
568
|
-
var
|
|
569
|
-
const e = t(this,
|
|
572
|
+
c(this, tt, /* @__PURE__ */ a((i) => {
|
|
573
|
+
var l;
|
|
574
|
+
const e = t(this, q);
|
|
570
575
|
if (!e || e <= 0) return;
|
|
571
|
-
const s = Math.max(0, Math.floor(i / e)), o = ((
|
|
572
|
-
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
573
|
-
const
|
|
574
|
-
if (!
|
|
575
|
-
const
|
|
576
|
-
if (!
|
|
577
|
-
Array.from(
|
|
578
|
-
const
|
|
579
|
-
|
|
576
|
+
const s = Math.max(0, Math.floor(i / e)), o = ((l = t(this, M).get(".ng-container-body")) == null ? void 0 : l.length) || 1, n = (t(this, I).data.get() || []).length;
|
|
577
|
+
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
578
|
+
const d = t(this, v).querySelector(h);
|
|
579
|
+
if (!d) return;
|
|
580
|
+
const f = d.querySelector("tbody.bindable-tbody");
|
|
581
|
+
if (!f) return;
|
|
582
|
+
Array.from(f.querySelectorAll("tr:not(.nodata)")).forEach((g, y) => {
|
|
583
|
+
const w = s + Math.floor(y / o), A = n - 1 - w;
|
|
584
|
+
if (A < 0 || A >= n) {
|
|
585
|
+
g.style.display = "none";
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
const G = t(this, I).data.get(A);
|
|
589
|
+
g.style.display = "", t(this, ut).call(this, g, G, A);
|
|
580
590
|
});
|
|
581
|
-
}), t(this,
|
|
582
|
-
t(this, Lt).call(this, s), b(this,
|
|
591
|
+
}), t(this, Q) || (b(this, Q, !0), setTimeout(() => {
|
|
592
|
+
t(this, Lt).call(this, s), b(this, Q, !1);
|
|
583
593
|
}, 0));
|
|
584
594
|
}, "#handleScroll"));
|
|
585
|
-
c(this,
|
|
595
|
+
c(this, ut, /* @__PURE__ */ a((i, e, s) => {
|
|
586
596
|
i.dataset.row = s, Array.from(i.cells).forEach((o, r) => {
|
|
587
597
|
const n = o.dataset.bind;
|
|
588
598
|
n && e && e[n] !== void 0 ? o.textContent = e[n] : o.textContent = e ? e[Object.keys(e)[r]] ?? `R${s}C${r}` : `ν ${s + 1}`, o.dataset.row = s;
|
|
589
599
|
});
|
|
590
600
|
}, "#bindRowData"));
|
|
591
601
|
x(this, "destroy", /* @__PURE__ */ a(() => {
|
|
592
|
-
t(this,
|
|
602
|
+
t(this, B) && (t(this, B).disconnect(), b(this, B, null));
|
|
593
603
|
}, "destroy"));
|
|
594
|
-
b(this,
|
|
604
|
+
b(this, I, i.getRootNode().host), b(this, v, i), t(this, kt).call(this);
|
|
595
605
|
}
|
|
596
606
|
getRowHeight() {
|
|
597
|
-
return t(this,
|
|
607
|
+
return t(this, q);
|
|
598
608
|
}
|
|
599
609
|
templateLength(i = ".ng-container-body") {
|
|
600
610
|
var e;
|
|
601
611
|
return ((e = t(this, M).get(i)) == null ? void 0 : e.length) || 1;
|
|
602
612
|
}
|
|
603
613
|
};
|
|
604
|
-
|
|
614
|
+
I = new WeakMap(), v = new WeakMap(), M = new WeakMap(), q = new WeakMap(), B = new WeakMap(), U = new WeakMap(), ct = new WeakMap(), Q = new WeakMap(), Rt = new WeakMap(), At = new WeakMap(), qt = new WeakMap(), ht = new WeakMap(), dt = new WeakMap(), Tt = new WeakMap(), kt = new WeakMap(), ft = new WeakMap(), Lt = new WeakMap(), tt = new WeakMap(), ut = new WeakMap(), a(le, "RowManager");
|
|
605
615
|
let Zt = le;
|
|
606
|
-
var Ht,
|
|
607
|
-
const
|
|
616
|
+
var Ht, et, F, Ct, _t, Mt, It, $t;
|
|
617
|
+
const rt = class rt extends HTMLElement {
|
|
608
618
|
constructor() {
|
|
609
619
|
super();
|
|
610
620
|
c(this, Ht);
|
|
611
|
-
c(this,
|
|
621
|
+
c(this, et, null);
|
|
612
622
|
c(this, F);
|
|
613
623
|
/**
|
|
614
624
|
* data.set, add, delete
|
|
@@ -625,7 +635,7 @@ const ot = class ot extends HTMLElement {
|
|
|
625
635
|
].forEach(({ selector: s, type: o }) => {
|
|
626
636
|
const r = this.querySelector(s);
|
|
627
637
|
if (!r) return;
|
|
628
|
-
const n = t(this, Mt).call(this, t(this,
|
|
638
|
+
const n = t(this, Mt).call(this, t(this, et), o);
|
|
629
639
|
r.innerHTML = "", r.appendChild(n);
|
|
630
640
|
});
|
|
631
641
|
}, "#renderSplitContainers"));
|
|
@@ -641,7 +651,7 @@ const ot = class ot extends HTMLElement {
|
|
|
641
651
|
});
|
|
642
652
|
}, "#updateContainerWidths"));
|
|
643
653
|
x(this, "generate", /* @__PURE__ */ a((e) => {
|
|
644
|
-
e && (b(this,
|
|
654
|
+
e && (b(this, et, Kt.compile(e)), t(this, et).style.display = "table", t(this, Ct).call(this), t(this, _t).call(this), requestAnimationFrame(() => {
|
|
645
655
|
var o;
|
|
646
656
|
const s = (o = this.querySelector("thead")) == null ? void 0 : o.getBoundingClientRect().height;
|
|
647
657
|
this.querySelectorAll("tbody.fixed-tbody").forEach((r) => {
|
|
@@ -682,7 +692,7 @@ const ot = class ot extends HTMLElement {
|
|
|
682
692
|
t(this, $t).call(this);
|
|
683
693
|
}, "#init"));
|
|
684
694
|
c(this, $t, /* @__PURE__ */ a(() => {
|
|
685
|
-
const e =
|
|
695
|
+
const e = rt.SCROLLBAR_SIZE;
|
|
686
696
|
this.innerHTML = `
|
|
687
697
|
<style>
|
|
688
698
|
nine-table-sheet {
|
|
@@ -834,13 +844,13 @@ const ot = class ot extends HTMLElement {
|
|
|
834
844
|
t(this, It).call(this);
|
|
835
845
|
}
|
|
836
846
|
disconnectedCallback() {
|
|
837
|
-
this.innerHTML = "",
|
|
847
|
+
this.innerHTML = "", W.log("NineTableSheet destroyed.");
|
|
838
848
|
}
|
|
839
849
|
};
|
|
840
|
-
Ht = new WeakMap(),
|
|
841
|
-
let xt =
|
|
850
|
+
Ht = new WeakMap(), et = new WeakMap(), F = new WeakMap(), Ct = new WeakMap(), _t = new WeakMap(), Mt = new WeakMap(), It = new WeakMap(), $t = new WeakMap(), a(rt, "NineTableSheet"), x(rt, "SCROLLBAR_SIZE", 16);
|
|
851
|
+
let xt = rt;
|
|
842
852
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", xt);
|
|
843
|
-
var Wt,
|
|
853
|
+
var Wt, bt;
|
|
844
854
|
const ae = class ae extends HTMLElement {
|
|
845
855
|
constructor() {
|
|
846
856
|
super();
|
|
@@ -849,17 +859,17 @@ const ae = class ae extends HTMLElement {
|
|
|
849
859
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
850
860
|
var n;
|
|
851
861
|
const o = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((n = s.target.closest(".nine-tab-item")) == null ? void 0 : n.dataset.index, 10);
|
|
852
|
-
t(this,
|
|
853
|
-
}), t(this,
|
|
862
|
+
t(this, bt).call(this, r, o);
|
|
863
|
+
}), t(this, bt).call(this, 0, !1);
|
|
854
864
|
}, "#init"));
|
|
855
|
-
c(this,
|
|
865
|
+
c(this, bt, /* @__PURE__ */ a((e, s = !1) => {
|
|
856
866
|
const o = /* @__PURE__ */ a(() => {
|
|
857
867
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
858
|
-
Array.from(this.querySelectorAll("nine-splitter")).forEach((
|
|
859
|
-
const g = f.filter((
|
|
860
|
-
g.length < 2 || g.forEach((
|
|
861
|
-
const
|
|
862
|
-
|
|
868
|
+
Array.from(this.querySelectorAll("nine-splitter")).forEach((y) => y.style.setProperty("display", "none"));
|
|
869
|
+
const g = f.filter((y) => y.classList.contains("active"));
|
|
870
|
+
g.length < 2 || g.forEach((y) => {
|
|
871
|
+
const w = parseInt(y.getAttribute("data-index"), 10), A = this.querySelector(`nine-splitter[data-split-index="${w}"]`), G = f[w + 1];
|
|
872
|
+
A && G && G.classList.contains("active") && A.style.setProperty("display", "flex");
|
|
863
873
|
});
|
|
864
874
|
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), n = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), h = n.querySelectorAll("nine-table-sheet");
|
|
865
875
|
if (!l[e]) return;
|
|
@@ -888,32 +898,32 @@ const ae = class ae extends HTMLElement {
|
|
|
888
898
|
t(this, Wt).call(this);
|
|
889
899
|
}
|
|
890
900
|
};
|
|
891
|
-
Wt = new WeakMap(),
|
|
901
|
+
Wt = new WeakMap(), bt = new WeakMap(), a(ae, "NineTableSheets");
|
|
892
902
|
let Gt = ae;
|
|
893
903
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Gt);
|
|
894
|
-
var
|
|
904
|
+
var T, Ot, gt, zt;
|
|
895
905
|
const ce = class ce {
|
|
896
906
|
constructor(i) {
|
|
897
|
-
c(this,
|
|
907
|
+
c(this, T);
|
|
898
908
|
c(this, Ot, /* @__PURE__ */ a(() => {
|
|
899
909
|
t(this, zt).call(this), new ResizeObserver((i) => {
|
|
900
910
|
for (let e of i)
|
|
901
|
-
t(this,
|
|
902
|
-
}).observe(t(this,
|
|
911
|
+
t(this, T).getAttribute("auto-height") === "true" && t(this, gt).call(this);
|
|
912
|
+
}).observe(t(this, T));
|
|
903
913
|
}, "#init"));
|
|
904
|
-
c(this,
|
|
914
|
+
c(this, gt, /* @__PURE__ */ a(() => {
|
|
905
915
|
var h, d;
|
|
906
|
-
const i = Array.from(t(this,
|
|
916
|
+
const i = Array.from(t(this, T).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
907
917
|
if (i.length === 0) return;
|
|
908
|
-
const e = parseInt(t(this,
|
|
909
|
-
t(this,
|
|
918
|
+
const e = parseInt(t(this, T).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), o = (h = t(this, T).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : h.getBoundingClientRect().height, r = (d = t(this, T).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : d.getBoundingClientRect().height, n = xt.SCROLLBAR_SIZE, l = e * s + o + r + n;
|
|
919
|
+
t(this, T).style.height = `${l}px`;
|
|
910
920
|
}, "#applyAutoHeight"));
|
|
911
921
|
c(this, zt, /* @__PURE__ */ a(() => {
|
|
912
|
-
const e = Array.from(t(this,
|
|
922
|
+
const e = Array.from(t(this, T).children).filter((h) => h.tagName === "TABLE"), s = t(this, T).getAttribute("auto-height") === "true", o = e.length, r = e.map((h, d) => {
|
|
913
923
|
const u = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`, g = d < o - 1 ? `<nine-splitter class="h" data-split-index="${d}"></nine-splitter>` : "";
|
|
914
924
|
return u + g;
|
|
915
925
|
}).join(""), n = e.map((h, d) => `<div class="nine-tab-item ${d === 0 ? "active" : ""}" data-index="${d}">Sheet ${d + 1}</div>`).join("");
|
|
916
|
-
t(this,
|
|
926
|
+
t(this, T).shadowRoot.innerHTML = `
|
|
917
927
|
<style>
|
|
918
928
|
:host {
|
|
919
929
|
display: flex;
|
|
@@ -1012,57 +1022,57 @@ const ce = class ce {
|
|
|
1012
1022
|
</nine-table-body>
|
|
1013
1023
|
<nine-table-footer></nine-table-footer>
|
|
1014
1024
|
`;
|
|
1015
|
-
const l = t(this,
|
|
1025
|
+
const l = t(this, T).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1016
1026
|
l == null || l.forEach((h, d) => {
|
|
1017
1027
|
e[d] && setTimeout(() => {
|
|
1018
|
-
h.generate(e[d]), s && t(this,
|
|
1028
|
+
h.generate(e[d]), s && t(this, gt).call(this);
|
|
1019
1029
|
});
|
|
1020
1030
|
});
|
|
1021
1031
|
}, "#render"));
|
|
1022
|
-
b(this,
|
|
1032
|
+
b(this, T, i), t(this, Ot).call(this);
|
|
1023
1033
|
}
|
|
1024
1034
|
};
|
|
1025
|
-
|
|
1035
|
+
T = new WeakMap(), Ot = new WeakMap(), gt = new WeakMap(), zt = new WeakMap(), a(ce, "LayoutManager");
|
|
1026
1036
|
let Jt = ce;
|
|
1027
|
-
var
|
|
1037
|
+
var yt, it;
|
|
1028
1038
|
const he = class he {
|
|
1029
1039
|
constructor(i) {
|
|
1030
|
-
c(this,
|
|
1031
|
-
c(this,
|
|
1032
|
-
x(this, "count", /* @__PURE__ */ a(() => t(this,
|
|
1033
|
-
b(this,
|
|
1040
|
+
c(this, yt);
|
|
1041
|
+
c(this, it, -1);
|
|
1042
|
+
x(this, "count", /* @__PURE__ */ a(() => t(this, yt).rawRecords.length, "count"));
|
|
1043
|
+
b(this, yt, i);
|
|
1034
1044
|
}
|
|
1035
1045
|
get at() {
|
|
1036
|
-
return t(this,
|
|
1046
|
+
return t(this, it);
|
|
1037
1047
|
}
|
|
1038
1048
|
set at(i) {
|
|
1039
|
-
b(this,
|
|
1049
|
+
b(this, it, parseInt(i, 10)), body && !body.querySelector(`tbody.bindable tr[data-row="${t(this, it)}"]`) && setTimeout(() => {
|
|
1040
1050
|
});
|
|
1041
1051
|
}
|
|
1042
1052
|
};
|
|
1043
|
-
|
|
1053
|
+
yt = new WeakMap(), it = new WeakMap(), a(he, "ngRow");
|
|
1044
1054
|
let Qt = he;
|
|
1045
|
-
var
|
|
1046
|
-
const
|
|
1055
|
+
var k, E, L, st, Bt, D, Dt, j, pt, Nt, Pt, nt;
|
|
1056
|
+
const H = class H {
|
|
1047
1057
|
constructor(i, e) {
|
|
1048
|
-
c(this,
|
|
1049
|
-
c(this,
|
|
1050
|
-
c(this,
|
|
1051
|
-
c(this,
|
|
1058
|
+
c(this, k);
|
|
1059
|
+
c(this, E);
|
|
1060
|
+
c(this, L, []);
|
|
1061
|
+
c(this, st, []);
|
|
1052
1062
|
c(this, Bt, 0);
|
|
1053
|
-
c(this,
|
|
1063
|
+
c(this, D, []);
|
|
1054
1064
|
c(this, Dt, /* @__PURE__ */ a(() => {
|
|
1055
|
-
b(this,
|
|
1056
|
-
const i = t(this,
|
|
1065
|
+
b(this, D, []);
|
|
1066
|
+
const i = t(this, k).template || [];
|
|
1057
1067
|
Array.from(i).forEach((e) => {
|
|
1058
1068
|
var s;
|
|
1059
|
-
t(this,
|
|
1060
|
-
}), (t(this,
|
|
1061
|
-
e.__ng || (e.__ng = t(this,
|
|
1069
|
+
t(this, D).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1070
|
+
}), (t(this, E).rawRecords || []).forEach((e) => {
|
|
1071
|
+
e.__ng || (e.__ng = t(this, pt).call(this)), e.__ng.height = t(this, D).slice();
|
|
1062
1072
|
});
|
|
1063
1073
|
}, "#initialize"));
|
|
1064
1074
|
c(this, j, /* @__PURE__ */ a(() => {
|
|
1065
|
-
t(this,
|
|
1075
|
+
t(this, k).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1066
1076
|
i.invalidate();
|
|
1067
1077
|
});
|
|
1068
1078
|
}, "#invalidate"));
|
|
@@ -1070,38 +1080,38 @@ const L = class L {
|
|
|
1070
1080
|
var r;
|
|
1071
1081
|
const s = this.getValidData();
|
|
1072
1082
|
if (!s || s.length <= 0) return;
|
|
1073
|
-
if (i == null) return t(this,
|
|
1083
|
+
if (i == null) return t(this, nt).call(this, s);
|
|
1074
1084
|
if (i < 0 || i >= s.length) return null;
|
|
1075
|
-
const o = typeof ((r = t(this,
|
|
1085
|
+
const o = typeof ((r = t(this, k).fields) == null ? void 0 : r.get) == "function" ? t(this, k).fields.get() : [];
|
|
1076
1086
|
if (e != null) {
|
|
1077
1087
|
const n = o.indexOf(e);
|
|
1078
1088
|
return n >= 0 ? s[i].v[n] : null;
|
|
1079
1089
|
}
|
|
1080
|
-
return t(this,
|
|
1090
|
+
return t(this, nt).call(this, s[i]);
|
|
1081
1091
|
}, "get"));
|
|
1082
1092
|
x(this, "set", /* @__PURE__ */ a((i) => {
|
|
1083
1093
|
this.clear(), this.add(i, !1), t(this, j).call(this);
|
|
1084
1094
|
}, "set"));
|
|
1085
|
-
c(this,
|
|
1086
|
-
rowState:
|
|
1095
|
+
c(this, pt, /* @__PURE__ */ a(() => ({
|
|
1096
|
+
rowState: H.ROW_STATE.EMPTY,
|
|
1087
1097
|
deleted: !1,
|
|
1088
1098
|
filtered: !1,
|
|
1089
|
-
height: t(this,
|
|
1099
|
+
height: t(this, D).slice(),
|
|
1090
1100
|
o: {},
|
|
1091
1101
|
c: {},
|
|
1092
|
-
_: [0, 0, 0, 0,
|
|
1102
|
+
_: [0, 0, 0, 0, H.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, D).slice(), -1, {}, {}]
|
|
1093
1103
|
}), "#getDefaultMeta"));
|
|
1094
1104
|
x(this, "reset", /* @__PURE__ */ a(() => {
|
|
1095
|
-
b(this,
|
|
1105
|
+
b(this, L, []), b(this, st, []), t(this, j).call(this);
|
|
1096
1106
|
}, "reset"));
|
|
1097
1107
|
x(this, "clear", /* @__PURE__ */ a(() => {
|
|
1098
1108
|
var i;
|
|
1099
|
-
t(this,
|
|
1109
|
+
t(this, E).rawRecords = [], b(this, L, []), b(this, st, []), (i = t(this, E).viewRecords) != null && i.reset && t(this, E).viewRecords.reset();
|
|
1100
1110
|
}, "clear"));
|
|
1101
1111
|
c(this, Nt, /* @__PURE__ */ a((i) => {
|
|
1102
1112
|
var o;
|
|
1103
1113
|
Array.isArray(i) || (i = [i]);
|
|
1104
|
-
const e = typeof ((o = t(this,
|
|
1114
|
+
const e = typeof ((o = t(this, k).fields) == null ? void 0 : o.get) == "function" ? t(this, k).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1105
1115
|
return i.forEach((r) => {
|
|
1106
1116
|
const n = { v: [] };
|
|
1107
1117
|
e.forEach((l) => {
|
|
@@ -1110,25 +1120,25 @@ const L = class L {
|
|
|
1110
1120
|
}), s;
|
|
1111
1121
|
}, "#json2Array"));
|
|
1112
1122
|
c(this, Pt, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1113
|
-
e.__ng = t(this,
|
|
1123
|
+
e.__ng = t(this, pt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = H.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1114
1124
|
}), i), "#defaultInsert"));
|
|
1115
1125
|
x(this, "add", /* @__PURE__ */ a((i, e = !0) => {
|
|
1116
1126
|
i === void 0 && (i = {});
|
|
1117
1127
|
const s = t(this, Nt).call(this, i);
|
|
1118
|
-
t(this,
|
|
1128
|
+
t(this, E).rawRecords = t(this, E).rawRecords.concat(t(this, Pt).call(this, s)), this.resetRecords();
|
|
1119
1129
|
const o = this.count() - 1;
|
|
1120
1130
|
return e || s.forEach((r, n) => {
|
|
1121
|
-
const l = t(this,
|
|
1122
|
-
l && (l.__ng.rowState =
|
|
1131
|
+
const l = t(this, E).rawRecords[o - n];
|
|
1132
|
+
l && (l.__ng.rowState = H.ROW_STATE.EMPTY);
|
|
1123
1133
|
}), t(this, j).call(this), o;
|
|
1124
1134
|
}, "add"));
|
|
1125
1135
|
x(this, "delete", /* @__PURE__ */ a((i) => {
|
|
1126
1136
|
let e = [];
|
|
1127
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this,
|
|
1128
|
-
if (t(this,
|
|
1129
|
-
const o = t(this,
|
|
1130
|
-
t(this,
|
|
1131
|
-
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState =
|
|
1137
|
+
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s, o) => o - s).forEach((s) => {
|
|
1138
|
+
if (t(this, L)[s]) {
|
|
1139
|
+
const o = t(this, L)[s].__ng.rowid;
|
|
1140
|
+
t(this, L)[s].__ng.rowState === H.ROW_STATE.INSERT ? t(this, E).rawRecords = t(this, E).rawRecords.filter((r) => r.__ng.rowid !== o) : t(this, E).rawRecords.forEach((r) => {
|
|
1141
|
+
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = H.ROW_STATE.DELETE);
|
|
1132
1142
|
});
|
|
1133
1143
|
}
|
|
1134
1144
|
}), this.resetRecords(), t(this, j).call(this);
|
|
@@ -1136,25 +1146,25 @@ const L = class L {
|
|
|
1136
1146
|
x(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
|
|
1137
1147
|
var h;
|
|
1138
1148
|
i = parseInt(i, 10);
|
|
1139
|
-
const r = (typeof ((h = t(this,
|
|
1149
|
+
const r = (typeof ((h = t(this, k).fields) == null ? void 0 : h.get) == "function" ? t(this, k).fields.get() : []).indexOf(e);
|
|
1140
1150
|
if (r < 0) return;
|
|
1141
1151
|
const n = this.getValidData()[i];
|
|
1142
1152
|
if (!n) return;
|
|
1143
1153
|
const l = n.v[r];
|
|
1144
|
-
l !== s && n.__ng.rowState !==
|
|
1154
|
+
l !== s && n.__ng.rowState !== H.ROW_STATE.INSERT && (n.__ng.o.hasOwnProperty(e) || (n.__ng.o[e] = l), n.__ng.rowState = H.ROW_STATE.UPDATE), n.v[r] = s;
|
|
1145
1155
|
}, "setValue"));
|
|
1146
1156
|
x(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1147
|
-
b(this,
|
|
1157
|
+
b(this, st, t(this, E).rawRecords.filter((i) => !i.__ng.deleted)), b(this, L, t(this, E).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, E).rawRecords.forEach((i, e) => {
|
|
1148
1158
|
i.__ng.rowidx = e;
|
|
1149
|
-
}), t(this,
|
|
1159
|
+
}), t(this, L).forEach((i, e) => {
|
|
1150
1160
|
i.__ng.i = e;
|
|
1151
1161
|
});
|
|
1152
1162
|
}, "resetRecords"));
|
|
1153
|
-
x(this, "getValidData", /* @__PURE__ */ a(() => (t(this,
|
|
1154
|
-
c(this,
|
|
1163
|
+
x(this, "getValidData", /* @__PURE__ */ a(() => (t(this, L).length === 0 && t(this, E).rawRecords.length > 0 && this.resetRecords(), t(this, L)), "getValidData"));
|
|
1164
|
+
c(this, nt, /* @__PURE__ */ a((i) => {
|
|
1155
1165
|
var n;
|
|
1156
1166
|
if (!i) return i;
|
|
1157
|
-
const e = !Array.isArray(i), s = e ? [i] : i, o = typeof ((n = t(this,
|
|
1167
|
+
const e = !Array.isArray(i), s = e ? [i] : i, o = typeof ((n = t(this, k).fields) == null ? void 0 : n.get) == "function" ? t(this, k).fields.get() : [], r = s.filter((l) => !l.__ng.deleted).map((l) => {
|
|
1158
1168
|
const h = {};
|
|
1159
1169
|
return o.forEach((d, f) => {
|
|
1160
1170
|
h[d] = l.v ? l.v[f] : l[d];
|
|
@@ -1163,10 +1173,10 @@ const L = class L {
|
|
|
1163
1173
|
return e ? r[0] : r;
|
|
1164
1174
|
}, "#conv"));
|
|
1165
1175
|
x(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
1166
|
-
b(this,
|
|
1176
|
+
b(this, k, i), b(this, E, e), t(this, Dt).call(this);
|
|
1167
1177
|
}
|
|
1168
1178
|
get source() {
|
|
1169
|
-
return t(this,
|
|
1179
|
+
return t(this, nt).call(this, t(this, E).rawRecords);
|
|
1170
1180
|
}
|
|
1171
1181
|
set source(i) {
|
|
1172
1182
|
this.clear(), this.add(i, !1);
|
|
@@ -1175,21 +1185,21 @@ const L = class L {
|
|
|
1175
1185
|
return ++pe(this, Bt)._;
|
|
1176
1186
|
}
|
|
1177
1187
|
get length() {
|
|
1178
|
-
return t(this,
|
|
1188
|
+
return t(this, L).length;
|
|
1179
1189
|
}
|
|
1180
1190
|
getRowCount() {
|
|
1181
1191
|
return this.length;
|
|
1182
1192
|
}
|
|
1183
1193
|
};
|
|
1184
|
-
|
|
1185
|
-
x(
|
|
1194
|
+
k = new WeakMap(), E = new WeakMap(), L = new WeakMap(), st = new WeakMap(), Bt = new WeakMap(), D = new WeakMap(), Dt = new WeakMap(), j = new WeakMap(), pt = new WeakMap(), Nt = new WeakMap(), Pt = new WeakMap(), nt = new WeakMap(), a(H, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1195
|
+
x(H, "ROW_STATE", {
|
|
1186
1196
|
EMPTY: "EMPTY",
|
|
1187
1197
|
NORMAL: "NORMAL",
|
|
1188
1198
|
INSERT: "INSERT",
|
|
1189
1199
|
UPDATE: "UPDATE",
|
|
1190
1200
|
DELETE: "DELETE"
|
|
1191
1201
|
});
|
|
1192
|
-
let te =
|
|
1202
|
+
let te = H;
|
|
1193
1203
|
var K;
|
|
1194
1204
|
const de = class de {
|
|
1195
1205
|
constructor(i) {
|
|
@@ -1213,29 +1223,29 @@ const de = class de {
|
|
|
1213
1223
|
};
|
|
1214
1224
|
K = new WeakMap(), a(de, "ngDataManager");
|
|
1215
1225
|
let ee = de;
|
|
1216
|
-
var
|
|
1226
|
+
var ot, R, mt, Yt;
|
|
1217
1227
|
const fe = class fe {
|
|
1218
1228
|
// π― μ΄μ { name: string, type: string } κ°μ²΄λ€μ λ°°μ΄λ‘ κ΄λ¦¬ν©λλ€.
|
|
1219
1229
|
constructor(i) {
|
|
1220
|
-
c(this,
|
|
1230
|
+
c(this, ot);
|
|
1221
1231
|
c(this, R, []);
|
|
1222
1232
|
x(this, "add", /* @__PURE__ */ a((i, e = "string") => {
|
|
1223
1233
|
i.forEach((s) => {
|
|
1224
1234
|
t(this, R).some((o) => o.name === s) || t(this, R).push({ name: s, type: e });
|
|
1225
|
-
}), t(this,
|
|
1235
|
+
}), t(this, mt).call(this);
|
|
1226
1236
|
}, "add"));
|
|
1227
|
-
c(this,
|
|
1237
|
+
c(this, mt, /* @__PURE__ */ a(() => {
|
|
1228
1238
|
const i = /* @__PURE__ */ new Map();
|
|
1229
1239
|
t(this, R).forEach((e) => {
|
|
1230
1240
|
i.set(e.name, e.type);
|
|
1231
1241
|
}), b(this, R, Array.from(i, ([e, s]) => ({ name: e, type: s }))), b(this, R, t(this, R).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, R).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1232
1242
|
}, "#adjust"));
|
|
1233
1243
|
c(this, Yt, /* @__PURE__ */ a(() => {
|
|
1234
|
-
b(this, R, []),
|
|
1235
|
-
const i = Array.from(t(this,
|
|
1244
|
+
b(this, R, []), W.log(t(this, ot).querySelectorAll("table"));
|
|
1245
|
+
const i = Array.from(t(this, ot).querySelectorAll("table"));
|
|
1236
1246
|
if (!(!i || i.length === 0)) {
|
|
1237
1247
|
for (const e of i)
|
|
1238
|
-
|
|
1248
|
+
W.log(e), $("[data-bind]", e).each((s, o) => {
|
|
1239
1249
|
const r = o.dataset.bind, n = o.getAttribute("data-type") || "string";
|
|
1240
1250
|
r && t(this, R).push({ name: r, type: n });
|
|
1241
1251
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1259,10 +1269,10 @@ const fe = class fe {
|
|
|
1259
1269
|
});
|
|
1260
1270
|
});
|
|
1261
1271
|
});
|
|
1262
|
-
t(this,
|
|
1272
|
+
t(this, mt).call(this);
|
|
1263
1273
|
}
|
|
1264
1274
|
}, "#init"));
|
|
1265
|
-
b(this,
|
|
1275
|
+
b(this, ot, i), t(this, Yt).call(this);
|
|
1266
1276
|
}
|
|
1267
1277
|
// π― κΈ°μ‘΄μ νλ μ΄λ¦λ§ μ°λ κ³³λ€κ³Όμ νΈνμ μν΄ μ΄λ¦ λ°°μ΄λ§ 리ν΄νλ λ©μλ μ μ§
|
|
1268
1278
|
get() {
|
|
@@ -1284,7 +1294,7 @@ const fe = class fe {
|
|
|
1284
1294
|
return t(this, R).some((e) => e.name === i);
|
|
1285
1295
|
}
|
|
1286
1296
|
};
|
|
1287
|
-
|
|
1297
|
+
ot = new WeakMap(), R = new WeakMap(), mt = new WeakMap(), Yt = new WeakMap(), a(fe, "ngFields");
|
|
1288
1298
|
let ie = fe;
|
|
1289
1299
|
var Z, Vt, Xt;
|
|
1290
1300
|
const ue = class ue extends HTMLElement {
|
|
@@ -1294,7 +1304,7 @@ const ue = class ue extends HTMLElement {
|
|
|
1294
1304
|
c(this, Z);
|
|
1295
1305
|
c(this, Vt);
|
|
1296
1306
|
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1297
|
-
this.fields = new ie(this), b(this, Vt, new Jt(this)),
|
|
1307
|
+
this.fields = new ie(this), b(this, Vt, new Jt(this)), W.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1298
1308
|
}, "#init"));
|
|
1299
1309
|
this.attachShadow({ mode: "open" }), b(this, Z, new ee(this));
|
|
1300
1310
|
}
|
|
@@ -1302,7 +1312,7 @@ const ue = class ue extends HTMLElement {
|
|
|
1302
1312
|
t(this, Xt).call(this);
|
|
1303
1313
|
}
|
|
1304
1314
|
disconnectedCallback() {
|
|
1305
|
-
|
|
1315
|
+
W.log("NineTable disconnected.");
|
|
1306
1316
|
}
|
|
1307
1317
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1308
1318
|
get data() {
|