@ninebone/table 0.0.307 β†’ 0.0.308

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.
@@ -22,7 +22,7 @@ const Vt = class Vt extends re.constructor {
22
22
  };
23
23
  a(Vt, "Trace");
24
24
  let $t = Vt;
25
- const H = new $t();
25
+ const A = new $t();
26
26
  var M, _, y, P, B, N, dt, Y, ft;
27
27
  const Xt = class Xt extends HTMLElement {
28
28
  constructor() {
@@ -59,7 +59,7 @@ const Xt = class Xt extends HTMLElement {
59
59
  let p = 0;
60
60
  g > 0 && (p = parseInt(f / g * (c - u), 10)), p < 0 && (p = 0);
61
61
  const E = c - u;
62
- p > E && (p = E), o.style.left = `${p}px`, H.log(p), t(this, y).left.disabled = p === 0, t(this, y).right.disabled = p >= E - 1;
62
+ p > E && (p = E), o.style.left = `${p}px`, A.log(p), t(this, y).left.disabled = p === 0, t(this, y).right.disabled = p >= E - 1;
63
63
  }, "refresh"));
64
64
  d(this, Y, /* @__PURE__ */ a((e) => {
65
65
  if (!t(this, y)) return !1;
@@ -242,7 +242,9 @@ const Ut = class Ut extends HTMLElement {
242
242
  n.stopPropagation(), n.preventDefault(), b(this, I, !0), b(this, it, n.clientY), b(this, st, e.scrollTop);
243
243
  const o = /* @__PURE__ */ a((l) => {
244
244
  if (!t(this, I)) return;
245
- const h = t(this, S).track.getBoundingClientRect(), c = t(this, S).thumb.clientHeight, f = h.height - c, g = l.clientY - t(this, it), p = e.clientHeight, k = s.scrollHeight - p;
245
+ const h = t(this, S).track.getBoundingClientRect(), c = t(this, S).thumb.clientHeight, f = h.height - c, g = l.clientY - t(this, it), p = e.clientHeight;
246
+ A.log(s), A.log(s.scrollHeight);
247
+ const k = s.scrollHeight - p;
246
248
  if (f > 0 && k > 0) {
247
249
  const D = g / f * k;
248
250
  e.scrollTop = t(this, st) + D;
@@ -463,7 +465,7 @@ const Kt = class Kt {
463
465
  i.addEventListener("scroll", () => {
464
466
  var n;
465
467
  const s = i.scrollTop;
466
- H.log(e, s), e !== s && (e = s, t(this, Z).call(this, s)), (n = t(this, m).querySelector("nine-table-vscrollbar")) == null || n.refresh();
468
+ A.log(e, s), e !== s && (e = s, t(this, Z).call(this, s)), (n = t(this, m).querySelector("nine-table-vscrollbar")) == null || n.refresh();
467
469
  });
468
470
  }
469
471
  }, "initialize"));
@@ -501,7 +503,7 @@ const Kt = class Kt {
501
503
  const f = s.querySelectorAll("tr:not(.nodata)");
502
504
  return f.forEach((g) => {
503
505
  u += g.offsetHeight || g.getBoundingClientRect().height;
504
- }), f.forEach((g) => g.remove()), r.style.display = l, r.style.visibility = h, r.style.position = c, b(this, R, u > 0 ? u : 24), t(this, ot).call(this), H.log(`[RowManager] Height Cached: ${t(this, R)}px | RowCount: ${t(this, U)}`), t(this, R);
506
+ }), f.forEach((g) => g.remove()), r.style.display = l, r.style.visibility = h, r.style.position = c, b(this, R, u > 0 ? u : 24), t(this, ot).call(this), A.log(`[RowManager] Height Cached: ${t(this, R)}px | RowCount: ${t(this, U)}`), t(this, R);
505
507
  }, "#measureAndCacheHeight"));
