monobill-mintui 0.6.727 → 0.6.729

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.
@@ -116,7 +116,8 @@ var n = {
116
116
  "lg:block": "rtu-d0ce7c24d",
117
117
  "lg:border-t-0": "rtu-7d283214b",
118
118
  "lg:hidden": "rtu-a327049ca",
119
- "lg:justify-end": "rtu-64b07e15f",
119
+ "lg:items-center": "rtu-cef361211",
120
+ "lg:justify-between": "rtu-62c392c49",
120
121
  "lg:mt-4": "rtu-010a34347",
121
122
  "lg:pt-0": "rtu-0cd43c7f4",
122
123
  "lg:py-0": "rtu-0df6beb59",
@@ -199,7 +200,7 @@ var n = {
199
200
  return e !== null && e !== "false";
200
201
  }
201
202
  constructor() {
202
- super(), this._configuration = null, this._rows = [], this._selectedRowIds = /* @__PURE__ */ new Set(), this._selectedRowCache = /* @__PURE__ */ new Map(), this._search = "", this._currentPage = 1, this._perPage = 15, this._totalRows = 0, this._lastPage = 0, this._offset = 0, this._loaded = !1, this._fetching = !1, this._loading = !1, this._loadingPage = null, this._fetchError = null, this._searching = !1, this._sorting = !1, this._sortingColumnData = null, this._type = "provided", this._searchTimeoutId = null, this._sortTimeoutId = null, this._searchColumns = [], this._exportColumns = {}, this._columns = [], this._tableId = "", this._searchInput = null, this._tableContainer = null, this._paginationContainer = null, this._skeletonContainer = null, this._inMintCard = !1, this._virtualBodyScrollEl = null, this._disposeVirtualBodyFade = null, this._virtualScrollHandler = null, this._virtualWindowRaf = null, this._virtualLastRangeStart = -1, this._virtualLastRangeEnd = -1, this._virtualLastRangeCacheSig = "", this._virtualResizeObserver = null, this._virtualWindowResizeHandler = null, this._virtualRowCache = /* @__PURE__ */ new Map(), this._virtualRangeFetching = !1, this._mobileListMql = null, this._boundMobileListMqlListener = null, this._boundMobileListViewportListener = null, this._initialMobileLayoutRaf = null, this._initialMobileLayoutTimer = null, this._mobileLayoutResizeObserver = null, this._lastMobileViewportObservedWidth = null, this._lastRenderedMobileLayout = null, this._virtualFetchGeneration = 0, this._virtualAjaxPrefetchTimer = null, this._fixedChromeResizeObserver = null, this._utilityClassObserver = null, this._mobileCardLongPressTimer = null, this._suppressMobileCardClick = !1;
203
+ super(), this._configuration = null, this._rows = [], this._selectedRowIds = /* @__PURE__ */ new Set(), this._selectedRowCache = /* @__PURE__ */ new Map(), this._search = "", this._currentPage = 1, this._perPage = 15, this._totalRows = 0, this._lastPage = 0, this._offset = 0, this._loaded = !1, this._resultsCountHasBeenShown = !1, this._fetching = !1, this._loading = !1, this._loadingPage = null, this._fetchError = null, this._searching = !1, this._sorting = !1, this._sortingColumnData = null, this._type = "provided", this._searchTimeoutId = null, this._sortTimeoutId = null, this._searchColumns = [], this._exportColumns = {}, this._columns = [], this._tableId = "", this._searchInput = null, this._tableContainer = null, this._paginationContainer = null, this._skeletonContainer = null, this._inMintCard = !1, this._virtualBodyScrollEl = null, this._disposeVirtualBodyFade = null, this._virtualScrollHandler = null, this._virtualWindowRaf = null, this._virtualLastRangeStart = -1, this._virtualLastRangeEnd = -1, this._virtualLastRangeCacheSig = "", this._virtualResizeObserver = null, this._virtualWindowResizeHandler = null, this._virtualRowCache = /* @__PURE__ */ new Map(), this._virtualRangeFetching = !1, this._mobileListMql = null, this._boundMobileListMqlListener = null, this._boundMobileListViewportListener = null, this._initialMobileLayoutRaf = null, this._initialMobileLayoutTimer = null, this._mobileLayoutResizeObserver = null, this._lastMobileViewportObservedWidth = null, this._lastRenderedMobileLayout = null, this._virtualFetchGeneration = 0, this._virtualAjaxPrefetchTimer = null, this._fixedChromeResizeObserver = null, this._utilityClassObserver = null, this._mobileCardLongPressTimer = null, this._suppressMobileCardClick = !1;
203
204
  }
204
205
  get inMintCard() {
205
206
  return this._inMintCard;
@@ -379,7 +380,8 @@ var n = {
379
380
  "render" in e && typeof e.render == "function" && e.render();
380
381
  });
381
382
  }, 0);
