monobill-mintui 0.6.657 → 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.
@@ -209,7 +209,7 @@ var n = {
209
209
  return this._configuration;
210
210
  }
211
211
  set configuration(e) {
212
- 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();
212
+ 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();
213
213
  }
214
214
  connectedCallback() {
215
215
  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, {
@@ -230,7 +230,7 @@ var n = {
230
230
  }
231
231
  setData(e) {
232
232
  if (this._configuration) {
233
- 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") {
233
+ 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") {
234
234
  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);
235
235
  return;
236
236
  }
@@ -244,7 +244,7 @@ var n = {
244
244
  return;
245
245
  }
246
246
  try {
247
- 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();
247
+ 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();
248
248
  } catch (e) {
249
249
  console.error("mint-resource-table: Invalid configuration JSON", e);
250
250
  }
@@ -425,7 +425,7 @@ var n = {
425
425
  let n = this._thumbnailMobilePx(e);
426
426
  return Math.max(t, n + 36);
427
427
  }
428
- return Math.max(t, 80);
428
+ return Math.max(t, 64);
429
429
  }
430
430
  let n = this._mobileThumbnailColumn();
431
431
  if (n) {
@@ -645,34 +645,32 @@ var n = {
645
645
  else typeof e.format == "function" ? a += this._escapeHtml(e.format(this, t)) : e.data && (a += this._escapeHtml(String(t[e.data] || "")));
646
646
  return r === "table" && e.thumbnail && a && !e.actions && !e.action ? this._wrapThumbnailDesktopBox(a, e) : a;
647
647
  }
648
- _buildMobileListItemHtml(e, t, n, r = !1) {
648
+ _buildMobileListItemHtml(e, t, n = !1) {
649
649
  if (!this._configuration) return "";
650
- let i = t, a = typeof this._configuration.onRowClick == "function", o = this._mobileThumbnailColumn(), s = this._mobilePrimaryColumn(), c = this._mobileActionsDropdownColumn(), l = o ? this._buildTableCellInnerHtml(o, e, i, "mobile") : "", u = s ? this._buildTableCellInnerHtml(s, e, i, "mobile") : "", d = c ? this._buildTableCellInnerHtml(c, e, i, "mobile") : "", f = [], p = this._configuration.mobileShowLabels === !0;
650
+ let r = t, i = typeof this._configuration.onRowClick == "function", a = this._mobileThumbnailColumn(), o = this._mobilePrimaryColumn(), s = this._mobileActionsDropdownColumn(), c = a ? this._buildTableCellInnerHtml(a, e, r, "mobile") : "", l = o ? this._buildTableCellInnerHtml(o, e, r, "mobile") : "", u = s ? this._buildTableCellInnerHtml(s, e, r, "mobile") : "", d = [], f = this._configuration.mobileShowLabels === !0;
651
651
  for (let t of this._configuration.columns) {
652
- if (t.hidden || o && t === o || s && t === s || c && t === c) continue;
652
+ if (t.hidden || a && t === a || o && t === o || s && t === s) continue;
653
653
  let n = this._columnPlainSummaryText(t, e);
654
- if (n) if (p) {
654
+ if (n) if (f) {
655
655
  let e = this._stripHtml(String(t.label || "")).trim();
656
- e ? f.push(`${this._escapeHtml(e)}: ${this._escapeHtml(n)}`) : f.push(this._escapeHtml(n));
657
- } else f.push(this._escapeHtml(n));
656
+ e ? d.push(`${this._escapeHtml(e)}: ${this._escapeHtml(n)}`) : d.push(this._escapeHtml(n));
657
+ } else d.push(this._escapeHtml(n));
658
658
  }
659
- let m = f.join("<span class=\"text-gray-300 dark:text-gray-600\" aria-hidden=\"true\"> · </span>"), h = [
659
+ let p = d.join("<span class=\"text-gray-300 dark:text-gray-600\" aria-hidden=\"true\"> · </span>"), m = [
660
660
  "list-none",
661
661
  "mint-resource-table-mobile-row",
662
- ...r ? [] : [
662
+ ...n ? [] : [
663
663
  "border-b",
664
664
  "border-gray-200",
665
665
  "dark:border-mint-divider"
666
666
  ],
667
- a ? "cursor-pointer" : ""
668
- ].filter(Boolean).join(" "), g = `<div class="flex items-center gap-3 py-3 pr-4${o ? " pl-0" : " pl-4"}">`;
669
- if (o) {
670
- let e = this._thumbnailMobilePx(o), t = `width:${e}px;height:${e}px;min-width:${e}px;min-height:${e}px`;
671
- g += `<div class="flex shrink-0 items-stretch overflow-hidden rounded-md border border-gray-200 bg-gray-100 p-0 dark:border-mint-divider dark:bg-mint-hover [&>*]:m-0 [&>*]:min-h-0 [&>*]:min-w-0 [&>*]:w-full [&>*]:max-w-full [&>*]:p-0 [&>span]:flex [&>span]:h-full [&>span]:w-full [&>span]:min-h-0 [&>span]:min-w-0 [&>span]:items-stretch [&>span]:justify-stretch [&_img]:!m-0 [&_img]:!box-border [&_img]:!block [&_img]:!h-full [&_img]:!w-full [&_img]:!min-h-0 [&_img]:!min-w-0 [&_img]:!max-h-full [&_img]:!max-w-full [&_img]:!border-0 [&_img]:!p-0 [&_img]:!rounded-none [&_img]:!object-cover [&_img]:!object-center" style="${t}">${l}</div>`;
667
+ i ? "cursor-pointer" : ""
668
+ ].filter(Boolean).join(" "), h = `<div class="flex items-center gap-3 py-3 pr-4${a ? " pl-0" : " pl-4"}">`;
669
+ if (a) {
670
+ let e = this._thumbnailMobilePx(a), t = `width:${e}px;height:${e}px;min-width:${e}px;min-height:${e}px`;
671
+ h += `<div class="flex shrink-0 items-stretch overflow-hidden rounded-md border border-gray-200 bg-gray-100 p-0 dark:border-mint-divider dark:bg-mint-hover [&>*]:m-0 [&>*]:min-h-0 [&>*]:min-w-0 [&>*]:w-full [&>*]:max-w-full [&>*]:p-0 [&>span]:flex [&>span]:h-full [&>span]:w-full [&>span]:min-h-0 [&>span]:min-w-0 [&>span]:items-stretch [&>span]:justify-stretch [&_img]:!m-0 [&_img]:!box-border [&_img]:!block [&_img]:!h-full [&_img]:!w-full [&_img]:!min-h-0 [&_img]:!min-w-0 [&_img]:!max-h-full [&_img]:!max-w-full [&_img]:!border-0 [&_img]:!p-0 [&_img]:!rounded-none [&_img]:!object-cover [&_img]:!object-center" style="${t}">${c}</div>`;
672
672
  }
673
- g += "<div class=\"flex min-w-0 flex-1 flex-col justify-center gap-1 mint-resource-table-mobile-content\">", g += "<div class=\"flex items-start justify-between gap-2 mint-resource-table-mobile-primary-row\">", g += `<div class="min-w-0 text-sm font-semibold leading-snug text-gray-900 dark:text-white mint-resource-table-mobile-primary">${u}</div>`, d && (g += `<div class="shrink-0 -mr-1 mint-resource-table-mobile-actions">${d}</div>`), g += "</div>", m && (g += `<div class="text-xs font-normal leading-snug text-gray-500 dark:text-gray-400 mint-resource-table-mobile-meta">${m}</div>`), g += "</div></div>";
674
- let _ = typeof n == "number" && n > 0 ? ` style="box-sizing:border-box;min-height:${n}px;max-height:${n}px;height:${n}px;overflow:hidden"` : "";
675
- return `<li data-row-index="${i}" ${a ? "data-row-clickable=\"true\" " : ""}class="${h}"${_}>${g}</li>`;
673
+ return h += "<div class=\"flex min-w-0 flex-1 flex-col justify-center gap-1 mint-resource-table-mobile-content\">", h += "<div class=\"flex items-start justify-between gap-2 mint-resource-table-mobile-primary-row\">", h += `<div class="min-w-0 text-sm font-semibold leading-snug text-gray-900 dark:text-white mint-resource-table-mobile-primary">${l}</div>`, u && (h += `<div class="shrink-0 -mr-1 mint-resource-table-mobile-actions">${u}</div>`), h += "</div>", p && (h += `<div class="text-xs font-normal leading-snug text-gray-500 dark:text-gray-400 mint-resource-table-mobile-meta">${p}</div>`), h += "</div></div>", `<li data-row-index="${r}" ${i ? "data-row-clickable=\"true\" " : ""}class="${m}">${h}</li>`;
676
674
  }
677
675
  _buildMobileListPlaceholderLi(e, t, n = !1) {
678
676
  let r = this._mobileThumbnailColumn(), i = r ? this._thumbnailMobilePx(r) : 56, a = `width:${i}px;height:${i}px;min-width:${i}px;min-height:${i}px`;
@@ -693,14 +691,14 @@ var n = {
693
691
  i === "px" ? s = ` style="width:${r}px;min-width:0"` : i === "lit" ? s = ` style="width:${this._escapeHtml(r)};min-width:0"` : a && (s = ` style="${a}"`), o += `<col${s} />`;
694
692
  }), o += "</colgroup>", o;
695
693
  }
696
- _buildDataRowHtml(e, t, n, r = !1) {
694
+ _buildDataRowHtml(e, t, n = !1) {
697
695
  if (!this._configuration) return "";
698
- let i = t, a = n, o = `box-sizing:border-box;min-height:${a}px;max-height:${a}px;height:${a}px;overflow:hidden`, s = "", c = typeof this._configuration.onRowClick == "function", l = c ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800" : "", u = c ? " data-row-clickable=\"true\"" : "", d = l ? ` class="${l}"` : "";
699
- return s += `<tr data-row-index="${i}"${r ? " data-mint-rt-last-row=\"\"" : ""}${u}${d} style="${o}">`, this._configuration.columns.forEach((t) => {
696
+ let r = t, i = "", a = typeof this._configuration.onRowClick == "function", o = a ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800" : "", s = a ? " data-row-clickable=\"true\"" : "", c = o ? ` class="${o}"` : "";
697
+ return i += `<tr data-row-index="${r}"${n ? " data-mint-rt-last-row=\"\"" : ""}${s}${c}>`, this._configuration.columns.forEach((t) => {
700
698
  if (t.hidden) return;
701
- let n = !t.show || t.show(this, e), r = `${this._getStyle(t)}box-sizing:border-box;max-height:${a}px;overflow:hidden;vertical-align:middle;`;
702
- s += `<td style="${r}" class="${this._getClasses(t, !0)}">`, s += n ? this._buildTableCellInnerHtml(t, e, i) : "", s += "</td>";
703
- }), s += "</tr>", s;
699
+ let n = !t.show || t.show(this, e), a = `${this._getStyle(t)}box-sizing:border-box;vertical-align:middle;`;
700
+ i += `<td style="${a}" class="${this._getClasses(t, !0)}">`, i += n ? this._buildTableCellInnerHtml(t, e, r) : "", i += "</td>";
701
+ }), i += "</tr>", i;
704
702
  }
705
703
  _getVirtualRowCount() {
706
704
  return !this._virtualScrollActive() || !this._configuration ? 0 : this._type === "provided" ? this._getAllFilteredRowsSorted().length : this._type === "ajax" ? this._totalRows : 0;
@@ -781,14 +779,14 @@ var n = {
781
779
  g += `<li aria-hidden="true" class="pointer-events-none m-0 block list-none border-0 p-0" style="height:${m}px"></li>`;
782
780
  for (let e = d; e < f; e++) {
783
781
  let t = this._getVirtualRowAt(e), n = i > 0 && e === i - 1;
784
- t ? g += this._buildMobileListItemHtml(t, e, a, n) : g += this._buildMobileListPlaceholderLi(e, a, n);
782
+ t ? g += this._buildMobileListItemHtml(t, e, n) : g += this._buildMobileListPlaceholderLi(e, a, n);
785
783
  }
786
784
  g += `<li aria-hidden="true" class="pointer-events-none m-0 block list-none border-0 p-0" style="height:${h}px"></li>`;
787
785
  } else {
788
786
  g += `<tr data-mint-rt-spacer="top" aria-hidden="true"><td colspan="${o}" style="height:${m}px;padding:0;border:0;line-height:0;font-size:0"></td></tr>`;
789
787
  for (let e = d; e < f; e++) {
790
788
  let t = this._getVirtualRowAt(e), n = i > 0 && e === i - 1;
791
- t ? g += this._buildDataRowHtml(t, e, a, n) : g += this._buildVirtualPlaceholderRowHtml(e, a, n);
789
+ t ? g += this._buildDataRowHtml(t, e, n) : g += this._buildVirtualPlaceholderRowHtml(e, a, n);
792
790
  }
793
791
  g += `<tr data-mint-rt-spacer="bottom" aria-hidden="true"><td colspan="${o}" style="height:${h}px;padding:0;border:0;line-height:0;font-size:0"></td></tr>`;
794
792
  }
@@ -878,11 +876,11 @@ var n = {
878
876
  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(() => {
879
877
  if (this._sortTimeoutId = null, !this._configuration || !t || !e.sortable) return;
880
878
  let n = this._configuration.sort || "asc";
881
- 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);
879
+ 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);
882
880
  }, 10);
883
881
  else {
884
882
  let e = this._configuration.sort || "asc";
885
- 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());
883
+ 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());
886
884
  }
887
885
  }
888
886
  _getSortClass(e) {
@@ -918,8 +916,8 @@ var n = {
918
916
  }
919
917
  _showFetchingState() {}
920
918
  _triggerSearch() {
921
- 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(() => {
922
- this._type === "ajax" ? (this._offset = 0, this._fetchData(void 0, !1, this._perPage, 0)) : (this._searching = !1, this._virtualScrollActive() && queueMicrotask(() => this._scrollVirtualTableTopIntoView()));
919
+ 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(() => {
920
+ 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()));
923
921
  }, 400);
924
922
  }
925
923
  _updateSearchIcon() {
@@ -973,7 +971,7 @@ var n = {
973
971
  let i = this.querySelector(`#search-${this._tableId}`), a = document.activeElement === i || i?.querySelector("input") === document.activeElement, o = this._search, s = "", c = "";
974
972
  if ((this._fetching || this._loading) && !this._loaded && !this._sorting) return;
975
973
  n.forEach((e, t) => {
976
- c += this._buildMobileListItemHtml(e, t, void 0, t === n.length - 1);
974
+ c += this._buildMobileListItemHtml(e, t, t === n.length - 1);
977
975
  let r = typeof this._configuration.onRowClick == "function", i = r ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800" : "";
978
976
  s += `<tr data-row-index="${t}" ${r ? "data-row-clickable=\"true\"" : ""}${i ? ` class="${i}"` : ""}>`, this._configuration.columns.forEach((n) => {
979
977
  if (n.hidden) return;
@@ -1174,7 +1172,7 @@ var n = {
1174
1172
  i += `<div id="mint-rt-vscroll-${this._tableId}" class="overflow-y-auto overflow-x-auto min-h-0 w-full" style="max-height: ${a}; scrollbar-gutter: stable; overscroll-behavior-x: contain; overscroll-behavior-y: none; overflow-anchor: none;">`, i += "<div class=\"hidden min-h-0 min-w-0 md:block\">", i += `<mint-table class="${l}"${c}>`, i += `<table id="${this._tableId}" class="w-full min-w-0 table-fixed">`, i += e, i += this._renderTheadHtml(!0, !0, !0, s);
1175
1173
  } else i += "<div class=\"hidden min-h-0 min-w-0 md:block\">", i += `<mint-table class="${l}"${c}>`, i += `<table id="${this._tableId}">`, e && (i += this._renderColgroupHtml()), i += this._renderTheadHtml(!0, !0, !!e, s);
1176
1174
  if (i += "<tbody" + (e ? ` data-mint-rt-tbody="${this._tableId}"` : "") + ">", !this._fetching && !this._loading && !r && !e && n.forEach((e, t) => {
1177
- d += this._buildMobileListItemHtml(e, t, void 0, t === n.length - 1);
1175
+ d += this._buildMobileListItemHtml(e, t, t === n.length - 1);
1178
1176
  let r = typeof this._configuration.onRowClick == "function", a = r ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-mint-elevated" : "";
1179
1177
  i += `<tr data-row-index="${t}" ${r ? "data-row-clickable=\"true\"" : ""}${a ? ` class="${a}"` : ""}>`, this._configuration.columns.forEach((n) => {
1180
1178
  if (n.hidden) return;
@@ -1286,7 +1284,7 @@ var n = {
1286
1284
  _updatePageInUrl(e) {
1287
1285
  if (!this._tableId) return;
1288
1286
  let t = new URL(window.location.href), n = t.searchParams;
1289
- n.set(`mui.${this._tableId}`, e.toString()), e === 1 && n.set(`mui.${this._tableId}`, "1"), window.history.replaceState({}, "", t.toString());
1287
+ n.set(`mui.${this._tableId}`, e.toString()), e === 1 && n.set(`mui.${this._tableId}`, "1"), window.history.replaceState(window.history.state, "", t.toString());
1290
1288
  }
1291
1289
  _loadPageFromUrl() {
1292
1290
  if (!this._configuration || !this._tableId) return;