@ninebone/table 0.0.278 β 0.0.280
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 +374 -380
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +7 -7
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Ve = Object.defineProperty;
|
|
2
|
+
var Xe = (p) => {
|
|
3
3
|
throw TypeError(p);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var a = (p, i) =>
|
|
7
|
-
var
|
|
8
|
-
var e = (p, i, t) => (
|
|
9
|
-
var
|
|
5
|
+
var Ke = (p, i, t) => i in p ? Ve(p, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[i] = t;
|
|
6
|
+
var a = (p, i) => Ve(p, "name", { value: i, configurable: !0 });
|
|
7
|
+
var v = (p, i, t) => Ke(p, typeof i != "symbol" ? i + "" : i, t), Ye = (p, i, t) => i.has(p) || Xe("Cannot " + t);
|
|
8
|
+
var e = (p, i, t) => (Ye(p, i, "read from private field"), t ? t.call(p) : i.get(p)), c = (p, i, t) => i.has(p) ? Xe("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(p) : i.set(p, t), g = (p, i, t, s) => (Ye(p, i, "write to private field"), s ? s.call(p, t) : i.set(p, t), t);
|
|
9
|
+
var Ue = (p, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
|
-
|
|
11
|
+
g(p, i, n, t);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
14
|
return e(p, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
import { trace as
|
|
18
|
-
const
|
|
17
|
+
import { trace as Ze } from "@ninebone/util";
|
|
18
|
+
const Me = class Me extends Ze.constructor {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
a(
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
var k,
|
|
27
|
-
const
|
|
23
|
+
a(Me, "Trace");
|
|
24
|
+
let Ee = Me;
|
|
25
|
+
const F = new Ee();
|
|
26
|
+
var k, $, y, O, W, z, ne, D, re;
|
|
27
|
+
const $e = class $e extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
c(this, k);
|
|
31
|
+
c(this, $, !1);
|
|
32
|
+
c(this, y);
|
|
33
|
+
c(this, O);
|
|
34
|
+
c(this, W);
|
|
35
|
+
c(this, z);
|
|
36
|
+
c(this, ne, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!e(this, k)) return;
|
|
38
38
|
const t = e(this, k).querySelector(".ng-container-body");
|
|
39
|
-
t && (
|
|
39
|
+
t && (g(this, z, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), e(this,
|
|
41
|
+
})), e(this, z).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
|
-
|
|
44
|
-
if (!e(this, k) || !e(this, y) || e(this,
|
|
43
|
+
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
+
if (!e(this, k) || !e(this, y) || e(this, $)) return;
|
|
45
45
|
const t = e(this, y).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = e(this, y).track,
|
|
48
|
-
if (l !== 0 &&
|
|
49
|
-
|
|
47
|
+
const n = e(this, y).track, r = e(this, y).thumb, o = e(this, k).querySelector(".ng-container-bottom"), l = t.clientWidth, d = s.scrollWidth;
|
|
48
|
+
if (l !== 0 && d > l)
|
|
49
|
+
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
51
|
-
|
|
51
|
+
o && (o.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
const h = n.clientWidth;
|
|
55
55
|
if (h <= 0) return;
|
|
56
|
-
const f = Math.max(Math.min(h * (l /
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
let
|
|
60
|
-
u > 0 && (
|
|
56
|
+
const f = Math.max(Math.min(h * (l / d), h), 20);
|
|
57
|
+
r.style.width = `${f}px`;
|
|
58
|
+
const b = t.scrollLeft, u = d - l;
|
|
59
|
+
let x = 0;
|
|
60
|
+
u > 0 && (x = parseInt(b / u * (h - f), 10)), x < 0 && (x = 0);
|
|
61
61
|
const w = h - f;
|
|
62
|
-
|
|
62
|
+
x > w && (x = w), r.style.left = `${x}px`, F.log(x), e(this, y).left.disabled = x === 0, e(this, y).right.disabled = x >= w - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
|
|
64
|
+
c(this, D, /* @__PURE__ */ a((t) => {
|
|
65
65
|
if (!e(this, y)) return !1;
|
|
66
66
|
const s = e(this, y).container, n = s.querySelector("table");
|
|
67
67
|
if (!n) return !1;
|
|
68
|
-
const
|
|
68
|
+
const r = e(this, y).track.getBoundingClientRect(), o = e(this, y).thumb.clientWidth;
|
|
69
69
|
let l = t;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
|
-
const
|
|
72
|
-
l >
|
|
71
|
+
const d = r.width - o;
|
|
72
|
+
l > d && (l = d), l = parseInt(l, 10), e(this, y).thumb.style.left = `${l}px`, e(this, y).left.disabled = l === 0, e(this, y).right.disabled = l >= d - 1;
|
|
73
73
|
const h = s.clientWidth, f = n.scrollWidth;
|
|
74
|
-
let
|
|
75
|
-
return -
|
|
74
|
+
let b = d > 0 ? -l * (f - h) / d : 0;
|
|
75
|
+
return -b > f - h && (b = -(f - h)), -b + 5 > f - h && (b = -(f - h)), h >= f && (b = 0), n.style.transform = `translateX(${b}px)`, l > 0 && l < d - 1;
|
|
76
76
|
}, "#thumbMoveTo"));
|
|
77
|
-
|
|
77
|
+
c(this, re, /* @__PURE__ */ a(() => {
|
|
78
78
|
const t = /* @__PURE__ */ a((n) => {
|
|
79
|
-
clearInterval(e(this, O)), clearInterval(e(this,
|
|
80
|
-
const
|
|
81
|
-
e(this, D).call(this,
|
|
82
|
-
clearInterval(e(this, O)),
|
|
83
|
-
const
|
|
84
|
-
e(this, D).call(this,
|
|
79
|
+
clearInterval(e(this, O)), clearInterval(e(this, W));
|
|
80
|
+
const r = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
81
|
+
e(this, D).call(this, r + n), g(this, O, setInterval(() => {
|
|
82
|
+
clearInterval(e(this, O)), g(this, W, setInterval(() => {
|
|
83
|
+
const o = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
84
|
+
e(this, D).call(this, o + n) || clearInterval(e(this, W));
|
|
85
85
|
}, 50));
|
|
86
86
|
}, 500));
|
|
87
87
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
88
|
-
clearInterval(e(this, O)), clearInterval(e(this,
|
|
88
|
+
clearInterval(e(this, O)), clearInterval(e(this, W));
|
|
89
89
|
}, "clearTimer");
|
|
90
90
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
91
91
|
e(this, y).left.addEventListener(n, s), e(this, y).right.addEventListener(n, s), e(this, y).track.addEventListener(n, s);
|
|
@@ -96,24 +96,24 @@ const He = class He extends HTMLElement {
|
|
|
96
96
|
}), e(this, y).left.addEventListener("touchstart", () => t(-20)), e(this, y).right.addEventListener("touchstart", () => t(20)), e(this, y).track.addEventListener("mousedown", (n) => {
|
|
97
97
|
if (n.button !== 0) return;
|
|
98
98
|
n.preventDefault();
|
|
99
|
-
const
|
|
100
|
-
e(this, D).call(this, n.clientX -
|
|
99
|
+
const r = e(this, y).track.getBoundingClientRect(), o = e(this, y).thumb.clientWidth;
|
|
100
|
+
e(this, D).call(this, n.clientX - r.left - o / 2);
|
|
101
101
|
}), e(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
102
102
|
if (n.button !== 0) return;
|
|
103
|
-
n.stopPropagation(), n.preventDefault(),
|
|
104
|
-
const
|
|
105
|
-
if (!e(this,
|
|
106
|
-
const
|
|
107
|
-
e(this, D).call(this, l.clientX -
|
|
108
|
-
}, "onMouseMove"),
|
|
109
|
-
|
|
103
|
+
n.stopPropagation(), n.preventDefault(), g(this, $, !0), this.shiftX = n.clientX - e(this, y).thumb.getBoundingClientRect().left;
|
|
104
|
+
const r = /* @__PURE__ */ a((l) => {
|
|
105
|
+
if (!e(this, $)) return;
|
|
106
|
+
const d = e(this, y).track.getBoundingClientRect();
|
|
107
|
+
e(this, D).call(this, l.clientX - d.left - this.shiftX);
|
|
108
|
+
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
109
|
+
g(this, $, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
110
110
|
}, "onMouseUp");
|
|
111
|
-
document.addEventListener("mousemove",
|
|
111
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
112
112
|
});
|
|
113
113
|
}, "#init"));
|
|
114
114
|
}
|
|
115
115
|
connectedCallback() {
|
|
116
|
-
if (
|
|
116
|
+
if (g(this, k, this.closest("nine-table-sheet") || this.getRootNode().host), !e(this, k)) return;
|
|
117
117
|
this.innerHTML = `
|
|
118
118
|
<style>
|
|
119
119
|
nine-table-hscrollbar {
|
|
@@ -183,24 +183,24 @@ const He = class He extends HTMLElement {
|
|
|
183
183
|
setTimeout(t, 10);
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
g(this, y, {
|
|
187
187
|
container: s,
|
|
188
188
|
track: this.querySelector(".ng-scroll-track"),
|
|
189
189
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
190
190
|
left: this.querySelector(".ng-scroll-left"),
|
|
191
191
|
right: this.querySelector(".ng-scroll-right")
|
|
192
|
-
}), e(this,
|
|
192
|
+
}), e(this, re).call(this), e(this, ne).call(this), this.refresh();
|
|
193
193
|
}, "initWhenReady");
|
|
194
194
|
t();
|
|
195
195
|
}
|
|
196
196
|
disconnectedCallback() {
|
|
197
|
-
e(this,
|
|
197
|
+
e(this, z) && e(this, z).disconnect();
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
|
-
k = new WeakMap(),
|
|
201
|
-
let
|
|
202
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar",
|
|
203
|
-
var
|
|
200
|
+
k = new WeakMap(), $ = new WeakMap(), y = new WeakMap(), O = new WeakMap(), W = new WeakMap(), z = new WeakMap(), ne = new WeakMap(), D = new WeakMap(), re = new WeakMap(), a($e, "NineTableHScrollBar");
|
|
201
|
+
let Re = $e;
|
|
202
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Re);
|
|
203
|
+
var oe, j;
|
|
204
204
|
const L = class L {
|
|
205
205
|
/**
|
|
206
206
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
@@ -212,23 +212,23 @@ const L = class L {
|
|
|
212
212
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
213
213
|
*/
|
|
214
214
|
static compile(i) {
|
|
215
|
-
var n,
|
|
215
|
+
var n, r, o;
|
|
216
216
|
if (!i) return null;
|
|
217
217
|
const t = i.cloneNode(!0);
|
|
218
|
-
return e(n = L,
|
|
218
|
+
return e(n = L, oe).call(n, t), e(r = L, j).call(r, t, "thead"), e(o = L, j).call(o, t, "tbody"), Array.from(t.querySelectorAll("colgroup col")).forEach((l, d) => {
|
|
219
219
|
const h = l.getAttribute("fixed");
|
|
220
|
-
h && t.querySelectorAll(`[data-col="${
|
|
220
|
+
h && t.querySelectorAll(`[data-col="${d}"]`).forEach((f) => {
|
|
221
221
|
f.setAttribute("fixed", h);
|
|
222
222
|
});
|
|
223
223
|
}), t;
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
|
-
|
|
226
|
+
oe = new WeakMap(), j = new WeakMap(), a(L, "TableCompiler"), c(L, oe, /* @__PURE__ */ a((i) => {
|
|
227
227
|
if (!i.querySelector("colgroup")) {
|
|
228
|
-
const t = i.querySelector("tbody tr") || i.querySelector("tr"), s = t ? t.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"),
|
|
229
|
-
for (let
|
|
228
|
+
const t = i.querySelector("tbody tr") || i.querySelector("tr"), s = t ? t.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
229
|
+
for (let o = 0; o < s; o++) {
|
|
230
230
|
const l = document.createElement("col");
|
|
231
|
-
l.setAttribute("width",
|
|
231
|
+
l.setAttribute("width", r), n.appendChild(l);
|
|
232
232
|
}
|
|
233
233
|
i.prepend(n);
|
|
234
234
|
}
|
|
@@ -237,77 +237,85 @@ le = new WeakMap(), G = new WeakMap(), a(L, "TableCompiler"), d(L, le, /* @__PUR
|
|
|
237
237
|
s ? s.after(t) : i.prepend(t);
|
|
238
238
|
}
|
|
239
239
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
240
|
-
}, "#ensureTableStructure")),
|
|
241
|
-
const s = Array.from(i.querySelectorAll(t + " tr")), n = Array.from(i.querySelectorAll(t + " th," + t + " td")),
|
|
242
|
-
if (
|
|
243
|
-
let
|
|
244
|
-
n.forEach((
|
|
245
|
-
|
|
240
|
+
}, "#ensureTableStructure")), c(L, j, /* @__PURE__ */ a((i, t) => {
|
|
241
|
+
const s = Array.from(i.querySelectorAll(t + " tr")), n = Array.from(i.querySelectorAll(t + " th," + t + " td")), r = s.length;
|
|
242
|
+
if (r === 0 || n.length === 0) return;
|
|
243
|
+
let o = 0;
|
|
244
|
+
n.forEach((d) => {
|
|
245
|
+
o += d.colSpan || 1;
|
|
246
246
|
});
|
|
247
|
-
const l = Array.from(Array(
|
|
248
|
-
s.forEach((
|
|
249
|
-
const h =
|
|
247
|
+
const l = Array.from(Array(r), () => Array(o).fill(null));
|
|
248
|
+
s.forEach((d) => {
|
|
249
|
+
const h = d.sectionRowIndex;
|
|
250
250
|
let f = 0;
|
|
251
|
-
Array.from(
|
|
251
|
+
Array.from(d.querySelectorAll("th,td")).forEach((b) => {
|
|
252
252
|
for (let w = 0; w < l[h].length; w++)
|
|
253
253
|
if (l[h][w] === null) {
|
|
254
254
|
f = w;
|
|
255
255
|
break;
|
|
256
256
|
}
|
|
257
|
-
const u =
|
|
257
|
+
const u = b.rowSpan || 1, x = b.colSpan || 1;
|
|
258
258
|
for (let w = 0; w < u; w++)
|
|
259
|
-
for (let
|
|
260
|
-
h + w <
|
|
259
|
+
for (let C = 0; C < x; C++)
|
|
260
|
+
h + w < r && f + C < o && (l[h + w][f + C] = w === 0 && C === 0 ? "1" : "0");
|
|
261
261
|
});
|
|
262
|
-
}), s.forEach((
|
|
263
|
-
const h =
|
|
264
|
-
Array.from(
|
|
265
|
-
for (let
|
|
266
|
-
if (l[h][
|
|
267
|
-
f.dataset.col =
|
|
262
|
+
}), s.forEach((d) => {
|
|
263
|
+
const h = d.sectionRowIndex;
|
|
264
|
+
Array.from(d.querySelectorAll("th,td")).forEach((f) => {
|
|
265
|
+
for (let b = 0; b < l[h].length; b++)
|
|
266
|
+
if (l[h][b] === "1") {
|
|
267
|
+
f.dataset.col = b, l[h][b] = "0";
|
|
268
268
|
break;
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
271
|
});
|
|
272
272
|
}, "#resetColIndex"));
|
|
273
|
-
let
|
|
274
|
-
var T,
|
|
275
|
-
const
|
|
273
|
+
let Ae = L;
|
|
274
|
+
var T, _, E, I, N, B, le, He, ae, G, ce, J;
|
|
275
|
+
const Oe = class Oe {
|
|
276
276
|
constructor(i) {
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
c(this, T);
|
|
278
|
+
c(this, _, /* @__PURE__ */ new Map());
|
|
279
279
|
// κ° μ»¨ν
μ΄λλ³ λ
립λ ν
νλ¦Ώ TR κ΄λ¦¬
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
c(this, E, null);
|
|
281
|
+
c(this, I, null);
|
|
282
|
+
c(this, N, 0);
|
|
283
|
+
c(this, B, 40);
|
|
284
284
|
/**
|
|
285
285
|
* π― NineTableSheetμμ λ§μ€ν° ν
μ΄λΈμ μ λ¬λ°μ κ° μμλ³ ν
μ΄λΈ μμ± λ° ν
νλ¦Ώ μΆμΆ μΌμν
|
|
286
286
|
*/
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
const r =
|
|
287
|
+
// [RowManager.js μμ λ΄μ© λ°μ·]
|
|
288
|
+
v(this, "initialize", /* @__PURE__ */ a(() => {
|
|
289
|
+
g(this, E, null), e(this, _).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((t) => {
|
|
290
|
+
const s = e(this, T).querySelector(t);
|
|
291
|
+
if (!s) return;
|
|
292
|
+
const n = s.querySelector("table");
|
|
293
|
+
if (!n) return;
|
|
294
|
+
const r = n.querySelector("tbody");
|
|
295
295
|
if (!r) return;
|
|
296
|
-
const l =
|
|
297
|
-
|
|
298
|
-
const c = l.querySelector("tbody");
|
|
299
|
-
if (c) {
|
|
300
|
-
const f = Array.from(c.querySelectorAll("tr")).map((g) => g.cloneNode(!0));
|
|
301
|
-
e(this, I).set(n, f);
|
|
302
|
-
}
|
|
296
|
+
const l = Array.from(r.querySelectorAll("tr")).map((d) => d.cloneNode(!0));
|
|
297
|
+
e(this, _).set(t, l);
|
|
303
298
|
});
|
|
304
|
-
const
|
|
305
|
-
|
|
299
|
+
const i = e(this, T).querySelector(".ng-container-body");
|
|
300
|
+
i && (e(this, ae).call(this, i), e(this, J).call(this));
|
|
306
301
|
}, "initialize"));
|
|
302
|
+
c(this, le, /* @__PURE__ */ a((i, t) => {
|
|
303
|
+
const s = e(this, _).get(t);
|
|
304
|
+
if (!s || s.length === 0) return;
|
|
305
|
+
const n = i.querySelector("tbody");
|
|
306
|
+
if (!n) return;
|
|
307
|
+
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
308
|
+
const r = n.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
309
|
+
for (let l = 0; l < e(this, B); l++)
|
|
310
|
+
s.forEach((d) => {
|
|
311
|
+
o.appendChild(d.cloneNode(!0));
|
|
312
|
+
});
|
|
313
|
+
r ? r.before(o) : n.appendChild(o);
|
|
314
|
+
}, "#renderRows"));
|
|
307
315
|
/**
|
|
308
316
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°κ±°λ μ κ±°νλ λΆν ν¬νΌ
|
|
309
317
|
*/
|
|
310
|
-
|
|
318
|
+
c(this, He, /* @__PURE__ */ a((i, t) => {
|
|
311
319
|
const s = i.cloneNode(!0);
|
|
312
320
|
return t === "left" ? s.querySelectorAll("col, th, td").forEach((n) => {
|
|
313
321
|
n.getAttribute("fixed") !== "left" && n.remove();
|
|
@@ -318,175 +326,161 @@ const Me = class Me {
|
|
|
318
326
|
/**
|
|
319
327
|
* π― ν
νλ¦Ώ TRλ€μ μ΄ λμ΄λ₯Ό μΈ‘μ νκ³ μΊμ±
|
|
320
328
|
*/
|
|
321
|
-
|
|
329
|
+
c(this, ae, /* @__PURE__ */ a((i) => {
|
|
322
330
|
if (e(this, E) !== null && e(this, E) > 0)
|
|
323
331
|
return e(this, E);
|
|
324
|
-
const t = e(this,
|
|
332
|
+
const t = e(this, _).get(".ng-container-body");
|
|
325
333
|
if (!t || t.length === 0) return 24;
|
|
326
334
|
const s = i.querySelector("tbody");
|
|
327
335
|
if (!s) return 24;
|
|
328
336
|
s.querySelectorAll("tr:not(.nodata)").forEach((u) => u.remove());
|
|
329
|
-
const n = s.querySelector("tr.nodata"),
|
|
337
|
+
const n = s.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
330
338
|
t.forEach((u) => {
|
|
331
|
-
|
|
332
|
-
}), n ? n.before(
|
|
333
|
-
const
|
|
334
|
-
(l === "none" || window.getComputedStyle(
|
|
339
|
+
r.appendChild(u.cloneNode(!0));
|
|
340
|
+
}), n ? n.before(r) : s.appendChild(r);
|
|
341
|
+
const o = e(this, T), l = o.style.display, d = o.style.visibility, h = o.style.position;
|
|
342
|
+
(l === "none" || window.getComputedStyle(o).display === "none") && (o.style.display = "block", o.style.visibility = "hidden", o.style.position = "absolute");
|
|
335
343
|
let f = 0;
|
|
336
|
-
const
|
|
337
|
-
return
|
|
344
|
+
const b = s.querySelectorAll("tr:not(.nodata)");
|
|
345
|
+
return b.forEach((u) => {
|
|
338
346
|
f += u.offsetHeight || u.getBoundingClientRect().height;
|
|
339
|
-
}),
|
|
347
|
+
}), b.forEach((u) => u.remove()), o.style.display = l, o.style.visibility = d, o.style.position = h, g(this, E, f > 0 ? f : 24), e(this, G).call(this), F.log(`[RowManager] Height Cached: ${e(this, E)}px | RowCount: ${e(this, B)}`), e(this, E);
|
|
340
348
|
}, "#measureAndCacheHeight"));
|
|
341
|
-
|
|
342
|
-
if (e(this,
|
|
343
|
-
const i = Math.ceil(e(this,
|
|
344
|
-
|
|
349
|
+
c(this, G, /* @__PURE__ */ a(() => {
|
|
350
|
+
if (e(this, N) > 0 && e(this, E) > 0) {
|
|
351
|
+
const i = Math.ceil(e(this, N) / e(this, E));
|
|
352
|
+
g(this, B, i + 20);
|
|
345
353
|
} else
|
|
346
|
-
|
|
354
|
+
g(this, B, 40);
|
|
347
355
|
}, "#updateRowCount"));
|
|
348
356
|
/**
|
|
349
357
|
* π― ResizeObserver μ€μ : μνΈ ν¬κΈ° λ³κ²½ μ ν κ°μ μ¬μ°μ λ° μ¬λ λλ§
|
|
350
358
|
*/
|
|
351
|
-
|
|
352
|
-
!e(this, T) || !(e(this, T) instanceof HTMLElement) || (
|
|
359
|
+
c(this, ce, /* @__PURE__ */ a(() => {
|
|
360
|
+
!e(this, T) || !(e(this, T) instanceof HTMLElement) || (g(this, I, new ResizeObserver((i) => {
|
|
353
361
|
for (const t of i) {
|
|
354
362
|
const s = t.target;
|
|
355
363
|
if (!s.classList.contains("active")) continue;
|
|
356
364
|
const n = t.contentRect.height;
|
|
357
365
|
if (n > 0) {
|
|
358
|
-
let
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
const l = Math.max(n -
|
|
362
|
-
e(this,
|
|
366
|
+
let r = 0;
|
|
367
|
+
const o = s.querySelector("thead");
|
|
368
|
+
o && (r += o.offsetHeight || o.getBoundingClientRect().height);
|
|
369
|
+
const l = Math.max(n - r, 100);
|
|
370
|
+
e(this, N) !== l && (g(this, N, l), e(this, G).call(this), e(this, E) !== null && e(this, J).call(this));
|
|
363
371
|
}
|
|
364
372
|
}
|
|
365
|
-
})), e(this,
|
|
373
|
+
})), e(this, I).observe(e(this, T)));
|
|
366
374
|
}, "#initResizeObserver"));
|
|
367
375
|
/**
|
|
368
376
|
* π― λ°λ λ° μ’μ° κ³ μ 컨ν
μ΄λ μ 체μ κ°κ°μ λ§λ ν
νλ¦Ώ ν λΌλ μ£Όμ
|
|
369
377
|
*/
|
|
370
|
-
|
|
378
|
+
c(this, J, /* @__PURE__ */ a(() => {
|
|
371
379
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
372
380
|
const t = e(this, T).querySelector(i);
|
|
373
|
-
t && t.querySelector("tbody") && e(this,
|
|
381
|
+
t && t.querySelector("tbody") && e(this, le).call(this, t, i);
|
|
374
382
|
});
|
|
375
383
|
}, "#renderAllContainers"));
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if (!s || s.length === 0) return;
|
|
379
|
-
const n = i.querySelector("tbody");
|
|
380
|
-
if (!n) return;
|
|
381
|
-
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
382
|
-
const o = n.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
383
|
-
for (let l = 0; l < e(this, P); l++)
|
|
384
|
-
s.forEach((c) => {
|
|
385
|
-
r.appendChild(c.cloneNode(!0));
|
|
386
|
-
});
|
|
387
|
-
o ? o.before(r) : n.appendChild(r);
|
|
388
|
-
}, "#renderRows"));
|
|
389
|
-
x(this, "destroy", /* @__PURE__ */ a(() => {
|
|
390
|
-
e(this, H) && (e(this, H).disconnect(), b(this, H, null));
|
|
384
|
+
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
385
|
+
e(this, I) && (e(this, I).disconnect(), g(this, I, null));
|
|
391
386
|
}, "destroy"));
|
|
392
|
-
|
|
387
|
+
g(this, T, i), e(this, ce).call(this);
|
|
393
388
|
}
|
|
394
389
|
getRowHeight() {
|
|
395
390
|
return e(this, E);
|
|
396
391
|
}
|
|
397
392
|
templateLength(i = ".ng-container-body") {
|
|
398
393
|
var t;
|
|
399
|
-
return ((t = e(this,
|
|
394
|
+
return ((t = e(this, _).get(i)) == null ? void 0 : t.length) || 1;
|
|
400
395
|
}
|
|
401
396
|
};
|
|
402
|
-
T = new WeakMap(),
|
|
403
|
-
let
|
|
404
|
-
var
|
|
405
|
-
const
|
|
397
|
+
T = new WeakMap(), _ = new WeakMap(), E = new WeakMap(), I = new WeakMap(), N = new WeakMap(), B = new WeakMap(), le = new WeakMap(), He = new WeakMap(), ae = new WeakMap(), G = new WeakMap(), ce = new WeakMap(), J = new WeakMap(), a(Oe, "RowManager");
|
|
398
|
+
let qe = Oe;
|
|
399
|
+
var X, Y, he, de, fe, Q, ue, ge;
|
|
400
|
+
const Z = class Z extends HTMLElement {
|
|
406
401
|
constructor() {
|
|
407
402
|
super();
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
403
|
+
c(this, X, null);
|
|
404
|
+
c(this, Y);
|
|
405
|
+
c(this, he, /* @__PURE__ */ a(() => {
|
|
406
|
+
[
|
|
407
|
+
{ selector: ".ng-container-body", type: null },
|
|
408
|
+
{ selector: ".ng-container-left", type: "left" },
|
|
409
|
+
{ selector: ".ng-container-right", type: "right" }
|
|
410
|
+
].forEach(({ selector: s, type: n }) => {
|
|
411
|
+
const r = this.querySelector(s);
|
|
412
|
+
if (!r) return;
|
|
413
|
+
const o = e(this, fe).call(this, e(this, X), n);
|
|
414
|
+
r.innerHTML = "", r.appendChild(o);
|
|
415
|
+
});
|
|
416
|
+
}, "#renderSplitContainers"));
|
|
417
|
+
c(this, de, /* @__PURE__ */ a(() => {
|
|
418
|
+
["left", "right"].forEach((t) => {
|
|
419
|
+
const s = this.querySelector(`.ng-container-${t}`), n = s == null ? void 0 : s.querySelector("table");
|
|
420
|
+
if (!s || !n) return;
|
|
421
|
+
let r = 0;
|
|
422
|
+
n.querySelectorAll("col").forEach((o) => {
|
|
423
|
+
const l = parseInt(o.getAttribute("width"), 10);
|
|
424
|
+
isNaN(r) || (r += l);
|
|
425
|
+
}), s.style.flex = `0 0 ${r}px`, s.style.width = `${r}px`;
|
|
426
|
+
});
|
|
427
|
+
}, "#updateContainerWidths"));
|
|
428
|
+
v(this, "generate", /* @__PURE__ */ a((t) => {
|
|
411
429
|
if (!t) return;
|
|
412
|
-
|
|
413
|
-
const s = this.querySelector(".ng-container-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
n
|
|
417
|
-
}
|
|
418
|
-
if (s) {
|
|
419
|
-
const r = e(this, U).call(this, e(this, C), "left");
|
|
420
|
-
let l = 0;
|
|
421
|
-
r.querySelectorAll("col").forEach((h) => {
|
|
422
|
-
const f = parseInt(h.getAttribute("width"), 10);
|
|
423
|
-
isNaN(f) || (l += f);
|
|
424
|
-
}), s.innerHTML = "", s.appendChild(r);
|
|
425
|
-
const c = l > 0 ? l : 0;
|
|
426
|
-
s.style.flex = `0 0 ${c}px`, s.style.width = `${c}px`;
|
|
427
|
-
}
|
|
428
|
-
if (o) {
|
|
429
|
-
const r = e(this, U).call(this, e(this, C), "right");
|
|
430
|
-
let l = 0;
|
|
431
|
-
r.querySelectorAll("col").forEach((h) => {
|
|
432
|
-
const f = parseInt(h.getAttribute("width"), 10);
|
|
433
|
-
isNaN(f) || (l += f);
|
|
434
|
-
}), o.innerHTML = "", o.appendChild(r);
|
|
435
|
-
const c = l > 0 ? l : 0;
|
|
436
|
-
o.style.flex = `0 0 ${c}px`, o.style.width = `${c}px`;
|
|
437
|
-
}
|
|
438
|
-
n && n.addEventListener("scroll", () => {
|
|
439
|
-
var r;
|
|
440
|
-
(r = this.querySelector("nine-table-hscrollbar")) == null || r.refresh();
|
|
430
|
+
g(this, X, Ae.compile(t)), e(this, X).style.display = "table", e(this, he).call(this), e(this, Y).initialize(), e(this, de).call(this);
|
|
431
|
+
const s = this.querySelector(".ng-container-body");
|
|
432
|
+
s && s.addEventListener("scroll", () => {
|
|
433
|
+
var n;
|
|
434
|
+
(n = this.querySelector("nine-table-hscrollbar")) == null || n.refresh();
|
|
441
435
|
}), setTimeout(() => {
|
|
442
|
-
var
|
|
443
|
-
e(this,
|
|
436
|
+
var n;
|
|
437
|
+
e(this, Q).call(this), (n = this.querySelector("nine-table-hscrollbar")) == null || n.refresh();
|
|
444
438
|
}, 0);
|
|
445
439
|
}, "generate"));
|
|
446
440
|
/**
|
|
447
441
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
448
442
|
*/
|
|
449
|
-
|
|
443
|
+
c(this, fe, /* @__PURE__ */ a((t, s) => {
|
|
450
444
|
const n = t.cloneNode(!0);
|
|
451
|
-
return s === "left" ? n.querySelectorAll("col, th, td").forEach((
|
|
452
|
-
|
|
453
|
-
}) : s === "right" ? n.querySelectorAll("col, th, td").forEach((
|
|
454
|
-
|
|
455
|
-
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((
|
|
456
|
-
|
|
445
|
+
return s === "left" ? n.querySelectorAll("col, th, td").forEach((r) => {
|
|
446
|
+
r.getAttribute("fixed") !== "left" && r.remove();
|
|
447
|
+
}) : s === "right" ? n.querySelectorAll("col, th, td").forEach((r) => {
|
|
448
|
+
r.getAttribute("fixed") !== "right" && r.remove();
|
|
449
|
+
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((r) => {
|
|
450
|
+
r.remove();
|
|
457
451
|
}), n;
|
|
458
452
|
}, "#createSplitTable"));
|
|
459
|
-
|
|
460
|
-
|
|
453
|
+
v(this, "getRowHeight", /* @__PURE__ */ a(() => e(this, Y).getRowHeight(), "getRowHeight"));
|
|
454
|
+
v(this, "scrollToX", /* @__PURE__ */ a((t) => {
|
|
461
455
|
const s = this.querySelector(".ng-container-body");
|
|
462
456
|
s && (s.scrollLeft = t);
|
|
463
457
|
}, "scrollToX"));
|
|
464
|
-
|
|
458
|
+
v(this, "scrollToY", /* @__PURE__ */ a((t) => {
|
|
465
459
|
const s = this.querySelector(".ng-container-body");
|
|
466
460
|
s && (s.scrollTop = t);
|
|
467
461
|
}, "scrollToY"));
|
|
468
|
-
|
|
469
|
-
var h, f,
|
|
462
|
+
c(this, Q, /* @__PURE__ */ a(() => {
|
|
463
|
+
var h, f, b;
|
|
470
464
|
const t = this.querySelector(".ng-container-left table"), s = this.querySelector(".ng-container-body table"), n = this.querySelector(".ng-container-right table");
|
|
471
465
|
if (!s) return;
|
|
472
|
-
const
|
|
473
|
-
for (let u = 0; u <
|
|
474
|
-
const
|
|
475
|
-
((h =
|
|
476
|
-
((f =
|
|
477
|
-
((
|
|
478
|
-
], w = Math.max(...
|
|
479
|
-
w > 0 && (
|
|
466
|
+
const r = t ? Array.from(t.querySelectorAll("tr")) : [], o = Array.from(s.querySelectorAll("tr")), l = n ? Array.from(n.querySelectorAll("tr")) : [], d = Math.max(r.length, o.length, l.length);
|
|
467
|
+
for (let u = 0; u < d; u++) {
|
|
468
|
+
const x = [
|
|
469
|
+
((h = r[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
470
|
+
((f = o[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
471
|
+
((b = l[u]) == null ? void 0 : b.getBoundingClientRect().height) || 0
|
|
472
|
+
], w = Math.max(...x);
|
|
473
|
+
w > 0 && (r[u] && (r[u].style.height = `${w}px`), o[u] && (o[u].style.height = `${w}px`), l[u] && (l[u].style.height = `${w}px`));
|
|
480
474
|
}
|
|
481
475
|
}, "#syncRowHeights"));
|
|
482
|
-
|
|
483
|
-
e(this,
|
|
476
|
+
c(this, ue, /* @__PURE__ */ a(() => {
|
|
477
|
+
e(this, ge).call(this), new MutationObserver((t) => {
|
|
484
478
|
for (const s of t)
|
|
485
|
-
s.attributeName === "class" && this.classList.contains("active") && e(this,
|
|
479
|
+
s.attributeName === "class" && this.classList.contains("active") && e(this, Q).call(this);
|
|
486
480
|
}).observe(this, { attributes: !0 });
|
|
487
481
|
}, "#init"));
|
|
488
|
-
|
|
489
|
-
const t =
|
|
482
|
+
c(this, ge, /* @__PURE__ */ a(() => {
|
|
483
|
+
const t = Z.SCROLLBAR_SIZE;
|
|
490
484
|
this.innerHTML = `
|
|
491
485
|
<style>
|
|
492
486
|
nine-table-sheet {
|
|
@@ -609,91 +603,91 @@ const F = class F extends HTMLElement {
|
|
|
609
603
|
</div>
|
|
610
604
|
`;
|
|
611
605
|
}, "#render"));
|
|
612
|
-
|
|
606
|
+
g(this, Y, new qe(this));
|
|
613
607
|
}
|
|
614
608
|
connectedCallback() {
|
|
615
|
-
e(this,
|
|
609
|
+
e(this, ue).call(this);
|
|
616
610
|
}
|
|
617
611
|
disconnectedCallback() {
|
|
618
|
-
this.innerHTML = "",
|
|
612
|
+
this.innerHTML = "", F.log("NineTableSheet destroyed.");
|
|
619
613
|
}
|
|
620
614
|
};
|
|
621
|
-
|
|
622
|
-
let
|
|
623
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
624
|
-
var
|
|
625
|
-
const
|
|
615
|
+
X = new WeakMap(), Y = new WeakMap(), he = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), Q = new WeakMap(), ue = new WeakMap(), ge = new WeakMap(), a(Z, "NineTableSheet"), v(Z, "SCROLLBAR_SIZE", 16);
|
|
616
|
+
let se = Z;
|
|
617
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", se);
|
|
618
|
+
var be, ee;
|
|
619
|
+
const We = class We extends HTMLElement {
|
|
626
620
|
constructor() {
|
|
627
621
|
super();
|
|
628
|
-
|
|
622
|
+
c(this, be, /* @__PURE__ */ a(() => {
|
|
629
623
|
var t;
|
|
630
624
|
(t = this.querySelector(".nine-tab-bar")) == null || t.addEventListener("click", (s) => {
|
|
631
|
-
var
|
|
632
|
-
const n = s.ctrlKey || s.metaKey || s.shiftKey,
|
|
633
|
-
e(this,
|
|
634
|
-
}), e(this,
|
|
625
|
+
var o;
|
|
626
|
+
const n = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((o = s.target.closest(".nine-tab-item")) == null ? void 0 : o.dataset.index, 10);
|
|
627
|
+
e(this, ee).call(this, r, n);
|
|
628
|
+
}), e(this, ee).call(this, 0, !1);
|
|
635
629
|
}, "#init"));
|
|
636
|
-
|
|
630
|
+
c(this, ee, /* @__PURE__ */ a((t, s = !1) => {
|
|
637
631
|
const n = /* @__PURE__ */ a(() => {
|
|
638
632
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
639
|
-
Array.from(this.querySelectorAll("nine-splitter")).forEach((
|
|
640
|
-
const u = f.filter((
|
|
641
|
-
u.length < 2 || u.forEach((
|
|
642
|
-
const w = parseInt(
|
|
643
|
-
|
|
633
|
+
Array.from(this.querySelectorAll("nine-splitter")).forEach((x) => x.style.setProperty("display", "none"));
|
|
634
|
+
const u = f.filter((x) => x.classList.contains("active"));
|
|
635
|
+
u.length < 2 || u.forEach((x) => {
|
|
636
|
+
const w = parseInt(x.getAttribute("data-index"), 10), C = this.querySelector(`nine-splitter[data-split-index="${w}"]`), Pe = f[w + 1];
|
|
637
|
+
C && Pe && Pe.classList.contains("active") && C.style.setProperty("display", "flex");
|
|
644
638
|
});
|
|
645
|
-
}, "updateSplitters"),
|
|
639
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), d = o.querySelectorAll("nine-table-sheet");
|
|
646
640
|
if (!l[t]) return;
|
|
647
641
|
if (!s)
|
|
648
|
-
l.forEach((f,
|
|
649
|
-
f.classList.toggle("active",
|
|
650
|
-
}),
|
|
651
|
-
const u =
|
|
642
|
+
l.forEach((f, b) => {
|
|
643
|
+
f.classList.toggle("active", b === t);
|
|
644
|
+
}), d.forEach((f, b) => {
|
|
645
|
+
const u = b === t;
|
|
652
646
|
f.classList.toggle("active", u), f.style.flex = u ? "1 1 100%" : "";
|
|
653
647
|
});
|
|
654
648
|
else {
|
|
655
|
-
const f = l[t],
|
|
656
|
-
if (f.classList.contains("active") &&
|
|
649
|
+
const f = l[t], b = r.querySelectorAll(".nine-tab-item.active");
|
|
650
|
+
if (f.classList.contains("active") && b.length <= 1)
|
|
657
651
|
return;
|
|
658
652
|
f.classList.toggle("active");
|
|
659
|
-
const u =
|
|
653
|
+
const u = o.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
660
654
|
u && (u.classList.toggle("active"), u.classList.contains("active") || (u.style.flex = ""));
|
|
661
655
|
}
|
|
662
|
-
const h =
|
|
656
|
+
const h = o.querySelectorAll("nine-table-sheet.active");
|
|
663
657
|
h == null || h.forEach((f) => {
|
|
664
658
|
f.style.flex = h.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
665
659
|
}), n();
|
|
666
660
|
}, "#switchSheet"));
|
|
667
661
|
}
|
|
668
662
|
connectedCallback() {
|
|
669
|
-
e(this,
|
|
663
|
+
e(this, be).call(this);
|
|
670
664
|
}
|
|
671
665
|
};
|
|
672
|
-
|
|
673
|
-
let
|
|
674
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
675
|
-
var S,
|
|
676
|
-
const
|
|
666
|
+
be = new WeakMap(), ee = new WeakMap(), a(We, "NineTableSheets");
|
|
667
|
+
let Te = We;
|
|
668
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Te);
|
|
669
|
+
var S, ye, te, pe;
|
|
670
|
+
const ze = class ze {
|
|
677
671
|
constructor(i) {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
e(this,
|
|
672
|
+
c(this, S);
|
|
673
|
+
c(this, ye, /* @__PURE__ */ a(() => {
|
|
674
|
+
e(this, pe).call(this), new ResizeObserver((i) => {
|
|
681
675
|
for (let t of i)
|
|
682
|
-
e(this, S).getAttribute("auto-height") === "true" && e(this,
|
|
676
|
+
e(this, S).getAttribute("auto-height") === "true" && e(this, te).call(this);
|
|
683
677
|
}).observe(e(this, S));
|
|
684
678
|
}, "#init"));
|
|
685
|
-
|
|
686
|
-
var
|
|
679
|
+
c(this, te, /* @__PURE__ */ a(() => {
|
|
680
|
+
var d, h;
|
|
687
681
|
const i = Array.from(e(this, S).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
688
682
|
if (i.length === 0) return;
|
|
689
|
-
const t = parseInt(e(this, S).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), n = (
|
|
683
|
+
const t = parseInt(e(this, S).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), n = (d = e(this, S).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : d.getBoundingClientRect().height, r = (h = e(this, S).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : h.getBoundingClientRect().height, o = se.SCROLLBAR_SIZE, l = t * s + n + r + o;
|
|
690
684
|
e(this, S).style.height = `${l}px`;
|
|
691
685
|
}, "#applyAutoHeight"));
|
|
692
|
-
|
|
693
|
-
const t = Array.from(e(this, S).children).filter((
|
|
694
|
-
const
|
|
695
|
-
return
|
|
696
|
-
}).join(""),
|
|
686
|
+
c(this, pe, /* @__PURE__ */ a(() => {
|
|
687
|
+
const t = Array.from(e(this, S).children).filter((d) => d.tagName === "TABLE"), s = e(this, S).getAttribute("auto-height") === "true", n = t.length, r = t.map((d, h) => {
|
|
688
|
+
const b = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, u = h < n - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
689
|
+
return b + u;
|
|
690
|
+
}).join(""), o = t.map((d, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
697
691
|
e(this, S).shadowRoot.innerHTML = `
|
|
698
692
|
<style>
|
|
699
693
|
:host {
|
|
@@ -783,9 +777,9 @@ const We = class We {
|
|
|
783
777
|
<nine-table-body>
|
|
784
778
|
<nine-table-summary></nine-table-summary>
|
|
785
779
|
<nine-table-sheets>
|
|
786
|
-
<nine-table-sheets-body>${
|
|
780
|
+
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
787
781
|
<nine-table-sheets-footer>
|
|
788
|
-
<div class="nine-tab-bar">${
|
|
782
|
+
<div class="nine-tab-bar">${o}</div>
|
|
789
783
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
790
784
|
</nine-table-sheets-footer>
|
|
791
785
|
</nine-table-sheets>
|
|
@@ -794,168 +788,168 @@ const We = class We {
|
|
|
794
788
|
<nine-table-footer></nine-table-footer>
|
|
795
789
|
`;
|
|
796
790
|
const l = e(this, S).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
797
|
-
l == null || l.forEach((
|
|
791
|
+
l == null || l.forEach((d, h) => {
|
|
798
792
|
t[h] && setTimeout(() => {
|
|
799
|
-
|
|
793
|
+
d.generate(t[h]), s && e(this, te).call(this);
|
|
800
794
|
});
|
|
801
795
|
});
|
|
802
796
|
}, "#render"));
|
|
803
|
-
|
|
797
|
+
g(this, S, i), e(this, ye).call(this);
|
|
804
798
|
}
|
|
805
799
|
};
|
|
806
|
-
S = new WeakMap(),
|
|
807
|
-
let
|
|
808
|
-
var
|
|
809
|
-
const
|
|
800
|
+
S = new WeakMap(), ye = new WeakMap(), te = new WeakMap(), pe = new WeakMap(), a(ze, "LayoutManager");
|
|
801
|
+
let ke = ze;
|
|
802
|
+
var H, P;
|
|
803
|
+
const De = class De {
|
|
810
804
|
constructor(i) {
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
805
|
+
c(this, H);
|
|
806
|
+
c(this, P, -1);
|
|
807
|
+
v(this, "count", /* @__PURE__ */ a(() => e(this, H).rawRecords.length, "count"));
|
|
808
|
+
g(this, H, i);
|
|
815
809
|
}
|
|
816
810
|
get at() {
|
|
817
|
-
return e(this,
|
|
811
|
+
return e(this, P);
|
|
818
812
|
}
|
|
819
813
|
set at(i) {
|
|
820
814
|
var s, n;
|
|
821
|
-
|
|
822
|
-
const t = ((n = (s = e(this,
|
|
823
|
-
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this,
|
|
824
|
-
var
|
|
825
|
-
(
|
|
815
|
+
g(this, P, parseInt(i, 10));
|
|
816
|
+
const t = ((n = (s = e(this, H).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || e(this, H).owner.body;
|
|
817
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, P)}"]`) && setTimeout(() => {
|
|
818
|
+
var r, o;
|
|
819
|
+
(o = (r = e(this, H).owner).scrollTo_V1) == null || o.call(r, e(this, P));
|
|
826
820
|
});
|
|
827
821
|
}
|
|
828
822
|
};
|
|
829
|
-
|
|
830
|
-
let
|
|
831
|
-
var R, m, A,
|
|
823
|
+
H = new WeakMap(), P = new WeakMap(), a(De, "ngRow");
|
|
824
|
+
let Le = De;
|
|
825
|
+
var R, m, A, U, me, M, we, ie, ve, xe, K;
|
|
832
826
|
const q = class q {
|
|
833
827
|
constructor(i, t) {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
828
|
+
c(this, R);
|
|
829
|
+
c(this, m);
|
|
830
|
+
c(this, A, []);
|
|
831
|
+
c(this, U, []);
|
|
832
|
+
c(this, me, 0);
|
|
833
|
+
c(this, M, []);
|
|
834
|
+
c(this, we, /* @__PURE__ */ a(() => {
|
|
835
|
+
g(this, M, []);
|
|
842
836
|
const i = e(this, R).template || [];
|
|
843
837
|
Array.from(i).forEach((t) => {
|
|
844
838
|
var s;
|
|
845
|
-
e(this,
|
|
839
|
+
e(this, M).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
846
840
|
}), (e(this, m).rawRecords || []).forEach((t) => {
|
|
847
|
-
t.__ng || (t.__ng = e(this,
|
|
841
|
+
t.__ng || (t.__ng = e(this, ie).call(this)), t.__ng.height = e(this, M).slice();
|
|
848
842
|
});
|
|
849
843
|
}, "#initialize"));
|
|
850
|
-
|
|
844
|
+
v(this, "set", /* @__PURE__ */ a((i) => {
|
|
851
845
|
this.clear(), this.add(i, !1);
|
|
852
846
|
}, "set"));
|
|
853
|
-
|
|
847
|
+
c(this, ie, /* @__PURE__ */ a(() => ({
|
|
854
848
|
rowState: q.ROW_STATE.EMPTY,
|
|
855
849
|
deleted: !1,
|
|
856
850
|
filtered: !1,
|
|
857
|
-
height: e(this,
|
|
851
|
+
height: e(this, M).slice(),
|
|
858
852
|
o: {},
|
|
859
853
|
c: {},
|
|
860
|
-
_: [0, 0, 0, 0, q.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this,
|
|
854
|
+
_: [0, 0, 0, 0, q.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, M).slice(), -1, {}, {}]
|
|
861
855
|
}), "#getDefaultMeta"));
|
|
862
|
-
|
|
863
|
-
|
|
856
|
+
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
857
|
+
g(this, A, []), g(this, U, []);
|
|
864
858
|
}, "reset"));
|
|
865
|
-
|
|
859
|
+
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
866
860
|
var i;
|
|
867
|
-
e(this, m).rawRecords = [],
|
|
861
|
+
e(this, m).rawRecords = [], g(this, A, []), g(this, U, []), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
868
862
|
}, "clear"));
|
|
869
|
-
|
|
863
|
+
c(this, ve, /* @__PURE__ */ a((i) => {
|
|
870
864
|
var n;
|
|
871
865
|
Array.isArray(i) || (i = [i]);
|
|
872
866
|
const t = typeof ((n = e(this, R).fields) == null ? void 0 : n.get) == "function" ? e(this, R).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
873
|
-
return i.forEach((
|
|
874
|
-
const
|
|
867
|
+
return i.forEach((r) => {
|
|
868
|
+
const o = { v: [] };
|
|
875
869
|
t.forEach((l) => {
|
|
876
|
-
|
|
877
|
-
}), s.push(
|
|
870
|
+
o.v.push(r[l] !== void 0 && r[l] !== null ? r[l] : "");
|
|
871
|
+
}), s.push(o);
|
|
878
872
|
}), s;
|
|
879
873
|
}, "#json2Array"));
|
|
880
|
-
|
|
881
|
-
t.__ng = e(this,
|
|
874
|
+
c(this, xe, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
875
|
+
t.__ng = e(this, ie).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = q.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
882
876
|
}), i), "#defaultInsert"));
|
|
883
|
-
|
|
884
|
-
var
|
|
877
|
+
v(this, "add", /* @__PURE__ */ a((i, t = !0) => {
|
|
878
|
+
var r;
|
|
885
879
|
i === void 0 && (i = {});
|
|
886
|
-
const s = e(this,
|
|
880
|
+
const s = e(this, ve).call(this, i);
|
|
887
881
|
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, xe).call(this, s)), this.resetRecords();
|
|
888
882
|
const n = this.count() - 1;
|
|
889
|
-
return t || s.forEach((
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
}), (
|
|
883
|
+
return t || s.forEach((o, l) => {
|
|
884
|
+
const d = e(this, m).rawRecords[n - l];
|
|
885
|
+
d && (d.__ng.rowState = q.ROW_STATE.EMPTY);
|
|
886
|
+
}), (r = e(this, m).viewRecords) != null && r.reset && e(this, m).viewRecords.reset(), n;
|
|
893
887
|
}, "add"));
|
|
894
|
-
|
|
888
|
+
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
895
889
|
var s;
|
|
896
890
|
let t = [];
|
|
897
|
-
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, m).owner.row.at] : t = [parseInt(i, 10)], t.sort((n,
|
|
891
|
+
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, m).owner.row.at] : t = [parseInt(i, 10)], t.sort((n, r) => r - n).forEach((n) => {
|
|
898
892
|
if (e(this, A)[n]) {
|
|
899
|
-
const
|
|
900
|
-
e(this, A)[n].__ng.rowState === q.ROW_STATE.INSERT ? e(this, m).rawRecords = e(this, m).rawRecords.filter((
|
|
901
|
-
|
|
893
|
+
const r = e(this, A)[n].__ng.rowid;
|
|
894
|
+
e(this, A)[n].__ng.rowState === q.ROW_STATE.INSERT ? e(this, m).rawRecords = e(this, m).rawRecords.filter((o) => o.__ng.rowid !== r) : e(this, m).rawRecords.forEach((o) => {
|
|
895
|
+
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState = q.ROW_STATE.DELETE);
|
|
902
896
|
});
|
|
903
897
|
}
|
|
904
898
|
}), this.resetRecords(), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
905
899
|
}, "delete"));
|
|
906
|
-
|
|
907
|
-
var
|
|
900
|
+
v(this, "setValue", /* @__PURE__ */ a((i, t, s) => {
|
|
901
|
+
var d;
|
|
908
902
|
i = parseInt(i, 10);
|
|
909
|
-
const
|
|
910
|
-
if (
|
|
911
|
-
const
|
|
912
|
-
if (!
|
|
913
|
-
const l =
|
|
914
|
-
l !== s &&
|
|
903
|
+
const r = (typeof ((d = e(this, R).fields) == null ? void 0 : d.get) == "function" ? e(this, R).fields.get() : []).indexOf(t);
|
|
904
|
+
if (r < 0) return;
|
|
905
|
+
const o = this.getValidData()[i];
|
|
906
|
+
if (!o) return;
|
|
907
|
+
const l = o.v[r];
|
|
908
|
+
l !== s && o.__ng.rowState !== q.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(t) || (o.__ng.o[t] = l), o.__ng.rowState = q.ROW_STATE.UPDATE), o.v[r] = s, e(this, m).owner.refreshData && e(this, m).owner.refreshData(i);
|
|
915
909
|
}, "setValue"));
|
|
916
|
-
|
|
917
|
-
|
|
910
|
+
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
911
|
+
g(this, U, e(this, m).rawRecords.filter((i) => !i.__ng.deleted)), g(this, A, e(this, m).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, m).rawRecords.forEach((i, t) => {
|
|
918
912
|
i.__ng.rowidx = t;
|
|
919
913
|
}), e(this, A).forEach((i, t) => {
|
|
920
914
|
i.__ng.i = t;
|
|
921
915
|
});
|
|
922
916
|
}, "resetRecords"));
|
|
923
|
-
|
|
924
|
-
|
|
917
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (e(this, A).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, A)), "getValidData"));
|
|
918
|
+
c(this, K, /* @__PURE__ */ a((i) => {
|
|
925
919
|
var s;
|
|
926
920
|
if (!i) return i;
|
|
927
921
|
const t = typeof ((s = e(this, R).fields) == null ? void 0 : s.get) == "function" ? e(this, R).fields.get() : [];
|
|
928
922
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
929
|
-
const
|
|
930
|
-
return t.forEach((
|
|
931
|
-
o
|
|
932
|
-
}),
|
|
923
|
+
const r = {};
|
|
924
|
+
return t.forEach((o, l) => {
|
|
925
|
+
r[o] = n.v ? n.v[l] : n[o];
|
|
926
|
+
}), r.__ng = n.__ng, r;
|
|
933
927
|
}) : i;
|
|
934
928
|
}, "#conv2"));
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
var
|
|
929
|
+
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
930
|
+
v(this, "get", /* @__PURE__ */ a((i, t) => {
|
|
931
|
+
var r;
|
|
938
932
|
const s = this.getValidData();
|
|
939
933
|
if (!s || s.length <= 0) return;
|
|
940
|
-
if (i == null) return e(this,
|
|
934
|
+
if (i == null) return e(this, K).call(this, s);
|
|
941
935
|
if (i < 0 || i >= s.length) return null;
|
|
942
|
-
const n = typeof ((
|
|
936
|
+
const n = typeof ((r = e(this, R).fields) == null ? void 0 : r.get) == "function" ? e(this, R).fields.get() : [];
|
|
943
937
|
if (t != null) {
|
|
944
|
-
const
|
|
945
|
-
return
|
|
938
|
+
const o = n.indexOf(t);
|
|
939
|
+
return o >= 0 ? s[i].v[o] : null;
|
|
946
940
|
}
|
|
947
|
-
return e(this,
|
|
941
|
+
return e(this, K).call(this, s[i]);
|
|
948
942
|
}, "get"));
|
|
949
|
-
|
|
943
|
+
g(this, R, i), g(this, m, t), e(this, we).call(this);
|
|
950
944
|
}
|
|
951
945
|
get source() {
|
|
952
|
-
return e(this,
|
|
946
|
+
return e(this, K).call(this, e(this, m).rawRecords);
|
|
953
947
|
}
|
|
954
948
|
set source(i) {
|
|
955
949
|
this.clear(), this.add(i, !1);
|
|
956
950
|
}
|
|
957
951
|
get nextId() {
|
|
958
|
-
return ++
|
|
952
|
+
return ++Ue(this, me)._;
|
|
959
953
|
}
|
|
960
954
|
get length() {
|
|
961
955
|
return e(this, A).length;
|
|
@@ -964,27 +958,27 @@ const q = class q {
|
|
|
964
958
|
return this.length;
|
|
965
959
|
}
|
|
966
960
|
};
|
|
967
|
-
R = new WeakMap(), m = new WeakMap(), A = new WeakMap(),
|
|
968
|
-
|
|
961
|
+
R = new WeakMap(), m = new WeakMap(), A = new WeakMap(), U = new WeakMap(), me = new WeakMap(), M = new WeakMap(), we = new WeakMap(), ie = new WeakMap(), ve = new WeakMap(), xe = new WeakMap(), K = new WeakMap(), a(q, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
962
|
+
v(q, "ROW_STATE", {
|
|
969
963
|
EMPTY: "EMPTY",
|
|
970
964
|
NORMAL: "NORMAL",
|
|
971
965
|
INSERT: "INSERT",
|
|
972
966
|
UPDATE: "UPDATE",
|
|
973
967
|
DELETE: "DELETE"
|
|
974
968
|
});
|
|
975
|
-
let
|
|
976
|
-
const
|
|
969
|
+
let Ce = q;
|
|
970
|
+
const Ne = class Ne {
|
|
977
971
|
constructor(i) {
|
|
978
|
-
this.owner = i, this.row = new
|
|
972
|
+
this.owner = i, this.row = new Le(this), this.data = new Ce(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
979
973
|
var t;
|
|
980
974
|
(t = this.owner.view) != null && t.redraw && this.owner.view.redraw();
|
|
981
975
|
}, this.setDataSource = (t) => {
|
|
982
976
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(t || []);
|
|
983
977
|
}, this.getRowState = (t) => {
|
|
984
|
-
var n,
|
|
978
|
+
var n, r;
|
|
985
979
|
const s = parseInt(t, 10);
|
|
986
980
|
if (!(s >= this.data.count()))
|
|
987
|
-
return (
|
|
981
|
+
return (r = (n = this.data.getValidData()[s]) == null ? void 0 : n.__ng) == null ? void 0 : r.rowState;
|
|
988
982
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (t) => {
|
|
989
983
|
this.row.at = t;
|
|
990
984
|
}, this.scrollTo_V1 = (t) => (t < 0 && (t = 0), t >= this.rawRecords.length && (t = this.rawRecords.length - 1), this.viewRecords.rawIndex = t, this.viewRecords.reset && this.viewRecords.reset(), !(t <= 0 || t >= this.rawRecords.length - 1)), this.getColumn = (t, s) => this.data.get(t, s), this.setColumn = (t, s, n) => {
|
|
@@ -992,37 +986,37 @@ const ze = class ze {
|
|
|
992
986
|
}, this.setDataSource([]);
|
|
993
987
|
}
|
|
994
988
|
};
|
|
995
|
-
a(
|
|
996
|
-
let
|
|
997
|
-
var
|
|
998
|
-
const
|
|
989
|
+
a(Ne, "ngDataManager");
|
|
990
|
+
let _e = Ne;
|
|
991
|
+
var V, Se;
|
|
992
|
+
const Be = class Be extends HTMLElement {
|
|
999
993
|
constructor() {
|
|
1000
994
|
super();
|
|
1001
995
|
//#created = false;
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
this.attachShadow({ mode: "open" }),
|
|
996
|
+
c(this, V);
|
|
997
|
+
c(this, Se);
|
|
998
|
+
this.attachShadow({ mode: "open" }), g(this, V, new _e(this));
|
|
1005
999
|
}
|
|
1006
1000
|
connectedCallback() {
|
|
1007
|
-
|
|
1001
|
+
g(this, Se, new ke(this)), F.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1008
1002
|
}
|
|
1009
1003
|
disconnectedCallback() {
|
|
1010
|
-
|
|
1004
|
+
F.log("NineTable disconnected.");
|
|
1011
1005
|
}
|
|
1012
1006
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1013
1007
|
get data() {
|
|
1014
|
-
return e(this,
|
|
1008
|
+
return e(this, V).data;
|
|
1015
1009
|
}
|
|
1016
1010
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
1017
1011
|
get row() {
|
|
1018
|
-
return e(this,
|
|
1012
|
+
return e(this, V).row;
|
|
1019
1013
|
}
|
|
1020
1014
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
1021
1015
|
get dataManager() {
|
|
1022
|
-
return e(this,
|
|
1016
|
+
return e(this, V);
|
|
1023
1017
|
}
|
|
1024
1018
|
};
|
|
1025
|
-
|
|
1026
|
-
let
|
|
1027
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
1019
|
+
V = new WeakMap(), Se = new WeakMap(), a(Be, "NineTable");
|
|
1020
|
+
let Ie = Be;
|
|
1021
|
+
customElements.get("nine-table") || customElements.define("nine-table", Ie);
|
|
1028
1022
|
//# sourceMappingURL=nine-table.js.map
|