@ninebone/table 0.0.403 β 0.0.405
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 +25 -27
- 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,7 +22,7 @@ const oe = class oe extends ve.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(oe, "Trace");
|
|
24
24
|
let Ft = oe;
|
|
25
|
-
const
|
|
25
|
+
const C = new Ft();
|
|
26
26
|
var M, O, p, V, Y, X, wt, U, St;
|
|
27
27
|
const re = class re extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -59,7 +59,7 @@ const re = class re 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`, C.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
64
|
c(this, U, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
@@ -217,20 +217,20 @@ const le = class le extends HTMLElement {
|
|
|
217
217
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
218
218
|
if (!t(this, z) || !t(this, S) || t(this, D)) return;
|
|
219
219
|
const e = t(this, S).container, s = t(this, S).track, n = t(this, S).thumb, r = e.clientHeight, l = (t(this, z).data.get() || []).length, d = t(this, Q).getRowHeight(), h = l * d;
|
|
220
|
-
if (
|
|
220
|
+
if (h <= r) {
|
|
221
221
|
n.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
222
222
|
return;
|
|
223
223
|
} else
|
|
224
224
|
n.style.display = "block";
|
|
225
225
|
const f = s.clientHeight;
|
|
226
|
-
if (
|
|
226
|
+
if (C.log(s, f, this, this.clientHeight), f <= 0) return;
|
|
227
227
|
const u = Math.max(Math.min(f * (r / h), f), 20);
|
|
228
228
|
n.style.height = `${u}px`;
|
|
229
229
|
const b = e.scrollTop, y = Math.max(h - r, 1);
|
|
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`, C.log(m), t(this, S).top.disabled = b <= 0, t(this, S).bottom.disabled = b >= y - 1;
|
|
234
234
|
}, "refresh"));
|
|
235
235
|
c(this, Et, /* @__PURE__ */ a(() => {
|
|
236
236
|
const e = t(this, S).container, s = /* @__PURE__ */ a(() => {
|
|
@@ -244,9 +244,7 @@ const le = class le extends HTMLElement {
|
|
|
244
244
|
n.stopPropagation(), n.preventDefault(), g(this, D, !0), g(this, ct, n.clientY), g(this, ht, e.scrollTop);
|
|
245
245
|
const r = /* @__PURE__ */ a((l) => {
|
|
246
246
|
if (!t(this, D)) return;
|
|
247
|
-
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h, b = l.clientY - t(this, ct), y = e.clientHeight;
|
|
248
|
-
H.log(":::", this.clientHeight);
|
|
249
|
-
const m = s(), R = Math.max(m - y, 1);
|
|
247
|
+
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h, b = l.clientY - t(this, ct), y = e.clientHeight, m = s(), R = Math.max(m - y, 1);
|
|
250
248
|
if (u > 0 && R > 0) {
|
|
251
249
|
const J = b / u * R;
|
|
252
250
|
t(this, ht) + J;
|
|
@@ -506,7 +504,7 @@ const ae = class ae {
|
|
|
506
504
|
c(this, dt, /* @__PURE__ */ a(() => {
|
|
507
505
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
508
506
|
const s = (t(this, I).data.get() || []).length, n = t(this, T) || 24, r = s * n;
|
|
509
|
-
|
|
507
|
+
C.log(`[VirtualHeight] totalCount: ${s}, rowHeight: ${n}, totalVirtualHeight: ${r}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
510
508
|
const l = t(this, w).querySelector(o), d = l == null ? void 0 : l.querySelector("table");
|
|
511
509
|
d && (d.style.height = `${r}px`);
|
|
512
510
|
});
|
|
@@ -514,7 +512,7 @@ const ae = class ae {
|
|
|
514
512
|
c(this, ft, /* @__PURE__ */ a(() => {
|
|
515
513
|
if ((t(this, I).data.get() || []).length, t(this, F) > 0 && t(this, T) > 0) {
|
|
516
514
|
const e = Math.ceil(t(this, F) / t(this, T));
|
|
517
|
-
g(this, N, e + t(this, At)),
|
|
515
|
+
g(this, N, e + t(this, At)), C.log("visibleRows:", e, "cachedRowCount:", t(this, N));
|
|
518
516
|
}
|
|
519
517
|
}, "#updateRowCount"));
|
|
520
518
|
c(this, kt, /* @__PURE__ */ a(() => {
|
|
@@ -577,7 +575,7 @@ const ae = class ae {
|
|
|
577
575
|
const e = t(this, T);
|
|
578
576
|
if (!e || e <= 0) return;
|
|
579
577
|
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, N);
|
|
580
|
-
|
|
578
|
+
C.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, N)}, targetDataIndex range: ${r} ~ ${l} (Total: ${n})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
581
579
|
const f = t(this, w).querySelector(h);
|
|
582
580
|
if (!f) return;
|
|
583
581
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
@@ -847,7 +845,7 @@ const at = class at extends HTMLElement {
|
|
|
847
845
|
t(this, It).call(this);
|
|
848
846
|
}
|
|
849
847
|
disconnectedCallback() {
|
|
850
|
-
this.innerHTML = "",
|
|
848
|
+
this.innerHTML = "", C.log("NineTableSheet destroyed.");
|
|
851
849
|
}
|
|
852
850
|
};
|
|
853
851
|
Ct = new WeakMap(), st = new WeakMap(), j = new WeakMap(), _t = new WeakMap(), $t = new WeakMap(), Mt = new WeakMap(), It = new WeakMap(), Wt = new WeakMap(), a(at, "NineTableSheet"), v(at, "SCROLLBAR_SIZE", 16);
|
|
@@ -1048,7 +1046,7 @@ const de = class de {
|
|
|
1048
1046
|
pt = new WeakMap(), nt = new WeakMap(), a(de, "ngRow");
|
|
1049
1047
|
let te = de;
|
|
1050
1048
|
var k, E, L, ot, Bt, P, Nt, K, mt, Pt, Vt, rt;
|
|
1051
|
-
const
|
|
1049
|
+
const H = class H {
|
|
1052
1050
|
constructor(i, e) {
|
|
1053
1051
|
c(this, k);
|
|
1054
1052
|
c(this, E);
|
|
@@ -1088,13 +1086,13 @@ const C = class C {
|
|
|
1088
1086
|
this.clear(), this.add(i, !1), t(this, K).call(this);
|
|
1089
1087
|
}, "set"));
|
|
1090
1088
|
c(this, mt, /* @__PURE__ */ a(() => ({
|
|
1091
|
-
rowState:
|
|
1089
|
+
rowState: H.ROW_STATE.EMPTY,
|
|
1092
1090
|
deleted: !1,
|
|
1093
1091
|
filtered: !1,
|
|
1094
1092
|
height: t(this, P).slice(),
|
|
1095
1093
|
o: {},
|
|
1096
1094
|
c: {},
|
|
1097
|
-
_: [0, 0, 0, 0,
|
|
1095
|
+
_: [0, 0, 0, 0, H.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, P).slice(), -1, {}, {}]
|
|
1098
1096
|
}), "#getDefaultMeta"));
|
|
1099
1097
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
1100
1098
|
g(this, L, []), g(this, ot, []), t(this, K).call(this);
|
|
@@ -1115,7 +1113,7 @@ const C = class C {
|
|
|
1115
1113
|
}), s;
|
|
1116
1114
|
}, "#json2Array"));
|
|
1117
1115
|
c(this, Vt, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1118
|
-
e.__ng = t(this, mt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState =
|
|
1116
|
+
e.__ng = t(this, mt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = H.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1119
1117
|
}), i), "#defaultInsert"));
|
|
1120
1118
|
v(this, "add", /* @__PURE__ */ a((i, e = !0) => {
|
|
1121
1119
|
i === void 0 && (i = {});
|
|
@@ -1124,7 +1122,7 @@ const C = class C {
|
|
|
1124
1122
|
const n = this.count() - 1;
|
|
1125
1123
|
return e || s.forEach((r, o) => {
|
|
1126
1124
|
const l = t(this, E).rawRecords[n - o];
|
|
1127
|
-
l && (l.__ng.rowState =
|
|
1125
|
+
l && (l.__ng.rowState = H.ROW_STATE.EMPTY);
|
|
1128
1126
|
}), t(this, K).call(this), n;
|
|
1129
1127
|
}, "add"));
|
|
1130
1128
|
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
@@ -1132,8 +1130,8 @@ const C = class C {
|
|
|
1132
1130
|
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s, n) => n - s).forEach((s) => {
|
|
1133
1131
|
if (t(this, L)[s]) {
|
|
1134
1132
|
const n = t(this, L)[s].__ng.rowid;
|
|
1135
|
-
t(this, L)[s].__ng.rowState ===
|
|
1136
|
-
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState =
|
|
1133
|
+
t(this, L)[s].__ng.rowState === H.ROW_STATE.INSERT ? t(this, E).rawRecords = t(this, E).rawRecords.filter((r) => r.__ng.rowid !== n) : t(this, E).rawRecords.forEach((r) => {
|
|
1134
|
+
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState = H.ROW_STATE.DELETE);
|
|
1137
1135
|
});
|
|
1138
1136
|
}
|
|
1139
1137
|
}), this.resetRecords(), t(this, K).call(this);
|
|
@@ -1146,7 +1144,7 @@ const C = class C {
|
|
|
1146
1144
|
const o = this.getValidData()[i];
|
|
1147
1145
|
if (!o) return;
|
|
1148
1146
|
const l = o.v[r];
|
|
1149
|
-
l !== s && o.__ng.rowState !==
|
|
1147
|
+
l !== s && o.__ng.rowState !== H.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = l), o.__ng.rowState = H.ROW_STATE.UPDATE), o.v[r] = s;
|
|
1150
1148
|
}, "setValue"));
|
|
1151
1149
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1152
1150
|
g(this, ot, t(this, E).rawRecords.filter((i) => !i.__ng.deleted)), g(this, L, t(this, E).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, E).rawRecords.forEach((i, e) => {
|
|
@@ -1186,15 +1184,15 @@ const C = class C {
|
|
|
1186
1184
|
return this.length;
|
|
1187
1185
|
}
|
|
1188
1186
|
};
|
|
1189
|
-
k = new WeakMap(), E = new WeakMap(), L = new WeakMap(), ot = new WeakMap(), Bt = new WeakMap(), P = new WeakMap(), Nt = new WeakMap(), K = new WeakMap(), mt = new WeakMap(), Pt = new WeakMap(), Vt = new WeakMap(), rt = new WeakMap(), a(
|
|
1190
|
-
v(
|
|
1187
|
+
k = new WeakMap(), E = new WeakMap(), L = new WeakMap(), ot = new WeakMap(), Bt = new WeakMap(), P = new WeakMap(), Nt = new WeakMap(), K = new WeakMap(), mt = new WeakMap(), Pt = new WeakMap(), Vt = new WeakMap(), rt = new WeakMap(), a(H, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1188
|
+
v(H, "ROW_STATE", {
|
|
1191
1189
|
EMPTY: "EMPTY",
|
|
1192
1190
|
NORMAL: "NORMAL",
|
|
1193
1191
|
INSERT: "INSERT",
|
|
1194
1192
|
UPDATE: "UPDATE",
|
|
1195
1193
|
DELETE: "DELETE"
|
|
1196
1194
|
});
|
|
1197
|
-
let ee =
|
|
1195
|
+
let ee = H;
|
|
1198
1196
|
var Z;
|
|
1199
1197
|
const fe = class fe {
|
|
1200
1198
|
constructor(i) {
|
|
@@ -1236,11 +1234,11 @@ const ue = class ue {
|
|
|
1236
1234
|
}), 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);
|
|
1237
1235
|
}, "#adjust"));
|
|
1238
1236
|
c(this, Yt, /* @__PURE__ */ a(() => {
|
|
1239
|
-
g(this, A, []),
|
|
1237
|
+
g(this, A, []), C.log(t(this, lt).querySelectorAll("table"));
|
|
1240
1238
|
const i = Array.from(t(this, lt).querySelectorAll("table"));
|
|
1241
1239
|
if (!(!i || i.length === 0)) {
|
|
1242
1240
|
for (const e of i)
|
|
1243
|
-
|
|
1241
|
+
C.log(e), $("[data-bind]", e).each((s, n) => {
|
|
1244
1242
|
const r = n.dataset.bind, o = n.getAttribute("data-type") || "string";
|
|
1245
1243
|
r && t(this, A).push({ name: r, type: o });
|
|
1246
1244
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1299,7 +1297,7 @@ const ge = class ge extends HTMLElement {
|
|
|
1299
1297
|
c(this, G);
|
|
1300
1298
|
c(this, Xt);
|
|
1301
1299
|
c(this, Ut, /* @__PURE__ */ a(() => {
|
|
1302
|
-
this.fields = new se(this), g(this, Xt, new Qt(this)),
|
|
1300
|
+
this.fields = new se(this), g(this, Xt, new Qt(this)), C.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1303
1301
|
}, "#init"));
|
|
1304
1302
|
this.attachShadow({ mode: "open" }), g(this, G, new ie(this));
|
|
1305
1303
|
}
|
|
@@ -1307,7 +1305,7 @@ const ge = class ge extends HTMLElement {
|
|
|
1307
1305
|
t(this, Ut).call(this);
|
|
1308
1306
|
}
|
|
1309
1307
|
disconnectedCallback() {
|
|
1310
|
-
|
|
1308
|
+
C.log("NineTable disconnected.");
|
|
1311
1309
|
}
|
|
1312
1310
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1313
1311
|
get data() {
|