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