@ninebone/table 0.0.225 β 0.0.228
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 +158 -158
- 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,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var $e = Object.defineProperty;
|
|
2
|
+
var We = (w) => {
|
|
3
3
|
throw TypeError(w);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var a = (w, i) =>
|
|
7
|
-
var x = (w, i, t) =>
|
|
8
|
-
var e = (w, i, t) => (
|
|
9
|
-
var
|
|
5
|
+
var Be = (w, i, t) => i in w ? $e(w, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : w[i] = t;
|
|
6
|
+
var a = (w, i) => $e(w, "name", { value: i, configurable: !0 });
|
|
7
|
+
var x = (w, i, t) => Be(w, typeof i != "symbol" ? i + "" : i, t), ze = (w, i, t) => i.has(w) || We("Cannot " + t);
|
|
8
|
+
var e = (w, i, t) => (ze(w, i, "read from private field"), t ? t.call(w) : i.get(w)), d = (w, i, t) => i.has(w) ? We("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(w) : i.set(w, t), y = (w, i, t, s) => (ze(w, i, "write to private field"), s ? s.call(w, t) : i.set(w, t), t);
|
|
9
|
+
var Oe = (w, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
11
|
y(w, i, n, t);
|
|
12
12
|
},
|
|
@@ -14,26 +14,26 @@ var ze = (w, i, t, s) => ({
|
|
|
14
14
|
return e(w, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
import { trace as
|
|
18
|
-
const
|
|
17
|
+
import { trace as De } from "@ninebone/util";
|
|
18
|
+
const qe = class qe extends De.constructor {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
a(
|
|
24
|
-
let
|
|
25
|
-
const j = new
|
|
23
|
+
a(qe, "Trace");
|
|
24
|
+
let me = qe;
|
|
25
|
+
const j = new me();
|
|
26
26
|
var C, B, p, D, N, P, se, V, ne;
|
|
27
|
-
const
|
|
27
|
+
const ke = class ke extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
d(this, C);
|
|
31
|
+
d(this, B, !1);
|
|
32
|
+
d(this, p);
|
|
33
|
+
d(this, D);
|
|
34
|
+
d(this, N);
|
|
35
|
+
d(this, P);
|
|
36
|
+
d(this, se, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!e(this, C)) return;
|
|
38
38
|
const t = e(this, C).querySelector(".ng-container-body");
|
|
39
39
|
t && (y(this, P, new ResizeObserver(() => {
|
|
@@ -44,8 +44,8 @@ const qe = class qe extends HTMLElement {
|
|
|
44
44
|
if (!e(this, C) || !e(this, p) || e(this, B)) return;
|
|
45
45
|
const t = e(this, p).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = e(this, p).track, r = e(this, p).thumb, o = e(this, C).querySelector(".ng-container-bottom"), c = t.clientWidth,
|
|
48
|
-
if (c !== 0 &&
|
|
47
|
+
const n = e(this, p).track, r = e(this, p).thumb, o = e(this, C).querySelector(".ng-container-bottom"), c = t.clientWidth, f = s.scrollWidth;
|
|
48
|
+
if (c !== 0 && f > c)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
o && (o.style.display = "none");
|
|
@@ -53,28 +53,28 @@ const qe = class qe extends HTMLElement {
|
|
|
53
53
|
}
|
|
54
54
|
const l = n.clientWidth;
|
|
55
55
|
if (l <= 0) return;
|
|
56
|
-
const h = Math.max(Math.min(l * (c /
|
|
56
|
+
const h = Math.max(Math.min(l * (c / f), l), 20);
|
|
57
57
|
r.style.width = `${h}px`;
|
|
58
|
-
const u = t.scrollLeft, b =
|
|
58
|
+
const u = t.scrollLeft, b = f - c;
|
|
59
59
|
let g = 0;
|
|
60
60
|
b > 0 && (g = parseInt(u / b * (l - h), 10)), g < 0 && (g = 0);
|
|
61
61
|
const m = l - h;
|
|
62
62
|
g > m && (g = m), r.style.left = `${g}px`, j.log(g), e(this, p).left.disabled = g === 0, e(this, p).right.disabled = g >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
|
|
64
|
+
d(this, V, /* @__PURE__ */ a((t) => {
|
|
65
65
|
if (!e(this, p)) return !1;
|
|
66
66
|
const s = e(this, p).container, n = s.querySelector("table");
|
|
67
67
|
if (!n) return !1;
|
|
68
68
|
const r = e(this, p).track.getBoundingClientRect(), o = e(this, p).thumb.clientWidth;
|
|
69
69
|
let c = t;
|
|
70
70
|
c < 0 && (c = 0);
|
|
71
|
-
const
|
|
72
|
-
c >
|
|
71
|
+
const f = r.width - o;
|
|
72
|
+
c > f && (c = f), c = parseInt(c, 10), e(this, p).thumb.style.left = `${c}px`, e(this, p).left.disabled = c === 0, e(this, p).right.disabled = c >= f - 1;
|
|
73
73
|
const l = s.clientWidth, h = n.scrollWidth;
|
|
74
|
-
let u =
|
|
75
|
-
return -u > h - l && (u = -(h - l)), -u + 5 > h - l && (u = -(h - l)), l >= h && (u = 0), n.style.transform = `translateX(${u}px)`, c > 0 && c <
|
|
74
|
+
let u = f > 0 ? -c * (h - l) / f : 0;
|
|
75
|
+
return -u > h - l && (u = -(h - l)), -u + 5 > h - l && (u = -(h - l)), l >= h && (u = 0), n.style.transform = `translateX(${u}px)`, c > 0 && c < f - 1;
|
|
76
76
|
}, "#thumbMoveTo"));
|
|
77
|
-
|
|
77
|
+
d(this, ne, /* @__PURE__ */ a(() => {
|
|
78
78
|
const t = /* @__PURE__ */ a((n) => {
|
|
79
79
|
clearInterval(e(this, D)), clearInterval(e(this, N));
|
|
80
80
|
const r = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
@@ -103,8 +103,8 @@ const qe = class qe extends HTMLElement {
|
|
|
103
103
|
n.stopPropagation(), n.preventDefault(), y(this, B, !0), this.shiftX = n.clientX - e(this, p).thumb.getBoundingClientRect().left;
|
|
104
104
|
const r = /* @__PURE__ */ a((c) => {
|
|
105
105
|
if (!e(this, B)) return;
|
|
106
|
-
const
|
|
107
|
-
e(this, V).call(this, c.clientX -
|
|
106
|
+
const f = e(this, p).track.getBoundingClientRect();
|
|
107
|
+
e(this, V).call(this, c.clientX - f.left - this.shiftX);
|
|
108
108
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
109
109
|
y(this, B, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
110
110
|
}, "onMouseUp");
|
|
@@ -197,26 +197,26 @@ const qe = class qe extends HTMLElement {
|
|
|
197
197
|
e(this, P) && e(this, P).disconnect();
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
|
-
C = new WeakMap(), B = new WeakMap(), p = new WeakMap(), D = new WeakMap(), N = new WeakMap(), P = new WeakMap(), se = new WeakMap(), V = new WeakMap(), ne = new WeakMap(), a(
|
|
201
|
-
let
|
|
202
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar",
|
|
203
|
-
var $,
|
|
200
|
+
C = new WeakMap(), B = new WeakMap(), p = new WeakMap(), D = new WeakMap(), N = new WeakMap(), P = new WeakMap(), se = new WeakMap(), V = new WeakMap(), ne = new WeakMap(), a(ke, "NineTableHScrollBar");
|
|
201
|
+
let we = ke;
|
|
202
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", we);
|
|
203
|
+
var $, L, S, W, M, H, re, oe, le, J;
|
|
204
204
|
const Le = class Le {
|
|
205
205
|
constructor(i) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
206
|
+
d(this, $);
|
|
207
|
+
d(this, L, []);
|
|
208
|
+
d(this, S, null);
|
|
209
|
+
d(this, W, null);
|
|
210
|
+
d(this, M, 0);
|
|
211
|
+
d(this, H, 0);
|
|
212
212
|
x(this, "getRowHeight", /* @__PURE__ */ a(() => e(this, S), "getRowHeight"));
|
|
213
|
-
|
|
213
|
+
d(this, re, /* @__PURE__ */ a(() => {
|
|
214
214
|
e(this, oe).call(this);
|
|
215
215
|
}, "#init"));
|
|
216
216
|
/**
|
|
217
217
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
218
218
|
*/
|
|
219
|
-
|
|
219
|
+
d(this, oe, /* @__PURE__ */ a(() => {
|
|
220
220
|
!e(this, $) || !(e(this, $) instanceof HTMLElement) || (y(this, W, new ResizeObserver((i) => {
|
|
221
221
|
for (const t of i) {
|
|
222
222
|
const s = t.target;
|
|
@@ -226,12 +226,12 @@ const Le = class Le {
|
|
|
226
226
|
if (n > 0) {
|
|
227
227
|
const r = s.clientHeight || s.getBoundingClientRect().height || n;
|
|
228
228
|
let o = 0;
|
|
229
|
-
const c = s.querySelector(".ng-container-body") || s,
|
|
230
|
-
|
|
229
|
+
const c = s.querySelector(".ng-container-body") || s, f = c.querySelector("thead"), l = c.querySelector("tfoot");
|
|
230
|
+
f && (o += f.offsetHeight || f.getBoundingClientRect().height), l && (o += l.offsetHeight || l.getBoundingClientRect().height);
|
|
231
231
|
const h = Math.max(r - o, 100);
|
|
232
|
-
if (e(this,
|
|
233
|
-
const u = Math.ceil(e(this,
|
|
234
|
-
y(this,
|
|
232
|
+
if (e(this, M) !== h && (y(this, M, h), e(this, S) !== null)) {
|
|
233
|
+
const u = Math.ceil(e(this, M) / e(this, S));
|
|
234
|
+
y(this, H, u + 20), j.log(`[RowManager] Resized. Height: ${e(this, M)}px | Target Rows: ${e(this, H)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((b) => {
|
|
235
235
|
const g = s.querySelector(b);
|
|
236
236
|
g && g.querySelector("tbody") && e(this, J).call(this, g);
|
|
237
237
|
});
|
|
@@ -244,43 +244,43 @@ const Le = class Le {
|
|
|
244
244
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
245
245
|
if (!t) return;
|
|
246
246
|
const s = Array.from(t.querySelectorAll("tr")).filter((n) => !n.classList.contains("nodata"));
|
|
247
|
-
y(this,
|
|
247
|
+
y(this, L, s.map((n) => n.cloneNode(!0))), y(this, S, null), console.log(`[RowManager] Template initialized with ${e(this, L).length} row(s).`);
|
|
248
248
|
}, "initTemplate"));
|
|
249
249
|
// π― ν
νλ¦Ώ μΆμΆ, λμ΄ μΈ‘μ , μ΄κΈ° λ λλ§μ μμμ λ§κ² λ΄λΆμμ μΌκ΄ μ²λ¦¬
|
|
250
250
|
x(this, "initialize", /* @__PURE__ */ a((i) => {
|
|
251
251
|
j.log(i);
|
|
252
252
|
const t = e(this, $).querySelector(".ng-container-body");
|
|
253
253
|
if (!t) return;
|
|
254
|
-
const s = i.querySelector("tbody
|
|
254
|
+
const s = i.querySelector("tbody");
|
|
255
255
|
if (!s) return;
|
|
256
|
-
const n = Array.from(s.querySelectorAll("tr"))
|
|
257
|
-
y(this,
|
|
256
|
+
const n = Array.from(s.querySelectorAll("tr"));
|
|
257
|
+
y(this, L, n.map((r) => r.cloneNode(!0))), y(this, S, null), e(this, le).call(this, t), e(this, J).call(this, t);
|
|
258
258
|
}, "initialize"));
|
|
259
|
-
|
|
259
|
+
d(this, le, /* @__PURE__ */ a((i) => {
|
|
260
260
|
if (e(this, S) !== null && e(this, S) > 0)
|
|
261
261
|
return e(this, S);
|
|
262
|
-
if (e(this,
|
|
262
|
+
if (e(this, L).length === 0)
|
|
263
263
|
throw new Error("[RowManager] Template TRs are empty.");
|
|
264
264
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
265
265
|
if (!t) return 24;
|
|
266
266
|
t.querySelectorAll("tr:not(.nodata)").forEach((u) => u.remove());
|
|
267
267
|
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
268
|
-
e(this,
|
|
268
|
+
e(this, L).forEach((u) => {
|
|
269
269
|
n.appendChild(u.cloneNode(!0));
|
|
270
270
|
}), s ? s.before(n) : t.appendChild(n);
|
|
271
|
-
const r = i.closest("nine-table-sheet"), o = r ? r.style.display : "", c = r ? r.style.visibility : "",
|
|
271
|
+
const r = i.closest("nine-table-sheet"), o = r ? r.style.display : "", c = r ? r.style.visibility : "", f = r ? r.style.position : "";
|
|
272
272
|
r && (r.style.display === "none" || window.getComputedStyle(r).display === "none") && (r.style.display = "block", r.style.visibility = "hidden", r.style.position = "absolute");
|
|
273
273
|
let l = 0;
|
|
274
274
|
if (t.querySelectorAll("tr:not(.nodata)").forEach((u, b) => {
|
|
275
275
|
const g = u.offsetHeight || u.getBoundingClientRect().height;
|
|
276
276
|
g === 0 ? l += 40 : l += g;
|
|
277
|
-
}), r && (r.style.display = o, r.style.visibility = c, r.style.position =
|
|
278
|
-
const u = Math.ceil(e(this,
|
|
279
|
-
y(this,
|
|
277
|
+
}), r && (r.style.display = o, r.style.visibility = c, r.style.position = f), y(this, S, l), e(this, M) > 0) {
|
|
278
|
+
const u = Math.ceil(e(this, M) / e(this, S));
|
|
279
|
+
y(this, H, u + 20);
|
|
280
280
|
} else
|
|
281
|
-
y(this,
|
|
282
|
-
return console.log(`[RowManager] Template Height Cached: ${e(this, S)}px | RowCount: ${e(this,
|
|
283
|
-
}, "measureAndCacheHeight"));
|
|
281
|
+
y(this, H, 40);
|
|
282
|
+
return console.log(`[RowManager] Template Height Cached: ${e(this, S)}px | RowCount: ${e(this, H)}`), e(this, S);
|
|
283
|
+
}, "#measureAndCacheHeight"));
|
|
284
284
|
/**
|
|
285
285
|
* π― μΊμλ ν κ°μ λ°ν (μμ λλ§ μ΅μνμ λ°©μ΄ μ°μ°)
|
|
286
286
|
*/
|
|
@@ -297,14 +297,14 @@ const Le = class Le {
|
|
|
297
297
|
/**
|
|
298
298
|
* π― μΊμλ ν κ°μλ₯Ό κ³§λ°λ‘ κ°μ Έμμ TR λΌλ μ£Όμ
(μ€λ³΅ κ³μ° μ κ±°)
|
|
299
299
|
*/
|
|
300
|
-
|
|
301
|
-
if (e(this,
|
|
300
|
+
d(this, J, /* @__PURE__ */ a((i) => {
|
|
301
|
+
if (e(this, L).length === 0) return;
|
|
302
302
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
303
303
|
if (!t) return;
|
|
304
304
|
t.querySelectorAll("tr:not(.nodata)").forEach((o) => o.remove());
|
|
305
|
-
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment(), r = e(this,
|
|
305
|
+
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment(), r = e(this, H);
|
|
306
306
|
for (let o = 0; o < r; o++)
|
|
307
|
-
e(this,
|
|
307
|
+
e(this, L).forEach((c) => {
|
|
308
308
|
n.appendChild(c.cloneNode(!0));
|
|
309
309
|
});
|
|
310
310
|
s ? s.before(n) : t.appendChild(n), console.log(`[RowManager] Rendered ${r} sets into DOM.`);
|
|
@@ -315,17 +315,17 @@ const Le = class Le {
|
|
|
315
315
|
y(this, $, i), e(this, re).call(this);
|
|
316
316
|
}
|
|
317
317
|
get templateLength() {
|
|
318
|
-
return e(this,
|
|
318
|
+
return e(this, L).length || 1;
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
|
-
$ = new WeakMap(),
|
|
322
|
-
let
|
|
323
|
-
var I, U,
|
|
321
|
+
$ = new WeakMap(), L = new WeakMap(), S = new WeakMap(), W = new WeakMap(), M = new WeakMap(), H = new WeakMap(), re = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), J = new WeakMap(), a(Le, "RowManager");
|
|
322
|
+
let ve = Le;
|
|
323
|
+
var I, U, ae, ce;
|
|
324
324
|
const G = class G extends HTMLElement {
|
|
325
325
|
constructor() {
|
|
326
326
|
super();
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
d(this, I, null);
|
|
328
|
+
d(this, U);
|
|
329
329
|
x(this, "generate", /* @__PURE__ */ a((t) => {
|
|
330
330
|
if (!t) return;
|
|
331
331
|
const s = /* @__PURE__ */ a((l) => {
|
|
@@ -345,7 +345,7 @@ const G = class G extends HTMLElement {
|
|
|
345
345
|
return h(l), u(l), l.classList.add("nine-table-element"), l;
|
|
346
346
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
347
347
|
y(this, I, s(n)), e(this, I).style.display = "table";
|
|
348
|
-
const r = this.querySelector(".ng-container-left"), o = this.querySelector(".ng-container-body"), c = this.querySelector(".ng-container-right"),
|
|
348
|
+
const r = this.querySelector(".ng-container-left"), o = this.querySelector(".ng-container-body"), c = this.querySelector(".ng-container-right"), f = /* @__PURE__ */ a((l, h, u = !1) => {
|
|
349
349
|
const b = l.cloneNode(!0), g = Array.from(b.querySelectorAll("colgroup col")), m = [];
|
|
350
350
|
return g.forEach((E, T) => {
|
|
351
351
|
const _ = E.getAttribute("fixed");
|
|
@@ -359,11 +359,11 @@ const G = class G extends HTMLElement {
|
|
|
359
359
|
}), b;
|
|
360
360
|
}, "filterTableByFixed");
|
|
361
361
|
if (o) {
|
|
362
|
-
const l =
|
|
362
|
+
const l = f(e(this, I), null, !0);
|
|
363
363
|
o.innerHTML = "", o.appendChild(l), e(this, U).initialize(e(this, I));
|
|
364
364
|
}
|
|
365
365
|
if (r) {
|
|
366
|
-
const l =
|
|
366
|
+
const l = f(e(this, I), "left", !1);
|
|
367
367
|
let h = 0;
|
|
368
368
|
l.querySelectorAll("col").forEach((b) => {
|
|
369
369
|
const g = parseInt(b.getAttribute("width"), 10);
|
|
@@ -373,7 +373,7 @@ const G = class G extends HTMLElement {
|
|
|
373
373
|
r.style.flex = `0 0 ${u}px`, r.style.width = `${u}px`;
|
|
374
374
|
}
|
|
375
375
|
if (c) {
|
|
376
|
-
const l =
|
|
376
|
+
const l = f(e(this, I), "right", !1);
|
|
377
377
|
let h = 0;
|
|
378
378
|
l.querySelectorAll("col").forEach((b) => {
|
|
379
379
|
const g = parseInt(b.getAttribute("width"), 10);
|
|
@@ -404,21 +404,21 @@ const G = class G extends HTMLElement {
|
|
|
404
404
|
const s = this.querySelector(".ng-container-body");
|
|
405
405
|
s && (s.scrollTop = t);
|
|
406
406
|
}, "scrollToY"));
|
|
407
|
-
|
|
408
|
-
e(this,
|
|
407
|
+
d(this, ae, /* @__PURE__ */ a(() => {
|
|
408
|
+
e(this, ce).call(this), new MutationObserver((t) => {
|
|
409
409
|
const s = /* @__PURE__ */ a(() => {
|
|
410
410
|
requestAnimationFrame(() => {
|
|
411
411
|
var u, b, g;
|
|
412
412
|
const n = this.querySelector(".ng-container-left table"), r = this.querySelector(".ng-container-body table"), o = this.querySelector(".ng-container-right table");
|
|
413
413
|
if (!r) return;
|
|
414
|
-
const c = n ? Array.from(n.querySelectorAll("tr")) : [],
|
|
414
|
+
const c = n ? Array.from(n.querySelectorAll("tr")) : [], f = Array.from(r.querySelectorAll("tr")), l = o ? Array.from(o.querySelectorAll("tr")) : [], h = Math.max(c.length, f.length, l.length);
|
|
415
415
|
for (let m = 0; m < h; m++) {
|
|
416
416
|
const E = [
|
|
417
417
|
((u = c[m]) == null ? void 0 : u.getBoundingClientRect().height) || 0,
|
|
418
|
-
((b =
|
|
418
|
+
((b = f[m]) == null ? void 0 : b.getBoundingClientRect().height) || 0,
|
|
419
419
|
((g = l[m]) == null ? void 0 : g.getBoundingClientRect().height) || 0
|
|
420
420
|
], T = Math.max(...E);
|
|
421
|
-
T > 0 && (c[m] && (c[m].style.height = `${T}px`),
|
|
421
|
+
T > 0 && (c[m] && (c[m].style.height = `${T}px`), f[m] && (f[m].style.height = `${T}px`), l[m] && (l[m].style.height = `${T}px`));
|
|
422
422
|
}
|
|
423
423
|
});
|
|
424
424
|
}, "syncRowHeights");
|
|
@@ -426,7 +426,7 @@ const G = class G extends HTMLElement {
|
|
|
426
426
|
n.attributeName === "class" && this.classList.contains("active") && s();
|
|
427
427
|
}).observe(this, { attributes: !0 });
|
|
428
428
|
}, "#init"));
|
|
429
|
-
|
|
429
|
+
d(this, ce, /* @__PURE__ */ a(() => {
|
|
430
430
|
const t = G.SCROLLBAR_SIZE;
|
|
431
431
|
this.innerHTML = `
|
|
432
432
|
<style>
|
|
@@ -552,23 +552,23 @@ const G = class G extends HTMLElement {
|
|
|
552
552
|
</div>
|
|
553
553
|
`;
|
|
554
554
|
}, "#render"));
|
|
555
|
-
y(this, U, new
|
|
555
|
+
y(this, U, new ve(this));
|
|
556
556
|
}
|
|
557
557
|
connectedCallback() {
|
|
558
|
-
e(this,
|
|
558
|
+
e(this, ae).call(this);
|
|
559
559
|
}
|
|
560
560
|
disconnectedCallback() {
|
|
561
561
|
this.innerHTML = "", j.log("NineTableSheet destroyed.");
|
|
562
562
|
}
|
|
563
563
|
};
|
|
564
|
-
I = new WeakMap(), U = new WeakMap(),
|
|
564
|
+
I = new WeakMap(), U = new WeakMap(), ae = new WeakMap(), ce = new WeakMap(), a(G, "NineTableSheet"), x(G, "SCROLLBAR_SIZE", 16);
|
|
565
565
|
let ie = G;
|
|
566
566
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ie);
|
|
567
|
-
var
|
|
568
|
-
const
|
|
567
|
+
var he, Q;
|
|
568
|
+
const Ce = class Ce extends HTMLElement {
|
|
569
569
|
constructor() {
|
|
570
570
|
super();
|
|
571
|
-
|
|
571
|
+
d(this, he, /* @__PURE__ */ a(() => {
|
|
572
572
|
var t;
|
|
573
573
|
(t = this.querySelector(".nine-tab-bar")) == null || t.addEventListener("click", (s) => {
|
|
574
574
|
var o;
|
|
@@ -576,7 +576,7 @@ const ke = class ke extends HTMLElement {
|
|
|
576
576
|
e(this, Q).call(this, r, n);
|
|
577
577
|
}), e(this, Q).call(this, 0, !1);
|
|
578
578
|
}, "#init"));
|
|
579
|
-
|
|
579
|
+
d(this, Q, /* @__PURE__ */ a((t, s = !1) => {
|
|
580
580
|
const n = /* @__PURE__ */ a(() => {
|
|
581
581
|
const h = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
582
582
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((g) => g.style.setProperty("display", "none"));
|
|
@@ -585,12 +585,12 @@ const ke = class ke extends HTMLElement {
|
|
|
585
585
|
const m = parseInt(g.getAttribute("data-index"), 10), E = this.querySelector(`nine-splitter[data-split-index="${m}"]`), T = h[m + 1];
|
|
586
586
|
E && T && T.classList.contains("active") && E.style.setProperty("display", "flex");
|
|
587
587
|
});
|
|
588
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), c = r.querySelectorAll(".nine-tab-item"),
|
|
588
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), c = r.querySelectorAll(".nine-tab-item"), f = o.querySelectorAll("nine-table-sheet");
|
|
589
589
|
if (!c[t]) return;
|
|
590
590
|
if (!s)
|
|
591
591
|
c.forEach((h, u) => {
|
|
592
592
|
h.classList.toggle("active", u === t);
|
|
593
|
-
}),
|
|
593
|
+
}), f.forEach((h, u) => {
|
|
594
594
|
const b = u === t;
|
|
595
595
|
h.classList.toggle("active", b), h.style.flex = b ? "1 1 100%" : "";
|
|
596
596
|
});
|
|
@@ -609,34 +609,34 @@ const ke = class ke extends HTMLElement {
|
|
|
609
609
|
}, "#switchSheet"));
|
|
610
610
|
}
|
|
611
611
|
connectedCallback() {
|
|
612
|
-
e(this,
|
|
612
|
+
e(this, he).call(this);
|
|
613
613
|
}
|
|
614
614
|
};
|
|
615
|
-
|
|
616
|
-
let
|
|
617
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
618
|
-
var R,
|
|
619
|
-
const
|
|
615
|
+
he = new WeakMap(), Q = new WeakMap(), a(Ce, "NineTableSheets");
|
|
616
|
+
let xe = Ce;
|
|
617
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", xe);
|
|
618
|
+
var R, de, ee, fe;
|
|
619
|
+
const _e = class _e {
|
|
620
620
|
constructor(i) {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
e(this,
|
|
621
|
+
d(this, R);
|
|
622
|
+
d(this, de, /* @__PURE__ */ a(() => {
|
|
623
|
+
e(this, fe).call(this), new ResizeObserver((i) => {
|
|
624
624
|
for (let t of i)
|
|
625
625
|
e(this, R).getAttribute("auto-height") === "true" && e(this, ee).call(this);
|
|
626
626
|
}).observe(e(this, R));
|
|
627
627
|
}, "#init"));
|
|
628
|
-
|
|
629
|
-
var
|
|
628
|
+
d(this, ee, /* @__PURE__ */ a(() => {
|
|
629
|
+
var f, l;
|
|
630
630
|
const i = Array.from(e(this, R).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
631
631
|
if (i.length === 0) return;
|
|
632
|
-
const t = parseInt(e(this, R).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((h) => h.getRowHeight())), n = (
|
|
632
|
+
const t = parseInt(e(this, R).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((h) => h.getRowHeight())), n = (f = e(this, R).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : f.getBoundingClientRect().height, r = (l = e(this, R).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, o = ie.SCROLLBAR_SIZE, c = t * s + n + r + o;
|
|
633
633
|
e(this, R).style.height = `${c}px`;
|
|
634
634
|
}, "#applyAutoHeight"));
|
|
635
|
-
|
|
636
|
-
const t = Array.from(e(this, R).children).filter((
|
|
635
|
+
d(this, fe, /* @__PURE__ */ a(() => {
|
|
636
|
+
const t = Array.from(e(this, R).children).filter((f) => f.tagName === "TABLE"), s = e(this, R).getAttribute("auto-height") === "true", n = t.length, r = t.map((f, l) => {
|
|
637
637
|
const u = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`, b = l < n - 1 ? `<nine-splitter class="h" data-split-index="${l}"></nine-splitter>` : "";
|
|
638
638
|
return u + b;
|
|
639
|
-
}).join(""), o = t.map((
|
|
639
|
+
}).join(""), o = t.map((f, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
640
640
|
e(this, R).shadowRoot.innerHTML = `
|
|
641
641
|
<style>
|
|
642
642
|
:host {
|
|
@@ -737,22 +737,22 @@ const Ce = class Ce {
|
|
|
737
737
|
<nine-table-footer></nine-table-footer>
|
|
738
738
|
`;
|
|
739
739
|
const c = e(this, R).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
740
|
-
c == null || c.forEach((
|
|
740
|
+
c == null || c.forEach((f, l) => {
|
|
741
741
|
t[l] && setTimeout(() => {
|
|
742
|
-
|
|
742
|
+
f.generate(t[l]), s && e(this, ee).call(this);
|
|
743
743
|
});
|
|
744
744
|
});
|
|
745
745
|
}, "#render"));
|
|
746
|
-
y(this, R, i), e(this,
|
|
746
|
+
y(this, R, i), e(this, de).call(this);
|
|
747
747
|
}
|
|
748
748
|
};
|
|
749
|
-
R = new WeakMap(),
|
|
750
|
-
let
|
|
749
|
+
R = new WeakMap(), de = new WeakMap(), ee = new WeakMap(), fe = new WeakMap(), a(_e, "LayoutManager");
|
|
750
|
+
let Se = _e;
|
|
751
751
|
var z, X;
|
|
752
|
-
const
|
|
752
|
+
const Me = class Me {
|
|
753
753
|
constructor(i) {
|
|
754
|
-
|
|
755
|
-
|
|
754
|
+
d(this, z);
|
|
755
|
+
d(this, X, -1);
|
|
756
756
|
x(this, "count", /* @__PURE__ */ a(() => e(this, z).rawRecords.length, "count"));
|
|
757
757
|
y(this, z, i);
|
|
758
758
|
}
|
|
@@ -769,18 +769,18 @@ const _e = class _e {
|
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
};
|
|
772
|
-
z = new WeakMap(), X = new WeakMap(), a(
|
|
773
|
-
let
|
|
774
|
-
var A, v, q, K,
|
|
775
|
-
const
|
|
772
|
+
z = new WeakMap(), X = new WeakMap(), a(Me, "ngRow");
|
|
773
|
+
let Re = Me;
|
|
774
|
+
var A, v, q, K, ue, O, ge, te, be, ye, Z;
|
|
775
|
+
const k = class k {
|
|
776
776
|
constructor(i, t) {
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
777
|
+
d(this, A);
|
|
778
|
+
d(this, v);
|
|
779
|
+
d(this, q, []);
|
|
780
|
+
d(this, K, []);
|
|
781
|
+
d(this, ue, 0);
|
|
782
|
+
d(this, O, []);
|
|
783
|
+
d(this, ge, /* @__PURE__ */ a(() => {
|
|
784
784
|
y(this, O, []);
|
|
785
785
|
const i = e(this, A).template || [];
|
|
786
786
|
Array.from(i).forEach((t) => {
|
|
@@ -793,14 +793,14 @@ const L = class L {
|
|
|
793
793
|
x(this, "set", /* @__PURE__ */ a((i) => {
|
|
794
794
|
this.clear(), this.add(i, !1);
|
|
795
795
|
}, "set"));
|
|
796
|
-
|
|
797
|
-
rowState:
|
|
796
|
+
d(this, te, /* @__PURE__ */ a(() => ({
|
|
797
|
+
rowState: k.ROW_STATE.EMPTY,
|
|
798
798
|
deleted: !1,
|
|
799
799
|
filtered: !1,
|
|
800
800
|
height: e(this, O).slice(),
|
|
801
801
|
o: {},
|
|
802
802
|
c: {},
|
|
803
|
-
_: [0, 0, 0, 0,
|
|
803
|
+
_: [0, 0, 0, 0, k.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, O).slice(), -1, {}, {}]
|
|
804
804
|
}), "#getDefaultMeta"));
|
|
805
805
|
x(this, "reset", /* @__PURE__ */ a(() => {
|
|
806
806
|
y(this, q, []), y(this, K, []);
|
|
@@ -809,7 +809,7 @@ const L = class L {
|
|
|
809
809
|
var i;
|
|
810
810
|
e(this, v).rawRecords = [], y(this, q, []), y(this, K, []), (i = e(this, v).viewRecords) != null && i.reset && e(this, v).viewRecords.reset();
|
|
811
811
|
}, "clear"));
|
|
812
|
-
|
|
812
|
+
d(this, be, /* @__PURE__ */ a((i) => {
|
|
813
813
|
var n;
|
|
814
814
|
Array.isArray(i) || (i = [i]);
|
|
815
815
|
const t = typeof ((n = e(this, A).fields) == null ? void 0 : n.get) == "function" ? e(this, A).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
@@ -820,18 +820,18 @@ const L = class L {
|
|
|
820
820
|
}), s.push(o);
|
|
821
821
|
}), s;
|
|
822
822
|
}, "#json2Array"));
|
|
823
|
-
|
|
824
|
-
t.__ng = e(this, te).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState =
|
|
823
|
+
d(this, ye, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
824
|
+
t.__ng = e(this, te).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = k.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
825
825
|
}), i), "#defaultInsert"));
|
|
826
826
|
x(this, "add", /* @__PURE__ */ a((i, t = !0) => {
|
|
827
827
|
var r;
|
|
828
828
|
i === void 0 && (i = {});
|
|
829
|
-
const s = e(this,
|
|
830
|
-
e(this, v).rawRecords = e(this, v).rawRecords.concat(e(this,
|
|
829
|
+
const s = e(this, be).call(this, i);
|
|
830
|
+
e(this, v).rawRecords = e(this, v).rawRecords.concat(e(this, ye).call(this, s)), this.resetRecords();
|
|
831
831
|
const n = this.count() - 1;
|
|
832
832
|
return t || s.forEach((o, c) => {
|
|
833
|
-
const
|
|
834
|
-
|
|
833
|
+
const f = e(this, v).rawRecords[n - c];
|
|
834
|
+
f && (f.__ng.rowState = k.ROW_STATE.EMPTY);
|
|
835
835
|
}), (r = e(this, v).viewRecords) != null && r.reset && e(this, v).viewRecords.reset(), n;
|
|
836
836
|
}, "add"));
|
|
837
837
|
x(this, "delete", /* @__PURE__ */ a((i) => {
|
|
@@ -840,21 +840,21 @@ const L = class L {
|
|
|
840
840
|
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, v).owner.row.at] : t = [parseInt(i, 10)], t.sort((n, r) => r - n).forEach((n) => {
|
|
841
841
|
if (e(this, q)[n]) {
|
|
842
842
|
const r = e(this, q)[n].__ng.rowid;
|
|
843
|
-
e(this, q)[n].__ng.rowState ===
|
|
844
|
-
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState =
|
|
843
|
+
e(this, q)[n].__ng.rowState === k.ROW_STATE.INSERT ? e(this, v).rawRecords = e(this, v).rawRecords.filter((o) => o.__ng.rowid !== r) : e(this, v).rawRecords.forEach((o) => {
|
|
844
|
+
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState = k.ROW_STATE.DELETE);
|
|
845
845
|
});
|
|
846
846
|
}
|
|
847
847
|
}), this.resetRecords(), (s = e(this, v).viewRecords) != null && s.reset && e(this, v).viewRecords.reset();
|
|
848
848
|
}, "delete"));
|
|
849
849
|
x(this, "setValue", /* @__PURE__ */ a((i, t, s) => {
|
|
850
|
-
var
|
|
850
|
+
var f;
|
|
851
851
|
i = parseInt(i, 10);
|
|
852
|
-
const r = (typeof ((
|
|
852
|
+
const r = (typeof ((f = e(this, A).fields) == null ? void 0 : f.get) == "function" ? e(this, A).fields.get() : []).indexOf(t);
|
|
853
853
|
if (r < 0) return;
|
|
854
854
|
const o = this.getValidData()[i];
|
|
855
855
|
if (!o) return;
|
|
856
856
|
const c = o.v[r];
|
|
857
|
-
c !== s && o.__ng.rowState !==
|
|
857
|
+
c !== s && o.__ng.rowState !== k.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(t) || (o.__ng.o[t] = c), o.__ng.rowState = k.ROW_STATE.UPDATE), o.v[r] = s, e(this, v).owner.refreshData && e(this, v).owner.refreshData(i);
|
|
858
858
|
}, "setValue"));
|
|
859
859
|
x(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
860
860
|
y(this, K, e(this, v).rawRecords.filter((i) => !i.__ng.deleted)), y(this, q, e(this, v).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, v).rawRecords.forEach((i, t) => {
|
|
@@ -864,7 +864,7 @@ const L = class L {
|
|
|
864
864
|
});
|
|
865
865
|
}, "resetRecords"));
|
|
866
866
|
x(this, "getValidData", /* @__PURE__ */ a(() => (e(this, q).length === 0 && e(this, v).rawRecords.length > 0 && this.resetRecords(), e(this, q)), "getValidData"));
|
|
867
|
-
|
|
867
|
+
d(this, Z, /* @__PURE__ */ a((i) => {
|
|
868
868
|
var s;
|
|
869
869
|
if (!i) return i;
|
|
870
870
|
const t = typeof ((s = e(this, A).fields) == null ? void 0 : s.get) == "function" ? e(this, A).fields.get() : [];
|
|
@@ -889,7 +889,7 @@ const L = class L {
|
|
|
889
889
|
}
|
|
890
890
|
return e(this, Z).call(this, s[i]);
|
|
891
891
|
}, "get"));
|
|
892
|
-
y(this, A, i), y(this, v, t), e(this,
|
|
892
|
+
y(this, A, i), y(this, v, t), e(this, ge).call(this);
|
|
893
893
|
}
|
|
894
894
|
get source() {
|
|
895
895
|
return e(this, Z).call(this, e(this, v).rawRecords);
|
|
@@ -898,7 +898,7 @@ const L = class L {
|
|
|
898
898
|
this.clear(), this.add(i, !1);
|
|
899
899
|
}
|
|
900
900
|
get nextId() {
|
|
901
|
-
return ++
|
|
901
|
+
return ++Oe(this, ue)._;
|
|
902
902
|
}
|
|
903
903
|
get length() {
|
|
904
904
|
return e(this, q).length;
|
|
@@ -907,18 +907,18 @@ const L = class L {
|
|
|
907
907
|
return this.length;
|
|
908
908
|
}
|
|
909
909
|
};
|
|
910
|
-
A = new WeakMap(), v = new WeakMap(), q = new WeakMap(), K = new WeakMap(),
|
|
911
|
-
x(
|
|
910
|
+
A = new WeakMap(), v = new WeakMap(), q = new WeakMap(), K = new WeakMap(), ue = new WeakMap(), O = new WeakMap(), ge = new WeakMap(), te = new WeakMap(), be = new WeakMap(), ye = new WeakMap(), Z = new WeakMap(), a(k, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
911
|
+
x(k, "ROW_STATE", {
|
|
912
912
|
EMPTY: "EMPTY",
|
|
913
913
|
NORMAL: "NORMAL",
|
|
914
914
|
INSERT: "INSERT",
|
|
915
915
|
UPDATE: "UPDATE",
|
|
916
916
|
DELETE: "DELETE"
|
|
917
917
|
});
|
|
918
|
-
let
|
|
918
|
+
let Ee = k;
|
|
919
919
|
const He = class He {
|
|
920
920
|
constructor(i) {
|
|
921
|
-
this.owner = i, this.row = new
|
|
921
|
+
this.owner = i, this.row = new Re(this), this.data = new Ee(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
922
922
|
var t;
|
|
923
923
|
(t = this.owner.view) != null && t.redraw && this.owner.view.redraw();
|
|
924
924
|
}, this.setDataSource = (t) => {
|
|
@@ -936,18 +936,18 @@ const He = class He {
|
|
|
936
936
|
}
|
|
937
937
|
};
|
|
938
938
|
a(He, "ngDataManager");
|
|
939
|
-
let
|
|
940
|
-
var F,
|
|
941
|
-
const
|
|
939
|
+
let Te = He;
|
|
940
|
+
var F, pe;
|
|
941
|
+
const Ie = class Ie extends HTMLElement {
|
|
942
942
|
constructor() {
|
|
943
943
|
super();
|
|
944
944
|
//#created = false;
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
this.attachShadow({ mode: "open" }), y(this, F, new
|
|
945
|
+
d(this, F);
|
|
946
|
+
d(this, pe);
|
|
947
|
+
this.attachShadow({ mode: "open" }), y(this, F, new Te(this));
|
|
948
948
|
}
|
|
949
949
|
connectedCallback() {
|
|
950
|
-
y(this,
|
|
950
|
+
y(this, pe, new Se(this)), j.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
951
951
|
}
|
|
952
952
|
disconnectedCallback() {
|
|
953
953
|
j.log("NineTable disconnected.");
|
|
@@ -965,7 +965,7 @@ const Me = class Me extends HTMLElement {
|
|
|
965
965
|
return e(this, F);
|
|
966
966
|
}
|
|
967
967
|
};
|
|
968
|
-
F = new WeakMap(),
|
|
969
|
-
let
|
|
970
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
968
|
+
F = new WeakMap(), pe = new WeakMap(), a(Ie, "NineTable");
|
|
969
|
+
let Ae = Ie;
|
|
970
|
+
customElements.get("nine-table") || customElements.define("nine-table", Ae);
|
|
971
971
|
//# sourceMappingURL=nine-table.js.map
|