monobill-mintui 0.6.658 → 0.6.659

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
@@ -9546,7 +9546,7 @@ var Wn = class extends HTMLElement {
9546
9546
  return this._configuration;
9547
9547
  }
9548
9548
  set configuration(e) {
9549
- e && typeof e == "object" && !Array.isArray(e) ? (this._configuration = e, this._tableId = this._configuration.id || `mint-resource-table-${Date.now()}`, this._perPage = this._configuration.perPage || 15, this._type = typeof this._configuration.data == "string" ? "ajax" : "provided", this._loaded = !1, this._currentPage = 1, this._offset = 0, this._type === "provided" && Array.isArray(this._configuration.data) && (this._rows = [...this._configuration.data], this._totalRows = this._configuration.data.length), this._initializeColumns(), this.isConnected && this.render()) : e == null ? this._configuration = null : this._parseConfiguration();
9549
+ e && typeof e == "object" && !Array.isArray(e) ? (this._configuration = e, this._tableId = this._configuration.id || this._tableId || `mint-resource-table-${Date.now()}`, this._perPage = this._configuration.perPage || 15, this._type = typeof this._configuration.data == "string" ? "ajax" : "provided", this._loaded = !1, this._currentPage = 1, this._offset = 0, this._loadPageFromUrl(), this._type === "provided" && Array.isArray(this._configuration.data) && (this._rows = [...this._configuration.data], this._totalRows = this._configuration.data.length), this._initializeColumns(), this.isConnected && this.render()) : e == null ? this._configuration = null : this._parseConfiguration();
9550
9550
  }
