monobill-mintui 0.6.659 → 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.
@@ -281,20 +281,24 @@ var n = {
281
281
  let d = this._sorting;
282
282
  this._sorting = !1, this._sortingColumnData = null, this.dispatchEvent(new CustomEvent("loaded", { detail: { rows: this._rows } })), this._updateSearchIcon();
283
283
  let f = `tbody[data-mint-rt-tbody="${this._tableId}"]`, p = !!this.querySelector(f);
284
- if (this._virtualScrollActive() && this._type === "ajax") p || this.render(), s.forEach((e, t) => {
285
- this._virtualRowCache.set(o + t, e);
286
- }), this._virtualInvalidate(), o === 0 ? queueMicrotask(() => this._scrollVirtualTableTopIntoView()) : this._scheduleVirtualWindowSync(), this._loadingPage, this._loadingPage = null, this._updatePagination(), setTimeout(() => {
287
- let e = this._paginationMountedRoot();
288
- e && e.querySelectorAll("mint-button[data-action=\"page\"]").forEach((e) => {
289
- "render" in e && typeof e.render == "function" && e.render();
290
- });
291
- }, 0);
292
- else if (this.querySelector(`#${this._tableId}`)?.closest("table")?.querySelector("tbody")) {
284
+ if (this._virtualScrollActive() && this._type === "ajax") {
285
+ p || this.render(), s.forEach((e, t) => {
286
+ this._virtualRowCache.set(o + t, e);
287
+ }), this._virtualInvalidate(), o === 0 ? queueMicrotask(() => this._scrollVirtualTableTopIntoView()) : this._scheduleVirtualWindowSync();
288
+ let e = this._loadingPage;
289
+ this._loadingPage = null, this._updatePagination(), e !== null && this._schedulePaginatedFirstRowIntoView(), setTimeout(() => {
290
+ let e = this._paginationMountedRoot();
291
+ e && e.querySelectorAll("mint-button[data-action=\"page\"]").forEach((e) => {
292
+ "render" in e && typeof e.render == "function" && e.render();
293
+ });
294
+ }, 0);
295
+ } else if (this.querySelector(`#${this._tableId}`)?.closest("table")?.querySelector("tbody")) {
293
296
  if (d) {
294
297
  let e = this._loading, t = this._fetching;
295
298
  this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = e, this._fetching = t;
296
299
  } else this._updateTableBody();
297
- this._loadingPage, this._loadingPage = null, this._updatePagination(), setTimeout(() => {
300
+ let e = this._loadingPage;
301
+ this._loadingPage = null, this._updatePagination(), e !== null && this._schedulePaginatedFirstRowIntoView(), setTimeout(() => {
298
302
  let e = this._paginationMountedRoot();
299
303
  e && e.querySelectorAll("mint-button[data-action=\"page\"]").forEach((e) => {
300
304
  "render" in e && typeof e.render == "function" && e.render();
@@ -1041,7 +1045,34 @@ var n = {
1041
1045
  }
1042
1046
  _goToPage(e) {
1043
1047
  let t = this._lastPage || Math.ceil(this._rows.length / this._perPage);
1044
- 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());
1048
+ 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()));
1049
+ }
1050
+ _schedulePaginatedFirstRowIntoView() {
1051
+ requestAnimationFrame(() => requestAnimationFrame(() => {
1052
+ if (!this.isConnected) return;
1053
+ 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\"]");
1054
+ if (!n) return;
1055
+ let r = this._virtualScrollStickyOverlapPx(t), i = this._findVerticalScrollContainer(n), a = n.getBoundingClientRect();
1056
+ if (i) {
1057
+ let e = i.getBoundingClientRect();
1058
+ i.scrollTo({
1059
+ top: i.scrollTop + a.top - e.top - r - 8,
1060
+ behavior: "smooth"
1061
+ });
1062
+ } else window.scrollTo({
1063
+ top: Math.max(0, window.scrollY + a.top - r - 8),
1064
+ behavior: "smooth"
1065
+ });
1066
+ }));
1067
+ }
1068
+ _findVerticalScrollContainer(e) {
1069
+ let t = e.parentElement;
1070
+ for (; t && t !== document.body && t !== document.documentElement;) {
1071
+ let e = getComputedStyle(t).overflowY;
1072
+ if (/(auto|scroll|overlay)/.test(e) && t.scrollHeight > t.clientHeight) return t;
1073
+ t = t.parentElement;
1074
+ }
1075
+ return null;
1045
1076
  }
1046
1077
  _handleButtonClick(e) {
1047
1078
  if (this._configuration) switch (e.type) {
@@ -1085,7 +1116,7 @@ var n = {
1085
1116
  }
1086
1117
  _getStyle(e) {
1087
1118
  let t = "";
1088
- 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;
1119
+ 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;
1089
1120
  }
1090
1121
  _getClasses(e, t = !1) {
1091
1122
  let n = [];