@ninebone/table 0.0.388 β 0.0.389
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 +200 -200
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +5 -5
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var pe = Object.defineProperty;
|
|
2
|
+
var me = (x) => {
|
|
3
3
|
throw TypeError(x);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var a = (x, i) =>
|
|
7
|
-
var v = (x, i, e) =>
|
|
8
|
-
var t = (x, i, e) => (
|
|
9
|
-
var
|
|
5
|
+
var we = (x, i, e) => i in x ? pe(x, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : x[i] = e;
|
|
6
|
+
var a = (x, i) => pe(x, "name", { value: i, configurable: !0 });
|
|
7
|
+
var v = (x, i, e) => we(x, typeof i != "symbol" ? i + "" : i, e), xe = (x, i, e) => i.has(x) || me("Cannot " + e);
|
|
8
|
+
var t = (x, i, e) => (xe(x, i, "read from private field"), e ? e.call(x) : i.get(x)), c = (x, i, e) => i.has(x) ? me("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(x) : i.set(x, e), g = (x, i, e, s) => (xe(x, i, "write to private field"), s ? s.call(x, e) : i.set(x, e), e);
|
|
9
|
+
var ve = (x, i, e, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
11
|
g(x, i, n, e);
|
|
12
12
|
},
|
|
@@ -14,37 +14,37 @@ var we = (x, i, e, s) => ({
|
|
|
14
14
|
return t(x, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
import { trace as
|
|
18
|
-
const
|
|
17
|
+
import { trace as Se } from "@ninebone/util";
|
|
18
|
+
const re = class re extends Se.constructor {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
a(
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
var
|
|
27
|
-
const
|
|
23
|
+
a(re, "Trace");
|
|
24
|
+
let jt = re;
|
|
25
|
+
const W = new jt();
|
|
26
|
+
var M, O, p, V, Y, X, St, U, Et;
|
|
27
|
+
const le = class le extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
c(this,
|
|
31
|
-
c(this,
|
|
30
|
+
c(this, M);
|
|
31
|
+
c(this, O, !1);
|
|
32
32
|
c(this, p);
|
|
33
|
+
c(this, V);
|
|
33
34
|
c(this, Y);
|
|
34
35
|
c(this, X);
|
|
35
|
-
c(this, U);
|
|
36
36
|
c(this, St, /* @__PURE__ */ a(() => {
|
|
37
|
-
if (!t(this,
|
|
38
|
-
const e = t(this,
|
|
39
|
-
e && (g(this,
|
|
37
|
+
if (!t(this, M)) return;
|
|
38
|
+
const e = t(this, M).querySelector(".ng-container-body");
|
|
39
|
+
e && (g(this, X, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), t(this,
|
|
41
|
+
})), t(this, X).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!t(this,
|
|
44
|
+
if (!t(this, M) || !t(this, p) || t(this, O)) return;
|
|
45
45
|
const e = t(this, p).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = t(this, p).track, r = t(this, p).thumb, o = t(this,
|
|
47
|
+
const n = t(this, p).track, r = t(this, p).thumb, o = t(this, M).querySelector(".ng-container-bottom"), l = e.clientWidth, d = s.scrollWidth;
|
|
48
48
|
if (l !== 0 && d > l)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -59,9 +59,9 @@ const ae = class ae extends HTMLElement {
|
|
|
59
59
|
let y = 0;
|
|
60
60
|
b > 0 && (y = parseInt(u / b * (h - f), 10)), y < 0 && (y = 0);
|
|
61
61
|
const m = h - f;
|
|
62
|
-
y > m && (y = m), r.style.left = `${y}px`,
|
|
62
|
+
y > m && (y = m), r.style.left = `${y}px`, W.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
c(this,
|
|
64
|
+
c(this, U, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
66
66
|
const s = t(this, p).container, n = s.querySelector("table");
|
|
67
67
|
if (!n) return !1;
|
|
@@ -75,16 +75,16 @@ const ae = class ae extends HTMLElement {
|
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
c(this, Et, /* @__PURE__ */ a(() => {
|
|
77
77
|
const e = /* @__PURE__ */ a((n) => {
|
|
78
|
-
clearInterval(t(this,
|
|
78
|
+
clearInterval(t(this, V)), clearInterval(t(this, Y));
|
|
79
79
|
const r = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
80
|
-
t(this,
|
|
81
|
-
clearInterval(t(this,
|
|
80
|
+
t(this, U).call(this, r + n), g(this, V, setInterval(() => {
|
|
81
|
+
clearInterval(t(this, V)), g(this, Y, setInterval(() => {
|
|
82
82
|
const o = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
83
|
-
t(this,
|
|
83
|
+
t(this, U).call(this, o + n) || clearInterval(t(this, Y));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
87
|
-
clearInterval(t(this,
|
|
87
|
+
clearInterval(t(this, V)), clearInterval(t(this, Y));
|
|
88
88
|
}, "clearTimer");
|
|
89
89
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
90
90
|
t(this, p).left.addEventListener(n, s), t(this, p).right.addEventListener(n, s), t(this, p).track.addEventListener(n, s);
|
|
@@ -96,23 +96,23 @@ const ae = class ae extends HTMLElement {
|
|
|
96
96
|
if (n.button !== 0) return;
|
|
97
97
|
n.preventDefault();
|
|
98
98
|
const r = t(this, p).track.getBoundingClientRect(), o = t(this, p).thumb.clientWidth;
|
|
99
|
-
t(this,
|
|
99
|
+
t(this, U).call(this, n.clientX - r.left - o / 2);
|
|
100
100
|
}), t(this, p).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, O, !0), this.shiftX = n.clientX - t(this, p).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ a((l) => {
|
|
104
|
-
if (!t(this,
|
|
104
|
+
if (!t(this, O)) return;
|
|
105
105
|
const d = t(this, p).track.getBoundingClientRect();
|
|
106
|
-
t(this,
|
|
106
|
+
t(this, U).call(this, l.clientX - d.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
108
|
-
g(this,
|
|
108
|
+
g(this, O, !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,
|
|
115
|
+
if (g(this, M, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, M)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -177,7 +177,7 @@ const ae = class ae extends HTMLElement {
|
|
|
177
177
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
178
178
|
`;
|
|
179
179
|
const e = /* @__PURE__ */ a(() => {
|
|
180
|
-
const s = t(this,
|
|
180
|
+
const s = t(this, M).querySelector(".ng-container-body");
|
|
181
181
|
if (!s) {
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
@@ -189,25 +189,25 @@ const ae = class ae extends HTMLElement {
|
|
|
189
189
|
left: this.querySelector(".ng-scroll-left"),
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), s.addEventListener("scroll", () => {
|
|
192
|
-
t(this,
|
|
192
|
+
t(this, O) || this.refresh();
|
|
193
193
|
}), t(this, Et).call(this), t(this, St).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
196
196
|
}
|
|
197
197
|
disconnectedCallback() {
|
|
198
|
-
t(this,
|
|
198
|
+
t(this, X) && t(this, X).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
202
|
-
let
|
|
203
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar",
|
|
204
|
-
var
|
|
205
|
-
const
|
|
201
|
+
M = new WeakMap(), O = new WeakMap(), p = new WeakMap(), V = new WeakMap(), Y = new WeakMap(), X = new WeakMap(), St = new WeakMap(), U = new WeakMap(), Et = new WeakMap(), a(le, "NineTableHScrollBar");
|
|
202
|
+
let Kt = le;
|
|
203
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Kt);
|
|
204
|
+
var z, Q, D, S, ht, dt, Rt;
|
|
205
|
+
const ae = class ae extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
|
-
c(this,
|
|
208
|
+
c(this, z);
|
|
209
209
|
c(this, Q);
|
|
210
|
-
c(this,
|
|
210
|
+
c(this, D, !1);
|
|
211
211
|
c(this, S);
|
|
212
212
|
c(this, ht, 0);
|
|
213
213
|
c(this, dt, 0);
|
|
@@ -215,8 +215,8 @@ const ce = class ce extends HTMLElement {
|
|
|
215
215
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
216
216
|
*/
|
|
217
217
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
218
|
-
if (!t(this,
|
|
219
|
-
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, l = (t(this,
|
|
218
|
+
if (!t(this, z) || !t(this, S) || t(this, D)) return;
|
|
219
|
+
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, l = (t(this, z).data.get() || []).length, d = t(this, Q).getRowHeight(), h = l * d;
|
|
220
220
|
if (h <= r) {
|
|
221
221
|
n.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
222
222
|
return;
|
|
@@ -226,42 +226,42 @@ const ce = class ce extends HTMLElement {
|
|
|
226
226
|
if (f <= 0) return;
|
|
227
227
|
const u = Math.max(Math.min(f * (r / h), f), 20);
|
|
228
228
|
n.style.height = `${u}px`;
|
|
229
|
-
const b = e.scrollTop, y =
|
|
230
|
-
let
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
|
|
229
|
+
const b = e.scrollTop, y = Math.max(h - r, 1);
|
|
230
|
+
let m = 0;
|
|
231
|
+
y > 0 && (m = b / y * (f - u));
|
|
232
|
+
const R = f - u;
|
|
233
|
+
m < 0 && (m = 0), m > R && (m = R), n.style.top = `${m}px`, t(this, S).top.disabled = b <= 0, t(this, S).bottom.disabled = b >= y - 1;
|
|
234
234
|
}, "refresh"));
|
|
235
235
|
c(this, Rt, /* @__PURE__ */ a(() => {
|
|
236
236
|
const e = t(this, S).container, s = /* @__PURE__ */ a(() => {
|
|
237
|
-
const r = (t(this,
|
|
237
|
+
const r = (t(this, z).data.get() || []).length, o = t(this, Q).getRowHeight();
|
|
238
238
|
return r * o;
|
|
239
239
|
}, "getContentHeight");
|
|
240
240
|
e.addEventListener("scroll", () => {
|
|
241
|
-
t(this,
|
|
241
|
+
t(this, D) || this.refresh();
|
|
242
242
|
}), t(this, S).thumb.addEventListener("mousedown", (n) => {
|
|
243
243
|
if (n.button !== 0) return;
|
|
244
|
-
n.stopPropagation(), n.preventDefault(), g(this,
|
|
244
|
+
n.stopPropagation(), n.preventDefault(), g(this, D, !0), g(this, ht, n.clientY), g(this, dt, e.scrollTop);
|
|
245
245
|
const r = /* @__PURE__ */ a((l) => {
|
|
246
|
-
if (!t(this,
|
|
247
|
-
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h, b = l.clientY - t(this, ht), y = e.clientHeight, m = s(),
|
|
248
|
-
if (u > 0 &&
|
|
249
|
-
const
|
|
250
|
-
let
|
|
251
|
-
const
|
|
252
|
-
|
|
246
|
+
if (!t(this, D)) return;
|
|
247
|
+
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h, b = l.clientY - t(this, ht), y = e.clientHeight, m = s(), R = Math.max(m - y, 1);
|
|
248
|
+
if (u > 0 && R > 0) {
|
|
249
|
+
const J = b / u * R;
|
|
250
|
+
let at = t(this, dt) + J;
|
|
251
|
+
const ye = Math.max(0, m - y);
|
|
252
|
+
at < 0 && (at = 0), at > ye && (at = ye), e.scrollTop = at;
|
|
253
253
|
}
|
|
254
254
|
this.refresh();
|
|
255
255
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
256
|
-
g(this,
|
|
256
|
+
g(this, D, !1), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
257
257
|
}, "onMouseUp");
|
|
258
258
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
259
259
|
}), t(this, S).track.addEventListener("mousedown", (n) => {
|
|
260
260
|
if (n.button !== 0 || n.target === t(this, S).thumb) return;
|
|
261
|
-
const r = t(this, S).track.getBoundingClientRect(), o = t(this, S).thumb.clientHeight, l = n.clientY - r.top - o / 2, h = r.height - o, f = e.clientHeight, u = s(), b =
|
|
262
|
-
if (h > 0 &&
|
|
263
|
-
const
|
|
264
|
-
e.scrollTop =
|
|
261
|
+
const r = t(this, S).track.getBoundingClientRect(), o = t(this, S).thumb.clientHeight, l = n.clientY - r.top - o / 2, h = r.height - o, f = e.clientHeight, u = s(), b = Math.max(u - f, 1);
|
|
262
|
+
if (h > 0 && b > 0) {
|
|
263
|
+
const y = Math.max(0, Math.min(1, l / h));
|
|
264
|
+
e.scrollTop = y * b;
|
|
265
265
|
}
|
|
266
266
|
this.refresh();
|
|
267
267
|
}), t(this, S).top.addEventListener("click", () => {
|
|
@@ -272,7 +272,7 @@ const ce = class ce extends HTMLElement {
|
|
|
272
272
|
}, "#init"));
|
|
273
273
|
}
|
|
274
274
|
connectedCallback() {
|
|
275
|
-
g(this,
|
|
275
|
+
g(this, z, this.getRootNode().host), g(this, Q, this.closest("nine-table-sheet")), this.innerHTML = `
|
|
276
276
|
<style>
|
|
277
277
|
nine-table-vscrollbar {
|
|
278
278
|
display: flex;
|
|
@@ -336,7 +336,7 @@ const ce = class ce extends HTMLElement {
|
|
|
336
336
|
<button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
|
|
337
337
|
`;
|
|
338
338
|
const e = /* @__PURE__ */ a(() => {
|
|
339
|
-
const s = t(this,
|
|
339
|
+
const s = t(this, z).shadowRoot.querySelector(".ng-container-body");
|
|
340
340
|
if (!s) {
|
|
341
341
|
setTimeout(e, 10);
|
|
342
342
|
return;
|
|
@@ -352,16 +352,16 @@ const ce = class ce extends HTMLElement {
|
|
|
352
352
|
e();
|
|
353
353
|
}
|
|
354
354
|
};
|
|
355
|
-
|
|
356
|
-
let
|
|
357
|
-
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar",
|
|
355
|
+
z = new WeakMap(), Q = new WeakMap(), D = new WeakMap(), S = new WeakMap(), ht = new WeakMap(), dt = new WeakMap(), Rt = new WeakMap(), a(ae, "NineTableVScrollBar");
|
|
356
|
+
let Zt = ae;
|
|
357
|
+
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", Zt);
|
|
358
358
|
var At, tt;
|
|
359
|
-
const
|
|
359
|
+
const H = class H {
|
|
360
360
|
/**
|
|
361
361
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
362
362
|
*/
|
|
363
363
|
static compileAll(i) {
|
|
364
|
-
return Array.isArray(i) ? i.map((e) =>
|
|
364
|
+
return Array.isArray(i) ? i.map((e) => H.compile(e)) : [];
|
|
365
365
|
}
|
|
366
366
|
/**
|
|
367
367
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
@@ -370,7 +370,7 @@ const M = class M {
|
|
|
370
370
|
var n, r, o, l;
|
|
371
371
|
if (!i) return null;
|
|
372
372
|
const e = i.cloneNode(!0);
|
|
373
|
-
return t(n =
|
|
373
|
+
return t(n = H, At).call(n, e), t(r = H, tt).call(r, e, "thead"), t(o = H, tt).call(o, e, "tbody"), t(l = H, tt).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((d, h) => {
|
|
374
374
|
const f = d.getAttribute("fixed");
|
|
375
375
|
f && e.querySelectorAll(`thead [data-col="${h}"], tbody [data-col="${h}"], tfoot [data-col="${h}"]`).forEach((u) => {
|
|
376
376
|
u.setAttribute("fixed", f);
|
|
@@ -378,7 +378,7 @@ const M = class M {
|
|
|
378
378
|
}), e;
|
|
379
379
|
}
|
|
380
380
|
};
|
|
381
|
-
At = new WeakMap(), tt = new WeakMap(), a(
|
|
381
|
+
At = new WeakMap(), tt = new WeakMap(), a(H, "TableCompiler"), c(H, At, /* @__PURE__ */ a((i) => {
|
|
382
382
|
if (!i.querySelector("colgroup")) {
|
|
383
383
|
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);
|
|
384
384
|
for (let o = 0; o < s; o++) {
|
|
@@ -392,7 +392,7 @@ At = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, At, /* @__PU
|
|
|
392
392
|
s ? s.after(e) : i.prepend(e);
|
|
393
393
|
}
|
|
394
394
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
395
|
-
}, "#ensureTableStructure")), c(
|
|
395
|
+
}, "#ensureTableStructure")), c(H, tt, /* @__PURE__ */ a((i, e) => {
|
|
396
396
|
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
397
397
|
if (r === 0 || n.length === 0) return;
|
|
398
398
|
let o = 0;
|
|
@@ -411,8 +411,8 @@ At = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, At, /* @__PU
|
|
|
411
411
|
}
|
|
412
412
|
const b = u.rowSpan || 1, y = u.colSpan || 1;
|
|
413
413
|
for (let m = 0; m < b; m++)
|
|
414
|
-
for (let
|
|
415
|
-
h + m < r && f +
|
|
414
|
+
for (let R = 0; R < y; R++)
|
|
415
|
+
h + m < r && f + R < o && (l[h + m][f + R] = m === 0 && R === 0 ? "1" : "0");
|
|
416
416
|
});
|
|
417
417
|
}), s.forEach((d) => {
|
|
418
418
|
const h = d.sectionRowIndex;
|
|
@@ -425,17 +425,17 @@ At = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, At, /* @__PU
|
|
|
425
425
|
});
|
|
426
426
|
});
|
|
427
427
|
}, "#resetColIndex"));
|
|
428
|
-
let
|
|
429
|
-
var
|
|
430
|
-
const
|
|
428
|
+
let Gt = H;
|
|
429
|
+
var _, w, I, T, B, F, N, et, Tt, qt, kt, ft, ut, Lt, Ct, gt, Ht, it, bt;
|
|
430
|
+
const ce = class ce {
|
|
431
431
|
constructor(i) {
|
|
432
|
-
c(this,
|
|
432
|
+
c(this, _);
|
|
433
433
|
c(this, w);
|
|
434
|
-
c(this,
|
|
434
|
+
c(this, I, /* @__PURE__ */ new Map());
|
|
435
435
|
c(this, T, null);
|
|
436
|
-
c(this,
|
|
437
|
-
c(this,
|
|
438
|
-
c(this,
|
|
436
|
+
c(this, B, null);
|
|
437
|
+
c(this, F, 0);
|
|
438
|
+
c(this, N, 40);
|
|
439
439
|
c(this, et, !1);
|
|
440
440
|
c(this, Tt, 3);
|
|
441
441
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
@@ -444,7 +444,7 @@ const he = class he {
|
|
|
444
444
|
i && (t(this, ft).call(this), t(this, it).call(this, i.scrollTop), (e = t(this, w).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
445
445
|
}, "refresh"));
|
|
446
446
|
v(this, "initialize", /* @__PURE__ */ a(() => {
|
|
447
|
-
g(this, T, null), t(this,
|
|
447
|
+
g(this, T, null), t(this, I).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
448
448
|
const r = t(this, w).querySelector(n);
|
|
449
449
|
if (!r) return;
|
|
450
450
|
const o = r.querySelector("table");
|
|
@@ -452,7 +452,7 @@ const he = class he {
|
|
|
452
452
|
const l = o.querySelector("tbody.bindable-tbody");
|
|
453
453
|
if (!l) return;
|
|
454
454
|
const h = Array.from(l.querySelectorAll("tr")).map((f) => f.cloneNode(!0));
|
|
455
|
-
t(this,
|
|
455
|
+
t(this, I).set(n, h);
|
|
456
456
|
});
|
|
457
457
|
const i = t(this, w).querySelector(".ng-container-body"), e = t(this, w).querySelector(".ng-container-left"), s = t(this, w).querySelector(".ng-container-right");
|
|
458
458
|
if (i) {
|
|
@@ -469,13 +469,13 @@ const he = class he {
|
|
|
469
469
|
}
|
|
470
470
|
}, "initialize"));
|
|
471
471
|
c(this, qt, /* @__PURE__ */ a((i, e) => {
|
|
472
|
-
const s = t(this,
|
|
472
|
+
const s = t(this, I).get(e);
|
|
473
473
|
if (!s || s.length === 0) return;
|
|
474
474
|
const n = i.querySelector("tbody.bindable-tbody");
|
|
475
475
|
if (!n) return;
|
|
476
476
|
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
477
477
|
const r = n.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
478
|
-
for (let l = 0; l < t(this,
|
|
478
|
+
for (let l = 0; l < t(this, N); l++)
|
|
479
479
|
s.forEach((d) => {
|
|
480
480
|
o.appendChild(d.cloneNode(!0));
|
|
481
481
|
});
|
|
@@ -484,7 +484,7 @@ const he = class he {
|
|
|
484
484
|
c(this, kt, /* @__PURE__ */ a((i) => {
|
|
485
485
|
if (t(this, T) !== null && t(this, T) > 0)
|
|
486
486
|
return t(this, T);
|
|
487
|
-
const e = t(this,
|
|
487
|
+
const e = t(this, I).get(".ng-container-body");
|
|
488
488
|
if (!e || e.length === 0) return 24;
|
|
489
489
|
const s = i.querySelector("tbody.bindable-tbody") || i.querySelector("tbody.bindable-tbody:last-of-type");
|
|
490
490
|
if (!s) return 24;
|
|
@@ -503,16 +503,16 @@ const he = class he {
|
|
|
503
503
|
}, "#measureAndCacheHeight"));
|
|
504
504
|
c(this, ft, /* @__PURE__ */ a(() => {
|
|
505
505
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
506
|
-
const s = (t(this,
|
|
507
|
-
|
|
506
|
+
const s = (t(this, _).data.get() || []).length, n = t(this, T) || 24, r = s * n;
|
|
507
|
+
W.log(`[VirtualHeight] totalCount: ${s}, rowHeight: ${n}, totalVirtualHeight: ${r}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
508
508
|
const l = t(this, w).querySelector(o), d = l == null ? void 0 : l.querySelector("table");
|
|
509
509
|
d && (d.style.height = `${r}px`);
|
|
510
510
|
});
|
|
511
511
|
}, "#updateVirtualScrollHeight"));
|
|
512
512
|
c(this, ut, /* @__PURE__ */ a(() => {
|
|
513
|
-
if ((t(this,
|
|
514
|
-
const e = Math.ceil(t(this,
|
|
515
|
-
g(this,
|
|
513
|
+
if ((t(this, _).data.get() || []).length, t(this, F) > 0 && t(this, T) > 0) {
|
|
514
|
+
const e = Math.ceil(t(this, F) / t(this, T));
|
|
515
|
+
g(this, N, e + t(this, Tt)), W.log("visibleRows:", e, "cachedRowCount:", t(this, N));
|
|
516
516
|
}
|
|
517
517
|
}, "#updateRowCount"));
|
|
518
518
|
c(this, Lt, /* @__PURE__ */ a(() => {
|
|
@@ -529,8 +529,8 @@ const he = class he {
|
|
|
529
529
|
y > 0 && (n[u] && (n[u].style.height = `${y}px`), r[u] && (r[u].style.height = `${y}px`), o[u] && (o[u].style.height = `${y}px`));
|
|
530
530
|
}
|
|
531
531
|
}, "#syncRowHeights"));
|
|
532
|
-
c(this,
|
|
533
|
-
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (g(this,
|
|
532
|
+
c(this, Ct, /* @__PURE__ */ a(() => {
|
|
533
|
+
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (g(this, B, new ResizeObserver((i) => {
|
|
534
534
|
for (const e of i) {
|
|
535
535
|
const s = e.target;
|
|
536
536
|
if (!s.classList.contains("active")) continue;
|
|
@@ -540,10 +540,10 @@ const he = class he {
|
|
|
540
540
|
const o = s.querySelector("thead");
|
|
541
541
|
o && (r += o.offsetHeight || o.getBoundingClientRect().height);
|
|
542
542
|
const l = Math.max(n - r, 100);
|
|
543
|
-
t(this,
|
|
543
|
+
t(this, F) !== l && (g(this, F, l), t(this, ut).call(this), t(this, T) !== null && t(this, gt).call(this));
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
})), t(this,
|
|
546
|
+
})), t(this, B).observe(t(this, w)));
|
|
547
547
|
}, "#initResizeObserver"));
|
|
548
548
|
c(this, gt, /* @__PURE__ */ a(() => {
|
|
549
549
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
@@ -551,21 +551,21 @@ const he = class he {
|
|
|
551
551
|
e && e.querySelector("tbody.bindable-tbody") && t(this, qt).call(this, e, i);
|
|
552
552
|
}), t(this, Lt).call(this);
|
|
553
553
|
}, "#renderAllContainers"));
|
|
554
|
-
c(this,
|
|
554
|
+
c(this, Ht, /* @__PURE__ */ a((i) => {
|
|
555
555
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
556
556
|
var h;
|
|
557
557
|
const s = t(this, w).querySelector(e);
|
|
558
558
|
if (!s) return;
|
|
559
559
|
const n = s.querySelector("tbody.bindable-tbody");
|
|
560
560
|
if (!n) return;
|
|
561
|
-
const r = Array.from(n.querySelectorAll("tr:not(.nodata)")), o = ((h = t(this,
|
|
561
|
+
const r = Array.from(n.querySelectorAll("tr:not(.nodata)")), o = ((h = t(this, I).get(e)) == null ? void 0 : h.length) || 1, d = (t(this, _).data.get() || []).length;
|
|
562
562
|
r.forEach((f, u) => {
|
|
563
563
|
const b = i + Math.floor(u / o);
|
|
564
564
|
if (b >= d) {
|
|
565
565
|
f.style.display = "none";
|
|
566
566
|
return;
|
|
567
567
|
}
|
|
568
|
-
const y = t(this,
|
|
568
|
+
const y = t(this, _).data.get(b);
|
|
569
569
|
f.style.display = "", t(this, bt).call(this, f, y, b);
|
|
570
570
|
});
|
|
571
571
|
});
|
|
@@ -574,23 +574,23 @@ const he = class he {
|
|
|
574
574
|
var d;
|
|
575
575
|
const e = t(this, T);
|
|
576
576
|
if (!e || e <= 0) return;
|
|
577
|
-
const n = (t(this,
|
|
578
|
-
|
|
577
|
+
const n = (t(this, _).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, I).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this, N);
|
|
578
|
+
W.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, N)}, targetDataIndex range: ${r} ~ ${l} (Total: ${n})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
579
579
|
const f = t(this, w).querySelector(h);
|
|
580
580
|
if (!f) return;
|
|
581
581
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
582
582
|
if (!u) return;
|
|
583
583
|
Array.from(u.querySelectorAll("tr:not(.nodata)")).forEach((y, m) => {
|
|
584
|
-
const
|
|
585
|
-
if (
|
|
584
|
+
const R = r + Math.floor(m / o);
|
|
585
|
+
if (R >= n) {
|
|
586
586
|
y.style.display = "none";
|
|
587
587
|
return;
|
|
588
588
|
}
|
|
589
|
-
const
|
|
590
|
-
y.style.display = "", t(this, bt).call(this, y,
|
|
589
|
+
const J = t(this, _).data.get(R);
|
|
590
|
+
y.style.display = "", t(this, bt).call(this, y, J, R);
|
|
591
591
|
});
|
|
592
592
|
}), t(this, et) || (g(this, et, !0), setTimeout(() => {
|
|
593
|
-
t(this,
|
|
593
|
+
t(this, Ht).call(this, r), g(this, et, !1);
|
|
594
594
|
}, 0));
|
|
595
595
|
}, "#handleScroll"));
|
|
596
596
|
c(this, bt, /* @__PURE__ */ a((i, e, s) => {
|
|
@@ -600,33 +600,33 @@ const he = class he {
|
|
|
600
600
|
});
|
|
601
601
|
}, "#bindRowData"));
|
|
602
602
|
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
603
|
-
t(this,
|
|
603
|
+
t(this, B) && (t(this, B).disconnect(), g(this, B, null));
|
|
604
604
|
}, "destroy"));
|
|
605
|
-
g(this,
|
|
605
|
+
g(this, _, i.getRootNode().host), g(this, w, i), t(this, Ct).call(this);
|
|
606
606
|
}
|
|
607
607
|
getRowHeight() {
|
|
608
608
|
return t(this, T);
|
|
609
609
|
}
|
|
610
610
|
templateLength(i = ".ng-container-body") {
|
|
611
611
|
var e;
|
|
612
|
-
return ((e = t(this,
|
|
612
|
+
return ((e = t(this, I).get(i)) == null ? void 0 : e.length) || 1;
|
|
613
613
|
}
|
|
614
614
|
};
|
|
615
|
-
|
|
616
|
-
let
|
|
617
|
-
var Mt, st,
|
|
615
|
+
_ = new WeakMap(), w = new WeakMap(), I = new WeakMap(), T = new WeakMap(), B = new WeakMap(), F = new WeakMap(), N = new WeakMap(), et = new WeakMap(), Tt = new WeakMap(), qt = new WeakMap(), kt = new WeakMap(), ft = new WeakMap(), ut = new WeakMap(), Lt = new WeakMap(), Ct = new WeakMap(), gt = new WeakMap(), Ht = new WeakMap(), it = new WeakMap(), bt = new WeakMap(), a(ce, "RowManager");
|
|
616
|
+
let Jt = ce;
|
|
617
|
+
var Mt, st, j, _t, $t, It, Wt, Ot;
|
|
618
618
|
const ct = class ct extends HTMLElement {
|
|
619
619
|
constructor() {
|
|
620
620
|
super();
|
|
621
621
|
c(this, Mt);
|
|
622
622
|
c(this, st, null);
|
|
623
|
-
c(this,
|
|
623
|
+
c(this, j);
|
|
624
624
|
/**
|
|
625
625
|
* data.set, add, delete
|
|
626
626
|
* filter, sorting : κ³ λ €λμ
|
|
627
627
|
*/
|
|
628
628
|
v(this, "invalidate", /* @__PURE__ */ a(() => {
|
|
629
|
-
t(this,
|
|
629
|
+
t(this, j).refresh();
|
|
630
630
|
}, "invalidate"));
|
|
631
631
|
c(this, _t, /* @__PURE__ */ a(() => {
|
|
632
632
|
[
|
|
@@ -652,13 +652,13 @@ const ct = class ct extends HTMLElement {
|
|
|
652
652
|
});
|
|
653
653
|
}, "#updateContainerWidths"));
|
|
654
654
|
v(this, "generate", /* @__PURE__ */ a((e) => {
|
|
655
|
-
e && (g(this, st,
|
|
655
|
+
e && (g(this, st, Gt.compile(e)), t(this, st).style.display = "table", t(this, _t).call(this), t(this, $t).call(this), requestAnimationFrame(() => {
|
|
656
656
|
var n;
|
|
657
657
|
const s = (n = this.querySelector("thead")) == null ? void 0 : n.getBoundingClientRect().height;
|
|
658
658
|
this.querySelectorAll("tbody.fixed-tbody").forEach((r) => {
|
|
659
659
|
r.style.top = `${s}px`;
|
|
660
660
|
});
|
|
661
|
-
}), t(this,
|
|
661
|
+
}), t(this, j).initialize(), setTimeout(() => {
|
|
662
662
|
var s;
|
|
663
663
|
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
664
664
|
}, 0));
|
|
@@ -680,7 +680,7 @@ const ct = class ct extends HTMLElement {
|
|
|
680
680
|
o.remove();
|
|
681
681
|
}), n;
|
|
682
682
|
}, "#createSplitTable"));
|
|
683
|
-
v(this, "getRowHeight", /* @__PURE__ */ a(() => t(this,
|
|
683
|
+
v(this, "getRowHeight", /* @__PURE__ */ a(() => t(this, j).getRowHeight(), "getRowHeight"));
|
|
684
684
|
v(this, "scrollToX", /* @__PURE__ */ a((e) => {
|
|
685
685
|
const s = this.querySelector(".ng-container-body");
|
|
686
686
|
s && (s.scrollLeft = e);
|
|
@@ -839,20 +839,20 @@ const ct = class ct extends HTMLElement {
|
|
|
839
839
|
</div>
|
|
840
840
|
`;
|
|
841
841
|
}, "#render"));
|
|
842
|
-
g(this,
|
|
842
|
+
g(this, j, new Jt(this)), g(this, Mt, this.getRootNode().host);
|
|
843
843
|
}
|
|
844
844
|
connectedCallback() {
|
|
845
845
|
t(this, Wt).call(this);
|
|
846
846
|
}
|
|
847
847
|
disconnectedCallback() {
|
|
848
|
-
this.innerHTML = "",
|
|
848
|
+
this.innerHTML = "", W.log("NineTableSheet destroyed.");
|
|
849
849
|
}
|
|
850
850
|
};
|
|
851
|
-
Mt = new WeakMap(), st = new WeakMap(),
|
|
851
|
+
Mt = new WeakMap(), st = new WeakMap(), j = new WeakMap(), _t = new WeakMap(), $t = new WeakMap(), It = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(), a(ct, "NineTableSheet"), v(ct, "SCROLLBAR_SIZE", 16);
|
|
852
852
|
let wt = ct;
|
|
853
853
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", wt);
|
|
854
854
|
var zt, yt;
|
|
855
|
-
const
|
|
855
|
+
const he = class he extends HTMLElement {
|
|
856
856
|
constructor() {
|
|
857
857
|
super();
|
|
858
858
|
c(this, zt, /* @__PURE__ */ a(() => {
|
|
@@ -869,8 +869,8 @@ const de = class de extends HTMLElement {
|
|
|
869
869
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((y) => y.style.setProperty("display", "none"));
|
|
870
870
|
const b = f.filter((y) => y.classList.contains("active"));
|
|
871
871
|
b.length < 2 || b.forEach((y) => {
|
|
872
|
-
const m = parseInt(y.getAttribute("data-index"), 10),
|
|
873
|
-
|
|
872
|
+
const m = parseInt(y.getAttribute("data-index"), 10), R = this.querySelector(`nine-splitter[data-split-index="${m}"]`), J = f[m + 1];
|
|
873
|
+
R && J && J.classList.contains("active") && R.style.setProperty("display", "flex");
|
|
874
874
|
});
|
|
875
875
|
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), d = o.querySelectorAll("nine-table-sheet");
|
|
876
876
|
if (!l[e]) return;
|
|
@@ -899,11 +899,11 @@ const de = class de extends HTMLElement {
|
|
|
899
899
|
t(this, zt).call(this);
|
|
900
900
|
}
|
|
901
901
|
};
|
|
902
|
-
zt = new WeakMap(), yt = new WeakMap(), a(
|
|
903
|
-
let
|
|
904
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
902
|
+
zt = new WeakMap(), yt = new WeakMap(), a(he, "NineTableSheets");
|
|
903
|
+
let Qt = he;
|
|
904
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Qt);
|
|
905
905
|
var q, Dt, pt, Bt;
|
|
906
|
-
const
|
|
906
|
+
const de = class de {
|
|
907
907
|
constructor(i) {
|
|
908
908
|
c(this, q);
|
|
909
909
|
c(this, Dt, /* @__PURE__ */ a(() => {
|
|
@@ -1025,10 +1025,10 @@ const fe = class fe {
|
|
|
1025
1025
|
g(this, q, i), t(this, Dt).call(this);
|
|
1026
1026
|
}
|
|
1027
1027
|
};
|
|
1028
|
-
q = new WeakMap(), Dt = new WeakMap(), pt = new WeakMap(), Bt = new WeakMap(), a(
|
|
1029
|
-
let
|
|
1028
|
+
q = new WeakMap(), Dt = new WeakMap(), pt = new WeakMap(), Bt = new WeakMap(), a(de, "LayoutManager");
|
|
1029
|
+
let te = de;
|
|
1030
1030
|
var mt, nt;
|
|
1031
|
-
const
|
|
1031
|
+
const fe = class fe {
|
|
1032
1032
|
constructor(i) {
|
|
1033
1033
|
c(this, mt);
|
|
1034
1034
|
c(this, nt, -1);
|
|
@@ -1043,29 +1043,29 @@ const ue = class ue {
|
|
|
1043
1043
|
});
|
|
1044
1044
|
}
|
|
1045
1045
|
};
|
|
1046
|
-
mt = new WeakMap(), nt = new WeakMap(), a(
|
|
1047
|
-
let
|
|
1048
|
-
var
|
|
1046
|
+
mt = new WeakMap(), nt = new WeakMap(), a(fe, "ngRow");
|
|
1047
|
+
let ee = fe;
|
|
1048
|
+
var k, E, L, ot, Nt, P, Pt, K, xt, Vt, Yt, rt;
|
|
1049
1049
|
const C = class C {
|
|
1050
1050
|
constructor(i, e) {
|
|
1051
|
-
c(this,
|
|
1052
|
-
c(this,
|
|
1053
|
-
c(this,
|
|
1051
|
+
c(this, k);
|
|
1052
|
+
c(this, E);
|
|
1053
|
+
c(this, L, []);
|
|
1054
1054
|
c(this, ot, []);
|
|
1055
1055
|
c(this, Nt, 0);
|
|
1056
|
-
c(this,
|
|
1056
|
+
c(this, P, []);
|
|
1057
1057
|
c(this, Pt, /* @__PURE__ */ a(() => {
|
|
1058
|
-
g(this,
|
|
1059
|
-
const i = t(this,
|
|
1058
|
+
g(this, P, []);
|
|
1059
|
+
const i = t(this, k).template || [];
|
|
1060
1060
|
Array.from(i).forEach((e) => {
|
|
1061
1061
|
var s;
|
|
1062
|
-
t(this,
|
|
1063
|
-
}), (t(this,
|
|
1064
|
-
e.__ng || (e.__ng = t(this, xt).call(this)), e.__ng.height = t(this,
|
|
1062
|
+
t(this, P).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1063
|
+
}), (t(this, E).rawRecords || []).forEach((e) => {
|
|
1064
|
+
e.__ng || (e.__ng = t(this, xt).call(this)), e.__ng.height = t(this, P).slice();
|
|
1065
1065
|
});
|
|
1066
1066
|
}, "#initialize"));
|
|
1067
|
-
c(this,
|
|
1068
|
-
t(this,
|
|
1067
|
+
c(this, K, /* @__PURE__ */ a(() => {
|
|
1068
|
+
t(this, k).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1069
1069
|
i.invalidate();
|
|
1070
1070
|
});
|
|
1071
1071
|
}, "#invalidate"));
|
|
@@ -1075,7 +1075,7 @@ const C = class C {
|
|
|
1075
1075
|
if (!s || s.length <= 0) return;
|
|
1076
1076
|
if (i == null) return t(this, rt).call(this, s);
|
|
1077
1077
|
if (i < 0 || i >= s.length) return null;
|
|
1078
|
-
const n = typeof ((r = t(this,
|
|
1078
|
+
const n = typeof ((r = t(this, k).fields) == null ? void 0 : r.get) == "function" ? t(this, k).fields.get() : [];
|
|
1079
1079
|
if (e != null) {
|
|
1080
1080
|
const o = n.indexOf(e);
|
|
1081
1081
|
return o >= 0 ? s[i].v[o] : null;
|
|
@@ -1083,28 +1083,28 @@ const C = class C {
|
|
|
1083
1083
|
return t(this, rt).call(this, s[i]);
|
|
1084
1084
|
}, "get"));
|
|
1085
1085
|
v(this, "set", /* @__PURE__ */ a((i) => {
|
|
1086
|
-
this.clear(), this.add(i, !1), t(this,
|
|
1086
|
+
this.clear(), this.add(i, !1), t(this, K).call(this);
|
|
1087
1087
|
}, "set"));
|
|
1088
1088
|
c(this, xt, /* @__PURE__ */ a(() => ({
|
|
1089
1089
|
rowState: C.ROW_STATE.EMPTY,
|
|
1090
1090
|
deleted: !1,
|
|
1091
1091
|
filtered: !1,
|
|
1092
|
-
height: t(this,
|
|
1092
|
+
height: t(this, P).slice(),
|
|
1093
1093
|
o: {},
|
|
1094
1094
|
c: {},
|
|
1095
|
-
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this,
|
|
1095
|
+
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, P).slice(), -1, {}, {}]
|
|
1096
1096
|
}), "#getDefaultMeta"));
|
|
1097
1097
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
1098
|
-
g(this,
|
|
1098
|
+
g(this, L, []), g(this, ot, []), t(this, K).call(this);
|
|
1099
1099
|
}, "reset"));
|
|
1100
1100
|
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
1101
1101
|
var i;
|
|
1102
|
-
t(this,
|
|
1102
|
+
t(this, E).rawRecords = [], g(this, L, []), g(this, ot, []), (i = t(this, E).viewRecords) != null && i.reset && t(this, E).viewRecords.reset();
|
|
1103
1103
|
}, "clear"));
|
|
1104
1104
|
c(this, Vt, /* @__PURE__ */ a((i) => {
|
|
1105
1105
|
var n;
|
|
1106
1106
|
Array.isArray(i) || (i = [i]);
|
|
1107
|
-
const e = typeof ((n = t(this,
|
|
1107
|
+
const e = typeof ((n = t(this, k).fields) == null ? void 0 : n.get) == "function" ? t(this, k).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1108
1108
|
return i.forEach((r) => {
|
|
1109
1109
|
const o = { v: [] };
|
|
1110
1110
|
e.forEach((l) => {
|
|
@@ -1118,28 +1118,28 @@ const C = class C {
|
|
|
1118
1118
|
v(this, "add", /* @__PURE__ */ a((i, e = !0) => {
|
|
1119
1119
|
i === void 0 && (i = {});
|
|
1120
1120
|
const s = t(this, Vt).call(this, i);
|
|
1121
|
-
t(this,
|
|
1121
|
+
t(this, E).rawRecords = t(this, E).rawRecords.concat(t(this, Yt).call(this, s)), this.resetRecords();
|
|
1122
1122
|
const n = this.count() - 1;
|
|
1123
1123
|
return e || s.forEach((r, o) => {
|
|
1124
|
-
const l = t(this,
|
|
1124
|
+
const l = t(this, E).rawRecords[n - o];
|
|
1125
1125
|
l && (l.__ng.rowState = C.ROW_STATE.EMPTY);
|
|
1126
|
-
}), t(this,
|
|
1126
|
+
}), t(this, K).call(this), n;
|
|
1127
1127
|
}, "add"));
|
|
1128
1128
|
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
1129
1129
|
let e = [];
|
|
1130
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this,
|
|
1131
|
-
if (t(this,
|
|
1132
|
-
const n = t(this,
|
|
1133
|
-
t(this,
|
|
1130
|
+
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s, n) => n - s).forEach((s) => {
|
|
1131
|
+
if (t(this, L)[s]) {
|
|
1132
|
+
const n = t(this, L)[s].__ng.rowid;
|
|
1133
|
+
t(this, L)[s].__ng.rowState === C.ROW_STATE.INSERT ? t(this, E).rawRecords = t(this, E).rawRecords.filter((r) => r.__ng.rowid !== n) : t(this, E).rawRecords.forEach((r) => {
|
|
1134
1134
|
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState = C.ROW_STATE.DELETE);
|
|
1135
1135
|
});
|
|
1136
1136
|
}
|
|
1137
|
-
}), this.resetRecords(), t(this,
|
|
1137
|
+
}), this.resetRecords(), t(this, K).call(this);
|
|
1138
1138
|
}, "delete"));
|
|
1139
1139
|
v(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
|
|
1140
1140
|
var d;
|
|
1141
1141
|
i = parseInt(i, 10);
|
|
1142
|
-
const r = (typeof ((d = t(this,
|
|
1142
|
+
const r = (typeof ((d = t(this, k).fields) == null ? void 0 : d.get) == "function" ? t(this, k).fields.get() : []).indexOf(e);
|
|
1143
1143
|
if (r < 0) return;
|
|
1144
1144
|
const o = this.getValidData()[i];
|
|
1145
1145
|
if (!o) return;
|
|
@@ -1147,17 +1147,17 @@ const C = class C {
|
|
|
1147
1147
|
l !== s && o.__ng.rowState !== C.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = l), o.__ng.rowState = C.ROW_STATE.UPDATE), o.v[r] = s;
|
|
1148
1148
|
}, "setValue"));
|
|
1149
1149
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1150
|
-
g(this, ot, t(this,
|
|
1150
|
+
g(this, ot, t(this, E).rawRecords.filter((i) => !i.__ng.deleted)), g(this, L, t(this, E).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, E).rawRecords.forEach((i, e) => {
|
|
1151
1151
|
i.__ng.rowidx = e;
|
|
1152
|
-
}), t(this,
|
|
1152
|
+
}), t(this, L).forEach((i, e) => {
|
|
1153
1153
|
i.__ng.i = e;
|
|
1154
1154
|
});
|
|
1155
1155
|
}, "resetRecords"));
|
|
1156
|
-
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this,
|
|
1156
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this, L).length === 0 && t(this, E).rawRecords.length > 0 && this.resetRecords(), t(this, L)), "getValidData"));
|
|
1157
1157
|
c(this, rt, /* @__PURE__ */ a((i) => {
|
|
1158
1158
|
var o;
|
|
1159
1159
|
if (!i) return i;
|
|
1160
|
-
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this,
|
|
1160
|
+
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this, k).fields) == null ? void 0 : o.get) == "function" ? t(this, k).fields.get() : [], r = s.filter((l) => !l.__ng.deleted).map((l) => {
|
|
1161
1161
|
const d = {};
|
|
1162
1162
|
return n.forEach((h, f) => {
|
|
1163
1163
|
d[h] = l.v ? l.v[f] : l[h];
|
|
@@ -1166,25 +1166,25 @@ const C = class C {
|
|
|
1166
1166
|
return e ? r[0] : r;
|
|
1167
1167
|
}, "#conv"));
|
|
1168
1168
|
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
1169
|
-
g(this,
|
|
1169
|
+
g(this, k, i), g(this, E, e), t(this, Pt).call(this);
|
|
1170
1170
|
}
|
|
1171
1171
|
get source() {
|
|
1172
|
-
return t(this, rt).call(this, t(this,
|
|
1172
|
+
return t(this, rt).call(this, t(this, E).rawRecords);
|
|
1173
1173
|
}
|
|
1174
1174
|
set source(i) {
|
|
1175
1175
|
this.clear(), this.add(i, !1);
|
|
1176
1176
|
}
|
|
1177
1177
|
get nextId() {
|
|
1178
|
-
return ++
|
|
1178
|
+
return ++ve(this, Nt)._;
|
|
1179
1179
|
}
|
|
1180
1180
|
get length() {
|
|
1181
|
-
return t(this,
|
|
1181
|
+
return t(this, L).length;
|
|
1182
1182
|
}
|
|
1183
1183
|
getRowCount() {
|
|
1184
1184
|
return this.length;
|
|
1185
1185
|
}
|
|
1186
1186
|
};
|
|
1187
|
-
|
|
1187
|
+
k = new WeakMap(), E = new WeakMap(), L = new WeakMap(), ot = new WeakMap(), Nt = new WeakMap(), P = new WeakMap(), Pt = new WeakMap(), K = new WeakMap(), xt = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), rt = new WeakMap(), a(C, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1188
1188
|
v(C, "ROW_STATE", {
|
|
1189
1189
|
EMPTY: "EMPTY",
|
|
1190
1190
|
NORMAL: "NORMAL",
|
|
@@ -1192,14 +1192,14 @@ v(C, "ROW_STATE", {
|
|
|
1192
1192
|
UPDATE: "UPDATE",
|
|
1193
1193
|
DELETE: "DELETE"
|
|
1194
1194
|
});
|
|
1195
|
-
let
|
|
1196
|
-
var
|
|
1197
|
-
const
|
|
1195
|
+
let ie = C;
|
|
1196
|
+
var Z;
|
|
1197
|
+
const ue = class ue {
|
|
1198
1198
|
constructor(i) {
|
|
1199
|
-
c(this,
|
|
1200
|
-
g(this,
|
|
1199
|
+
c(this, Z);
|
|
1200
|
+
g(this, Z, i), this.row = new ee(this), this.data = new ie(t(this, Z), this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1201
1201
|
var e;
|
|
1202
|
-
(e = t(this,
|
|
1202
|
+
(e = t(this, Z).view) != null && e.redraw && t(this, Z).view.redraw();
|
|
1203
1203
|
}, this.setDataSource = (e) => {
|
|
1204
1204
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1205
1205
|
}, this.getRowState = (e) => {
|
|
@@ -1214,10 +1214,10 @@ const ge = class ge {
|
|
|
1214
1214
|
}, this.setDataSource([]);
|
|
1215
1215
|
}
|
|
1216
1216
|
};
|
|
1217
|
-
|
|
1218
|
-
let
|
|
1217
|
+
Z = new WeakMap(), a(ue, "ngDataManager");
|
|
1218
|
+
let se = ue;
|
|
1219
1219
|
var lt, A, vt, Xt;
|
|
1220
|
-
const
|
|
1220
|
+
const ge = class ge {
|
|
1221
1221
|
// π― μ΄μ { name: string, type: string } κ°μ²΄λ€μ λ°°μ΄λ‘ κ΄λ¦¬ν©λλ€.
|
|
1222
1222
|
constructor(i) {
|
|
1223
1223
|
c(this, lt);
|
|
@@ -1234,11 +1234,11 @@ const be = class be {
|
|
|
1234
1234
|
}), g(this, A, Array.from(i, ([e, s]) => ({ name: e, type: s }))), g(this, A, t(this, A).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, A).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1235
1235
|
}, "#adjust"));
|
|
1236
1236
|
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1237
|
-
g(this, A, []),
|
|
1237
|
+
g(this, A, []), W.log(t(this, lt).querySelectorAll("table"));
|
|
1238
1238
|
const i = Array.from(t(this, lt).querySelectorAll("table"));
|
|
1239
1239
|
if (!(!i || i.length === 0)) {
|
|
1240
1240
|
for (const e of i)
|
|
1241
|
-
|
|
1241
|
+
W.log(e), $("[data-bind]", e).each((s, n) => {
|
|
1242
1242
|
const r = n.dataset.bind, o = n.getAttribute("data-type") || "string";
|
|
1243
1243
|
r && t(this, A).push({ name: r, type: o });
|
|
1244
1244
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1287,40 +1287,40 @@ const be = class be {
|
|
|
1287
1287
|
return t(this, A).some((e) => e.name === i);
|
|
1288
1288
|
}
|
|
1289
1289
|
};
|
|
1290
|
-
lt = new WeakMap(), A = new WeakMap(), vt = new WeakMap(), Xt = new WeakMap(), a(
|
|
1291
|
-
let
|
|
1292
|
-
var
|
|
1293
|
-
const
|
|
1290
|
+
lt = new WeakMap(), A = new WeakMap(), vt = new WeakMap(), Xt = new WeakMap(), a(ge, "ngFields");
|
|
1291
|
+
let ne = ge;
|
|
1292
|
+
var G, Ut, Ft;
|
|
1293
|
+
const be = class be extends HTMLElement {
|
|
1294
1294
|
constructor() {
|
|
1295
1295
|
super();
|
|
1296
1296
|
//#created = false;
|
|
1297
|
-
c(this,
|
|
1297
|
+
c(this, G);
|
|
1298
1298
|
c(this, Ut);
|
|
1299
1299
|
c(this, Ft, /* @__PURE__ */ a(() => {
|
|
1300
|
-
this.fields = new
|
|
1300
|
+
this.fields = new ne(this), g(this, Ut, new te(this)), W.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1301
1301
|
}, "#init"));
|
|
1302
|
-
this.attachShadow({ mode: "open" }), g(this,
|
|
1302
|
+
this.attachShadow({ mode: "open" }), g(this, G, new se(this));
|
|
1303
1303
|
}
|
|
1304
1304
|
connectedCallback() {
|
|
1305
1305
|
t(this, Ft).call(this);
|
|
1306
1306
|
}
|
|
1307
1307
|
disconnectedCallback() {
|
|
1308
|
-
|
|
1308
|
+
W.log("NineTable disconnected.");
|
|
1309
1309
|
}
|
|
1310
1310
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1311
1311
|
get data() {
|
|
1312
|
-
return t(this,
|
|
1312
|
+
return t(this, G).data;
|
|
1313
1313
|
}
|
|
1314
1314
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
1315
1315
|
get row() {
|
|
1316
|
-
return t(this,
|
|
1316
|
+
return t(this, G).row;
|
|
1317
1317
|
}
|
|
1318
1318
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
1319
1319
|
get dataManager() {
|
|
1320
|
-
return t(this,
|
|
1320
|
+
return t(this, G);
|
|
1321
1321
|
}
|
|
1322
1322
|
};
|
|
1323
|
-
|
|
1324
|
-
let
|
|
1325
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
1323
|
+
G = new WeakMap(), Ut = new WeakMap(), Ft = new WeakMap(), a(be, "NineTable");
|
|
1324
|
+
let oe = be;
|
|
1325
|
+
customElements.get("nine-table") || customElements.define("nine-table", oe);
|
|
1326
1326
|
//# sourceMappingURL=nine-table.js.map
|