@ninebone/table 0.0.256 β 0.0.258
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 +275 -283
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +4 -4
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -3,9 +3,9 @@ var Oe = (m) => {
|
|
|
3
3
|
throw TypeError(m);
|
|
4
4
|
};
|
|
5
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
|
|
7
|
-
var
|
|
8
|
-
var e = (m, i, t) => (Be(m, i, "read from private field"), t ? t.call(m) : i.get(m)),
|
|
6
|
+
var c = (m, i) => ze(m, "name", { value: i, configurable: !0 });
|
|
7
|
+
var x = (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
9
|
var De = (m, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
11
|
y(m, i, n, t);
|
|
@@ -20,32 +20,32 @@ const qe = class qe extends Pe.constructor {
|
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
c(qe, "Trace");
|
|
24
24
|
let me = qe;
|
|
25
|
-
const
|
|
26
|
-
var C,
|
|
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
|
-
|
|
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__ */ c(() => {
|
|
37
37
|
if (!e(this, C)) return;
|
|
38
38
|
const t = e(this, C).querySelector(".ng-container-body");
|
|
39
|
-
t && (y(this,
|
|
39
|
+
t && (y(this, P, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), e(this,
|
|
41
|
+
})), e(this, P).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
|
-
|
|
44
|
-
if (!e(this, C) || !e(this, p) || e(this,
|
|
43
|
+
x(this, "refresh", /* @__PURE__ */ c(() => {
|
|
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, C).querySelector(".ng-container-bottom"),
|
|
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,39 +53,39 @@ 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 f = t.scrollLeft,
|
|
59
|
-
let
|
|
60
|
-
|
|
61
|
-
const S = l -
|
|
62
|
-
|
|
56
|
+
const h = Math.max(Math.min(l * (a / d), l), 20);
|
|
57
|
+
r.style.width = `${h}px`;
|
|
58
|
+
const f = t.scrollLeft, g = d - a;
|
|
59
|
+
let b = 0;
|
|
60
|
+
g > 0 && (b = parseInt(f / g * (l - h), 10)), b < 0 && (b = 0);
|
|
61
|
+
const S = l - h;
|
|
62
|
+
b > S && (b = S), r.style.left = `${b}px`, M.log(b), e(this, p).left.disabled = b === 0, e(this, p).right.disabled = b >= S - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
|
|
64
|
+
u(this, V, /* @__PURE__ */ c((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
|
-
|
|
69
|
+
let a = t;
|
|
70
|
+
a < 0 && (a = 0);
|
|
71
71
|
const d = r.width - o;
|
|
72
|
-
|
|
73
|
-
const l = s.clientWidth,
|
|
74
|
-
let f = d > 0 ? -
|
|
75
|
-
return -f >
|
|
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, h = n.scrollWidth;
|
|
74
|
+
let f = d > 0 ? -a * (h - l) / d : 0;
|
|
75
|
+
return -f > h - l && (f = -(h - l)), -f + 5 > h - l && (f = -(h - l)), l >= h && (f = 0), n.style.transform = `translateX(${f}px)`, a > 0 && a < d - 1;
|
|
76
76
|
}, "#thumbMoveTo"));
|
|
77
|
-
|
|
78
|
-
const t = /* @__PURE__ */
|
|
79
|
-
clearInterval(e(this,
|
|
77
|
+
u(this, se, /* @__PURE__ */ c(() => {
|
|
78
|
+
const t = /* @__PURE__ */ c((n) => {
|
|
79
|
+
clearInterval(e(this, D)), clearInterval(e(this, N));
|
|
80
80
|
const r = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
81
|
-
e(this,
|
|
82
|
-
clearInterval(e(this,
|
|
81
|
+
e(this, V).call(this, r + n), y(this, D, setInterval(() => {
|
|
82
|
+
clearInterval(e(this, D)), y(this, N, setInterval(() => {
|
|
83
83
|
const o = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
84
|
-
e(this,
|
|
84
|
+
e(this, V).call(this, o + n) || clearInterval(e(this, N));
|
|
85
85
|
}, 50));
|
|
86
86
|
}, 500));
|
|
87
|
-
}, "delayScroll"), s = /* @__PURE__ */
|
|
88
|
-
clearInterval(e(this,
|
|
87
|
+
}, "delayScroll"), s = /* @__PURE__ */ c(() => {
|
|
88
|
+
clearInterval(e(this, D)), clearInterval(e(this, N));
|
|
89
89
|
}, "clearTimer");
|
|
90
90
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
91
91
|
e(this, p).left.addEventListener(n, s), e(this, p).right.addEventListener(n, s), e(this, p).track.addEventListener(n, s);
|
|
@@ -97,16 +97,16 @@ const ke = class ke extends HTMLElement {
|
|
|
97
97
|
if (n.button !== 0) return;
|
|
98
98
|
n.preventDefault();
|
|
99
99
|
const r = e(this, p).track.getBoundingClientRect(), o = e(this, p).thumb.clientWidth;
|
|
100
|
-
e(this,
|
|
100
|
+
e(this, V).call(this, n.clientX - r.left - o / 2);
|
|
101
101
|
}), e(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
102
102
|
if (n.button !== 0) return;
|
|
103
|
-
n.stopPropagation(), n.preventDefault(), y(this,
|
|
104
|
-
const r = /* @__PURE__ */
|
|
105
|
-
if (!e(this,
|
|
103
|
+
n.stopPropagation(), n.preventDefault(), y(this, B, !0), this.shiftX = n.clientX - e(this, p).thumb.getBoundingClientRect().left;
|
|
104
|
+
const r = /* @__PURE__ */ c((a) => {
|
|
105
|
+
if (!e(this, B)) return;
|
|
106
106
|
const d = e(this, p).track.getBoundingClientRect();
|
|
107
|
-
e(this,
|
|
108
|
-
}, "onMouseMove"), o = /* @__PURE__ */
|
|
109
|
-
y(this,
|
|
107
|
+
e(this, V).call(this, a.clientX - d.left - this.shiftX);
|
|
108
|
+
}, "onMouseMove"), o = /* @__PURE__ */ c(() => {
|
|
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);
|
|
112
112
|
});
|
|
@@ -177,7 +177,7 @@ 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__ */
|
|
180
|
+
const t = /* @__PURE__ */ c(() => {
|
|
181
181
|
const s = e(this, C).querySelector(".ng-container-body");
|
|
182
182
|
if (!s) {
|
|
183
183
|
setTimeout(t, 10);
|
|
@@ -194,30 +194,30 @@ const ke = class ke extends HTMLElement {
|
|
|
194
194
|
t();
|
|
195
195
|
}
|
|
196
196
|
disconnectedCallback() {
|
|
197
|
-
e(this,
|
|
197
|
+
e(this, P) && e(this, P).disconnect();
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
|
-
C = new WeakMap(),
|
|
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(), c(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, H, I, 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, H, 0);
|
|
211
|
+
u(this, I, 0);
|
|
212
|
+
x(this, "getRowHeight", /* @__PURE__ */ c(() => e(this, A), "getRowHeight"));
|
|
213
|
+
u(this, ne, /* @__PURE__ */ c(() => {
|
|
214
214
|
e(this, re).call(this);
|
|
215
215
|
}, "#init"));
|
|
216
216
|
/**
|
|
217
217
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
218
218
|
*/
|
|
219
|
-
|
|
220
|
-
!e(this,
|
|
219
|
+
u(this, re, /* @__PURE__ */ c(() => {
|
|
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;
|
|
223
223
|
if (!s.classList.contains("active"))
|
|
@@ -226,29 +226,29 @@ 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
|
|
229
|
+
const a = s.querySelector(".ng-container-body") || s, d = a.querySelector("thead"), l = a.querySelector("tfoot");
|
|
230
230
|
d && (o += d.offsetHeight || d.getBoundingClientRect().height), l && (o += l.offsetHeight || l.getBoundingClientRect().height);
|
|
231
|
-
const
|
|
232
|
-
if (e(this,
|
|
233
|
-
const f = Math.ceil(e(this,
|
|
234
|
-
y(this,
|
|
235
|
-
const
|
|
236
|
-
|
|
231
|
+
const h = Math.max(r - o, 100);
|
|
232
|
+
if (e(this, H) !== h && (y(this, H, h), e(this, A) !== null)) {
|
|
233
|
+
const f = Math.ceil(e(this, H) / e(this, A));
|
|
234
|
+
y(this, I, f + 20), M.log(`[RowManager] Resized. Height: ${e(this, H)}px | Target Rows: ${e(this, I)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((g) => {
|
|
235
|
+
const b = s.querySelector(g);
|
|
236
|
+
b && b.querySelector("tbody") && e(this, le).call(this, b);
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
})), e(this,
|
|
241
|
+
})), e(this, W).observe(e(this, $)));
|
|
242
242
|
}, "#initResizeObserver"));
|
|
243
243
|
// π― ν
νλ¦Ώ μΆμΆ, λμ΄ μΈ‘μ , μ΄κΈ° λ λλ§μ μμμ λ§κ² λ΄λΆμμ μΌκ΄ μ²λ¦¬
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const t = e(this,
|
|
247
|
-
y(this, _, n.map((r) => r.cloneNode(!0))), y(this,
|
|
244
|
+
x(this, "initialize", /* @__PURE__ */ c((i) => {
|
|
245
|
+
M.log(i);
|
|
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, 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__ */ c((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");
|
|
@@ -258,18 +258,18 @@ const Le = class Le {
|
|
|
258
258
|
e(this, _).forEach((f) => {
|
|
259
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 (
|
|
264
|
+
const h = t.querySelectorAll("tr:not(.nodata)");
|
|
265
|
+
if (h.forEach((f, g) => {
|
|
266
266
|
l += f.offsetHeight || f.getBoundingClientRect().height;
|
|
267
|
-
}),
|
|
268
|
-
const f = Math.ceil(e(this,
|
|
269
|
-
y(this,
|
|
267
|
+
}), h.forEach((f) => f.remove()), r && (r.style.display = o, r.style.visibility = a, r.style.position = d), y(this, A, l), e(this, H) > 0) {
|
|
268
|
+
const f = Math.ceil(e(this, H) / e(this, A));
|
|
269
|
+
y(this, I, f + 20);
|
|
270
270
|
} else
|
|
271
|
-
y(this,
|
|
272
|
-
return console.log(`[RowManager] Template Height Cached: ${e(this,
|
|
271
|
+
y(this, I, 40);
|
|
272
|
+
return console.log(`[RowManager] Template Height Cached: ${e(this, A)}px | RowCount: ${e(this, I)}`), e(this, A);
|
|
273
273
|
}, "#measureAndCacheHeight"));
|
|
274
274
|
/**
|
|
275
275
|
* π― μΊμλ ν κ°μ λ°ν (μμ λλ§ μ΅μνμ λ°©μ΄ μ°μ°)
|
|
@@ -287,142 +287,134 @@ const Le = class Le {
|
|
|
287
287
|
/**
|
|
288
288
|
* π― μΊμλ ν κ°μλ₯Ό κ³§λ°λ‘ κ°μ Έμμ TR λΌλ μ£Όμ
(μ€λ³΅ κ³μ° μ κ±°)
|
|
289
289
|
*/
|
|
290
|
-
|
|
290
|
+
u(this, le, /* @__PURE__ */ c((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, I);
|
|
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
|
-
|
|
303
|
-
e(this,
|
|
302
|
+
x(this, "destroy", /* @__PURE__ */ c(() => {
|
|
303
|
+
e(this, W) && (e(this, W).disconnect(), y(this, W, null));
|
|
304
304
|
}, "destroy"));
|
|
305
|
-
y(this,
|
|
305
|
+
y(this, $, i), e(this, ne).call(this);
|
|
306
306
|
}
|
|
307
307
|
get templateLength() {
|
|
308
308
|
return e(this, _).length || 1;
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
|
-
|
|
311
|
+
$ = new WeakMap(), _ = new WeakMap(), A = new WeakMap(), W = new WeakMap(), H = new WeakMap(), I = new WeakMap(), ne = new WeakMap(), re = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), c(Le, "RowManager");
|
|
312
312
|
let xe = Le;
|
|
313
|
-
var
|
|
313
|
+
var E, F, G, U, ae, ce;
|
|
314
314
|
const j = class j extends HTMLElement {
|
|
315
315
|
constructor() {
|
|
316
316
|
super();
|
|
317
|
-
|
|
318
|
-
|
|
317
|
+
u(this, E, null);
|
|
318
|
+
u(this, F);
|
|
319
319
|
/**
|
|
320
320
|
* π― 2μ°¨μ μ
격μ μΈλ±μ€λ₯Ό κ³μ°νμ¬ λ³ν©(`rowSpan`/`colSpan`) μ
μ μ λ μ»¬λΌ μμΉλ₯Ό λΆμ¬
|
|
321
321
|
*/
|
|
322
|
-
|
|
322
|
+
u(this, G, /* @__PURE__ */ c((t, s) => {
|
|
323
323
|
const n = Array.from(t.querySelectorAll(s + " tr")), r = Array.from(t.querySelectorAll(s + " th," + s + " td")), o = n.length;
|
|
324
324
|
if (o === 0 || r.length === 0) return;
|
|
325
|
-
let
|
|
325
|
+
let a = 0;
|
|
326
326
|
r.forEach((l) => {
|
|
327
|
-
|
|
327
|
+
a += l.colSpan || 1;
|
|
328
328
|
});
|
|
329
|
-
const d = Array.from(Array(o), () => Array(
|
|
329
|
+
const d = Array.from(Array(o), () => Array(a).fill(null));
|
|
330
330
|
n.forEach((l) => {
|
|
331
|
-
const
|
|
331
|
+
const h = l.sectionRowIndex;
|
|
332
332
|
let f = 0;
|
|
333
|
-
Array.from(l.querySelectorAll("th,td")).forEach((
|
|
334
|
-
for (let
|
|
335
|
-
if (d[
|
|
336
|
-
f =
|
|
333
|
+
Array.from(l.querySelectorAll("th,td")).forEach((g) => {
|
|
334
|
+
for (let v = 0; v < d[h].length; v++)
|
|
335
|
+
if (d[h][v] === null) {
|
|
336
|
+
f = v;
|
|
337
337
|
break;
|
|
338
338
|
}
|
|
339
|
-
const
|
|
340
|
-
for (let
|
|
339
|
+
const b = g.rowSpan || 1, S = g.colSpan || 1;
|
|
340
|
+
for (let v = 0; v < b; v++)
|
|
341
341
|
for (let L = 0; L < S; L++)
|
|
342
|
-
|
|
342
|
+
h + v < o && f + L < a && (d[h + v][f + L] = v === 0 && L === 0 ? "1" : "0");
|
|
343
343
|
});
|
|
344
344
|
}), n.forEach((l) => {
|
|
345
|
-
const
|
|
345
|
+
const h = l.sectionRowIndex;
|
|
346
346
|
Array.from(l.querySelectorAll("th,td")).forEach((f) => {
|
|
347
|
-
for (let
|
|
348
|
-
if (d[
|
|
349
|
-
f.dataset.col =
|
|
347
|
+
for (let g = 0; g < d[h].length; g++)
|
|
348
|
+
if (d[h][g] === "1") {
|
|
349
|
+
f.dataset.col = g, d[h][g] = "0";
|
|
350
350
|
break;
|
|
351
351
|
}
|
|
352
352
|
});
|
|
353
353
|
});
|
|
354
354
|
}, "#resetColIndex"));
|
|
355
355
|
/**
|
|
356
|
-
* π―
|
|
356
|
+
* π― μμ λ°λλΌ μλ°μ€ν¬λ¦½νΈ(Vanilla JS) κΈ°λ°μ κΉλν #createSplitTable
|
|
357
357
|
*/
|
|
358
|
-
|
|
359
|
-
const n = t.cloneNode(!0)
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}), c.reverse().forEach((d) => {
|
|
367
|
-
o[d] && o[d].remove(), n.querySelectorAll("tr").forEach((l) => {
|
|
368
|
-
let a = 0;
|
|
369
|
-
Array.from(l.querySelectorAll("th, td")).forEach((u) => {
|
|
370
|
-
const g = u.colSpan || 1, S = a, x = a + g - 1;
|
|
371
|
-
d >= S && d <= x && (g === 1 ? u.remove() : u.colSpan = g - 1), a += g;
|
|
372
|
-
});
|
|
373
|
-
});
|
|
358
|
+
u(this, U, /* @__PURE__ */ c((t, s) => {
|
|
359
|
+
const n = t.cloneNode(!0);
|
|
360
|
+
return s === "left" ? n.querySelectorAll("col, th, td").forEach((r) => {
|
|
361
|
+
r.getAttribute("fixed") !== "left" && r.remove();
|
|
362
|
+
}) : s === "right" ? n.querySelectorAll("col, th, td").forEach((r) => {
|
|
363
|
+
r.getAttribute("fixed") !== "right" && r.remove();
|
|
364
|
+
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((r) => {
|
|
365
|
+
r.remove();
|
|
374
366
|
}), n;
|
|
375
367
|
}, "#createSplitTable"));
|
|
376
|
-
|
|
368
|
+
x(this, "generate", /* @__PURE__ */ c((t) => {
|
|
377
369
|
if (!t) return;
|
|
378
|
-
const s = /* @__PURE__ */
|
|
379
|
-
const
|
|
380
|
-
if (
|
|
381
|
-
const
|
|
370
|
+
const s = /* @__PURE__ */ c((l) => {
|
|
371
|
+
const h = /* @__PURE__ */ c((g) => {
|
|
372
|
+
if (g.querySelector("colgroup")) return;
|
|
373
|
+
const b = g.querySelector("tbody tr") || g.querySelector("tr"), S = b ? b.querySelectorAll("th, td").length : 1, v = document.createElement("colgroup"), L = Math.max(Math.floor(g.clientWidth / S), 100);
|
|
382
374
|
for (let $e = 0; $e < S; $e++) {
|
|
383
375
|
const We = document.createElement("col");
|
|
384
|
-
We.setAttribute("width", L),
|
|
376
|
+
We.setAttribute("width", L), v.appendChild(We);
|
|
385
377
|
}
|
|
386
|
-
|
|
387
|
-
}, "ensureColgroup"), f = /* @__PURE__ */
|
|
388
|
-
if (
|
|
389
|
-
const
|
|
390
|
-
S ? S.after(
|
|
378
|
+
g.prepend(v);
|
|
379
|
+
}, "ensureColgroup"), f = /* @__PURE__ */ c((g) => {
|
|
380
|
+
if (g.querySelector("thead")) return;
|
|
381
|
+
const b = document.createElement("thead"), S = g.querySelector("colgroup");
|
|
382
|
+
S ? S.after(b) : g.prepend(b);
|
|
391
383
|
}, "ensureThead");
|
|
392
|
-
return
|
|
384
|
+
return h(l), f(l), l.classList.add("nine-table-element"), l;
|
|
393
385
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
394
|
-
y(this,
|
|
386
|
+
y(this, E, s(n)), e(this, E).style.display = "table", e(this, G).call(this, e(this, E), "thead"), e(this, G).call(this, e(this, E), "tbody"), Array.from(e(this, E).querySelectorAll("colgroup col")).forEach((l, h) => {
|
|
395
387
|
const f = l.getAttribute("fixed");
|
|
396
|
-
f && e(this,
|
|
397
|
-
|
|
388
|
+
f && e(this, E).querySelectorAll(`[data-col="${h}"]`).forEach((g) => {
|
|
389
|
+
g.setAttribute("fixed", f);
|
|
398
390
|
});
|
|
399
|
-
}),
|
|
400
|
-
const o = this.querySelector(".ng-container-left"),
|
|
401
|
-
if (
|
|
402
|
-
const l = e(this, U).call(this, e(this,
|
|
403
|
-
|
|
391
|
+
}), M.log(e(this, E));
|
|
392
|
+
const o = this.querySelector(".ng-container-left"), a = this.querySelector(".ng-container-body"), d = this.querySelector(".ng-container-right");
|
|
393
|
+
if (a) {
|
|
394
|
+
const l = e(this, U).call(this, e(this, E), null);
|
|
395
|
+
a.innerHTML = "", a.appendChild(l), M.log(e(this, E)), M.log(l), e(this, F).initialize(e(this, E));
|
|
404
396
|
}
|
|
405
397
|
if (o) {
|
|
406
|
-
const l = e(this, U).call(this, e(this,
|
|
407
|
-
let
|
|
408
|
-
l.querySelectorAll("col").forEach((
|
|
409
|
-
const
|
|
410
|
-
isNaN(
|
|
398
|
+
const l = e(this, U).call(this, e(this, E), "left");
|
|
399
|
+
let h = 0;
|
|
400
|
+
l.querySelectorAll("col").forEach((g) => {
|
|
401
|
+
const b = parseInt(g.getAttribute("width"), 10);
|
|
402
|
+
isNaN(b) || (h += b);
|
|
411
403
|
}), o.innerHTML = "", o.appendChild(l);
|
|
412
|
-
const f =
|
|
404
|
+
const f = h > 0 ? h : 0;
|
|
413
405
|
o.style.flex = `0 0 ${f}px`, o.style.width = `${f}px`;
|
|
414
406
|
}
|
|
415
407
|
if (d) {
|
|
416
|
-
const l = e(this, U).call(this, e(this,
|
|
417
|
-
let
|
|
418
|
-
l.querySelectorAll("col").forEach((
|
|
419
|
-
const
|
|
420
|
-
isNaN(
|
|
408
|
+
const l = e(this, U).call(this, e(this, E), "right");
|
|
409
|
+
let h = 0;
|
|
410
|
+
l.querySelectorAll("col").forEach((g) => {
|
|
411
|
+
const b = parseInt(g.getAttribute("width"), 10);
|
|
412
|
+
isNaN(b) || (h += b);
|
|
421
413
|
}), d.innerHTML = "", d.appendChild(l);
|
|
422
|
-
const f =
|
|
414
|
+
const f = h > 0 ? h : 0;
|
|
423
415
|
d.style.flex = `0 0 ${f}px`, d.style.width = `${f}px`;
|
|
424
416
|
}
|
|
425
|
-
|
|
417
|
+
a && a.addEventListener("scroll", () => {
|
|
426
418
|
var l;
|
|
427
419
|
(l = this.querySelector("nine-table-hscrollbar")) == null || l.refresh();
|
|
428
420
|
}), setTimeout(() => {
|
|
@@ -430,28 +422,28 @@ const j = class j extends HTMLElement {
|
|
|
430
422
|
(l = this.querySelector("nine-table-hscrollbar")) == null || l.refresh();
|
|
431
423
|
}, 0);
|
|
432
424
|
}, "generate"));
|
|
433
|
-
|
|
434
|
-
|
|
425
|
+
x(this, "getRowHeight", /* @__PURE__ */ c(() => e(this, F).getRowHeight(), "getRowHeight"));
|
|
426
|
+
x(this, "scrollToX", /* @__PURE__ */ c((t) => {
|
|
435
427
|
const s = this.querySelector(".ng-container-body");
|
|
436
428
|
s && (s.scrollLeft = t);
|
|
437
429
|
}, "scrollToX"));
|
|
438
|
-
|
|
430
|
+
x(this, "scrollToY", /* @__PURE__ */ c((t) => {
|
|
439
431
|
const s = this.querySelector(".ng-container-body");
|
|
440
432
|
s && (s.scrollTop = t);
|
|
441
433
|
}, "scrollToY"));
|
|
442
|
-
|
|
443
|
-
const t = /* @__PURE__ */
|
|
444
|
-
var
|
|
434
|
+
u(this, ae, /* @__PURE__ */ c(() => {
|
|
435
|
+
const t = /* @__PURE__ */ c(() => {
|
|
436
|
+
var h, f, g;
|
|
445
437
|
const s = this.querySelector(".ng-container-left table"), n = this.querySelector(".ng-container-body table"), r = this.querySelector(".ng-container-right table");
|
|
446
438
|
if (!n) return;
|
|
447
|
-
const o = s ? Array.from(s.querySelectorAll("tr")) : [],
|
|
448
|
-
for (let
|
|
439
|
+
const o = s ? Array.from(s.querySelectorAll("tr")) : [], a = Array.from(n.querySelectorAll("tr")), d = r ? Array.from(r.querySelectorAll("tr")) : [], l = Math.max(o.length, a.length, d.length);
|
|
440
|
+
for (let b = 0; b < l; b++) {
|
|
449
441
|
const S = [
|
|
450
|
-
((
|
|
451
|
-
((f =
|
|
452
|
-
((
|
|
453
|
-
],
|
|
454
|
-
|
|
442
|
+
((h = o[b]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
443
|
+
((f = a[b]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
444
|
+
((g = d[b]) == null ? void 0 : g.getBoundingClientRect().height) || 0
|
|
445
|
+
], v = Math.max(...S);
|
|
446
|
+
v > 0 && (o[b] && (o[b].style.height = `${v}px`), a[b] && (a[b].style.height = `${v}px`), d[b] && (d[b].style.height = `${v}px`));
|
|
455
447
|
}
|
|
456
448
|
}, "syncRowHeights");
|
|
457
449
|
e(this, ce).call(this), requestAnimationFrame(() => {
|
|
@@ -461,7 +453,7 @@ const j = class j extends HTMLElement {
|
|
|
461
453
|
n.attributeName === "class" && this.classList.contains("active") && t();
|
|
462
454
|
}).observe(this, { attributes: !0 });
|
|
463
455
|
}, "#init"));
|
|
464
|
-
|
|
456
|
+
u(this, ce, /* @__PURE__ */ c(() => {
|
|
465
457
|
const t = j.SCROLLBAR_SIZE;
|
|
466
458
|
this.innerHTML = `
|
|
467
459
|
<style>
|
|
@@ -591,17 +583,17 @@ const j = class j extends HTMLElement {
|
|
|
591
583
|
e(this, ae).call(this);
|
|
592
584
|
}
|
|
593
585
|
disconnectedCallback() {
|
|
594
|
-
this.innerHTML = "",
|
|
586
|
+
this.innerHTML = "", M.log("NineTableSheet destroyed.");
|
|
595
587
|
}
|
|
596
588
|
};
|
|
597
|
-
|
|
589
|
+
E = new WeakMap(), F = new WeakMap(), G = new WeakMap(), U = new WeakMap(), ae = new WeakMap(), ce = new WeakMap(), c(j, "NineTableSheet"), x(j, "SCROLLBAR_SIZE", 16);
|
|
598
590
|
let te = j;
|
|
599
591
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", te);
|
|
600
592
|
var he, J;
|
|
601
593
|
const Ce = class Ce extends HTMLElement {
|
|
602
594
|
constructor() {
|
|
603
595
|
super();
|
|
604
|
-
|
|
596
|
+
u(this, he, /* @__PURE__ */ c(() => {
|
|
605
597
|
var t;
|
|
606
598
|
(t = this.querySelector(".nine-tab-bar")) == null || t.addEventListener("click", (s) => {
|
|
607
599
|
var o;
|
|
@@ -609,35 +601,35 @@ const Ce = class Ce extends HTMLElement {
|
|
|
609
601
|
e(this, J).call(this, r, n);
|
|
610
602
|
}), e(this, J).call(this, 0, !1);
|
|
611
603
|
}, "#init"));
|
|
612
|
-
|
|
613
|
-
const n = /* @__PURE__ */
|
|
614
|
-
const
|
|
615
|
-
Array.from(this.querySelectorAll("nine-splitter")).forEach((
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
-
const S = parseInt(
|
|
619
|
-
|
|
604
|
+
u(this, J, /* @__PURE__ */ c((t, s = !1) => {
|
|
605
|
+
const n = /* @__PURE__ */ c(() => {
|
|
606
|
+
const h = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
607
|
+
Array.from(this.querySelectorAll("nine-splitter")).forEach((b) => b.style.setProperty("display", "none"));
|
|
608
|
+
const g = h.filter((b) => b.classList.contains("active"));
|
|
609
|
+
g.length < 2 || g.forEach((b) => {
|
|
610
|
+
const S = parseInt(b.getAttribute("data-index"), 10), v = this.querySelector(`nine-splitter[data-split-index="${S}"]`), L = h[S + 1];
|
|
611
|
+
v && L && L.classList.contains("active") && v.style.setProperty("display", "flex");
|
|
620
612
|
});
|
|
621
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"),
|
|
622
|
-
if (!
|
|
613
|
+
}, "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");
|
|
614
|
+
if (!a[t]) return;
|
|
623
615
|
if (!s)
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
}), d.forEach((
|
|
627
|
-
const
|
|
628
|
-
|
|
616
|
+
a.forEach((h, f) => {
|
|
617
|
+
h.classList.toggle("active", f === t);
|
|
618
|
+
}), d.forEach((h, f) => {
|
|
619
|
+
const g = f === t;
|
|
620
|
+
h.classList.toggle("active", g), h.style.flex = g ? "1 1 100%" : "";
|
|
629
621
|
});
|
|
630
622
|
else {
|
|
631
|
-
const
|
|
632
|
-
if (
|
|
623
|
+
const h = a[t], f = r.querySelectorAll(".nine-tab-item.active");
|
|
624
|
+
if (h.classList.contains("active") && f.length <= 1)
|
|
633
625
|
return;
|
|
634
|
-
|
|
635
|
-
const
|
|
636
|
-
|
|
626
|
+
h.classList.toggle("active");
|
|
627
|
+
const g = o.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
628
|
+
g && (g.classList.toggle("active"), g.classList.contains("active") || (g.style.flex = ""));
|
|
637
629
|
}
|
|
638
630
|
const l = o.querySelectorAll("nine-table-sheet.active");
|
|
639
|
-
l == null || l.forEach((
|
|
640
|
-
|
|
631
|
+
l == null || l.forEach((h) => {
|
|
632
|
+
h.style.flex = l.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
641
633
|
}), n();
|
|
642
634
|
}, "#switchSheet"));
|
|
643
635
|
}
|
|
@@ -645,32 +637,32 @@ const Ce = class Ce extends HTMLElement {
|
|
|
645
637
|
e(this, he).call(this);
|
|
646
638
|
}
|
|
647
639
|
};
|
|
648
|
-
he = new WeakMap(), J = new WeakMap(),
|
|
640
|
+
he = new WeakMap(), J = new WeakMap(), c(Ce, "NineTableSheets");
|
|
649
641
|
let ve = Ce;
|
|
650
642
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", ve);
|
|
651
|
-
var
|
|
643
|
+
var R, de, Q, fe;
|
|
652
644
|
const _e = class _e {
|
|
653
645
|
constructor(i) {
|
|
654
|
-
|
|
655
|
-
|
|
646
|
+
u(this, R);
|
|
647
|
+
u(this, de, /* @__PURE__ */ c(() => {
|
|
656
648
|
e(this, fe).call(this), new ResizeObserver((i) => {
|
|
657
649
|
for (let t of i)
|
|
658
|
-
e(this,
|
|
659
|
-
}).observe(e(this,
|
|
650
|
+
e(this, R).getAttribute("auto-height") === "true" && e(this, Q).call(this);
|
|
651
|
+
}).observe(e(this, R));
|
|
660
652
|
}, "#init"));
|
|
661
|
-
|
|
653
|
+
u(this, Q, /* @__PURE__ */ c(() => {
|
|
662
654
|
var d, l;
|
|
663
|
-
const i = Array.from(e(this,
|
|
655
|
+
const i = Array.from(e(this, R).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
664
656
|
if (i.length === 0) return;
|
|
665
|
-
const t = parseInt(e(this,
|
|
666
|
-
e(this,
|
|
657
|
+
const t = parseInt(e(this, R).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((h) => h.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;
|
|
658
|
+
e(this, R).style.height = `${a}px`;
|
|
667
659
|
}, "#applyAutoHeight"));
|
|
668
|
-
|
|
669
|
-
const t = Array.from(e(this,
|
|
670
|
-
const f = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`,
|
|
671
|
-
return f +
|
|
660
|
+
u(this, fe, /* @__PURE__ */ c(() => {
|
|
661
|
+
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) => {
|
|
662
|
+
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>` : "";
|
|
663
|
+
return f + g;
|
|
672
664
|
}).join(""), o = t.map((d, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
673
|
-
e(this,
|
|
665
|
+
e(this, R).shadowRoot.innerHTML = `
|
|
674
666
|
<style>
|
|
675
667
|
:host {
|
|
676
668
|
display: flex;
|
|
@@ -769,105 +761,105 @@ const _e = class _e {
|
|
|
769
761
|
</nine-table-body>
|
|
770
762
|
<nine-table-footer></nine-table-footer>
|
|
771
763
|
`;
|
|
772
|
-
const
|
|
773
|
-
|
|
764
|
+
const a = e(this, R).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
765
|
+
a == null || a.forEach((d, l) => {
|
|
774
766
|
t[l] && setTimeout(() => {
|
|
775
767
|
d.generate(t[l]), s && e(this, Q).call(this);
|
|
776
768
|
});
|
|
777
769
|
});
|
|
778
770
|
}, "#render"));
|
|
779
|
-
y(this,
|
|
771
|
+
y(this, R, i), e(this, de).call(this);
|
|
780
772
|
}
|
|
781
773
|
};
|
|
782
|
-
|
|
774
|
+
R = new WeakMap(), de = new WeakMap(), Q = new WeakMap(), fe = new WeakMap(), c(_e, "LayoutManager");
|
|
783
775
|
let Se = _e;
|
|
784
|
-
var
|
|
785
|
-
const
|
|
776
|
+
var z, X;
|
|
777
|
+
const He = class He {
|
|
786
778
|
constructor(i) {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
y(this,
|
|
779
|
+
u(this, z);
|
|
780
|
+
u(this, X, -1);
|
|
781
|
+
x(this, "count", /* @__PURE__ */ c(() => e(this, z).rawRecords.length, "count"));
|
|
782
|
+
y(this, z, i);
|
|
791
783
|
}
|
|
792
784
|
get at() {
|
|
793
|
-
return e(this,
|
|
785
|
+
return e(this, X);
|
|
794
786
|
}
|
|
795
787
|
set at(i) {
|
|
796
788
|
var s, n;
|
|
797
|
-
y(this,
|
|
798
|
-
const t = ((n = (s = e(this,
|
|
799
|
-
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this,
|
|
789
|
+
y(this, X, parseInt(i, 10));
|
|
790
|
+
const t = ((n = (s = e(this, z).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || e(this, z).owner.body;
|
|
791
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, X)}"]`) && setTimeout(() => {
|
|
800
792
|
var r, o;
|
|
801
|
-
(o = (r = e(this,
|
|
793
|
+
(o = (r = e(this, z).owner).scrollTo_V1) == null || o.call(r, e(this, X));
|
|
802
794
|
});
|
|
803
795
|
}
|
|
804
796
|
};
|
|
805
|
-
|
|
806
|
-
let Ee =
|
|
807
|
-
var T, w, q, K, ue,
|
|
797
|
+
z = new WeakMap(), X = new WeakMap(), c(He, "ngRow");
|
|
798
|
+
let Ee = He;
|
|
799
|
+
var T, w, q, K, ue, O, ge, ee, be, ye, Z;
|
|
808
800
|
const k = class k {
|
|
809
801
|
constructor(i, t) {
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
y(this,
|
|
802
|
+
u(this, T);
|
|
803
|
+
u(this, w);
|
|
804
|
+
u(this, q, []);
|
|
805
|
+
u(this, K, []);
|
|
806
|
+
u(this, ue, 0);
|
|
807
|
+
u(this, O, []);
|
|
808
|
+
u(this, ge, /* @__PURE__ */ c(() => {
|
|
809
|
+
y(this, O, []);
|
|
818
810
|
const i = e(this, T).template || [];
|
|
819
811
|
Array.from(i).forEach((t) => {
|
|
820
812
|
var s;
|
|
821
|
-
e(this,
|
|
813
|
+
e(this, O).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
822
814
|
}), (e(this, w).rawRecords || []).forEach((t) => {
|
|
823
|
-
t.__ng || (t.__ng = e(this, ee).call(this)), t.__ng.height = e(this,
|
|
815
|
+
t.__ng || (t.__ng = e(this, ee).call(this)), t.__ng.height = e(this, O).slice();
|
|
824
816
|
});
|
|
825
817
|
}, "#initialize"));
|
|
826
|
-
|
|
818
|
+
x(this, "set", /* @__PURE__ */ c((i) => {
|
|
827
819
|
this.clear(), this.add(i, !1);
|
|
828
820
|
}, "set"));
|
|
829
|
-
|
|
821
|
+
u(this, ee, /* @__PURE__ */ c(() => ({
|
|
830
822
|
rowState: k.ROW_STATE.EMPTY,
|
|
831
823
|
deleted: !1,
|
|
832
824
|
filtered: !1,
|
|
833
|
-
height: e(this,
|
|
825
|
+
height: e(this, O).slice(),
|
|
834
826
|
o: {},
|
|
835
827
|
c: {},
|
|
836
|
-
_: [0, 0, 0, 0, k.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this,
|
|
828
|
+
_: [0, 0, 0, 0, k.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, O).slice(), -1, {}, {}]
|
|
837
829
|
}), "#getDefaultMeta"));
|
|
838
|
-
|
|
830
|
+
x(this, "reset", /* @__PURE__ */ c(() => {
|
|
839
831
|
y(this, q, []), y(this, K, []);
|
|
840
832
|
}, "reset"));
|
|
841
|
-
|
|
833
|
+
x(this, "clear", /* @__PURE__ */ c(() => {
|
|
842
834
|
var i;
|
|
843
835
|
e(this, w).rawRecords = [], y(this, q, []), y(this, K, []), (i = e(this, w).viewRecords) != null && i.reset && e(this, w).viewRecords.reset();
|
|
844
836
|
}, "clear"));
|
|
845
|
-
|
|
837
|
+
u(this, be, /* @__PURE__ */ c((i) => {
|
|
846
838
|
var n;
|
|
847
839
|
Array.isArray(i) || (i = [i]);
|
|
848
840
|
const t = typeof ((n = e(this, T).fields) == null ? void 0 : n.get) == "function" ? e(this, T).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
849
841
|
return i.forEach((r) => {
|
|
850
842
|
const o = { v: [] };
|
|
851
|
-
t.forEach((
|
|
852
|
-
o.v.push(r[
|
|
843
|
+
t.forEach((a) => {
|
|
844
|
+
o.v.push(r[a] !== void 0 && r[a] !== null ? r[a] : "");
|
|
853
845
|
}), s.push(o);
|
|
854
846
|
}), s;
|
|
855
847
|
}, "#json2Array"));
|
|
856
|
-
|
|
848
|
+
u(this, ye, /* @__PURE__ */ c((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
857
849
|
t.__ng = e(this, ee).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = k.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
858
850
|
}), i), "#defaultInsert"));
|
|
859
|
-
|
|
851
|
+
x(this, "add", /* @__PURE__ */ c((i, t = !0) => {
|
|
860
852
|
var r;
|
|
861
853
|
i === void 0 && (i = {});
|
|
862
854
|
const s = e(this, be).call(this, i);
|
|
863
855
|
e(this, w).rawRecords = e(this, w).rawRecords.concat(e(this, ye).call(this, s)), this.resetRecords();
|
|
864
856
|
const n = this.count() - 1;
|
|
865
|
-
return t || s.forEach((o,
|
|
866
|
-
const d = e(this, w).rawRecords[n -
|
|
857
|
+
return t || s.forEach((o, a) => {
|
|
858
|
+
const d = e(this, w).rawRecords[n - a];
|
|
867
859
|
d && (d.__ng.rowState = k.ROW_STATE.EMPTY);
|
|
868
860
|
}), (r = e(this, w).viewRecords) != null && r.reset && e(this, w).viewRecords.reset(), n;
|
|
869
861
|
}, "add"));
|
|
870
|
-
|
|
862
|
+
x(this, "delete", /* @__PURE__ */ c((i) => {
|
|
871
863
|
var s;
|
|
872
864
|
let t = [];
|
|
873
865
|
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, w).owner.row.at] : t = [parseInt(i, 10)], t.sort((n, r) => r - n).forEach((n) => {
|
|
@@ -879,37 +871,37 @@ const k = class k {
|
|
|
879
871
|
}
|
|
880
872
|
}), this.resetRecords(), (s = e(this, w).viewRecords) != null && s.reset && e(this, w).viewRecords.reset();
|
|
881
873
|
}, "delete"));
|
|
882
|
-
|
|
874
|
+
x(this, "setValue", /* @__PURE__ */ c((i, t, s) => {
|
|
883
875
|
var d;
|
|
884
876
|
i = parseInt(i, 10);
|
|
885
877
|
const r = (typeof ((d = e(this, T).fields) == null ? void 0 : d.get) == "function" ? e(this, T).fields.get() : []).indexOf(t);
|
|
886
878
|
if (r < 0) return;
|
|
887
879
|
const o = this.getValidData()[i];
|
|
888
880
|
if (!o) return;
|
|
889
|
-
const
|
|
890
|
-
|
|
881
|
+
const a = o.v[r];
|
|
882
|
+
a !== s && o.__ng.rowState !== k.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(t) || (o.__ng.o[t] = a), o.__ng.rowState = k.ROW_STATE.UPDATE), o.v[r] = s, e(this, w).owner.refreshData && e(this, w).owner.refreshData(i);
|
|
891
883
|
}, "setValue"));
|
|
892
|
-
|
|
884
|
+
x(this, "resetRecords", /* @__PURE__ */ c(() => {
|
|
893
885
|
y(this, K, e(this, w).rawRecords.filter((i) => !i.__ng.deleted)), y(this, q, e(this, w).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, w).rawRecords.forEach((i, t) => {
|
|
894
886
|
i.__ng.rowidx = t;
|
|
895
887
|
}), e(this, q).forEach((i, t) => {
|
|
896
888
|
i.__ng.i = t;
|
|
897
889
|
});
|
|
898
890
|
}, "resetRecords"));
|
|
899
|
-
|
|
900
|
-
|
|
891
|
+
x(this, "getValidData", /* @__PURE__ */ c(() => (e(this, q).length === 0 && e(this, w).rawRecords.length > 0 && this.resetRecords(), e(this, q)), "getValidData"));
|
|
892
|
+
u(this, Z, /* @__PURE__ */ c((i) => {
|
|
901
893
|
var s;
|
|
902
894
|
if (!i) return i;
|
|
903
895
|
const t = typeof ((s = e(this, T).fields) == null ? void 0 : s.get) == "function" ? e(this, T).fields.get() : [];
|
|
904
896
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
905
897
|
const r = {};
|
|
906
|
-
return t.forEach((o,
|
|
907
|
-
r[o] = n.v ? n.v[
|
|
898
|
+
return t.forEach((o, a) => {
|
|
899
|
+
r[o] = n.v ? n.v[a] : n[o];
|
|
908
900
|
}), r.__ng = n.__ng, r;
|
|
909
901
|
}) : i;
|
|
910
902
|
}, "#conv2"));
|
|
911
|
-
|
|
912
|
-
|
|
903
|
+
x(this, "count", /* @__PURE__ */ c(() => this.getValidData().length, "count"));
|
|
904
|
+
x(this, "get", /* @__PURE__ */ c((i, t) => {
|
|
913
905
|
var r;
|
|
914
906
|
const s = this.getValidData();
|
|
915
907
|
if (!s || s.length <= 0) return;
|
|
@@ -940,8 +932,8 @@ const k = class k {
|
|
|
940
932
|
return this.length;
|
|
941
933
|
}
|
|
942
934
|
};
|
|
943
|
-
T = new WeakMap(), w = new WeakMap(), q = new WeakMap(), K = new WeakMap(), ue = new WeakMap(),
|
|
944
|
-
|
|
935
|
+
T = new WeakMap(), w = new WeakMap(), q = 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(), c(k, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
936
|
+
x(k, "ROW_STATE", {
|
|
945
937
|
EMPTY: "EMPTY",
|
|
946
938
|
NORMAL: "NORMAL",
|
|
947
939
|
INSERT: "INSERT",
|
|
@@ -949,7 +941,7 @@ v(k, "ROW_STATE", {
|
|
|
949
941
|
DELETE: "DELETE"
|
|
950
942
|
});
|
|
951
943
|
let Re = k;
|
|
952
|
-
const
|
|
944
|
+
const Ie = class Ie {
|
|
953
945
|
constructor(i) {
|
|
954
946
|
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 = () => {
|
|
955
947
|
var t;
|
|
@@ -968,37 +960,37 @@ const He = class He {
|
|
|
968
960
|
}, this.setDataSource([]);
|
|
969
961
|
}
|
|
970
962
|
};
|
|
971
|
-
|
|
972
|
-
let Ae =
|
|
973
|
-
var
|
|
963
|
+
c(Ie, "ngDataManager");
|
|
964
|
+
let Ae = Ie;
|
|
965
|
+
var Y, pe;
|
|
974
966
|
const Me = class Me extends HTMLElement {
|
|
975
967
|
constructor() {
|
|
976
968
|
super();
|
|
977
969
|
//#created = false;
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
this.attachShadow({ mode: "open" }), y(this,
|
|
970
|
+
u(this, Y);
|
|
971
|
+
u(this, pe);
|
|
972
|
+
this.attachShadow({ mode: "open" }), y(this, Y, new Ae(this));
|
|
981
973
|
}
|
|
982
974
|
connectedCallback() {
|
|
983
|
-
y(this, pe, new Se(this)),
|
|
975
|
+
y(this, pe, new Se(this)), M.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
984
976
|
}
|
|
985
977
|
disconnectedCallback() {
|
|
986
|
-
|
|
978
|
+
M.log("NineTable disconnected.");
|
|
987
979
|
}
|
|
988
980
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
989
981
|
get data() {
|
|
990
|
-
return e(this,
|
|
982
|
+
return e(this, Y).data;
|
|
991
983
|
}
|
|
992
984
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
993
985
|
get row() {
|
|
994
|
-
return e(this,
|
|
986
|
+
return e(this, Y).row;
|
|
995
987
|
}
|
|
996
988
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
997
989
|
get dataManager() {
|
|
998
|
-
return e(this,
|
|
990
|
+
return e(this, Y);
|
|
999
991
|
}
|
|
1000
992
|
};
|
|
1001
|
-
|
|
993
|
+
Y = new WeakMap(), pe = new WeakMap(), c(Me, "NineTable");
|
|
1002
994
|
let Te = Me;
|
|
1003
995
|
customElements.get("nine-table") || customElements.define("nine-table", Te);
|
|
1004
996
|
//# sourceMappingURL=nine-table.js.map
|