@ninebone/table 0.0.332 β 0.0.333
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 +277 -280
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +6 -6
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var se = Object.defineProperty;
|
|
2
|
+
var ne = (m) => {
|
|
3
|
+
throw TypeError(m);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var t = (
|
|
9
|
-
var
|
|
5
|
+
var le = (m, i, e) => i in m ? se(m, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : m[i] = e;
|
|
6
|
+
var c = (m, i) => se(m, "name", { value: i, configurable: !0 });
|
|
7
|
+
var x = (m, i, e) => le(m, typeof i != "symbol" ? i + "" : i, e), oe = (m, i, e) => i.has(m) || ne("Cannot " + e);
|
|
8
|
+
var t = (m, i, e) => (oe(m, i, "read from private field"), e ? e.call(m) : i.get(m)), a = (m, i, e) => i.has(m) ? ne("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(m) : i.set(m, e), b = (m, i, e, s) => (oe(m, i, "write to private field"), s ? s.call(m, e) : i.set(m, e), e);
|
|
9
|
+
var re = (m, i, e, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
|
-
|
|
11
|
+
b(m, i, n, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return t(
|
|
14
|
+
return t(m, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
import { trace as ce } from "@ninebone/util";
|
|
@@ -20,27 +20,27 @@ const Kt = class Kt extends ce.constructor {
|
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
c(Kt, "Trace");
|
|
24
24
|
let zt = Kt;
|
|
25
|
-
const
|
|
26
|
-
var C, M, y, O, D,
|
|
25
|
+
const F = new zt();
|
|
26
|
+
var C, M, y, z, O, D, bt, N, gt;
|
|
27
27
|
const jt = class jt extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
a(this, C);
|
|
31
|
+
a(this, M, !1);
|
|
32
|
+
a(this, y);
|
|
33
|
+
a(this, z);
|
|
34
|
+
a(this, O);
|
|
35
|
+
a(this, D);
|
|
36
|
+
a(this, bt, /* @__PURE__ */ c(() => {
|
|
37
37
|
if (!t(this, C)) return;
|
|
38
38
|
const e = t(this, C).querySelector(".ng-container-body");
|
|
39
|
-
e && (
|
|
39
|
+
e && (b(this, D, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), t(this,
|
|
41
|
+
})), t(this, D).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
|
-
|
|
43
|
+
x(this, "refresh", /* @__PURE__ */ c(() => {
|
|
44
44
|
if (!t(this, C) || !t(this, y) || t(this, M)) return;
|
|
45
45
|
const e = t(this, y).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
@@ -55,13 +55,13 @@ const jt = class jt extends HTMLElement {
|
|
|
55
55
|
if (d <= 0) return;
|
|
56
56
|
const f = Math.max(Math.min(d * (l / h), d), 20);
|
|
57
57
|
r.style.width = `${f}px`;
|
|
58
|
-
const u = e.scrollLeft,
|
|
58
|
+
const u = e.scrollLeft, g = h - l;
|
|
59
59
|
let p = 0;
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
p >
|
|
60
|
+
g > 0 && (p = parseInt(u / g * (d - f), 10)), p < 0 && (p = 0);
|
|
61
|
+
const E = d - f;
|
|
62
|
+
p > E && (p = E), r.style.left = `${p}px`, F.log(p), t(this, y).left.disabled = p === 0, t(this, y).right.disabled = p >= E - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
|
|
64
|
+
a(this, N, /* @__PURE__ */ c((e) => {
|
|
65
65
|
if (!t(this, y)) return !1;
|
|
66
66
|
const s = t(this, y).container, n = s.querySelector("table");
|
|
67
67
|
if (!n) return !1;
|
|
@@ -73,18 +73,18 @@ const jt = class jt extends HTMLElement {
|
|
|
73
73
|
const d = s.clientWidth, u = n.scrollWidth - d;
|
|
74
74
|
return h > 0 && u > 0 && (s.scrollLeft = l / h * u), l > 0 && l < h - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
|
-
|
|
77
|
-
const e = /* @__PURE__ */
|
|
78
|
-
clearInterval(t(this,
|
|
76
|
+
a(this, gt, /* @__PURE__ */ c(() => {
|
|
77
|
+
const e = /* @__PURE__ */ c((n) => {
|
|
78
|
+
clearInterval(t(this, z)), clearInterval(t(this, O));
|
|
79
79
|
const r = parseInt(t(this, y).thumb.style.left || 0, 10);
|
|
80
|
-
t(this,
|
|
81
|
-
clearInterval(t(this,
|
|
80
|
+
t(this, N).call(this, r + n), b(this, z, setInterval(() => {
|
|
81
|
+
clearInterval(t(this, z)), b(this, O, setInterval(() => {
|
|
82
82
|
const o = parseInt(t(this, y).thumb.style.left || 0, 10);
|
|
83
|
-
t(this,
|
|
83
|
+
t(this, N).call(this, o + n) || clearInterval(t(this, O));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
|
-
}, "delayScroll"), s = /* @__PURE__ */
|
|
87
|
-
clearInterval(t(this,
|
|
86
|
+
}, "delayScroll"), s = /* @__PURE__ */ c(() => {
|
|
87
|
+
clearInterval(t(this, z)), clearInterval(t(this, O));
|
|
88
88
|
}, "clearTimer");
|
|
89
89
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
90
90
|
t(this, y).left.addEventListener(n, s), t(this, y).right.addEventListener(n, s), t(this, y).track.addEventListener(n, s);
|
|
@@ -96,23 +96,23 @@ const jt = class jt extends HTMLElement {
|
|
|
96
96
|
if (n.button !== 0) return;
|
|
97
97
|
n.preventDefault();
|
|
98
98
|
const r = t(this, y).track.getBoundingClientRect(), o = t(this, y).thumb.clientWidth;
|
|
99
|
-
t(this,
|
|
99
|
+
t(this, N).call(this, n.clientX - r.left - o / 2);
|
|
100
100
|
}), t(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
101
101
|
if (n.button !== 0) return;
|
|
102
|
-
n.stopPropagation(), n.preventDefault(),
|
|
103
|
-
const r = /* @__PURE__ */
|
|
102
|
+
n.stopPropagation(), n.preventDefault(), b(this, M, !0), this.shiftX = n.clientX - t(this, y).thumb.getBoundingClientRect().left;
|
|
103
|
+
const r = /* @__PURE__ */ c((l) => {
|
|
104
104
|
if (!t(this, M)) return;
|
|
105
105
|
const h = t(this, y).track.getBoundingClientRect();
|
|
106
|
-
t(this,
|
|
107
|
-
}, "onMouseMove"), o = /* @__PURE__ */
|
|
108
|
-
|
|
106
|
+
t(this, N).call(this, l.clientX - h.left - this.shiftX);
|
|
107
|
+
}, "onMouseMove"), o = /* @__PURE__ */ c(() => {
|
|
108
|
+
b(this, M, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
110
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
111
111
|
});
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (
|
|
115
|
+
if (b(this, C, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, C)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -176,13 +176,13 @@ const jt = class jt extends HTMLElement {
|
|
|
176
176
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
177
177
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
178
178
|
`;
|
|
179
|
-
const e = /* @__PURE__ */
|
|
179
|
+
const e = /* @__PURE__ */ c(() => {
|
|
180
180
|
const s = t(this, C).querySelector(".ng-container-body");
|
|
181
181
|
if (!s) {
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
|
|
185
|
+
b(this, y, {
|
|
186
186
|
container: s,
|
|
187
187
|
track: this.querySelector(".ng-scroll-track"),
|
|
188
188
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
@@ -195,31 +195,31 @@ const jt = class jt extends HTMLElement {
|
|
|
195
195
|
e();
|
|
196
196
|
}
|
|
197
197
|
disconnectedCallback() {
|
|
198
|
-
t(this,
|
|
198
|
+
t(this, D) && t(this, D).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
C = new WeakMap(), M = new WeakMap(), y = new WeakMap(),
|
|
201
|
+
C = new WeakMap(), M = new WeakMap(), y = new WeakMap(), z = new WeakMap(), O = new WeakMap(), D = new WeakMap(), bt = new WeakMap(), N = new WeakMap(), gt = new WeakMap(), c(jt, "NineTableHScrollBar");
|
|
202
202
|
let Ot = jt;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Ot);
|
|
204
|
-
var
|
|
204
|
+
var B, I, v, st, nt, yt;
|
|
205
205
|
const Zt = class Zt extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
208
|
+
a(this, B);
|
|
209
|
+
a(this, I, !1);
|
|
210
|
+
a(this, v);
|
|
211
|
+
a(this, st, 0);
|
|
212
|
+
a(this, nt, 0);
|
|
213
213
|
/**
|
|
214
214
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
215
215
|
*/
|
|
216
|
-
|
|
217
|
-
if (!t(this,
|
|
218
|
-
const e = t(this,
|
|
216
|
+
x(this, "refresh", /* @__PURE__ */ c(() => {
|
|
217
|
+
if (!t(this, B) || !t(this, v) || t(this, I)) return;
|
|
218
|
+
const e = t(this, v).container, s = e.querySelector("table");
|
|
219
219
|
if (!s) return;
|
|
220
|
-
const n = t(this,
|
|
220
|
+
const n = t(this, v).track, r = t(this, v).thumb, o = e.clientHeight, l = s.scrollHeight;
|
|
221
221
|
if (l <= o) {
|
|
222
|
-
r.style.display = "none", t(this,
|
|
222
|
+
r.style.display = "none", t(this, v).top.disabled = !0, t(this, v).bottom.disabled = !0;
|
|
223
223
|
return;
|
|
224
224
|
} else
|
|
225
225
|
r.style.display = "block";
|
|
@@ -228,49 +228,49 @@ const Zt = class Zt extends HTMLElement {
|
|
|
228
228
|
const d = Math.max(Math.min(h * (o / l), h), 20);
|
|
229
229
|
r.style.height = `${d}px`;
|
|
230
230
|
const f = e.scrollTop, u = l - o;
|
|
231
|
-
let
|
|
232
|
-
u > 0 && (
|
|
231
|
+
let g = 0;
|
|
232
|
+
u > 0 && (g = f / u * (h - d));
|
|
233
233
|
const p = h - d;
|
|
234
|
-
|
|
234
|
+
g < 0 && (g = 0), g > p && (g = p), r.style.top = `${g}px`, t(this, v).top.disabled = f <= 0, t(this, v).bottom.disabled = f >= u - 1;
|
|
235
235
|
}, "refresh"));
|
|
236
|
-
|
|
237
|
-
const e = t(this,
|
|
236
|
+
a(this, yt, /* @__PURE__ */ c(() => {
|
|
237
|
+
const e = t(this, v).container;
|
|
238
238
|
e.addEventListener("scroll", () => {
|
|
239
239
|
t(this, I) || this.refresh();
|
|
240
|
-
}), t(this,
|
|
240
|
+
}), t(this, v).thumb.addEventListener("mousedown", (s) => {
|
|
241
241
|
if (s.button !== 0) return;
|
|
242
|
-
s.stopPropagation(), s.preventDefault(),
|
|
243
|
-
const n = /* @__PURE__ */
|
|
242
|
+
s.stopPropagation(), s.preventDefault(), b(this, I, !0), b(this, st, s.clientY), b(this, nt, e.scrollTop);
|
|
243
|
+
const n = /* @__PURE__ */ c((o) => {
|
|
244
244
|
if (!t(this, I)) return;
|
|
245
|
-
const l = t(this,
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
if (f > 0 &&
|
|
249
|
-
const
|
|
250
|
-
e.scrollTop = t(this, nt) +
|
|
245
|
+
const l = t(this, v).track.getBoundingClientRect(), h = t(this, v).thumb.clientHeight, f = l.height - h, u = o.clientY - t(this, st), g = e.clientHeight, p = e.querySelector("table");
|
|
246
|
+
F.log(p), F.log(p.scrollHeight);
|
|
247
|
+
const L = p.scrollHeight - g;
|
|
248
|
+
if (f > 0 && L > 0) {
|
|
249
|
+
const ft = u / f * L;
|
|
250
|
+
e.scrollTop = t(this, nt) + ft;
|
|
251
251
|
}
|
|
252
252
|
this.refresh();
|
|
253
|
-
}, "onMouseMove"), r = /* @__PURE__ */
|
|
254
|
-
|
|
253
|
+
}, "onMouseMove"), r = /* @__PURE__ */ c(() => {
|
|
254
|
+
b(this, I, !1), document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", r), this.refresh();
|
|
255
255
|
}, "onMouseUp");
|
|
256
256
|
document.addEventListener("mousemove", n), document.addEventListener("mouseup", r);
|
|
257
|
-
}), t(this,
|
|
258
|
-
if (s.button !== 0 || s.target === t(this,
|
|
259
|
-
const n = t(this,
|
|
257
|
+
}), t(this, v).track.addEventListener("mousedown", (s) => {
|
|
258
|
+
if (s.button !== 0 || s.target === t(this, v).thumb) return;
|
|
259
|
+
const n = t(this, v).track.getBoundingClientRect(), r = t(this, v).thumb.clientHeight, o = s.clientY - n.top - r / 2, h = n.height - r, d = e.clientHeight, u = e.querySelector("table").scrollHeight - d;
|
|
260
260
|
if (h > 0 && u > 0) {
|
|
261
|
-
const
|
|
262
|
-
e.scrollTop =
|
|
261
|
+
const g = Math.max(0, Math.min(1, o / h));
|
|
262
|
+
e.scrollTop = g * u;
|
|
263
263
|
}
|
|
264
264
|
this.refresh();
|
|
265
|
-
}), t(this,
|
|
265
|
+
}), t(this, v).top.addEventListener("click", () => {
|
|
266
266
|
e.scrollTop -= 40;
|
|
267
|
-
}), t(this,
|
|
267
|
+
}), t(this, v).bottom.addEventListener("click", () => {
|
|
268
268
|
e.scrollTop += 40;
|
|
269
269
|
});
|
|
270
270
|
}, "#init"));
|
|
271
271
|
}
|
|
272
272
|
connectedCallback() {
|
|
273
|
-
if (
|
|
273
|
+
if (b(this, B, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, B)) return;
|
|
274
274
|
this.innerHTML = `
|
|
275
275
|
<style>
|
|
276
276
|
nine-table-vscrollbar {
|
|
@@ -334,13 +334,13 @@ const Zt = class Zt extends HTMLElement {
|
|
|
334
334
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
335
335
|
<button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
|
|
336
336
|
`;
|
|
337
|
-
const e = /* @__PURE__ */
|
|
338
|
-
const s = t(this,
|
|
337
|
+
const e = /* @__PURE__ */ c(() => {
|
|
338
|
+
const s = t(this, B).querySelector(".ng-container-body");
|
|
339
339
|
if (!s) {
|
|
340
340
|
setTimeout(e, 10);
|
|
341
341
|
return;
|
|
342
342
|
}
|
|
343
|
-
|
|
343
|
+
b(this, v, {
|
|
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 Zt = class Zt extends HTMLElement {
|
|
|
351
351
|
e();
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
|
-
|
|
354
|
+
B = new WeakMap(), I = new WeakMap(), v = new WeakMap(), st = new WeakMap(), nt = new WeakMap(), yt = new WeakMap(), c(Zt, "NineTableVScrollBar");
|
|
355
355
|
let Dt = Zt;
|
|
356
356
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", Dt);
|
|
357
|
-
var pt,
|
|
357
|
+
var pt, K;
|
|
358
358
|
const H = class H {
|
|
359
359
|
/**
|
|
360
360
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
@@ -369,7 +369,7 @@ const H = class H {
|
|
|
369
369
|
var n, r, o, l;
|
|
370
370
|
if (!i) return null;
|
|
371
371
|
const e = i.cloneNode(!0);
|
|
372
|
-
return t(n = H, pt).call(n, e), t(r = H,
|
|
372
|
+
return t(n = H, pt).call(n, e), t(r = H, K).call(r, e, "thead"), t(o = H, K).call(o, e, "tbody"), t(l = H, K).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 H = class H {
|
|
|
377
377
|
}), e;
|
|
378
378
|
}
|
|
379
379
|
};
|
|
380
|
-
pt = new WeakMap(),
|
|
380
|
+
pt = new WeakMap(), K = new WeakMap(), c(H, "TableCompiler"), a(H, pt, /* @__PURE__ */ c((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, n = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
383
383
|
for (let o = 0; o < s; o++) {
|
|
@@ -391,7 +391,7 @@ pt = new WeakMap(), j = new WeakMap(), a(H, "TableCompiler"), c(H, pt, /* @__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")),
|
|
394
|
+
}, "#ensureTableStructure")), a(H, K, /* @__PURE__ */ c((i, e) => {
|
|
395
395
|
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
396
396
|
if (r === 0 || n.length === 0) return;
|
|
397
397
|
let o = 0;
|
|
@@ -403,15 +403,15 @@ pt = new WeakMap(), j = new WeakMap(), a(H, "TableCompiler"), c(H, pt, /* @__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 E = 0; E < l[d].length; E++)
|
|
407
|
+
if (l[d][E] === null) {
|
|
408
|
+
f = E;
|
|
409
409
|
break;
|
|
410
410
|
}
|
|
411
|
-
const
|
|
412
|
-
for (let
|
|
413
|
-
for (let
|
|
414
|
-
d +
|
|
411
|
+
const g = u.rowSpan || 1, p = u.colSpan || 1;
|
|
412
|
+
for (let E = 0; E < g; E++)
|
|
413
|
+
for (let L = 0; L < p; L++)
|
|
414
|
+
d + E < r && f + L < o && (l[d + E][f + L] = E === 0 && L === 0 ? "1" : "0");
|
|
415
415
|
});
|
|
416
416
|
}), s.forEach((h) => {
|
|
417
417
|
const d = h.sectionRowIndex;
|
|
@@ -425,24 +425,24 @@ pt = new WeakMap(), j = new WeakMap(), a(H, "TableCompiler"), c(H, pt, /* @__PUR
|
|
|
425
425
|
});
|
|
426
426
|
}, "#resetColIndex"));
|
|
427
427
|
let Nt = H;
|
|
428
|
-
var
|
|
428
|
+
var j, w, _, R, $, P, Z, mt, xt, ot, rt, vt, wt, lt, G, St;
|
|
429
429
|
const Gt = class Gt {
|
|
430
430
|
constructor(i) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
431
|
+
a(this, j);
|
|
432
|
+
a(this, w);
|
|
433
|
+
a(this, _, /* @__PURE__ */ new Map());
|
|
434
|
+
a(this, R, null);
|
|
435
|
+
a(this, $, null);
|
|
436
|
+
a(this, P, 0);
|
|
437
|
+
a(this, Z, 40);
|
|
438
|
+
x(this, "refresh", /* @__PURE__ */ c(() => {
|
|
439
439
|
var e;
|
|
440
|
-
const i = t(this,
|
|
441
|
-
i && (t(this,
|
|
440
|
+
const i = t(this, w).querySelector(".ng-container-body");
|
|
441
|
+
i && (t(this, ot).call(this), t(this, G).call(this, i.scrollTop), (e = t(this, w).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
442
442
|
}, "refresh"));
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
const r = t(this,
|
|
443
|
+
x(this, "initialize", /* @__PURE__ */ c(() => {
|
|
444
|
+
b(this, R, null), t(this, _).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
445
|
+
const r = t(this, w).querySelector(n);
|
|
446
446
|
if (!r) return;
|
|
447
447
|
const o = r.querySelector("table");
|
|
448
448
|
if (!o) return;
|
|
@@ -451,13 +451,13 @@ const Gt = class Gt {
|
|
|
451
451
|
const d = Array.from(l.querySelectorAll("tr")).map((f) => f.cloneNode(!0));
|
|
452
452
|
t(this, _).set(n, d);
|
|
453
453
|
});
|
|
454
|
-
const i = t(this,
|
|
454
|
+
const i = t(this, w).querySelector(".ng-container-body"), e = t(this, w).querySelector(".ng-container-left"), s = t(this, w).querySelector(".ng-container-right");
|
|
455
455
|
if (i) {
|
|
456
|
-
t(this, xt).call(this, i), t(this,
|
|
456
|
+
t(this, xt).call(this, i), t(this, lt).call(this), t(this, ot).call(this), t(this, G).call(this, i.scrollTop);
|
|
457
457
|
let n = i.scrollTop;
|
|
458
|
-
const r = /* @__PURE__ */
|
|
458
|
+
const r = /* @__PURE__ */ c((o) => {
|
|
459
459
|
var l;
|
|
460
|
-
e && e.scrollTop !== o && (e.scrollTop = o), s && s.scrollTop !== o && (s.scrollTop = o), t(this, G).call(this, o), (l = t(this,
|
|
460
|
+
e && e.scrollTop !== o && (e.scrollTop = o), s && s.scrollTop !== o && (s.scrollTop = o), t(this, G).call(this, o), (l = t(this, w).querySelector("nine-table-vscrollbar")) == null || l.refresh();
|
|
461
461
|
}, "syncScroll");
|
|
462
462
|
i.addEventListener("scroll", () => {
|
|
463
463
|
const o = i.scrollTop;
|
|
@@ -465,7 +465,7 @@ const Gt = class Gt {
|
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
}, "initialize"));
|
|
468
|
-
|
|
468
|
+
a(this, mt, /* @__PURE__ */ c((i, e) => {
|
|
469
469
|
const s = t(this, _).get(e);
|
|
470
470
|
if (!s || s.length === 0) return;
|
|
471
471
|
const n = i.querySelector("tbody.bindable-tbody");
|
|
@@ -478,59 +478,57 @@ const Gt = class Gt {
|
|
|
478
478
|
});
|
|
479
479
|
r ? r.before(o) : n.appendChild(o);
|
|
480
480
|
}, "#renderRows"));
|
|
481
|
-
|
|
481
|
+
a(this, xt, /* @__PURE__ */ c((i) => {
|
|
482
482
|
if (t(this, R) !== null && t(this, R) > 0)
|
|
483
483
|
return t(this, R);
|
|
484
484
|
const e = t(this, _).get(".ng-container-body");
|
|
485
485
|
if (!e || e.length === 0) return 24;
|
|
486
486
|
const s = i.querySelector("tbody.bindable-tbody") || i.querySelector("tbody.bindable-tbody:last-of-type");
|
|
487
487
|
if (!s) return 24;
|
|
488
|
-
s.querySelectorAll("tr:not(.nodata)").forEach((
|
|
488
|
+
s.querySelectorAll("tr:not(.nodata)").forEach((g) => g.remove());
|
|
489
489
|
const n = s.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
490
|
-
e.forEach((
|
|
491
|
-
r.appendChild(
|
|
490
|
+
e.forEach((g) => {
|
|
491
|
+
r.appendChild(g.cloneNode(!0));
|
|
492
492
|
}), n ? n.before(r) : s.appendChild(r);
|
|
493
|
-
const o = t(this,
|
|
493
|
+
const o = t(this, w), l = o.style.display, h = o.style.visibility, d = o.style.position;
|
|
494
494
|
(l === "none" || window.getComputedStyle(o).display === "none") && (o.style.display = "block", o.style.visibility = "hidden", o.style.position = "absolute");
|
|
495
495
|
let f = 0;
|
|
496
496
|
const u = s.querySelectorAll("tr:not(.nodata)");
|
|
497
|
-
return u.forEach((
|
|
498
|
-
f +=
|
|
499
|
-
}), u.forEach((
|
|
497
|
+
return u.forEach((g) => {
|
|
498
|
+
f += g.offsetHeight || g.getBoundingClientRect().height;
|
|
499
|
+
}), u.forEach((g) => g.remove()), o.style.display = l, o.style.visibility = h, o.style.position = d, b(this, R, f > 0 ? f : 24), t(this, rt).call(this), t(this, R);
|
|
500
500
|
}, "#measureAndCacheHeight"));
|
|
501
|
-
|
|
502
|
-
if (!t(this,
|
|
503
|
-
const e = t(this,
|
|
504
|
-
K.log(e);
|
|
505
|
-
const s = e.length > 0 ? e.length : 100, n = t(this, R), r = s * n;
|
|
501
|
+
a(this, ot, /* @__PURE__ */ c(() => {
|
|
502
|
+
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
503
|
+
const e = t(this, j).data.get() || [], s = e.length > 0 ? e.length : 100, n = t(this, R), r = s * n;
|
|
506
504
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
507
|
-
const l = t(this,
|
|
505
|
+
const l = t(this, w).querySelector(o), h = l == null ? void 0 : l.querySelector("table");
|
|
508
506
|
h && (h.style.height = `${r}px`);
|
|
509
507
|
});
|
|
510
508
|
}, "#updateVirtualScrollHeight"));
|
|
511
|
-
|
|
512
|
-
if (t(this,
|
|
513
|
-
const i = Math.ceil(t(this,
|
|
514
|
-
|
|
509
|
+
a(this, rt, /* @__PURE__ */ c(() => {
|
|
510
|
+
if (t(this, P) > 0 && t(this, R) > 0) {
|
|
511
|
+
const i = Math.ceil(t(this, P) / t(this, R));
|
|
512
|
+
b(this, Z, i + 20);
|
|
515
513
|
} else
|
|
516
|
-
|
|
514
|
+
b(this, Z, 40);
|
|
517
515
|
}, "#updateRowCount"));
|
|
518
|
-
|
|
516
|
+
a(this, vt, /* @__PURE__ */ c(() => {
|
|
519
517
|
var h, d, f;
|
|
520
|
-
const i = t(this,
|
|
518
|
+
const i = t(this, w).querySelector(".ng-container-left table"), e = t(this, w).querySelector(".ng-container-body table"), s = t(this, w).querySelector(".ng-container-right table");
|
|
521
519
|
if (!e) return;
|
|
522
520
|
const n = i ? Array.from(i.querySelectorAll("tr")) : [], r = Array.from(e.querySelectorAll("tr")), o = s ? Array.from(s.querySelectorAll("tr")) : [], l = Math.max(n.length, r.length, o.length);
|
|
523
521
|
for (let u = 0; u < l; u++) {
|
|
524
|
-
const
|
|
522
|
+
const g = [
|
|
525
523
|
((h = n[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
526
524
|
((d = r[u]) == null ? void 0 : d.getBoundingClientRect().height) || 0,
|
|
527
525
|
((f = o[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
528
|
-
], p = Math.max(...
|
|
526
|
+
], p = Math.max(...g);
|
|
529
527
|
p > 0 && (n[u] && (n[u].style.height = `${p}px`), r[u] && (r[u].style.height = `${p}px`), o[u] && (o[u].style.height = `${p}px`));
|
|
530
528
|
}
|
|
531
529
|
}, "#syncRowHeights"));
|
|
532
|
-
|
|
533
|
-
!t(this,
|
|
530
|
+
a(this, wt, /* @__PURE__ */ c(() => {
|
|
531
|
+
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (b(this, $, new ResizeObserver((i) => {
|
|
534
532
|
for (const e of i) {
|
|
535
533
|
const s = e.target;
|
|
536
534
|
if (!s.classList.contains("active")) continue;
|
|
@@ -540,44 +538,43 @@ const Gt = class Gt {
|
|
|
540
538
|
const o = s.querySelector("thead");
|
|
541
539
|
o && (r += o.offsetHeight || o.getBoundingClientRect().height);
|
|
542
540
|
const l = Math.max(n - r, 100);
|
|
543
|
-
t(this,
|
|
541
|
+
t(this, P) !== l && (b(this, P, l), t(this, rt).call(this), t(this, R) !== null && t(this, lt).call(this));
|
|
544
542
|
}
|
|
545
543
|
}
|
|
546
|
-
})), t(this, $).observe(t(this,
|
|
544
|
+
})), t(this, $).observe(t(this, w)));
|
|
547
545
|
}, "#initResizeObserver"));
|
|
548
|
-
|
|
546
|
+
a(this, lt, /* @__PURE__ */ c(() => {
|
|
549
547
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
550
|
-
const e = t(this,
|
|
548
|
+
const e = t(this, w).querySelector(i);
|
|
551
549
|
e && e.querySelector("tbody.bindable-tbody") && t(this, mt).call(this, e, i);
|
|
552
550
|
}), t(this, vt).call(this);
|
|
553
551
|
}, "#renderAllContainers"));
|
|
554
|
-
|
|
552
|
+
a(this, G, /* @__PURE__ */ c((i) => {
|
|
555
553
|
var r;
|
|
556
554
|
const e = t(this, R);
|
|
557
555
|
if (!e || e <= 0) return;
|
|
558
556
|
const s = Math.max(0, Math.floor(i / e)), n = ((r = t(this, _).get(".ng-container-body")) == null ? void 0 : r.length) || 1;
|
|
559
557
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
560
|
-
const l = t(this,
|
|
558
|
+
const l = t(this, w).querySelector(o);
|
|
561
559
|
if (!l) return;
|
|
562
560
|
const h = l.querySelector("tbody.bindable-tbody");
|
|
563
561
|
if (!h) return;
|
|
564
562
|
Array.from(h.querySelectorAll("tr:not(.nodata)")).forEach((f, u) => {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
f.style.display = "", t(this, St).call(this, f, p, b);
|
|
563
|
+
const g = s + Math.floor(u / n), p = t(this, j).data.get();
|
|
564
|
+
f.style.display = "", t(this, St).call(this, f, p, g);
|
|
568
565
|
});
|
|
569
566
|
});
|
|
570
567
|
}, "#handleScroll"));
|
|
571
|
-
|
|
572
|
-
i.dataset.row = s, Array.from(i.cells).forEach((n, r) => {
|
|
568
|
+
a(this, St, /* @__PURE__ */ c((i, e, s) => {
|
|
569
|
+
i.dataset.row = s, F.log(i, e, s), Array.from(i.cells).forEach((n, r) => {
|
|
573
570
|
const o = n.dataset.bind;
|
|
574
571
|
o && e && e[o] !== void 0 ? n.textContent = e[o] : n.textContent = e ? e[Object.keys(e)[r]] ?? `R${s}C${r}` : `ν ${s + 1}`, n.dataset.row = s;
|
|
575
572
|
});
|
|
576
573
|
}, "#bindRowData"));
|
|
577
|
-
|
|
578
|
-
t(this, $) && (t(this, $).disconnect(),
|
|
574
|
+
x(this, "destroy", /* @__PURE__ */ c(() => {
|
|
575
|
+
t(this, $) && (t(this, $).disconnect(), b(this, $, null));
|
|
579
576
|
}, "destroy"));
|
|
580
|
-
|
|
577
|
+
b(this, j, i.getRootNode().host), b(this, w, i), t(this, wt).call(this);
|
|
581
578
|
}
|
|
582
579
|
getRowHeight() {
|
|
583
580
|
return t(this, R);
|
|
@@ -587,23 +584,23 @@ const Gt = class Gt {
|
|
|
587
584
|
return ((e = t(this, _).get(i)) == null ? void 0 : e.length) || 1;
|
|
588
585
|
}
|
|
589
586
|
};
|
|
590
|
-
|
|
587
|
+
j = new WeakMap(), w = new WeakMap(), _ = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), P = new WeakMap(), Z = new WeakMap(), mt = new WeakMap(), xt = new WeakMap(), ot = new WeakMap(), rt = new WeakMap(), vt = new WeakMap(), wt = new WeakMap(), lt = new WeakMap(), G = new WeakMap(), St = new WeakMap(), c(Gt, "RowManager");
|
|
591
588
|
let Bt = Gt;
|
|
592
|
-
var Et, J,
|
|
589
|
+
var Et, J, Y, Rt, kt, qt, At, Tt;
|
|
593
590
|
const it = class it extends HTMLElement {
|
|
594
591
|
constructor() {
|
|
595
592
|
super();
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
593
|
+
a(this, Et);
|
|
594
|
+
a(this, J, null);
|
|
595
|
+
a(this, Y);
|
|
599
596
|
/**
|
|
600
597
|
* data.set, add, delete
|
|
601
598
|
* filter, sorting : κ³ λ €λμ
|
|
602
599
|
*/
|
|
603
|
-
|
|
604
|
-
t(this,
|
|
600
|
+
x(this, "invalidate", /* @__PURE__ */ c(() => {
|
|
601
|
+
t(this, Y).refresh();
|
|
605
602
|
}, "invalidate"));
|
|
606
|
-
|
|
603
|
+
a(this, Rt, /* @__PURE__ */ c(() => {
|
|
607
604
|
[
|
|
608
605
|
{ selector: ".ng-container-body", type: null },
|
|
609
606
|
{ selector: ".ng-container-left", type: "left" },
|
|
@@ -615,7 +612,7 @@ const it = class it extends HTMLElement {
|
|
|
615
612
|
r.innerHTML = "", r.appendChild(o);
|
|
616
613
|
});
|
|
617
614
|
}, "#renderSplitContainers"));
|
|
618
|
-
|
|
615
|
+
a(this, kt, /* @__PURE__ */ c(() => {
|
|
619
616
|
["left", "right"].forEach((e) => {
|
|
620
617
|
const s = this.querySelector(`.ng-container-${e}`), n = s == null ? void 0 : s.querySelector("table");
|
|
621
618
|
if (!s || !n) return;
|
|
@@ -626,14 +623,14 @@ const it = class it extends HTMLElement {
|
|
|
626
623
|
}), s.style.flex = `0 0 ${r}px`, s.style.width = `${r}px`;
|
|
627
624
|
});
|
|
628
625
|
}, "#updateContainerWidths"));
|
|
629
|
-
|
|
630
|
-
e && (
|
|
626
|
+
x(this, "generate", /* @__PURE__ */ c((e) => {
|
|
627
|
+
e && (b(this, J, Nt.compile(e)), t(this, J).style.display = "table", t(this, Rt).call(this), t(this, kt).call(this), requestAnimationFrame(() => {
|
|
631
628
|
var n;
|
|
632
629
|
const s = (n = this.querySelector("thead")) == null ? void 0 : n.getBoundingClientRect().height;
|
|
633
630
|
this.querySelectorAll("tbody.fixed-tbody").forEach((r) => {
|
|
634
631
|
r.style.top = `${s}px`;
|
|
635
632
|
});
|
|
636
|
-
}), t(this,
|
|
633
|
+
}), t(this, Y).initialize(), setTimeout(() => {
|
|
637
634
|
var s;
|
|
638
635
|
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
639
636
|
}, 0));
|
|
@@ -641,7 +638,7 @@ const it = class it extends HTMLElement {
|
|
|
641
638
|
/**
|
|
642
639
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
643
640
|
*/
|
|
644
|
-
|
|
641
|
+
a(this, qt, /* @__PURE__ */ c((e, s) => {
|
|
645
642
|
const n = e.cloneNode(!0), r = n.querySelector("tbody");
|
|
646
643
|
if (r) {
|
|
647
644
|
const o = document.createElement("tbody");
|
|
@@ -655,19 +652,19 @@ const it = class it extends HTMLElement {
|
|
|
655
652
|
o.remove();
|
|
656
653
|
}), n;
|
|
657
654
|
}, "#createSplitTable"));
|
|
658
|
-
|
|
659
|
-
|
|
655
|
+
x(this, "getRowHeight", /* @__PURE__ */ c(() => t(this, Y).getRowHeight(), "getRowHeight"));
|
|
656
|
+
x(this, "scrollToX", /* @__PURE__ */ c((e) => {
|
|
660
657
|
const s = this.querySelector(".ng-container-body");
|
|
661
658
|
s && (s.scrollLeft = e);
|
|
662
659
|
}, "scrollToX"));
|
|
663
|
-
|
|
660
|
+
x(this, "scrollToY", /* @__PURE__ */ c((e) => {
|
|
664
661
|
const s = this.querySelector(".ng-container-body");
|
|
665
662
|
s && (s.scrollTop = e);
|
|
666
663
|
}, "scrollToY"));
|
|
667
|
-
|
|
664
|
+
a(this, At, /* @__PURE__ */ c(() => {
|
|
668
665
|
t(this, Tt).call(this);
|
|
669
666
|
}, "#init"));
|
|
670
|
-
|
|
667
|
+
a(this, Tt, /* @__PURE__ */ c(() => {
|
|
671
668
|
const e = it.SCROLLBAR_SIZE;
|
|
672
669
|
this.innerHTML = `
|
|
673
670
|
<style>
|
|
@@ -814,23 +811,23 @@ const it = class it extends HTMLElement {
|
|
|
814
811
|
</div>
|
|
815
812
|
`;
|
|
816
813
|
}, "#render"));
|
|
817
|
-
|
|
814
|
+
b(this, Y, new Bt(this)), b(this, Et, this.getRootNode().host);
|
|
818
815
|
}
|
|
819
816
|
connectedCallback() {
|
|
820
817
|
t(this, At).call(this);
|
|
821
818
|
}
|
|
822
819
|
disconnectedCallback() {
|
|
823
|
-
this.innerHTML = "",
|
|
820
|
+
this.innerHTML = "", F.log("NineTableSheet destroyed.");
|
|
824
821
|
}
|
|
825
822
|
};
|
|
826
|
-
Et = new WeakMap(), J = new WeakMap(),
|
|
823
|
+
Et = new WeakMap(), J = new WeakMap(), Y = new WeakMap(), Rt = new WeakMap(), kt = new WeakMap(), qt = new WeakMap(), At = new WeakMap(), Tt = new WeakMap(), c(it, "NineTableSheet"), x(it, "SCROLLBAR_SIZE", 16);
|
|
827
824
|
let ut = it;
|
|
828
825
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ut);
|
|
829
826
|
var Lt, ct;
|
|
830
827
|
const Jt = class Jt extends HTMLElement {
|
|
831
828
|
constructor() {
|
|
832
829
|
super();
|
|
833
|
-
|
|
830
|
+
a(this, Lt, /* @__PURE__ */ c(() => {
|
|
834
831
|
var e;
|
|
835
832
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
836
833
|
var o;
|
|
@@ -838,14 +835,14 @@ const Jt = class Jt extends HTMLElement {
|
|
|
838
835
|
t(this, ct).call(this, r, n);
|
|
839
836
|
}), t(this, ct).call(this, 0, !1);
|
|
840
837
|
}, "#init"));
|
|
841
|
-
|
|
842
|
-
const n = /* @__PURE__ */
|
|
838
|
+
a(this, ct, /* @__PURE__ */ c((e, s = !1) => {
|
|
839
|
+
const n = /* @__PURE__ */ c(() => {
|
|
843
840
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
844
841
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((p) => p.style.setProperty("display", "none"));
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
const
|
|
848
|
-
|
|
842
|
+
const g = f.filter((p) => p.classList.contains("active"));
|
|
843
|
+
g.length < 2 || g.forEach((p) => {
|
|
844
|
+
const E = parseInt(p.getAttribute("data-index"), 10), L = this.querySelector(`nine-splitter[data-split-index="${E}"]`), ft = f[E + 1];
|
|
845
|
+
L && ft && ft.classList.contains("active") && L.style.setProperty("display", "flex");
|
|
849
846
|
});
|
|
850
847
|
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), h = o.querySelectorAll("nine-table-sheet");
|
|
851
848
|
if (!l[e]) return;
|
|
@@ -853,16 +850,16 @@ const Jt = class Jt extends HTMLElement {
|
|
|
853
850
|
l.forEach((f, u) => {
|
|
854
851
|
f.classList.toggle("active", u === e);
|
|
855
852
|
}), h.forEach((f, u) => {
|
|
856
|
-
const
|
|
857
|
-
f.classList.toggle("active",
|
|
853
|
+
const g = u === e;
|
|
854
|
+
f.classList.toggle("active", g), f.style.flex = g ? "1 1 100%" : "";
|
|
858
855
|
});
|
|
859
856
|
else {
|
|
860
857
|
const f = l[e], u = r.querySelectorAll(".nine-tab-item.active");
|
|
861
858
|
if (f.classList.contains("active") && u.length <= 1)
|
|
862
859
|
return;
|
|
863
860
|
f.classList.toggle("active");
|
|
864
|
-
const
|
|
865
|
-
|
|
861
|
+
const g = o.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
862
|
+
g && (g.classList.toggle("active"), g.classList.contains("active") || (g.style.flex = ""));
|
|
866
863
|
}
|
|
867
864
|
const d = o.querySelectorAll("nine-table-sheet.active");
|
|
868
865
|
d == null || d.forEach((f) => {
|
|
@@ -874,30 +871,30 @@ const Jt = class Jt extends HTMLElement {
|
|
|
874
871
|
t(this, Lt).call(this);
|
|
875
872
|
}
|
|
876
873
|
};
|
|
877
|
-
Lt = new WeakMap(), ct = new WeakMap(),
|
|
874
|
+
Lt = new WeakMap(), ct = new WeakMap(), c(Jt, "NineTableSheets");
|
|
878
875
|
let Pt = Jt;
|
|
879
876
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Pt);
|
|
880
|
-
var k, Ht,
|
|
877
|
+
var k, Ht, at, Ct;
|
|
881
878
|
const Qt = class Qt {
|
|
882
879
|
constructor(i) {
|
|
883
|
-
|
|
884
|
-
|
|
880
|
+
a(this, k);
|
|
881
|
+
a(this, Ht, /* @__PURE__ */ c(() => {
|
|
885
882
|
t(this, Ct).call(this), new ResizeObserver((i) => {
|
|
886
883
|
for (let e of i)
|
|
887
|
-
t(this, k).getAttribute("auto-height") === "true" && t(this,
|
|
884
|
+
t(this, k).getAttribute("auto-height") === "true" && t(this, at).call(this);
|
|
888
885
|
}).observe(t(this, k));
|
|
889
886
|
}, "#init"));
|
|
890
|
-
|
|
887
|
+
a(this, at, /* @__PURE__ */ c(() => {
|
|
891
888
|
var h, d;
|
|
892
889
|
const i = Array.from(t(this, k).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
893
890
|
if (i.length === 0) return;
|
|
894
891
|
const e = parseInt(t(this, k).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), n = (h = t(this, k).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : h.getBoundingClientRect().height, r = (d = t(this, k).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : d.getBoundingClientRect().height, o = ut.SCROLLBAR_SIZE, l = e * s + n + r + o;
|
|
895
892
|
t(this, k).style.height = `${l}px`;
|
|
896
893
|
}, "#applyAutoHeight"));
|
|
897
|
-
|
|
894
|
+
a(this, Ct, /* @__PURE__ */ c(() => {
|
|
898
895
|
const e = Array.from(t(this, k).children).filter((h) => h.tagName === "TABLE"), s = t(this, k).getAttribute("auto-height") === "true", n = e.length, r = e.map((h, d) => {
|
|
899
|
-
const u = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`,
|
|
900
|
-
return u +
|
|
896
|
+
const u = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`, g = d < n - 1 ? `<nine-splitter class="h" data-split-index="${d}"></nine-splitter>` : "";
|
|
897
|
+
return u + g;
|
|
901
898
|
}).join(""), o = e.map((h, d) => `<div class="nine-tab-item ${d === 0 ? "active" : ""}" data-index="${d}">Sheet ${d + 1}</div>`).join("");
|
|
902
899
|
t(this, k).shadowRoot.innerHTML = `
|
|
903
900
|
<style>
|
|
@@ -1001,80 +998,80 @@ const Qt = class Qt {
|
|
|
1001
998
|
const l = t(this, k).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1002
999
|
l == null || l.forEach((h, d) => {
|
|
1003
1000
|
e[d] && setTimeout(() => {
|
|
1004
|
-
h.generate(e[d]), s && t(this,
|
|
1001
|
+
h.generate(e[d]), s && t(this, at).call(this);
|
|
1005
1002
|
});
|
|
1006
1003
|
});
|
|
1007
1004
|
}, "#render"));
|
|
1008
|
-
|
|
1005
|
+
b(this, k, i), t(this, Ht).call(this);
|
|
1009
1006
|
}
|
|
1010
1007
|
};
|
|
1011
|
-
k = new WeakMap(), Ht = new WeakMap(),
|
|
1008
|
+
k = new WeakMap(), Ht = new WeakMap(), at = new WeakMap(), Ct = new WeakMap(), c(Qt, "LayoutManager");
|
|
1012
1009
|
let Yt = Qt;
|
|
1013
|
-
var
|
|
1010
|
+
var ht, Q;
|
|
1014
1011
|
const te = class te {
|
|
1015
1012
|
constructor(i) {
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1013
|
+
a(this, ht);
|
|
1014
|
+
a(this, Q, -1);
|
|
1015
|
+
x(this, "count", /* @__PURE__ */ c(() => t(this, ht).rawRecords.length, "count"));
|
|
1016
|
+
b(this, ht, i);
|
|
1020
1017
|
}
|
|
1021
1018
|
get at() {
|
|
1022
1019
|
return t(this, Q);
|
|
1023
1020
|
}
|
|
1024
1021
|
set at(i) {
|
|
1025
|
-
|
|
1022
|
+
b(this, Q, parseInt(i, 10)), body && !body.querySelector(`tbody.bindable tr[data-row="${t(this, Q)}"]`) && setTimeout(() => {
|
|
1026
1023
|
});
|
|
1027
1024
|
}
|
|
1028
1025
|
};
|
|
1029
|
-
|
|
1026
|
+
ht = new WeakMap(), Q = new WeakMap(), c(te, "ngRow");
|
|
1030
1027
|
let Vt = te;
|
|
1031
|
-
var
|
|
1032
|
-
const
|
|
1028
|
+
var q, S, A, tt, _t, W, Mt, V, dt, It, $t, et;
|
|
1029
|
+
const T = class T {
|
|
1033
1030
|
constructor(i, e) {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
const i = t(this,
|
|
1031
|
+
a(this, q);
|
|
1032
|
+
a(this, S);
|
|
1033
|
+
a(this, A, []);
|
|
1034
|
+
a(this, tt, []);
|
|
1035
|
+
a(this, _t, 0);
|
|
1036
|
+
a(this, W, []);
|
|
1037
|
+
a(this, Mt, /* @__PURE__ */ c(() => {
|
|
1038
|
+
b(this, W, []);
|
|
1039
|
+
const i = t(this, q).template || [];
|
|
1043
1040
|
Array.from(i).forEach((e) => {
|
|
1044
1041
|
var s;
|
|
1045
1042
|
t(this, W).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1046
|
-
}), (t(this,
|
|
1047
|
-
e.__ng || (e.__ng = t(this,
|
|
1043
|
+
}), (t(this, S).rawRecords || []).forEach((e) => {
|
|
1044
|
+
e.__ng || (e.__ng = t(this, dt).call(this)), e.__ng.height = t(this, W).slice();
|
|
1048
1045
|
});
|
|
1049
1046
|
}, "#initialize"));
|
|
1050
|
-
|
|
1051
|
-
t(this,
|
|
1047
|
+
a(this, V, /* @__PURE__ */ c(() => {
|
|
1048
|
+
t(this, q).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1052
1049
|
i.invalidate();
|
|
1053
1050
|
});
|
|
1054
1051
|
}, "#invalidate"));
|
|
1055
|
-
|
|
1056
|
-
this.clear(), this.add(i, !1), t(this,
|
|
1052
|
+
x(this, "set", /* @__PURE__ */ c((i) => {
|
|
1053
|
+
this.clear(), this.add(i, !1), t(this, V).call(this);
|
|
1057
1054
|
}, "set"));
|
|
1058
|
-
|
|
1059
|
-
rowState:
|
|
1055
|
+
a(this, dt, /* @__PURE__ */ c(() => ({
|
|
1056
|
+
rowState: T.ROW_STATE.EMPTY,
|
|
1060
1057
|
deleted: !1,
|
|
1061
1058
|
filtered: !1,
|
|
1062
1059
|
height: t(this, W).slice(),
|
|
1063
1060
|
o: {},
|
|
1064
1061
|
c: {},
|
|
1065
|
-
_: [0, 0, 0, 0,
|
|
1062
|
+
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, W).slice(), -1, {}, {}]
|
|
1066
1063
|
}), "#getDefaultMeta"));
|
|
1067
|
-
|
|
1068
|
-
|
|
1064
|
+
x(this, "reset", /* @__PURE__ */ c(() => {
|
|
1065
|
+
b(this, A, []), b(this, tt, []), t(this, V).call(this);
|
|
1069
1066
|
}, "reset"));
|
|
1070
|
-
|
|
1067
|
+
x(this, "clear", /* @__PURE__ */ c(() => {
|
|
1071
1068
|
var i;
|
|
1072
|
-
t(this,
|
|
1069
|
+
t(this, S).rawRecords = [], b(this, A, []), b(this, tt, []), (i = t(this, S).viewRecords) != null && i.reset && t(this, S).viewRecords.reset();
|
|
1073
1070
|
}, "clear"));
|
|
1074
|
-
|
|
1071
|
+
a(this, It, /* @__PURE__ */ c((i) => {
|
|
1075
1072
|
var n;
|
|
1076
1073
|
Array.isArray(i) || (i = [i]);
|
|
1077
|
-
const e = typeof ((n = t(this,
|
|
1074
|
+
const e = typeof ((n = t(this, q).fields) == null ? void 0 : n.get) == "function" ? t(this, q).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1078
1075
|
return i.forEach((r) => {
|
|
1079
1076
|
const o = { v: [] };
|
|
1080
1077
|
e.forEach((l) => {
|
|
@@ -1082,52 +1079,52 @@ const L = class L {
|
|
|
1082
1079
|
}), s.push(o);
|
|
1083
1080
|
}), s;
|
|
1084
1081
|
}, "#json2Array"));
|
|
1085
|
-
|
|
1086
|
-
e.__ng = t(this,
|
|
1082
|
+
a(this, $t, /* @__PURE__ */ c((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1083
|
+
e.__ng = t(this, dt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = T.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1087
1084
|
}), i), "#defaultInsert"));
|
|
1088
|
-
|
|
1085
|
+
x(this, "add", /* @__PURE__ */ c((i, e = !0) => {
|
|
1089
1086
|
i === void 0 && (i = {});
|
|
1090
1087
|
const s = t(this, It).call(this, i);
|
|
1091
|
-
t(this,
|
|
1088
|
+
t(this, S).rawRecords = t(this, S).rawRecords.concat(t(this, $t).call(this, s)), this.resetRecords();
|
|
1092
1089
|
const n = this.count() - 1;
|
|
1093
1090
|
return e || s.forEach((r, o) => {
|
|
1094
|
-
const l = t(this,
|
|
1095
|
-
l && (l.__ng.rowState =
|
|
1096
|
-
}), t(this,
|
|
1091
|
+
const l = t(this, S).rawRecords[n - o];
|
|
1092
|
+
l && (l.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
1093
|
+
}), t(this, V).call(this), n;
|
|
1097
1094
|
}, "add"));
|
|
1098
|
-
|
|
1095
|
+
x(this, "delete", /* @__PURE__ */ c((i) => {
|
|
1099
1096
|
let e = [];
|
|
1100
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this,
|
|
1101
|
-
if (t(this,
|
|
1102
|
-
const n = t(this,
|
|
1103
|
-
t(this,
|
|
1104
|
-
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState =
|
|
1097
|
+
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, S).host.row.at] : e = [parseInt(i, 10)], e.sort((s, n) => n - s).forEach((s) => {
|
|
1098
|
+
if (t(this, A)[s]) {
|
|
1099
|
+
const n = t(this, A)[s].__ng.rowid;
|
|
1100
|
+
t(this, A)[s].__ng.rowState === T.ROW_STATE.INSERT ? t(this, S).rawRecords = t(this, S).rawRecords.filter((r) => r.__ng.rowid !== n) : t(this, S).rawRecords.forEach((r) => {
|
|
1101
|
+
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState = T.ROW_STATE.DELETE);
|
|
1105
1102
|
});
|
|
1106
1103
|
}
|
|
1107
|
-
}), this.resetRecords(), t(this,
|
|
1104
|
+
}), this.resetRecords(), t(this, V).call(this);
|
|
1108
1105
|
}, "delete"));
|
|
1109
|
-
|
|
1106
|
+
x(this, "setValue", /* @__PURE__ */ c((i, e, s) => {
|
|
1110
1107
|
var h;
|
|
1111
1108
|
i = parseInt(i, 10);
|
|
1112
|
-
const r = (typeof ((h = t(this,
|
|
1109
|
+
const r = (typeof ((h = t(this, q).fields) == null ? void 0 : h.get) == "function" ? t(this, q).fields.get() : []).indexOf(e);
|
|
1113
1110
|
if (r < 0) return;
|
|
1114
1111
|
const o = this.getValidData()[i];
|
|
1115
1112
|
if (!o) return;
|
|
1116
1113
|
const l = o.v[r];
|
|
1117
|
-
l !== s && o.__ng.rowState !==
|
|
1114
|
+
l !== s && o.__ng.rowState !== T.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = l), o.__ng.rowState = T.ROW_STATE.UPDATE), o.v[r] = s;
|
|
1118
1115
|
}, "setValue"));
|
|
1119
|
-
|
|
1120
|
-
|
|
1116
|
+
x(this, "resetRecords", /* @__PURE__ */ c(() => {
|
|
1117
|
+
b(this, tt, t(this, S).rawRecords.filter((i) => !i.__ng.deleted)), b(this, A, t(this, S).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, S).rawRecords.forEach((i, e) => {
|
|
1121
1118
|
i.__ng.rowidx = e;
|
|
1122
|
-
}), t(this,
|
|
1119
|
+
}), t(this, A).forEach((i, e) => {
|
|
1123
1120
|
i.__ng.i = e;
|
|
1124
1121
|
});
|
|
1125
1122
|
}, "resetRecords"));
|
|
1126
|
-
|
|
1127
|
-
|
|
1123
|
+
x(this, "getValidData", /* @__PURE__ */ c(() => (t(this, A).length === 0 && t(this, S).rawRecords.length > 0 && this.resetRecords(), t(this, A)), "getValidData"));
|
|
1124
|
+
a(this, et, /* @__PURE__ */ c((i) => {
|
|
1128
1125
|
var s;
|
|
1129
1126
|
if (!i) return i;
|
|
1130
|
-
const e = typeof ((s = t(this,
|
|
1127
|
+
const e = typeof ((s = t(this, q).fields) == null ? void 0 : s.get) == "function" ? t(this, q).fields.get() : [];
|
|
1131
1128
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
1132
1129
|
const r = {};
|
|
1133
1130
|
return e.forEach((o, l) => {
|
|
@@ -1135,54 +1132,54 @@ const L = class L {
|
|
|
1135
1132
|
}), r.__ng = n.__ng, r;
|
|
1136
1133
|
}) : i;
|
|
1137
1134
|
}, "#conv2"));
|
|
1138
|
-
|
|
1139
|
-
|
|
1135
|
+
x(this, "count", /* @__PURE__ */ c(() => this.getValidData().length, "count"));
|
|
1136
|
+
x(this, "get", /* @__PURE__ */ c((i, e) => {
|
|
1140
1137
|
var r;
|
|
1141
1138
|
const s = this.getValidData();
|
|
1142
1139
|
if (!s || s.length <= 0) return;
|
|
1143
1140
|
if (i == null) return t(this, et).call(this, s);
|
|
1144
1141
|
if (i < 0 || i >= s.length) return null;
|
|
1145
|
-
const n = typeof ((r = t(this,
|
|
1142
|
+
const n = typeof ((r = t(this, q).fields) == null ? void 0 : r.get) == "function" ? t(this, q).fields.get() : [];
|
|
1146
1143
|
if (e != null) {
|
|
1147
1144
|
const o = n.indexOf(e);
|
|
1148
1145
|
return o >= 0 ? s[i].v[o] : null;
|
|
1149
1146
|
}
|
|
1150
1147
|
return t(this, et).call(this, s[i]);
|
|
1151
1148
|
}, "get"));
|
|
1152
|
-
|
|
1149
|
+
b(this, q, i), b(this, S, e), t(this, Mt).call(this);
|
|
1153
1150
|
}
|
|
1154
1151
|
get source() {
|
|
1155
|
-
return t(this, et).call(this, t(this,
|
|
1152
|
+
return t(this, et).call(this, t(this, S).rawRecords);
|
|
1156
1153
|
}
|
|
1157
1154
|
set source(i) {
|
|
1158
1155
|
this.clear(), this.add(i, !1);
|
|
1159
1156
|
}
|
|
1160
1157
|
get nextId() {
|
|
1161
|
-
return ++
|
|
1158
|
+
return ++re(this, _t)._;
|
|
1162
1159
|
}
|
|
1163
1160
|
get length() {
|
|
1164
|
-
return t(this,
|
|
1161
|
+
return t(this, A).length;
|
|
1165
1162
|
}
|
|
1166
1163
|
getRowCount() {
|
|
1167
1164
|
return this.length;
|
|
1168
1165
|
}
|
|
1169
1166
|
};
|
|
1170
|
-
|
|
1171
|
-
|
|
1167
|
+
q = new WeakMap(), S = new WeakMap(), A = new WeakMap(), tt = new WeakMap(), _t = new WeakMap(), W = new WeakMap(), Mt = new WeakMap(), V = new WeakMap(), dt = new WeakMap(), It = new WeakMap(), $t = new WeakMap(), et = new WeakMap(), c(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1168
|
+
x(T, "ROW_STATE", {
|
|
1172
1169
|
EMPTY: "EMPTY",
|
|
1173
1170
|
NORMAL: "NORMAL",
|
|
1174
1171
|
INSERT: "INSERT",
|
|
1175
1172
|
UPDATE: "UPDATE",
|
|
1176
1173
|
DELETE: "DELETE"
|
|
1177
1174
|
});
|
|
1178
|
-
let Xt =
|
|
1179
|
-
var
|
|
1175
|
+
let Xt = T;
|
|
1176
|
+
var X;
|
|
1180
1177
|
const ee = class ee {
|
|
1181
1178
|
constructor(i) {
|
|
1182
|
-
|
|
1183
|
-
|
|
1179
|
+
a(this, X);
|
|
1180
|
+
b(this, X, i), this.row = new Vt(this), this.data = new Xt(t(this, X), this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1184
1181
|
var e;
|
|
1185
|
-
(e = t(this,
|
|
1182
|
+
(e = t(this, X).view) != null && e.redraw && t(this, X).view.redraw();
|
|
1186
1183
|
}, this.setDataSource = (e) => {
|
|
1187
1184
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1188
1185
|
}, this.getRowState = (e) => {
|
|
@@ -1197,37 +1194,37 @@ const ee = class ee {
|
|
|
1197
1194
|
}, this.setDataSource([]);
|
|
1198
1195
|
}
|
|
1199
1196
|
};
|
|
1200
|
-
|
|
1197
|
+
X = new WeakMap(), c(ee, "ngDataManager");
|
|
1201
1198
|
let Ut = ee;
|
|
1202
|
-
var
|
|
1199
|
+
var U, Wt;
|
|
1203
1200
|
const ie = class ie extends HTMLElement {
|
|
1204
1201
|
constructor() {
|
|
1205
1202
|
super();
|
|
1206
1203
|
//#created = false;
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
this.attachShadow({ mode: "open" }),
|
|
1204
|
+
a(this, U);
|
|
1205
|
+
a(this, Wt);
|
|
1206
|
+
this.attachShadow({ mode: "open" }), b(this, U, new Ut(this));
|
|
1210
1207
|
}
|
|
1211
1208
|
connectedCallback() {
|
|
1212
|
-
|
|
1209
|
+
b(this, Wt, new Yt(this)), F.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1213
1210
|
}
|
|
1214
1211
|
disconnectedCallback() {
|
|
1215
|
-
|
|
1212
|
+
F.log("NineTable disconnected.");
|
|
1216
1213
|
}
|
|
1217
1214
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1218
1215
|
get data() {
|
|
1219
|
-
return t(this,
|
|
1216
|
+
return t(this, U).data;
|
|
1220
1217
|
}
|
|
1221
1218
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
1222
1219
|
get row() {
|
|
1223
|
-
return t(this,
|
|
1220
|
+
return t(this, U).row;
|
|
1224
1221
|
}
|
|
1225
1222
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
1226
1223
|
get dataManager() {
|
|
1227
|
-
return t(this,
|
|
1224
|
+
return t(this, U);
|
|
1228
1225
|
}
|
|
1229
1226
|
};
|
|
1230
|
-
|
|
1227
|
+
U = new WeakMap(), Wt = new WeakMap(), c(ie, "NineTable");
|
|
1231
1228
|
let Ft = ie;
|
|
1232
1229
|
customElements.get("nine-table") || customElements.define("nine-table", Ft);
|
|
1233
1230
|
//# sourceMappingURL=nine-table.js.map
|