9551
9551
  connectedCallback() {
9552
9552
  this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "block", "w-full"), this._utilityClassObserver = new MutationObserver(() => this._replaceUtilityClasses()), this._utilityClassObserver.observe(this, {
@@ -9567,7 +9567,7 @@ var Wn = class extends HTMLElement {
9567
9567
  }
9568
9568
  setData(e) {
9569
9569
  if (this._configuration) {
9570
- if (this._configuration.data = e, this._type = typeof e == "string" ? "ajax" : "provided", this._currentPage = 1, this._offset = 0, this._fetchError = null, this._searching = !1, this._loadingPage = null, this._sortTimeoutId &&= (clearTimeout(this._sortTimeoutId), null), this._searchTimeoutId &&= (clearTimeout(this._searchTimeoutId), null), this._virtualScrollActive() && (this._virtualRowCache.clear(), this._virtualInvalidate()), this._type === "ajax") {
9570
+ if (this._configuration.data = e, this._type = typeof e == "string" ? "ajax" : "provided", this._currentPage = 1, this._offset = 0, this._updatePageInUrl(1), this._fetchError = null, this._searching = !1, this._loadingPage = null, this._sortTimeoutId &&= (clearTimeout(this._sortTimeoutId), null), this._searchTimeoutId &&= (clearTimeout(this._searchTimeoutId), null), this._virtualScrollActive() && (this._virtualRowCache.clear(), this._virtualInvalidate()), this._type === "ajax") {
9571
9571
  this._rows = [], this._totalRows = 0, this._lastPage = 0, this._loaded = !1, this._fetching = !1, this._loading = !1, this._fetchData(void 0, !0, this._perPage, 0);
9572
9572
  return;
9573
9573
  }
@@ -9581,7 +9581,7 @@ var Wn = class extends HTMLElement {
9581
9581
  return;
9582
9582
  }
9583
9583
  try {
9584
- this._configuration = JSON.parse(e), this._tableId = this._configuration.id || `mint-resource-table-${Date.now()}`, this._perPage = this._configuration.perPage || 15, this._type = typeof this._configuration.data == "string" ? "ajax" : "provided", this._loaded = !1, this._currentPage = this._getPageFromUrl() || 1, this._offset = (this._currentPage - 1) * this._perPage, this._type === "provided" && Array.isArray(this._configuration.data) && (this._rows = [...this._configuration.data], this._totalRows = this._configuration.data.length), this._initializeColumns();
9584
+ this._configuration = JSON.parse(e), this._tableId = this._configuration.id || this._tableId || `mint-resource-table-${Date.now()}`, this._perPage = this._configuration.perPage || 15, this._type = typeof this._configuration.data == "string" ? "ajax" : "provided", this._loaded = !1, this._currentPage = this._getPageFromUrl() || 1, this._offset = (this._currentPage - 1) * this._perPage, this._type === "provided" && Array.isArray(this._configuration.data) && (this._rows = [...this._configuration.data], this._totalRows = this._configuration.data.length), this._initializeColumns();
9585
9585
  } catch (e) {
9586
9586
  console.error("mint-resource-table: Invalid configuration JSON", e);
9587
9587
  }
@@ -10213,11 +10213,11 @@ var Wn = class extends HTMLElement {
10213
10213
  if (this._sortTimeoutId !== null && (clearTimeout(this._sortTimeoutId), this._sortTimeoutId = null), this._sorting = !0, this._sortingColumnData = t.toLowerCase(), this._updateSortIcons(), this._type === "ajax") this._sortTimeoutId = window.setTimeout(() => {
10214
10214
  if (this._sortTimeoutId = null, !this._configuration || !t || !e.sortable) return;
10215
10215
  let n = this._configuration.sort || "asc";
10216
- this._configuration.sortBy?.toLowerCase() === t.toLowerCase() && (n = n === "desc" ? "asc" : "desc"), this._configuration.sort = n, this._configuration.sortBy = t, this._updateSortIcons(), this._offset = 0, this._currentPage = 1, this._fetching = !1, this._loading = !1, this._fetchData(void 0, !1, this._perPage, 0);
10216
+ this._configuration.sortBy?.toLowerCase() === t.toLowerCase() && (n = n === "desc" ? "asc" : "desc"), this._configuration.sort = n, this._configuration.sortBy = t, this._updateSortIcons(), this._offset = 0, this._currentPage = 1, this._updatePageInUrl(1), this._fetching = !1, this._loading = !1, this._fetchData(void 0, !1, this._perPage, 0);
10217
10217
  }, 10);
10218
10218
  else {
10219
10219
  let e = this._configuration.sort || "asc";
10220
- this._configuration.sortBy?.toLowerCase() === t.toLowerCase() && (e = e === "desc" ? "asc" : "desc"), this._configuration.sort = e, this._configuration.sortBy = t, this._currentPage = 1, this._sorting = !1, this._sortingColumnData = null, this._updateSortIcons(), this.render(), this._virtualScrollActive() && queueMicrotask(() => this._scrollVirtualTableTopIntoView());
10220
+ this._configuration.sortBy?.toLowerCase() === t.toLowerCase() && (e = e === "desc" ? "asc" : "desc"), this._configuration.sort = e, this._configuration.sortBy = t, this._currentPage = 1, this._updatePageInUrl(1), this._sorting = !1, this._sortingColumnData = null, this._updateSortIcons(), this.render(), this._virtualScrollActive() && queueMicrotask(() => this._scrollVirtualTableTopIntoView());
10221
10221
  }
10222
10222
  }
10223
10223
  _getSortClass(e) {
@@ -10253,8 +10253,8 @@ var Wn = class extends HTMLElement {
10253
10253
  }
10254
10254
  _showFetchingState() {}
10255
10255
  _triggerSearch() {
10256
- this._searchTimeoutId && clearTimeout(this._searchTimeoutId), this._searching = !0, this._type === "ajax" && this._updateSearchIcon(), this._type !== "ajax" && (this._currentPage = 1), this._updateTableBody(), this._type !== "ajax" && this._updatePagination(), this._searchTimeoutId = window.setTimeout(() => {
10257
- this._type === "ajax" ? (this._offset = 0, this._fetchData(void 0, !1, this._perPage, 0)) : (this._searching = !1, this._virtualScrollActive() && queueMicrotask(() => this._scrollVirtualTableTopIntoView()));
10256
+ this._searchTimeoutId && clearTimeout(this._searchTimeoutId), this._searching = !0, this._type === "ajax" && this._updateSearchIcon(), this._type !== "ajax" && (this._currentPage = 1, this._updatePageInUrl(1)), this._updateTableBody(), this._type !== "ajax" && this._updatePagination(), this._searchTimeoutId = window.setTimeout(() => {
10257
+ this._type === "ajax" ? (this._offset = 0, this._currentPage = 1, this._updatePageInUrl(1), this._fetchData(void 0, !1, this._perPage, 0)) : (this._searching = !1, this._virtualScrollActive() && queueMicrotask(() => this._scrollVirtualTableTopIntoView()));
10258
10258
  }, 400);
10259
10259
  }
10260
10260
  _updateSearchIcon() {
@@ -10621,7 +10621,7 @@ var Wn = class extends HTMLElement {
10621
10621
  _updatePageInUrl(e) {
10622
10622
  if (!this._tableId) return;
10623
10623
  let t = new URL(window.location.href), n = t.searchParams;
10624
- n.set(`mui.${this._tableId}`, e.toString()), e === 1 && n.set(`mui.${this._tableId}`, "1"), window.history.replaceState({}, "", t.toString());
10624
+ n.set(`mui.${this._tableId}`, e.toString()), e === 1 && n.set(`mui.${this._tableId}`, "1"), window.history.replaceState(window.history.state, "", t.toString());
10625
10625
  }
10626
10626
  _loadPageFromUrl() {
10627
10627
  if (!this._configuration || !this._tableId) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monobill-mintui",
3
- "version": "0.6.658",
3
+ "version": "0.6.659",
4
4
  "description": "Framework-independent HTML custom elements with component-scoped CSS.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",