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