@ninebone/table 0.0.212 → 0.0.213

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.
@@ -58,8 +58,8 @@ const Ae = class Ae extends HTMLElement {
58
58
  let f = 0;
59
59
  const g = s.style.transform;
60
60
  if (g && g.includes("translateX")) {
61
- const S = g.match(/translateX\(([-\d.]+)px\)/);
62
- S && S[1] && (f = parseFloat(S[1]));
61
+ const R = g.match(/translateX\(([-\d.]+)px\)/);
62
+ R && R[1] && (f = parseFloat(R[1]));
63
63
  } else
64
64
  f = parseInt(s.style.left || 0, 10);
65
65
  let b = parseInt(Math.abs(f) * l / h, 10);
@@ -327,12 +327,12 @@ const Z = class Z extends HTMLElement {
327
327
  const s = /* @__PURE__ */ a((l) => {
328
328
  const d = /* @__PURE__ */ a((g) => {
329
329
  if (g.querySelector("colgroup")) return;
330
- const b = g.querySelector("tbody tr") || g.querySelector("tr"), m = b ? b.querySelectorAll("th, td").length : 1, S = document.createElement("colgroup"), T = Math.max(Math.floor((g.clientWidth || 600) / m), 100);
330
+ const b = g.querySelector("tbody tr") || g.querySelector("tr"), m = b ? b.querySelectorAll("th, td").length : 1, R = document.createElement("colgroup"), T = Math.max(Math.floor((g.clientWidth || 600) / m), 100);
331
331
  for (let _ = 0; _ < m; _++) {
332
332
  const be = document.createElement("col");
333
- be.setAttribute("width", T), S.appendChild(be);
333
+ be.setAttribute("width", T), R.appendChild(be);
334
334
  }
335
- g.prepend(S);
335
+ g.prepend(R);
336
336
  }, "ensureColgroup"), f = /* @__PURE__ */ a((g) => {
337
337
  if (g.querySelector("thead")) return;
338
338
  const b = document.createElement("thead"), m = g.querySelector("colgroup");
@@ -343,13 +343,13 @@ const Z = class Z extends HTMLElement {
343
343
  p(this, I, s(n)), e(this, I).style.display = "table", e(this, X).initTemplate(e(this, I));
344
344
  const r = this.querySelector(".ng-container-left"), o = this.querySelector(".ng-container-body"), c = this.querySelector(".ng-container-right"), h = /* @__PURE__ */ a((l, d, f = !1) => {
345
345
  const g = l.cloneNode(!0), b = Array.from(g.querySelectorAll("colgroup col")), m = [];
346
- return b.forEach((S, T) => {
347
- const _ = S.getAttribute("fixed");
346
+ return b.forEach((R, T) => {
347
+ const _ = R.getAttribute("fixed");
348
348
  (f ? _ !== "left" && _ !== "right" : _ === d) || m.push(T);
349
- }), m.reverse().forEach((S) => {
350
- b[S] && b[S].remove(), g.querySelectorAll("tr").forEach((T) => {
349
+ }), m.reverse().forEach((R) => {
350
+ b[R] && b[R].remove(), g.querySelectorAll("tr").forEach((T) => {
351
351
  const _ = T.querySelectorAll("th, td");
352
- _[S] && _[S].remove();
352
+ _[R] && _[R].remove();
353
353
  });
354
354
  }), g;
355
355
  }, "filterTableByFixed");
@@ -379,10 +379,10 @@ const Z = class Z extends HTMLElement {
379
379
  }
380
380
  o && o.addEventListener("scroll", () => {
381
381
  var l;
382
- this.querySelector("nine-table-hscrollbar"), (l = this.querySelector("nine-table-hscrollbar")) == null || l.refresh();
382
+ (l = this.querySelector("nine-table-hscrollbar")) == null || l.refresh();
383
383
  }), setTimeout(() => {
384
- const l = this.querySelector("nine-table-hscrollbar");
385
- l && typeof l.refresh == "function" && l.refresh();
384
+ var l;
385
+ (l = this.querySelector("nine-table-hscrollbar")) == null || l.refresh();
386
386
  }, 0);
387
387
  }, "generate"));
388
388
  x(this, "getRowHeight", /* @__PURE__ */ a(() => e(this, X).getRowHeight(), "getRowHeight"));
@@ -408,11 +408,11 @@ const Z = class Z extends HTMLElement {
408
408
  if (!r) return;
409
409
  const c = n ? Array.from(n.querySelectorAll("tr")) : [], h = Array.from(r.querySelectorAll("tr")), l = o ? Array.from(o.querySelectorAll("tr")) : [], d = Math.max(c.length, h.length, l.length);
410
410
  for (let m = 0; m < d; m++) {
411
- const S = [
411
+ const R = [
412
412
  ((f = c[m]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
413
413
  ((g = h[m]) == null ? void 0 : g.getBoundingClientRect().height) || 0,
414
414
  ((b = l[m]) == null ? void 0 : b.getBoundingClientRect().height) || 0
415
- ], T = Math.max(...S);
415
+ ], T = Math.max(...R);
416
416
  T > 0 && (c[m] && (c[m].style.height = `${T}px`), h[m] && (h[m].style.height = `${T}px`), l[m] && (l[m].style.height = `${T}px`));
417
417
  }
418
418
  });
@@ -465,6 +465,7 @@ const Z = class Z extends HTMLElement {
465
465
  flex-direction: column;
466
466
  flex: 1;
467
467
  overflow: hidden;
468
+ overflow-x: auto;
468
469
  background: #ffffff;
469
470
  position: relative;
470
471
  }
@@ -567,8 +568,8 @@ const ke = class ke extends HTMLElement {
567
568
  Array.from(this.querySelectorAll("nine-splitter")).forEach((b) => b.style.setProperty("display", "none"));
568
569
  const g = d.filter((b) => b.classList.contains("active"));
569
570
  g.length < 2 || g.forEach((b) => {
570
- const m = parseInt(b.getAttribute("data-index"), 10), S = this.querySelector(`nine-splitter[data-split-index="${m}"]`), T = d[m + 1];
571
- S && T && T.classList.contains("active") && S.style.setProperty("display", "flex");
571
+ const m = parseInt(b.getAttribute("data-index"), 10), R = this.querySelector(`nine-splitter[data-split-index="${m}"]`), T = d[m + 1];
572
+ R && T && T.classList.contains("active") && R.style.setProperty("display", "flex");
572
573
  });
573
574
  }, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), c = r.querySelectorAll(".nine-tab-item"), h = o.querySelectorAll("nine-table-sheet");
574
575
  if (!c[t]) return;
@@ -600,29 +601,29 @@ const ke = class ke extends HTMLElement {
600
601
  le = new WeakMap(), j = new WeakMap(), a(ke, "NineTableSheets");
601
602
  let we = ke;
602
603
  customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", we);
603
- var R, ae, G, ce;
604
+ var S, ae, G, ce;
604
605
  const Le = class Le {
605
606
  constructor(i) {
606
- u(this, R);
607
+ u(this, S);
607
608
  u(this, ae, /* @__PURE__ */ a(() => {
608
609
  e(this, ce).call(this), new ResizeObserver((i) => {
609
610
  for (let t of i)
610
- e(this, R).getAttribute("auto-height") === "true" && e(this, G).call(this);
611
- }).observe(e(this, R));
611
+ e(this, S).getAttribute("auto-height") === "true" && e(this, G).call(this);
612
+ }).observe(e(this, S));
612
613
  }, "#init"));
613
614
  u(this, G, /* @__PURE__ */ a(() => {
614
615
  var h, l;
615
- const i = Array.from(e(this, R).shadowRoot.querySelectorAll("nine-table-sheet.active"));
616
+ const i = Array.from(e(this, S).shadowRoot.querySelectorAll("nine-table-sheet.active"));
616
617
  if (i.length === 0) return;
617
- const t = parseInt(e(this, R).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((d) => d.getRowHeight())), n = (h = e(this, R).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : h.getBoundingClientRect().height, r = (l = e(this, R).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, o = ee.SCROLLBAR_SIZE, c = t * s + n + r + o;
618
- e(this, R).style.height = `${c}px`;
618
+ const t = parseInt(e(this, S).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((d) => d.getRowHeight())), n = (h = e(this, S).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : h.getBoundingClientRect().height, r = (l = e(this, S).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, o = ee.SCROLLBAR_SIZE, c = t * s + n + r + o;
619
+ e(this, S).style.height = `${c}px`;
619
620
  }, "#applyAutoHeight"));
620
621
  u(this, ce, /* @__PURE__ */ a(() => {
621
- const t = Array.from(e(this, R).children).filter((h) => h.tagName === "TABLE"), s = e(this, R).getAttribute("auto-height") === "true", n = t.length, r = t.map((h, l) => {
622
+ const t = Array.from(e(this, S).children).filter((h) => h.tagName === "TABLE"), s = e(this, S).getAttribute("auto-height") === "true", n = t.length, r = t.map((h, l) => {
622
623
  const f = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`, g = l < n - 1 ? `<nine-splitter class="h" data-split-index="${l}"></nine-splitter>` : "";
623
624
  return f + g;
624
625
  }).join(""), o = t.map((h, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
625
- e(this, R).shadowRoot.innerHTML = `
626
+ e(this, S).shadowRoot.innerHTML = `
626
627
  <style>
627
628
  :host {
628
629
  display: flex;
@@ -721,17 +722,17 @@ const Le = class Le {
721
722
  </nine-table-body>
722
723
  <nine-table-footer></nine-table-footer>
723
724
  `;
724
- const c = e(this, R).shadowRoot.querySelectorAll("nine-table-sheet");
725
+ const c = e(this, S).shadowRoot.querySelectorAll("nine-table-sheet");
725
726
  c == null || c.forEach((h, l) => {
726
727
  t[l] && setTimeout(() => {
727
728
  h.generate(t[l]), s && e(this, G).call(this);
728
729
  });
729
730
  });
730
731
  }, "#render"));
731
- p(this, R, i), e(this, ae).call(this);
732
+ p(this, S, i), e(this, ae).call(this);
732
733
  }
733
734
  };
734
- R = new WeakMap(), ae = new WeakMap(), G = new WeakMap(), ce = new WeakMap(), a(Le, "LayoutManager");
735
+ S = new WeakMap(), ae = new WeakMap(), G = new WeakMap(), ce = new WeakMap(), a(Le, "LayoutManager");
735
736
  let ve = Le;
736
737
  var W, F;
737
738
  const Ce = class Ce {
@@ -900,10 +901,10 @@ x(k, "ROW_STATE", {
900
901
  UPDATE: "UPDATE",
901
902
  DELETE: "DELETE"
902
903
  });
903
- let Se = k;
904
+ let Re = k;
904
905
  const _e = class _e {
905
906
  constructor(i) {
906
- this.owner = i, this.row = new xe(this), this.data = new Se(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
907
+ this.owner = i, this.row = new xe(this), this.data = new Re(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
907
908
  var t;
908
909
  (t = this.owner.view) != null && t.redraw && this.owner.view.redraw();
909
910
  }, this.setDataSource = (t) => {
@@ -921,7 +922,7 @@ const _e = class _e {
921
922
  }
922
923
  };
923
924
  a(_e, "ngDataManager");
924
- let Re = _e;
925
+ let Se = _e;
925
926
  var Y, ge;
926
927
  const Me = class Me extends HTMLElement {
927
928
  constructor() {
@@ -929,7 +930,7 @@ const Me = class Me extends HTMLElement {
929
930
  //#created = false;
930
931
  u(this, Y);
931
932
  u(this, ge);
932
- this.attachShadow({ mode: "open" }), p(this, Y, new Re(this));
933
+ this.attachShadow({ mode: "open" }), p(this, Y, new Se(this));
933
934
  }
934
935
  connectedCallback() {
935
936
  p(this, ge, new ve(this)), Q.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));