@ninebone/table 0.0.278 β 0.0.279
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 +373 -382
- 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,158 @@ 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
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}),
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}
|
|
438
|
-
n && n.addEventListener("scroll", () => {
|
|
439
|
-
var r;
|
|
440
|
-
(r = this.querySelector("nine-table-hscrollbar")) == null || r.refresh();
|
|
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) => {
|
|
429
|
+
t && (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), bodyContainer && bodyContainer.addEventListener("scroll", () => {
|
|
430
|
+
var s;
|
|
431
|
+
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
441
432
|
}), setTimeout(() => {
|
|
442
|
-
var
|
|
443
|
-
e(this,
|
|
444
|
-
}, 0);
|
|
433
|
+
var s;
|
|
434
|
+
e(this, Q).call(this), (s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
435
|
+
}, 0));
|
|
445
436
|
}, "generate"));
|
|
446
437
|
/**
|
|
447
438
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
448
439
|
*/
|
|
449
|
-
|
|
440
|
+
c(this, fe, /* @__PURE__ */ a((t, s) => {
|
|
450
441
|
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
|
-
|
|
442
|
+
return s === "left" ? n.querySelectorAll("col, th, td").forEach((r) => {
|
|
443
|
+
r.getAttribute("fixed") !== "left" && r.remove();
|
|
444
|
+
}) : s === "right" ? n.querySelectorAll("col, th, td").forEach((r) => {
|
|
445
|
+
r.getAttribute("fixed") !== "right" && r.remove();
|
|
446
|
+
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((r) => {
|
|
447
|
+
r.remove();
|
|
457
448
|
}), n;
|
|
458
449
|
}, "#createSplitTable"));
|
|
459
|
-
|
|
460
|
-
|
|
450
|
+
v(this, "getRowHeight", /* @__PURE__ */ a(() => e(this, Y).getRowHeight(), "getRowHeight"));
|
|
451
|
+
v(this, "scrollToX", /* @__PURE__ */ a((t) => {
|
|
461
452
|
const s = this.querySelector(".ng-container-body");
|
|
462
453
|
s && (s.scrollLeft = t);
|
|
463
454
|
}, "scrollToX"));
|
|
464
|
-
|
|
455
|
+
v(this, "scrollToY", /* @__PURE__ */ a((t) => {
|
|
465
456
|
const s = this.querySelector(".ng-container-body");
|
|
466
457
|
s && (s.scrollTop = t);
|
|
467
458
|
}, "scrollToY"));
|
|
468
|
-
|
|
469
|
-
var h, f,
|
|
459
|
+
c(this, Q, /* @__PURE__ */ a(() => {
|
|
460
|
+
var h, f, b;
|
|
470
461
|
const t = this.querySelector(".ng-container-left table"), s = this.querySelector(".ng-container-body table"), n = this.querySelector(".ng-container-right table");
|
|
471
462
|
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 && (
|
|
463
|
+
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);
|
|
464
|
+
for (let u = 0; u < d; u++) {
|
|
465
|
+
const x = [
|
|
466
|
+
((h = r[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
467
|
+
((f = o[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
468
|
+
((b = l[u]) == null ? void 0 : b.getBoundingClientRect().height) || 0
|
|
469
|
+
], w = Math.max(...x);
|
|
470
|
+
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
471
|
}
|
|
481
472
|
}, "#syncRowHeights"));
|
|
482
|
-
|
|
483
|
-
e(this,
|
|
473
|
+
c(this, ue, /* @__PURE__ */ a(() => {
|
|
474
|
+
e(this, ge).call(this), new MutationObserver((t) => {
|
|
484
475
|
for (const s of t)
|
|
485
|
-
s.attributeName === "class" && this.classList.contains("active") && e(this,
|
|
476
|
+
s.attributeName === "class" && this.classList.contains("active") && e(this, Q).call(this);
|
|
486
477
|
}).observe(this, { attributes: !0 });
|
|
487
478
|
}, "#init"));
|
|
488
|
-
|
|
489
|
-
const t =
|
|
479
|
+
c(this, ge, /* @__PURE__ */ a(() => {
|
|
480
|
+
const t = Z.SCROLLBAR_SIZE;
|
|
490
481
|
this.innerHTML = `
|
|
491
482
|
<style>
|
|
492
483
|
nine-table-sheet {
|
|
@@ -609,91 +600,91 @@ const F = class F extends HTMLElement {
|
|
|
609
600
|
</div>
|
|
610
601
|
`;
|
|
611
602
|
}, "#render"));
|
|
612
|
-
|
|
603
|
+
g(this, Y, new qe(this));
|
|
613
604
|
}
|
|
614
605
|
connectedCallback() {
|
|
615
|
-
e(this,
|
|
606
|
+
e(this, ue).call(this);
|
|
616
607
|
}
|
|
617
608
|
disconnectedCallback() {
|
|
618
|
-
this.innerHTML = "",
|
|
609
|
+
this.innerHTML = "", F.log("NineTableSheet destroyed.");
|
|
619
610
|
}
|
|
620
611
|
};
|
|
621
|
-
|
|
622
|
-
let
|
|
623
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
624
|
-
var
|
|
625
|
-
const
|
|
612
|
+
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);
|
|
613
|
+
let se = Z;
|
|
614
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", se);
|
|
615
|
+
var be, ee;
|
|
616
|
+
const We = class We extends HTMLElement {
|
|
626
617
|
constructor() {
|
|
627
618
|
super();
|
|
628
|
-
|
|
619
|
+
c(this, be, /* @__PURE__ */ a(() => {
|
|
629
620
|
var t;
|
|
630
621
|
(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,
|
|
622
|
+
var o;
|
|
623
|
+
const n = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((o = s.target.closest(".nine-tab-item")) == null ? void 0 : o.dataset.index, 10);
|
|
624
|
+
e(this, ee).call(this, r, n);
|
|
625
|
+
}), e(this, ee).call(this, 0, !1);
|
|
635
626
|
}, "#init"));
|
|
636
|
-
|
|
627
|
+
c(this, ee, /* @__PURE__ */ a((t, s = !1) => {
|
|
637
628
|
const n = /* @__PURE__ */ a(() => {
|
|
638
629
|
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
|
-
|
|
630
|
+
Array.from(this.querySelectorAll("nine-splitter")).forEach((x) => x.style.setProperty("display", "none"));
|
|
631
|
+
const u = f.filter((x) => x.classList.contains("active"));
|
|
632
|
+
u.length < 2 || u.forEach((x) => {
|
|
633
|
+
const w = parseInt(x.getAttribute("data-index"), 10), C = this.querySelector(`nine-splitter[data-split-index="${w}"]`), Pe = f[w + 1];
|
|
634
|
+
C && Pe && Pe.classList.contains("active") && C.style.setProperty("display", "flex");
|
|
644
635
|
});
|
|
645
|
-
}, "updateSplitters"),
|
|
636
|
+
}, "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
637
|
if (!l[t]) return;
|
|
647
638
|
if (!s)
|
|
648
|
-
l.forEach((f,
|
|
649
|
-
f.classList.toggle("active",
|
|
650
|
-
}),
|
|
651
|
-
const u =
|
|
639
|
+
l.forEach((f, b) => {
|
|
640
|
+
f.classList.toggle("active", b === t);
|
|
641
|
+
}), d.forEach((f, b) => {
|
|
642
|
+
const u = b === t;
|
|
652
643
|
f.classList.toggle("active", u), f.style.flex = u ? "1 1 100%" : "";
|
|
653
644
|
});
|
|
654
645
|
else {
|
|
655
|
-
const f = l[t],
|
|
656
|
-
if (f.classList.contains("active") &&
|
|
646
|
+
const f = l[t], b = r.querySelectorAll(".nine-tab-item.active");
|
|
647
|
+
if (f.classList.contains("active") && b.length <= 1)
|
|
657
648
|
return;
|
|
658
649
|
f.classList.toggle("active");
|
|
659
|
-
const u =
|
|
650
|
+
const u = o.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
660
651
|
u && (u.classList.toggle("active"), u.classList.contains("active") || (u.style.flex = ""));
|
|
661
652
|
}
|
|
662
|
-
const h =
|
|
653
|
+
const h = o.querySelectorAll("nine-table-sheet.active");
|
|
663
654
|
h == null || h.forEach((f) => {
|
|
664
655
|
f.style.flex = h.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
665
656
|
}), n();
|
|
666
657
|
}, "#switchSheet"));
|
|
667
658
|
}
|
|
668
659
|
connectedCallback() {
|
|
669
|
-
e(this,
|
|
660
|
+
e(this, be).call(this);
|
|
670
661
|
}
|
|
671
662
|
};
|
|
672
|
-
|
|
673
|
-
let
|
|
674
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
675
|
-
var S,
|
|
676
|
-
const
|
|
663
|
+
be = new WeakMap(), ee = new WeakMap(), a(We, "NineTableSheets");
|
|
664
|
+
let Te = We;
|
|
665
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Te);
|
|
666
|
+
var S, ye, te, pe;
|
|
667
|
+
const ze = class ze {
|
|
677
668
|
constructor(i) {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
e(this,
|
|
669
|
+
c(this, S);
|
|
670
|
+
c(this, ye, /* @__PURE__ */ a(() => {
|
|
671
|
+
e(this, pe).call(this), new ResizeObserver((i) => {
|
|
681
672
|
for (let t of i)
|
|
682
|
-
e(this, S).getAttribute("auto-height") === "true" && e(this,
|
|
673
|
+
e(this, S).getAttribute("auto-height") === "true" && e(this, te).call(this);
|
|
683
674
|
}).observe(e(this, S));
|
|
684
675
|
}, "#init"));
|
|
685
|
-
|
|
686
|
-
var
|
|
676
|
+
c(this, te, /* @__PURE__ */ a(() => {
|
|
677
|
+
var d, h;
|
|
687
678
|
const i = Array.from(e(this, S).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
688
679
|
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 = (
|
|
680
|
+
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
681
|
e(this, S).style.height = `${l}px`;
|
|
691
682
|
}, "#applyAutoHeight"));
|
|
692
|
-
|
|
693
|
-
const t = Array.from(e(this, S).children).filter((
|
|
694
|
-
const
|
|
695
|
-
return
|
|
696
|
-
}).join(""),
|
|
683
|
+
c(this, pe, /* @__PURE__ */ a(() => {
|
|
684
|
+
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) => {
|
|
685
|
+
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>` : "";
|
|
686
|
+
return b + u;
|
|
687
|
+
}).join(""), o = t.map((d, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
697
688
|
e(this, S).shadowRoot.innerHTML = `
|
|
698
689
|
<style>
|
|
699
690
|
:host {
|
|
@@ -783,9 +774,9 @@ const We = class We {
|
|
|
783
774
|
<nine-table-body>
|
|
784
775
|
<nine-table-summary></nine-table-summary>
|
|
785
776
|
<nine-table-sheets>
|
|
786
|
-
<nine-table-sheets-body>${
|
|
777
|
+
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
787
778
|
<nine-table-sheets-footer>
|
|
788
|
-
<div class="nine-tab-bar">${
|
|
779
|
+
<div class="nine-tab-bar">${o}</div>
|
|
789
780
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
790
781
|
</nine-table-sheets-footer>
|
|
791
782
|
</nine-table-sheets>
|
|
@@ -794,168 +785,168 @@ const We = class We {
|
|
|
794
785
|
<nine-table-footer></nine-table-footer>
|
|
795
786
|
`;
|
|
796
787
|
const l = e(this, S).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
797
|
-
l == null || l.forEach((
|
|
788
|
+
l == null || l.forEach((d, h) => {
|
|
798
789
|
t[h] && setTimeout(() => {
|
|
799
|
-
|
|
790
|
+
d.generate(t[h]), s && e(this, te).call(this);
|
|
800
791
|
});
|
|
801
792
|
});
|
|
802
793
|
}, "#render"));
|
|
803
|
-
|
|
794
|
+
g(this, S, i), e(this, ye).call(this);
|
|
804
795
|
}
|
|
805
796
|
};
|
|
806
|
-
S = new WeakMap(),
|
|
807
|
-
let
|
|
808
|
-
var
|
|
809
|
-
const
|
|
797
|
+
S = new WeakMap(), ye = new WeakMap(), te = new WeakMap(), pe = new WeakMap(), a(ze, "LayoutManager");
|
|
798
|
+
let ke = ze;
|
|
799
|
+
var H, P;
|
|
800
|
+
const De = class De {
|
|
810
801
|
constructor(i) {
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
802
|
+
c(this, H);
|
|
803
|
+
c(this, P, -1);
|
|
804
|
+
v(this, "count", /* @__PURE__ */ a(() => e(this, H).rawRecords.length, "count"));
|
|
805
|
+
g(this, H, i);
|
|
815
806
|
}
|
|
816
807
|
get at() {
|
|
817
|
-
return e(this,
|
|
808
|
+
return e(this, P);
|
|
818
809
|
}
|
|
819
810
|
set at(i) {
|
|
820
811
|
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
|
-
(
|
|
812
|
+
g(this, P, parseInt(i, 10));
|
|
813
|
+
const t = ((n = (s = e(this, H).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || e(this, H).owner.body;
|
|
814
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, P)}"]`) && setTimeout(() => {
|
|
815
|
+
var r, o;
|
|
816
|
+
(o = (r = e(this, H).owner).scrollTo_V1) == null || o.call(r, e(this, P));
|
|
826
817
|
});
|
|
827
818
|
}
|
|
828
819
|
};
|
|
829
|
-
|
|
830
|
-
let
|
|
831
|
-
var R, m, A,
|
|
820
|
+
H = new WeakMap(), P = new WeakMap(), a(De, "ngRow");
|
|
821
|
+
let Le = De;
|
|
822
|
+
var R, m, A, U, me, M, we, ie, ve, xe, K;
|
|
832
823
|
const q = class q {
|
|
833
824
|
constructor(i, t) {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
825
|
+
c(this, R);
|
|
826
|
+
c(this, m);
|
|
827
|
+
c(this, A, []);
|
|
828
|
+
c(this, U, []);
|
|
829
|
+
c(this, me, 0);
|
|
830
|
+
c(this, M, []);
|
|
831
|
+
c(this, we, /* @__PURE__ */ a(() => {
|
|
832
|
+
g(this, M, []);
|
|
842
833
|
const i = e(this, R).template || [];
|
|
843
834
|
Array.from(i).forEach((t) => {
|
|
844
835
|
var s;
|
|
845
|
-
e(this,
|
|
836
|
+
e(this, M).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
846
837
|
}), (e(this, m).rawRecords || []).forEach((t) => {
|
|
847
|
-
t.__ng || (t.__ng = e(this,
|
|
838
|
+
t.__ng || (t.__ng = e(this, ie).call(this)), t.__ng.height = e(this, M).slice();
|
|
848
839
|
});
|
|
849
840
|
}, "#initialize"));
|
|
850
|
-
|
|
841
|
+
v(this, "set", /* @__PURE__ */ a((i) => {
|
|
851
842
|
this.clear(), this.add(i, !1);
|
|
852
843
|
}, "set"));
|
|
853
|
-
|
|
844
|
+
c(this, ie, /* @__PURE__ */ a(() => ({
|
|
854
845
|
rowState: q.ROW_STATE.EMPTY,
|
|
855
846
|
deleted: !1,
|
|
856
847
|
filtered: !1,
|
|
857
|
-
height: e(this,
|
|
848
|
+
height: e(this, M).slice(),
|
|
858
849
|
o: {},
|
|
859
850
|
c: {},
|
|
860
|
-
_: [0, 0, 0, 0, q.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this,
|
|
851
|
+
_: [0, 0, 0, 0, q.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, M).slice(), -1, {}, {}]
|
|
861
852
|
}), "#getDefaultMeta"));
|
|
862
|
-
|
|
863
|
-
|
|
853
|
+
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
854
|
+
g(this, A, []), g(this, U, []);
|
|
864
855
|
}, "reset"));
|
|
865
|
-
|
|
856
|
+
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
866
857
|
var i;
|
|
867
|
-
e(this, m).rawRecords = [],
|
|
858
|
+
e(this, m).rawRecords = [], g(this, A, []), g(this, U, []), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
868
859
|
}, "clear"));
|
|
869
|
-
|
|
860
|
+
c(this, ve, /* @__PURE__ */ a((i) => {
|
|
870
861
|
var n;
|
|
871
862
|
Array.isArray(i) || (i = [i]);
|
|
872
863
|
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
|
|
864
|
+
return i.forEach((r) => {
|
|
865
|
+
const o = { v: [] };
|
|
875
866
|
t.forEach((l) => {
|
|
876
|
-
|
|
877
|
-
}), s.push(
|
|
867
|
+
o.v.push(r[l] !== void 0 && r[l] !== null ? r[l] : "");
|
|
868
|
+
}), s.push(o);
|
|
878
869
|
}), s;
|
|
879
870
|
}, "#json2Array"));
|
|
880
|
-
|
|
881
|
-
t.__ng = e(this,
|
|
871
|
+
c(this, xe, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
872
|
+
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
873
|
}), i), "#defaultInsert"));
|
|
883
|
-
|
|
884
|
-
var
|
|
874
|
+
v(this, "add", /* @__PURE__ */ a((i, t = !0) => {
|
|
875
|
+
var r;
|
|
885
876
|
i === void 0 && (i = {});
|
|
886
|
-
const s = e(this,
|
|
877
|
+
const s = e(this, ve).call(this, i);
|
|
887
878
|
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, xe).call(this, s)), this.resetRecords();
|
|
888
879
|
const n = this.count() - 1;
|
|
889
|
-
return t || s.forEach((
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
}), (
|
|
880
|
+
return t || s.forEach((o, l) => {
|
|
881
|
+
const d = e(this, m).rawRecords[n - l];
|
|
882
|
+
d && (d.__ng.rowState = q.ROW_STATE.EMPTY);
|
|
883
|
+
}), (r = e(this, m).viewRecords) != null && r.reset && e(this, m).viewRecords.reset(), n;
|
|
893
884
|
}, "add"));
|
|
894
|
-
|
|
885
|
+
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
895
886
|
var s;
|
|
896
887
|
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,
|
|
888
|
+
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
889
|
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
|
-
|
|
890
|
+
const r = e(this, A)[n].__ng.rowid;
|
|
891
|
+
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) => {
|
|
892
|
+
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState = q.ROW_STATE.DELETE);
|
|
902
893
|
});
|
|
903
894
|
}
|
|
904
895
|
}), this.resetRecords(), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
905
896
|
}, "delete"));
|
|
906
|
-
|
|
907
|
-
var
|
|
897
|
+
v(this, "setValue", /* @__PURE__ */ a((i, t, s) => {
|
|
898
|
+
var d;
|
|
908
899
|
i = parseInt(i, 10);
|
|
909
|
-
const
|
|
910
|
-
if (
|
|
911
|
-
const
|
|
912
|
-
if (!
|
|
913
|
-
const l =
|
|
914
|
-
l !== s &&
|
|
900
|
+
const r = (typeof ((d = e(this, R).fields) == null ? void 0 : d.get) == "function" ? e(this, R).fields.get() : []).indexOf(t);
|
|
901
|
+
if (r < 0) return;
|
|
902
|
+
const o = this.getValidData()[i];
|
|
903
|
+
if (!o) return;
|
|
904
|
+
const l = o.v[r];
|
|
905
|
+
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
906
|
}, "setValue"));
|
|
916
|
-
|
|
917
|
-
|
|
907
|
+
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
908
|
+
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
909
|
i.__ng.rowidx = t;
|
|
919
910
|
}), e(this, A).forEach((i, t) => {
|
|
920
911
|
i.__ng.i = t;
|
|
921
912
|
});
|
|
922
913
|
}, "resetRecords"));
|
|
923
|
-
|
|
924
|
-
|
|
914
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (e(this, A).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, A)), "getValidData"));
|
|
915
|
+
c(this, K, /* @__PURE__ */ a((i) => {
|
|
925
916
|
var s;
|
|
926
917
|
if (!i) return i;
|
|
927
918
|
const t = typeof ((s = e(this, R).fields) == null ? void 0 : s.get) == "function" ? e(this, R).fields.get() : [];
|
|
928
919
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
929
|
-
const
|
|
930
|
-
return t.forEach((
|
|
931
|
-
o
|
|
932
|
-
}),
|
|
920
|
+
const r = {};
|
|
921
|
+
return t.forEach((o, l) => {
|
|
922
|
+
r[o] = n.v ? n.v[l] : n[o];
|
|
923
|
+
}), r.__ng = n.__ng, r;
|
|
933
924
|
}) : i;
|
|
934
925
|
}, "#conv2"));
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
var
|
|
926
|
+
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
927
|
+
v(this, "get", /* @__PURE__ */ a((i, t) => {
|
|
928
|
+
var r;
|
|
938
929
|
const s = this.getValidData();
|
|
939
930
|
if (!s || s.length <= 0) return;
|
|
940
|
-
if (i == null) return e(this,
|
|
931
|
+
if (i == null) return e(this, K).call(this, s);
|
|
941
932
|
if (i < 0 || i >= s.length) return null;
|
|
942
|
-
const n = typeof ((
|
|
933
|
+
const n = typeof ((r = e(this, R).fields) == null ? void 0 : r.get) == "function" ? e(this, R).fields.get() : [];
|
|
943
934
|
if (t != null) {
|
|
944
|
-
const
|
|
945
|
-
return
|
|
935
|
+
const o = n.indexOf(t);
|
|
936
|
+
return o >= 0 ? s[i].v[o] : null;
|
|
946
937
|
}
|
|
947
|
-
return e(this,
|
|
938
|
+
return e(this, K).call(this, s[i]);
|
|
948
939
|
}, "get"));
|
|
949
|
-
|
|
940
|
+
g(this, R, i), g(this, m, t), e(this, we).call(this);
|
|
950
941
|
}
|
|
951
942
|
get source() {
|
|
952
|
-
return e(this,
|
|
943
|
+
return e(this, K).call(this, e(this, m).rawRecords);
|
|
953
944
|
}
|
|
954
945
|
set source(i) {
|
|
955
946
|
this.clear(), this.add(i, !1);
|
|
956
947
|
}
|
|
957
948
|
get nextId() {
|
|
958
|
-
return ++
|
|
949
|
+
return ++Ue(this, me)._;
|
|
959
950
|
}
|
|
960
951
|
get length() {
|
|
961
952
|
return e(this, A).length;
|
|
@@ -964,27 +955,27 @@ const q = class q {
|
|
|
964
955
|
return this.length;
|
|
965
956
|
}
|
|
966
957
|
};
|
|
967
|
-
R = new WeakMap(), m = new WeakMap(), A = new WeakMap(),
|
|
968
|
-
|
|
958
|
+
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"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
959
|
+
v(q, "ROW_STATE", {
|
|
969
960
|
EMPTY: "EMPTY",
|
|
970
961
|
NORMAL: "NORMAL",
|
|
971
962
|
INSERT: "INSERT",
|
|
972
963
|
UPDATE: "UPDATE",
|
|
973
964
|
DELETE: "DELETE"
|
|
974
965
|
});
|
|
975
|
-
let
|
|
976
|
-
const
|
|
966
|
+
let Ce = q;
|
|
967
|
+
const Ne = class Ne {
|
|
977
968
|
constructor(i) {
|
|
978
|
-
this.owner = i, this.row = new
|
|
969
|
+
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
970
|
var t;
|
|
980
971
|
(t = this.owner.view) != null && t.redraw && this.owner.view.redraw();
|
|
981
972
|
}, this.setDataSource = (t) => {
|
|
982
973
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(t || []);
|
|
983
974
|
}, this.getRowState = (t) => {
|
|
984
|
-
var n,
|
|
975
|
+
var n, r;
|
|
985
976
|
const s = parseInt(t, 10);
|
|
986
977
|
if (!(s >= this.data.count()))
|
|
987
|
-
return (
|
|
978
|
+
return (r = (n = this.data.getValidData()[s]) == null ? void 0 : n.__ng) == null ? void 0 : r.rowState;
|
|
988
979
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (t) => {
|
|
989
980
|
this.row.at = t;
|
|
990
981
|
}, 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 +983,37 @@ const ze = class ze {
|
|
|
992
983
|
}, this.setDataSource([]);
|
|
993
984
|
}
|
|
994
985
|
};
|
|
995
|
-
a(
|
|
996
|
-
let
|
|
997
|
-
var
|
|
998
|
-
const
|
|
986
|
+
a(Ne, "ngDataManager");
|
|
987
|
+
let _e = Ne;
|
|
988
|
+
var V, Se;
|
|
989
|
+
const Be = class Be extends HTMLElement {
|
|
999
990
|
constructor() {
|
|
1000
991
|
super();
|
|
1001
992
|
//#created = false;
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
this.attachShadow({ mode: "open" }),
|
|
993
|
+
c(this, V);
|
|
994
|
+
c(this, Se);
|
|
995
|
+
this.attachShadow({ mode: "open" }), g(this, V, new _e(this));
|
|
1005
996
|
}
|
|
1006
997
|
connectedCallback() {
|
|
1007
|
-
|
|
998
|
+
g(this, Se, new ke(this)), F.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1008
999
|
}
|
|
1009
1000
|
disconnectedCallback() {
|
|
1010
|
-
|
|
1001
|
+
F.log("NineTable disconnected.");
|
|
1011
1002
|
}
|
|
1012
1003
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1013
1004
|
get data() {
|
|
1014
|
-
return e(this,
|
|
1005
|
+
return e(this, V).data;
|
|
1015
1006
|
}
|
|
1016
1007
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
1017
1008
|
get row() {
|
|
1018
|
-
return e(this,
|
|
1009
|
+
return e(this, V).row;
|
|
1019
1010
|
}
|
|
1020
1011
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
1021
1012
|
get dataManager() {
|
|
1022
|
-
return e(this,
|
|
1013
|
+
return e(this, V);
|
|
1023
1014
|
}
|
|
1024
1015
|
};
|
|
1025
|
-
|
|
1026
|
-
let
|
|
1027
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
1016
|
+
V = new WeakMap(), Se = new WeakMap(), a(Be, "NineTable");
|
|
1017
|
+
let Ie = Be;
|
|
1018
|
+
customElements.get("nine-table") || customElements.define("nine-table", Ie);
|
|
1028
1019
|
//# sourceMappingURL=nine-table.js.map
|