@ninebone/table 0.0.196 β 0.0.197
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 +179 -181
- 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,30 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var _e = Object.defineProperty;
|
|
2
|
+
var Ie = (w) => {
|
|
3
3
|
throw TypeError(w);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var a = (w, i) =>
|
|
7
|
-
var m = (w, i, t) =>
|
|
8
|
-
var e = (w, i, t) => (
|
|
9
|
-
var
|
|
5
|
+
var $e = (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 m = (w, i, t) => $e(w, typeof i != "symbol" ? i + "" : i, t), Me = (w, i, t) => i.has(w) || Ie("Cannot " + t);
|
|
8
|
+
var e = (w, i, t) => (Me(w, i, "read from private field"), t ? t.call(w) : i.get(w)), d = (w, i, t) => i.has(w) ? Ie("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(w) : i.set(w, t), p = (w, i, t, s) => (Me(w, i, "write to private field"), s ? s.call(w, t) : i.set(w, t), t);
|
|
9
|
+
var He = (w, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
|
-
|
|
11
|
+
p(w, i, n, t);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
14
|
return e(w, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
import { trace as
|
|
18
|
-
const
|
|
17
|
+
import { trace as We } from "@ninebone/util";
|
|
18
|
+
const Re = class Re extends We.constructor {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
a(
|
|
24
|
-
let
|
|
25
|
-
const G = new
|
|
26
|
-
var L, O, y, B, D, N,
|
|
27
|
-
const
|
|
23
|
+
a(Re, "Trace");
|
|
24
|
+
let ge = Re;
|
|
25
|
+
const G = new ge();
|
|
26
|
+
var L, O, y, B, D, N, te, P, ie;
|
|
27
|
+
const Ee = class Ee extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
d(this, L);
|
|
@@ -33,10 +33,10 @@ const Ae = class Ae extends HTMLElement {
|
|
|
33
33
|
d(this, B);
|
|
34
34
|
d(this, D);
|
|
35
35
|
d(this, N);
|
|
36
|
-
d(this,
|
|
36
|
+
d(this, te, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!e(this, L)) return;
|
|
38
38
|
const t = e(this, L).querySelector(".ng-container-body");
|
|
39
|
-
t && (
|
|
39
|
+
t && (p(this, N, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), e(this, N).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
@@ -53,19 +53,19 @@ const Ae = class Ae extends HTMLElement {
|
|
|
53
53
|
}
|
|
54
54
|
const l = n.clientWidth;
|
|
55
55
|
if (l <= 0) return;
|
|
56
|
-
const
|
|
57
|
-
r.style.width = `${
|
|
56
|
+
const g = Math.max(Math.min(l * (h / f), l), 20);
|
|
57
|
+
r.style.width = `${g}px`;
|
|
58
58
|
let c = 0;
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
const x =
|
|
59
|
+
const b = s.style.transform;
|
|
60
|
+
if (b && b.includes("translateX")) {
|
|
61
|
+
const x = b.match(/translateX\(([-\d.]+)px\)/);
|
|
62
62
|
x && x[1] && (c = parseFloat(x[1]));
|
|
63
63
|
} else
|
|
64
64
|
c = parseInt(s.style.left || 0, 10);
|
|
65
65
|
let u = parseInt(Math.abs(c) * l / f, 10);
|
|
66
66
|
u < 0 && (u = 0);
|
|
67
|
-
const
|
|
68
|
-
u >
|
|
67
|
+
const S = l - g;
|
|
68
|
+
u > S && (u = S), r.style.left = `${u}px`, e(this, y).left.disabled = u === 0, e(this, y).right.disabled = u >= S - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
70
|
d(this, P, /* @__PURE__ */ a((t) => {
|
|
71
71
|
if (!e(this, y)) return !1;
|
|
@@ -76,16 +76,16 @@ const Ae = class Ae extends HTMLElement {
|
|
|
76
76
|
h < 0 && (h = 0);
|
|
77
77
|
const f = r.width - o;
|
|
78
78
|
h > f && (h = f), h = parseInt(h, 10), e(this, y).thumb.style.left = `${h}px`, e(this, y).left.disabled = h === 0, e(this, y).right.disabled = h >= f - 1;
|
|
79
|
-
const l = s.clientWidth,
|
|
80
|
-
let c = f > 0 ? -h * (
|
|
81
|
-
return -c >
|
|
79
|
+
const l = s.clientWidth, g = n.scrollWidth;
|
|
80
|
+
let c = f > 0 ? -h * (g - l) / f : 0;
|
|
81
|
+
return -c > g - l && (c = -(g - l)), -c + 5 > g - l && (c = -(g - l)), l >= g && (c = 0), n.style.transform = `translateX(${c}px)`, h > 0 && h < f - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
|
-
d(this,
|
|
83
|
+
d(this, ie, /* @__PURE__ */ a(() => {
|
|
84
84
|
const t = /* @__PURE__ */ a((n) => {
|
|
85
85
|
clearInterval(e(this, B)), clearInterval(e(this, D));
|
|
86
86
|
const r = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
87
|
-
e(this, P).call(this, r + n),
|
|
88
|
-
clearInterval(e(this, B)),
|
|
87
|
+
e(this, P).call(this, r + n), p(this, B, setInterval(() => {
|
|
88
|
+
clearInterval(e(this, B)), p(this, D, setInterval(() => {
|
|
89
89
|
const o = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
90
90
|
e(this, P).call(this, o + n) || clearInterval(e(this, D));
|
|
91
91
|
}, 50));
|
|
@@ -106,20 +106,20 @@ const Ae = class Ae extends HTMLElement {
|
|
|
106
106
|
e(this, P).call(this, n.clientX - r.left - o / 2);
|
|
107
107
|
}), e(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
|
-
n.stopPropagation(), n.preventDefault(),
|
|
109
|
+
n.stopPropagation(), n.preventDefault(), p(this, O, !0), this.shiftX = n.clientX - e(this, y).thumb.getBoundingClientRect().left;
|
|
110
110
|
const r = /* @__PURE__ */ a((h) => {
|
|
111
111
|
if (!e(this, O)) return;
|
|
112
112
|
const f = e(this, y).track.getBoundingClientRect();
|
|
113
113
|
e(this, P).call(this, h.clientX - f.left - this.shiftX);
|
|
114
114
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
115
|
-
|
|
115
|
+
p(this, O, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
116
116
|
}, "onMouseUp");
|
|
117
117
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
118
118
|
});
|
|
119
119
|
}, "#init"));
|
|
120
120
|
}
|
|
121
121
|
connectedCallback() {
|
|
122
|
-
if (
|
|
122
|
+
if (p(this, L, this.closest("nine-table-sheet") || this.getRootNode().host), !e(this, L)) return;
|
|
123
123
|
this.innerHTML = `
|
|
124
124
|
<style>
|
|
125
125
|
nine-table-hscrollbar {
|
|
@@ -189,13 +189,13 @@ const Ae = class Ae extends HTMLElement {
|
|
|
189
189
|
setTimeout(t, 10);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
p(this, y, {
|
|
193
193
|
container: s,
|
|
194
194
|
track: this.querySelector(".ng-scroll-track"),
|
|
195
195
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
196
196
|
left: this.querySelector(".ng-scroll-left"),
|
|
197
197
|
right: this.querySelector(".ng-scroll-right")
|
|
198
|
-
}), e(this,
|
|
198
|
+
}), e(this, ie).call(this), e(this, te).call(this), this.refresh();
|
|
199
199
|
}, "initWhenReady");
|
|
200
200
|
t();
|
|
201
201
|
}
|
|
@@ -203,11 +203,11 @@ const Ae = class Ae extends HTMLElement {
|
|
|
203
203
|
e(this, N) && e(this, N).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
L = new WeakMap(), O = new WeakMap(), y = new WeakMap(), B = new WeakMap(), D = new WeakMap(), N = new WeakMap(),
|
|
207
|
-
let
|
|
208
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar",
|
|
209
|
-
var V, _, E, $, I, M,
|
|
210
|
-
const
|
|
206
|
+
L = new WeakMap(), O = new WeakMap(), y = new WeakMap(), B = new WeakMap(), D = new WeakMap(), N = new WeakMap(), te = new WeakMap(), P = new WeakMap(), ie = new WeakMap(), a(Ee, "NineTableHScrollBar");
|
|
207
|
+
let be = Ee;
|
|
208
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", be);
|
|
209
|
+
var V, _, E, $, I, M, se, ne;
|
|
210
|
+
const Te = class Te {
|
|
211
211
|
constructor(i) {
|
|
212
212
|
d(this, V);
|
|
213
213
|
d(this, _, []);
|
|
@@ -216,14 +216,14 @@ const qe = class qe {
|
|
|
216
216
|
d(this, I, 0);
|
|
217
217
|
d(this, M, 0);
|
|
218
218
|
m(this, "getRowHeight", /* @__PURE__ */ a(() => e(this, E), "getRowHeight"));
|
|
219
|
-
d(this,
|
|
220
|
-
e(this,
|
|
219
|
+
d(this, se, /* @__PURE__ */ a(() => {
|
|
220
|
+
e(this, ne).call(this);
|
|
221
221
|
}, "#init"));
|
|
222
222
|
/**
|
|
223
223
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
224
224
|
*/
|
|
225
|
-
d(this,
|
|
226
|
-
!e(this, V) || !(e(this, V) instanceof HTMLElement) || (
|
|
225
|
+
d(this, ne, /* @__PURE__ */ a(() => {
|
|
226
|
+
!e(this, V) || !(e(this, V) instanceof HTMLElement) || (p(this, $, new ResizeObserver((i) => {
|
|
227
227
|
for (const t of i) {
|
|
228
228
|
const s = t.target;
|
|
229
229
|
if (!s.classList.contains("active"))
|
|
@@ -234,11 +234,11 @@ const qe = class qe {
|
|
|
234
234
|
let o = 0;
|
|
235
235
|
const h = s.querySelector(".ng-container-body") || s, f = h.querySelector("thead"), l = h.querySelector("tfoot");
|
|
236
236
|
f && (o += f.offsetHeight || f.getBoundingClientRect().height), l && (o += l.offsetHeight || l.getBoundingClientRect().height);
|
|
237
|
-
const
|
|
238
|
-
if (e(this, I) !==
|
|
237
|
+
const g = Math.max(r - o, 100);
|
|
238
|
+
if (e(this, I) !== g && (p(this, I, g), e(this, E) !== null)) {
|
|
239
239
|
const c = Math.ceil(e(this, I) / e(this, E));
|
|
240
|
-
|
|
241
|
-
const u = s.querySelector(
|
|
240
|
+
p(this, M, c + 20), G.log(`[RowManager] Resized. Height: ${e(this, I)}px | Target Rows: ${e(this, M)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((b) => {
|
|
241
|
+
const u = s.querySelector(b);
|
|
242
242
|
u && u.querySelector("tbody") && this.renderRows(u);
|
|
243
243
|
});
|
|
244
244
|
}
|
|
@@ -250,7 +250,7 @@ const qe = class qe {
|
|
|
250
250
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
251
251
|
if (!t) return;
|
|
252
252
|
const s = Array.from(t.querySelectorAll("tr")).filter((n) => !n.classList.contains("nodata"));
|
|
253
|
-
|
|
253
|
+
p(this, _, s.map((n) => n.cloneNode(!0))), p(this, E, null), console.log(`[RowManager] Template initialized with ${e(this, _).length} row(s).`);
|
|
254
254
|
}, "initTemplate"));
|
|
255
255
|
m(this, "measureAndCacheHeight", /* @__PURE__ */ a((i) => {
|
|
256
256
|
if (e(this, E) !== null && e(this, E) > 0)
|
|
@@ -267,14 +267,14 @@ const qe = class qe {
|
|
|
267
267
|
const r = i.closest("nine-table-sheet"), o = r ? r.style.display : "", h = r ? r.style.visibility : "", f = r ? r.style.position : "";
|
|
268
268
|
r && (r.style.display === "none" || window.getComputedStyle(r).display === "none") && (r.style.display = "block", r.style.visibility = "hidden", r.style.position = "absolute");
|
|
269
269
|
let l = 0;
|
|
270
|
-
if (t.querySelectorAll("tr:not(.nodata)").forEach((c,
|
|
270
|
+
if (t.querySelectorAll("tr:not(.nodata)").forEach((c, b) => {
|
|
271
271
|
const u = c.offsetHeight || c.getBoundingClientRect().height;
|
|
272
272
|
u === 0 ? l += 40 : l += u;
|
|
273
|
-
}), r && (r.style.display = o, r.style.visibility = h, r.style.position = f),
|
|
273
|
+
}), r && (r.style.display = o, r.style.visibility = h, r.style.position = f), p(this, E, l), e(this, I) > 0) {
|
|
274
274
|
const c = Math.ceil(e(this, I) / e(this, E));
|
|
275
|
-
|
|
275
|
+
p(this, M, c + 20);
|
|
276
276
|
} else
|
|
277
|
-
|
|
277
|
+
p(this, M, 40);
|
|
278
278
|
return console.log(`[RowManager] Template Height Cached: ${e(this, E)}px | RowCount: ${e(this, M)}`), e(this, E);
|
|
279
279
|
}, "measureAndCacheHeight"));
|
|
280
280
|
/**
|
|
@@ -306,17 +306,17 @@ const qe = class qe {
|
|
|
306
306
|
s ? s.before(n) : t.appendChild(n), console.log(`[RowManager] Rendered ${r} sets into DOM.`);
|
|
307
307
|
}, "renderRows"));
|
|
308
308
|
m(this, "destroy", /* @__PURE__ */ a(() => {
|
|
309
|
-
e(this, $) && (e(this, $).disconnect(),
|
|
309
|
+
e(this, $) && (e(this, $).disconnect(), p(this, $, null));
|
|
310
310
|
}, "destroy"));
|
|
311
|
-
|
|
311
|
+
p(this, V, i), e(this, se).call(this);
|
|
312
312
|
}
|
|
313
313
|
get templateLength() {
|
|
314
314
|
return e(this, _).length || 1;
|
|
315
315
|
}
|
|
316
316
|
};
|
|
317
|
-
V = new WeakMap(), _ = new WeakMap(), E = new WeakMap(), $ = new WeakMap(), I = new WeakMap(), M = new WeakMap(),
|
|
318
|
-
let
|
|
319
|
-
var C, X,
|
|
317
|
+
V = new WeakMap(), _ = new WeakMap(), E = new WeakMap(), $ = new WeakMap(), I = new WeakMap(), M = new WeakMap(), se = new WeakMap(), ne = new WeakMap(), a(Te, "RowManager");
|
|
318
|
+
let pe = Te;
|
|
319
|
+
var C, X, re;
|
|
320
320
|
const j = class j extends HTMLElement {
|
|
321
321
|
constructor() {
|
|
322
322
|
super();
|
|
@@ -325,33 +325,33 @@ const j = class j extends HTMLElement {
|
|
|
325
325
|
m(this, "init", /* @__PURE__ */ a((t) => {
|
|
326
326
|
if (!t) return;
|
|
327
327
|
const s = /* @__PURE__ */ a((l) => {
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
330
|
-
const u =
|
|
331
|
-
for (let q = 0; q <
|
|
328
|
+
const g = /* @__PURE__ */ a((b) => {
|
|
329
|
+
if (b.querySelector("colgroup")) return;
|
|
330
|
+
const u = b.querySelector("tbody tr") || b.querySelector("tr"), S = u ? u.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), H = Math.max(Math.floor((b.clientWidth || 600) / S), 100);
|
|
331
|
+
for (let q = 0; q < S; q++) {
|
|
332
332
|
const U = document.createElement("col");
|
|
333
333
|
U.setAttribute("width", H), x.appendChild(U);
|
|
334
334
|
}
|
|
335
|
-
|
|
336
|
-
}, "ensureColgroup"), c = /* @__PURE__ */ a((
|
|
337
|
-
if (
|
|
338
|
-
const u = document.createElement("thead"),
|
|
339
|
-
|
|
335
|
+
b.prepend(x);
|
|
336
|
+
}, "ensureColgroup"), c = /* @__PURE__ */ a((b) => {
|
|
337
|
+
if (b.querySelector("thead")) return;
|
|
338
|
+
const u = document.createElement("thead"), S = b.querySelector("colgroup");
|
|
339
|
+
S ? S.after(u) : b.prepend(u);
|
|
340
340
|
}, "ensureThead");
|
|
341
|
-
return
|
|
341
|
+
return g(l), c(l), l.classList.add("nine-table-element"), l;
|
|
342
342
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
343
|
-
|
|
344
|
-
const r = this.querySelector(".ng-container-left"), o = this.querySelector(".ng-container-body"), h = this.querySelector(".ng-container-right"), f = /* @__PURE__ */ a((l,
|
|
345
|
-
const
|
|
343
|
+
p(this, C, s(n)), e(this, C).style.display = "table", e(this, X).initTemplate(e(this, C));
|
|
344
|
+
const r = this.querySelector(".ng-container-left"), o = this.querySelector(".ng-container-body"), h = this.querySelector(".ng-container-right"), f = /* @__PURE__ */ a((l, g, c = !1) => {
|
|
345
|
+
const b = l.cloneNode(!0), u = Array.from(b.querySelectorAll("colgroup col")), S = [];
|
|
346
346
|
return u.forEach((x, H) => {
|
|
347
347
|
const q = x.getAttribute("fixed");
|
|
348
|
-
(c ? q !== "left" && q !== "right" : q ===
|
|
349
|
-
}),
|
|
350
|
-
u[x] && u[x].remove(),
|
|
348
|
+
(c ? q !== "left" && q !== "right" : q === g) || S.push(H);
|
|
349
|
+
}), S.reverse().forEach((x) => {
|
|
350
|
+
u[x] && u[x].remove(), b.querySelectorAll("tr").forEach((H) => {
|
|
351
351
|
const q = H.querySelectorAll("th, td");
|
|
352
352
|
q[x] && q[x].remove();
|
|
353
353
|
});
|
|
354
|
-
}),
|
|
354
|
+
}), b;
|
|
355
355
|
}, "filterTableByFixed");
|
|
356
356
|
if (o) {
|
|
357
357
|
const l = f(e(this, C), null, !0);
|
|
@@ -359,29 +359,29 @@ const j = class j extends HTMLElement {
|
|
|
359
359
|
}
|
|
360
360
|
if (r) {
|
|
361
361
|
const l = f(e(this, C), "left", !1);
|
|
362
|
-
let
|
|
363
|
-
l.querySelectorAll("col").forEach((
|
|
364
|
-
const u = parseInt(
|
|
365
|
-
isNaN(u) || (
|
|
362
|
+
let g = 0;
|
|
363
|
+
l.querySelectorAll("col").forEach((b) => {
|
|
364
|
+
const u = parseInt(b.getAttribute("width"), 10);
|
|
365
|
+
isNaN(u) || (g += u);
|
|
366
366
|
}), r.innerHTML = "", r.appendChild(l);
|
|
367
|
-
const c =
|
|
367
|
+
const c = g > 0 ? g : 0;
|
|
368
368
|
r.style.flex = `0 0 ${c}px`, r.style.width = `${c}px`;
|
|
369
369
|
}
|
|
370
370
|
if (h) {
|
|
371
371
|
const l = f(e(this, C), "right", !1);
|
|
372
|
-
let
|
|
373
|
-
l.querySelectorAll("col").forEach((
|
|
374
|
-
const u = parseInt(
|
|
375
|
-
isNaN(u) || (
|
|
372
|
+
let g = 0;
|
|
373
|
+
l.querySelectorAll("col").forEach((b) => {
|
|
374
|
+
const u = parseInt(b.getAttribute("width"), 10);
|
|
375
|
+
isNaN(u) || (g += u);
|
|
376
376
|
}), h.innerHTML = "", h.appendChild(l);
|
|
377
|
-
const c =
|
|
377
|
+
const c = g > 0 ? g : 0;
|
|
378
378
|
h.style.flex = `0 0 ${c}px`, h.style.width = `${c}px`;
|
|
379
379
|
}
|
|
380
380
|
if (o) {
|
|
381
381
|
const l = this.getRowCount();
|
|
382
382
|
o.style.overflowY = l > 10 ? "auto" : "hidden", o.addEventListener("scroll", () => {
|
|
383
|
-
const
|
|
384
|
-
|
|
383
|
+
const g = this.querySelector("nine-table-hscrollbar");
|
|
384
|
+
g && typeof g.refresh == "function" && g.refresh();
|
|
385
385
|
});
|
|
386
386
|
}
|
|
387
387
|
setTimeout(() => {
|
|
@@ -399,7 +399,7 @@ const j = class j extends HTMLElement {
|
|
|
399
399
|
const s = this.querySelector(".ng-container-body");
|
|
400
400
|
s && (s.scrollTop = t);
|
|
401
401
|
}, "scrollToY"));
|
|
402
|
-
d(this,
|
|
402
|
+
d(this, re, /* @__PURE__ */ a(() => {
|
|
403
403
|
const t = j.SCROLLBAR_SIZE;
|
|
404
404
|
this.innerHTML = `
|
|
405
405
|
<style>
|
|
@@ -515,23 +515,23 @@ const j = class j extends HTMLElement {
|
|
|
515
515
|
</div>
|
|
516
516
|
`;
|
|
517
517
|
}, "#render"));
|
|
518
|
-
|
|
518
|
+
p(this, X, new pe(this));
|
|
519
519
|
}
|
|
520
520
|
connectedCallback() {
|
|
521
|
-
e(this,
|
|
521
|
+
e(this, re).call(this);
|
|
522
522
|
}
|
|
523
523
|
disconnectedCallback() {
|
|
524
524
|
this.innerHTML = "", G.log("NineTableSheet destroyed.");
|
|
525
525
|
}
|
|
526
526
|
};
|
|
527
|
-
C = new WeakMap(), X = new WeakMap(),
|
|
528
|
-
let
|
|
529
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
530
|
-
var
|
|
531
|
-
const
|
|
527
|
+
C = new WeakMap(), X = new WeakMap(), re = new WeakMap(), a(j, "NineTableSheet"), m(j, "SCROLLBAR_SIZE", 16);
|
|
528
|
+
let ee = j;
|
|
529
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ee);
|
|
530
|
+
var oe;
|
|
531
|
+
const Ae = class Ae extends HTMLElement {
|
|
532
532
|
constructor() {
|
|
533
533
|
super();
|
|
534
|
-
d(this,
|
|
534
|
+
d(this, oe, /* @__PURE__ */ a(() => {
|
|
535
535
|
const t = this.querySelector(".nine-tab-bar");
|
|
536
536
|
t && (t.addEventListener("click", (s) => {
|
|
537
537
|
const n = s.target.closest(".nine-tab-item");
|
|
@@ -542,26 +542,26 @@ const ke = class ke extends HTMLElement {
|
|
|
542
542
|
}, "#init"));
|
|
543
543
|
m(this, "switchSheet", /* @__PURE__ */ a((t, s = !1) => {
|
|
544
544
|
const n = /* @__PURE__ */ a((c) => {
|
|
545
|
-
const
|
|
545
|
+
const b = Array.from(c.querySelectorAll("nine-table-sheet"));
|
|
546
546
|
Array.from(c.querySelectorAll("nine-splitter")).forEach((x) => x.style.setProperty("display", "none"));
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
const H = parseInt(x.getAttribute("data-index"), 10), q = c.querySelector(`nine-splitter[data-split-index="${H}"]`), U =
|
|
547
|
+
const S = b.filter((x) => x.classList.contains("active"));
|
|
548
|
+
S.length < 2 || S.forEach((x) => {
|
|
549
|
+
const H = parseInt(x.getAttribute("data-index"), 10), q = c.querySelector(`nine-splitter[data-split-index="${H}"]`), U = b[H + 1];
|
|
550
550
|
q && U && U.classList.contains("active") && q.style.setProperty("display", "block");
|
|
551
551
|
});
|
|
552
552
|
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), h = r.querySelectorAll(".nine-tab-item"), f = o.querySelectorAll("nine-table-sheet");
|
|
553
553
|
if (!h[t]) return;
|
|
554
554
|
if (!s)
|
|
555
|
-
trace.log("================================= 1"), h.forEach((c,
|
|
556
|
-
c.classList.toggle("active",
|
|
557
|
-
}), f.forEach((c,
|
|
558
|
-
const u =
|
|
555
|
+
trace.log("================================= 1"), h.forEach((c, b) => {
|
|
556
|
+
c.classList.toggle("active", b === t);
|
|
557
|
+
}), f.forEach((c, b) => {
|
|
558
|
+
const u = b === t;
|
|
559
559
|
c.classList.toggle("active", u), u ? c.style.flex = "1 1 100%" : c.style.flex = "";
|
|
560
560
|
});
|
|
561
561
|
else {
|
|
562
562
|
trace.log("================================= 2");
|
|
563
|
-
const c = h[t],
|
|
564
|
-
if (trace.log(c,
|
|
563
|
+
const c = h[t], b = r.querySelectorAll(".nine-tab-item.active");
|
|
564
|
+
if (trace.log(c, b.length), c.classList.contains("active") && b.length <= 1)
|
|
565
565
|
return;
|
|
566
566
|
c.classList.toggle("active");
|
|
567
567
|
const u = o.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
@@ -573,45 +573,43 @@ const ke = class ke extends HTMLElement {
|
|
|
573
573
|
}) : l.forEach((c) => {
|
|
574
574
|
c.style.flex = "1 1 100%";
|
|
575
575
|
}), n(o);
|
|
576
|
-
const
|
|
577
|
-
if (
|
|
576
|
+
const g = o.querySelector("nine-table-sheet.active");
|
|
577
|
+
if (g && typeof g.getRowCount == "function") {
|
|
578
578
|
const c = this.querySelector("#row-count");
|
|
579
|
-
c && (c.textContent =
|
|
579
|
+
c && (c.textContent = g.getRowCount().toLocaleString());
|
|
580
580
|
}
|
|
581
581
|
}, "switchSheet"));
|
|
582
582
|
}
|
|
583
583
|
connectedCallback() {
|
|
584
|
-
e(this,
|
|
584
|
+
e(this, oe).call(this);
|
|
585
585
|
}
|
|
586
586
|
};
|
|
587
|
-
|
|
588
|
-
let
|
|
589
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
590
|
-
var
|
|
591
|
-
const
|
|
587
|
+
oe = new WeakMap(), a(Ae, "NineTableSheets");
|
|
588
|
+
let ye = Ae;
|
|
589
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", ye);
|
|
590
|
+
var R, le, J, ae;
|
|
591
|
+
const qe = class qe {
|
|
592
592
|
constructor(i) {
|
|
593
|
-
d(this,
|
|
594
|
-
d(this,
|
|
595
|
-
|
|
596
|
-
d(this, ce, /* @__PURE__ */ a(() => {
|
|
597
|
-
g(this, J, new ResizeObserver((i) => {
|
|
593
|
+
d(this, R);
|
|
594
|
+
d(this, le, /* @__PURE__ */ a(() => {
|
|
595
|
+
e(this, ae).call(this), new ResizeObserver((i) => {
|
|
598
596
|
for (let t of i)
|
|
599
|
-
e(this,
|
|
600
|
-
})
|
|
601
|
-
}, "#
|
|
602
|
-
d(this,
|
|
597
|
+
e(this, R).getAttribute("auto-height") === "true" && e(this, J).call(this);
|
|
598
|
+
}).observe(e(this, R));
|
|
599
|
+
}, "#init"));
|
|
600
|
+
d(this, J, /* @__PURE__ */ a(() => {
|
|
603
601
|
var f, l;
|
|
604
|
-
const i = Array.from(e(this,
|
|
602
|
+
const i = Array.from(e(this, R).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
605
603
|
if (i.length === 0) return;
|
|
606
|
-
const t = parseInt(e(this,
|
|
607
|
-
e(this,
|
|
604
|
+
const t = parseInt(e(this, R).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((g) => g.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 = ee.SCROLLBAR_SIZE, h = t * s + n + r + o;
|
|
605
|
+
e(this, R).style.height = `${h}px`;
|
|
608
606
|
}, "#applyAutoHeight"));
|
|
609
|
-
d(this,
|
|
610
|
-
const t = Array.from(e(this,
|
|
611
|
-
const c = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`,
|
|
612
|
-
return c +
|
|
607
|
+
d(this, ae, /* @__PURE__ */ a(() => {
|
|
608
|
+
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) => {
|
|
609
|
+
const c = `<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>` : "";
|
|
610
|
+
return c + b;
|
|
613
611
|
}).join(""), o = t.map((f, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
614
|
-
e(this,
|
|
612
|
+
e(this, R).shadowRoot.innerHTML = `
|
|
615
613
|
<style>
|
|
616
614
|
:host {
|
|
617
615
|
display: flex;
|
|
@@ -710,80 +708,80 @@ const Ce = class Ce {
|
|
|
710
708
|
</nine-table-body>
|
|
711
709
|
<nine-table-footer></nine-table-footer>
|
|
712
710
|
`;
|
|
713
|
-
const h = e(this,
|
|
711
|
+
const h = e(this, R).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
714
712
|
h == null || h.forEach((f, l) => {
|
|
715
713
|
t[l] && setTimeout(() => {
|
|
716
|
-
f.init(t[l]), s && e(this,
|
|
714
|
+
f.init(t[l]), s && e(this, J).call(this);
|
|
717
715
|
});
|
|
718
716
|
});
|
|
719
717
|
}, "#render"));
|
|
720
|
-
|
|
718
|
+
p(this, R, i), e(this, le).call(this);
|
|
721
719
|
}
|
|
722
720
|
};
|
|
723
|
-
|
|
724
|
-
let
|
|
725
|
-
var
|
|
726
|
-
const
|
|
721
|
+
R = new WeakMap(), le = new WeakMap(), J = new WeakMap(), ae = new WeakMap(), a(qe, "LayoutManager");
|
|
722
|
+
let we = qe;
|
|
723
|
+
var W, Y;
|
|
724
|
+
const ke = class ke {
|
|
727
725
|
constructor(i) {
|
|
728
|
-
d(this,
|
|
726
|
+
d(this, W);
|
|
729
727
|
d(this, Y, -1);
|
|
730
|
-
m(this, "count", /* @__PURE__ */ a(() => e(this,
|
|
731
|
-
|
|
728
|
+
m(this, "count", /* @__PURE__ */ a(() => e(this, W).rawRecords.length, "count"));
|
|
729
|
+
p(this, W, i);
|
|
732
730
|
}
|
|
733
731
|
get at() {
|
|
734
732
|
return e(this, Y);
|
|
735
733
|
}
|
|
736
734
|
set at(i) {
|
|
737
735
|
var s, n;
|
|
738
|
-
|
|
739
|
-
const t = ((n = (s = e(this,
|
|
736
|
+
p(this, Y, parseInt(i, 10));
|
|
737
|
+
const t = ((n = (s = e(this, W).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || e(this, W).owner.body;
|
|
740
738
|
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, Y)}"]`) && setTimeout(() => {
|
|
741
739
|
var r, o;
|
|
742
|
-
(o = (r = e(this,
|
|
740
|
+
(o = (r = e(this, W).owner).scrollTo_V1) == null || o.call(r, e(this, Y));
|
|
743
741
|
});
|
|
744
742
|
}
|
|
745
743
|
};
|
|
746
|
-
|
|
747
|
-
let
|
|
748
|
-
var T, v, A, K,
|
|
744
|
+
W = new WeakMap(), Y = new WeakMap(), a(ke, "ngRow");
|
|
745
|
+
let me = ke;
|
|
746
|
+
var T, v, A, K, ce, z, he, Q, de, fe, Z;
|
|
749
747
|
const k = class k {
|
|
750
748
|
constructor(i, t) {
|
|
751
749
|
d(this, T);
|
|
752
750
|
d(this, v);
|
|
753
751
|
d(this, A, []);
|
|
754
752
|
d(this, K, []);
|
|
755
|
-
d(this,
|
|
756
|
-
d(this,
|
|
757
|
-
d(this,
|
|
758
|
-
|
|
753
|
+
d(this, ce, 0);
|
|
754
|
+
d(this, z, []);
|
|
755
|
+
d(this, he, /* @__PURE__ */ a(() => {
|
|
756
|
+
p(this, z, []);
|
|
759
757
|
const i = e(this, T).template || [];
|
|
760
758
|
Array.from(i).forEach((t) => {
|
|
761
759
|
var s;
|
|
762
|
-
e(this,
|
|
760
|
+
e(this, z).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
763
761
|
}), (e(this, v).rawRecords || []).forEach((t) => {
|
|
764
|
-
t.__ng || (t.__ng = e(this,
|
|
762
|
+
t.__ng || (t.__ng = e(this, Q).call(this)), t.__ng.height = e(this, z).slice();
|
|
765
763
|
});
|
|
766
764
|
}, "#initialize"));
|
|
767
765
|
m(this, "set", /* @__PURE__ */ a((i) => {
|
|
768
766
|
this.clear(), this.add(i, !1);
|
|
769
767
|
}, "set"));
|
|
770
|
-
d(this,
|
|
768
|
+
d(this, Q, /* @__PURE__ */ a(() => ({
|
|
771
769
|
rowState: k.ROW_STATE.EMPTY,
|
|
772
770
|
deleted: !1,
|
|
773
771
|
filtered: !1,
|
|
774
|
-
height: e(this,
|
|
772
|
+
height: e(this, z).slice(),
|
|
775
773
|
o: {},
|
|
776
774
|
c: {},
|
|
777
|
-
_: [0, 0, 0, 0, k.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this,
|
|
775
|
+
_: [0, 0, 0, 0, k.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, z).slice(), -1, {}, {}]
|
|
778
776
|
}), "#getDefaultMeta"));
|
|
779
777
|
m(this, "reset", /* @__PURE__ */ a(() => {
|
|
780
|
-
|
|
778
|
+
p(this, A, []), p(this, K, []);
|
|
781
779
|
}, "reset"));
|
|
782
780
|
m(this, "clear", /* @__PURE__ */ a(() => {
|
|
783
781
|
var i;
|
|
784
|
-
e(this, v).rawRecords = [],
|
|
782
|
+
e(this, v).rawRecords = [], p(this, A, []), p(this, K, []), (i = e(this, v).viewRecords) != null && i.reset && e(this, v).viewRecords.reset();
|
|
785
783
|
}, "clear"));
|
|
786
|
-
d(this,
|
|
784
|
+
d(this, de, /* @__PURE__ */ a((i) => {
|
|
787
785
|
var n;
|
|
788
786
|
Array.isArray(i) || (i = [i]);
|
|
789
787
|
const t = typeof ((n = e(this, T).fields) == null ? void 0 : n.get) == "function" ? e(this, T).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
@@ -794,14 +792,14 @@ const k = class k {
|
|
|
794
792
|
}), s.push(o);
|
|
795
793
|
}), s;
|
|
796
794
|
}, "#json2Array"));
|
|
797
|
-
d(this,
|
|
798
|
-
t.__ng = e(this,
|
|
795
|
+
d(this, fe, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
796
|
+
t.__ng = e(this, Q).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = k.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
799
797
|
}), i), "#defaultInsert"));
|
|
800
798
|
m(this, "add", /* @__PURE__ */ a((i, t = !0) => {
|
|
801
799
|
var r;
|
|
802
800
|
i === void 0 && (i = {});
|
|
803
|
-
const s = e(this,
|
|
804
|
-
e(this, v).rawRecords = e(this, v).rawRecords.concat(e(this,
|
|
801
|
+
const s = e(this, de).call(this, i);
|
|
802
|
+
e(this, v).rawRecords = e(this, v).rawRecords.concat(e(this, fe).call(this, s)), this.resetRecords();
|
|
805
803
|
const n = this.count() - 1;
|
|
806
804
|
return t || s.forEach((o, h) => {
|
|
807
805
|
const f = e(this, v).rawRecords[n - h];
|
|
@@ -831,7 +829,7 @@ const k = class k {
|
|
|
831
829
|
h !== s && o.__ng.rowState !== k.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(t) || (o.__ng.o[t] = h), o.__ng.rowState = k.ROW_STATE.UPDATE), o.v[r] = s, e(this, v).owner.refreshData && e(this, v).owner.refreshData(i);
|
|
832
830
|
}, "setValue"));
|
|
833
831
|
m(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
834
|
-
|
|
832
|
+
p(this, K, e(this, v).rawRecords.filter((i) => !i.__ng.deleted)), p(this, A, e(this, v).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, v).rawRecords.forEach((i, t) => {
|
|
835
833
|
i.__ng.rowidx = t;
|
|
836
834
|
}), e(this, A).forEach((i, t) => {
|
|
837
835
|
i.__ng.i = t;
|
|
@@ -863,7 +861,7 @@ const k = class k {
|
|
|
863
861
|
}
|
|
864
862
|
return e(this, Z).call(this, s[i]);
|
|
865
863
|
}, "get"));
|
|
866
|
-
|
|
864
|
+
p(this, T, i), p(this, v, t), e(this, he).call(this);
|
|
867
865
|
}
|
|
868
866
|
get source() {
|
|
869
867
|
return e(this, Z).call(this, e(this, v).rawRecords);
|
|
@@ -872,7 +870,7 @@ const k = class k {
|
|
|
872
870
|
this.clear(), this.add(i, !1);
|
|
873
871
|
}
|
|
874
872
|
get nextId() {
|
|
875
|
-
return ++
|
|
873
|
+
return ++He(this, ce)._;
|
|
876
874
|
}
|
|
877
875
|
get length() {
|
|
878
876
|
return e(this, A).length;
|
|
@@ -881,7 +879,7 @@ const k = class k {
|
|
|
881
879
|
return this.length;
|
|
882
880
|
}
|
|
883
881
|
};
|
|
884
|
-
T = new WeakMap(), v = new WeakMap(), A = new WeakMap(), K = new WeakMap(),
|
|
882
|
+
T = new WeakMap(), v = new WeakMap(), A = new WeakMap(), K = new WeakMap(), ce = new WeakMap(), z = new WeakMap(), he = new WeakMap(), Q = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), Z = new WeakMap(), a(k, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
885
883
|
m(k, "ROW_STATE", {
|
|
886
884
|
EMPTY: "EMPTY",
|
|
887
885
|
NORMAL: "NORMAL",
|
|
@@ -889,10 +887,10 @@ m(k, "ROW_STATE", {
|
|
|
889
887
|
UPDATE: "UPDATE",
|
|
890
888
|
DELETE: "DELETE"
|
|
891
889
|
});
|
|
892
|
-
let
|
|
893
|
-
const
|
|
890
|
+
let ve = k;
|
|
891
|
+
const Ce = class Ce {
|
|
894
892
|
constructor(i) {
|
|
895
|
-
this.owner = i, this.row = new
|
|
893
|
+
this.owner = i, this.row = new me(this), this.data = new ve(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
896
894
|
var t;
|
|
897
895
|
(t = this.owner.view) != null && t.redraw && this.owner.view.redraw();
|
|
898
896
|
}, this.setDataSource = (t) => {
|
|
@@ -909,19 +907,19 @@ const _e = class _e {
|
|
|
909
907
|
}, this.setDataSource([]);
|
|
910
908
|
}
|
|
911
909
|
};
|
|
912
|
-
a(
|
|
913
|
-
let
|
|
914
|
-
var F,
|
|
915
|
-
const
|
|
910
|
+
a(Ce, "ngDataManager");
|
|
911
|
+
let xe = Ce;
|
|
912
|
+
var F, ue;
|
|
913
|
+
const Le = class Le extends HTMLElement {
|
|
916
914
|
constructor() {
|
|
917
915
|
super();
|
|
918
916
|
//#created = false;
|
|
919
917
|
d(this, F);
|
|
920
|
-
d(this,
|
|
921
|
-
this.attachShadow({ mode: "open" }),
|
|
918
|
+
d(this, ue);
|
|
919
|
+
this.attachShadow({ mode: "open" }), p(this, F, new xe(this));
|
|
922
920
|
}
|
|
923
921
|
connectedCallback() {
|
|
924
|
-
|
|
922
|
+
p(this, ue, new we(this)), G.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
925
923
|
}
|
|
926
924
|
disconnectedCallback() {
|
|
927
925
|
G.log("NineTable disconnected.");
|
|
@@ -939,7 +937,7 @@ const Ie = class Ie extends HTMLElement {
|
|
|
939
937
|
return e(this, F);
|
|
940
938
|
}
|
|
941
939
|
};
|
|
942
|
-
F = new WeakMap(),
|
|
943
|
-
let
|
|
944
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
940
|
+
F = new WeakMap(), ue = new WeakMap(), a(Le, "NineTable");
|
|
941
|
+
let Se = Le;
|
|
942
|
+
customElements.get("nine-table") || customElements.define("nine-table", Se);
|
|
945
943
|
//# sourceMappingURL=nine-table.js.map
|