@ninebone/table 0.0.528 β 0.0.529
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 +43 -41
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +1 -1
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -22,7 +22,7 @@ const Le = class Le extends Xe.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
h(Le, "Trace");
|
|
24
24
|
let oe = Le;
|
|
25
|
-
const
|
|
25
|
+
const C = new oe();
|
|
26
26
|
var z, j, w, X, K, Z, It, G, _t;
|
|
27
27
|
const He = class He extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -213,7 +213,7 @@ const Me = class Me extends HTMLElement {
|
|
|
213
213
|
d(this, vt, 0);
|
|
214
214
|
S(this, "refresh", /* @__PURE__ */ h(() => {
|
|
215
215
|
if (!t(this, F) || !t(this, q)) return;
|
|
216
|
-
|
|
216
|
+
C.log("nine-table-vscrollbar.refresh");
|
|
217
217
|
const e = t(this, q).container, s = t(this, q).track, r = t(this, q).thumb, n = e.clientHeight, o = (t(this, F).data.get() || []).length, c = t(this, ot).getRowHeight(), l = o * c;
|
|
218
218
|
if (l <= n) {
|
|
219
219
|
r.style.display = "none", t(this, q).top.disabled = !0, t(this, q).bottom.disabled = !0;
|
|
@@ -231,7 +231,7 @@ const Me = class Me extends HTMLElement {
|
|
|
231
231
|
x < 0 && (x = 0), x > v && (x = v), r.style.top = `${x}px`, t(this, q).top.disabled = g <= 0, t(this, q).bottom.disabled = g >= b - 1;
|
|
232
232
|
}, "refresh"));
|
|
233
233
|
d(this, Nt, /* @__PURE__ */ h(() => {
|
|
234
|
-
|
|
234
|
+
C.log("nine-table-vscrollbar.#init");
|
|
235
235
|
const e = t(this, q).container, s = /* @__PURE__ */ h(() => {
|
|
236
236
|
const n = (t(this, F).data.get() || []).length, a = t(this, ot).getRowHeight();
|
|
237
237
|
return n * a;
|
|
@@ -369,12 +369,12 @@ const $e = class $e {
|
|
|
369
369
|
d(this, at, !1);
|
|
370
370
|
d(this, Wt, 3);
|
|
371
371
|
S(this, "refresh", /* @__PURE__ */ h(() => {
|
|
372
|
-
|
|
372
|
+
C.log("rowManager.refresh");
|
|
373
373
|
const i = t(this, E).querySelector(".ng-container-body .ng-part-body");
|
|
374
374
|
i && (t(this, St).call(this), t(this, lt).call(this, i.scrollTop));
|
|
375
375
|
}, "refresh"));
|
|
376
376
|
S(this, "initialize", /* @__PURE__ */ h(() => {
|
|
377
|
-
|
|
377
|
+
C.log("rowManager.initialize"), y(this, M, null), t(this, D).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((a) => {
|
|
378
378
|
const o = t(this, E).querySelector(a);
|
|
379
379
|
if (!o) return;
|
|
380
380
|
const c = o.querySelector(".ng-part-body table");
|
|
@@ -402,7 +402,7 @@ const $e = class $e {
|
|
|
402
402
|
}
|
|
403
403
|
}, "initialize"));
|
|
404
404
|
d(this, Ot, /* @__PURE__ */ h((i, e) => {
|
|
405
|
-
|
|
405
|
+
C.log("rowManager.#renderRows");
|
|
406
406
|
const s = t(this, D).get(e);
|
|
407
407
|
if (!s || s.length === 0) return;
|
|
408
408
|
const r = i.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -416,9 +416,9 @@ const $e = class $e {
|
|
|
416
416
|
n ? n.before(a) : r.appendChild(a);
|
|
417
417
|
}, "#renderRows"));
|
|
418
418
|
d(this, Bt, /* @__PURE__ */ h((i) => {
|
|
419
|
-
if (
|
|
419
|
+
if (C.log("rowManager.#measureAndCacheHeight"), t(this, M) !== null && t(this, M) > 0)
|
|
420
420
|
return t(this, M);
|
|
421
|
-
|
|
421
|
+
C.log("#measureAndCacheHeight");
|
|
422
422
|
const e = t(this, D).get(".ng-container-body");
|
|
423
423
|
if (!e || e.length === 0) return 24;
|
|
424
424
|
const s = i.querySelector("tbody.bindable-tbody");
|
|
@@ -437,7 +437,7 @@ const $e = class $e {
|
|
|
437
437
|
}), u.forEach((g) => g.remove()), a.style.display = o, a.style.visibility = c, a.style.position = l, y(this, M, f > 0 ? f : 24), t(this, Et).call(this), t(this, M);
|
|
438
438
|
}, "#measureAndCacheHeight"));
|
|
439
439
|
d(this, St, /* @__PURE__ */ h(() => {
|
|
440
|
-
|
|
440
|
+
C.log("rowManager.#updateVirtualScrollHeight");
|
|
441
441
|
const e = (t(this, P).data.get() || []).length, s = t(this, M), r = e * s;
|
|
442
442
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
443
443
|
const a = t(this, E).querySelector(n);
|
|
@@ -462,8 +462,8 @@ const $e = class $e {
|
|
|
462
462
|
((o = b[m]) == null ? void 0 : o.getBoundingClientRect().height) || 0,
|
|
463
463
|
((c = x[m]) == null ? void 0 : c.getBoundingClientRect().height) || 0,
|
|
464
464
|
((l = v[m]) == null ? void 0 : l.getBoundingClientRect().height) || 0
|
|
465
|
-
],
|
|
466
|
-
|
|
465
|
+
], L = Math.max(...W);
|
|
466
|
+
L > 0 && (b[m] && (b[m].style.height = `${L}px`), x[m] && (x[m].style.height = `${L}px`), v[m] && (v[m].style.height = `${L}px`));
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
const r = t(this, E).querySelector(".ng-container-left .ng-part-footer table"), n = t(this, E).querySelector(".ng-container-body .ng-part-footer table"), a = t(this, E).querySelector(".ng-container-right .ng-part-footer table");
|
|
@@ -474,8 +474,8 @@ const $e = class $e {
|
|
|
474
474
|
((f = b[m]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
475
475
|
((u = x[m]) == null ? void 0 : u.getBoundingClientRect().height) || 0,
|
|
476
476
|
((g = v[m]) == null ? void 0 : g.getBoundingClientRect().height) || 0
|
|
477
|
-
],
|
|
478
|
-
|
|
477
|
+
], L = Math.max(...W);
|
|
478
|
+
L > 0 && (b[m] && (b[m].style.height = `${L}px`), x[m] && (x[m].style.height = `${L}px`), v[m] && (v[m].style.height = `${L}px`));
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
}, "#syncRowHeights"));
|
|
@@ -496,7 +496,7 @@ const $e = class $e {
|
|
|
496
496
|
})), t(this, V).observe(t(this, E)));
|
|
497
497
|
}, "#initResizeObserver"));
|
|
498
498
|
d(this, At, /* @__PURE__ */ h(() => {
|
|
499
|
-
|
|
499
|
+
C.log("rowManager.#renderAllContainers"), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
500
500
|
const e = t(this, E).querySelector(i);
|
|
501
501
|
e && e.querySelector(".ng-part-body tbody.bindable-tbody") && t(this, Ot).call(this, e, i);
|
|
502
502
|
}), t(this, Pt).call(this), t(this, zt).call(this);
|
|
@@ -524,10 +524,12 @@ const $e = class $e {
|
|
|
524
524
|
var f;
|
|
525
525
|
const e = t(this, M);
|
|
526
526
|
if (!e || e <= 0) return;
|
|
527
|
-
const s = t(this, P).data.length
|
|
527
|
+
const s = t(this, P).data.length;
|
|
528
|
+
C.log(s);
|
|
529
|
+
const r = Math.max(0, Math.floor(i / e)), n = r * e, a = ((f = t(this, D).get(".ng-container-body")) == null ? void 0 : f.length) || 1, o = t(this, E).querySelector(".ng-container-body"), c = o == null ? void 0 : o.querySelector(".ng-part-body tbody.bindable-tbody tr:not(.nodata)"), l = c && c.dataset.row !== void 0 ? parseInt(c.dataset.row, 10) : -1;
|
|
528
530
|
[".ng-container-body .ng-part-body table", ".ng-container-left .ng-part-body table", ".ng-container-right .ng-part-body table"].forEach((u) => {
|
|
529
531
|
u.style.transform = `translateY(${n}px)`;
|
|
530
|
-
}),
|
|
532
|
+
}), C.log("#handleScroll", l, r), l !== r && [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((u) => {
|
|
531
533
|
const g = t(this, E).querySelector(u);
|
|
532
534
|
if (!g) return;
|
|
533
535
|
const b = g.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -558,7 +560,7 @@ const $e = class $e {
|
|
|
558
560
|
});
|
|
559
561
|
}; */
|
|
560
562
|
d(this, Rt, /* @__PURE__ */ h((i, e, s) => {
|
|
561
|
-
i.dataset.row = s, i.data = e,
|
|
563
|
+
i.dataset.row = s, i.data = e, C.log(e, s), Array.from(i.cells).forEach((r, n) => {
|
|
562
564
|
r.dataset.row = s;
|
|
563
565
|
const a = Array.from(r.children).find((o) => o.tagName.toLowerCase().startsWith("cell-") || typeof o.refresh == "function");
|
|
564
566
|
a && typeof a.refresh == "function" && a.refresh();
|
|
@@ -566,7 +568,7 @@ const $e = class $e {
|
|
|
566
568
|
}, "#bindRowData"));
|
|
567
569
|
d(this, Pt, /* @__PURE__ */ h(() => {
|
|
568
570
|
var c, l, f;
|
|
569
|
-
|
|
571
|
+
C.log("rowManager.#syncHeaderHeights");
|
|
570
572
|
const i = t(this, E).querySelector(".ng-container-left .ng-part-header table"), e = t(this, E).querySelector(".ng-container-body .ng-part-header table"), s = t(this, E).querySelector(".ng-container-right .ng-part-header table");
|
|
571
573
|
if (!e) return;
|
|
572
574
|
const r = i ? Array.from(i.querySelectorAll("tr")) : [], n = Array.from(e.querySelectorAll("tr")), a = s ? Array.from(s.querySelectorAll("tr")) : [], o = Math.max(r.length, n.length, a.length);
|
|
@@ -646,9 +648,9 @@ const jt = class jt {
|
|
|
646
648
|
A = B;
|
|
647
649
|
break;
|
|
648
650
|
}
|
|
649
|
-
const W = m.rowSpan || 1,
|
|
651
|
+
const W = m.rowSpan || 1, L = m.colSpan || 1;
|
|
650
652
|
for (let B = 0; B < W; B++)
|
|
651
|
-
for (let yt = 0; yt <
|
|
653
|
+
for (let yt = 0; yt < L; yt++)
|
|
652
654
|
v + B < u && A + yt < g && (b[v + B][A + yt] = B === 0 && yt === 0 ? "1" : "0");
|
|
653
655
|
});
|
|
654
656
|
}), l.forEach((x) => {
|
|
@@ -898,7 +900,7 @@ const pt = class pt extends HTMLElement {
|
|
|
898
900
|
t(this, Ut).call(this);
|
|
899
901
|
}
|
|
900
902
|
disconnectedCallback() {
|
|
901
|
-
this.innerHTML = "",
|
|
903
|
+
this.innerHTML = "", C.log("NineTableSheet destroyed.");
|
|
902
904
|
}
|
|
903
905
|
};
|
|
904
906
|
Ft = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), ct = new WeakMap(), Ut = new WeakMap(), Xt = new WeakMap(), h(pt, "NineTableSheet"), S(pt, "SCROLLBAR_SIZE", 16);
|
|
@@ -1272,31 +1274,31 @@ const We = class We {
|
|
|
1272
1274
|
};
|
|
1273
1275
|
it = new WeakMap(), h(We, "ngDataManager");
|
|
1274
1276
|
let be = We;
|
|
1275
|
-
var ut,
|
|
1277
|
+
var ut, H, Lt, se;
|
|
1276
1278
|
const Oe = class Oe {
|
|
1277
1279
|
// π― μ΄μ { name: string, type: string } κ°μ²΄λ€μ λ°°μ΄λ‘ κ΄λ¦¬ν©λλ€.
|
|
1278
1280
|
constructor(i) {
|
|
1279
1281
|
d(this, ut);
|
|
1280
|
-
d(this,
|
|
1282
|
+
d(this, H, []);
|
|
1281
1283
|
S(this, "add", /* @__PURE__ */ h((i, e = "string") => {
|
|
1282
1284
|
i.forEach((s) => {
|
|
1283
|
-
t(this,
|
|
1285
|
+
t(this, H).some((r) => r.name === s) || t(this, H).push({ name: s, type: e });
|
|
1284
1286
|
}), t(this, Lt).call(this);
|
|
1285
1287
|
}, "add"));
|
|
1286
1288
|
d(this, Lt, /* @__PURE__ */ h(() => {
|
|
1287
1289
|
const i = /* @__PURE__ */ new Map();
|
|
1288
|
-
t(this,
|
|
1290
|
+
t(this, H).forEach((e) => {
|
|
1289
1291
|
i.set(e.name, e.type);
|
|
1290
|
-
}), y(this,
|
|
1292
|
+
}), y(this, H, Array.from(i, ([e, s]) => ({ name: e, type: s }))), y(this, H, t(this, H).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, H).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1291
1293
|
}, "#adjust"));
|
|
1292
1294
|
d(this, se, /* @__PURE__ */ h(() => {
|
|
1293
|
-
y(this,
|
|
1295
|
+
y(this, H, []), C.log(t(this, ut).querySelectorAll("table"));
|
|
1294
1296
|
const i = Array.from(t(this, ut).querySelectorAll("table"));
|
|
1295
1297
|
if (!(!i || i.length === 0)) {
|
|
1296
1298
|
for (const e of i)
|
|
1297
|
-
|
|
1299
|
+
C.log(e), $("[data-bind]", e).each((s, r) => {
|
|
1298
1300
|
const n = r.dataset.bind, a = r.getAttribute("data-type") || "string";
|
|
1299
|
-
n && t(this,
|
|
1301
|
+
n && t(this, H).push({ name: n, type: a });
|
|
1300
1302
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
1301
1303
|
$(`[${s}]`, e).each((r, n) => {
|
|
1302
1304
|
var a = n.getAttribute(s);
|
|
@@ -1313,7 +1315,7 @@ const Oe = class Oe {
|
|
|
1313
1315
|
if (o.trim() != "") {
|
|
1314
1316
|
const c = o.search(/[^_A-Za-z0-9]/g);
|
|
1315
1317
|
let l = "";
|
|
1316
|
-
c >= 0 ? l = o.substring(0, c) : a.startsWith("data.") && (l = o.replace("data.", "")), l && t(this,
|
|
1318
|
+
c >= 0 ? l = o.substring(0, c) : a.startsWith("data.") && (l = o.replace("data.", "")), l && t(this, H).push({ name: l, type: "string" });
|
|
1317
1319
|
}
|
|
1318
1320
|
});
|
|
1319
1321
|
});
|
|
@@ -1325,25 +1327,25 @@ const Oe = class Oe {
|
|
|
1325
1327
|
}
|
|
1326
1328
|
// π― κΈ°μ‘΄μ νλ μ΄λ¦λ§ μ°λ κ³³λ€κ³Όμ νΈνμ μν΄ μ΄λ¦ λ°°μ΄λ§ 리ν΄νλ λ©μλ μ μ§
|
|
1327
1329
|
get() {
|
|
1328
|
-
return t(this,
|
|
1330
|
+
return t(this, H).map((i) => i.name);
|
|
1329
1331
|
}
|
|
1330
1332
|
// π― λ΄λΆ κ°μ²΄ ν΅μ§Έλ‘ μ»κΈ°
|
|
1331
1333
|
getFields() {
|
|
1332
|
-
return t(this,
|
|
1334
|
+
return t(this, H);
|
|
1333
1335
|
}
|
|
1334
1336
|
// π― νΉμ νλμ λ°μ΄ν° νμ
μ‘°ν
|
|
1335
1337
|
getType(i) {
|
|
1336
|
-
const e = t(this,
|
|
1338
|
+
const e = t(this, H).find((s) => s.name === i);
|
|
1337
1339
|
return e ? e.type : "string";
|
|
1338
1340
|
}
|
|
1339
1341
|
indexOf(i) {
|
|
1340
|
-
return t(this,
|
|
1342
|
+
return t(this, H).findIndex((e) => e.name === i);
|
|
1341
1343
|
}
|
|
1342
1344
|
includes(i) {
|
|
1343
|
-
return t(this,
|
|
1345
|
+
return t(this, H).some((e) => e.name === i);
|
|
1344
1346
|
}
|
|
1345
1347
|
};
|
|
1346
|
-
ut = new WeakMap(),
|
|
1348
|
+
ut = new WeakMap(), H = new WeakMap(), Lt = new WeakMap(), se = new WeakMap(), h(Oe, "ngFields");
|
|
1347
1349
|
let ye = Oe;
|
|
1348
1350
|
var rt, ie, re;
|
|
1349
1351
|
const Be = class Be extends HTMLElement {
|
|
@@ -1353,7 +1355,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1353
1355
|
d(this, rt);
|
|
1354
1356
|
d(this, ie);
|
|
1355
1357
|
d(this, re, /* @__PURE__ */ h(() => {
|
|
1356
|
-
this.fields = new ye(this), y(this, ie, new fe(this)),
|
|
1358
|
+
this.fields = new ye(this), y(this, ie, new fe(this)), C.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1357
1359
|
}, "#init"));
|
|
1358
1360
|
this.attachShadow({ mode: "open" }), y(this, rt, new be(this));
|
|
1359
1361
|
}
|
|
@@ -1361,7 +1363,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1361
1363
|
t(this, re).call(this);
|
|
1362
1364
|
}
|
|
1363
1365
|
disconnectedCallback() {
|
|
1364
|
-
|
|
1366
|
+
C.log("NineTable disconnected.");
|
|
1365
1367
|
}
|
|
1366
1368
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1367
1369
|
get data() {
|
|
@@ -1429,8 +1431,8 @@ const ze = class ze extends me {
|
|
|
1429
1431
|
if (e && (e = parseInt(e)), e && !isNaN(e)) {
|
|
1430
1432
|
var s = t(this, p).closest("tr"), r = [];
|
|
1431
1433
|
$("th,td", s).each((m, W) => {
|
|
1432
|
-
var
|
|
1433
|
-
|
|
1434
|
+
var L = ninegrid.j.querySelectorAll(W).attr("suppress");
|
|
1435
|
+
L && W.dataset.row && (L = parseInt(L), !isNaN(L) && L <= e && r.push(L));
|
|
1434
1436
|
}), r.sort();
|
|
1435
1437
|
var n = !1;
|
|
1436
1438
|
if (parseInt(s.sectionRowIndex / t(this, T).template.length) > 0)
|
|
@@ -1515,7 +1517,7 @@ const Pe = class Pe extends ve {
|
|
|
1515
1517
|
d(this, U);
|
|
1516
1518
|
S(this, "refresh", /* @__PURE__ */ h(() => {
|
|
1517
1519
|
const e = super.refresh();
|
|
1518
|
-
|
|
1520
|
+
C.log("::", e), t(this, Mt).value = e;
|
|
1519
1521
|
}, "refresh"));
|
|
1520
1522
|
/**
|
|
1521
1523
|
dataRefresh = (v) => {
|