monobill-mintui 0.6.660 → 0.6.661

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/index.js CHANGED
@@ -9618,20 +9618,24 @@ var Wn = class extends HTMLElement {
9618
9618
  let d = this._sorting;
9619
9619
  this._sorting = !1, this._sortingColumnData = null, this.dispatchEvent(new CustomEvent("loaded", { detail: { rows: this._rows } })), this._updateSearchIcon();
9620
9620
  let f = `tbody[data-mint-rt-tbody="${this._tableId}"]`, p = !!this.querySelector(f);
9621
- if (this._virtualScrollActive() && this._type === "ajax") p || this.render(), s.forEach((e, t) => {
9622
- this._virtualRowCache.set(o + t, e);
9623
- }), this._virtualInvalidate(), o === 0 ? queueMicrotask(() => this._scrollVirtualTableTopIntoView()) : this._scheduleVirtualWindowSync(), this._loadingPage, this._loadingPage = null, this._updatePagination(), setTimeout(() => {
9624
- let e = this._paginationMountedRoot();
9625
- e && e.querySelectorAll("mint-button[data-action=\"page\"]").forEach((e) => {
9626
- "render" in e && typeof e.render == "function" && e.render();
9627
- });
9628
- }, 0);
9629
- else if (this.querySelector(`#${this._tableId}`)?.closest("table")?.querySelector("tbody")) {
9621
+ if (this._virtualScrollActive() && this._type === "ajax") {
9622
+ p || this.render(), s.forEach((e, t) => {
9623
+ this._virtualRowCache.set(o + t, e);
9624
+ }), this._virtualInvalidate(), o === 0 ? queueMicrotask(() => this._scrollVirtualTableTopIntoView()) : this._scheduleVirtualWindowSync();
9625
+ let e = this._loadingPage;
9626
+ this._loadingPage = null, this._updatePagination(), e !== null && this._schedulePaginatedFirstRowIntoView(), setTimeout(() => {
9627
+ let e = this._paginationMountedRoot();
9628
+ e && e.querySelectorAll("mint-button[data-action=\"page\"]").forEach((e) => {
9629
+ "render" in e && typeof e.render == "function" && e.render();
9630
+ });
9631
+ }, 0);
9632
+ } else if (this.querySelector(`#${this._tableId}`)?.closest("table")?.querySelector("tbody")) {
9630
9633
  if (d) {
9631
9634
  let e = this._loading, t = this._fetching;
9632
9635
  this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = e, this._fetching = t;
9633
9636
  } else this._updateTableBody();
9634
- this._loadingPage, this._loadingPage = null, this._updatePagination(), setTimeout(() => {
9637
+ let e = this._loadingPage;
9638
+ this._loadingPage = null, this._updatePagination(), e !== null && this._schedulePaginatedFirstRowIntoView(), setTimeout(() => {
9635
9639
  let e = this._paginationMountedRoot();
9636
9640
  e && e.querySelectorAll("mint-button[data-action=\"page\"]").forEach((e) => {
9637
9641
  "render" in e && typeof e.render == "function" && e.render();
@@ -10378,7 +10382,34 @@ var Wn = class extends HTMLElement {
10378
10382
  }
10379
10383
  _goToPage(e) {
10380
10384
  let t = this._lastPage || Math.ceil(this._rows.length / this._perPage);
10381
- e > t && (e = t), e < 1 && (e = 1), e !== this._currentPage && (this._currentPage = e, this._offset = (e - 1) * this._perPage, this._updatePageInUrl(e), this._type === "ajax" ? (this._loadingPage = e, this._updatePagination(), this._fetchData()) : this.render());
10385
+ e > t && (e = t), e < 1 && (e = 1), e !== this._currentPage && (this._currentPage = e, this._offset = (e - 1) * this._perPage, this._updatePageInUrl(e), this._type === "ajax" ? (this._loadingPage = e, this._updatePagination(), this._fetchData()) : (this.render(), this._schedulePaginatedFirstRowIntoView()));
10386
+ }
10387
+ _schedulePaginatedFirstRowIntoView() {
10388
+ requestAnimationFrame(() => requestAnimationFrame(() => {
10389
+ if (!this.isConnected) return;
10390
+ let e = this._useMobileListLayout() ? this.querySelector(`ul[data-mint-rt-mobile-list="${this._tableId}"]`) : null, t = this.querySelector(`#${this._tableId}`)?.closest("table"), n = e?.querySelector(":scope > li") || t?.querySelector("tbody tr[data-row-index=\"0\"]");
10391
+ if (!n) return;
10392
+ let r = this._virtualScrollStickyOverlapPx(t), i = this._findVerticalScrollContainer(n), a = n.getBoundingClientRect();
10393
+ if (i) {
10394
+ let e = i.getBoundingClientRect();
10395
+ i.scrollTo({
10396
+ top: i.scrollTop + a.top - e.top - r - 8,
10397
+ behavior: "smooth"
10398
+ });
10399
+ } else window.scrollTo({
10400
+ top: Math.max(0, window.scrollY + a.top - r - 8),
10401
+ behavior: "smooth"
10402
+ });
10403
+ }));
10404
+ }
10405
+ _findVerticalScrollContainer(e) {
10406
+ let t = e.parentElement;
10407
+ for (; t && t !== document.body && t !== document.documentElement;) {
10408
+ let e = getComputedStyle(t).overflowY;
10409
+ if (/(auto|scroll|overlay)/.test(e) && t.scrollHeight > t.clientHeight) return t;
10410
+ t = t.parentElement;
10411
+ }
10412
+ return null;
10382
10413
  }
10383
10414
  _handleButtonClick(e) {
10384
10415
  if (this._configuration) switch (e.type) {
@@ -10422,7 +10453,7 @@ var Wn = class extends HTMLElement {
10422
10453
  }
10423
10454
  _getStyle(e) {
10424
10455
  let t = "";
10425
- return (e.nowrap || e.actions) && (t += "white-space: nowrap;"), e.offsetLeft && (t += `left: ${e.offsetLeft} !important;`), e.offsetRight && (t += `right: ${e.offsetRight} !important;`), e.width && (t += `min-width: ${e.width}px; max-width: ${e.width}px;`), t;
10456
+ return (e.nowrap || e.actions) && (t += "white-space: nowrap;"), e.offsetLeft && (t += `left: ${e.offsetLeft} !important;`), e.offsetRight && (t += `right: ${e.offsetRight} !important;`), e.width && (t += `min-width: ${e.width}px; max-width: ${e.width}px;`), e.minWidth && (t += `min-width: ${this._escapeHtml(e.minWidth)};`), t;
10426
10457
  }
10427
10458
  _getClasses(e, t = !1) {
10428
10459
  let n = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monobill-mintui",
3
- "version": "0.6.660",
3
+ "version": "0.6.661",
4
4
  "description": "Framework-independent HTML custom elements with component-scoped CSS.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",