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