@ninebone/table 0.0.400 β 0.0.402
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 +27 -25
- 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 re = class re extends Se.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(re, "Trace");
|
|
24
24
|
let jt = re;
|
|
25
|
-
const
|
|
25
|
+
const H = new jt();
|
|
26
26
|
var _, O, p, V, Y, X, St, U, Et;
|
|
27
27
|
const le = class le extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -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`, H.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 ae = class ae 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.log(h, r), 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 (H.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`, H.log(m), 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(() => {
|
|
@@ -244,7 +244,9 @@ const ae = class ae extends HTMLElement {
|
|
|
244
244
|
n.stopPropagation(), n.preventDefault(), g(this, D, !0), g(this, ht, n.clientY), g(this, dt, 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, ht), y = e.clientHeight
|
|
247
|
+
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h, b = l.clientY - t(this, ht), y = e.clientHeight;
|
|
248
|
+
H.log(":::", this.clientHeight);
|
|
249
|
+
const m = s(), R = Math.max(m - y, 1);
|
|
248
250
|
if (u > 0 && R > 0) {
|
|
249
251
|
const J = b / u * R;
|
|
250
252
|
let at = t(this, dt) + J;
|
|
@@ -506,7 +508,7 @@ const ce = class ce {
|
|
|
506
508
|
c(this, ft, /* @__PURE__ */ a(() => {
|
|
507
509
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
508
510
|
const s = (t(this, I).data.get() || []).length, n = t(this, T) || 24, r = s * n;
|
|
509
|
-
|
|
511
|
+
H.log(`[VirtualHeight] totalCount: ${s}, rowHeight: ${n}, totalVirtualHeight: ${r}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
510
512
|
const l = t(this, w).querySelector(o), d = l == null ? void 0 : l.querySelector("table");
|
|
511
513
|
d && (d.style.height = `${r}px`);
|
|
512
514
|
});
|
|
@@ -514,7 +516,7 @@ const ce = class ce {
|
|
|
514
516
|
c(this, ut, /* @__PURE__ */ a(() => {
|
|
515
517
|
if ((t(this, I).data.get() || []).length, t(this, F) > 0 && t(this, T) > 0) {
|
|
516
518
|
const e = Math.ceil(t(this, F) / t(this, T));
|
|
517
|
-
g(this, N, e + t(this, Tt)),
|
|
519
|
+
g(this, N, e + t(this, Tt)), H.log("visibleRows:", e, "cachedRowCount:", t(this, N));
|
|
518
520
|
}
|
|
519
521
|
}, "#updateRowCount"));
|
|
520
522
|
c(this, Lt, /* @__PURE__ */ a(() => {
|
|
@@ -577,7 +579,7 @@ const ce = class ce {
|
|
|
577
579
|
const e = t(this, T);
|
|
578
580
|
if (!e || e <= 0) return;
|
|
579
581
|
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
|
-
|
|
582
|
+
H.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
583
|
const f = t(this, w).querySelector(h);
|
|
582
584
|
if (!f) return;
|
|
583
585
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
@@ -847,7 +849,7 @@ const ct = class ct extends HTMLElement {
|
|
|
847
849
|
t(this, Wt).call(this);
|
|
848
850
|
}
|
|
849
851
|
disconnectedCallback() {
|
|
850
|
-
this.innerHTML = "",
|
|
852
|
+
this.innerHTML = "", H.log("NineTableSheet destroyed.");
|
|
851
853
|
}
|
|
852
854
|
};
|
|
853
855
|
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,7 +1050,7 @@ const fe = class fe {
|
|
|
1048
1050
|
mt = new WeakMap(), nt = new WeakMap(), a(fe, "ngRow");
|
|
1049
1051
|
let ee = fe;
|
|
1050
1052
|
var k, E, L, ot, Nt, P, Pt, K, xt, Vt, Yt, rt;
|
|
1051
|
-
const
|
|
1053
|
+
const C = class C {
|
|
1052
1054
|
constructor(i, e) {
|
|
1053
1055
|
c(this, k);
|
|
1054
1056
|
c(this, E);
|
|
@@ -1088,13 +1090,13 @@ const H = class H {
|
|
|
1088
1090
|
this.clear(), this.add(i, !1), t(this, K).call(this);
|
|
1089
1091
|
}, "set"));
|
|
1090
1092
|
c(this, xt, /* @__PURE__ */ a(() => ({
|
|
1091
|
-
rowState:
|
|
1093
|
+
rowState: C.ROW_STATE.EMPTY,
|
|
1092
1094
|
deleted: !1,
|
|
1093
1095
|
filtered: !1,
|
|
1094
1096
|
height: t(this, P).slice(),
|
|
1095
1097
|
o: {},
|
|
1096
1098
|
c: {},
|
|
1097
|
-
_: [0, 0, 0, 0,
|
|
1099
|
+
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, P).slice(), -1, {}, {}]
|
|
1098
1100
|
}), "#getDefaultMeta"));
|
|
1099
1101
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
1100
1102
|
g(this, L, []), g(this, ot, []), t(this, K).call(this);
|
|
@@ -1115,7 +1117,7 @@ const H = class H {
|
|
|
1115
1117
|
}), s;
|
|
1116
1118
|
}, "#json2Array"));
|
|
1117
1119
|
c(this, Yt, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1118
|
-
e.__ng = t(this, xt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState =
|
|
1120
|
+
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;
|
|
1119
1121
|
}), i), "#defaultInsert"));
|
|
1120
1122
|
v(this, "add", /* @__PURE__ */ a((i, e = !0) => {
|
|
1121
1123
|
i === void 0 && (i = {});
|
|
@@ -1124,7 +1126,7 @@ const H = class H {
|
|
|
1124
1126
|
const n = this.count() - 1;
|
|
1125
1127
|
return e || s.forEach((r, o) => {
|
|
1126
1128
|
const l = t(this, E).rawRecords[n - o];
|
|
1127
|
-
l && (l.__ng.rowState =
|
|
1129
|
+
l && (l.__ng.rowState = C.ROW_STATE.EMPTY);
|
|
1128
1130
|
}), t(this, K).call(this), n;
|
|
1129
1131
|
}, "add"));
|
|
1130
1132
|
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
@@ -1132,8 +1134,8 @@ const H = class H {
|
|
|
1132
1134
|
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
1135
|
if (t(this, L)[s]) {
|
|
1134
1136
|
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 =
|
|
1137
|
+
t(this, L)[s].__ng.rowState === C.ROW_STATE.INSERT ? t(this, E).rawRecords = t(this, E).rawRecords.filter((r) => r.__ng.rowid !== n) : t(this, E).rawRecords.forEach((r) => {
|
|
1138
|
+
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState = C.ROW_STATE.DELETE);
|
|
1137
1139
|
});
|
|
1138
1140
|
}
|
|
1139
1141
|
}), this.resetRecords(), t(this, K).call(this);
|
|
@@ -1146,7 +1148,7 @@ const H = class H {
|
|
|
1146
1148
|
const o = this.getValidData()[i];
|
|
1147
1149
|
if (!o) return;
|
|
1148
1150
|
const l = o.v[r];
|
|
1149
|
-
l !== s && o.__ng.rowState !==
|
|
1151
|
+
l !== s && o.__ng.rowState !== C.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = l), o.__ng.rowState = C.ROW_STATE.UPDATE), o.v[r] = s;
|
|
1150
1152
|
}, "setValue"));
|
|
1151
1153
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1152
1154
|
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 +1188,15 @@ const H = class H {
|
|
|
1186
1188
|
return this.length;
|
|
1187
1189
|
}
|
|
1188
1190
|
};
|
|
1189
|
-
k = new WeakMap(), E = new WeakMap(), L = new WeakMap(), ot = new WeakMap(), Nt = new WeakMap(), P = new WeakMap(), Pt = new WeakMap(), K = new WeakMap(), xt = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), rt = new WeakMap(), a(
|
|
1190
|
-
v(
|
|
1191
|
+
k = new WeakMap(), E = new WeakMap(), L = new WeakMap(), ot = new WeakMap(), Nt = new WeakMap(), P = new WeakMap(), Pt = new WeakMap(), K = new WeakMap(), xt = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), rt = new WeakMap(), a(C, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1192
|
+
v(C, "ROW_STATE", {
|
|
1191
1193
|
EMPTY: "EMPTY",
|
|
1192
1194
|
NORMAL: "NORMAL",
|
|
1193
1195
|
INSERT: "INSERT",
|
|
1194
1196
|
UPDATE: "UPDATE",
|
|
1195
1197
|
DELETE: "DELETE"
|
|
1196
1198
|
});
|
|
1197
|
-
let ie =
|
|
1199
|
+
let ie = C;
|
|
1198
1200
|
var Z;
|
|
1199
1201
|
const ue = class ue {
|
|
1200
1202
|
constructor(i) {
|
|
@@ -1236,11 +1238,11 @@ const ge = class ge {
|
|
|
1236
1238
|
}), 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
1239
|
}, "#adjust"));
|
|
1238
1240
|
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1239
|
-
g(this, A, []),
|
|
1241
|
+
g(this, A, []), H.log(t(this, lt).querySelectorAll("table"));
|
|
1240
1242
|
const i = Array.from(t(this, lt).querySelectorAll("table"));
|
|
1241
1243
|
if (!(!i || i.length === 0)) {
|
|
1242
1244
|
for (const e of i)
|
|
1243
|
-
|
|
1245
|
+
H.log(e), $("[data-bind]", e).each((s, n) => {
|
|
1244
1246
|
const r = n.dataset.bind, o = n.getAttribute("data-type") || "string";
|
|
1245
1247
|
r && t(this, A).push({ name: r, type: o });
|
|
1246
1248
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1299,7 +1301,7 @@ const be = class be extends HTMLElement {
|
|
|
1299
1301
|
c(this, G);
|
|
1300
1302
|
c(this, Ut);
|
|
1301
1303
|
c(this, Ft, /* @__PURE__ */ a(() => {
|
|
1302
|
-
this.fields = new ne(this), g(this, Ut, new te(this)),
|
|
1304
|
+
this.fields = new ne(this), g(this, Ut, new te(this)), H.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1303
1305
|
}, "#init"));
|
|
1304
1306
|
this.attachShadow({ mode: "open" }), g(this, G, new se(this));
|
|
1305
1307
|
}
|
|
@@ -1307,7 +1309,7 @@ const be = class be extends HTMLElement {
|
|
|
1307
1309
|
t(this, Ft).call(this);
|
|
1308
1310
|
}
|
|
1309
1311
|
disconnectedCallback() {
|
|
1310
|
-
|
|
1312
|
+
H.log("NineTable disconnected.");
|
|
1311
1313
|
}
|
|
1312
1314
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1313
1315
|
get data() {
|