@ninebone/table 0.0.517 β 0.0.519
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 -25
- 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 Le = class Le extends Xe.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
h(Le, "Trace");
|
|
24
24
|
let oe = Le;
|
|
25
|
-
const
|
|
25
|
+
const W = new oe();
|
|
26
26
|
var z, j, w, X, K, Z, It, G, _t;
|
|
27
27
|
const He = class He extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
@@ -213,7 +213,7 @@ const Me = class Me extends HTMLElement {
|
|
|
213
213
|
d(this, vt, 0);
|
|
214
214
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
215
215
|
if (!t(this, F) || !t(this, q)) return;
|
|
216
|
-
|
|
216
|
+
W.log("nine-table-vscrollbar.refresh");
|
|
217
217
|
const e = t(this, q).container, s = t(this, q).track, r = t(this, q).thumb, n = e.clientHeight, a = (t(this, F).data.get() || []).length, c = t(this, ot).getRowHeight(), l = a * c;
|
|
218
218
|
if (l <= n) {
|
|
219
219
|
r.style.display = "none", t(this, q).top.disabled = !0, t(this, q).bottom.disabled = !0;
|
|
@@ -231,7 +231,7 @@ const Me = class Me extends HTMLElement {
|
|
|
231
231
|
m < 0 && (m = 0), m > v && (m = v), r.style.top = `${m}px`, t(this, q).top.disabled = b <= 0, t(this, q).bottom.disabled = b >= g - 1;
|
|
232
232
|
}, "refresh"));
|
|
233
233
|
d(this, Nt, /* @__PURE__ */ h(() => {
|
|
234
|
-
|
|
234
|
+
W.log("nine-table-vscrollbar.#init");
|
|
235
235
|
const e = t(this, q).container, s = /* @__PURE__ */ h(() => {
|
|
236
236
|
const n = (t(this, F).data.get() || []).length, o = t(this, ot).getRowHeight();
|
|
237
237
|
return n * o;
|
|
@@ -369,12 +369,12 @@ const $e = class $e {
|
|
|
369
369
|
d(this, at, !1);
|
|
370
370
|
d(this, Wt, 3);
|
|
371
371
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
372
|
-
|
|
372
|
+
W.log("rowManager.refresh");
|
|
373
373
|
const i = t(this, S).querySelector(".ng-container-body .ng-part-body");
|
|
374
374
|
i && (t(this, St).call(this), t(this, lt).call(this, i.scrollTop));
|
|
375
375
|
}, "refresh"));
|
|
376
376
|
A(this, "initialize", /* @__PURE__ */ h(() => {
|
|
377
|
-
y(this, M, null), t(this, D).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
377
|
+
W.log("rowManager.initialize"), y(this, M, null), t(this, D).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
378
378
|
const a = t(this, S).querySelector(o);
|
|
379
379
|
if (!a) return;
|
|
380
380
|
const c = a.querySelector(".ng-part-body table");
|
|
@@ -417,7 +417,7 @@ const $e = class $e {
|
|
|
417
417
|
d(this, Bt, /* @__PURE__ */ h((i) => {
|
|
418
418
|
if (t(this, M) !== null && t(this, M) > 0)
|
|
419
419
|
return t(this, M);
|
|
420
|
-
|
|
420
|
+
W.log("#measureAndCacheHeight");
|
|
421
421
|
const e = t(this, D).get(".ng-container-body");
|
|
422
422
|
if (!e || e.length === 0) return 24;
|
|
423
423
|
const s = i.querySelector("tbody.bindable-tbody");
|
|
@@ -528,7 +528,7 @@ const $e = class $e {
|
|
|
528
528
|
if (!g) return;
|
|
529
529
|
const m = g.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
530
530
|
m && (m.style.transform = `translateY(${o}px)`);
|
|
531
|
-
}),
|
|
531
|
+
}), W.log("#handleScroll", f, n), f !== n && [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((b) => {
|
|
532
532
|
const g = t(this, S).querySelector(b);
|
|
533
533
|
if (!g) return;
|
|
534
534
|
const m = g.querySelector(".ng-part-body tbody.bindable-tbody");
|
|
@@ -559,7 +559,7 @@ const $e = class $e {
|
|
|
559
559
|
});
|
|
560
560
|
}; */
|
|
561
561
|
d(this, Rt, /* @__PURE__ */ h((i, e, s) => {
|
|
562
|
-
i.dataset.row = s, i.data = e,
|
|
562
|
+
i.dataset.row = s, i.data = e, W.log(e, s), Array.from(i.cells).forEach((r, n) => {
|
|
563
563
|
r.dataset.row = s;
|
|
564
564
|
const o = Array.from(r.children).find((a) => a.tagName.toLowerCase().startsWith("cell-") || typeof a.refresh == "function");
|
|
565
565
|
o && typeof o.refresh == "function" && o.refresh();
|
|
@@ -898,7 +898,7 @@ const pt = class pt extends HTMLElement {
|
|
|
898
898
|
t(this, Ut).call(this);
|
|
899
899
|
}
|
|
900
900
|
disconnectedCallback() {
|
|
901
|
-
this.innerHTML = "",
|
|
901
|
+
this.innerHTML = "", W.log("NineTableSheet destroyed.");
|
|
902
902
|
}
|
|
903
903
|
};
|
|
904
904
|
Ft = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap(), ct = new WeakMap(), Ut = new WeakMap(), Xt = new WeakMap(), h(pt, "NineTableSheet"), A(pt, "SCROLLBAR_SIZE", 16);
|
|
@@ -1099,7 +1099,7 @@ const Ne = class Ne {
|
|
|
1099
1099
|
Tt = new WeakMap(), ht = new WeakMap(), h(Ne, "ngRow");
|
|
1100
1100
|
let ue = Ne;
|
|
1101
1101
|
var _, T, N, dt, Jt, Y, Qt, st, Ct, te, ee, ft;
|
|
1102
|
-
const
|
|
1102
|
+
const O = class O {
|
|
1103
1103
|
constructor(i, e) {
|
|
1104
1104
|
d(this, _);
|
|
1105
1105
|
d(this, T);
|
|
@@ -1139,13 +1139,13 @@ const W = class W {
|
|
|
1139
1139
|
this.clear(), this.add(i, !1), t(this, st).call(this);
|
|
1140
1140
|
}, "set"));
|
|
1141
1141
|
d(this, Ct, /* @__PURE__ */ h(() => ({
|
|
1142
|
-
rowState:
|
|
1142
|
+
rowState: O.ROW_STATE.EMPTY,
|
|
1143
1143
|
deleted: !1,
|
|
1144
1144
|
filtered: !1,
|
|
1145
1145
|
height: t(this, Y).slice(),
|
|
1146
1146
|
o: {},
|
|
1147
1147
|
c: {},
|
|
1148
|
-
_: [0, 0, 0, 0,
|
|
1148
|
+
_: [0, 0, 0, 0, O.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, Y).slice(), -1, {}, {}]
|
|
1149
1149
|
}), "#getDefaultMeta"));
|
|
1150
1150
|
A(this, "reset", /* @__PURE__ */ h(() => {
|
|
1151
1151
|
y(this, N, []), y(this, dt, []), t(this, st).call(this);
|
|
@@ -1166,7 +1166,7 @@ const W = class W {
|
|
|
1166
1166
|
}), s;
|
|
1167
1167
|
}, "#json2Array"));
|
|
1168
1168
|
d(this, ee, /* @__PURE__ */ h((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1169
|
-
e.__ng = t(this, Ct).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState =
|
|
1169
|
+
e.__ng = t(this, Ct).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = O.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1170
1170
|
}), i), "#defaultInsert"));
|
|
1171
1171
|
A(this, "add", /* @__PURE__ */ h((i, e = !0) => {
|
|
1172
1172
|
i === void 0 && (i = {});
|
|
@@ -1175,7 +1175,7 @@ const W = class W {
|
|
|
1175
1175
|
const r = this.count() - 1;
|
|
1176
1176
|
return e || s.forEach((n, o) => {
|
|
1177
1177
|
const a = t(this, T).rawRecords[r - o];
|
|
1178
|
-
a && (a.__ng.rowState =
|
|
1178
|
+
a && (a.__ng.rowState = O.ROW_STATE.EMPTY);
|
|
1179
1179
|
}), t(this, st).call(this), r;
|
|
1180
1180
|
}, "add"));
|
|
1181
1181
|
A(this, "delete", /* @__PURE__ */ h((i) => {
|
|
@@ -1183,8 +1183,8 @@ const W = class W {
|
|
|
1183
1183
|
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, T).host.row.at] : e = [parseInt(i, 10)], e.sort((s, r) => r - s).forEach((s) => {
|
|
1184
1184
|
if (t(this, N)[s]) {
|
|
1185
1185
|
const r = t(this, N)[s].__ng.rowid;
|
|
1186
|
-
t(this, N)[s].__ng.rowState ===
|
|
1187
|
-
n.__ng.rowid === r && (n.__ng.deleted = !0, n.__ng.rowState =
|
|
1186
|
+
t(this, N)[s].__ng.rowState === O.ROW_STATE.INSERT ? t(this, T).rawRecords = t(this, T).rawRecords.filter((n) => n.__ng.rowid !== r) : t(this, T).rawRecords.forEach((n) => {
|
|
1187
|
+
n.__ng.rowid === r && (n.__ng.deleted = !0, n.__ng.rowState = O.ROW_STATE.DELETE);
|
|
1188
1188
|
});
|
|
1189
1189
|
}
|
|
1190
1190
|
}), this.resetRecords(), t(this, st).call(this);
|
|
@@ -1197,7 +1197,7 @@ const W = class W {
|
|
|
1197
1197
|
const o = this.getValidData()[i];
|
|
1198
1198
|
if (!o) return;
|
|
1199
1199
|
const a = o.v[n];
|
|
1200
|
-
a !== s && o.__ng.rowState !==
|
|
1200
|
+
a !== s && o.__ng.rowState !== O.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = a), o.__ng.rowState = O.ROW_STATE.UPDATE), o.v[n] = s;
|
|
1201
1201
|
}, "setValue"));
|
|
1202
1202
|
A(this, "resetRecords", /* @__PURE__ */ h(() => {
|
|
1203
1203
|
y(this, dt, t(this, T).rawRecords.filter((i) => !i.__ng.deleted)), y(this, N, t(this, T).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, T).rawRecords.forEach((i, e) => {
|
|
@@ -1237,15 +1237,15 @@ const W = class W {
|
|
|
1237
1237
|
return this.length;
|
|
1238
1238
|
}
|
|
1239
1239
|
};
|
|
1240
|
-
_ = new WeakMap(), T = new WeakMap(), N = new WeakMap(), dt = new WeakMap(), Jt = new WeakMap(), Y = new WeakMap(), Qt = new WeakMap(), st = new WeakMap(), Ct = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ft = new WeakMap(), h(
|
|
1241
|
-
A(
|
|
1240
|
+
_ = new WeakMap(), T = new WeakMap(), N = new WeakMap(), dt = new WeakMap(), Jt = new WeakMap(), Y = new WeakMap(), Qt = new WeakMap(), st = new WeakMap(), Ct = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ft = new WeakMap(), h(O, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1241
|
+
A(O, "ROW_STATE", {
|
|
1242
1242
|
EMPTY: "EMPTY",
|
|
1243
1243
|
NORMAL: "NORMAL",
|
|
1244
1244
|
INSERT: "INSERT",
|
|
1245
1245
|
UPDATE: "UPDATE",
|
|
1246
1246
|
DELETE: "DELETE"
|
|
1247
1247
|
});
|
|
1248
|
-
let ge =
|
|
1248
|
+
let ge = O;
|
|
1249
1249
|
var it;
|
|
1250
1250
|
const We = class We {
|
|
1251
1251
|
constructor(i) {
|
|
@@ -1287,11 +1287,11 @@ const Oe = class Oe {
|
|
|
1287
1287
|
}), 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);
|
|
1288
1288
|
}, "#adjust"));
|
|
1289
1289
|
d(this, se, /* @__PURE__ */ h(() => {
|
|
1290
|
-
y(this, L, []),
|
|
1290
|
+
y(this, L, []), W.log(t(this, ut).querySelectorAll("table"));
|
|
1291
1291
|
const i = Array.from(t(this, ut).querySelectorAll("table"));
|
|
1292
1292
|
if (!(!i || i.length === 0)) {
|
|
1293
1293
|
for (const e of i)
|
|
1294
|
-
|
|
1294
|
+
W.log(e), $("[data-bind]", e).each((s, r) => {
|
|
1295
1295
|
const n = r.dataset.bind, o = r.getAttribute("data-type") || "string";
|
|
1296
1296
|
n && t(this, L).push({ name: n, type: o });
|
|
1297
1297
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1350,7 +1350,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1350
1350
|
d(this, rt);
|
|
1351
1351
|
d(this, ie);
|
|
1352
1352
|
d(this, re, /* @__PURE__ */ h(() => {
|
|
1353
|
-
this.fields = new ye(this), y(this, ie, new fe(this)),
|
|
1353
|
+
this.fields = new ye(this), y(this, ie, new fe(this)), W.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1354
1354
|
}, "#init"));
|
|
1355
1355
|
this.attachShadow({ mode: "open" }), y(this, rt, new be(this));
|
|
1356
1356
|
}
|
|
@@ -1358,7 +1358,7 @@ const Be = class Be extends HTMLElement {
|
|
|
1358
1358
|
t(this, re).call(this);
|
|
1359
1359
|
}
|
|
1360
1360
|
disconnectedCallback() {
|
|
1361
|
-
|
|
1361
|
+
W.log("NineTable disconnected.");
|
|
1362
1362
|
}
|
|
1363
1363
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1364
1364
|
get data() {
|
|
@@ -1512,7 +1512,7 @@ const Pe = class Pe extends ve {
|
|
|
1512
1512
|
d(this, U);
|
|
1513
1513
|
A(this, "refresh", /* @__PURE__ */ h(() => {
|
|
1514
1514
|
const e = super.refresh();
|
|
1515
|
-
|
|
1515
|
+
W.log("::", e), t(this, Mt).value = e;
|
|
1516
1516
|
}, "refresh"));
|
|
1517
1517
|
/**
|
|
1518
1518
|
dataRefresh = (v) => {
|