@ninebone/table 0.0.544 β 0.0.545
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 +37 -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,7 +22,7 @@ const He = class He extends Ke.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
h(He, "Trace");
|
|
24
24
|
let ae = He;
|
|
25
|
-
const
|
|
25
|
+
const N = new ae();
|
|
26
26
|
var z, j, w, X, K, Z, _t, G, Nt;
|
|
27
27
|
const Me = class Me extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -230,7 +230,7 @@ const $e = class $e extends HTMLElement {
|
|
|
230
230
|
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;
|
|
231
231
|
}, "refresh"));
|
|
232
232
|
d(this, Wt, /* @__PURE__ */ h(() => {
|
|
233
|
-
|
|
233
|
+
N.log("nine-table-vscrollbar.#init");
|
|
234
234
|
const e = t(this, q).container, s = /* @__PURE__ */ h(() => {
|
|
235
235
|
const n = (t(this, F).data.get() || []).length, a = t(this, at).getRowHeight();
|
|
236
236
|
return n * a;
|
|
@@ -370,12 +370,12 @@ const Ie = class Ie {
|
|
|
370
370
|
d(this, Ot, 3);
|
|
371
371
|
E(this, "refresh", /* @__PURE__ */ h(() => {
|
|
372
372
|
var e;
|
|
373
|
-
|
|
373
|
+
N.log("rowManager.refresh");
|
|
374
374
|
const i = t(this, S).querySelector(".ng-container-body .ng-part-body");
|
|
375
375
|
i && (t(this, Et).call(this), t(this, ct).call(this, i.scrollTop), (e = t(this, S).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
376
376
|
}, "refresh"));
|
|
377
377
|
E(this, "initialize", /* @__PURE__ */ h(() => {
|
|
378
|
-
|
|
378
|
+
N.log("rowManager.initialize"), y(this, Q, {
|
|
379
379
|
scrollTables: t(this, S).querySelectorAll(".ng-part-body table"),
|
|
380
380
|
firstTr: t(this, S).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")
|
|
381
381
|
}), y(this, H, null), t(this, P).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((a) => {
|
|
@@ -406,7 +406,7 @@ const Ie = class Ie {
|
|
|
406
406
|
}
|
|
407
407
|
}, "initialize"));
|
|
408
408
|
d(this, Bt, /* @__PURE__ */ h((i, e) => {
|
|
409
|
-
|
|
409
|
+
N.log("rowManager.#renderRows");
|
|
410
410
|
const s = t(this, P).get(e);
|
|
411
411
|
if (!s || s.length === 0) return;
|
|
412
412
|
const r = i.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -420,9 +420,9 @@ const Ie = class Ie {
|
|
|
420
420
|
n ? n.before(a) : r.appendChild(a), e === ".ng-container-body" && (t(this, Q).firstTr = r.querySelector("tr:not(.nodata)"));
|
|
421
421
|
}, "#renderRows"));
|
|
422
422
|
d(this, zt, /* @__PURE__ */ h((i) => {
|
|
423
|
-
if (
|
|
423
|
+
if (N.log("rowManager.#measureAndCacheHeight"), t(this, H) !== null && t(this, H) > 0)
|
|
424
424
|
return t(this, H);
|
|
425
|
-
|
|
425
|
+
N.log("#measureAndCacheHeight");
|
|
426
426
|
const e = t(this, P).get(".ng-container-body");
|
|
427
427
|
if (!e || e.length === 0) return 24;
|
|
428
428
|
const s = i.querySelector("tbody.bindable-tbody");
|
|
@@ -441,7 +441,7 @@ const Ie = class Ie {
|
|
|
441
441
|
}), u.forEach((g) => g.remove()), a.style.display = o, a.style.visibility = c, a.style.position = l, y(this, H, f > 0 ? f : 24), t(this, At).call(this), t(this, H);
|
|
442
442
|
}, "#measureAndCacheHeight"));
|
|
443
443
|
d(this, Et, /* @__PURE__ */ h(() => {
|
|
444
|
-
|
|
444
|
+
N.log("rowManager.#updateVirtualScrollHeight");
|
|
445
445
|
const e = (t(this, D).data.get() || []).length, s = t(this, H), r = e * s;
|
|
446
446
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
447
447
|
const a = t(this, S).querySelector(n);
|
|
@@ -500,7 +500,7 @@ const Ie = class Ie {
|
|
|
500
500
|
})), t(this, V).observe(t(this, S)));
|
|
501
501
|
}, "#initResizeObserver"));
|
|
502
502
|
d(this, Rt, /* @__PURE__ */ h(() => {
|
|
503
|
-
|
|
503
|
+
N.log("rowManager.#renderAllContainers"), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
504
504
|
const e = t(this, S).querySelector(i);
|
|
505
505
|
e && e.querySelector(".ng-part-body tbody.bindable-tbody") && t(this, Bt).call(this, e, i);
|
|
506
506
|
}), t(this, jt).call(this), t(this, Pt).call(this);
|
|
@@ -570,7 +570,7 @@ const Ie = class Ie {
|
|
|
570
570
|
}, "#bindRowData"));
|
|
571
571
|
d(this, jt, /* @__PURE__ */ h(() => {
|
|
572
572
|
var c, l, f;
|
|
573
|
-
|
|
573
|
+
N.log("rowManager.#syncHeaderHeights");
|
|
574
574
|
const i = t(this, S).querySelector(".ng-container-left .ng-part-header table"), e = t(this, S).querySelector(".ng-container-body .ng-part-header table"), s = t(this, S).querySelector(".ng-container-right .ng-part-header table");
|
|
575
575
|
if (!e) return;
|
|
576
576
|
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);
|
|
@@ -908,7 +908,7 @@ const mt = class mt extends HTMLElement {
|
|
|
908
908
|
t(this, Xt).call(this);
|
|
909
909
|
}
|
|
910
910
|
disconnectedCallback() {
|
|
911
|
-
this.innerHTML = "",
|
|
911
|
+
this.innerHTML = "", N.log("NineTableSheet destroyed.");
|
|
912
912
|
}
|
|
913
913
|
};
|
|
914
914
|
Vt = new WeakMap(), et = new WeakMap(), st = new WeakMap(), Yt = new WeakMap(), Ut = new WeakMap(), ht = new WeakMap(), Xt = new WeakMap(), Kt = new WeakMap(), h(mt, "NineTableSheet"), E(mt, "SCROLLBAR_SIZE", 16);
|
|
@@ -1108,18 +1108,18 @@ const We = class We {
|
|
|
1108
1108
|
};
|
|
1109
1109
|
Ct = new WeakMap(), dt = new WeakMap(), h(We, "ngRow");
|
|
1110
1110
|
let ge = We;
|
|
1111
|
-
var
|
|
1111
|
+
var I, k, _, ft, Qt, Y, te, it, Lt, ee, se, ut;
|
|
1112
1112
|
const O = class O {
|
|
1113
1113
|
constructor(i, e) {
|
|
1114
|
-
d(this,
|
|
1114
|
+
d(this, I);
|
|
1115
1115
|
d(this, k);
|
|
1116
|
-
d(this,
|
|
1116
|
+
d(this, _, []);
|
|
1117
1117
|
d(this, ft, []);
|
|
1118
1118
|
d(this, Qt, 0);
|
|
1119
1119
|
d(this, Y, []);
|
|
1120
1120
|
d(this, te, /* @__PURE__ */ h(() => {
|
|
1121
1121
|
y(this, Y, []);
|
|
1122
|
-
const i = t(this,
|
|
1122
|
+
const i = t(this, I).template || [];
|
|
1123
1123
|
Array.from(i).forEach((e) => {
|
|
1124
1124
|
var s;
|
|
1125
1125
|
t(this, Y).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
@@ -1128,7 +1128,7 @@ const O = class O {
|
|
|
1128
1128
|
});
|
|
1129
1129
|
}, "#initialize"));
|
|
1130
1130
|
d(this, it, /* @__PURE__ */ h(() => {
|
|
1131
|
-
t(this,
|
|
1131
|
+
t(this, I).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1132
1132
|
i.invalidate();
|
|
1133
1133
|
});
|
|
1134
1134
|
}, "#invalidate"));
|
|
@@ -1138,7 +1138,7 @@ const O = class O {
|
|
|
1138
1138
|
if (!s || s.length <= 0) return;
|
|
1139
1139
|
if (i == null) return t(this, ut).call(this, s);
|
|
1140
1140
|
if (i < 0 || i >= s.length) return null;
|
|
1141
|
-
const r = typeof ((n = t(this,
|
|
1141
|
+
const r = typeof ((n = t(this, I).fields) == null ? void 0 : n.get) == "function" ? t(this, I).fields.get() : [];
|
|
1142
1142
|
if (e != null) {
|
|
1143
1143
|
const a = r.indexOf(e);
|
|
1144
1144
|
return a >= 0 ? s[i].v[a] : null;
|
|
@@ -1158,16 +1158,16 @@ const O = class O {
|
|
|
1158
1158
|
_: [0, 0, 0, 0, O.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, Y).slice(), -1, {}, {}]
|
|
1159
1159
|
}), "#getDefaultMeta"));
|
|
1160
1160
|
E(this, "reset", /* @__PURE__ */ h(() => {
|
|
1161
|
-
y(this,
|
|
1161
|
+
y(this, _, []), y(this, ft, []), t(this, it).call(this);
|
|
1162
1162
|
}, "reset"));
|
|
1163
1163
|
E(this, "clear", /* @__PURE__ */ h(() => {
|
|
1164
1164
|
var i;
|
|
1165
|
-
t(this, k).rawRecords = [], y(this,
|
|
1165
|
+
t(this, k).rawRecords = [], y(this, _, []), y(this, ft, []), (i = t(this, k).viewRecords) != null && i.reset && t(this, k).viewRecords.reset();
|
|
1166
1166
|
}, "clear"));
|
|
1167
1167
|
d(this, ee, /* @__PURE__ */ h((i) => {
|
|
1168
1168
|
var r;
|
|
1169
1169
|
Array.isArray(i) || (i = [i]);
|
|
1170
|
-
const e = typeof ((r = t(this,
|
|
1170
|
+
const e = typeof ((r = t(this, I).fields) == null ? void 0 : r.get) == "function" ? t(this, I).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1171
1171
|
return i.forEach((n) => {
|
|
1172
1172
|
const a = { v: [] };
|
|
1173
1173
|
e.forEach((o) => {
|
|
@@ -1191,9 +1191,9 @@ const O = class O {
|
|
|
1191
1191
|
E(this, "delete", /* @__PURE__ */ h((i) => {
|
|
1192
1192
|
let e = [];
|
|
1193
1193
|
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, k).host.row.at] : e = [parseInt(i, 10)], e.sort((s, r) => r - s).forEach((s) => {
|
|
1194
|
-
if (t(this,
|
|
1195
|
-
const r = t(this,
|
|
1196
|
-
t(this,
|
|
1194
|
+
if (t(this, _)[s]) {
|
|
1195
|
+
const r = t(this, _)[s].__ng.rowid;
|
|
1196
|
+
t(this, _)[s].__ng.rowState === O.ROW_STATE.INSERT ? t(this, k).rawRecords = t(this, k).rawRecords.filter((n) => n.__ng.rowid !== r) : t(this, k).rawRecords.forEach((n) => {
|
|
1197
1197
|
n.__ng.rowid === r && (n.__ng.deleted = !0, n.__ng.rowState = O.ROW_STATE.DELETE);
|
|
1198
1198
|
});
|
|
1199
1199
|
}
|
|
@@ -1202,7 +1202,7 @@ const O = class O {
|
|
|
1202
1202
|
E(this, "setValue", /* @__PURE__ */ h((i, e, s) => {
|
|
1203
1203
|
var c;
|
|
1204
1204
|
i = parseInt(i, 10);
|
|
1205
|
-
const n = (typeof ((c = t(this,
|
|
1205
|
+
const n = (typeof ((c = t(this, I).fields) == null ? void 0 : c.get) == "function" ? t(this, I).fields.get() : []).indexOf(e);
|
|
1206
1206
|
if (n < 0) return;
|
|
1207
1207
|
const a = this.getValidData()[i];
|
|
1208
1208
|
if (!a) return;
|
|
@@ -1210,17 +1210,17 @@ const O = class O {
|
|
|
1210
1210
|
o !== s && a.__ng.rowState !== O.ROW_STATE.INSERT && (a.__ng.o.hasOwnProperty(e) || (a.__ng.o[e] = o), a.__ng.rowState = O.ROW_STATE.UPDATE), a.v[n] = s;
|
|
1211
1211
|
}, "setValue"));
|
|
1212
1212
|
E(this, "resetRecords", /* @__PURE__ */ h(() => {
|
|
1213
|
-
y(this, ft, t(this, k).rawRecords.filter((i) => !i.__ng.deleted)), y(this,
|
|
1213
|
+
y(this, ft, t(this, k).rawRecords.filter((i) => !i.__ng.deleted)), y(this, _, t(this, k).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, k).rawRecords.forEach((i, e) => {
|
|
1214
1214
|
i.__ng.rowidx = e;
|
|
1215
|
-
}), t(this,
|
|
1215
|
+
}), t(this, _).forEach((i, e) => {
|
|
1216
1216
|
i.__ng.i = e;
|
|
1217
1217
|
});
|
|
1218
1218
|
}, "resetRecords"));
|
|
1219
|
-
E(this, "getValidData", /* @__PURE__ */ h(() => (t(this,
|
|
1219
|
+
E(this, "getValidData", /* @__PURE__ */ h(() => (t(this, _).length === 0 && t(this, k).rawRecords.length > 0 && this.resetRecords(), t(this, _)), "getValidData"));
|
|
1220
1220
|
d(this, ut, /* @__PURE__ */ h((i) => {
|
|
1221
1221
|
var a;
|
|
1222
1222
|
if (!i) return i;
|
|
1223
|
-
const e = !Array.isArray(i), s = e ? [i] : i, r = typeof ((a = t(this,
|
|
1223
|
+
const e = !Array.isArray(i), s = e ? [i] : i, r = typeof ((a = t(this, I).fields) == null ? void 0 : a.get) == "function" ? t(this, I).fields.get() : [], n = s.filter((o) => !o.__ng.deleted).map((o) => {
|
|
1224
1224
|
const c = {};
|
|
1225
1225
|
return r.forEach((l, f) => {
|
|
1226
1226
|
c[l] = o.v ? o.v[f] : o[l];
|
|
@@ -1229,7 +1229,7 @@ const O = class O {
|
|
|
1229
1229
|
return e ? n[0] : n;
|
|
1230
1230
|
}, "#conv"));
|
|
1231
1231
|
E(this, "count", /* @__PURE__ */ h(() => this.getValidData().length, "count"));
|
|
1232
|
-
y(this,
|
|
1232
|
+
y(this, I, i), y(this, k, e), t(this, te).call(this);
|
|
1233
1233
|
}
|
|
1234
1234
|
get source() {
|
|
1235
1235
|
return t(this, ut).call(this, t(this, k).rawRecords);
|
|
@@ -1241,16 +1241,16 @@ const O = class O {
|
|
|
1241
1241
|
return ++Ue(this, Qt)._;
|
|
1242
1242
|
}
|
|
1243
1243
|
get count() {
|
|
1244
|
-
return t(this,
|
|
1244
|
+
return t(this, _).length;
|
|
1245
1245
|
}
|
|
1246
1246
|
get length() {
|
|
1247
|
-
return t(this,
|
|
1247
|
+
return t(this, _).length;
|
|
1248
1248
|
}
|
|
1249
1249
|
getRowCount() {
|
|
1250
1250
|
return this.length;
|
|
1251
1251
|
}
|
|
1252
1252
|
};
|
|
1253
|
-
|
|
1253
|
+
I = new WeakMap(), k = new WeakMap(), _ = new WeakMap(), ft = new WeakMap(), Qt = new WeakMap(), Y = new WeakMap(), te = new WeakMap(), it = new WeakMap(), Lt = new WeakMap(), ee = new WeakMap(), se = new WeakMap(), ut = new WeakMap(), h(O, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1254
1254
|
E(O, "ROW_STATE", {
|
|
1255
1255
|
EMPTY: "EMPTY",
|
|
1256
1256
|
NORMAL: "NORMAL",
|
|
@@ -1300,11 +1300,11 @@ const Be = class Be {
|
|
|
1300
1300
|
}), y(this, L, Array.from(i, ([e, s]) => ({ name: e, type: s }))), y(this, L, t(this, L).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, L).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1301
1301
|
}, "#adjust"));
|
|
1302
1302
|
d(this, ie, /* @__PURE__ */ h(() => {
|
|
1303
|
-
y(this, L, []),
|
|
1303
|
+
y(this, L, []), N.log(t(this, gt).querySelectorAll("table"));
|
|
1304
1304
|
const i = Array.from(t(this, gt).querySelectorAll("table"));
|
|
1305
1305
|
if (!(!i || i.length === 0)) {
|
|
1306
1306
|
for (const e of i)
|
|
1307
|
-
|
|
1307
|
+
N.log(e), $("[data-bind]", e).each((s, r) => {
|
|
1308
1308
|
const n = r.dataset.bind, a = r.getAttribute("data-type") || "string";
|
|
1309
1309
|
n && t(this, L).push({ name: n, type: a });
|
|
1310
1310
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1363,7 +1363,7 @@ const ze = class ze extends HTMLElement {
|
|
|
1363
1363
|
d(this, nt);
|
|
1364
1364
|
d(this, re);
|
|
1365
1365
|
d(this, ne, /* @__PURE__ */ h(() => {
|
|
1366
|
-
this.fields = new pe(this), y(this, re, new ue(this)),
|
|
1366
|
+
this.fields = new pe(this), y(this, re, new ue(this)), N.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1367
1367
|
}, "#init"));
|
|
1368
1368
|
this.attachShadow({ mode: "open" }), y(this, nt, new ye(this));
|
|
1369
1369
|
}
|
|
@@ -1371,7 +1371,7 @@ const ze = class ze extends HTMLElement {
|
|
|
1371
1371
|
t(this, ne).call(this);
|
|
1372
1372
|
}
|
|
1373
1373
|
disconnectedCallback() {
|
|
1374
|
-
|
|
1374
|
+
N.log("NineTable disconnected.");
|
|
1375
1375
|
}
|
|
1376
1376
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1377
1377
|
get data() {
|
|
@@ -1525,7 +1525,7 @@ const je = class je extends we {
|
|
|
1525
1525
|
d(this, U);
|
|
1526
1526
|
E(this, "refresh", /* @__PURE__ */ h(() => {
|
|
1527
1527
|
const e = super.refresh();
|
|
1528
|
-
|
|
1528
|
+
t(this, $t).value = e;
|
|
1529
1529
|
}, "refresh"));
|
|
1530
1530
|
/**
|
|
1531
1531
|
dataRefresh = (v) => {
|