382
- } else if (this.querySelector(`#${this._tableId}`)?.closest("table")?.querySelector("tbody")) {
383
+ } else if (this._rows.length === 0 && this._hasActiveFilters()) this._loadingPage = null, this.render();
384
+ else if (this.querySelector(`#${this._tableId}`)?.closest("table")?.querySelector("tbody")) {
383
385
  if (f) {
384
386
  let e = this._loading, t = this._fetching;
385
387
  this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = e, this._fetching = t;
@@ -565,15 +567,14 @@ var n = {
565
567
  }
566
568
  _paginationHostPlaceholderHtml() {
567
569
  if (!this._configuration?.perPage || this._virtualScrollActive()) return "";
568
- let e = this._lastPage || Math.ceil(this._rows.length / this._perPage);
569
- if ((this._lastPage > 0 ? this._lastPage : e) <= 1) return "";
570
- let t = [
570
+ this._lastPage || Math.ceil(this._rows.length / this._perPage);
571
+ let e = [
571
572
  "mint-rt-pagination-host",
572
573
  "w-full min-w-0 overflow-x-auto overflow-y-hidden overscroll-x-contain",
573
- "flex justify-center [-webkit-overflow-scrolling:touch] lg:justify-end",
574
+ "flex justify-center [-webkit-overflow-scrolling:touch] lg:items-center lg:justify-between",
574
575
  this._inMintCard ? "border-t border-gray-200 px-3.5 pb-3.5 pt-3 dark:border-mint-divider lg:border-t-0 lg:pt-0" : "border-t border-gray-200 px-2 py-3 dark:border-mint-divider lg:border-t-0 lg:py-0 lg:mt-4"
575
576
  ].join(" ");
576
- return `<div id="mint-rt-pagination-host-${this._tableId}" data-mint-rt-pagination-wrap="" class="${t}"></div>`;
577
+ return `<div id="mint-rt-pagination-host-${this._tableId}" data-mint-rt-pagination-wrap="" class="${e}"></div>`;
577
578
  }
578
579
  _getPaginationHostEl() {
579
580
  return this.querySelector(`#mint-rt-pagination-host-${this._tableId}`);
@@ -632,6 +633,25 @@ var n = {
632
633
  _hasSortableColumns() {
633
634
  return !!this._configuration?.columns.some((e) => !e.hidden && e.sortable && e.data);
634
635
  }
636
+ _hasActiveFilters() {
637
+ if (this._search.trim()) return !0;
638
+ let e = typeof this._configuration?.data == "string" ? this._configuration.data : "";
639
+ if (!e) return !1;
640
+ try {
641
+ let t = new URL(e, window.location.href).searchParams, n = new Set([
642
+ "perPage",
643
+ "offset",
644
+ "search",
645
+ "sortBy",
646
+ "sort",
647
+ "searchColumns",
648
+ "columns"
649
+ ]);
650
+ return Array.from(t.keys()).some((e) => !n.has(e));
651
+ } catch {
652
+ return !1;
653
+ }
654
+ }
635
655
  _getMobileSortTriggerIconName() {
636
656
  return "sort-arrows";
637
657
  }
@@ -1112,7 +1132,7 @@ var n = {
1112
1132
  let e = this.querySelector("mint-table"), t = e?.nextElementSibling;
1113
1133
  e && t && t.id !== `mint-rt-pagination-host-${this._tableId}` && !t.classList.contains("mint-rt-pagination-host") && t.querySelector?.("[data-action=\"page\"]") && t.remove();
1114
1134
  };
1115
- if (!this._configuration.perPage || e <= 1 || this._virtualScrollActive()) {
1135
+ if (!this._configuration.perPage || this._virtualScrollActive()) {
1116
1136
  this._getPaginationHostEl()?.replaceChildren(), t();
1117
1137
  return;
1118
1138
  }
@@ -1123,10 +1143,12 @@ var n = {
1123
1143
  this.render();
1124
1144
  return;
1125
1145
  }
1126
- n = document.createElement("div"), n.id = `mint-rt-pagination-host-${this._tableId}`, n.setAttribute("data-mint-rt-pagination-wrap", ""), n.className = "mint-rt-pagination-host w-full min-w-0 overflow-x-auto overflow-y-hidden overscroll-x-contain flex justify-center [-webkit-overflow-scrolling:touch] lg:justify-end " + (this._inMintCard ? "border-t border-gray-200 px-3.5 pb-3.5 pt-3 dark:border-mint-divider lg:border-t-0 lg:pt-0" : "border-t border-gray-200 px-2 py-3 dark:border-mint-divider lg:border-t-0 lg:py-0 lg:mt-4"), e.insertAdjacentElement("afterend", n);
1146
+ n = document.createElement("div"), n.id = `mint-rt-pagination-host-${this._tableId}`, n.setAttribute("data-mint-rt-pagination-wrap", ""), n.className = "mint-rt-pagination-host w-full min-w-0 overflow-x-auto overflow-y-hidden overscroll-x-contain flex justify-center [-webkit-overflow-scrolling:touch] lg:items-center lg:justify-between " + (this._inMintCard ? "border-t border-gray-200 px-3.5 pb-3.5 pt-3 dark:border-mint-divider lg:border-t-0 lg:pt-0" : "border-t border-gray-200 px-2 py-3 dark:border-mint-divider lg:border-t-0 lg:py-0 lg:mt-4"), e.insertAdjacentElement("afterend", n);
1127
1147
  }
1128
- let r = this._buildPaginationNavMarkup(e);
1129
- n.innerHTML = r, setTimeout(() => {
1148
+ let r = Math.max(0, this._totalRows);
1149
+ !this._resultsCountHasBeenShown && !this._fetchError && !this._isExternalLoading() && (this._loaded || this._type === "provided") && (this._resultsCountHasBeenShown = !0);
1150
+ let i = r ? Math.min((this._currentPage - 1) * this._perPage + 1, r) : 0, a = r ? Math.min(i + this._perPage - 1, r) : 0, o = this._escapeHtml(this._configuration.resultsLabel || "items"), s = `<span class="${this._resultsCountHasBeenShown ? "hidden shrink-0 text-sm text-gray-500 dark:text-gray-400 lg:block" : "hidden"}" data-mint-rt-results-count>Showing ${i}–${a} of ${r.toLocaleString()} ${o}</span>`, c = e > 1 ? this._buildPaginationNavMarkup(e) : "";
1151
+ n.innerHTML = `${s}${c}`, setTimeout(() => {
1130
1152
  this._attachPaginationListeners(), n.querySelectorAll("mint-button[data-action=\"page\"]").forEach((e) => {
1131
1153
  "render" in e && typeof e.render == "function" && e.render();
1132
1154
  }), n.querySelectorAll("mint-button[data-action=\"page-prev\"], mint-button[data-action=\"page-next\"]").forEach((e) => {
@@ -1268,9 +1290,10 @@ var n = {
1268
1290
  let n = this._configuration.mobileSearchFirst === !0, r = this._configuration.showSearch === !1 ? "" : `<mint-input id="search-${this._tableId}" type="search" label="" placeholder="${this._escapeHtml(this._configuration.searchPlaceholder || "Search...")}" class="min-w-0 flex-1" icon="search" value="${this._escapeHtml(this._search)}"></mint-input>`;
1269
1291
  n && (a += r), a += this._buildMobileSortToolbarHtml(), a += this._toolbarButtonsHtml("left"), n || (a += r), a += this._toolbarButtonsHtml("right"), a += "</div>", a += "</div>";
1270
1292
  }
1271
- if ((this._type === "ajax" && !this._loaded || this._type === "provided" && i) && !this._fetchError && !this._sorting) {
1293
+ let o = (this._type === "ajax" && !this._loaded || this._type === "provided" && i) && !this._fetchError && !this._sorting, s = this._loaded && r.length === 0 && !this._fetchError && !this._fetching && !this._loading && !i && this._hasActiveFilters();
1294
+ if (o) {
1272
1295
  let e = this._fixedHeader() ? " data-mint-rt-scroll-inner=\"\"" : "", t = this._fixedHeader() && this._fixedControls(), n = this._fixedHeader() ? t ? "sticky top-[var(--mint-rt-fixed-controls-h,0px)] z-30 " : "sticky top-0 z-30 " : "sticky top-0 z-10 ";
1273
- a += "<div class=\"mint-resource-table-desktop min-h-0 min-w-0\">", a += "<mint-table class=\"table-section" + (this._inMintCard ? " rounded-t-none" : "") + "\"" + e + ">", a += `<table id="${this._tableId}">`, a += "<thead class=\"" + n + "bg-white dark:bg-mint-nav border-b border-gray-200 dark:border-mint-divider\"><tr>", a += this._renderSelectionHeader(), this._configuration.columns.forEach((e, t) => {
1296
+ a += "<div class=\"mint-resource-table-desktop min-h-0 min-w-0\" data-mint-rt-horizontal-scroll>", a += "<mint-table class=\"table-section" + (this._inMintCard ? " rounded-t-none" : "") + "\"" + e + ">", a += `<table id="${this._tableId}">`, a += "<thead class=\"" + n + "bg-white dark:bg-mint-nav border-b border-gray-200 dark:border-mint-divider\"><tr>", a += this._renderSelectionHeader(), this._configuration.columns.forEach((e, t) => {
1274
1297
  if (e.hidden) return;
1275
1298
  let n = e.sortable ? " data-mint-rt-sortable=\"\"" : "";
1276
1299
  if (a += `<th width="${e.width || ""}" style="${this._getStyle(e)}" class="${this._getClasses(e)}" data-column-key="${t}"${n}>`, e.showLabel !== !1) {
@@ -1294,12 +1317,13 @@ var n = {
1294
1317
  a += "</tbody>", a += "</table>", a += "</mint-table>", a += "</div>", a += `<ul class="mint-resource-table-mobile-list min-h-0 w-full list-none" data-mint-rt-mobile-list="${this._tableId}" aria-hidden="true">`;
1295
1318
  for (let e = 0; e < 6; e++) a += "<li class=\"mint-resource-table-mobile-row mint-resource-table-mobile-skeleton-card\"><span></span><span></span><span></span></li>";
1296
1319
  a += "</ul>", a += this._paginationHostPlaceholderHtml();
1297
- } else {
1320
+ } else if (s) a += "<div class=\"px-4 py-8 text-center text-sm text-gray-500 dark:text-gray-400\" data-mint-rt-filtered-empty=\"\">No results match the current filters.</div>", a += this._paginationHostPlaceholderHtml();
1321
+ else {
1298
1322
  let e = this._virtualScrollActive() && (this._type === "provided" || this._type === "ajax" && this._loaded && !this._fetchError), t = e && this._virtualScrollRoot() === "table-body", n = this._escapeHtml(this._virtualMaxHeightCss()), o = t || this._fixedHeader(), s = this._fixedHeader() && this._fixedControls(), c = o ? " data-mint-rt-scroll-inner=\"\"" : "", l = "table-section" + (this._inMintCard ? " rounded-t-none" : ""), u = "";
1299
1323
  if (t) {
1300
1324
  let e = this._renderColgroupHtml();
1301
1325
  a += `<div id="mint-rt-vscroll-${this._tableId}" class="overflow-y-auto overflow-x-auto min-h-0 w-full" style="max-height: ${n}; scrollbar-gutter: stable; overscroll-behavior-x: contain; overscroll-behavior-y: none; overflow-anchor: none;">`, a += "<div class=\"mint-resource-table-desktop min-h-0 min-w-0\">", a += `<mint-table class="${l}"${c}>`, a += `<table id="${this._tableId}" class="w-full min-w-0 table-fixed">`, a += e, a += this._renderTheadHtml(!0, !0, !0, s);
1302
- } else a += "<div class=\"mint-resource-table-desktop min-h-0 min-w-0\">", a += `<mint-table class="${l}"${c}>`, a += `<table id="${this._tableId}">`, e && (a += this._renderColgroupHtml()), a += this._renderTheadHtml(!0, !0, !!e, s);
1326
+ } else a += "<div class=\"mint-resource-table-desktop min-h-0 min-w-0\" data-mint-rt-horizontal-scroll>", a += `<mint-table class="${l}"${c}>`, a += `<table id="${this._tableId}">`, e && (a += this._renderColgroupHtml()), a += this._renderTheadHtml(!0, !0, !!e, s);
1303
1327
  if (a += "<tbody" + (e ? ` data-mint-rt-tbody="${this._tableId}"` : "") + ">", !this._fetching && !this._loading && !i && !e && r.forEach((e, t) => {
1304
1328
  u += this._buildMobileListItemHtml(e, t, t === r.length - 1);
1305
1329
  let n = typeof this._configuration.onRowClick == "function", i = n ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-mint-elevated" : "";
@@ -91,7 +91,8 @@ export const resourceTableUtilityAliases: {
91
91
  "lg:block": string;
92
92
  "lg:border-t-0": string;
93
93
  "lg:hidden": string;
94
- "lg:justify-end": string;
94
+ "lg:items-center": string;
95
+ "lg:justify-between": string;
95
96
  "lg:mt-4": string;
96
97
  "lg:pt-0": string;
97
98
  "lg:py-0": string;
@@ -1 +1 @@
1
- {"version":3,"file":"utility-aliases.d.ts","sourceRoot":"","sources":["../../../src/components/resource-table/utility-aliases.js"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8JC"}
1
+ {"version":3,"file":"utility-aliases.d.ts","sourceRoot":"","sources":["../../../src/components/resource-table/utility-aliases.js"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+JC"}