@ninebone/table 0.0.420 β 0.0.421
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 +58 -37
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +5 -5
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -22,8 +22,8 @@ const re = class re extends Se.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(re, "Trace");
|
|
24
24
|
let jt = re;
|
|
25
|
-
const
|
|
26
|
-
var _, O, p, P,
|
|
25
|
+
const L = new jt();
|
|
26
|
+
var _, O, p, P, Y, V, St, X, Et;
|
|
27
27
|
const le = class le extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
@@ -31,14 +31,14 @@ const le = class le extends HTMLElement {
|
|
|
31
31
|
c(this, O, !1);
|
|
32
32
|
c(this, p);
|
|
33
33
|
c(this, P);
|
|
34
|
-
c(this, V);
|
|
35
34
|
c(this, Y);
|
|
35
|
+
c(this, V);
|
|
36
36
|
c(this, St, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!t(this, _)) return;
|
|
38
38
|
const e = t(this, _).querySelector(".ng-container-body");
|
|
39
|
-
e && (g(this,
|
|
39
|
+
e && (g(this, V, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), t(this,
|
|
41
|
+
})), t(this, V).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
44
|
if (!t(this, _) || !t(this, p) || t(this, O)) return;
|
|
@@ -59,7 +59,7 @@ const le = class le extends HTMLElement {
|
|
|
59
59
|
let y = 0;
|
|
60
60
|
b > 0 && (y = parseInt(u / b * (h - f), 10)), y < 0 && (y = 0);
|
|
61
61
|
const m = h - f;
|
|
62
|
-
y > m && (y = m), r.style.left = `${y}px`,
|
|
62
|
+
y > m && (y = m), r.style.left = `${y}px`, L.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
c(this, X, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
@@ -75,16 +75,16 @@ const le = class le extends HTMLElement {
|
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
c(this, Et, /* @__PURE__ */ a(() => {
|
|
77
77
|
const e = /* @__PURE__ */ a((n) => {
|
|
78
|
-
clearInterval(t(this, P)), clearInterval(t(this,
|
|
78
|
+
clearInterval(t(this, P)), clearInterval(t(this, Y));
|
|
79
79
|
const r = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
80
80
|
t(this, X).call(this, r + n), g(this, P, setInterval(() => {
|
|
81
|
-
clearInterval(t(this, P)), g(this,
|
|
81
|
+
clearInterval(t(this, P)), g(this, Y, setInterval(() => {
|
|
82
82
|
const o = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
83
|
-
t(this, X).call(this, o + n) || clearInterval(t(this,
|
|
83
|
+
t(this, X).call(this, o + n) || clearInterval(t(this, Y));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
87
|
-
clearInterval(t(this, P)), clearInterval(t(this,
|
|
87
|
+
clearInterval(t(this, P)), clearInterval(t(this, Y));
|
|
88
88
|
}, "clearTimer");
|
|
89
89
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
90
90
|
t(this, p).left.addEventListener(n, s), t(this, p).right.addEventListener(n, s), t(this, p).track.addEventListener(n, s);
|
|
@@ -195,10 +195,10 @@ const le = class le extends HTMLElement {
|
|
|
195
195
|
e();
|
|
196
196
|
}
|
|
197
197
|
disconnectedCallback() {
|
|
198
|
-
t(this,
|
|
198
|
+
t(this, V) && t(this, V).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
_ = new WeakMap(), O = new WeakMap(), p = new WeakMap(), P = new WeakMap(),
|
|
201
|
+
_ = new WeakMap(), O = new WeakMap(), p = new WeakMap(), P = new WeakMap(), Y = new WeakMap(), V = new WeakMap(), St = new WeakMap(), X = new WeakMap(), Et = new WeakMap(), a(le, "NineTableHScrollBar");
|
|
202
202
|
let Kt = le;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Kt);
|
|
204
204
|
var U, Q, z, S, ht, dt, Rt;
|
|
@@ -215,7 +215,7 @@ const ae = class ae extends HTMLElement {
|
|
|
215
215
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
216
216
|
*/
|
|
217
217
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
218
|
-
|
|
218
|
+
L.log("refresh", t(this, z)), L.log("refresh2");
|
|
219
219
|
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, l = (t(this, U).data.get() || []).length, d = t(this, Q).getRowHeight(), h = l * d;
|
|
220
220
|
if (h <= r) {
|
|
221
221
|
n.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
@@ -230,7 +230,7 @@ const ae = class ae extends HTMLElement {
|
|
|
230
230
|
let m = 0;
|
|
231
231
|
y > 0 && (m = b / y * (f - u));
|
|
232
232
|
const R = f - u;
|
|
233
|
-
m < 0 && (m = 0), m > R && (m = R), n.style.top = `${m}px`,
|
|
233
|
+
m < 0 && (m = 0), m > R && (m = R), n.style.top = `${m}px`, L.log("currentScrollTop", b), L.log("maxScrollTop", y), L.log("trackHeight", f), L.log("thumbHeight", u), t(this, S).top.disabled = b <= 0, t(this, S).bottom.disabled = b >= y - 1;
|
|
234
234
|
}, "refresh"));
|
|
235
235
|
c(this, Rt, /* @__PURE__ */ a(() => {
|
|
236
236
|
const e = t(this, S).container, s = /* @__PURE__ */ a(() => {
|
|
@@ -503,18 +503,39 @@ const ce = class ce {
|
|
|
503
503
|
f += b.offsetHeight || b.getBoundingClientRect().height;
|
|
504
504
|
}), u.forEach((b) => b.remove()), o.style.display = l, o.style.visibility = d, o.style.position = h, g(this, T, f > 0 ? f : 24), t(this, ut).call(this), t(this, T);
|
|
505
505
|
}, "#measureAndCacheHeight"));
|
|
506
|
+
/**
|
|
507
|
+
#updateVirtualScrollHeight = () => {
|
|
508
|
+
const bodyContainer = this.#sheet.querySelector('.ng-container-body');
|
|
509
|
+
if (!bodyContainer) return;
|
|
510
|
+
|
|
511
|
+
const dataList = this.#host.data.get() || [];
|
|
512
|
+
const totalCount = dataList.length;
|
|
513
|
+
const rowHeight = this.#cachedTemplateHeight || 24;
|
|
514
|
+
const totalVirtualHeight = totalCount * rowHeight;
|
|
515
|
+
|
|
516
|
+
// π― λλ²κΉ
λ‘κ·Έ: μ 체 λ°μ΄ν°κ° λͺ 건μ΄κ³ ν
μ΄λΈ λμ΄κ° μΌλ§λ‘ μ‘νλμ§ νμΈ
|
|
517
|
+
trace.log(`[VirtualHeight] totalCount: ${totalCount}, rowHeight: ${rowHeight}, totalVirtualHeight: ${totalVirtualHeight}`);
|
|
518
|
+
|
|
519
|
+
['.ng-container-body', '.ng-container-left', '.ng-container-right'].forEach(selector => {
|
|
520
|
+
const container = this.#sheet.querySelector(selector);
|
|
521
|
+
const table = container?.querySelector('table');
|
|
522
|
+
if (table) {
|
|
523
|
+
table.style.height = `${totalVirtualHeight}px`;
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
}; */
|
|
506
527
|
c(this, ft, /* @__PURE__ */ a(() => {
|
|
507
528
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
508
529
|
const s = (t(this, I).data.get() || []).length, n = t(this, T) || 24, r = s * n;
|
|
509
|
-
|
|
530
|
+
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
510
531
|
const l = t(this, w).querySelector(o), d = l == null ? void 0 : l.querySelector("table");
|
|
511
|
-
d && (d.style.height = `${r}px`);
|
|
532
|
+
d && (d.style.height = "auto", d.style.minHeight = `${r}px`);
|
|
512
533
|
});
|
|
513
534
|
}, "#updateVirtualScrollHeight"));
|
|
514
535
|
c(this, ut, /* @__PURE__ */ a(() => {
|
|
515
536
|
if ((t(this, I).data.get() || []).length, t(this, F) > 0 && t(this, T) > 0) {
|
|
516
537
|
const e = Math.ceil(t(this, F) / t(this, T));
|
|
517
|
-
g(this, B, e + t(this, Tt)),
|
|
538
|
+
g(this, B, e + t(this, Tt)), L.log("visibleRows:", e, "cachedRowCount:", t(this, B));
|
|
518
539
|
}
|
|
519
540
|
}, "#updateRowCount"));
|
|
520
541
|
c(this, Lt, /* @__PURE__ */ a(() => {
|
|
@@ -577,7 +598,7 @@ const ce = class ce {
|
|
|
577
598
|
const e = t(this, T);
|
|
578
599
|
if (!e || e <= 0) return;
|
|
579
600
|
const n = (t(this, I).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, W).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this, B);
|
|
580
|
-
|
|
601
|
+
L.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, B)}, targetDataIndex range: ${r} ~ ${l} (Total: ${n})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
581
602
|
const f = t(this, w).querySelector(h);
|
|
582
603
|
if (!f) return;
|
|
583
604
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
@@ -848,7 +869,7 @@ const ct = class ct extends HTMLElement {
|
|
|
848
869
|
t(this, Wt).call(this);
|
|
849
870
|
}
|
|
850
871
|
disconnectedCallback() {
|
|
851
|
-
this.innerHTML = "",
|
|
872
|
+
this.innerHTML = "", L.log("NineTableSheet destroyed.");
|
|
852
873
|
}
|
|
853
874
|
};
|
|
854
875
|
Mt = new WeakMap(), st = new WeakMap(), j = new WeakMap(), _t = new WeakMap(), $t = new WeakMap(), It = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(), a(ct, "NineTableSheet"), v(ct, "SCROLLBAR_SIZE", 16);
|
|
@@ -1048,10 +1069,10 @@ const fe = class fe {
|
|
|
1048
1069
|
};
|
|
1049
1070
|
mt = new WeakMap(), nt = new WeakMap(), a(fe, "ngRow");
|
|
1050
1071
|
let ee = fe;
|
|
1051
|
-
var
|
|
1072
|
+
var k, E, H, ot, Nt, N, Pt, K, xt, Yt, Vt, rt;
|
|
1052
1073
|
const C = class C {
|
|
1053
1074
|
constructor(i, e) {
|
|
1054
|
-
c(this,
|
|
1075
|
+
c(this, k);
|
|
1055
1076
|
c(this, E);
|
|
1056
1077
|
c(this, H, []);
|
|
1057
1078
|
c(this, ot, []);
|
|
@@ -1059,7 +1080,7 @@ const C = class C {
|
|
|
1059
1080
|
c(this, N, []);
|
|
1060
1081
|
c(this, Pt, /* @__PURE__ */ a(() => {
|
|
1061
1082
|
g(this, N, []);
|
|
1062
|
-
const i = t(this,
|
|
1083
|
+
const i = t(this, k).template || [];
|
|
1063
1084
|
Array.from(i).forEach((e) => {
|
|
1064
1085
|
var s;
|
|
1065
1086
|
t(this, N).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
@@ -1068,7 +1089,7 @@ const C = class C {
|
|
|
1068
1089
|
});
|
|
1069
1090
|
}, "#initialize"));
|
|
1070
1091
|
c(this, K, /* @__PURE__ */ a(() => {
|
|
1071
|
-
t(this,
|
|
1092
|
+
t(this, k).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1072
1093
|
i.invalidate();
|
|
1073
1094
|
});
|
|
1074
1095
|
}, "#invalidate"));
|
|
@@ -1078,7 +1099,7 @@ const C = class C {
|
|
|
1078
1099
|
if (!s || s.length <= 0) return;
|
|
1079
1100
|
if (i == null) return t(this, rt).call(this, s);
|
|
1080
1101
|
if (i < 0 || i >= s.length) return null;
|
|
1081
|
-
const n = typeof ((r = t(this,
|
|
1102
|
+
const n = typeof ((r = t(this, k).fields) == null ? void 0 : r.get) == "function" ? t(this, k).fields.get() : [];
|
|
1082
1103
|
if (e != null) {
|
|
1083
1104
|
const o = n.indexOf(e);
|
|
1084
1105
|
return o >= 0 ? s[i].v[o] : null;
|
|
@@ -1104,10 +1125,10 @@ const C = class C {
|
|
|
1104
1125
|
var i;
|
|
1105
1126
|
t(this, E).rawRecords = [], g(this, H, []), g(this, ot, []), (i = t(this, E).viewRecords) != null && i.reset && t(this, E).viewRecords.reset();
|
|
1106
1127
|
}, "clear"));
|
|
1107
|
-
c(this,
|
|
1128
|
+
c(this, Yt, /* @__PURE__ */ a((i) => {
|
|
1108
1129
|
var n;
|
|
1109
1130
|
Array.isArray(i) || (i = [i]);
|
|
1110
|
-
const e = typeof ((n = t(this,
|
|
1131
|
+
const e = typeof ((n = t(this, k).fields) == null ? void 0 : n.get) == "function" ? t(this, k).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1111
1132
|
return i.forEach((r) => {
|
|
1112
1133
|
const o = { v: [] };
|
|
1113
1134
|
e.forEach((l) => {
|
|
@@ -1115,13 +1136,13 @@ const C = class C {
|
|
|
1115
1136
|
}), s.push(o);
|
|
1116
1137
|
}), s;
|
|
1117
1138
|
}, "#json2Array"));
|
|
1118
|
-
c(this,
|
|
1139
|
+
c(this, Vt, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1119
1140
|
e.__ng = t(this, xt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = C.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1120
1141
|
}), i), "#defaultInsert"));
|
|
1121
1142
|
v(this, "add", /* @__PURE__ */ a((i, e = !0) => {
|
|
1122
1143
|
i === void 0 && (i = {});
|
|
1123
|
-
const s = t(this,
|
|
1124
|
-
t(this, E).rawRecords = t(this, E).rawRecords.concat(t(this,
|
|
1144
|
+
const s = t(this, Yt).call(this, i);
|
|
1145
|
+
t(this, E).rawRecords = t(this, E).rawRecords.concat(t(this, Vt).call(this, s)), this.resetRecords();
|
|
1125
1146
|
const n = this.count() - 1;
|
|
1126
1147
|
return e || s.forEach((r, o) => {
|
|
1127
1148
|
const l = t(this, E).rawRecords[n - o];
|
|
@@ -1142,7 +1163,7 @@ const C = class C {
|
|
|
1142
1163
|
v(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
|
|
1143
1164
|
var d;
|
|
1144
1165
|
i = parseInt(i, 10);
|
|
1145
|
-
const r = (typeof ((d = t(this,
|
|
1166
|
+
const r = (typeof ((d = t(this, k).fields) == null ? void 0 : d.get) == "function" ? t(this, k).fields.get() : []).indexOf(e);
|
|
1146
1167
|
if (r < 0) return;
|
|
1147
1168
|
const o = this.getValidData()[i];
|
|
1148
1169
|
if (!o) return;
|
|
@@ -1160,7 +1181,7 @@ const C = class C {
|
|
|
1160
1181
|
c(this, rt, /* @__PURE__ */ a((i) => {
|
|
1161
1182
|
var o;
|
|
1162
1183
|
if (!i) return i;
|
|
1163
|
-
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this,
|
|
1184
|
+
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this, k).fields) == null ? void 0 : o.get) == "function" ? t(this, k).fields.get() : [], r = s.filter((l) => !l.__ng.deleted).map((l) => {
|
|
1164
1185
|
const d = {};
|
|
1165
1186
|
return n.forEach((h, f) => {
|
|
1166
1187
|
d[h] = l.v ? l.v[f] : l[h];
|
|
@@ -1169,7 +1190,7 @@ const C = class C {
|
|
|
1169
1190
|
return e ? r[0] : r;
|
|
1170
1191
|
}, "#conv"));
|
|
1171
1192
|
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
1172
|
-
g(this,
|
|
1193
|
+
g(this, k, i), g(this, E, e), t(this, Pt).call(this);
|
|
1173
1194
|
}
|
|
1174
1195
|
get source() {
|
|
1175
1196
|
return t(this, rt).call(this, t(this, E).rawRecords);
|
|
@@ -1187,7 +1208,7 @@ const C = class C {
|
|
|
1187
1208
|
return this.length;
|
|
1188
1209
|
}
|
|
1189
1210
|
};
|
|
1190
|
-
|
|
1211
|
+
k = new WeakMap(), E = new WeakMap(), H = new WeakMap(), ot = new WeakMap(), Nt = new WeakMap(), N = new WeakMap(), Pt = new WeakMap(), K = new WeakMap(), xt = new WeakMap(), Yt = new WeakMap(), Vt = new WeakMap(), rt = new WeakMap(), a(C, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1191
1212
|
v(C, "ROW_STATE", {
|
|
1192
1213
|
EMPTY: "EMPTY",
|
|
1193
1214
|
NORMAL: "NORMAL",
|
|
@@ -1237,11 +1258,11 @@ const ge = class ge {
|
|
|
1237
1258
|
}), g(this, A, Array.from(i, ([e, s]) => ({ name: e, type: s }))), g(this, A, t(this, A).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, A).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1238
1259
|
}, "#adjust"));
|
|
1239
1260
|
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1240
|
-
g(this, A, []),
|
|
1261
|
+
g(this, A, []), L.log(t(this, lt).querySelectorAll("table"));
|
|
1241
1262
|
const i = Array.from(t(this, lt).querySelectorAll("table"));
|
|
1242
1263
|
if (!(!i || i.length === 0)) {
|
|
1243
1264
|
for (const e of i)
|
|
1244
|
-
|
|
1265
|
+
L.log(e), $("[data-bind]", e).each((s, n) => {
|
|
1245
1266
|
const r = n.dataset.bind, o = n.getAttribute("data-type") || "string";
|
|
1246
1267
|
r && t(this, A).push({ name: r, type: o });
|
|
1247
1268
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1300,7 +1321,7 @@ const be = class be extends HTMLElement {
|
|
|
1300
1321
|
c(this, G);
|
|
1301
1322
|
c(this, Ut);
|
|
1302
1323
|
c(this, Ft, /* @__PURE__ */ a(() => {
|
|
1303
|
-
this.fields = new ne(this), g(this, Ut, new te(this)),
|
|
1324
|
+
this.fields = new ne(this), g(this, Ut, new te(this)), L.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1304
1325
|
}, "#init"));
|
|
1305
1326
|
this.attachShadow({ mode: "open" }), g(this, G, new se(this));
|
|
1306
1327
|
}
|
|
@@ -1308,7 +1329,7 @@ const be = class be extends HTMLElement {
|
|
|
1308
1329
|
t(this, Ft).call(this);
|
|
1309
1330
|
}
|
|
1310
1331
|
disconnectedCallback() {
|
|
1311
|
-
|
|
1332
|
+
L.log("NineTable disconnected.");
|
|
1312
1333
|
}
|
|
1313
1334
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1314
1335
|
get data() {
|