@ninebone/table 0.0.410 β 0.0.411
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 +33 -33
- 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 re = class re extends Se.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(re, "Trace");
|
|
24
24
|
let jt = re;
|
|
25
|
-
const
|
|
25
|
+
const k = new jt();
|
|
26
26
|
var _, O, p, P, V, Y, St, X, 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`, k.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;
|
|
@@ -215,7 +215,7 @@ const ae = class ae extends HTMLElement {
|
|
|
215
215
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
216
216
|
*/
|
|
217
217
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
218
|
-
|
|
218
|
+
k.log("refresh", t(this, z)), k.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;
|
|
@@ -223,14 +223,14 @@ const ae = class ae extends HTMLElement {
|
|
|
223
223
|
} else
|
|
224
224
|
n.style.display = "block";
|
|
225
225
|
const f = s.clientHeight;
|
|
226
|
-
if (
|
|
226
|
+
if (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`, k.log("currentScrollTop", b), k.log("maxScrollTop", y), k.log("trackHeight", f), k.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(() => {
|
|
@@ -506,7 +506,7 @@ const ce = class ce {
|
|
|
506
506
|
c(this, ft, /* @__PURE__ */ a(() => {
|
|
507
507
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
508
508
|
const s = (t(this, I).data.get() || []).length, n = t(this, T) || 24, r = s * n;
|
|
509
|
-
|
|
509
|
+
k.log(`[VirtualHeight] totalCount: ${s}, rowHeight: ${n}, totalVirtualHeight: ${r}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
510
510
|
const l = t(this, w).querySelector(o), d = l == null ? void 0 : l.querySelector("table");
|
|
511
511
|
d && (d.style.height = `${r}px`);
|
|
512
512
|
});
|
|
@@ -514,7 +514,7 @@ const ce = class ce {
|
|
|
514
514
|
c(this, ut, /* @__PURE__ */ a(() => {
|
|
515
515
|
if ((t(this, I).data.get() || []).length, t(this, F) > 0 && t(this, T) > 0) {
|
|
516
516
|
const e = Math.ceil(t(this, F) / t(this, T));
|
|
517
|
-
g(this, B, e + t(this, Tt)),
|
|
517
|
+
g(this, B, e + t(this, Tt)), k.log("visibleRows:", e, "cachedRowCount:", t(this, B));
|
|
518
518
|
}
|
|
519
519
|
}, "#updateRowCount"));
|
|
520
520
|
c(this, Lt, /* @__PURE__ */ a(() => {
|
|
@@ -577,7 +577,7 @@ const ce = class ce {
|
|
|
577
577
|
const e = t(this, T);
|
|
578
578
|
if (!e || e <= 0) return;
|
|
579
579
|
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
|
-
|
|
580
|
+
k.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
581
|
const f = t(this, w).querySelector(h);
|
|
582
582
|
if (!f) return;
|
|
583
583
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
@@ -847,7 +847,7 @@ const ct = class ct extends HTMLElement {
|
|
|
847
847
|
t(this, Wt).call(this);
|
|
848
848
|
}
|
|
849
849
|
disconnectedCallback() {
|
|
850
|
-
this.innerHTML = "",
|
|
850
|
+
this.innerHTML = "", k.log("NineTableSheet destroyed.");
|
|
851
851
|
}
|
|
852
852
|
};
|
|
853
853
|
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);
|
|
@@ -1047,18 +1047,18 @@ const fe = class fe {
|
|
|
1047
1047
|
};
|
|
1048
1048
|
mt = new WeakMap(), nt = new WeakMap(), a(fe, "ngRow");
|
|
1049
1049
|
let ee = fe;
|
|
1050
|
-
var
|
|
1050
|
+
var L, E, H, ot, Nt, N, Pt, K, xt, Vt, Yt, rt;
|
|
1051
1051
|
const C = class C {
|
|
1052
1052
|
constructor(i, e) {
|
|
1053
|
-
c(this,
|
|
1053
|
+
c(this, L);
|
|
1054
1054
|
c(this, E);
|
|
1055
|
-
c(this,
|
|
1055
|
+
c(this, H, []);
|
|
1056
1056
|
c(this, ot, []);
|
|
1057
1057
|
c(this, Nt, 0);
|
|
1058
1058
|
c(this, N, []);
|
|
1059
1059
|
c(this, Pt, /* @__PURE__ */ a(() => {
|
|
1060
1060
|
g(this, N, []);
|
|
1061
|
-
const i = t(this,
|
|
1061
|
+
const i = t(this, L).template || [];
|
|
1062
1062
|
Array.from(i).forEach((e) => {
|
|
1063
1063
|
var s;
|
|
1064
1064
|
t(this, N).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
@@ -1067,7 +1067,7 @@ const C = class C {
|
|
|
1067
1067
|
});
|
|
1068
1068
|
}, "#initialize"));
|
|
1069
1069
|
c(this, K, /* @__PURE__ */ a(() => {
|
|
1070
|
-
t(this,
|
|
1070
|
+
t(this, L).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1071
1071
|
i.invalidate();
|
|
1072
1072
|
});
|
|
1073
1073
|
}, "#invalidate"));
|
|
@@ -1077,7 +1077,7 @@ const C = class C {
|
|
|
1077
1077
|
if (!s || s.length <= 0) return;
|
|
1078
1078
|
if (i == null) return t(this, rt).call(this, s);
|
|
1079
1079
|
if (i < 0 || i >= s.length) return null;
|
|
1080
|
-
const n = typeof ((r = t(this,
|
|
1080
|
+
const n = typeof ((r = t(this, L).fields) == null ? void 0 : r.get) == "function" ? t(this, L).fields.get() : [];
|
|
1081
1081
|
if (e != null) {
|
|
1082
1082
|
const o = n.indexOf(e);
|
|
1083
1083
|
return o >= 0 ? s[i].v[o] : null;
|
|
@@ -1097,16 +1097,16 @@ const C = class C {
|
|
|
1097
1097
|
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, N).slice(), -1, {}, {}]
|
|
1098
1098
|
}), "#getDefaultMeta"));
|
|
1099
1099
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
1100
|
-
g(this,
|
|
1100
|
+
g(this, H, []), g(this, ot, []), t(this, K).call(this);
|
|
1101
1101
|
}, "reset"));
|
|
1102
1102
|
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
1103
1103
|
var i;
|
|
1104
|
-
t(this, E).rawRecords = [], g(this,
|
|
1104
|
+
t(this, E).rawRecords = [], g(this, H, []), g(this, ot, []), (i = t(this, E).viewRecords) != null && i.reset && t(this, E).viewRecords.reset();
|
|
1105
1105
|
}, "clear"));
|
|
1106
1106
|
c(this, Vt, /* @__PURE__ */ a((i) => {
|
|
1107
1107
|
var n;
|
|
1108
1108
|
Array.isArray(i) || (i = [i]);
|
|
1109
|
-
const e = typeof ((n = t(this,
|
|
1109
|
+
const e = typeof ((n = t(this, L).fields) == null ? void 0 : n.get) == "function" ? t(this, L).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1110
1110
|
return i.forEach((r) => {
|
|
1111
1111
|
const o = { v: [] };
|
|
1112
1112
|
e.forEach((l) => {
|
|
@@ -1130,9 +1130,9 @@ const C = class C {
|
|
|
1130
1130
|
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
1131
1131
|
let e = [];
|
|
1132
1132
|
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
|
-
if (t(this,
|
|
1134
|
-
const n = t(this,
|
|
1135
|
-
t(this,
|
|
1133
|
+
if (t(this, H)[s]) {
|
|
1134
|
+
const n = t(this, H)[s].__ng.rowid;
|
|
1135
|
+
t(this, H)[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) => {
|
|
1136
1136
|
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState = C.ROW_STATE.DELETE);
|
|
1137
1137
|
});
|
|
1138
1138
|
}
|
|
@@ -1141,7 +1141,7 @@ const C = class C {
|
|
|
1141
1141
|
v(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
|
|
1142
1142
|
var d;
|
|
1143
1143
|
i = parseInt(i, 10);
|
|
1144
|
-
const r = (typeof ((d = t(this,
|
|
1144
|
+
const r = (typeof ((d = t(this, L).fields) == null ? void 0 : d.get) == "function" ? t(this, L).fields.get() : []).indexOf(e);
|
|
1145
1145
|
if (r < 0) return;
|
|
1146
1146
|
const o = this.getValidData()[i];
|
|
1147
1147
|
if (!o) return;
|
|
@@ -1149,17 +1149,17 @@ const C = class C {
|
|
|
1149
1149
|
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
1150
|
}, "setValue"));
|
|
1151
1151
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1152
|
-
g(this, ot, t(this, E).rawRecords.filter((i) => !i.__ng.deleted)), g(this,
|
|
1152
|
+
g(this, ot, t(this, E).rawRecords.filter((i) => !i.__ng.deleted)), g(this, H, t(this, E).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, E).rawRecords.forEach((i, e) => {
|
|
1153
1153
|
i.__ng.rowidx = e;
|
|
1154
|
-
}), t(this,
|
|
1154
|
+
}), t(this, H).forEach((i, e) => {
|
|
1155
1155
|
i.__ng.i = e;
|
|
1156
1156
|
});
|
|
1157
1157
|
}, "resetRecords"));
|
|
1158
|
-
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this,
|
|
1158
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this, H).length === 0 && t(this, E).rawRecords.length > 0 && this.resetRecords(), t(this, H)), "getValidData"));
|
|
1159
1159
|
c(this, rt, /* @__PURE__ */ a((i) => {
|
|
1160
1160
|
var o;
|
|
1161
1161
|
if (!i) return i;
|
|
1162
|
-
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this,
|
|
1162
|
+
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this, L).fields) == null ? void 0 : o.get) == "function" ? t(this, L).fields.get() : [], r = s.filter((l) => !l.__ng.deleted).map((l) => {
|
|
1163
1163
|
const d = {};
|
|
1164
1164
|
return n.forEach((h, f) => {
|
|
1165
1165
|
d[h] = l.v ? l.v[f] : l[h];
|
|
@@ -1168,7 +1168,7 @@ const C = class C {
|
|
|
1168
1168
|
return e ? r[0] : r;
|
|
1169
1169
|
}, "#conv"));
|
|
1170
1170
|
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
1171
|
-
g(this,
|
|
1171
|
+
g(this, L, i), g(this, E, e), t(this, Pt).call(this);
|
|
1172
1172
|
}
|
|
1173
1173
|
get source() {
|
|
1174
1174
|
return t(this, rt).call(this, t(this, E).rawRecords);
|
|
@@ -1180,13 +1180,13 @@ const C = class C {
|
|
|
1180
1180
|
return ++ve(this, Nt)._;
|
|
1181
1181
|
}
|
|
1182
1182
|
get length() {
|
|
1183
|
-
return t(this,
|
|
1183
|
+
return t(this, H).length;
|
|
1184
1184
|
}
|
|
1185
1185
|
getRowCount() {
|
|
1186
1186
|
return this.length;
|
|
1187
1187
|
}
|
|
1188
1188
|
};
|
|
1189
|
-
|
|
1189
|
+
L = 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(), Vt = new WeakMap(), Yt = new WeakMap(), rt = new WeakMap(), a(C, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1190
1190
|
v(C, "ROW_STATE", {
|
|
1191
1191
|
EMPTY: "EMPTY",
|
|
1192
1192
|
NORMAL: "NORMAL",
|
|
@@ -1236,11 +1236,11 @@ const ge = class ge {
|
|
|
1236
1236
|
}), 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
1237
|
}, "#adjust"));
|
|
1238
1238
|
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1239
|
-
g(this, A, []),
|
|
1239
|
+
g(this, A, []), k.log(t(this, lt).querySelectorAll("table"));
|
|
1240
1240
|
const i = Array.from(t(this, lt).querySelectorAll("table"));
|
|
1241
1241
|
if (!(!i || i.length === 0)) {
|
|
1242
1242
|
for (const e of i)
|
|
1243
|
-
|
|
1243
|
+
k.log(e), $("[data-bind]", e).each((s, n) => {
|
|
1244
1244
|
const r = n.dataset.bind, o = n.getAttribute("data-type") || "string";
|
|
1245
1245
|
r && t(this, A).push({ name: r, type: o });
|
|
1246
1246
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1299,7 +1299,7 @@ const be = class be extends HTMLElement {
|
|
|
1299
1299
|
c(this, G);
|
|
1300
1300
|
c(this, Ut);
|
|
1301
1301
|
c(this, Ft, /* @__PURE__ */ a(() => {
|
|
1302
|
-
this.fields = new ne(this), g(this, Ut, new te(this)),
|
|
1302
|
+
this.fields = new ne(this), g(this, Ut, new te(this)), k.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1303
1303
|
}, "#init"));
|
|
1304
1304
|
this.attachShadow({ mode: "open" }), g(this, G, new se(this));
|
|
1305
1305
|
}
|
|
@@ -1307,7 +1307,7 @@ const be = class be extends HTMLElement {
|
|
|
1307
1307
|
t(this, Ft).call(this);
|
|
1308
1308
|
}
|
|
1309
1309
|
disconnectedCallback() {
|
|
1310
|
-
|
|
1310
|
+
k.log("NineTable disconnected.");
|
|
1311
1311
|
}
|
|
1312
1312
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1313
1313
|
get data() {
|