@ninebone/table 0.0.269 β 0.0.270
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 +229 -260
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +5 -5
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Pe = Object.defineProperty;
|
|
2
|
+
var Ve = (w) => {
|
|
3
3
|
throw TypeError(w);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var h = (w, i) =>
|
|
7
|
-
var S = (w, i, t) =>
|
|
8
|
-
var e = (w, i, t) => (
|
|
9
|
-
var
|
|
5
|
+
var Ue = (w, i, t) => i in w ? Pe(w, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : w[i] = t;
|
|
6
|
+
var h = (w, i) => Pe(w, "name", { value: i, configurable: !0 });
|
|
7
|
+
var S = (w, i, t) => Ue(w, typeof i != "symbol" ? i + "" : i, t), Xe = (w, i, t) => i.has(w) || Ve("Cannot " + t);
|
|
8
|
+
var e = (w, i, t) => (Xe(w, i, "read from private field"), t ? t.call(w) : i.get(w)), g = (w, i, t) => i.has(w) ? Ve("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(w) : i.set(w, t), y = (w, i, t, s) => (Xe(w, i, "write to private field"), s ? s.call(w, t) : i.set(w, t), t);
|
|
9
|
+
var Ye = (w, i, t, s) => ({
|
|
10
10
|
set _(r) {
|
|
11
11
|
y(w, i, r, t);
|
|
12
12
|
},
|
|
@@ -15,36 +15,36 @@ var Ke = (w, i, t, s) => ({
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
import { trace as Fe } from "@ninebone/util";
|
|
18
|
-
const
|
|
18
|
+
const Ie = class Ie extends Fe.constructor {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
h(
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
var
|
|
27
|
-
const
|
|
23
|
+
h(Ie, "Trace");
|
|
24
|
+
let Se = Ie;
|
|
25
|
+
const L = new Se();
|
|
26
|
+
var _, D, p, N, P, V, ne, X, oe;
|
|
27
|
+
const Me = class Me extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
g(this,
|
|
31
|
-
g(this,
|
|
32
|
-
g(this,
|
|
33
|
-
g(this,
|
|
30
|
+
g(this, _);
|
|
31
|
+
g(this, D, !1);
|
|
32
|
+
g(this, p);
|
|
33
|
+
g(this, N);
|
|
34
34
|
g(this, P);
|
|
35
35
|
g(this, V);
|
|
36
|
-
g(this,
|
|
37
|
-
if (!e(this,
|
|
38
|
-
const t = e(this,
|
|
36
|
+
g(this, ne, /* @__PURE__ */ h(() => {
|
|
37
|
+
if (!e(this, _)) return;
|
|
38
|
+
const t = e(this, _).querySelector(".ng-container-body");
|
|
39
39
|
t && (y(this, V, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), e(this, V).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
S(this, "refresh", /* @__PURE__ */ h(() => {
|
|
44
|
-
if (!e(this,
|
|
45
|
-
const t = e(this,
|
|
44
|
+
if (!e(this, _) || !e(this, p) || e(this, D)) return;
|
|
45
|
+
const t = e(this, p).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const r = e(this,
|
|
47
|
+
const r = e(this, p).track, n = e(this, p).thumb, o = e(this, _).querySelector(".ng-container-bottom"), c = t.clientWidth, u = s.scrollWidth;
|
|
48
48
|
if (c !== 0 && u > c)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -58,62 +58,62 @@ const ze = class ze extends HTMLElement {
|
|
|
58
58
|
const d = t.scrollLeft, f = u - c;
|
|
59
59
|
let b = 0;
|
|
60
60
|
f > 0 && (b = parseInt(d / f * (l - a), 10)), b < 0 && (b = 0);
|
|
61
|
-
const
|
|
62
|
-
b >
|
|
61
|
+
const m = l - a;
|
|
62
|
+
b > m && (b = m), n.style.left = `${b}px`, L.log(b), e(this, p).left.disabled = b === 0, e(this, p).right.disabled = b >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
g(this, X, /* @__PURE__ */ h((t) => {
|
|
65
|
-
if (!e(this,
|
|
66
|
-
const s = e(this,
|
|
65
|
+
if (!e(this, p)) return !1;
|
|
66
|
+
const s = e(this, p).container, r = s.querySelector("table");
|
|
67
67
|
if (!r) return !1;
|
|
68
|
-
const n = e(this,
|
|
68
|
+
const n = e(this, p).track.getBoundingClientRect(), o = e(this, p).thumb.clientWidth;
|
|
69
69
|
let c = t;
|
|
70
70
|
c < 0 && (c = 0);
|
|
71
71
|
const u = n.width - o;
|
|
72
|
-
c > u && (c = u), c = parseInt(c, 10), e(this,
|
|
72
|
+
c > u && (c = u), c = parseInt(c, 10), e(this, p).thumb.style.left = `${c}px`, e(this, p).left.disabled = c === 0, e(this, p).right.disabled = c >= u - 1;
|
|
73
73
|
const l = s.clientWidth, a = r.scrollWidth;
|
|
74
74
|
let d = u > 0 ? -c * (a - l) / u : 0;
|
|
75
75
|
return -d > a - l && (d = -(a - l)), -d + 5 > a - l && (d = -(a - l)), l >= a && (d = 0), r.style.transform = `translateX(${d}px)`, c > 0 && c < u - 1;
|
|
76
76
|
}, "#thumbMoveTo"));
|
|
77
|
-
g(this,
|
|
77
|
+
g(this, oe, /* @__PURE__ */ h(() => {
|
|
78
78
|
const t = /* @__PURE__ */ h((r) => {
|
|
79
|
-
clearInterval(e(this,
|
|
80
|
-
const n = parseInt(e(this,
|
|
81
|
-
e(this, X).call(this, n + r), y(this,
|
|
82
|
-
clearInterval(e(this,
|
|
83
|
-
const o = parseInt(e(this,
|
|
79
|
+
clearInterval(e(this, N)), clearInterval(e(this, P));
|
|
80
|
+
const n = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
81
|
+
e(this, X).call(this, n + r), y(this, N, setInterval(() => {
|
|
82
|
+
clearInterval(e(this, N)), y(this, P, setInterval(() => {
|
|
83
|
+
const o = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
84
84
|
e(this, X).call(this, o + r) || clearInterval(e(this, P));
|
|
85
85
|
}, 50));
|
|
86
86
|
}, 500));
|
|
87
87
|
}, "delayScroll"), s = /* @__PURE__ */ h(() => {
|
|
88
|
-
clearInterval(e(this,
|
|
88
|
+
clearInterval(e(this, N)), clearInterval(e(this, P));
|
|
89
89
|
}, "clearTimer");
|
|
90
90
|
["mouseup", "mouseleave", "touchend"].forEach((r) => {
|
|
91
|
-
e(this,
|
|
92
|
-
}), e(this,
|
|
91
|
+
e(this, p).left.addEventListener(r, s), e(this, p).right.addEventListener(r, s), e(this, p).track.addEventListener(r, s);
|
|
92
|
+
}), e(this, p).left.addEventListener("mousedown", (r) => {
|
|
93
93
|
r.button === 0 && t(-20);
|
|
94
|
-
}), e(this,
|
|
94
|
+
}), e(this, p).right.addEventListener("mousedown", (r) => {
|
|
95
95
|
r.button === 0 && t(20);
|
|
96
|
-
}), e(this,
|
|
96
|
+
}), e(this, p).left.addEventListener("touchstart", () => t(-20)), e(this, p).right.addEventListener("touchstart", () => t(20)), e(this, p).track.addEventListener("mousedown", (r) => {
|
|
97
97
|
if (r.button !== 0) return;
|
|
98
98
|
r.preventDefault();
|
|
99
|
-
const n = e(this,
|
|
99
|
+
const n = e(this, p).track.getBoundingClientRect(), o = e(this, p).thumb.clientWidth;
|
|
100
100
|
e(this, X).call(this, r.clientX - n.left - o / 2);
|
|
101
|
-
}), e(this,
|
|
101
|
+
}), e(this, p).thumb.addEventListener("mousedown", (r) => {
|
|
102
102
|
if (r.button !== 0) return;
|
|
103
|
-
r.stopPropagation(), r.preventDefault(), y(this,
|
|
103
|
+
r.stopPropagation(), r.preventDefault(), y(this, D, !0), this.shiftX = r.clientX - e(this, p).thumb.getBoundingClientRect().left;
|
|
104
104
|
const n = /* @__PURE__ */ h((c) => {
|
|
105
|
-
if (!e(this,
|
|
106
|
-
const u = e(this,
|
|
105
|
+
if (!e(this, D)) return;
|
|
106
|
+
const u = e(this, p).track.getBoundingClientRect();
|
|
107
107
|
e(this, X).call(this, c.clientX - u.left - this.shiftX);
|
|
108
108
|
}, "onMouseMove"), o = /* @__PURE__ */ h(() => {
|
|
109
|
-
y(this,
|
|
109
|
+
y(this, D, !1), s(), document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", o), this.refresh();
|
|
110
110
|
}, "onMouseUp");
|
|
111
111
|
document.addEventListener("mousemove", n), document.addEventListener("mouseup", o);
|
|
112
112
|
});
|
|
113
113
|
}, "#init"));
|
|
114
114
|
}
|
|
115
115
|
connectedCallback() {
|
|
116
|
-
if (y(this,
|
|
116
|
+
if (y(this, _, this.closest("nine-table-sheet") || this.getRootNode().host), !e(this, _)) return;
|
|
117
117
|
this.innerHTML = `
|
|
118
118
|
<style>
|
|
119
119
|
nine-table-hscrollbar {
|
|
@@ -178,18 +178,18 @@ const ze = class ze extends HTMLElement {
|
|
|
178
178
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
179
179
|
`;
|
|
180
180
|
const t = /* @__PURE__ */ h(() => {
|
|
181
|
-
const s = e(this,
|
|
181
|
+
const s = e(this, _).querySelector(".ng-container-body");
|
|
182
182
|
if (!s) {
|
|
183
183
|
setTimeout(t, 10);
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
|
-
y(this,
|
|
186
|
+
y(this, p, {
|
|
187
187
|
container: s,
|
|
188
188
|
track: this.querySelector(".ng-scroll-track"),
|
|
189
189
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
190
190
|
left: this.querySelector(".ng-scroll-left"),
|
|
191
191
|
right: this.querySelector(".ng-scroll-right")
|
|
192
|
-
}), e(this,
|
|
192
|
+
}), e(this, oe).call(this), e(this, ne).call(this), this.refresh();
|
|
193
193
|
}, "initWhenReady");
|
|
194
194
|
t();
|
|
195
195
|
}
|
|
@@ -197,26 +197,26 @@ const ze = class ze extends HTMLElement {
|
|
|
197
197
|
e(this, V) && e(this, V).disconnect();
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
|
-
|
|
201
|
-
let
|
|
202
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar",
|
|
203
|
-
var W,
|
|
204
|
-
const
|
|
200
|
+
_ = new WeakMap(), D = new WeakMap(), p = new WeakMap(), N = new WeakMap(), P = new WeakMap(), V = new WeakMap(), ne = new WeakMap(), X = new WeakMap(), oe = new WeakMap(), h(Me, "NineTableHScrollBar");
|
|
201
|
+
let Ee = Me;
|
|
202
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Ee);
|
|
203
|
+
var W, M, A, z, H, $, le, ae, ce, he;
|
|
204
|
+
const He = class He {
|
|
205
205
|
constructor(i) {
|
|
206
206
|
g(this, W);
|
|
207
|
-
g(this,
|
|
208
|
-
g(this,
|
|
207
|
+
g(this, M, []);
|
|
208
|
+
g(this, A, null);
|
|
209
209
|
g(this, z, null);
|
|
210
|
-
g(this,
|
|
210
|
+
g(this, H, 0);
|
|
211
211
|
g(this, $, 0);
|
|
212
|
-
S(this, "getRowHeight", /* @__PURE__ */ h(() => e(this,
|
|
213
|
-
g(this,
|
|
214
|
-
e(this,
|
|
212
|
+
S(this, "getRowHeight", /* @__PURE__ */ h(() => e(this, A), "getRowHeight"));
|
|
213
|
+
g(this, le, /* @__PURE__ */ h(() => {
|
|
214
|
+
e(this, ae).call(this);
|
|
215
215
|
}, "#init"));
|
|
216
216
|
/**
|
|
217
217
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
218
218
|
*/
|
|
219
|
-
g(this,
|
|
219
|
+
g(this, ae, /* @__PURE__ */ h(() => {
|
|
220
220
|
!e(this, W) || !(e(this, W) instanceof HTMLElement) || (y(this, z, new ResizeObserver((i) => {
|
|
221
221
|
for (const t of i) {
|
|
222
222
|
const s = t.target;
|
|
@@ -229,11 +229,11 @@ const Oe = class Oe {
|
|
|
229
229
|
const c = s.querySelector(".ng-container-body") || s, u = c.querySelector("thead"), l = c.querySelector("tfoot");
|
|
230
230
|
u && (o += u.offsetHeight || u.getBoundingClientRect().height), l && (o += l.offsetHeight || l.getBoundingClientRect().height);
|
|
231
231
|
const a = Math.max(n - o, 100);
|
|
232
|
-
if (e(this,
|
|
233
|
-
const d = Math.ceil(e(this,
|
|
234
|
-
y(this, $, d + 20),
|
|
232
|
+
if (e(this, H) !== a && (y(this, H, a), e(this, A) !== null)) {
|
|
233
|
+
const d = Math.ceil(e(this, H) / e(this, A));
|
|
234
|
+
y(this, $, d + 20), L.log(`[RowManager] Resized. Height: ${e(this, H)}px | Target Rows: ${e(this, $)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((f) => {
|
|
235
235
|
const b = s.querySelector(f);
|
|
236
|
-
b && b.querySelector("tbody") && e(this,
|
|
236
|
+
b && b.querySelector("tbody") && e(this, he).call(this, b);
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
}
|
|
@@ -242,20 +242,20 @@ const Oe = class Oe {
|
|
|
242
242
|
}, "#initResizeObserver"));
|
|
243
243
|
// π― ν
νλ¦Ώ μΆμΆ, λμ΄ μΈ‘μ , μ΄κΈ° λ λλ§μ μμμ λ§κ² λ΄λΆμμ μΌκ΄ μ²λ¦¬
|
|
244
244
|
S(this, "initialize", /* @__PURE__ */ h((i) => {
|
|
245
|
-
|
|
245
|
+
L.log(i);
|
|
246
246
|
const t = e(this, W).querySelector(".ng-container-body"), s = i.querySelector("tbody"), r = Array.from(s.querySelectorAll("tr"));
|
|
247
|
-
y(this,
|
|
247
|
+
y(this, M, r.map((n) => n.cloneNode(!0))), y(this, A, null), e(this, ce).call(this, t);
|
|
248
248
|
}, "initialize"));
|
|
249
|
-
g(this,
|
|
250
|
-
if (e(this,
|
|
251
|
-
return e(this,
|
|
252
|
-
if (e(this,
|
|
249
|
+
g(this, ce, /* @__PURE__ */ h((i) => {
|
|
250
|
+
if (e(this, A) !== null && e(this, A) > 0)
|
|
251
|
+
return e(this, A);
|
|
252
|
+
if (e(this, M).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
256
|
t.querySelectorAll("tr:not(.nodata)").forEach((d) => d.remove());
|
|
257
257
|
const s = t.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
258
|
-
e(this,
|
|
258
|
+
e(this, M).forEach((d) => {
|
|
259
259
|
r.appendChild(d.cloneNode(!0));
|
|
260
260
|
}), s ? s.before(r) : t.appendChild(r);
|
|
261
261
|
const n = i.closest("nine-table-sheet"), o = n ? n.style.display : "", c = n ? n.style.visibility : "", u = n ? n.style.position : "";
|
|
@@ -264,12 +264,12 @@ const Oe = class Oe {
|
|
|
264
264
|
const a = t.querySelectorAll("tr:not(.nodata)");
|
|
265
265
|
if (a.forEach((d, f) => {
|
|
266
266
|
l += d.offsetHeight || d.getBoundingClientRect().height;
|
|
267
|
-
}), a.forEach((d) => d.remove()), n && (n.style.display = o, n.style.visibility = c, n.style.position = u), y(this,
|
|
268
|
-
const d = Math.ceil(e(this,
|
|
267
|
+
}), a.forEach((d) => d.remove()), n && (n.style.display = o, n.style.visibility = c, n.style.position = u), y(this, A, l), e(this, H) > 0) {
|
|
268
|
+
const d = Math.ceil(e(this, H) / e(this, A));
|
|
269
269
|
y(this, $, d + 20);
|
|
270
270
|
} else
|
|
271
271
|
y(this, $, 40);
|
|
272
|
-
return console.log(`[RowManager] Template Height Cached: ${e(this,
|
|
272
|
+
return console.log(`[RowManager] Template Height Cached: ${e(this, A)}px | RowCount: ${e(this, $)}`), e(this, A);
|
|
273
273
|
}, "#measureAndCacheHeight"));
|
|
274
274
|
/**
|
|
275
275
|
* π― μΊμλ ν κ°μ λ°ν (μμ λλ§ μ΅μνμ λ°©μ΄ μ°μ°)
|
|
@@ -287,14 +287,14 @@ const Oe = class Oe {
|
|
|
287
287
|
/**
|
|
288
288
|
* π― μΊμλ ν κ°μλ₯Ό κ³§λ°λ‘ κ°μ Έμμ TR λΌλ μ£Όμ
(μ€λ³΅ κ³μ° μ κ±°)
|
|
289
289
|
*/
|
|
290
|
-
g(this,
|
|
291
|
-
if (e(this,
|
|
290
|
+
g(this, he, /* @__PURE__ */ h((i) => {
|
|
291
|
+
if (e(this, M).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
295
|
const s = t.querySelector("tr.nodata"), r = document.createDocumentFragment(), n = e(this, $);
|
|
296
296
|
for (let o = 0; o < n; o++)
|
|
297
|
-
e(this,
|
|
297
|
+
e(this, M).forEach((c) => {
|
|
298
298
|
r.appendChild(c.cloneNode(!0));
|
|
299
299
|
});
|
|
300
300
|
s ? s.before(r) : t.appendChild(r), console.log(`[RowManager] Rendered ${n} sets into DOM.`);
|
|
@@ -302,24 +302,24 @@ const Oe = class Oe {
|
|
|
302
302
|
S(this, "destroy", /* @__PURE__ */ h(() => {
|
|
303
303
|
e(this, z) && (e(this, z).disconnect(), y(this, z, null));
|
|
304
304
|
}, "destroy"));
|
|
305
|
-
y(this, W, i), e(this,
|
|
305
|
+
y(this, W, i), e(this, le).call(this);
|
|
306
306
|
}
|
|
307
307
|
get templateLength() {
|
|
308
|
-
return e(this,
|
|
308
|
+
return e(this, M).length || 1;
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
|
-
W = new WeakMap(),
|
|
312
|
-
let
|
|
313
|
-
var
|
|
314
|
-
const
|
|
311
|
+
W = new WeakMap(), M = new WeakMap(), A = new WeakMap(), z = new WeakMap(), H = new WeakMap(), $ = new WeakMap(), le = new WeakMap(), ae = new WeakMap(), ce = new WeakMap(), he = new WeakMap(), h(He, "RowManager");
|
|
312
|
+
let Re = He;
|
|
313
|
+
var E, F, J, K, Q, de, fe;
|
|
314
|
+
const G = class G extends HTMLElement {
|
|
315
315
|
constructor() {
|
|
316
316
|
super();
|
|
317
|
-
g(this,
|
|
318
|
-
g(this,
|
|
317
|
+
g(this, E, null);
|
|
318
|
+
g(this, F);
|
|
319
319
|
/**
|
|
320
320
|
* π― 2μ°¨μ μ
격μ μΈλ±μ€λ₯Ό κ³μ°νμ¬ λ³ν©(`rowSpan`/`colSpan`) μ
μ μ λ μ»¬λΌ μμΉλ₯Ό λΆμ¬
|
|
321
321
|
*/
|
|
322
|
-
g(this,
|
|
322
|
+
g(this, J, /* @__PURE__ */ h((t, s) => {
|
|
323
323
|
const r = Array.from(t.querySelectorAll(s + " tr")), n = Array.from(t.querySelectorAll(s + " th," + s + " td")), o = r.length;
|
|
324
324
|
if (o === 0 || n.length === 0) return;
|
|
325
325
|
let c = 0;
|
|
@@ -336,10 +336,10 @@ const ee = class ee extends HTMLElement {
|
|
|
336
336
|
d = v;
|
|
337
337
|
break;
|
|
338
338
|
}
|
|
339
|
-
const b = f.rowSpan || 1,
|
|
339
|
+
const b = f.rowSpan || 1, m = f.colSpan || 1;
|
|
340
340
|
for (let v = 0; v < b; v++)
|
|
341
|
-
for (let
|
|
342
|
-
a + v < o && d +
|
|
341
|
+
for (let C = 0; C < m; C++)
|
|
342
|
+
a + v < o && d + C < c && (u[a + v][d + C] = v === 0 && C === 0 ? "1" : "0");
|
|
343
343
|
});
|
|
344
344
|
}), r.forEach((l) => {
|
|
345
345
|
const a = l.sectionRowIndex;
|
|
@@ -355,7 +355,7 @@ const ee = class ee extends HTMLElement {
|
|
|
355
355
|
/**
|
|
356
356
|
* π― μμ λ°λλΌ μλ°μ€ν¬λ¦½νΈ(Vanilla JS) κΈ°λ°μ κΉλν #createSplitTable
|
|
357
357
|
*/
|
|
358
|
-
g(this,
|
|
358
|
+
g(this, K, /* @__PURE__ */ h((t, s) => {
|
|
359
359
|
const r = t.cloneNode(!0);
|
|
360
360
|
return s === "left" ? r.querySelectorAll("col, th, td").forEach((n) => {
|
|
361
361
|
n.getAttribute("fixed") !== "left" && n.remove();
|
|
@@ -370,32 +370,32 @@ const ee = class ee extends HTMLElement {
|
|
|
370
370
|
const s = /* @__PURE__ */ h((l) => {
|
|
371
371
|
const a = /* @__PURE__ */ h((f) => {
|
|
372
372
|
if (f.querySelector("colgroup")) return;
|
|
373
|
-
const b = f.querySelector("tbody tr") || f.querySelector("tr"),
|
|
374
|
-
for (let
|
|
375
|
-
const
|
|
376
|
-
|
|
373
|
+
const b = f.querySelector("tbody tr") || f.querySelector("tr"), m = b ? b.querySelectorAll("th, td").length : 1, v = document.createElement("colgroup"), C = Math.max(Math.floor(f.clientWidth / m), 100);
|
|
374
|
+
for (let De = 0; De < m; De++) {
|
|
375
|
+
const Ne = document.createElement("col");
|
|
376
|
+
Ne.setAttribute("width", C), v.appendChild(Ne);
|
|
377
377
|
}
|
|
378
378
|
f.prepend(v);
|
|
379
379
|
}, "ensureColgroup"), d = /* @__PURE__ */ h((f) => {
|
|
380
380
|
if (f.querySelector("thead")) return;
|
|
381
|
-
const b = document.createElement("thead"),
|
|
382
|
-
|
|
381
|
+
const b = document.createElement("thead"), m = f.querySelector("colgroup");
|
|
382
|
+
m ? m.after(b) : f.prepend(b);
|
|
383
383
|
}, "ensureThead");
|
|
384
384
|
return a(l), d(l), l.classList.add("nine-table-element"), l;
|
|
385
385
|
}, "initializeTable"), r = t.cloneNode(!0);
|
|
386
|
-
y(this,
|
|
386
|
+
y(this, E, s(r)), e(this, E).style.display = "table", e(this, J).call(this, e(this, E), "thead"), e(this, J).call(this, e(this, E), "tbody"), Array.from(e(this, E).querySelectorAll("colgroup col")).forEach((l, a) => {
|
|
387
387
|
const d = l.getAttribute("fixed");
|
|
388
|
-
d && e(this,
|
|
388
|
+
d && e(this, E).querySelectorAll(`[data-col="${a}"]`).forEach((f) => {
|
|
389
389
|
f.setAttribute("fixed", d);
|
|
390
390
|
});
|
|
391
|
-
}),
|
|
391
|
+
}), L.log(e(this, E));
|
|
392
392
|
const o = this.querySelector(".ng-container-left"), c = this.querySelector(".ng-container-body"), u = this.querySelector(".ng-container-right");
|
|
393
393
|
if (c) {
|
|
394
|
-
const l = e(this,
|
|
395
|
-
c.innerHTML = "", c.appendChild(l),
|
|
394
|
+
const l = e(this, K).call(this, e(this, E), null);
|
|
395
|
+
c.innerHTML = "", c.appendChild(l), L.log(e(this, E)), L.log(l), e(this, F).initialize(e(this, E));
|
|
396
396
|
}
|
|
397
397
|
if (o) {
|
|
398
|
-
const l = e(this,
|
|
398
|
+
const l = e(this, K).call(this, e(this, E), "left");
|
|
399
399
|
let a = 0;
|
|
400
400
|
l.querySelectorAll("col").forEach((f) => {
|
|
401
401
|
const b = parseInt(f.getAttribute("width"), 10);
|
|
@@ -405,7 +405,7 @@ const ee = class ee extends HTMLElement {
|
|
|
405
405
|
o.style.flex = `0 0 ${d}px`, o.style.width = `${d}px`;
|
|
406
406
|
}
|
|
407
407
|
if (u) {
|
|
408
|
-
const l = e(this,
|
|
408
|
+
const l = e(this, K).call(this, e(this, E), "right");
|
|
409
409
|
let a = 0;
|
|
410
410
|
l.querySelectorAll("col").forEach((f) => {
|
|
411
411
|
const b = parseInt(f.getAttribute("width"), 10);
|
|
@@ -419,10 +419,10 @@ const ee = class ee extends HTMLElement {
|
|
|
419
419
|
(l = this.querySelector("nine-table-hscrollbar")) == null || l.refresh();
|
|
420
420
|
}), setTimeout(() => {
|
|
421
421
|
var l;
|
|
422
|
-
e(this,
|
|
422
|
+
e(this, Q).call(this), (l = this.querySelector("nine-table-hscrollbar")) == null || l.refresh();
|
|
423
423
|
}, 0);
|
|
424
424
|
}, "generate"));
|
|
425
|
-
S(this, "getRowHeight", /* @__PURE__ */ h(() => e(this,
|
|
425
|
+
S(this, "getRowHeight", /* @__PURE__ */ h(() => e(this, F).getRowHeight(), "getRowHeight"));
|
|
426
426
|
S(this, "scrollToX", /* @__PURE__ */ h((t) => {
|
|
427
427
|
const s = this.querySelector(".ng-container-body");
|
|
428
428
|
s && (s.scrollLeft = t);
|
|
@@ -431,7 +431,7 @@ const ee = class ee extends HTMLElement {
|
|
|
431
431
|
const s = this.querySelector(".ng-container-body");
|
|
432
432
|
s && (s.scrollTop = t);
|
|
433
433
|
}, "scrollToY"));
|
|
434
|
-
g(this,
|
|
434
|
+
g(this, Q, /* @__PURE__ */ h(() => {
|
|
435
435
|
var l, a, d;
|
|
436
436
|
const t = this.querySelector(".ng-container-left table"), s = this.querySelector(".ng-container-body table"), r = this.querySelector(".ng-container-right table");
|
|
437
437
|
if (!s) return;
|
|
@@ -441,18 +441,18 @@ const ee = class ee extends HTMLElement {
|
|
|
441
441
|
((l = n[f]) == null ? void 0 : l.getBoundingClientRect().height) || 0,
|
|
442
442
|
((a = o[f]) == null ? void 0 : a.getBoundingClientRect().height) || 0,
|
|
443
443
|
((d = c[f]) == null ? void 0 : d.getBoundingClientRect().height) || 0
|
|
444
|
-
],
|
|
445
|
-
|
|
444
|
+
], m = Math.max(...b);
|
|
445
|
+
m > 0 && (n[f] && (n[f].style.height = `${m}px`), o[f] && (o[f].style.height = `${m}px`), c[f] && (c[f].style.height = `${m}px`));
|
|
446
446
|
}
|
|
447
447
|
}, "#syncRowHeights"));
|
|
448
|
-
g(this,
|
|
449
|
-
e(this,
|
|
448
|
+
g(this, de, /* @__PURE__ */ h(() => {
|
|
449
|
+
e(this, fe).call(this), new MutationObserver((t) => {
|
|
450
450
|
for (const s of t)
|
|
451
|
-
s.attributeName === "class" && this.classList.contains("active") && e(this,
|
|
451
|
+
s.attributeName === "class" && this.classList.contains("active") && e(this, Q).call(this);
|
|
452
452
|
}).observe(this, { attributes: !0 });
|
|
453
453
|
}, "#init"));
|
|
454
|
-
g(this,
|
|
455
|
-
const t =
|
|
454
|
+
g(this, fe, /* @__PURE__ */ h(() => {
|
|
455
|
+
const t = G.SCROLLBAR_SIZE;
|
|
456
456
|
this.innerHTML = `
|
|
457
457
|
<style>
|
|
458
458
|
nine-table-sheet {
|
|
@@ -575,38 +575,38 @@ const ee = class ee extends HTMLElement {
|
|
|
575
575
|
</div>
|
|
576
576
|
`;
|
|
577
577
|
}, "#render"));
|
|
578
|
-
y(this,
|
|
578
|
+
y(this, F, new Re(this));
|
|
579
579
|
}
|
|
580
580
|
connectedCallback() {
|
|
581
|
-
e(this,
|
|
581
|
+
e(this, de).call(this);
|
|
582
582
|
}
|
|
583
583
|
disconnectedCallback() {
|
|
584
|
-
this.innerHTML = "",
|
|
584
|
+
this.innerHTML = "", L.log("NineTableSheet destroyed.");
|
|
585
585
|
}
|
|
586
586
|
};
|
|
587
|
-
|
|
588
|
-
let
|
|
589
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
590
|
-
var
|
|
591
|
-
const
|
|
587
|
+
E = new WeakMap(), F = new WeakMap(), J = new WeakMap(), K = new WeakMap(), Q = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), h(G, "NineTableSheet"), S(G, "SCROLLBAR_SIZE", 16);
|
|
588
|
+
let re = G;
|
|
589
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", re);
|
|
590
|
+
var ue, ee;
|
|
591
|
+
const $e = class $e extends HTMLElement {
|
|
592
592
|
constructor() {
|
|
593
593
|
super();
|
|
594
|
-
g(this,
|
|
594
|
+
g(this, ue, /* @__PURE__ */ h(() => {
|
|
595
595
|
var t;
|
|
596
596
|
(t = this.querySelector(".nine-tab-bar")) == null || t.addEventListener("click", (s) => {
|
|
597
597
|
var o;
|
|
598
598
|
const r = s.ctrlKey || s.metaKey || s.shiftKey, n = parseInt((o = s.target.closest(".nine-tab-item")) == null ? void 0 : o.dataset.index, 10);
|
|
599
|
-
e(this,
|
|
600
|
-
}), e(this,
|
|
599
|
+
e(this, ee).call(this, n, r);
|
|
600
|
+
}), e(this, ee).call(this, 0, !1);
|
|
601
601
|
}, "#init"));
|
|
602
|
-
g(this,
|
|
602
|
+
g(this, ee, /* @__PURE__ */ h((t, s = !1) => {
|
|
603
603
|
const r = /* @__PURE__ */ h(() => {
|
|
604
604
|
const a = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
605
605
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((b) => b.style.setProperty("display", "none"));
|
|
606
606
|
const f = a.filter((b) => b.classList.contains("active"));
|
|
607
607
|
f.length < 2 || f.forEach((b) => {
|
|
608
|
-
const
|
|
609
|
-
v &&
|
|
608
|
+
const m = parseInt(b.getAttribute("data-index"), 10), v = this.querySelector(`nine-splitter[data-split-index="${m}"]`), C = a[m + 1];
|
|
609
|
+
v && C && C.classList.contains("active") && v.style.setProperty("display", "flex");
|
|
610
610
|
});
|
|
611
611
|
}, "updateSplitters"), n = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), c = n.querySelectorAll(".nine-tab-item"), u = o.querySelectorAll("nine-table-sheet");
|
|
612
612
|
if (!c[t]) return;
|
|
@@ -632,52 +632,36 @@ const Ne = class Ne extends HTMLElement {
|
|
|
632
632
|
}, "#switchSheet"));
|
|
633
633
|
}
|
|
634
634
|
connectedCallback() {
|
|
635
|
-
e(this,
|
|
635
|
+
e(this, ue).call(this);
|
|
636
636
|
}
|
|
637
637
|
};
|
|
638
|
-
|
|
639
|
-
let
|
|
640
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
641
|
-
var
|
|
642
|
-
const
|
|
638
|
+
ue = new WeakMap(), ee = new WeakMap(), h($e, "NineTableSheets");
|
|
639
|
+
let Ae = $e;
|
|
640
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Ae);
|
|
641
|
+
var ge, te;
|
|
642
|
+
const I = class I {
|
|
643
643
|
/**
|
|
644
|
-
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ
|
|
644
|
+
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
645
645
|
*/
|
|
646
646
|
static compileAll(i) {
|
|
647
|
-
return Array.isArray(i) ? i.map((t) =>
|
|
647
|
+
return Array.isArray(i) ? i.map((t) => I.compile(t)) : [];
|
|
648
648
|
}
|
|
649
649
|
/**
|
|
650
|
-
* π― λ¨μΌ μλ³Έ ν
μ΄λΈ
|
|
650
|
+
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
651
651
|
*/
|
|
652
652
|
static compile(i) {
|
|
653
|
-
var
|
|
653
|
+
var r, n, o;
|
|
654
654
|
if (!i) return null;
|
|
655
655
|
const t = i.cloneNode(!0);
|
|
656
|
-
e(
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
|
|
656
|
+
return e(r = I, ge).call(r, t), e(n = I, te).call(n, t, "thead"), e(o = I, te).call(o, t, "tbody"), Array.from(t.querySelectorAll("colgroup col")).forEach((c, u) => {
|
|
657
|
+
const l = c.getAttribute("fixed");
|
|
658
|
+
l && t.querySelectorAll(`[data-col="${u}"]`).forEach((a) => {
|
|
659
|
+
a.setAttribute("fixed", l);
|
|
660
660
|
});
|
|
661
|
-
});
|
|
662
|
-
const r = e(a = E, j).call(a, t, "left"), n = e(d = E, j).call(d, t, null), o = e(f = E, j).call(f, t, "right");
|
|
663
|
-
return {
|
|
664
|
-
masterTable: t,
|
|
665
|
-
left: {
|
|
666
|
-
table: r,
|
|
667
|
-
width: e(b = E, F).call(b, r)
|
|
668
|
-
},
|
|
669
|
-
body: {
|
|
670
|
-
table: n,
|
|
671
|
-
width: e(p = E, F).call(p, n)
|
|
672
|
-
},
|
|
673
|
-
right: {
|
|
674
|
-
table: o,
|
|
675
|
-
width: e(v = E, F).call(v, o)
|
|
676
|
-
}
|
|
677
|
-
};
|
|
661
|
+
}), t;
|
|
678
662
|
}
|
|
679
663
|
};
|
|
680
|
-
|
|
664
|
+
ge = new WeakMap(), te = new WeakMap(), h(I, "TableCompiler"), g(I, ge, /* @__PURE__ */ h((i) => {
|
|
681
665
|
if (!i.querySelector("colgroup")) {
|
|
682
666
|
const t = i.querySelector("tbody tr") || i.querySelector("tr"), s = t ? t.querySelectorAll("th, td").length : 1, r = document.createElement("colgroup"), n = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
683
667
|
for (let o = 0; o < s; o++) {
|
|
@@ -691,7 +675,7 @@ me = new WeakMap(), re = new WeakMap(), j = new WeakMap(), F = new WeakMap(), h(
|
|
|
691
675
|
s ? s.after(t) : i.prepend(t);
|
|
692
676
|
}
|
|
693
677
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
694
|
-
}, "#ensureTableStructure")), g(
|
|
678
|
+
}, "#ensureTableStructure")), g(I, te, /* @__PURE__ */ h((i, t) => {
|
|
695
679
|
const s = Array.from(i.querySelectorAll(t + " tr")), r = Array.from(i.querySelectorAll(t + " th," + t + " td")), n = s.length;
|
|
696
680
|
if (n === 0 || r.length === 0) return;
|
|
697
681
|
let o = 0;
|
|
@@ -703,15 +687,15 @@ me = new WeakMap(), re = new WeakMap(), j = new WeakMap(), F = new WeakMap(), h(
|
|
|
703
687
|
const l = u.sectionRowIndex;
|
|
704
688
|
let a = 0;
|
|
705
689
|
Array.from(u.querySelectorAll("th,td")).forEach((d) => {
|
|
706
|
-
for (let
|
|
707
|
-
if (c[l][
|
|
708
|
-
a =
|
|
690
|
+
for (let m = 0; m < c[l].length; m++)
|
|
691
|
+
if (c[l][m] === null) {
|
|
692
|
+
a = m;
|
|
709
693
|
break;
|
|
710
694
|
}
|
|
711
695
|
const f = d.rowSpan || 1, b = d.colSpan || 1;
|
|
712
|
-
for (let
|
|
696
|
+
for (let m = 0; m < f; m++)
|
|
713
697
|
for (let v = 0; v < b; v++)
|
|
714
|
-
l +
|
|
698
|
+
l + m < n && a + v < o && (c[l + m][a + v] = m === 0 && v === 0 ? "1" : "0");
|
|
715
699
|
});
|
|
716
700
|
}), s.forEach((u) => {
|
|
717
701
|
const l = u.sectionRowIndex;
|
|
@@ -723,41 +707,26 @@ me = new WeakMap(), re = new WeakMap(), j = new WeakMap(), F = new WeakMap(), h(
|
|
|
723
707
|
}
|
|
724
708
|
});
|
|
725
709
|
});
|
|
726
|
-
}, "#resetColIndex"))
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
}) : t === "right" ? s.querySelectorAll("col, th, td").forEach((r) => {
|
|
731
|
-
r.getAttribute("fixed") !== "right" && r.remove();
|
|
732
|
-
}) : s.querySelectorAll("[fixed=left], [fixed=right]").forEach((r) => {
|
|
733
|
-
r.remove();
|
|
734
|
-
}), s;
|
|
735
|
-
}, "#createSplitTable")), g(E, F, /* @__PURE__ */ h((i) => {
|
|
736
|
-
let t = 0;
|
|
737
|
-
return i.querySelectorAll("col").forEach((s) => {
|
|
738
|
-
const r = parseInt(s.getAttribute("width"), 10);
|
|
739
|
-
isNaN(r) || (t += r);
|
|
740
|
-
}), t;
|
|
741
|
-
}, "#calculateTableWidth"));
|
|
742
|
-
let Ce = E;
|
|
743
|
-
var R, we, ne, xe;
|
|
744
|
-
const Be = class Be {
|
|
710
|
+
}, "#resetColIndex"));
|
|
711
|
+
let qe = I;
|
|
712
|
+
var R, be, ie, ye;
|
|
713
|
+
const We = class We {
|
|
745
714
|
constructor(i) {
|
|
746
715
|
g(this, R);
|
|
747
|
-
g(this,
|
|
748
|
-
e(this,
|
|
716
|
+
g(this, be, /* @__PURE__ */ h(() => {
|
|
717
|
+
e(this, ye).call(this), new ResizeObserver((i) => {
|
|
749
718
|
for (let t of i)
|
|
750
|
-
e(this, R).getAttribute("auto-height") === "true" && e(this,
|
|
719
|
+
e(this, R).getAttribute("auto-height") === "true" && e(this, ie).call(this);
|
|
751
720
|
}).observe(e(this, R));
|
|
752
721
|
}, "#init"));
|
|
753
|
-
g(this,
|
|
722
|
+
g(this, ie, /* @__PURE__ */ h(() => {
|
|
754
723
|
var u, l;
|
|
755
724
|
const i = Array.from(e(this, R).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
756
725
|
if (i.length === 0) return;
|
|
757
|
-
const t = parseInt(e(this, R).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((a) => a.getRowHeight())), r = (u = e(this, R).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : u.getBoundingClientRect().height, n = (l = e(this, R).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, o =
|
|
726
|
+
const t = parseInt(e(this, R).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((a) => a.getRowHeight())), r = (u = e(this, R).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : u.getBoundingClientRect().height, n = (l = e(this, R).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, o = re.SCROLLBAR_SIZE, c = t * s + r + n + o;
|
|
758
727
|
e(this, R).style.height = `${c}px`;
|
|
759
728
|
}, "#applyAutoHeight"));
|
|
760
|
-
g(this,
|
|
729
|
+
g(this, ye, /* @__PURE__ */ h(() => {
|
|
761
730
|
const t = Array.from(e(this, R).children).filter((l) => l.tagName === "TABLE"), s = e(this, R).getAttribute("auto-height") === "true", r = t.length, n = t.map((l, a) => {
|
|
762
731
|
const f = `<nine-table-sheet class="${a === 0 ? "active" : ""}" data-index="${a}"></nine-table-sheet>`, b = a < r - 1 ? `<nine-splitter class="h" data-split-index="${a}"></nine-splitter>` : "";
|
|
763
732
|
return f + b;
|
|
@@ -861,20 +830,20 @@ const Be = class Be {
|
|
|
861
830
|
</nine-table-body>
|
|
862
831
|
<nine-table-footer></nine-table-footer>
|
|
863
832
|
`;
|
|
864
|
-
const c = e(this, R).shadowRoot.querySelectorAll("nine-table-sheet"), u =
|
|
865
|
-
|
|
833
|
+
const c = e(this, R).shadowRoot.querySelectorAll("nine-table-sheet"), u = qe.compileAll(t);
|
|
834
|
+
L.log("==================="), L.log(u), L.log("==================="), c == null || c.forEach((l, a) => {
|
|
866
835
|
t[a] && setTimeout(() => {
|
|
867
|
-
l.generate(t[a]), s && e(this,
|
|
836
|
+
l.generate(t[a]), s && e(this, ie).call(this);
|
|
868
837
|
});
|
|
869
838
|
});
|
|
870
839
|
}, "#render"));
|
|
871
|
-
y(this, R, i), e(this,
|
|
840
|
+
y(this, R, i), e(this, be).call(this);
|
|
872
841
|
}
|
|
873
842
|
};
|
|
874
|
-
R = new WeakMap(),
|
|
875
|
-
let
|
|
843
|
+
R = new WeakMap(), be = new WeakMap(), ie = new WeakMap(), ye = new WeakMap(), h(We, "LayoutManager");
|
|
844
|
+
let Te = We;
|
|
876
845
|
var O, Y;
|
|
877
|
-
const
|
|
846
|
+
const ze = class ze {
|
|
878
847
|
constructor(i) {
|
|
879
848
|
g(this, O);
|
|
880
849
|
g(this, Y, -1);
|
|
@@ -894,50 +863,50 @@ const De = class De {
|
|
|
894
863
|
});
|
|
895
864
|
}
|
|
896
865
|
};
|
|
897
|
-
O = new WeakMap(), Y = new WeakMap(), h(
|
|
898
|
-
let
|
|
899
|
-
var
|
|
900
|
-
const
|
|
866
|
+
O = new WeakMap(), Y = new WeakMap(), h(ze, "ngRow");
|
|
867
|
+
let ke = ze;
|
|
868
|
+
var q, x, T, Z, pe, B, me, se, we, xe, j;
|
|
869
|
+
const k = class k {
|
|
901
870
|
constructor(i, t) {
|
|
902
|
-
g(this,
|
|
871
|
+
g(this, q);
|
|
903
872
|
g(this, x);
|
|
904
|
-
g(this,
|
|
905
|
-
g(this,
|
|
906
|
-
g(this,
|
|
907
|
-
g(this,
|
|
908
|
-
g(this,
|
|
909
|
-
y(this,
|
|
910
|
-
const i = e(this,
|
|
873
|
+
g(this, T, []);
|
|
874
|
+
g(this, Z, []);
|
|
875
|
+
g(this, pe, 0);
|
|
876
|
+
g(this, B, []);
|
|
877
|
+
g(this, me, /* @__PURE__ */ h(() => {
|
|
878
|
+
y(this, B, []);
|
|
879
|
+
const i = e(this, q).template || [];
|
|
911
880
|
Array.from(i).forEach((t) => {
|
|
912
881
|
var s;
|
|
913
|
-
e(this,
|
|
882
|
+
e(this, B).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
914
883
|
}), (e(this, x).rawRecords || []).forEach((t) => {
|
|
915
|
-
t.__ng || (t.__ng = e(this,
|
|
884
|
+
t.__ng || (t.__ng = e(this, se).call(this)), t.__ng.height = e(this, B).slice();
|
|
916
885
|
});
|
|
917
886
|
}, "#initialize"));
|
|
918
887
|
S(this, "set", /* @__PURE__ */ h((i) => {
|
|
919
888
|
this.clear(), this.add(i, !1);
|
|
920
889
|
}, "set"));
|
|
921
|
-
g(this,
|
|
922
|
-
rowState:
|
|
890
|
+
g(this, se, /* @__PURE__ */ h(() => ({
|
|
891
|
+
rowState: k.ROW_STATE.EMPTY,
|
|
923
892
|
deleted: !1,
|
|
924
893
|
filtered: !1,
|
|
925
|
-
height: e(this,
|
|
894
|
+
height: e(this, B).slice(),
|
|
926
895
|
o: {},
|
|
927
896
|
c: {},
|
|
928
|
-
_: [0, 0, 0, 0,
|
|
897
|
+
_: [0, 0, 0, 0, k.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, B).slice(), -1, {}, {}]
|
|
929
898
|
}), "#getDefaultMeta"));
|
|
930
899
|
S(this, "reset", /* @__PURE__ */ h(() => {
|
|
931
|
-
y(this,
|
|
900
|
+
y(this, T, []), y(this, Z, []);
|
|
932
901
|
}, "reset"));
|
|
933
902
|
S(this, "clear", /* @__PURE__ */ h(() => {
|
|
934
903
|
var i;
|
|
935
|
-
e(this, x).rawRecords = [], y(this,
|
|
904
|
+
e(this, x).rawRecords = [], y(this, T, []), y(this, Z, []), (i = e(this, x).viewRecords) != null && i.reset && e(this, x).viewRecords.reset();
|
|
936
905
|
}, "clear"));
|
|
937
|
-
g(this,
|
|
906
|
+
g(this, we, /* @__PURE__ */ h((i) => {
|
|
938
907
|
var r;
|
|
939
908
|
Array.isArray(i) || (i = [i]);
|
|
940
|
-
const t = typeof ((r = e(this,
|
|
909
|
+
const t = typeof ((r = e(this, q).fields) == null ? void 0 : r.get) == "function" ? e(this, q).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
941
910
|
return i.forEach((n) => {
|
|
942
911
|
const o = { v: [] };
|
|
943
912
|
t.forEach((c) => {
|
|
@@ -945,28 +914,28 @@ const C = class C {
|
|
|
945
914
|
}), s.push(o);
|
|
946
915
|
}), s;
|
|
947
916
|
}, "#json2Array"));
|
|
948
|
-
g(this,
|
|
949
|
-
t.__ng = e(this,
|
|
917
|
+
g(this, xe, /* @__PURE__ */ h((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
918
|
+
t.__ng = e(this, se).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = k.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
950
919
|
}), i), "#defaultInsert"));
|
|
951
920
|
S(this, "add", /* @__PURE__ */ h((i, t = !0) => {
|
|
952
921
|
var n;
|
|
953
922
|
i === void 0 && (i = {});
|
|
954
|
-
const s = e(this,
|
|
955
|
-
e(this, x).rawRecords = e(this, x).rawRecords.concat(e(this,
|
|
923
|
+
const s = e(this, we).call(this, i);
|
|
924
|
+
e(this, x).rawRecords = e(this, x).rawRecords.concat(e(this, xe).call(this, s)), this.resetRecords();
|
|
956
925
|
const r = this.count() - 1;
|
|
957
926
|
return t || s.forEach((o, c) => {
|
|
958
927
|
const u = e(this, x).rawRecords[r - c];
|
|
959
|
-
u && (u.__ng.rowState =
|
|
928
|
+
u && (u.__ng.rowState = k.ROW_STATE.EMPTY);
|
|
960
929
|
}), (n = e(this, x).viewRecords) != null && n.reset && e(this, x).viewRecords.reset(), r;
|
|
961
930
|
}, "add"));
|
|
962
931
|
S(this, "delete", /* @__PURE__ */ h((i) => {
|
|
963
932
|
var s;
|
|
964
933
|
let t = [];
|
|
965
934
|
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, x).owner.row.at] : t = [parseInt(i, 10)], t.sort((r, n) => n - r).forEach((r) => {
|
|
966
|
-
if (e(this,
|
|
967
|
-
const n = e(this,
|
|
968
|
-
e(this,
|
|
969
|
-
o.__ng.rowid === n && (o.__ng.deleted = !0, o.__ng.rowState =
|
|
935
|
+
if (e(this, T)[r]) {
|
|
936
|
+
const n = e(this, T)[r].__ng.rowid;
|
|
937
|
+
e(this, T)[r].__ng.rowState === k.ROW_STATE.INSERT ? e(this, x).rawRecords = e(this, x).rawRecords.filter((o) => o.__ng.rowid !== n) : e(this, x).rawRecords.forEach((o) => {
|
|
938
|
+
o.__ng.rowid === n && (o.__ng.deleted = !0, o.__ng.rowState = k.ROW_STATE.DELETE);
|
|
970
939
|
});
|
|
971
940
|
}
|
|
972
941
|
}), this.resetRecords(), (s = e(this, x).viewRecords) != null && s.reset && e(this, x).viewRecords.reset();
|
|
@@ -974,25 +943,25 @@ const C = class C {
|
|
|
974
943
|
S(this, "setValue", /* @__PURE__ */ h((i, t, s) => {
|
|
975
944
|
var u;
|
|
976
945
|
i = parseInt(i, 10);
|
|
977
|
-
const n = (typeof ((u = e(this,
|
|
946
|
+
const n = (typeof ((u = e(this, q).fields) == null ? void 0 : u.get) == "function" ? e(this, q).fields.get() : []).indexOf(t);
|
|
978
947
|
if (n < 0) return;
|
|
979
948
|
const o = this.getValidData()[i];
|
|
980
949
|
if (!o) return;
|
|
981
950
|
const c = o.v[n];
|
|
982
|
-
c !== s && o.__ng.rowState !==
|
|
951
|
+
c !== s && o.__ng.rowState !== k.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(t) || (o.__ng.o[t] = c), o.__ng.rowState = k.ROW_STATE.UPDATE), o.v[n] = s, e(this, x).owner.refreshData && e(this, x).owner.refreshData(i);
|
|
983
952
|
}, "setValue"));
|
|
984
953
|
S(this, "resetRecords", /* @__PURE__ */ h(() => {
|
|
985
|
-
y(this,
|
|
954
|
+
y(this, Z, e(this, x).rawRecords.filter((i) => !i.__ng.deleted)), y(this, T, e(this, x).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, x).rawRecords.forEach((i, t) => {
|
|
986
955
|
i.__ng.rowidx = t;
|
|
987
|
-
}), e(this,
|
|
956
|
+
}), e(this, T).forEach((i, t) => {
|
|
988
957
|
i.__ng.i = t;
|
|
989
958
|
});
|
|
990
959
|
}, "resetRecords"));
|
|
991
|
-
S(this, "getValidData", /* @__PURE__ */ h(() => (e(this,
|
|
992
|
-
g(this,
|
|
960
|
+
S(this, "getValidData", /* @__PURE__ */ h(() => (e(this, T).length === 0 && e(this, x).rawRecords.length > 0 && this.resetRecords(), e(this, T)), "getValidData"));
|
|
961
|
+
g(this, j, /* @__PURE__ */ h((i) => {
|
|
993
962
|
var s;
|
|
994
963
|
if (!i) return i;
|
|
995
|
-
const t = typeof ((s = e(this,
|
|
964
|
+
const t = typeof ((s = e(this, q).fields) == null ? void 0 : s.get) == "function" ? e(this, q).fields.get() : [];
|
|
996
965
|
return Array.isArray(i) ? i.filter((r) => !r.__ng.deleted).map((r) => {
|
|
997
966
|
const n = {};
|
|
998
967
|
return t.forEach((o, c) => {
|
|
@@ -1005,45 +974,45 @@ const C = class C {
|
|
|
1005
974
|
var n;
|
|
1006
975
|
const s = this.getValidData();
|
|
1007
976
|
if (!s || s.length <= 0) return;
|
|
1008
|
-
if (i == null) return e(this,
|
|
977
|
+
if (i == null) return e(this, j).call(this, s);
|
|
1009
978
|
if (i < 0 || i >= s.length) return null;
|
|
1010
|
-
const r = typeof ((n = e(this,
|
|
979
|
+
const r = typeof ((n = e(this, q).fields) == null ? void 0 : n.get) == "function" ? e(this, q).fields.get() : [];
|
|
1011
980
|
if (t != null) {
|
|
1012
981
|
const o = r.indexOf(t);
|
|
1013
982
|
return o >= 0 ? s[i].v[o] : null;
|
|
1014
983
|
}
|
|
1015
|
-
return e(this,
|
|
984
|
+
return e(this, j).call(this, s[i]);
|
|
1016
985
|
}, "get"));
|
|
1017
|
-
y(this,
|
|
986
|
+
y(this, q, i), y(this, x, t), e(this, me).call(this);
|
|
1018
987
|
}
|
|
1019
988
|
get source() {
|
|
1020
|
-
return e(this,
|
|
989
|
+
return e(this, j).call(this, e(this, x).rawRecords);
|
|
1021
990
|
}
|
|
1022
991
|
set source(i) {
|
|
1023
992
|
this.clear(), this.add(i, !1);
|
|
1024
993
|
}
|
|
1025
994
|
get nextId() {
|
|
1026
|
-
return ++
|
|
995
|
+
return ++Ye(this, pe)._;
|
|
1027
996
|
}
|
|
1028
997
|
get length() {
|
|
1029
|
-
return e(this,
|
|
998
|
+
return e(this, T).length;
|
|
1030
999
|
}
|
|
1031
1000
|
getRowCount() {
|
|
1032
1001
|
return this.length;
|
|
1033
1002
|
}
|
|
1034
1003
|
};
|
|
1035
|
-
|
|
1036
|
-
S(
|
|
1004
|
+
q = new WeakMap(), x = new WeakMap(), T = new WeakMap(), Z = new WeakMap(), pe = new WeakMap(), B = new WeakMap(), me = new WeakMap(), se = new WeakMap(), we = new WeakMap(), xe = new WeakMap(), j = new WeakMap(), h(k, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1005
|
+
S(k, "ROW_STATE", {
|
|
1037
1006
|
EMPTY: "EMPTY",
|
|
1038
1007
|
NORMAL: "NORMAL",
|
|
1039
1008
|
INSERT: "INSERT",
|
|
1040
1009
|
UPDATE: "UPDATE",
|
|
1041
1010
|
DELETE: "DELETE"
|
|
1042
1011
|
});
|
|
1043
|
-
let
|
|
1044
|
-
const
|
|
1012
|
+
let Le = k;
|
|
1013
|
+
const Oe = class Oe {
|
|
1045
1014
|
constructor(i) {
|
|
1046
|
-
this.owner = i, this.row = new
|
|
1015
|
+
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 = () => {
|
|
1047
1016
|
var t;
|
|
1048
1017
|
(t = this.owner.view) != null && t.redraw && this.owner.view.redraw();
|
|
1049
1018
|
}, this.setDataSource = (t) => {
|
|
@@ -1060,22 +1029,22 @@ const Pe = class Pe {
|
|
|
1060
1029
|
}, this.setDataSource([]);
|
|
1061
1030
|
}
|
|
1062
1031
|
};
|
|
1063
|
-
h(
|
|
1064
|
-
let
|
|
1065
|
-
var U,
|
|
1066
|
-
const
|
|
1032
|
+
h(Oe, "ngDataManager");
|
|
1033
|
+
let Ce = Oe;
|
|
1034
|
+
var U, ve;
|
|
1035
|
+
const Be = class Be extends HTMLElement {
|
|
1067
1036
|
constructor() {
|
|
1068
1037
|
super();
|
|
1069
1038
|
//#created = false;
|
|
1070
1039
|
g(this, U);
|
|
1071
|
-
g(this,
|
|
1072
|
-
this.attachShadow({ mode: "open" }), y(this, U, new
|
|
1040
|
+
g(this, ve);
|
|
1041
|
+
this.attachShadow({ mode: "open" }), y(this, U, new Ce(this));
|
|
1073
1042
|
}
|
|
1074
1043
|
connectedCallback() {
|
|
1075
|
-
y(this,
|
|
1044
|
+
y(this, ve, new Te(this)), L.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1076
1045
|
}
|
|
1077
1046
|
disconnectedCallback() {
|
|
1078
|
-
|
|
1047
|
+
L.log("NineTable disconnected.");
|
|
1079
1048
|
}
|
|
1080
1049
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1081
1050
|
get data() {
|
|
@@ -1090,7 +1059,7 @@ const Ve = class Ve extends HTMLElement {
|
|
|
1090
1059
|
return e(this, U);
|
|
1091
1060
|
}
|
|
1092
1061
|
};
|
|
1093
|
-
U = new WeakMap(),
|
|
1094
|
-
let
|
|
1095
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
1062
|
+
U = new WeakMap(), ve = new WeakMap(), h(Be, "NineTable");
|
|
1063
|
+
let _e = Be;
|
|
1064
|
+
customElements.get("nine-table") || customElements.define("nine-table", _e);
|
|
1096
1065
|
//# sourceMappingURL=nine-table.js.map
|