@ninebone/table 0.0.286 β 0.0.288
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 +324 -288
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +4 -4
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Xt = Object.defineProperty;
|
|
2
|
+
var Yt = (p) => {
|
|
3
3
|
throw TypeError(p);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var a = (p, i) =>
|
|
7
|
-
var x = (p, i,
|
|
8
|
-
var
|
|
9
|
-
var
|
|
5
|
+
var Ft = (p, i, e) => i in p ? Xt(p, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : p[i] = e;
|
|
6
|
+
var a = (p, i) => Xt(p, "name", { value: i, configurable: !0 });
|
|
7
|
+
var x = (p, i, e) => Ft(p, typeof i != "symbol" ? i + "" : i, e), Kt = (p, i, e) => i.has(p) || Yt("Cannot " + e);
|
|
8
|
+
var t = (p, i, e) => (Kt(p, i, "read from private field"), e ? e.call(p) : i.get(p)), c = (p, i, e) => i.has(p) ? Yt("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(p) : i.set(p, e), g = (p, i, e, s) => (Kt(p, i, "write to private field"), s ? s.call(p, e) : i.set(p, e), e);
|
|
9
|
+
var Ut = (p, i, e, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
|
-
g(p, i, n,
|
|
11
|
+
g(p, i, n, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return
|
|
14
|
+
return t(p, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
import { trace as
|
|
18
|
-
const
|
|
17
|
+
import { trace as Zt } from "@ninebone/util";
|
|
18
|
+
const $t = class $t extends Zt.constructor {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
a(
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
var k,
|
|
27
|
-
const
|
|
23
|
+
a($t, "Trace");
|
|
24
|
+
let At = $t;
|
|
25
|
+
const F = new At();
|
|
26
|
+
var k, I, b, W, O, D, st, z, nt;
|
|
27
|
+
const Wt = class Wt extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
c(this, k);
|
|
31
|
-
c(this,
|
|
31
|
+
c(this, I, !1);
|
|
32
32
|
c(this, b);
|
|
33
33
|
c(this, W);
|
|
34
34
|
c(this, O);
|
|
35
|
-
c(this,
|
|
36
|
-
c(this,
|
|
37
|
-
if (!
|
|
38
|
-
const
|
|
39
|
-
|
|
35
|
+
c(this, D);
|
|
36
|
+
c(this, st, /* @__PURE__ */ a(() => {
|
|
37
|
+
if (!t(this, k)) return;
|
|
38
|
+
const e = t(this, k).querySelector(".ng-container-body");
|
|
39
|
+
e && (g(this, D, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})),
|
|
41
|
+
})), t(this, D).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
x(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!
|
|
45
|
-
const
|
|
44
|
+
if (!t(this, k) || !t(this, b) || t(this, I)) return;
|
|
45
|
+
const e = t(this, b).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n =
|
|
47
|
+
const n = t(this, b).track, r = t(this, b).thumb, o = t(this, k).querySelector(".ng-container-bottom"), l = e.clientWidth, h = s.scrollWidth;
|
|
48
48
|
if (l !== 0 && h > l)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -55,64 +55,64 @@ const Me = class Me extends HTMLElement {
|
|
|
55
55
|
if (d <= 0) return;
|
|
56
56
|
const u = Math.max(Math.min(d * (l / h), d), 20);
|
|
57
57
|
r.style.width = `${u}px`;
|
|
58
|
-
const f =
|
|
58
|
+
const f = e.scrollLeft, y = h - l;
|
|
59
59
|
let w = 0;
|
|
60
60
|
y > 0 && (w = parseInt(f / y * (d - u), 10)), w < 0 && (w = 0);
|
|
61
61
|
const v = d - u;
|
|
62
|
-
w > v && (w = v), r.style.left = `${w}px`,
|
|
62
|
+
w > v && (w = v), r.style.left = `${w}px`, F.log(w), t(this, b).left.disabled = w === 0, t(this, b).right.disabled = w >= v - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
c(this,
|
|
65
|
-
if (!
|
|
66
|
-
const s =
|
|
64
|
+
c(this, z, /* @__PURE__ */ a((e) => {
|
|
65
|
+
if (!t(this, b)) return !1;
|
|
66
|
+
const s = t(this, b).container, n = s.querySelector("table");
|
|
67
67
|
if (!n) return !1;
|
|
68
|
-
const r =
|
|
69
|
-
let l =
|
|
68
|
+
const r = t(this, b).track.getBoundingClientRect(), o = t(this, b).thumb.clientWidth;
|
|
69
|
+
let l = e;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
71
|
const h = r.width - o;
|
|
72
|
-
l > h && (l = h), l = parseInt(l, 10),
|
|
72
|
+
l > h && (l = h), l = parseInt(l, 10), t(this, b).thumb.style.left = `${l}px`, t(this, b).left.disabled = l === 0, t(this, b).right.disabled = l >= h - 1;
|
|
73
73
|
const d = s.clientWidth, f = n.scrollWidth - d;
|
|
74
74
|
return h > 0 && f > 0 && (s.scrollLeft = l / h * f), l > 0 && l < h - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
|
-
c(this,
|
|
77
|
-
const
|
|
78
|
-
clearInterval(
|
|
79
|
-
const r = parseInt(
|
|
80
|
-
|
|
81
|
-
clearInterval(
|
|
82
|
-
const o = parseInt(
|
|
83
|
-
|
|
76
|
+
c(this, nt, /* @__PURE__ */ a(() => {
|
|
77
|
+
const e = /* @__PURE__ */ a((n) => {
|
|
78
|
+
clearInterval(t(this, W)), clearInterval(t(this, O));
|
|
79
|
+
const r = parseInt(t(this, b).thumb.style.left || 0, 10);
|
|
80
|
+
t(this, z).call(this, r + n), g(this, W, setInterval(() => {
|
|
81
|
+
clearInterval(t(this, W)), g(this, O, setInterval(() => {
|
|
82
|
+
const o = parseInt(t(this, b).thumb.style.left || 0, 10);
|
|
83
|
+
t(this, z).call(this, o + n) || clearInterval(t(this, O));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
87
|
-
clearInterval(
|
|
87
|
+
clearInterval(t(this, W)), clearInterval(t(this, O));
|
|
88
88
|
}, "clearTimer");
|
|
89
89
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
90
|
-
|
|
91
|
-
}),
|
|
92
|
-
n.button === 0 &&
|
|
93
|
-
}),
|
|
94
|
-
n.button === 0 &&
|
|
95
|
-
}),
|
|
90
|
+
t(this, b).left.addEventListener(n, s), t(this, b).right.addEventListener(n, s), t(this, b).track.addEventListener(n, s);
|
|
91
|
+
}), t(this, b).left.addEventListener("mousedown", (n) => {
|
|
92
|
+
n.button === 0 && e(-20);
|
|
93
|
+
}), t(this, b).right.addEventListener("mousedown", (n) => {
|
|
94
|
+
n.button === 0 && e(20);
|
|
95
|
+
}), t(this, b).left.addEventListener("touchstart", () => e(-20)), t(this, b).right.addEventListener("touchstart", () => e(20)), t(this, b).track.addEventListener("mousedown", (n) => {
|
|
96
96
|
if (n.button !== 0) return;
|
|
97
97
|
n.preventDefault();
|
|
98
|
-
const r =
|
|
99
|
-
|
|
100
|
-
}),
|
|
98
|
+
const r = t(this, b).track.getBoundingClientRect(), o = t(this, b).thumb.clientWidth;
|
|
99
|
+
t(this, z).call(this, n.clientX - r.left - o / 2);
|
|
100
|
+
}), t(this, b).thumb.addEventListener("mousedown", (n) => {
|
|
101
101
|
if (n.button !== 0) return;
|
|
102
|
-
n.stopPropagation(), n.preventDefault(), g(this,
|
|
102
|
+
n.stopPropagation(), n.preventDefault(), g(this, I, !0), this.shiftX = n.clientX - t(this, b).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ a((l) => {
|
|
104
|
-
if (!
|
|
105
|
-
const h =
|
|
106
|
-
|
|
104
|
+
if (!t(this, I)) return;
|
|
105
|
+
const h = t(this, b).track.getBoundingClientRect();
|
|
106
|
+
t(this, z).call(this, l.clientX - h.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
108
|
-
g(this,
|
|
108
|
+
g(this, I, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
110
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
111
111
|
});
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (g(this, k, this.closest("nine-table-sheet") || this.getRootNode().host), !
|
|
115
|
+
if (g(this, k, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, k)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -176,10 +176,10 @@ const Me = class Me extends HTMLElement {
|
|
|
176
176
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
177
177
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
178
178
|
`;
|
|
179
|
-
const
|
|
180
|
-
const s =
|
|
179
|
+
const e = /* @__PURE__ */ a(() => {
|
|
180
|
+
const s = t(this, k).querySelector(".ng-container-body");
|
|
181
181
|
if (!s) {
|
|
182
|
-
setTimeout(
|
|
182
|
+
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
g(this, b, {
|
|
@@ -189,25 +189,25 @@ const Me = class Me extends HTMLElement {
|
|
|
189
189
|
left: this.querySelector(".ng-scroll-left"),
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), s.addEventListener("scroll", () => {
|
|
192
|
-
|
|
193
|
-
}),
|
|
192
|
+
t(this, I) || this.refresh();
|
|
193
|
+
}), t(this, nt).call(this), t(this, st).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
|
-
|
|
195
|
+
e();
|
|
196
196
|
}
|
|
197
197
|
disconnectedCallback() {
|
|
198
|
-
|
|
198
|
+
t(this, D) && t(this, D).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
k = new WeakMap(),
|
|
202
|
-
let
|
|
203
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar",
|
|
204
|
-
var
|
|
201
|
+
k = new WeakMap(), I = new WeakMap(), b = new WeakMap(), W = new WeakMap(), O = new WeakMap(), D = new WeakMap(), st = new WeakMap(), z = new WeakMap(), nt = new WeakMap(), a(Wt, "NineTableHScrollBar");
|
|
202
|
+
let qt = Wt;
|
|
203
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", qt);
|
|
204
|
+
var rt, j;
|
|
205
205
|
const L = class L {
|
|
206
206
|
/**
|
|
207
207
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
208
208
|
*/
|
|
209
209
|
static compileAll(i) {
|
|
210
|
-
return Array.isArray(i) ? i.map((
|
|
210
|
+
return Array.isArray(i) ? i.map((e) => L.compile(e)) : [];
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
213
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
@@ -215,18 +215,18 @@ const L = class L {
|
|
|
215
215
|
static compile(i) {
|
|
216
216
|
var n, r, o;
|
|
217
217
|
if (!i) return null;
|
|
218
|
-
const
|
|
219
|
-
return
|
|
218
|
+
const e = i.cloneNode(!0);
|
|
219
|
+
return t(n = L, rt).call(n, e), t(r = L, j).call(r, e, "thead"), t(o = L, j).call(o, e, "tbody"), Array.from(e.querySelectorAll("colgroup col")).forEach((l, h) => {
|
|
220
220
|
const d = l.getAttribute("fixed");
|
|
221
|
-
d &&
|
|
221
|
+
d && e.querySelectorAll(`[data-col="${h}"]`).forEach((u) => {
|
|
222
222
|
u.setAttribute("fixed", d);
|
|
223
223
|
});
|
|
224
|
-
}),
|
|
224
|
+
}), e;
|
|
225
225
|
}
|
|
226
226
|
};
|
|
227
|
-
|
|
227
|
+
rt = new WeakMap(), j = new WeakMap(), a(L, "TableCompiler"), c(L, rt, /* @__PURE__ */ a((i) => {
|
|
228
228
|
if (!i.querySelector("colgroup")) {
|
|
229
|
-
const
|
|
229
|
+
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
230
230
|
for (let o = 0; o < s; o++) {
|
|
231
231
|
const l = document.createElement("col");
|
|
232
232
|
l.setAttribute("width", r), n.appendChild(l);
|
|
@@ -234,12 +234,12 @@ re = new WeakMap(), j = new WeakMap(), a(L, "TableCompiler"), c(L, re, /* @__PUR
|
|
|
234
234
|
i.prepend(n);
|
|
235
235
|
}
|
|
236
236
|
if (!i.querySelector("thead")) {
|
|
237
|
-
const
|
|
238
|
-
s ? s.after(
|
|
237
|
+
const e = document.createElement("thead"), s = i.querySelector("colgroup");
|
|
238
|
+
s ? s.after(e) : i.prepend(e);
|
|
239
239
|
}
|
|
240
240
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
241
|
-
}, "#ensureTableStructure")), c(L, j, /* @__PURE__ */ a((i,
|
|
242
|
-
const s = Array.from(i.querySelectorAll(
|
|
241
|
+
}, "#ensureTableStructure")), c(L, j, /* @__PURE__ */ a((i, e) => {
|
|
242
|
+
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
243
243
|
if (r === 0 || n.length === 0) return;
|
|
244
244
|
let o = 0;
|
|
245
245
|
n.forEach((h) => {
|
|
@@ -257,8 +257,8 @@ re = new WeakMap(), j = new WeakMap(), a(L, "TableCompiler"), c(L, re, /* @__PUR
|
|
|
257
257
|
}
|
|
258
258
|
const y = f.rowSpan || 1, w = f.colSpan || 1;
|
|
259
259
|
for (let v = 0; v < y; v++)
|
|
260
|
-
for (let
|
|
261
|
-
d + v < r && u +
|
|
260
|
+
for (let _ = 0; _ < w; _++)
|
|
261
|
+
d + v < r && u + _ < o && (l[d + v][u + _] = v === 0 && _ === 0 ? "1" : "0");
|
|
262
262
|
});
|
|
263
263
|
}), s.forEach((h) => {
|
|
264
264
|
const d = h.sectionRowIndex;
|
|
@@ -271,14 +271,14 @@ re = new WeakMap(), j = new WeakMap(), a(L, "TableCompiler"), c(L, re, /* @__PUR
|
|
|
271
271
|
});
|
|
272
272
|
});
|
|
273
273
|
}, "#resetColIndex"));
|
|
274
|
-
let
|
|
275
|
-
var
|
|
276
|
-
const
|
|
274
|
+
let Tt = L;
|
|
275
|
+
var S, C, E, H, B, N, ot, lt, G, at, ct, J, ht, dt;
|
|
276
|
+
const Ot = class Ot {
|
|
277
277
|
constructor(i) {
|
|
278
|
-
c(this,
|
|
279
|
-
c(this,
|
|
278
|
+
c(this, S);
|
|
279
|
+
c(this, C, /* @__PURE__ */ new Map());
|
|
280
280
|
// κ° μ»¨ν
μ΄λλ³ λ
립λ ν
νλ¦Ώ TR κ΄λ¦¬
|
|
281
|
-
c(this,
|
|
281
|
+
c(this, E, null);
|
|
282
282
|
c(this, H, null);
|
|
283
283
|
c(this, B, 0);
|
|
284
284
|
c(this, N, 40);
|
|
@@ -287,27 +287,35 @@ const $e = class $e {
|
|
|
287
287
|
*/
|
|
288
288
|
// [RowManager.js μμ λ΄μ© λ°μ·]
|
|
289
289
|
x(this, "initialize", /* @__PURE__ */ a(() => {
|
|
290
|
-
g(this,
|
|
291
|
-
const s =
|
|
290
|
+
g(this, E, null), t(this, C).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
291
|
+
const s = t(this, S).querySelector(e);
|
|
292
292
|
if (!s) return;
|
|
293
293
|
const n = s.querySelector("table");
|
|
294
294
|
if (!n) return;
|
|
295
295
|
const r = n.querySelector("tbody");
|
|
296
296
|
if (!r) return;
|
|
297
297
|
const l = Array.from(r.querySelectorAll("tr")).map((h) => h.cloneNode(!0));
|
|
298
|
-
|
|
298
|
+
t(this, C).set(e, l);
|
|
299
299
|
});
|
|
300
|
-
const i =
|
|
301
|
-
|
|
300
|
+
const i = t(this, S).querySelector(".ng-container-body");
|
|
301
|
+
if (i) {
|
|
302
|
+
t(this, lt).call(this, i), t(this, J).call(this);
|
|
303
|
+
let e = i.scrollTop;
|
|
304
|
+
i.addEventListener("scroll", () => {
|
|
305
|
+
var n;
|
|
306
|
+
const s = i.scrollTop;
|
|
307
|
+
F.log(e, s), e !== s && (e = s, t(this, ht).call(this, s)), (n = t(this, S).querySelector("nine-table-vscrollbar")) == null || n.refresh();
|
|
308
|
+
});
|
|
309
|
+
}
|
|
302
310
|
}, "initialize"));
|
|
303
|
-
c(this,
|
|
304
|
-
const s =
|
|
311
|
+
c(this, ot, /* @__PURE__ */ a((i, e) => {
|
|
312
|
+
const s = t(this, C).get(e);
|
|
305
313
|
if (!s || s.length === 0) return;
|
|
306
314
|
const n = i.querySelector("tbody");
|
|
307
315
|
if (!n) return;
|
|
308
316
|
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
309
317
|
const r = n.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
310
|
-
for (let l = 0; l <
|
|
318
|
+
for (let l = 0; l < t(this, N); l++)
|
|
311
319
|
s.forEach((h) => {
|
|
312
320
|
o.appendChild(h.cloneNode(!0));
|
|
313
321
|
});
|
|
@@ -316,38 +324,38 @@ const $e = class $e {
|
|
|
316
324
|
/**
|
|
317
325
|
* π― ν
νλ¦Ώ TRλ€μ μ΄ λμ΄λ₯Ό μΈ‘μ νκ³ μΊμ±
|
|
318
326
|
*/
|
|
319
|
-
c(this,
|
|
320
|
-
if (
|
|
321
|
-
return
|
|
322
|
-
const
|
|
323
|
-
if (!
|
|
327
|
+
c(this, lt, /* @__PURE__ */ a((i) => {
|
|
328
|
+
if (t(this, E) !== null && t(this, E) > 0)
|
|
329
|
+
return t(this, E);
|
|
330
|
+
const e = t(this, C).get(".ng-container-body");
|
|
331
|
+
if (!e || e.length === 0) return 24;
|
|
324
332
|
const s = i.querySelector("tbody");
|
|
325
333
|
if (!s) return 24;
|
|
326
334
|
s.querySelectorAll("tr:not(.nodata)").forEach((y) => y.remove());
|
|
327
335
|
const n = s.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
328
|
-
|
|
336
|
+
e.forEach((y) => {
|
|
329
337
|
r.appendChild(y.cloneNode(!0));
|
|
330
338
|
}), n ? n.before(r) : s.appendChild(r);
|
|
331
|
-
const o =
|
|
339
|
+
const o = t(this, S), l = o.style.display, h = o.style.visibility, d = o.style.position;
|
|
332
340
|
(l === "none" || window.getComputedStyle(o).display === "none") && (o.style.display = "block", o.style.visibility = "hidden", o.style.position = "absolute");
|
|
333
341
|
let u = 0;
|
|
334
342
|
const f = s.querySelectorAll("tr:not(.nodata)");
|
|
335
343
|
return f.forEach((y) => {
|
|
336
344
|
u += y.offsetHeight || y.getBoundingClientRect().height;
|
|
337
|
-
}), f.forEach((y) => y.remove()), o.style.display = l, o.style.visibility = h, o.style.position = d, g(this,
|
|
345
|
+
}), f.forEach((y) => y.remove()), o.style.display = l, o.style.visibility = h, o.style.position = d, g(this, E, u > 0 ? u : 24), t(this, G).call(this), F.log(`[RowManager] Height Cached: ${t(this, E)}px | RowCount: ${t(this, N)}`), t(this, E);
|
|
338
346
|
}, "#measureAndCacheHeight"));
|
|
339
347
|
c(this, G, /* @__PURE__ */ a(() => {
|
|
340
|
-
if (
|
|
341
|
-
const i = Math.ceil(
|
|
348
|
+
if (t(this, B) > 0 && t(this, E) > 0) {
|
|
349
|
+
const i = Math.ceil(t(this, B) / t(this, E));
|
|
342
350
|
g(this, N, i + 20);
|
|
343
351
|
} else
|
|
344
352
|
g(this, N, 40);
|
|
345
353
|
}, "#updateRowCount"));
|
|
346
|
-
c(this,
|
|
354
|
+
c(this, at, /* @__PURE__ */ a(() => {
|
|
347
355
|
var h, d, u;
|
|
348
|
-
const i =
|
|
349
|
-
if (!
|
|
350
|
-
const n = i ? Array.from(i.querySelectorAll("tr")) : [], r = Array.from(
|
|
356
|
+
const i = t(this, S).querySelector(".ng-container-left table"), e = t(this, S).querySelector(".ng-container-body table"), s = t(this, S).querySelector(".ng-container-right table");
|
|
357
|
+
if (!e) return;
|
|
358
|
+
const n = i ? Array.from(i.querySelectorAll("tr")) : [], r = Array.from(e.querySelectorAll("tr")), o = s ? Array.from(s.querySelectorAll("tr")) : [], l = Math.max(n.length, r.length, o.length);
|
|
351
359
|
for (let f = 0; f < l; f++) {
|
|
352
360
|
const y = [
|
|
353
361
|
((h = n[f]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
@@ -360,53 +368,81 @@ const $e = class $e {
|
|
|
360
368
|
/**
|
|
361
369
|
* π― ResizeObserver μ€μ : μνΈ ν¬κΈ° λ³κ²½ μ ν κ°μ μ¬μ°μ λ° μ¬λ λλ§
|
|
362
370
|
*/
|
|
363
|
-
c(this,
|
|
364
|
-
!
|
|
365
|
-
for (const
|
|
366
|
-
const s =
|
|
371
|
+
c(this, ct, /* @__PURE__ */ a(() => {
|
|
372
|
+
!t(this, S) || !(t(this, S) instanceof HTMLElement) || (g(this, H, new ResizeObserver((i) => {
|
|
373
|
+
for (const e of i) {
|
|
374
|
+
const s = e.target;
|
|
367
375
|
if (!s.classList.contains("active")) continue;
|
|
368
|
-
const n =
|
|
376
|
+
const n = e.contentRect.height;
|
|
369
377
|
if (n > 0) {
|
|
370
378
|
let r = 0;
|
|
371
379
|
const o = s.querySelector("thead");
|
|
372
380
|
o && (r += o.offsetHeight || o.getBoundingClientRect().height);
|
|
373
381
|
const l = Math.max(n - r, 100);
|
|
374
|
-
|
|
382
|
+
t(this, B) !== l && (g(this, B, l), t(this, G).call(this), t(this, E) !== null && t(this, J).call(this));
|
|
375
383
|
}
|
|
376
384
|
}
|
|
377
|
-
})),
|
|
385
|
+
})), t(this, H).observe(t(this, S)));
|
|
378
386
|
}, "#initResizeObserver"));
|
|
379
387
|
/**
|
|
380
388
|
* π― λ°λ λ° μ’μ° κ³ μ 컨ν
μ΄λ μ 체μ κ°κ°μ λ§λ ν
νλ¦Ώ ν λΌλ μ£Όμ
|
|
381
389
|
*/
|
|
382
390
|
c(this, J, /* @__PURE__ */ a(() => {
|
|
383
391
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
}),
|
|
392
|
+
const e = t(this, S).querySelector(i);
|
|
393
|
+
e && e.querySelector("tbody") && t(this, ot).call(this, e, i);
|
|
394
|
+
}), t(this, at).call(this);
|
|
387
395
|
}, "#renderAllContainers"));
|
|
396
|
+
/**
|
|
397
|
+
* π― μ€ν¬λ‘€ μμΉμ λ°λ₯Έ λ°μ΄ν° λ°μΈλ© κ°±μ
|
|
398
|
+
*/
|
|
399
|
+
c(this, ht, /* @__PURE__ */ a((i) => {
|
|
400
|
+
var o;
|
|
401
|
+
const e = t(this, E);
|
|
402
|
+
if (!e || e <= 0) return;
|
|
403
|
+
const s = ((o = t(this, C).get(".ng-container-body")) == null ? void 0 : o.length) || 1, n = Math.floor(i / e), r = Math.max(0, n);
|
|
404
|
+
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((l) => {
|
|
405
|
+
const h = t(this, S).querySelector(l);
|
|
406
|
+
if (!h) return;
|
|
407
|
+
const d = h.querySelector("tbody");
|
|
408
|
+
if (!d) return;
|
|
409
|
+
Array.from(d.querySelectorAll("tr:not(.nodata)")).forEach((f, y) => {
|
|
410
|
+
const w = r + Math.floor(y / s), v = t(this, S).getData ? t(this, S).getData(w) : null;
|
|
411
|
+
v ? (f.style.display = "", t(this, dt).call(this, f, v, w)) : f.style.display = "none";
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
}, "#handleScroll"));
|
|
415
|
+
/**
|
|
416
|
+
* π― κ°λ³ TR μ리먼νΈμ μ€μ λ°μ΄ν° κ°μ κ½μμ£Όλ λ°μΈλ© λ©μλ
|
|
417
|
+
*/
|
|
418
|
+
c(this, dt, /* @__PURE__ */ a((i, e, s) => {
|
|
419
|
+
i.dataset.row = s, Array.from(i.cells).forEach((n) => {
|
|
420
|
+
const r = n.dataset.bind;
|
|
421
|
+
r && e[r] !== void 0 && (n.textContent = e[r]), n.dataset.row = s;
|
|
422
|
+
});
|
|
423
|
+
}, "#bindRowData"));
|
|
388
424
|
x(this, "destroy", /* @__PURE__ */ a(() => {
|
|
389
|
-
|
|
425
|
+
t(this, H) && (t(this, H).disconnect(), g(this, H, null));
|
|
390
426
|
}, "destroy"));
|
|
391
|
-
g(this,
|
|
427
|
+
g(this, S, i), t(this, ct).call(this);
|
|
392
428
|
}
|
|
393
429
|
getRowHeight() {
|
|
394
|
-
return
|
|
430
|
+
return t(this, E);
|
|
395
431
|
}
|
|
396
432
|
templateLength(i = ".ng-container-body") {
|
|
397
|
-
var
|
|
398
|
-
return ((
|
|
433
|
+
var e;
|
|
434
|
+
return ((e = t(this, C).get(i)) == null ? void 0 : e.length) || 1;
|
|
399
435
|
}
|
|
400
436
|
};
|
|
401
|
-
|
|
402
|
-
let
|
|
403
|
-
var X, Y,
|
|
404
|
-
const
|
|
437
|
+
S = new WeakMap(), C = new WeakMap(), E = new WeakMap(), H = new WeakMap(), B = new WeakMap(), N = new WeakMap(), ot = new WeakMap(), lt = new WeakMap(), G = new WeakMap(), at = new WeakMap(), ct = new WeakMap(), J = new WeakMap(), ht = new WeakMap(), dt = new WeakMap(), a(Ot, "RowManager");
|
|
438
|
+
let kt = Ot;
|
|
439
|
+
var X, Y, ft, ut, gt, bt, yt;
|
|
440
|
+
const Z = class Z extends HTMLElement {
|
|
405
441
|
constructor() {
|
|
406
442
|
super();
|
|
407
443
|
c(this, X, null);
|
|
408
444
|
c(this, Y);
|
|
409
|
-
c(this,
|
|
445
|
+
c(this, ft, /* @__PURE__ */ a(() => {
|
|
410
446
|
[
|
|
411
447
|
{ selector: ".ng-container-body", type: null },
|
|
412
448
|
{ selector: ".ng-container-left", type: "left" },
|
|
@@ -414,13 +450,13 @@ const K = class K extends HTMLElement {
|
|
|
414
450
|
].forEach(({ selector: s, type: n }) => {
|
|
415
451
|
const r = this.querySelector(s);
|
|
416
452
|
if (!r) return;
|
|
417
|
-
const o =
|
|
453
|
+
const o = t(this, gt).call(this, t(this, X), n);
|
|
418
454
|
r.innerHTML = "", r.appendChild(o);
|
|
419
455
|
});
|
|
420
456
|
}, "#renderSplitContainers"));
|
|
421
|
-
c(this,
|
|
422
|
-
["left", "right"].forEach((
|
|
423
|
-
const s = this.querySelector(`.ng-container-${
|
|
457
|
+
c(this, ut, /* @__PURE__ */ a(() => {
|
|
458
|
+
["left", "right"].forEach((e) => {
|
|
459
|
+
const s = this.querySelector(`.ng-container-${e}`), n = s == null ? void 0 : s.querySelector("table");
|
|
424
460
|
if (!s || !n) return;
|
|
425
461
|
let r = 0;
|
|
426
462
|
n.querySelectorAll("col").forEach((o) => {
|
|
@@ -429,8 +465,8 @@ const K = class K extends HTMLElement {
|
|
|
429
465
|
}), s.style.flex = `0 0 ${r}px`, s.style.width = `${r}px`;
|
|
430
466
|
});
|
|
431
467
|
}, "#updateContainerWidths"));
|
|
432
|
-
x(this, "generate", /* @__PURE__ */ a((
|
|
433
|
-
|
|
468
|
+
x(this, "generate", /* @__PURE__ */ a((e) => {
|
|
469
|
+
e && (g(this, X, Tt.compile(e)), t(this, X).style.display = "table", t(this, ft).call(this), t(this, Y).initialize(), t(this, ut).call(this), setTimeout(() => {
|
|
434
470
|
var s;
|
|
435
471
|
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
436
472
|
}, 0));
|
|
@@ -438,8 +474,8 @@ const K = class K extends HTMLElement {
|
|
|
438
474
|
/**
|
|
439
475
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
440
476
|
*/
|
|
441
|
-
c(this,
|
|
442
|
-
const n =
|
|
477
|
+
c(this, gt, /* @__PURE__ */ a((e, s) => {
|
|
478
|
+
const n = e.cloneNode(!0);
|
|
443
479
|
return s === "left" ? n.querySelectorAll("col, th, td").forEach((r) => {
|
|
444
480
|
r.getAttribute("fixed") !== "left" && r.remove();
|
|
445
481
|
}) : s === "right" ? n.querySelectorAll("col, th, td").forEach((r) => {
|
|
@@ -448,20 +484,20 @@ const K = class K extends HTMLElement {
|
|
|
448
484
|
r.remove();
|
|
449
485
|
}), n;
|
|
450
486
|
}, "#createSplitTable"));
|
|
451
|
-
x(this, "getRowHeight", /* @__PURE__ */ a(() =>
|
|
452
|
-
x(this, "scrollToX", /* @__PURE__ */ a((
|
|
487
|
+
x(this, "getRowHeight", /* @__PURE__ */ a(() => t(this, Y).getRowHeight(), "getRowHeight"));
|
|
488
|
+
x(this, "scrollToX", /* @__PURE__ */ a((e) => {
|
|
453
489
|
const s = this.querySelector(".ng-container-body");
|
|
454
|
-
s && (s.scrollLeft =
|
|
490
|
+
s && (s.scrollLeft = e);
|
|
455
491
|
}, "scrollToX"));
|
|
456
|
-
x(this, "scrollToY", /* @__PURE__ */ a((
|
|
492
|
+
x(this, "scrollToY", /* @__PURE__ */ a((e) => {
|
|
457
493
|
const s = this.querySelector(".ng-container-body");
|
|
458
|
-
s && (s.scrollTop =
|
|
494
|
+
s && (s.scrollTop = e);
|
|
459
495
|
}, "scrollToY"));
|
|
460
|
-
c(this,
|
|
461
|
-
|
|
496
|
+
c(this, bt, /* @__PURE__ */ a(() => {
|
|
497
|
+
t(this, yt).call(this);
|
|
462
498
|
}, "#init"));
|
|
463
|
-
c(this,
|
|
464
|
-
const
|
|
499
|
+
c(this, yt, /* @__PURE__ */ a(() => {
|
|
500
|
+
const e = Z.SCROLLBAR_SIZE;
|
|
465
501
|
this.innerHTML = `
|
|
466
502
|
<style>
|
|
467
503
|
nine-table-sheet {
|
|
@@ -484,7 +520,7 @@ const K = class K extends HTMLElement {
|
|
|
484
520
|
flex-direction: row;
|
|
485
521
|
flex: 1 1 auto;
|
|
486
522
|
width: 100%;
|
|
487
|
-
height: calc(100% - ${
|
|
523
|
+
height: calc(100% - ${e}px);
|
|
488
524
|
overflow: hidden;
|
|
489
525
|
position: relative;
|
|
490
526
|
}
|
|
@@ -528,16 +564,16 @@ const K = class K extends HTMLElement {
|
|
|
528
564
|
nine-table-sheet .ng-container-bottom {
|
|
529
565
|
display: flex;
|
|
530
566
|
flex-direction: row;
|
|
531
|
-
height: ${
|
|
532
|
-
min-height: ${
|
|
567
|
+
height: ${e}px;
|
|
568
|
+
min-height: ${e}px;
|
|
533
569
|
flex-shrink: 0;
|
|
534
570
|
background: #f9fafb;
|
|
535
571
|
border-top: 1px solid #e5e7eb;
|
|
536
572
|
}
|
|
537
573
|
|
|
538
574
|
nine-table-sheet .ng-scroll-edge {
|
|
539
|
-
width: ${
|
|
540
|
-
min-width: ${
|
|
575
|
+
width: ${e}px;
|
|
576
|
+
min-width: ${e}px;
|
|
541
577
|
height: 100%;
|
|
542
578
|
flex-shrink: 0;
|
|
543
579
|
background: #f3f4f6;
|
|
@@ -584,54 +620,54 @@ const K = class K extends HTMLElement {
|
|
|
584
620
|
</div>
|
|
585
621
|
`;
|
|
586
622
|
}, "#render"));
|
|
587
|
-
g(this, Y, new
|
|
623
|
+
g(this, Y, new kt(this));
|
|
588
624
|
}
|
|
589
625
|
connectedCallback() {
|
|
590
|
-
|
|
626
|
+
t(this, bt).call(this);
|
|
591
627
|
}
|
|
592
628
|
disconnectedCallback() {
|
|
593
|
-
this.innerHTML = "",
|
|
629
|
+
this.innerHTML = "", F.log("NineTableSheet destroyed.");
|
|
594
630
|
}
|
|
595
631
|
};
|
|
596
|
-
X = new WeakMap(), Y = new WeakMap(),
|
|
597
|
-
let
|
|
598
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
599
|
-
var
|
|
600
|
-
const
|
|
632
|
+
X = new WeakMap(), Y = new WeakMap(), ft = new WeakMap(), ut = new WeakMap(), gt = new WeakMap(), bt = new WeakMap(), yt = new WeakMap(), a(Z, "NineTableSheet"), x(Z, "SCROLLBAR_SIZE", 16);
|
|
633
|
+
let it = Z;
|
|
634
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", it);
|
|
635
|
+
var pt, Q;
|
|
636
|
+
const Dt = class Dt extends HTMLElement {
|
|
601
637
|
constructor() {
|
|
602
638
|
super();
|
|
603
|
-
c(this,
|
|
604
|
-
var
|
|
605
|
-
(
|
|
639
|
+
c(this, pt, /* @__PURE__ */ a(() => {
|
|
640
|
+
var e;
|
|
641
|
+
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
606
642
|
var o;
|
|
607
643
|
const n = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((o = s.target.closest(".nine-tab-item")) == null ? void 0 : o.dataset.index, 10);
|
|
608
|
-
|
|
609
|
-
}),
|
|
644
|
+
t(this, Q).call(this, r, n);
|
|
645
|
+
}), t(this, Q).call(this, 0, !1);
|
|
610
646
|
}, "#init"));
|
|
611
|
-
c(this, Q, /* @__PURE__ */ a((
|
|
647
|
+
c(this, Q, /* @__PURE__ */ a((e, s = !1) => {
|
|
612
648
|
const n = /* @__PURE__ */ a(() => {
|
|
613
649
|
const u = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
614
650
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((w) => w.style.setProperty("display", "none"));
|
|
615
651
|
const y = u.filter((w) => w.classList.contains("active"));
|
|
616
652
|
y.length < 2 || y.forEach((w) => {
|
|
617
|
-
const v = parseInt(w.getAttribute("data-index"), 10),
|
|
618
|
-
|
|
653
|
+
const v = parseInt(w.getAttribute("data-index"), 10), _ = this.querySelector(`nine-splitter[data-split-index="${v}"]`), Vt = u[v + 1];
|
|
654
|
+
_ && Vt && Vt.classList.contains("active") && _.style.setProperty("display", "flex");
|
|
619
655
|
});
|
|
620
656
|
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), h = o.querySelectorAll("nine-table-sheet");
|
|
621
|
-
if (!l[
|
|
657
|
+
if (!l[e]) return;
|
|
622
658
|
if (!s)
|
|
623
659
|
l.forEach((u, f) => {
|
|
624
|
-
u.classList.toggle("active", f ===
|
|
660
|
+
u.classList.toggle("active", f === e);
|
|
625
661
|
}), h.forEach((u, f) => {
|
|
626
|
-
const y = f ===
|
|
662
|
+
const y = f === e;
|
|
627
663
|
u.classList.toggle("active", y), u.style.flex = y ? "1 1 100%" : "";
|
|
628
664
|
});
|
|
629
665
|
else {
|
|
630
|
-
const u = l[
|
|
666
|
+
const u = l[e], f = r.querySelectorAll(".nine-tab-item.active");
|
|
631
667
|
if (u.classList.contains("active") && f.length <= 1)
|
|
632
668
|
return;
|
|
633
669
|
u.classList.toggle("active");
|
|
634
|
-
const y = o.querySelector(`nine-table-sheet[data-index="${
|
|
670
|
+
const y = o.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
635
671
|
y && (y.classList.toggle("active"), y.classList.contains("active") || (y.style.flex = ""));
|
|
636
672
|
}
|
|
637
673
|
const d = o.querySelectorAll("nine-table-sheet.active");
|
|
@@ -641,35 +677,35 @@ const We = class We extends HTMLElement {
|
|
|
641
677
|
}, "#switchSheet"));
|
|
642
678
|
}
|
|
643
679
|
connectedCallback() {
|
|
644
|
-
|
|
680
|
+
t(this, pt).call(this);
|
|
645
681
|
}
|
|
646
682
|
};
|
|
647
|
-
|
|
648
|
-
let
|
|
649
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
650
|
-
var
|
|
651
|
-
const
|
|
683
|
+
pt = new WeakMap(), Q = new WeakMap(), a(Dt, "NineTableSheets");
|
|
684
|
+
let Lt = Dt;
|
|
685
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Lt);
|
|
686
|
+
var R, mt, tt, wt;
|
|
687
|
+
const zt = class zt {
|
|
652
688
|
constructor(i) {
|
|
653
|
-
c(this,
|
|
654
|
-
c(this,
|
|
655
|
-
|
|
656
|
-
for (let
|
|
657
|
-
|
|
658
|
-
}).observe(
|
|
689
|
+
c(this, R);
|
|
690
|
+
c(this, mt, /* @__PURE__ */ a(() => {
|
|
691
|
+
t(this, wt).call(this), new ResizeObserver((i) => {
|
|
692
|
+
for (let e of i)
|
|
693
|
+
t(this, R).getAttribute("auto-height") === "true" && t(this, tt).call(this);
|
|
694
|
+
}).observe(t(this, R));
|
|
659
695
|
}, "#init"));
|
|
660
|
-
c(this,
|
|
696
|
+
c(this, tt, /* @__PURE__ */ a(() => {
|
|
661
697
|
var h, d;
|
|
662
|
-
const i = Array.from(
|
|
698
|
+
const i = Array.from(t(this, R).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
663
699
|
if (i.length === 0) return;
|
|
664
|
-
const
|
|
665
|
-
|
|
700
|
+
const e = parseInt(t(this, R).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((u) => u.getRowHeight())), n = (h = t(this, R).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : h.getBoundingClientRect().height, r = (d = t(this, R).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : d.getBoundingClientRect().height, o = it.SCROLLBAR_SIZE, l = e * s + n + r + o;
|
|
701
|
+
t(this, R).style.height = `${l}px`;
|
|
666
702
|
}, "#applyAutoHeight"));
|
|
667
|
-
c(this,
|
|
668
|
-
const
|
|
703
|
+
c(this, wt, /* @__PURE__ */ a(() => {
|
|
704
|
+
const e = Array.from(t(this, R).children).filter((h) => h.tagName === "TABLE"), s = t(this, R).getAttribute("auto-height") === "true", n = e.length, r = e.map((h, d) => {
|
|
669
705
|
const f = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`, y = d < n - 1 ? `<nine-splitter class="h" data-split-index="${d}"></nine-splitter>` : "";
|
|
670
706
|
return f + y;
|
|
671
|
-
}).join(""), o =
|
|
672
|
-
|
|
707
|
+
}).join(""), o = e.map((h, d) => `<div class="nine-tab-item ${d === 0 ? "active" : ""}" data-index="${d}">Sheet ${d + 1}</div>`).join("");
|
|
708
|
+
t(this, R).shadowRoot.innerHTML = `
|
|
673
709
|
<style>
|
|
674
710
|
:host {
|
|
675
711
|
display: flex;
|
|
@@ -768,178 +804,178 @@ const Oe = class Oe {
|
|
|
768
804
|
</nine-table-body>
|
|
769
805
|
<nine-table-footer></nine-table-footer>
|
|
770
806
|
`;
|
|
771
|
-
const l =
|
|
807
|
+
const l = t(this, R).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
772
808
|
l == null || l.forEach((h, d) => {
|
|
773
|
-
|
|
774
|
-
h.generate(
|
|
809
|
+
e[d] && setTimeout(() => {
|
|
810
|
+
h.generate(e[d]), s && t(this, tt).call(this);
|
|
775
811
|
});
|
|
776
812
|
});
|
|
777
813
|
}, "#render"));
|
|
778
|
-
g(this,
|
|
814
|
+
g(this, R, i), t(this, mt).call(this);
|
|
779
815
|
}
|
|
780
816
|
};
|
|
781
|
-
|
|
782
|
-
let
|
|
817
|
+
R = new WeakMap(), mt = new WeakMap(), tt = new WeakMap(), wt = new WeakMap(), a(zt, "LayoutManager");
|
|
818
|
+
let Ct = zt;
|
|
783
819
|
var M, P;
|
|
784
|
-
const
|
|
820
|
+
const Bt = class Bt {
|
|
785
821
|
constructor(i) {
|
|
786
822
|
c(this, M);
|
|
787
823
|
c(this, P, -1);
|
|
788
|
-
x(this, "count", /* @__PURE__ */ a(() =>
|
|
824
|
+
x(this, "count", /* @__PURE__ */ a(() => t(this, M).rawRecords.length, "count"));
|
|
789
825
|
g(this, M, i);
|
|
790
826
|
}
|
|
791
827
|
get at() {
|
|
792
|
-
return
|
|
828
|
+
return t(this, P);
|
|
793
829
|
}
|
|
794
830
|
set at(i) {
|
|
795
831
|
var s, n;
|
|
796
832
|
g(this, P, parseInt(i, 10));
|
|
797
|
-
const
|
|
798
|
-
|
|
833
|
+
const e = ((n = (s = t(this, M).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || t(this, M).owner.body;
|
|
834
|
+
e && !e.querySelector(`tbody.bindable tr[data-row="${t(this, P)}"]`) && setTimeout(() => {
|
|
799
835
|
var r, o;
|
|
800
|
-
(o = (r =
|
|
836
|
+
(o = (r = t(this, M).owner).scrollTo_V1) == null || o.call(r, t(this, P));
|
|
801
837
|
});
|
|
802
838
|
}
|
|
803
839
|
};
|
|
804
|
-
M = new WeakMap(), P = new WeakMap(), a(
|
|
805
|
-
let
|
|
806
|
-
var A, m, q,
|
|
840
|
+
M = new WeakMap(), P = new WeakMap(), a(Bt, "ngRow");
|
|
841
|
+
let _t = Bt;
|
|
842
|
+
var A, m, q, K, xt, $, vt, et, St, Et, U;
|
|
807
843
|
const T = class T {
|
|
808
|
-
constructor(i,
|
|
844
|
+
constructor(i, e) {
|
|
809
845
|
c(this, A);
|
|
810
846
|
c(this, m);
|
|
811
847
|
c(this, q, []);
|
|
812
|
-
c(this,
|
|
813
|
-
c(this,
|
|
848
|
+
c(this, K, []);
|
|
849
|
+
c(this, xt, 0);
|
|
814
850
|
c(this, $, []);
|
|
815
|
-
c(this,
|
|
851
|
+
c(this, vt, /* @__PURE__ */ a(() => {
|
|
816
852
|
g(this, $, []);
|
|
817
|
-
const i =
|
|
818
|
-
Array.from(i).forEach((
|
|
853
|
+
const i = t(this, A).template || [];
|
|
854
|
+
Array.from(i).forEach((e) => {
|
|
819
855
|
var s;
|
|
820
|
-
|
|
821
|
-
}), (
|
|
822
|
-
|
|
856
|
+
t(this, $).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
857
|
+
}), (t(this, m).rawRecords || []).forEach((e) => {
|
|
858
|
+
e.__ng || (e.__ng = t(this, et).call(this)), e.__ng.height = t(this, $).slice();
|
|
823
859
|
});
|
|
824
860
|
}, "#initialize"));
|
|
825
861
|
x(this, "set", /* @__PURE__ */ a((i) => {
|
|
826
862
|
this.clear(), this.add(i, !1);
|
|
827
863
|
}, "set"));
|
|
828
|
-
c(this,
|
|
864
|
+
c(this, et, /* @__PURE__ */ a(() => ({
|
|
829
865
|
rowState: T.ROW_STATE.EMPTY,
|
|
830
866
|
deleted: !1,
|
|
831
867
|
filtered: !1,
|
|
832
|
-
height:
|
|
868
|
+
height: t(this, $).slice(),
|
|
833
869
|
o: {},
|
|
834
870
|
c: {},
|
|
835
|
-
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1,
|
|
871
|
+
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, $).slice(), -1, {}, {}]
|
|
836
872
|
}), "#getDefaultMeta"));
|
|
837
873
|
x(this, "reset", /* @__PURE__ */ a(() => {
|
|
838
|
-
g(this, q, []), g(this,
|
|
874
|
+
g(this, q, []), g(this, K, []);
|
|
839
875
|
}, "reset"));
|
|
840
876
|
x(this, "clear", /* @__PURE__ */ a(() => {
|
|
841
877
|
var i;
|
|
842
|
-
|
|
878
|
+
t(this, m).rawRecords = [], g(this, q, []), g(this, K, []), (i = t(this, m).viewRecords) != null && i.reset && t(this, m).viewRecords.reset();
|
|
843
879
|
}, "clear"));
|
|
844
|
-
c(this,
|
|
880
|
+
c(this, St, /* @__PURE__ */ a((i) => {
|
|
845
881
|
var n;
|
|
846
882
|
Array.isArray(i) || (i = [i]);
|
|
847
|
-
const
|
|
883
|
+
const e = typeof ((n = t(this, A).fields) == null ? void 0 : n.get) == "function" ? t(this, A).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
848
884
|
return i.forEach((r) => {
|
|
849
885
|
const o = { v: [] };
|
|
850
|
-
|
|
886
|
+
e.forEach((l) => {
|
|
851
887
|
o.v.push(r[l] !== void 0 && r[l] !== null ? r[l] : "");
|
|
852
888
|
}), s.push(o);
|
|
853
889
|
}), s;
|
|
854
890
|
}, "#json2Array"));
|
|
855
|
-
c(this,
|
|
856
|
-
|
|
891
|
+
c(this, Et, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
892
|
+
e.__ng = t(this, et).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = T.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
857
893
|
}), i), "#defaultInsert"));
|
|
858
|
-
x(this, "add", /* @__PURE__ */ a((i,
|
|
894
|
+
x(this, "add", /* @__PURE__ */ a((i, e = !0) => {
|
|
859
895
|
var r;
|
|
860
896
|
i === void 0 && (i = {});
|
|
861
|
-
const s =
|
|
862
|
-
|
|
897
|
+
const s = t(this, St).call(this, i);
|
|
898
|
+
t(this, m).rawRecords = t(this, m).rawRecords.concat(t(this, Et).call(this, s)), this.resetRecords();
|
|
863
899
|
const n = this.count() - 1;
|
|
864
|
-
return
|
|
865
|
-
const h =
|
|
900
|
+
return e || s.forEach((o, l) => {
|
|
901
|
+
const h = t(this, m).rawRecords[n - l];
|
|
866
902
|
h && (h.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
867
|
-
}), (r =
|
|
903
|
+
}), (r = t(this, m).viewRecords) != null && r.reset && t(this, m).viewRecords.reset(), n;
|
|
868
904
|
}, "add"));
|
|
869
905
|
x(this, "delete", /* @__PURE__ */ a((i) => {
|
|
870
906
|
var s;
|
|
871
|
-
let
|
|
872
|
-
Array.isArray(i) ?
|
|
873
|
-
if (
|
|
874
|
-
const r =
|
|
875
|
-
|
|
907
|
+
let e = [];
|
|
908
|
+
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, m).owner.row.at] : e = [parseInt(i, 10)], e.sort((n, r) => r - n).forEach((n) => {
|
|
909
|
+
if (t(this, q)[n]) {
|
|
910
|
+
const r = t(this, q)[n].__ng.rowid;
|
|
911
|
+
t(this, q)[n].__ng.rowState === T.ROW_STATE.INSERT ? t(this, m).rawRecords = t(this, m).rawRecords.filter((o) => o.__ng.rowid !== r) : t(this, m).rawRecords.forEach((o) => {
|
|
876
912
|
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState = T.ROW_STATE.DELETE);
|
|
877
913
|
});
|
|
878
914
|
}
|
|
879
|
-
}), this.resetRecords(), (s =
|
|
915
|
+
}), this.resetRecords(), (s = t(this, m).viewRecords) != null && s.reset && t(this, m).viewRecords.reset();
|
|
880
916
|
}, "delete"));
|
|
881
|
-
x(this, "setValue", /* @__PURE__ */ a((i,
|
|
917
|
+
x(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
|
|
882
918
|
var h;
|
|
883
919
|
i = parseInt(i, 10);
|
|
884
|
-
const r = (typeof ((h =
|
|
920
|
+
const r = (typeof ((h = t(this, A).fields) == null ? void 0 : h.get) == "function" ? t(this, A).fields.get() : []).indexOf(e);
|
|
885
921
|
if (r < 0) return;
|
|
886
922
|
const o = this.getValidData()[i];
|
|
887
923
|
if (!o) return;
|
|
888
924
|
const l = o.v[r];
|
|
889
|
-
l !== s && o.__ng.rowState !== T.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(
|
|
925
|
+
l !== s && o.__ng.rowState !== T.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = l), o.__ng.rowState = T.ROW_STATE.UPDATE), o.v[r] = s, t(this, m).owner.refreshData && t(this, m).owner.refreshData(i);
|
|
890
926
|
}, "setValue"));
|
|
891
927
|
x(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
892
|
-
g(this,
|
|
893
|
-
i.__ng.rowidx =
|
|
894
|
-
}),
|
|
895
|
-
i.__ng.i =
|
|
928
|
+
g(this, K, t(this, m).rawRecords.filter((i) => !i.__ng.deleted)), g(this, q, t(this, m).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, m).rawRecords.forEach((i, e) => {
|
|
929
|
+
i.__ng.rowidx = e;
|
|
930
|
+
}), t(this, q).forEach((i, e) => {
|
|
931
|
+
i.__ng.i = e;
|
|
896
932
|
});
|
|
897
933
|
}, "resetRecords"));
|
|
898
|
-
x(this, "getValidData", /* @__PURE__ */ a(() => (
|
|
899
|
-
c(this,
|
|
934
|
+
x(this, "getValidData", /* @__PURE__ */ a(() => (t(this, q).length === 0 && t(this, m).rawRecords.length > 0 && this.resetRecords(), t(this, q)), "getValidData"));
|
|
935
|
+
c(this, U, /* @__PURE__ */ a((i) => {
|
|
900
936
|
var s;
|
|
901
937
|
if (!i) return i;
|
|
902
|
-
const
|
|
938
|
+
const e = typeof ((s = t(this, A).fields) == null ? void 0 : s.get) == "function" ? t(this, A).fields.get() : [];
|
|
903
939
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
904
940
|
const r = {};
|
|
905
|
-
return
|
|
941
|
+
return e.forEach((o, l) => {
|
|
906
942
|
r[o] = n.v ? n.v[l] : n[o];
|
|
907
943
|
}), r.__ng = n.__ng, r;
|
|
908
944
|
}) : i;
|
|
909
945
|
}, "#conv2"));
|
|
910
946
|
x(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
911
|
-
x(this, "get", /* @__PURE__ */ a((i,
|
|
947
|
+
x(this, "get", /* @__PURE__ */ a((i, e) => {
|
|
912
948
|
var r;
|
|
913
949
|
const s = this.getValidData();
|
|
914
950
|
if (!s || s.length <= 0) return;
|
|
915
|
-
if (i == null) return
|
|
951
|
+
if (i == null) return t(this, U).call(this, s);
|
|
916
952
|
if (i < 0 || i >= s.length) return null;
|
|
917
|
-
const n = typeof ((r =
|
|
918
|
-
if (
|
|
919
|
-
const o = n.indexOf(
|
|
953
|
+
const n = typeof ((r = t(this, A).fields) == null ? void 0 : r.get) == "function" ? t(this, A).fields.get() : [];
|
|
954
|
+
if (e != null) {
|
|
955
|
+
const o = n.indexOf(e);
|
|
920
956
|
return o >= 0 ? s[i].v[o] : null;
|
|
921
957
|
}
|
|
922
|
-
return
|
|
958
|
+
return t(this, U).call(this, s[i]);
|
|
923
959
|
}, "get"));
|
|
924
|
-
g(this, A, i), g(this, m,
|
|
960
|
+
g(this, A, i), g(this, m, e), t(this, vt).call(this);
|
|
925
961
|
}
|
|
926
962
|
get source() {
|
|
927
|
-
return
|
|
963
|
+
return t(this, U).call(this, t(this, m).rawRecords);
|
|
928
964
|
}
|
|
929
965
|
set source(i) {
|
|
930
966
|
this.clear(), this.add(i, !1);
|
|
931
967
|
}
|
|
932
968
|
get nextId() {
|
|
933
|
-
return ++
|
|
969
|
+
return ++Ut(this, xt)._;
|
|
934
970
|
}
|
|
935
971
|
get length() {
|
|
936
|
-
return
|
|
972
|
+
return t(this, q).length;
|
|
937
973
|
}
|
|
938
974
|
getRowCount() {
|
|
939
975
|
return this.length;
|
|
940
976
|
}
|
|
941
977
|
};
|
|
942
|
-
A = new WeakMap(), m = new WeakMap(), q = new WeakMap(),
|
|
978
|
+
A = new WeakMap(), m = new WeakMap(), q = new WeakMap(), K = new WeakMap(), xt = new WeakMap(), $ = new WeakMap(), vt = new WeakMap(), et = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), U = new WeakMap(), a(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
943
979
|
x(T, "ROW_STATE", {
|
|
944
980
|
EMPTY: "EMPTY",
|
|
945
981
|
NORMAL: "NORMAL",
|
|
@@ -947,57 +983,57 @@ x(T, "ROW_STATE", {
|
|
|
947
983
|
UPDATE: "UPDATE",
|
|
948
984
|
DELETE: "DELETE"
|
|
949
985
|
});
|
|
950
|
-
let
|
|
951
|
-
const
|
|
986
|
+
let It = T;
|
|
987
|
+
const Nt = class Nt {
|
|
952
988
|
constructor(i) {
|
|
953
|
-
this.owner = i, this.row = new
|
|
954
|
-
var
|
|
955
|
-
(
|
|
956
|
-
}, this.setDataSource = (
|
|
957
|
-
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(
|
|
958
|
-
}, this.getRowState = (
|
|
989
|
+
this.owner = i, this.row = new _t(this), this.data = new It(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
990
|
+
var e;
|
|
991
|
+
(e = this.owner.view) != null && e.redraw && this.owner.view.redraw();
|
|
992
|
+
}, this.setDataSource = (e) => {
|
|
993
|
+
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
994
|
+
}, this.getRowState = (e) => {
|
|
959
995
|
var n, r;
|
|
960
|
-
const s = parseInt(
|
|
996
|
+
const s = parseInt(e, 10);
|
|
961
997
|
if (!(s >= this.data.count()))
|
|
962
998
|
return (r = (n = this.data.getValidData()[s]) == null ? void 0 : n.__ng) == null ? void 0 : r.rowState;
|
|
963
|
-
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (
|
|
964
|
-
this.row.at =
|
|
965
|
-
}, this.scrollTo_V1 = (
|
|
966
|
-
|
|
999
|
+
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (e) => {
|
|
1000
|
+
this.row.at = e;
|
|
1001
|
+
}, this.scrollTo_V1 = (e) => (e < 0 && (e = 0), e >= this.rawRecords.length && (e = this.rawRecords.length - 1), this.viewRecords.rawIndex = e, this.viewRecords.reset && this.viewRecords.reset(), !(e <= 0 || e >= this.rawRecords.length - 1)), this.getColumn = (e, s) => this.data.get(e, s), this.setColumn = (e, s, n) => {
|
|
1002
|
+
e = parseInt(e, 10), this.data.setValue(e, s, n);
|
|
967
1003
|
}, this.setDataSource([]);
|
|
968
1004
|
}
|
|
969
1005
|
};
|
|
970
|
-
a(
|
|
971
|
-
let
|
|
972
|
-
var V,
|
|
973
|
-
const
|
|
1006
|
+
a(Nt, "ngDataManager");
|
|
1007
|
+
let Ht = Nt;
|
|
1008
|
+
var V, Rt;
|
|
1009
|
+
const Pt = class Pt extends HTMLElement {
|
|
974
1010
|
constructor() {
|
|
975
1011
|
super();
|
|
976
1012
|
//#created = false;
|
|
977
1013
|
c(this, V);
|
|
978
|
-
c(this,
|
|
979
|
-
this.attachShadow({ mode: "open" }), g(this, V, new
|
|
1014
|
+
c(this, Rt);
|
|
1015
|
+
this.attachShadow({ mode: "open" }), g(this, V, new Ht(this));
|
|
980
1016
|
}
|
|
981
1017
|
connectedCallback() {
|
|
982
|
-
g(this,
|
|
1018
|
+
g(this, Rt, new Ct(this)), F.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
983
1019
|
}
|
|
984
1020
|
disconnectedCallback() {
|
|
985
|
-
|
|
1021
|
+
F.log("NineTable disconnected.");
|
|
986
1022
|
}
|
|
987
1023
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
988
1024
|
get data() {
|
|
989
|
-
return
|
|
1025
|
+
return t(this, V).data;
|
|
990
1026
|
}
|
|
991
1027
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
992
1028
|
get row() {
|
|
993
|
-
return
|
|
1029
|
+
return t(this, V).row;
|
|
994
1030
|
}
|
|
995
1031
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
996
1032
|
get dataManager() {
|
|
997
|
-
return
|
|
1033
|
+
return t(this, V);
|
|
998
1034
|
}
|
|
999
1035
|
};
|
|
1000
|
-
V = new WeakMap(),
|
|
1001
|
-
let
|
|
1002
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
1036
|
+
V = new WeakMap(), Rt = new WeakMap(), a(Pt, "NineTable");
|
|
1037
|
+
let Mt = Pt;
|
|
1038
|
+
customElements.get("nine-table") || customElements.define("nine-table", Mt);
|
|
1003
1039
|
//# sourceMappingURL=nine-table.js.map
|