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