506
508
  /**
507
509
  * 🎯 전체 데이터 개수 기반으둜 가상 슀크둀 높이 μ„€μ •
@@ -513,9 +515,9 @@ const Kt = class Kt {
513
515
  var o, r, l, h;
514
516
  if (!t(this, m).querySelector(".ng-container-body")) return;
515
517
  const e = (typeof ((o = t(this, m).data) == null ? void 0 : o.count) == "function" ? t(this, m).data.count() : null) ?? ((l = (r = t(this, m).dataManager) == null ? void 0 : r.rawRecords) == null ? void 0 : l.length) ?? ((h = t(this, m).data) == null ? void 0 : h.length) ?? 0, s = t(this, R) || 24, n = e * s;
516
- H.log(`[RowManager] TotalCount: ${e} | RowHeight: ${s}px | TotalVirtualHeight: ${n}px`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((c) => {
518
+ A.log(`[RowManager] TotalCount: ${e} | RowHeight: ${s}px | TotalVirtualHeight: ${n}px`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((c) => {
517
519
  const u = t(this, m).querySelector(c), f = u == null ? void 0 : u.querySelector("table");
518
- f ? (f.style.height = `${n}px`, H.log(`[RowManager] Applied height to ${c} table:`, f.style.height)) : H.log(`[RowManager] Table not found for selector: ${c}`);
520
+ f ? (f.style.height = `${n}px`, A.log(`[RowManager] Applied height to ${c} table:`, f.style.height)) : A.log(`[RowManager] Table not found for selector: ${c}`);
519
521
  });
520
522
  }, "#updateVirtualScrollHeight"));
521
523
  d(this, ot, /* @__PURE__ */ a(() => {
@@ -580,18 +582,18 @@ const Kt = class Kt {
580
582
  var r;
581
583
  const e = t(this, R);
582
584
  if (!e || e <= 0) {
583
- H.log("[RowManager] #handleScroll Aborted: rowHeight is invalid", e);
585
+ A.log("[RowManager] #handleScroll Aborted: rowHeight is invalid", e);
584
586
  return;
585
587
  }
586
588
  const s = Math.max(0, Math.floor(i / e)), n = i % e;
587
- H.log(`[RowManager] ScrollTop: ${i} | StartIndex: ${s} | OffsetY: ${n}px`);
589
+ A.log(`[RowManager] ScrollTop: ${i} | StartIndex: ${s} | OffsetY: ${n}px`);
588
590
  const o = ((r = t(this, $).get(".ng-container-body")) == null ? void 0 : r.length) || 1;
589
591
  [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((l) => {
590
592
  const h = t(this, m).querySelector(l);
591
593
  if (!h) return;
592
594
  const c = h.querySelector("tbody");
593
595
  if (!c) {
594
- H.log(`[RowManager] tbody not found for selector: ${l}`);
596
+ A.log(`[RowManager] tbody not found for selector: ${l}`);
595
597
  return;
596
598
  }
597
599
  window.getComputedStyle(c).position === "static" && (c.style.position = "relative"), c.style.transform = `translateY(-${n}px)`, c.style.willChange = "transform", Array.from(c.querySelectorAll("tr:not(.nodata)")).forEach((f, g) => {
@@ -828,7 +830,7 @@ const et = class et extends HTMLElement {
828
830
  t(this, Et).call(this);
829
831
  }
830
832
  disconnectedCallback() {
831
- this.innerHTML = "", H.log("NineTableSheet destroyed.");
833
+ this.innerHTML = "", A.log("NineTableSheet destroyed.");
832
834
  }
833
835
  };
834
836
  G = new WeakMap(), J = new WeakMap(), vt = new WeakMap(), wt = new WeakMap(), St = new WeakMap(), Et = new WeakMap(), Rt = new WeakMap(), a(et, "NineTableSheet"), w(et, "SCROLLBAR_SIZE", 16);
@@ -1041,18 +1043,18 @@ const Zt = class Zt {
1041
1043
  };
1042
1044
  O = new WeakMap(), K = new WeakMap(), a(Zt, "ngRow");
1043
1045
  let Pt = Zt;
1044
- var A, v, q, Q, qt, z, Lt, ct, Ht, Ct, tt;
1045
- const L = class L {
1046
+ var q, v, L, Q, qt, z, Lt, ct, Ht, Ct, tt;
1047
+ const H = class H {
1046
1048
  constructor(i, e) {
1047
- d(this, A);
1049
+ d(this, q);
1048
1050
  d(this, v);
1049
- d(this, q, []);
1051
+ d(this, L, []);
1050
1052
  d(this, Q, []);
1051
1053
  d(this, qt, 0);
1052
1054
  d(this, z, []);
1053
1055
  d(this, Lt, /* @__PURE__ */ a(() => {
1054
1056
  b(this, z, []);
1055
- const i = t(this, A).template || [];
1057
+ const i = t(this, q).template || [];
1056
1058
  Array.from(i).forEach((e) => {
1057
1059
  var s;
1058
1060
  t(this, z).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
@@ -1064,25 +1066,25 @@ const L = class L {
1064
1066
  this.clear(), this.add(i, !1);
1065
1067
  }, "set"));
1066
1068
  d(this, ct, /* @__PURE__ */ a(() => ({
1067
- rowState: L.ROW_STATE.EMPTY,
1069
+ rowState: H.ROW_STATE.EMPTY,
1068
1070
  deleted: !1,
1069
1071
  filtered: !1,
1070
1072
  height: t(this, z).slice(),
1071
1073
  o: {},
1072
1074
  c: {},
1073
- _: [0, 0, 0, 0, L.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, z).slice(), -1, {}, {}]
1075
+ _: [0, 0, 0, 0, H.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, z).slice(), -1, {}, {}]
1074
1076
  }), "#getDefaultMeta"));
1075
1077
  w(this, "reset", /* @__PURE__ */ a(() => {
1076
- b(this, q, []), b(this, Q, []);
1078
+ b(this, L, []), b(this, Q, []);
1077
1079
  }, "reset"));
1078
1080
  w(this, "clear", /* @__PURE__ */ a(() => {
1079
1081
  var i;
1080
- t(this, v).rawRecords = [], b(this, q, []), b(this, Q, []), (i = t(this, v).viewRecords) != null && i.reset && t(this, v).viewRecords.reset();
1082
+ t(this, v).rawRecords = [], b(this, L, []), b(this, Q, []), (i = t(this, v).viewRecords) != null && i.reset && t(this, v).viewRecords.reset();
1081
1083
  }, "clear"));
1082
1084
  d(this, Ht, /* @__PURE__ */ a((i) => {
1083
1085
  var n;
1084
1086
  Array.isArray(i) || (i = [i]);
1085
- const e = typeof ((n = t(this, A).fields) == null ? void 0 : n.get) == "function" ? t(this, A).fields.get() : Object.keys(i[0] || {}), s = [];
1087
+ const e = typeof ((n = t(this, q).fields) == null ? void 0 : n.get) == "function" ? t(this, q).fields.get() : Object.keys(i[0] || {}), s = [];
1086
1088
  return i.forEach((o) => {
1087
1089
  const r = { v: [] };
1088
1090
  e.forEach((l) => {
@@ -1091,7 +1093,7 @@ const L = class L {
1091
1093
  }), s;
1092
1094
  }, "#json2Array"));
1093
1095
  d(this, Ct, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
1094
- e.__ng = t(this, ct).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = L.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
1096
+ e.__ng = t(this, ct).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = H.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
1095
1097
  }), i), "#defaultInsert"));
1096
1098
  w(this, "add", /* @__PURE__ */ a((i, e = !0) => {
1097
1099
  var o;
@@ -1101,17 +1103,17 @@ const L = class L {
1101
1103
  const n = this.count() - 1;
1102
1104
  return e || s.forEach((r, l) => {
1103
1105
  const h = t(this, v).rawRecords[n - l];
1104
- h && (h.__ng.rowState = L.ROW_STATE.EMPTY);
1106
+ h && (h.__ng.rowState = H.ROW_STATE.EMPTY);
1105
1107
  }), (o = t(this, v).viewRecords) != null && o.reset && t(this, v).viewRecords.reset(), n;
1106
1108
  }, "add"));
1107
1109
  w(this, "delete", /* @__PURE__ */ a((i) => {
1108
1110
  var s;
1109
1111
  let e = [];
1110
1112
  Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, v).owner.row.at] : e = [parseInt(i, 10)], e.sort((n, o) => o - n).forEach((n) => {
1111
- if (t(this, q)[n]) {
1112
- const o = t(this, q)[n].__ng.rowid;
1113
- t(this, q)[n].__ng.rowState === L.ROW_STATE.INSERT ? t(this, v).rawRecords = t(this, v).rawRecords.filter((r) => r.__ng.rowid !== o) : t(this, v).rawRecords.forEach((r) => {
1114
- r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = L.ROW_STATE.DELETE);
1113
+ if (t(this, L)[n]) {
1114
+ const o = t(this, L)[n].__ng.rowid;
1115
+ t(this, L)[n].__ng.rowState === H.ROW_STATE.INSERT ? t(this, v).rawRecords = t(this, v).rawRecords.filter((r) => r.__ng.rowid !== o) : t(this, v).rawRecords.forEach((r) => {
1116
+ r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = H.ROW_STATE.DELETE);
1115
1117
  });
1116
1118
  }
1117
1119
  }), this.resetRecords(), (s = t(this, v).viewRecords) != null && s.reset && t(this, v).viewRecords.reset();
@@ -1119,25 +1121,25 @@ const L = class L {
1119
1121
  w(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
1120
1122
  var h;
1121
1123
  i = parseInt(i, 10);
1122
- const o = (typeof ((h = t(this, A).fields) == null ? void 0 : h.get) == "function" ? t(this, A).fields.get() : []).indexOf(e);
1124
+ const o = (typeof ((h = t(this, q).fields) == null ? void 0 : h.get) == "function" ? t(this, q).fields.get() : []).indexOf(e);
1123
1125
  if (o < 0) return;
1124
1126
  const r = this.getValidData()[i];
1125
1127
  if (!r) return;
1126
1128
  const l = r.v[o];
1127
- l !== s && r.__ng.rowState !== L.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(e) || (r.__ng.o[e] = l), r.__ng.rowState = L.ROW_STATE.UPDATE), r.v[o] = s, t(this, v).owner.refreshData && t(this, v).owner.refreshData(i);
1129
+ l !== s && r.__ng.rowState !== H.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(e) || (r.__ng.o[e] = l), r.__ng.rowState = H.ROW_STATE.UPDATE), r.v[o] = s, t(this, v).owner.refreshData && t(this, v).owner.refreshData(i);
1128
1130
  }, "setValue"));
1129
1131
  w(this, "resetRecords", /* @__PURE__ */ a(() => {
1130
- b(this, Q, t(this, v).rawRecords.filter((i) => !i.__ng.deleted)), b(this, q, t(this, v).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, v).rawRecords.forEach((i, e) => {
1132
+ b(this, Q, t(this, v).rawRecords.filter((i) => !i.__ng.deleted)), b(this, L, t(this, v).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, v).rawRecords.forEach((i, e) => {
1131
1133
  i.__ng.rowidx = e;
1132
- }), t(this, q).forEach((i, e) => {
1134
+ }), t(this, L).forEach((i, e) => {
1133
1135
  i.__ng.i = e;
1134
1136
  });
1135
1137
  }, "resetRecords"));
1136
- w(this, "getValidData", /* @__PURE__ */ a(() => (t(this, q).length === 0 && t(this, v).rawRecords.length > 0 && this.resetRecords(), t(this, q)), "getValidData"));
1138
+ w(this, "getValidData", /* @__PURE__ */ a(() => (t(this, L).length === 0 && t(this, v).rawRecords.length > 0 && this.resetRecords(), t(this, L)), "getValidData"));
1137
1139
  d(this, tt, /* @__PURE__ */ a((i) => {
1138
1140
  var s;
1139
1141
  if (!i) return i;
1140
- const e = typeof ((s = t(this, A).fields) == null ? void 0 : s.get) == "function" ? t(this, A).fields.get() : [];
1142
+ const e = typeof ((s = t(this, q).fields) == null ? void 0 : s.get) == "function" ? t(this, q).fields.get() : [];
1141
1143
  return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
1142
1144
  const o = {};
1143
1145
  return e.forEach((r, l) => {
@@ -1152,14 +1154,14 @@ const L = class L {
1152
1154
  if (!s || s.length <= 0) return;
1153
1155
  if (i == null) return t(this, tt).call(this, s);
1154
1156
  if (i < 0 || i >= s.length) return null;
1155
- const n = typeof ((o = t(this, A).fields) == null ? void 0 : o.get) == "function" ? t(this, A).fields.get() : [];
1157
+ const n = typeof ((o = t(this, q).fields) == null ? void 0 : o.get) == "function" ? t(this, q).fields.get() : [];
1156
1158
  if (e != null) {
1157
1159
  const r = n.indexOf(e);
1158
1160
  return r >= 0 ? s[i].v[r] : null;
1159
1161
  }
1160
1162
  return t(this, tt).call(this, s[i]);
1161
1163
  }, "get"));
1162
- b(this, A, i), b(this, v, e), t(this, Lt).call(this);
1164
+ b(this, q, i), b(this, v, e), t(this, Lt).call(this);
1163
1165
  }
1164
1166
  get source() {
1165
1167
  return t(this, tt).call(this, t(this, v).rawRecords);
@@ -1171,21 +1173,21 @@ const L = class L {
1171
1173
  return ++ne(this, qt)._;
1172
1174
  }
1173
1175
  get length() {
1174
- return t(this, q).length;
1176
+ return t(this, L).length;
1175
1177
  }
1176
1178
  getRowCount() {
1177
1179
  return this.length;
1178
1180
  }
1179
1181
  };
1180
- A = new WeakMap(), v = new WeakMap(), q = new WeakMap(), Q = new WeakMap(), qt = new WeakMap(), z = new WeakMap(), Lt = new WeakMap(), ct = new WeakMap(), Ht = new WeakMap(), Ct = new WeakMap(), tt = new WeakMap(), a(L, "ngData"), // 🎯 ν–‰ μƒνƒœ μ •μ˜ μƒμˆ˜λ₯Ό 클래슀 λ‚΄λΆ€λ‘œ λ‚΄μž¬ν™”
1181
- w(L, "ROW_STATE", {
1182
+ q = new WeakMap(), v = new WeakMap(), L = new WeakMap(), Q = new WeakMap(), qt = new WeakMap(), z = new WeakMap(), Lt = new WeakMap(), ct = new WeakMap(), Ht = new WeakMap(), Ct = new WeakMap(), tt = new WeakMap(), a(H, "ngData"), // 🎯 ν–‰ μƒνƒœ μ •μ˜ μƒμˆ˜λ₯Ό 클래슀 λ‚΄λΆ€λ‘œ λ‚΄μž¬ν™”
1183
+ w(H, "ROW_STATE", {
1182
1184
  EMPTY: "EMPTY",
1183
1185
  NORMAL: "NORMAL",
1184
1186
  INSERT: "INSERT",
1185
1187
  UPDATE: "UPDATE",
1186
1188
  DELETE: "DELETE"
1187
1189
  });
1188
- let Bt = L;
1190
+ let Bt = H;
1189
1191
  const Gt = class Gt {
1190
1192
  constructor(i) {
1191
1193
  this.owner = i, this.row = new Pt(this), this.data = new Bt(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
@@ -1217,10 +1219,10 @@ const Jt = class Jt extends HTMLElement {
1217
1219
  this.attachShadow({ mode: "open" }), b(this, j, new Nt(this));
1218
1220
  }
1219
1221
  connectedCallback() {
1220
- b(this, Mt, new Dt(this)), H.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
1222
+ b(this, Mt, new Dt(this)), A.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
1221
1223
  }
1222
1224
  disconnectedCallback() {
1223
- H.log("NineTable disconnected.");
1225
+ A.log("NineTable disconnected.");
1224
1226
  }
1225
1227
  // 🎯 μ™ΈλΆ€μ—μ„œ grid.data.set(...) ν˜•νƒœλ‘œ μ ‘κ·Όν•  수 μžˆλ„λ‘ 데이터 λ§€λ‹ˆμ € μ˜€ν”ˆ
1226
1228
  get data() {