@ninebone/table 0.0.284 β 0.0.285
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 +134 -146
- 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 Pe = Object.defineProperty;
|
|
2
|
+
var Ve = (p) => {
|
|
3
3
|
throw TypeError(p);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var a = (p, i) =>
|
|
7
|
-
var x = (p, i, t) =>
|
|
8
|
-
var e = (p, i, t) => (
|
|
9
|
-
var
|
|
5
|
+
var Ue = (p, i, t) => i in p ? Pe(p, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[i] = t;
|
|
6
|
+
var a = (p, i) => Pe(p, "name", { value: i, configurable: !0 });
|
|
7
|
+
var x = (p, i, t) => Ue(p, typeof i != "symbol" ? i + "" : i, t), Xe = (p, i, t) => i.has(p) || Ve("Cannot " + t);
|
|
8
|
+
var e = (p, i, t) => (Xe(p, i, "read from private field"), t ? t.call(p) : i.get(p)), c = (p, i, t) => i.has(p) ? Ve("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(p) : i.set(p, t), g = (p, i, t, s) => (Xe(p, i, "write to private field"), s ? s.call(p, t) : i.set(p, t), t);
|
|
9
|
+
var Ye = (p, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
11
|
g(p, i, n, t);
|
|
12
12
|
},
|
|
@@ -14,17 +14,17 @@ var Ue = (p, i, t, s) => ({
|
|
|
14
14
|
return e(p, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
import { trace as
|
|
18
|
-
const
|
|
17
|
+
import { trace as Fe } from "@ninebone/util";
|
|
18
|
+
const He = class He extends Fe.constructor {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
a(
|
|
24
|
-
let Ee =
|
|
25
|
-
const
|
|
23
|
+
a(He, "Trace");
|
|
24
|
+
let Ee = He;
|
|
25
|
+
const Z = new Ee();
|
|
26
26
|
var k, $, b, W, O, z, se, D, ne;
|
|
27
|
-
const
|
|
27
|
+
const Me = class Me extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
c(this, k);
|
|
@@ -44,22 +44,22 @@ const $e = class $e extends HTMLElement {
|
|
|
44
44
|
if (!e(this, k) || !e(this, b) || e(this, $)) return;
|
|
45
45
|
const t = e(this, b).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = e(this, b).track, r = e(this, b).thumb, o = e(this, k).querySelector(".ng-container-bottom"), l = t.clientWidth,
|
|
48
|
-
if (l !== 0 &&
|
|
47
|
+
const n = e(this, b).track, r = e(this, b).thumb, o = e(this, k).querySelector(".ng-container-bottom"), l = t.clientWidth, h = s.scrollWidth;
|
|
48
|
+
if (l !== 0 && h > l)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
o && (o.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
r.style.width = `${
|
|
58
|
-
const
|
|
54
|
+
const d = n.clientWidth;
|
|
55
|
+
if (d <= 0) return;
|
|
56
|
+
const u = Math.max(Math.min(d * (l / h), d), 20);
|
|
57
|
+
r.style.width = `${u}px`;
|
|
58
|
+
const f = t.scrollLeft, y = h - l;
|
|
59
59
|
let w = 0;
|
|
60
|
-
y > 0 && (w = parseInt(
|
|
61
|
-
const v =
|
|
62
|
-
w > v && (w = v), r.style.left = `${w}px`,
|
|
60
|
+
y > 0 && (w = parseInt(f / y * (d - u), 10)), w < 0 && (w = 0);
|
|
61
|
+
const v = d - u;
|
|
62
|
+
w > v && (w = v), r.style.left = `${w}px`, Z.log(w), e(this, b).left.disabled = w === 0, e(this, b).right.disabled = w >= v - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
c(this, D, /* @__PURE__ */ a((t) => {
|
|
65
65
|
if (!e(this, b)) return !1;
|
|
@@ -68,11 +68,10 @@ const $e = class $e extends HTMLElement {
|
|
|
68
68
|
const r = e(this, b).track.getBoundingClientRect(), o = e(this, b).thumb.clientWidth;
|
|
69
69
|
let l = t;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
|
-
const
|
|
72
|
-
l >
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
return -u > f - h && (u = -(f - h)), -u + 5 > f - h && (u = -(f - h)), h >= f && (u = 0), n.style.transform = `translateX(${u}px)`, l > 0 && l < d - 1;
|
|
71
|
+
const h = r.width - o;
|
|
72
|
+
l > h && (l = h), l = parseInt(l, 10), e(this, b).thumb.style.left = `${l}px`, e(this, b).left.disabled = l === 0, e(this, b).right.disabled = l >= h - 1;
|
|
73
|
+
const d = s.clientWidth, f = n.scrollWidth - d;
|
|
74
|
+
return h > 0 && f > 0 && (s.scrollLeft = l / h * f), l > 0 && l < h - 1;
|
|
76
75
|
}, "#thumbMoveTo"));
|
|
77
76
|
c(this, ne, /* @__PURE__ */ a(() => {
|
|
78
77
|
const t = /* @__PURE__ */ a((n) => {
|
|
@@ -103,8 +102,8 @@ const $e = class $e extends HTMLElement {
|
|
|
103
102
|
n.stopPropagation(), n.preventDefault(), g(this, $, !0), this.shiftX = n.clientX - e(this, b).thumb.getBoundingClientRect().left;
|
|
104
103
|
const r = /* @__PURE__ */ a((l) => {
|
|
105
104
|
if (!e(this, $)) return;
|
|
106
|
-
const
|
|
107
|
-
e(this, D).call(this, l.clientX -
|
|
105
|
+
const h = e(this, b).track.getBoundingClientRect();
|
|
106
|
+
e(this, D).call(this, l.clientX - h.left - this.shiftX);
|
|
108
107
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
109
108
|
g(this, $, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
110
109
|
}, "onMouseUp");
|
|
@@ -197,8 +196,8 @@ const $e = class $e extends HTMLElement {
|
|
|
197
196
|
e(this, z) && e(this, z).disconnect();
|
|
198
197
|
}
|
|
199
198
|
};
|
|
200
|
-
k = new WeakMap(), $ = new WeakMap(), b = new WeakMap(), W = new WeakMap(), O = new WeakMap(), z = new WeakMap(), se = new WeakMap(), D = new WeakMap(), ne = new WeakMap(), a(
|
|
201
|
-
let Re =
|
|
199
|
+
k = new WeakMap(), $ = new WeakMap(), b = new WeakMap(), W = new WeakMap(), O = new WeakMap(), z = new WeakMap(), se = new WeakMap(), D = new WeakMap(), ne = new WeakMap(), a(Me, "NineTableHScrollBar");
|
|
200
|
+
let Re = Me;
|
|
202
201
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Re);
|
|
203
202
|
var re, j;
|
|
204
203
|
const L = class L {
|
|
@@ -215,10 +214,10 @@ const L = class L {
|
|
|
215
214
|
var n, r, o;
|
|
216
215
|
if (!i) return null;
|
|
217
216
|
const t = i.cloneNode(!0);
|
|
218
|
-
return e(n = L, re).call(n, t), e(r = L, j).call(r, t, "thead"), e(o = L, j).call(o, t, "tbody"), Array.from(t.querySelectorAll("colgroup col")).forEach((l,
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
return e(n = L, re).call(n, t), e(r = L, j).call(r, t, "thead"), e(o = L, j).call(o, t, "tbody"), Array.from(t.querySelectorAll("colgroup col")).forEach((l, h) => {
|
|
218
|
+
const d = l.getAttribute("fixed");
|
|
219
|
+
d && t.querySelectorAll(`[data-col="${h}"]`).forEach((u) => {
|
|
220
|
+
u.setAttribute("fixed", d);
|
|
222
221
|
});
|
|
223
222
|
}), t;
|
|
224
223
|
}
|
|
@@ -241,46 +240,46 @@ re = new WeakMap(), j = new WeakMap(), a(L, "TableCompiler"), c(L, re, /* @__PUR
|
|
|
241
240
|
const s = Array.from(i.querySelectorAll(t + " tr")), n = Array.from(i.querySelectorAll(t + " th," + t + " td")), r = s.length;
|
|
242
241
|
if (r === 0 || n.length === 0) return;
|
|
243
242
|
let o = 0;
|
|
244
|
-
n.forEach((
|
|
245
|
-
o +=
|
|
243
|
+
n.forEach((h) => {
|
|
244
|
+
o += h.colSpan || 1;
|
|
246
245
|
});
|
|
247
246
|
const l = Array.from(Array(r), () => Array(o).fill(null));
|
|
248
|
-
s.forEach((
|
|
249
|
-
const
|
|
250
|
-
let
|
|
251
|
-
Array.from(
|
|
252
|
-
for (let v = 0; v < l[
|
|
253
|
-
if (l[
|
|
254
|
-
|
|
247
|
+
s.forEach((h) => {
|
|
248
|
+
const d = h.sectionRowIndex;
|
|
249
|
+
let u = 0;
|
|
250
|
+
Array.from(h.querySelectorAll("th,td")).forEach((f) => {
|
|
251
|
+
for (let v = 0; v < l[d].length; v++)
|
|
252
|
+
if (l[d][v] === null) {
|
|
253
|
+
u = v;
|
|
255
254
|
break;
|
|
256
255
|
}
|
|
257
|
-
const y =
|
|
256
|
+
const y = f.rowSpan || 1, w = f.colSpan || 1;
|
|
258
257
|
for (let v = 0; v < y; v++)
|
|
259
258
|
for (let C = 0; C < w; C++)
|
|
260
|
-
|
|
259
|
+
d + v < r && u + C < o && (l[d + v][u + C] = v === 0 && C === 0 ? "1" : "0");
|
|
261
260
|
});
|
|
262
|
-
}), s.forEach((
|
|
263
|
-
const
|
|
264
|
-
Array.from(
|
|
265
|
-
for (let
|
|
266
|
-
if (l[
|
|
267
|
-
|
|
261
|
+
}), s.forEach((h) => {
|
|
262
|
+
const d = h.sectionRowIndex;
|
|
263
|
+
Array.from(h.querySelectorAll("th,td")).forEach((u) => {
|
|
264
|
+
for (let f = 0; f < l[d].length; f++)
|
|
265
|
+
if (l[d][f] === "1") {
|
|
266
|
+
u.dataset.col = f, l[d][f] = "0";
|
|
268
267
|
break;
|
|
269
268
|
}
|
|
270
269
|
});
|
|
271
270
|
});
|
|
272
271
|
}, "#resetColIndex"));
|
|
273
272
|
let Ae = L;
|
|
274
|
-
var E, _, R, I,
|
|
275
|
-
const
|
|
273
|
+
var E, _, R, I, B, N, oe, le, G, ae, ce, J;
|
|
274
|
+
const $e = class $e {
|
|
276
275
|
constructor(i) {
|
|
277
276
|
c(this, E);
|
|
278
277
|
c(this, _, /* @__PURE__ */ new Map());
|
|
279
278
|
// κ° μ»¨ν
μ΄λλ³ λ
립λ ν
νλ¦Ώ TR κ΄λ¦¬
|
|
280
279
|
c(this, R, null);
|
|
281
280
|
c(this, I, null);
|
|
282
|
-
c(this,
|
|
283
|
-
c(this,
|
|
281
|
+
c(this, B, 0);
|
|
282
|
+
c(this, N, 40);
|
|
284
283
|
/**
|
|
285
284
|
* π― NineTableSheetμμ λ§μ€ν° ν
μ΄λΈμ μ λ¬λ°μ κ° μμλ³ ν
μ΄λΈ μμ± λ° ν
νλ¦Ώ μΆμΆ μΌμν
|
|
286
285
|
*/
|
|
@@ -293,7 +292,7 @@ const We = class We {
|
|
|
293
292
|
if (!n) return;
|
|
294
293
|
const r = n.querySelector("tbody");
|
|
295
294
|
if (!r) return;
|
|
296
|
-
const l = Array.from(r.querySelectorAll("tr")).map((
|
|
295
|
+
const l = Array.from(r.querySelectorAll("tr")).map((h) => h.cloneNode(!0));
|
|
297
296
|
e(this, _).set(t, l);
|
|
298
297
|
});
|
|
299
298
|
const i = e(this, E).querySelector(".ng-container-body");
|
|
@@ -306,23 +305,12 @@ const We = class We {
|
|
|
306
305
|
if (!n) return;
|
|
307
306
|
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
308
307
|
const r = n.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
309
|
-
for (let l = 0; l < e(this,
|
|
310
|
-
s.forEach((
|
|
311
|
-
o.appendChild(
|
|
308
|
+
for (let l = 0; l < e(this, N); l++)
|
|
309
|
+
s.forEach((h) => {
|
|
310
|
+
o.appendChild(h.cloneNode(!0));
|
|
312
311
|
});
|
|
313
312
|
r ? r.before(o) : n.appendChild(o);
|
|
314
313
|
}, "#renderRows"));
|
|
315
|
-
/**
|
|
316
|
-
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°κ±°λ μ κ±°νλ λΆν ν¬νΌ
|
|
317
|
-
*/
|
|
318
|
-
c(this, He, /* @__PURE__ */ a((i, t) => {
|
|
319
|
-
const s = i.cloneNode(!0);
|
|
320
|
-
return t === "left" ? s.querySelectorAll("col, th, td").forEach((n) => {
|
|
321
|
-
n.getAttribute("fixed") !== "left" && n.remove();
|
|
322
|
-
}) : t === "right" ? s.querySelectorAll("col, th, td").forEach((n) => {
|
|
323
|
-
n.getAttribute("fixed") !== "right" && n.remove();
|
|
324
|
-
}) : s.querySelectorAll("[fixed='left'], [fixed='right']").forEach((n) => n.remove()), s;
|
|
325
|
-
}, "#createSplitTable"));
|
|
326
314
|
/**
|
|
327
315
|
* π― ν
νλ¦Ώ TRλ€μ μ΄ λμ΄λ₯Ό μΈ‘μ νκ³ μΊμ±
|
|
328
316
|
*/
|
|
@@ -338,33 +326,33 @@ const We = class We {
|
|
|
338
326
|
t.forEach((y) => {
|
|
339
327
|
r.appendChild(y.cloneNode(!0));
|
|
340
328
|
}), n ? n.before(r) : s.appendChild(r);
|
|
341
|
-
const o = e(this, E), l = o.style.display,
|
|
329
|
+
const o = e(this, E), l = o.style.display, h = o.style.visibility, d = o.style.position;
|
|
342
330
|
(l === "none" || window.getComputedStyle(o).display === "none") && (o.style.display = "block", o.style.visibility = "hidden", o.style.position = "absolute");
|
|
343
|
-
let
|
|
344
|
-
const
|
|
345
|
-
return
|
|
346
|
-
|
|
347
|
-
}),
|
|
331
|
+
let u = 0;
|
|
332
|
+
const f = s.querySelectorAll("tr:not(.nodata)");
|
|
333
|
+
return f.forEach((y) => {
|
|
334
|
+
u += y.offsetHeight || y.getBoundingClientRect().height;
|
|
335
|
+
}), f.forEach((y) => y.remove()), o.style.display = l, o.style.visibility = h, o.style.position = d, g(this, R, u > 0 ? u : 24), e(this, G).call(this), Z.log(`[RowManager] Height Cached: ${e(this, R)}px | RowCount: ${e(this, N)}`), e(this, R);
|
|
348
336
|
}, "#measureAndCacheHeight"));
|
|
349
337
|
c(this, G, /* @__PURE__ */ a(() => {
|
|
350
|
-
if (e(this,
|
|
351
|
-
const i = Math.ceil(e(this,
|
|
352
|
-
g(this,
|
|
338
|
+
if (e(this, B) > 0 && e(this, R) > 0) {
|
|
339
|
+
const i = Math.ceil(e(this, B) / e(this, R));
|
|
340
|
+
g(this, N, i + 20);
|
|
353
341
|
} else
|
|
354
|
-
g(this,
|
|
342
|
+
g(this, N, 40);
|
|
355
343
|
}, "#updateRowCount"));
|
|
356
344
|
c(this, ae, /* @__PURE__ */ a(() => {
|
|
357
|
-
var
|
|
345
|
+
var h, d, u;
|
|
358
346
|
const i = e(this, E).querySelector(".ng-container-left table"), t = e(this, E).querySelector(".ng-container-body table"), s = e(this, E).querySelector(".ng-container-right table");
|
|
359
347
|
if (!t) return;
|
|
360
348
|
const n = i ? Array.from(i.querySelectorAll("tr")) : [], r = Array.from(t.querySelectorAll("tr")), o = s ? Array.from(s.querySelectorAll("tr")) : [], l = Math.max(n.length, r.length, o.length);
|
|
361
|
-
for (let
|
|
349
|
+
for (let f = 0; f < l; f++) {
|
|
362
350
|
const y = [
|
|
363
|
-
((
|
|
364
|
-
((
|
|
365
|
-
((
|
|
351
|
+
((h = n[f]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
352
|
+
((d = r[f]) == null ? void 0 : d.getBoundingClientRect().height) || 0,
|
|
353
|
+
((u = o[f]) == null ? void 0 : u.getBoundingClientRect().height) || 0
|
|
366
354
|
], w = Math.max(...y);
|
|
367
|
-
w > 0 && (n[
|
|
355
|
+
w > 0 && (n[f] && (n[f].style.height = `${w}px`), r[f] && (r[f].style.height = `${w}px`), o[f] && (o[f].style.height = `${w}px`));
|
|
368
356
|
}
|
|
369
357
|
}, "#syncRowHeights"));
|
|
370
358
|
/**
|
|
@@ -381,7 +369,7 @@ const We = class We {
|
|
|
381
369
|
const o = s.querySelector("thead");
|
|
382
370
|
o && (r += o.offsetHeight || o.getBoundingClientRect().height);
|
|
383
371
|
const l = Math.max(n - r, 100);
|
|
384
|
-
e(this,
|
|
372
|
+
e(this, B) !== l && (g(this, B, l), e(this, G).call(this), e(this, R) !== null && e(this, J).call(this));
|
|
385
373
|
}
|
|
386
374
|
}
|
|
387
375
|
})), e(this, I).observe(e(this, E)));
|
|
@@ -408,10 +396,10 @@ const We = class We {
|
|
|
408
396
|
return ((t = e(this, _).get(i)) == null ? void 0 : t.length) || 1;
|
|
409
397
|
}
|
|
410
398
|
};
|
|
411
|
-
E = new WeakMap(), _ = new WeakMap(), R = new WeakMap(), I = new WeakMap(),
|
|
412
|
-
let qe =
|
|
399
|
+
E = new WeakMap(), _ = new WeakMap(), R = new WeakMap(), I = new WeakMap(), B = new WeakMap(), N = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), G = new WeakMap(), ae = new WeakMap(), ce = new WeakMap(), J = new WeakMap(), a($e, "RowManager");
|
|
400
|
+
let qe = $e;
|
|
413
401
|
var X, Y, he, de, fe, ue, ge;
|
|
414
|
-
const
|
|
402
|
+
const K = class K extends HTMLElement {
|
|
415
403
|
constructor() {
|
|
416
404
|
super();
|
|
417
405
|
c(this, X, null);
|
|
@@ -477,7 +465,7 @@ const Z = class Z extends HTMLElement {
|
|
|
477
465
|
e(this, ge).call(this);
|
|
478
466
|
}, "#init"));
|
|
479
467
|
c(this, ge, /* @__PURE__ */ a(() => {
|
|
480
|
-
const t =
|
|
468
|
+
const t = K.SCROLLBAR_SIZE;
|
|
481
469
|
this.innerHTML = `
|
|
482
470
|
<style>
|
|
483
471
|
nine-table-sheet {
|
|
@@ -606,14 +594,14 @@ const Z = class Z extends HTMLElement {
|
|
|
606
594
|
e(this, ue).call(this);
|
|
607
595
|
}
|
|
608
596
|
disconnectedCallback() {
|
|
609
|
-
this.innerHTML = "",
|
|
597
|
+
this.innerHTML = "", Z.log("NineTableSheet destroyed.");
|
|
610
598
|
}
|
|
611
599
|
};
|
|
612
|
-
X = new WeakMap(), Y = new WeakMap(), he = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), ue = new WeakMap(), ge = new WeakMap(), a(
|
|
613
|
-
let ie =
|
|
600
|
+
X = new WeakMap(), Y = new WeakMap(), he = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), ue = new WeakMap(), ge = new WeakMap(), a(K, "NineTableSheet"), x(K, "SCROLLBAR_SIZE", 16);
|
|
601
|
+
let ie = K;
|
|
614
602
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ie);
|
|
615
603
|
var be, Q;
|
|
616
|
-
const
|
|
604
|
+
const We = class We extends HTMLElement {
|
|
617
605
|
constructor() {
|
|
618
606
|
super();
|
|
619
607
|
c(this, be, /* @__PURE__ */ a(() => {
|
|
@@ -626,33 +614,33 @@ const Oe = class Oe extends HTMLElement {
|
|
|
626
614
|
}, "#init"));
|
|
627
615
|
c(this, Q, /* @__PURE__ */ a((t, s = !1) => {
|
|
628
616
|
const n = /* @__PURE__ */ a(() => {
|
|
629
|
-
const
|
|
617
|
+
const u = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
630
618
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((w) => w.style.setProperty("display", "none"));
|
|
631
|
-
const y =
|
|
619
|
+
const y = u.filter((w) => w.classList.contains("active"));
|
|
632
620
|
y.length < 2 || y.forEach((w) => {
|
|
633
|
-
const v = parseInt(w.getAttribute("data-index"), 10), C = this.querySelector(`nine-splitter[data-split-index="${v}"]`),
|
|
634
|
-
C &&
|
|
621
|
+
const v = parseInt(w.getAttribute("data-index"), 10), C = this.querySelector(`nine-splitter[data-split-index="${v}"]`), Ne = u[v + 1];
|
|
622
|
+
C && Ne && Ne.classList.contains("active") && C.style.setProperty("display", "flex");
|
|
635
623
|
});
|
|
636
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"),
|
|
624
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), h = o.querySelectorAll("nine-table-sheet");
|
|
637
625
|
if (!l[t]) return;
|
|
638
626
|
if (!s)
|
|
639
|
-
l.forEach((
|
|
640
|
-
|
|
641
|
-
}),
|
|
642
|
-
const y =
|
|
643
|
-
|
|
627
|
+
l.forEach((u, f) => {
|
|
628
|
+
u.classList.toggle("active", f === t);
|
|
629
|
+
}), h.forEach((u, f) => {
|
|
630
|
+
const y = f === t;
|
|
631
|
+
u.classList.toggle("active", y), u.style.flex = y ? "1 1 100%" : "";
|
|
644
632
|
});
|
|
645
633
|
else {
|
|
646
|
-
const
|
|
647
|
-
if (
|
|
634
|
+
const u = l[t], f = r.querySelectorAll(".nine-tab-item.active");
|
|
635
|
+
if (u.classList.contains("active") && f.length <= 1)
|
|
648
636
|
return;
|
|
649
|
-
|
|
637
|
+
u.classList.toggle("active");
|
|
650
638
|
const y = o.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
651
639
|
y && (y.classList.toggle("active"), y.classList.contains("active") || (y.style.flex = ""));
|
|
652
640
|
}
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
|
|
641
|
+
const d = o.querySelectorAll("nine-table-sheet.active");
|
|
642
|
+
d == null || d.forEach((u) => {
|
|
643
|
+
u.style.flex = d.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
656
644
|
}), n();
|
|
657
645
|
}, "#switchSheet"));
|
|
658
646
|
}
|
|
@@ -660,11 +648,11 @@ const Oe = class Oe extends HTMLElement {
|
|
|
660
648
|
e(this, be).call(this);
|
|
661
649
|
}
|
|
662
650
|
};
|
|
663
|
-
be = new WeakMap(), Q = new WeakMap(), a(
|
|
664
|
-
let Te =
|
|
651
|
+
be = new WeakMap(), Q = new WeakMap(), a(We, "NineTableSheets");
|
|
652
|
+
let Te = We;
|
|
665
653
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Te);
|
|
666
654
|
var S, ye, ee, pe;
|
|
667
|
-
const
|
|
655
|
+
const Oe = class Oe {
|
|
668
656
|
constructor(i) {
|
|
669
657
|
c(this, S);
|
|
670
658
|
c(this, ye, /* @__PURE__ */ a(() => {
|
|
@@ -674,17 +662,17 @@ const ze = class ze {
|
|
|
674
662
|
}).observe(e(this, S));
|
|
675
663
|
}, "#init"));
|
|
676
664
|
c(this, ee, /* @__PURE__ */ a(() => {
|
|
677
|
-
var
|
|
665
|
+
var h, d;
|
|
678
666
|
const i = Array.from(e(this, S).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
679
667
|
if (i.length === 0) return;
|
|
680
|
-
const t = parseInt(e(this, S).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((
|
|
668
|
+
const t = parseInt(e(this, S).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((u) => u.getRowHeight())), n = (h = e(this, S).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : h.getBoundingClientRect().height, r = (d = e(this, S).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : d.getBoundingClientRect().height, o = ie.SCROLLBAR_SIZE, l = t * s + n + r + o;
|
|
681
669
|
e(this, S).style.height = `${l}px`;
|
|
682
670
|
}, "#applyAutoHeight"));
|
|
683
671
|
c(this, pe, /* @__PURE__ */ a(() => {
|
|
684
|
-
const t = Array.from(e(this, S).children).filter((
|
|
685
|
-
const
|
|
686
|
-
return
|
|
687
|
-
}).join(""), o = t.map((
|
|
672
|
+
const t = Array.from(e(this, S).children).filter((h) => h.tagName === "TABLE"), s = e(this, S).getAttribute("auto-height") === "true", n = t.length, r = t.map((h, d) => {
|
|
673
|
+
const f = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`, y = d < n - 1 ? `<nine-splitter class="h" data-split-index="${d}"></nine-splitter>` : "";
|
|
674
|
+
return f + y;
|
|
675
|
+
}).join(""), o = t.map((h, d) => `<div class="nine-tab-item ${d === 0 ? "active" : ""}" data-index="${d}">Sheet ${d + 1}</div>`).join("");
|
|
688
676
|
e(this, S).shadowRoot.innerHTML = `
|
|
689
677
|
<style>
|
|
690
678
|
:host {
|
|
@@ -785,19 +773,19 @@ const ze = class ze {
|
|
|
785
773
|
<nine-table-footer></nine-table-footer>
|
|
786
774
|
`;
|
|
787
775
|
const l = e(this, S).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
788
|
-
l == null || l.forEach((
|
|
789
|
-
t[
|
|
790
|
-
|
|
776
|
+
l == null || l.forEach((h, d) => {
|
|
777
|
+
t[d] && setTimeout(() => {
|
|
778
|
+
h.generate(t[d]), s && e(this, ee).call(this);
|
|
791
779
|
});
|
|
792
780
|
});
|
|
793
781
|
}, "#render"));
|
|
794
782
|
g(this, S, i), e(this, ye).call(this);
|
|
795
783
|
}
|
|
796
784
|
};
|
|
797
|
-
S = new WeakMap(), ye = new WeakMap(), ee = new WeakMap(), pe = new WeakMap(), a(
|
|
798
|
-
let ke =
|
|
785
|
+
S = new WeakMap(), ye = new WeakMap(), ee = new WeakMap(), pe = new WeakMap(), a(Oe, "LayoutManager");
|
|
786
|
+
let ke = Oe;
|
|
799
787
|
var H, P;
|
|
800
|
-
const
|
|
788
|
+
const ze = class ze {
|
|
801
789
|
constructor(i) {
|
|
802
790
|
c(this, H);
|
|
803
791
|
c(this, P, -1);
|
|
@@ -817,9 +805,9 @@ const De = class De {
|
|
|
817
805
|
});
|
|
818
806
|
}
|
|
819
807
|
};
|
|
820
|
-
H = new WeakMap(), P = new WeakMap(), a(
|
|
821
|
-
let Le =
|
|
822
|
-
var A, m, q, U, me, M, we, te, xe, ve,
|
|
808
|
+
H = new WeakMap(), P = new WeakMap(), a(ze, "ngRow");
|
|
809
|
+
let Le = ze;
|
|
810
|
+
var A, m, q, U, me, M, we, te, xe, ve, F;
|
|
823
811
|
const T = class T {
|
|
824
812
|
constructor(i, t) {
|
|
825
813
|
c(this, A);
|
|
@@ -878,8 +866,8 @@ const T = class T {
|
|
|
878
866
|
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, ve).call(this, s)), this.resetRecords();
|
|
879
867
|
const n = this.count() - 1;
|
|
880
868
|
return t || s.forEach((o, l) => {
|
|
881
|
-
const
|
|
882
|
-
|
|
869
|
+
const h = e(this, m).rawRecords[n - l];
|
|
870
|
+
h && (h.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
883
871
|
}), (r = e(this, m).viewRecords) != null && r.reset && e(this, m).viewRecords.reset(), n;
|
|
884
872
|
}, "add"));
|
|
885
873
|
x(this, "delete", /* @__PURE__ */ a((i) => {
|
|
@@ -895,9 +883,9 @@ const T = class T {
|
|
|
895
883
|
}), this.resetRecords(), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
896
884
|
}, "delete"));
|
|
897
885
|
x(this, "setValue", /* @__PURE__ */ a((i, t, s) => {
|
|
898
|
-
var
|
|
886
|
+
var h;
|
|
899
887
|
i = parseInt(i, 10);
|
|
900
|
-
const r = (typeof ((
|
|
888
|
+
const r = (typeof ((h = e(this, A).fields) == null ? void 0 : h.get) == "function" ? e(this, A).fields.get() : []).indexOf(t);
|
|
901
889
|
if (r < 0) return;
|
|
902
890
|
const o = this.getValidData()[i];
|
|
903
891
|
if (!o) return;
|
|
@@ -912,7 +900,7 @@ const T = class T {
|
|
|
912
900
|
});
|
|
913
901
|
}, "resetRecords"));
|
|
914
902
|
x(this, "getValidData", /* @__PURE__ */ a(() => (e(this, q).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, q)), "getValidData"));
|
|
915
|
-
c(this,
|
|
903
|
+
c(this, F, /* @__PURE__ */ a((i) => {
|
|
916
904
|
var s;
|
|
917
905
|
if (!i) return i;
|
|
918
906
|
const t = typeof ((s = e(this, A).fields) == null ? void 0 : s.get) == "function" ? e(this, A).fields.get() : [];
|
|
@@ -928,25 +916,25 @@ const T = class T {
|
|
|
928
916
|
var r;
|
|
929
917
|
const s = this.getValidData();
|
|
930
918
|
if (!s || s.length <= 0) return;
|
|
931
|
-
if (i == null) return e(this,
|
|
919
|
+
if (i == null) return e(this, F).call(this, s);
|
|
932
920
|
if (i < 0 || i >= s.length) return null;
|
|
933
921
|
const n = typeof ((r = e(this, A).fields) == null ? void 0 : r.get) == "function" ? e(this, A).fields.get() : [];
|
|
934
922
|
if (t != null) {
|
|
935
923
|
const o = n.indexOf(t);
|
|
936
924
|
return o >= 0 ? s[i].v[o] : null;
|
|
937
925
|
}
|
|
938
|
-
return e(this,
|
|
926
|
+
return e(this, F).call(this, s[i]);
|
|
939
927
|
}, "get"));
|
|
940
928
|
g(this, A, i), g(this, m, t), e(this, we).call(this);
|
|
941
929
|
}
|
|
942
930
|
get source() {
|
|
943
|
-
return e(this,
|
|
931
|
+
return e(this, F).call(this, e(this, m).rawRecords);
|
|
944
932
|
}
|
|
945
933
|
set source(i) {
|
|
946
934
|
this.clear(), this.add(i, !1);
|
|
947
935
|
}
|
|
948
936
|
get nextId() {
|
|
949
|
-
return ++
|
|
937
|
+
return ++Ye(this, me)._;
|
|
950
938
|
}
|
|
951
939
|
get length() {
|
|
952
940
|
return e(this, q).length;
|
|
@@ -955,7 +943,7 @@ const T = class T {
|
|
|
955
943
|
return this.length;
|
|
956
944
|
}
|
|
957
945
|
};
|
|
958
|
-
A = new WeakMap(), m = new WeakMap(), q = new WeakMap(), U = new WeakMap(), me = new WeakMap(), M = new WeakMap(), we = new WeakMap(), te = new WeakMap(), xe = new WeakMap(), ve = new WeakMap(),
|
|
946
|
+
A = new WeakMap(), m = new WeakMap(), q = new WeakMap(), U = new WeakMap(), me = new WeakMap(), M = new WeakMap(), we = new WeakMap(), te = new WeakMap(), xe = new WeakMap(), ve = new WeakMap(), F = new WeakMap(), a(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
959
947
|
x(T, "ROW_STATE", {
|
|
960
948
|
EMPTY: "EMPTY",
|
|
961
949
|
NORMAL: "NORMAL",
|
|
@@ -964,7 +952,7 @@ x(T, "ROW_STATE", {
|
|
|
964
952
|
DELETE: "DELETE"
|
|
965
953
|
});
|
|
966
954
|
let Ce = T;
|
|
967
|
-
const
|
|
955
|
+
const De = class De {
|
|
968
956
|
constructor(i) {
|
|
969
957
|
this.owner = i, this.row = new Le(this), this.data = new Ce(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
970
958
|
var t;
|
|
@@ -983,8 +971,8 @@ const Ne = class Ne {
|
|
|
983
971
|
}, this.setDataSource([]);
|
|
984
972
|
}
|
|
985
973
|
};
|
|
986
|
-
a(
|
|
987
|
-
let _e =
|
|
974
|
+
a(De, "ngDataManager");
|
|
975
|
+
let _e = De;
|
|
988
976
|
var V, Se;
|
|
989
977
|
const Be = class Be extends HTMLElement {
|
|
990
978
|
constructor() {
|
|
@@ -995,10 +983,10 @@ const Be = class Be extends HTMLElement {
|
|
|
995
983
|
this.attachShadow({ mode: "open" }), g(this, V, new _e(this));
|
|
996
984
|
}
|
|
997
985
|
connectedCallback() {
|
|
998
|
-
g(this, Se, new ke(this)),
|
|
986
|
+
g(this, Se, new ke(this)), Z.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
999
987
|
}
|
|
1000
988
|
disconnectedCallback() {
|
|
1001
|
-
|
|
989
|
+
Z.log("NineTable disconnected.");
|
|
1002
990
|
}
|
|
1003
991
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1004
992
|
get data() {
|