@ninebone/table 0.0.132 β 0.0.134
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 +184 -178
- 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 Me = Object.defineProperty;
|
|
2
|
+
var Ie = (w) => {
|
|
3
3
|
throw TypeError(w);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var c = (w, i) =>
|
|
7
|
-
var v = (w, i, t) =>
|
|
8
|
-
var e = (w, i, t) => (
|
|
9
|
-
var
|
|
5
|
+
var We = (w, i, t) => i in w ? Me(w, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : w[i] = t;
|
|
6
|
+
var c = (w, i) => Me(w, "name", { value: i, configurable: !0 });
|
|
7
|
+
var v = (w, i, t) => We(w, typeof i != "symbol" ? i + "" : i, t), $e = (w, i, t) => i.has(w) || Ie("Cannot " + t);
|
|
8
|
+
var e = (w, i, t) => ($e(w, i, "read from private field"), t ? t.call(w) : i.get(w)), f = (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) => ($e(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
|
},
|
|
@@ -14,17 +14,17 @@ var $e = (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 ze } from "@ninebone/util";
|
|
18
|
+
const Re = class Re extends ze.constructor {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
c(
|
|
24
|
-
let
|
|
25
|
-
const j = new
|
|
23
|
+
c(Re, "Trace");
|
|
24
|
+
let be = Re;
|
|
25
|
+
const j = new be();
|
|
26
26
|
var _, O, y, B, D, N, ee, P, te;
|
|
27
|
-
const
|
|
27
|
+
const Te = class Te extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
f(this, _);
|
|
@@ -44,27 +44,27 @@ const Re = class Re extends HTMLElement {
|
|
|
44
44
|
if (!e(this, _) || !e(this, y) || e(this, O)) return;
|
|
45
45
|
const t = e(this, y).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = e(this, y).track, o = e(this, y).thumb, r = e(this, _).querySelector(".ng-container-bottom"),
|
|
48
|
-
if (
|
|
47
|
+
const n = e(this, y).track, o = e(this, y).thumb, r = e(this, _).querySelector(".ng-container-bottom"), a = t.clientWidth, u = s.scrollWidth;
|
|
48
|
+
if (a !== 0 && u > a)
|
|
49
49
|
r && (r.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
r && (r.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
o.style.width = `${
|
|
54
|
+
const l = n.clientWidth;
|
|
55
|
+
if (l <= 0) return;
|
|
56
|
+
const g = Math.max(Math.min(l * (a / u), l), 20);
|
|
57
|
+
o.style.width = `${g}px`;
|
|
58
58
|
let h = 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] && (h = parseFloat(x[1]));
|
|
63
63
|
} else
|
|
64
64
|
h = parseInt(s.style.left || 0, 10);
|
|
65
|
-
let d = parseInt(Math.abs(h) *
|
|
65
|
+
let d = parseInt(Math.abs(h) * l / u, 10);
|
|
66
66
|
d < 0 && (d = 0);
|
|
67
|
-
const S =
|
|
67
|
+
const S = l - g;
|
|
68
68
|
d > S && (d = S), o.style.left = `${d}px`, e(this, y).left.disabled = d === 0, e(this, y).right.disabled = d >= S - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
70
|
f(this, P, /* @__PURE__ */ c((t) => {
|
|
@@ -72,13 +72,13 @@ const Re = class Re extends HTMLElement {
|
|
|
72
72
|
const s = e(this, y).container, n = s.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
74
74
|
const o = e(this, y).track.getBoundingClientRect(), r = e(this, y).thumb.clientWidth;
|
|
75
|
-
let
|
|
76
|
-
|
|
75
|
+
let a = t;
|
|
76
|
+
a < 0 && (a = 0);
|
|
77
77
|
const u = o.width - r;
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
let h = u > 0 ? -
|
|
81
|
-
return -h >
|
|
78
|
+
a > u && (a = u), a = parseInt(a, 10), e(this, y).thumb.style.left = `${a}px`, e(this, y).left.disabled = a === 0, e(this, y).right.disabled = a >= u - 1;
|
|
79
|
+
const l = s.clientWidth, g = n.scrollWidth;
|
|
80
|
+
let h = u > 0 ? -a * (g - l) / u : 0;
|
|
81
|
+
return -h > g - l && (h = -(g - l)), -h + 5 > g - l && (h = -(g - l)), l >= g && (h = 0), n.style.transform = `translateX(${h}px)`, a > 0 && a < u - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
83
|
f(this, te, /* @__PURE__ */ c(() => {
|
|
84
84
|
const t = /* @__PURE__ */ c((n) => {
|
|
@@ -107,10 +107,10 @@ const Re = class Re extends HTMLElement {
|
|
|
107
107
|
}), e(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
109
|
n.stopPropagation(), n.preventDefault(), p(this, O, !0), this.shiftX = n.clientX - e(this, y).thumb.getBoundingClientRect().left;
|
|
110
|
-
const o = /* @__PURE__ */ c((
|
|
110
|
+
const o = /* @__PURE__ */ c((a) => {
|
|
111
111
|
if (!e(this, O)) return;
|
|
112
112
|
const u = e(this, y).track.getBoundingClientRect();
|
|
113
|
-
e(this, P).call(this,
|
|
113
|
+
e(this, P).call(this, a.clientX - u.left - this.shiftX);
|
|
114
114
|
}, "onMouseMove"), r = /* @__PURE__ */ c(() => {
|
|
115
115
|
p(this, O, !1), s(), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
116
116
|
}, "onMouseUp");
|
|
@@ -203,11 +203,11 @@ const Re = class Re extends HTMLElement {
|
|
|
203
203
|
e(this, N) && e(this, N).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
_ = new WeakMap(), O = new WeakMap(), y = new WeakMap(), B = new WeakMap(), D = new WeakMap(), N = new WeakMap(), ee = new WeakMap(), P = new WeakMap(), te = new WeakMap(), c(
|
|
207
|
-
let
|
|
208
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar",
|
|
209
|
-
var X, M, q, $, I, H, ie;
|
|
210
|
-
const
|
|
206
|
+
_ = new WeakMap(), O = new WeakMap(), y = new WeakMap(), B = new WeakMap(), D = new WeakMap(), N = new WeakMap(), ee = new WeakMap(), P = new WeakMap(), te = new WeakMap(), c(Te, "NineTableHScrollBar");
|
|
207
|
+
let ge = Te;
|
|
208
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ge);
|
|
209
|
+
var X, M, q, $, I, H, ie, se;
|
|
210
|
+
const qe = class qe {
|
|
211
211
|
constructor(i) {
|
|
212
212
|
f(this, X);
|
|
213
213
|
f(this, M, []);
|
|
@@ -215,10 +215,13 @@ const Te = class Te {
|
|
|
215
215
|
f(this, $, null);
|
|
216
216
|
f(this, I, 0);
|
|
217
217
|
f(this, H, 0);
|
|
218
|
+
f(this, ie, /* @__PURE__ */ c(() => {
|
|
219
|
+
e(this, se).call(this);
|
|
220
|
+
}, "#init"));
|
|
218
221
|
/**
|
|
219
222
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
220
223
|
*/
|
|
221
|
-
f(this,
|
|
224
|
+
f(this, se, /* @__PURE__ */ c(() => {
|
|
222
225
|
!e(this, X) || !(e(this, X) instanceof HTMLElement) || (p(this, $, new ResizeObserver((i) => {
|
|
223
226
|
for (const t of i) {
|
|
224
227
|
const s = t.target;
|
|
@@ -228,13 +231,13 @@ const Te = class Te {
|
|
|
228
231
|
if (n > 0) {
|
|
229
232
|
const o = s.clientHeight || s.getBoundingClientRect().height || n;
|
|
230
233
|
let r = 0;
|
|
231
|
-
const
|
|
232
|
-
u && (r += u.offsetHeight || u.getBoundingClientRect().height),
|
|
233
|
-
const
|
|
234
|
-
if (e(this, I) !==
|
|
234
|
+
const a = s.querySelector(".ng-container-body") || s, u = a.querySelector("thead"), l = a.querySelector("tfoot");
|
|
235
|
+
u && (r += u.offsetHeight || u.getBoundingClientRect().height), l && (r += l.offsetHeight || l.getBoundingClientRect().height);
|
|
236
|
+
const g = Math.max(o - r, 100);
|
|
237
|
+
if (e(this, I) !== g && (p(this, I, g), e(this, q) !== null)) {
|
|
235
238
|
const h = Math.ceil(e(this, I) / e(this, q));
|
|
236
|
-
p(this, H, h + 20), j.log(`[RowManager] Resized. Height: ${e(this, I)}px | Target Rows: ${e(this, H)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((
|
|
237
|
-
const d = s.querySelector(
|
|
239
|
+
p(this, H, h + 20), j.log(`[RowManager] Resized. Height: ${e(this, I)}px | Target Rows: ${e(this, H)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((b) => {
|
|
240
|
+
const d = s.querySelector(b);
|
|
238
241
|
d && d.querySelector("tbody") && this.renderRows(d);
|
|
239
242
|
});
|
|
240
243
|
}
|
|
@@ -255,20 +258,20 @@ const Te = class Te {
|
|
|
255
258
|
throw new Error("[RowManager] Template TRs are empty.");
|
|
256
259
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
257
260
|
if (!t) return 24;
|
|
258
|
-
t.querySelectorAll("tr:not(.nodata)").forEach((
|
|
261
|
+
t.querySelectorAll("tr:not(.nodata)").forEach((a) => a.remove());
|
|
259
262
|
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
260
|
-
e(this, M).forEach((
|
|
261
|
-
n.appendChild(
|
|
263
|
+
e(this, M).forEach((a) => {
|
|
264
|
+
n.appendChild(a.cloneNode(!0));
|
|
262
265
|
}), s ? s.before(n) : t.appendChild(n);
|
|
263
266
|
let o = 0;
|
|
264
|
-
if (t.querySelectorAll("tr:not(.nodata)").forEach((
|
|
265
|
-
const
|
|
266
|
-
if (
|
|
267
|
+
if (t.querySelectorAll("tr:not(.nodata)").forEach((a, u) => {
|
|
268
|
+
const l = a.offsetHeight;
|
|
269
|
+
if (l === 0)
|
|
267
270
|
throw new Error(`[RowManager] Rendered TR[${u}] height is 0. Check CSS styles.`);
|
|
268
|
-
o +=
|
|
271
|
+
o += l;
|
|
269
272
|
}), p(this, q, o), e(this, I) > 0) {
|
|
270
|
-
const
|
|
271
|
-
p(this, H,
|
|
273
|
+
const a = Math.ceil(e(this, I) / e(this, q));
|
|
274
|
+
p(this, H, a + 20);
|
|
272
275
|
}
|
|
273
276
|
return console.log(`[RowManager] Template Height Cached: ${e(this, q)}px | RowCount: ${e(this, H)}`), e(this, q);
|
|
274
277
|
}, "measureAndCacheHeight"));
|
|
@@ -295,8 +298,8 @@ const Te = class Te {
|
|
|
295
298
|
t.querySelectorAll("tr:not(.nodata)").forEach((r) => r.remove());
|
|
296
299
|
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment(), o = e(this, H);
|
|
297
300
|
for (let r = 0; r < o; r++)
|
|
298
|
-
e(this, M).forEach((
|
|
299
|
-
n.appendChild(
|
|
301
|
+
e(this, M).forEach((a) => {
|
|
302
|
+
n.appendChild(a.cloneNode(!0));
|
|
300
303
|
});
|
|
301
304
|
s ? s.before(n) : t.appendChild(n), console.log(`[RowManager] Rendered ${o} sets into DOM.`);
|
|
302
305
|
}, "renderRows"));
|
|
@@ -309,9 +312,9 @@ const Te = class Te {
|
|
|
309
312
|
return e(this, M).length || 1;
|
|
310
313
|
}
|
|
311
314
|
};
|
|
312
|
-
X = new WeakMap(), M = new WeakMap(), q = new WeakMap(), $ = new WeakMap(), I = new WeakMap(), H = new WeakMap(), ie = new WeakMap(), c(
|
|
313
|
-
let
|
|
314
|
-
var A, F,
|
|
315
|
+
X = new WeakMap(), M = new WeakMap(), q = new WeakMap(), $ = new WeakMap(), I = new WeakMap(), H = new WeakMap(), ie = new WeakMap(), se = new WeakMap(), c(qe, "RowManager");
|
|
316
|
+
let pe = qe;
|
|
317
|
+
var A, F, ne;
|
|
315
318
|
const Z = class Z extends HTMLElement {
|
|
316
319
|
constructor() {
|
|
317
320
|
super();
|
|
@@ -319,69 +322,69 @@ const Z = class Z extends HTMLElement {
|
|
|
319
322
|
f(this, F);
|
|
320
323
|
v(this, "init", /* @__PURE__ */ c((t) => {
|
|
321
324
|
if (!t) return;
|
|
322
|
-
const s = /* @__PURE__ */ c((
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
325
|
-
const d =
|
|
325
|
+
const s = /* @__PURE__ */ c((l) => {
|
|
326
|
+
const g = /* @__PURE__ */ c((b) => {
|
|
327
|
+
if (b.querySelector("colgroup")) return;
|
|
328
|
+
const d = b.querySelector("tbody tr") || b.querySelector("tr"), S = d ? d.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), k = Math.max(Math.floor((b.clientWidth || 600) / S), 100);
|
|
326
329
|
for (let R = 0; R < S; R++) {
|
|
327
|
-
const
|
|
328
|
-
|
|
330
|
+
const ue = document.createElement("col");
|
|
331
|
+
ue.setAttribute("width", k), x.appendChild(ue);
|
|
329
332
|
}
|
|
330
|
-
|
|
331
|
-
}, "ensureColgroup"), h = /* @__PURE__ */ c((
|
|
332
|
-
if (
|
|
333
|
-
const d = document.createElement("thead"), S =
|
|
334
|
-
S ? S.after(d) :
|
|
333
|
+
b.prepend(x);
|
|
334
|
+
}, "ensureColgroup"), h = /* @__PURE__ */ c((b) => {
|
|
335
|
+
if (b.querySelector("thead")) return;
|
|
336
|
+
const d = document.createElement("thead"), S = b.querySelector("colgroup");
|
|
337
|
+
S ? S.after(d) : b.prepend(d);
|
|
335
338
|
}, "ensureThead");
|
|
336
|
-
return
|
|
339
|
+
return g(l), h(l), l.classList.add("nine-table-element"), l;
|
|
337
340
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
338
341
|
p(this, A, s(n)), e(this, A).style.display = "table", e(this, F).initTemplate(e(this, A));
|
|
339
|
-
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"),
|
|
340
|
-
const
|
|
342
|
+
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"), a = this.querySelector(".ng-container-right"), u = /* @__PURE__ */ c((l, g, h = !1) => {
|
|
343
|
+
const b = l.cloneNode(!0), d = Array.from(b.querySelectorAll("colgroup col")), S = [];
|
|
341
344
|
return d.forEach((x, k) => {
|
|
342
345
|
const R = x.getAttribute("fixed");
|
|
343
|
-
(h ? !R || R === "" : R ===
|
|
346
|
+
(h ? !R || R === "" : R === g) || S.push(k);
|
|
344
347
|
}), S.reverse().forEach((x) => {
|
|
345
|
-
d[x] && d[x].remove(),
|
|
348
|
+
d[x] && d[x].remove(), b.querySelectorAll("tr").forEach((k) => {
|
|
346
349
|
const R = k.querySelectorAll("th, td");
|
|
347
350
|
R[x] && R[x].remove();
|
|
348
351
|
});
|
|
349
|
-
}),
|
|
352
|
+
}), b;
|
|
350
353
|
}, "filterTableByFixed");
|
|
351
354
|
if (r) {
|
|
352
|
-
const
|
|
353
|
-
r.innerHTML = "", r.appendChild(
|
|
355
|
+
const l = u(e(this, A), null, !0);
|
|
356
|
+
r.innerHTML = "", r.appendChild(l), e(this, F).measureAndCacheHeight(r);
|
|
354
357
|
}
|
|
355
358
|
if (o) {
|
|
356
|
-
const
|
|
357
|
-
let
|
|
358
|
-
|
|
359
|
-
const d = parseInt(
|
|
360
|
-
isNaN(d) || (
|
|
361
|
-
}), o.innerHTML = "", o.appendChild(
|
|
362
|
-
const h =
|
|
359
|
+
const l = u(e(this, A), "left", !1);
|
|
360
|
+
let g = 0;
|
|
361
|
+
l.querySelectorAll("col").forEach((b) => {
|
|
362
|
+
const d = parseInt(b.getAttribute("width"), 10);
|
|
363
|
+
isNaN(d) || (g += d);
|
|
364
|
+
}), o.innerHTML = "", o.appendChild(l);
|
|
365
|
+
const h = g > 0 ? g : 0;
|
|
363
366
|
o.style.flex = `0 0 ${h}px`, o.style.width = `${h}px`;
|
|
364
367
|
}
|
|
365
|
-
if (
|
|
366
|
-
const
|
|
367
|
-
let
|
|
368
|
-
|
|
369
|
-
const d = parseInt(
|
|
370
|
-
isNaN(d) || (
|
|
371
|
-
}),
|
|
372
|
-
const h =
|
|
373
|
-
|
|
368
|
+
if (a) {
|
|
369
|
+
const l = u(e(this, A), "right", !1);
|
|
370
|
+
let g = 0;
|
|
371
|
+
l.querySelectorAll("col").forEach((b) => {
|
|
372
|
+
const d = parseInt(b.getAttribute("width"), 10);
|
|
373
|
+
isNaN(d) || (g += d);
|
|
374
|
+
}), a.innerHTML = "", a.appendChild(l);
|
|
375
|
+
const h = g > 0 ? g : 0;
|
|
376
|
+
a.style.flex = `0 0 ${h}px`, a.style.width = `${h}px`;
|
|
374
377
|
}
|
|
375
378
|
if (r) {
|
|
376
|
-
const
|
|
377
|
-
r.style.overflowY =
|
|
378
|
-
const
|
|
379
|
-
|
|
379
|
+
const l = this.getRowCount();
|
|
380
|
+
r.style.overflowY = l > 10 ? "auto" : "hidden", r.addEventListener("scroll", () => {
|
|
381
|
+
const g = this.querySelector("nine-table-hscrollbar");
|
|
382
|
+
g && typeof g.refresh == "function" && g.refresh();
|
|
380
383
|
});
|
|
381
384
|
}
|
|
382
385
|
setTimeout(() => {
|
|
383
|
-
const
|
|
384
|
-
|
|
386
|
+
const l = this.querySelector("nine-table-hscrollbar");
|
|
387
|
+
l && typeof l.refresh == "function" && l.refresh();
|
|
385
388
|
}, 0), j.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
386
389
|
}, "init"));
|
|
387
390
|
v(this, "getRowCount", /* @__PURE__ */ c(() => e(this, A) ? e(this, A).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
@@ -393,7 +396,7 @@ const Z = class Z extends HTMLElement {
|
|
|
393
396
|
const s = this.querySelector(".ng-container-body");
|
|
394
397
|
s && (s.scrollTop = t);
|
|
395
398
|
}, "scrollToY"));
|
|
396
|
-
f(this,
|
|
399
|
+
f(this, ne, /* @__PURE__ */ c(() => {
|
|
397
400
|
const t = Z.SCROLLBAR_SIZE;
|
|
398
401
|
this.innerHTML = `
|
|
399
402
|
<style>
|
|
@@ -510,23 +513,23 @@ const Z = class Z extends HTMLElement {
|
|
|
510
513
|
</div>
|
|
511
514
|
`;
|
|
512
515
|
}, "#render"));
|
|
513
|
-
p(this, F, new
|
|
516
|
+
p(this, F, new pe(this));
|
|
514
517
|
}
|
|
515
518
|
connectedCallback() {
|
|
516
|
-
e(this,
|
|
519
|
+
e(this, ne).call(this);
|
|
517
520
|
}
|
|
518
521
|
disconnectedCallback() {
|
|
519
522
|
this.innerHTML = "", j.log("NineTableSheet destroyed.");
|
|
520
523
|
}
|
|
521
524
|
};
|
|
522
|
-
A = new WeakMap(), F = new WeakMap(),
|
|
523
|
-
let
|
|
524
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
525
|
-
var
|
|
526
|
-
const
|
|
525
|
+
A = new WeakMap(), F = new WeakMap(), ne = new WeakMap(), c(Z, "NineTableSheet"), v(Z, "SCROLLBAR_SIZE", 16);
|
|
526
|
+
let ye = Z;
|
|
527
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ye);
|
|
528
|
+
var re;
|
|
529
|
+
const Ce = class Ce extends HTMLElement {
|
|
527
530
|
constructor() {
|
|
528
531
|
super();
|
|
529
|
-
f(this,
|
|
532
|
+
f(this, re, /* @__PURE__ */ c(() => {
|
|
530
533
|
const t = this.querySelector(".nine-tab-bar");
|
|
531
534
|
t && (t.addEventListener("click", (s) => {
|
|
532
535
|
const n = s.target.closest(".nine-tab-item");
|
|
@@ -542,55 +545,55 @@ const qe = class qe extends HTMLElement {
|
|
|
542
545
|
const S = parseInt(d.dataset.splitIndex, 10), x = h.querySelector(`nine-table-sheet[data-index="${S - 1}"]`), k = h.querySelector(`nine-table-sheet[data-index="${S}"]`);
|
|
543
546
|
x && k && x.classList.contains("active") && k.classList.contains("active") ? d.classList.add("active") : d.classList.remove("active");
|
|
544
547
|
});
|
|
545
|
-
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"),
|
|
546
|
-
if (!
|
|
548
|
+
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), a = o.querySelectorAll(".nine-tab-item"), u = r.querySelectorAll("nine-table-sheet");
|
|
549
|
+
if (!a[t]) return;
|
|
547
550
|
if (!s)
|
|
548
|
-
|
|
549
|
-
h.classList.toggle("active",
|
|
550
|
-
const d = r.querySelector(`nine-table-sheet[data-index="${
|
|
551
|
+
a.forEach((h, b) => {
|
|
552
|
+
h.classList.toggle("active", b === t);
|
|
553
|
+
const d = r.querySelector(`nine-table-sheet[data-index="${b}"]`);
|
|
551
554
|
d && (d.style.flex = "");
|
|
552
|
-
}), u.forEach((h,
|
|
553
|
-
h.classList.toggle("active",
|
|
555
|
+
}), u.forEach((h, b) => {
|
|
556
|
+
h.classList.toggle("active", b === t);
|
|
554
557
|
});
|
|
555
558
|
else {
|
|
556
|
-
const h =
|
|
557
|
-
if (h.classList.contains("active") &&
|
|
559
|
+
const h = a[t], b = o.querySelectorAll(".nine-tab-item.active");
|
|
560
|
+
if (h.classList.contains("active") && b.length <= 1)
|
|
558
561
|
return;
|
|
559
562
|
h.classList.toggle("active");
|
|
560
563
|
const d = r.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
561
564
|
d && (d.classList.toggle("active"), d.classList.contains("active") || (d.style.flex = ""));
|
|
562
565
|
}
|
|
563
|
-
const
|
|
564
|
-
if (
|
|
565
|
-
const h = 1 /
|
|
566
|
-
|
|
567
|
-
(!
|
|
566
|
+
const l = Array.from(r.querySelectorAll("nine-table-sheet.active"));
|
|
567
|
+
if (l.length > 1) {
|
|
568
|
+
const h = 1 / l.length;
|
|
569
|
+
l.forEach((b) => {
|
|
570
|
+
(!b.style.flex || b.style.flex === "1 1 100%") && (b.style.flex = `${h} ${h} 0px`);
|
|
568
571
|
});
|
|
569
572
|
} else
|
|
570
|
-
|
|
573
|
+
l.forEach((h) => {
|
|
571
574
|
h.style.flex = "1 1 100%";
|
|
572
575
|
});
|
|
573
576
|
n();
|
|
574
|
-
const
|
|
575
|
-
if (
|
|
577
|
+
const g = r.querySelector("nine-table-sheet.active");
|
|
578
|
+
if (g && typeof g.getRowCount == "function") {
|
|
576
579
|
const h = this.querySelector("#row-count");
|
|
577
|
-
h && (h.textContent =
|
|
580
|
+
h && (h.textContent = g.getRowCount().toLocaleString());
|
|
578
581
|
}
|
|
579
582
|
}, "switchSheet"));
|
|
580
583
|
}
|
|
581
584
|
connectedCallback() {
|
|
582
|
-
e(this,
|
|
585
|
+
e(this, re).call(this);
|
|
583
586
|
}
|
|
584
587
|
};
|
|
585
|
-
|
|
586
|
-
let
|
|
587
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
588
|
-
var L, G,
|
|
589
|
-
const
|
|
588
|
+
re = new WeakMap(), c(Ce, "NineTableSheets");
|
|
589
|
+
let we = Ce;
|
|
590
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", we);
|
|
591
|
+
var L, G, oe, J, le;
|
|
592
|
+
const ke = class ke {
|
|
590
593
|
constructor(i) {
|
|
591
594
|
f(this, L);
|
|
592
595
|
f(this, G, null);
|
|
593
|
-
f(this,
|
|
596
|
+
f(this, oe, /* @__PURE__ */ c(() => {
|
|
594
597
|
const i = e(this, L).host;
|
|
595
598
|
i && (p(this, G, new ResizeObserver((t) => {
|
|
596
599
|
for (let s of t)
|
|
@@ -601,13 +604,16 @@ const Ce = class Ce {
|
|
|
601
604
|
var k, R;
|
|
602
605
|
const t = (k = i.shadowRoot) == null ? void 0 : k.querySelector("nine-table-sheet.active");
|
|
603
606
|
if (!t) return;
|
|
604
|
-
const s = ((R = t.getRowCount) == null ? void 0 : R.call(t)) || 0, n = parseInt(i.getAttribute("max-display-row"), 10) || 10, o = Math.min(s, n), r = t.querySelector("tbody tr") || t.querySelector("tr"),
|
|
605
|
-
i.style.height = `${S}px`, i.style.maxHeight = `${n *
|
|
607
|
+
const s = ((R = t.getRowCount) == null ? void 0 : R.call(t)) || 0, n = parseInt(i.getAttribute("max-display-row"), 10) || 10, o = Math.min(s, n), r = t.querySelector("tbody tr") || t.querySelector("tr"), a = r ? r.getBoundingClientRect().height : 32, u = e(this, L).querySelector("nine-table-header"), l = e(this, L).querySelector("nine-table-sheets-footer"), g = u ? u.getBoundingClientRect().height : 40, h = l ? l.getBoundingClientRect().height : 32, d = g + h + 16, S = o * a + d;
|
|
608
|
+
i.style.height = `${S}px`, i.style.maxHeight = `${n * a + d}px`;
|
|
606
609
|
const x = e(this, L).querySelector("nine-table-sheets-body");
|
|
607
610
|
x && (x.style.overflowY = s > n ? "auto" : "hidden");
|
|
608
611
|
}, "#applyAutoHeight"));
|
|
609
|
-
f(this,
|
|
610
|
-
const i = e(this, L).host, s = Array.from(i.children).filter((u) => u.tagName === "TABLE"), n = i.getAttribute("auto-height") === "true", o = s.map((u,
|
|
612
|
+
f(this, le, /* @__PURE__ */ c(() => {
|
|
613
|
+
const i = e(this, L).host, s = Array.from(i.children).filter((u) => u.tagName === "TABLE"), n = i.getAttribute("auto-height") === "true", o = s.map((u, l) => {
|
|
614
|
+
const h = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`, b = l < s.length - 1 ? `<nine-splitter class="h" data-split-index="${l}"></nine-splitter>` : "";
|
|
615
|
+
return h + b;
|
|
616
|
+
}).join(""), r = s.map((u, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
611
617
|
e(this, L).innerHTML = `
|
|
612
618
|
<style>
|
|
613
619
|
:host {
|
|
@@ -706,20 +712,20 @@ const Ce = class Ce {
|
|
|
706
712
|
</nine-table-body>
|
|
707
713
|
<nine-table-footer></nine-table-footer>
|
|
708
714
|
`;
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
s[
|
|
712
|
-
u.init(s[
|
|
715
|
+
const a = e(this, L).querySelectorAll("nine-table-sheet");
|
|
716
|
+
a == null || a.forEach((u, l) => {
|
|
717
|
+
s[l] && setTimeout(() => {
|
|
718
|
+
u.init(s[l]), n && e(this, J).call(this, i);
|
|
713
719
|
});
|
|
714
720
|
});
|
|
715
721
|
}, "#render"));
|
|
716
|
-
p(this, L, i), e(this,
|
|
722
|
+
p(this, L, i), e(this, le).call(this), e(this, oe).call(this);
|
|
717
723
|
}
|
|
718
724
|
};
|
|
719
|
-
L = new WeakMap(), G = new WeakMap(),
|
|
720
|
-
let
|
|
725
|
+
L = new WeakMap(), G = new WeakMap(), oe = new WeakMap(), J = new WeakMap(), le = new WeakMap(), c(ke, "LayoutManager");
|
|
726
|
+
let me = ke;
|
|
721
727
|
var W, V;
|
|
722
|
-
const
|
|
728
|
+
const Ae = class Ae {
|
|
723
729
|
constructor(i) {
|
|
724
730
|
f(this, W);
|
|
725
731
|
f(this, V, -1);
|
|
@@ -739,18 +745,18 @@ const ke = class ke {
|
|
|
739
745
|
});
|
|
740
746
|
}
|
|
741
747
|
};
|
|
742
|
-
W = new WeakMap(), V = new WeakMap(), c(
|
|
743
|
-
let
|
|
744
|
-
var E, m, C, U,
|
|
748
|
+
W = new WeakMap(), V = new WeakMap(), c(Ae, "ngRow");
|
|
749
|
+
let ve = Ae;
|
|
750
|
+
var E, m, C, U, ae, z, ce, Q, he, de, K;
|
|
745
751
|
const T = class T {
|
|
746
752
|
constructor(i, t) {
|
|
747
753
|
f(this, E);
|
|
748
754
|
f(this, m);
|
|
749
755
|
f(this, C, []);
|
|
750
756
|
f(this, U, []);
|
|
751
|
-
f(this,
|
|
757
|
+
f(this, ae, 0);
|
|
752
758
|
f(this, z, []);
|
|
753
|
-
f(this,
|
|
759
|
+
f(this, ce, /* @__PURE__ */ c(() => {
|
|
754
760
|
p(this, z, []);
|
|
755
761
|
const i = e(this, E).template || [];
|
|
756
762
|
Array.from(i).forEach((t) => {
|
|
@@ -779,28 +785,28 @@ const T = class T {
|
|
|
779
785
|
var i;
|
|
780
786
|
e(this, m).rawRecords = [], p(this, C, []), p(this, U, []), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
781
787
|
}, "clear"));
|
|
782
|
-
f(this,
|
|
788
|
+
f(this, he, /* @__PURE__ */ c((i) => {
|
|
783
789
|
var n;
|
|
784
790
|
Array.isArray(i) || (i = [i]);
|
|
785
791
|
const t = typeof ((n = e(this, E).fields) == null ? void 0 : n.get) == "function" ? e(this, E).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
786
792
|
return i.forEach((o) => {
|
|
787
793
|
const r = { v: [] };
|
|
788
|
-
t.forEach((
|
|
789
|
-
r.v.push(o[
|
|
794
|
+
t.forEach((a) => {
|
|
795
|
+
r.v.push(o[a] !== void 0 && o[a] !== null ? o[a] : "");
|
|
790
796
|
}), s.push(r);
|
|
791
797
|
}), s;
|
|
792
798
|
}, "#json2Array"));
|
|
793
|
-
f(this,
|
|
799
|
+
f(this, de, /* @__PURE__ */ c((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
794
800
|
t.__ng = e(this, Q).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = T.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
795
801
|
}), i), "#defaultInsert"));
|
|
796
802
|
v(this, "add", /* @__PURE__ */ c((i, t = !0) => {
|
|
797
803
|
var o;
|
|
798
804
|
i === void 0 && (i = {});
|
|
799
|
-
const s = e(this,
|
|
800
|
-
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this,
|
|
805
|
+
const s = e(this, he).call(this, i);
|
|
806
|
+
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, de).call(this, s)), this.resetRecords();
|
|
801
807
|
const n = this.count() - 1;
|
|
802
|
-
return t || s.forEach((r,
|
|
803
|
-
const u = e(this, m).rawRecords[n -
|
|
808
|
+
return t || s.forEach((r, a) => {
|
|
809
|
+
const u = e(this, m).rawRecords[n - a];
|
|
804
810
|
u && (u.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
805
811
|
}), (o = e(this, m).viewRecords) != null && o.reset && e(this, m).viewRecords.reset(), n;
|
|
806
812
|
}, "add"));
|
|
@@ -823,8 +829,8 @@ const T = class T {
|
|
|
823
829
|
if (o < 0) return;
|
|
824
830
|
const r = this.getValidData()[i];
|
|
825
831
|
if (!r) return;
|
|
826
|
-
const
|
|
827
|
-
|
|
832
|
+
const a = r.v[o];
|
|
833
|
+
a !== s && r.__ng.rowState !== T.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(t) || (r.__ng.o[t] = a), r.__ng.rowState = T.ROW_STATE.UPDATE), r.v[o] = s, e(this, m).owner.refreshData && e(this, m).owner.refreshData(i);
|
|
828
834
|
}, "setValue"));
|
|
829
835
|
v(this, "resetRecords", /* @__PURE__ */ c(() => {
|
|
830
836
|
p(this, U, e(this, m).rawRecords.filter((i) => !i.__ng.deleted)), p(this, C, e(this, m).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, m).rawRecords.forEach((i, t) => {
|
|
@@ -840,8 +846,8 @@ const T = class T {
|
|
|
840
846
|
const t = typeof ((s = e(this, E).fields) == null ? void 0 : s.get) == "function" ? e(this, E).fields.get() : [];
|
|
841
847
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
842
848
|
const o = {};
|
|
843
|
-
return t.forEach((r,
|
|
844
|
-
o[r] = n.v ? n.v[
|
|
849
|
+
return t.forEach((r, a) => {
|
|
850
|
+
o[r] = n.v ? n.v[a] : n[r];
|
|
845
851
|
}), o.__ng = n.__ng, o;
|
|
846
852
|
}) : i;
|
|
847
853
|
}, "#conv2"));
|
|
@@ -859,7 +865,7 @@ const T = class T {
|
|
|
859
865
|
}
|
|
860
866
|
return e(this, K).call(this, s[i]);
|
|
861
867
|
}, "get"));
|
|
862
|
-
p(this, E, i), p(this, m, t), e(this,
|
|
868
|
+
p(this, E, i), p(this, m, t), e(this, ce).call(this);
|
|
863
869
|
}
|
|
864
870
|
get source() {
|
|
865
871
|
return e(this, K).call(this, e(this, m).rawRecords);
|
|
@@ -868,10 +874,10 @@ const T = class T {
|
|
|
868
874
|
this.clear(), this.add(i, !1);
|
|
869
875
|
}
|
|
870
876
|
get nextId() {
|
|
871
|
-
return
|
|
877
|
+
return ++He(this, ae)._;
|
|
872
878
|
}
|
|
873
879
|
};
|
|
874
|
-
E = new WeakMap(), m = new WeakMap(), C = new WeakMap(), U = new WeakMap(),
|
|
880
|
+
E = new WeakMap(), m = new WeakMap(), C = new WeakMap(), U = new WeakMap(), ae = new WeakMap(), z = new WeakMap(), ce = new WeakMap(), Q = new WeakMap(), he = new WeakMap(), de = new WeakMap(), K = new WeakMap(), c(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
875
881
|
v(T, "ROW_STATE", {
|
|
876
882
|
EMPTY: "EMPTY",
|
|
877
883
|
NORMAL: "NORMAL",
|
|
@@ -879,10 +885,10 @@ v(T, "ROW_STATE", {
|
|
|
879
885
|
UPDATE: "UPDATE",
|
|
880
886
|
DELETE: "DELETE"
|
|
881
887
|
});
|
|
882
|
-
let
|
|
883
|
-
const
|
|
888
|
+
let xe = T;
|
|
889
|
+
const Le = class Le {
|
|
884
890
|
constructor(i) {
|
|
885
|
-
this.owner = i, this.row = new
|
|
891
|
+
this.owner = i, this.row = new ve(this), this.data = new xe(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
886
892
|
var t;
|
|
887
893
|
(t = this.owner.view) != null && t.redraw && this.owner.view.redraw();
|
|
888
894
|
}, this.setDataSource = (t) => {
|
|
@@ -899,19 +905,19 @@ const Ae = class Ae {
|
|
|
899
905
|
}, this.setDataSource([]);
|
|
900
906
|
}
|
|
901
907
|
};
|
|
902
|
-
c(
|
|
903
|
-
let
|
|
904
|
-
var Y,
|
|
905
|
-
const
|
|
908
|
+
c(Le, "ngDataManager");
|
|
909
|
+
let Se = Le;
|
|
910
|
+
var Y, fe;
|
|
911
|
+
const _e = class _e extends HTMLElement {
|
|
906
912
|
constructor() {
|
|
907
913
|
super();
|
|
908
914
|
//#created = false;
|
|
909
915
|
f(this, Y);
|
|
910
|
-
f(this,
|
|
911
|
-
this.attachShadow({ mode: "open" }), p(this, Y, new
|
|
916
|
+
f(this, fe);
|
|
917
|
+
this.attachShadow({ mode: "open" }), p(this, Y, new Se(this));
|
|
912
918
|
}
|
|
913
919
|
connectedCallback() {
|
|
914
|
-
p(this,
|
|
920
|
+
p(this, fe, new me(this.shadowRoot)), j.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
915
921
|
}
|
|
916
922
|
disconnectedCallback() {
|
|
917
923
|
j.log("NineTable disconnected.");
|
|
@@ -929,7 +935,7 @@ const Le = class Le extends HTMLElement {
|
|
|
929
935
|
return e(this, Y);
|
|
930
936
|
}
|
|
931
937
|
};
|
|
932
|
-
Y = new WeakMap(),
|
|
933
|
-
let
|
|
934
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
938
|
+
Y = new WeakMap(), fe = new WeakMap(), c(_e, "NineTable");
|
|
939
|
+
let Ee = _e;
|
|
940
|
+
customElements.get("nine-table") || customElements.define("nine-table", Ee);
|
|
935
941
|
//# sourceMappingURL=nine-table.js.map
|