monobill-mintui 0.6.706 → 0.6.707
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/components/resource-table/ResourceTable.d.ts +2 -0
- package/dist/components/resource-table/ResourceTable.d.ts.map +1 -1
- package/dist/components/resource-table/browser.js +50 -43
- package/dist/components/resource-table/index.cjs +2 -2
- package/dist/components/resource-table/index.js +50 -43
- package/dist/index.cjs +2 -2
- package/dist/index.js +50 -43
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10100,7 +10100,7 @@ var Gn = class extends HTMLElement {
|
|
|
10100
10100
|
return e !== null && e !== "false";
|
|
10101
10101
|
}
|
|
10102
10102
|
constructor() {
|
|
10103
|
-
super(), this._configuration = null, this._rows = [], 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._virtualFetchGeneration = 0, this._virtualAjaxPrefetchTimer = null, this._fixedChromeResizeObserver = null, this._utilityClassObserver = null;
|
|
10103
|
+
super(), this._configuration = null, this._rows = [], 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._initialMobileLayoutRaf = null, this._virtualFetchGeneration = 0, this._virtualAjaxPrefetchTimer = null, this._fixedChromeResizeObserver = null, this._utilityClassObserver = null;
|
|
10104
10104
|
}
|
|
10105
10105
|
get inMintCard() {
|
|
10106
10106
|
return this._inMintCard;
|
|
@@ -10120,7 +10120,7 @@ var Gn = class extends HTMLElement {
|
|
|
10120
10120
|
}), this._inMintCard = this.closest("mint-card") !== null, this._configuration || this._parseConfiguration(), this._initializeColumns(), this._loadPageFromUrl(), this._attachRowClickHandler(), this.render();
|
|
10121
10121
|
}
|
|
10122
10122
|
disconnectedCallback() {
|
|
10123
|
-
this._searchTimeoutId && clearTimeout(this._searchTimeoutId), this._detachVirtualScroll(), this._detachFixedChromeResize(), this._detachMobileListMql(), this._utilityClassObserver?.disconnect(), this._utilityClassObserver = null, this._rowClickHandler &&= (this.removeEventListener("click", this._rowClickHandler, !0), null), this._scrollHandler &&= (window.removeEventListener("scroll", this._scrollHandler), null);
|
|
10123
|
+
this._searchTimeoutId && clearTimeout(this._searchTimeoutId), this._detachVirtualScroll(), this._detachFixedChromeResize(), this._detachMobileListMql(), this._initialMobileLayoutRaf !== null && (window.cancelAnimationFrame(this._initialMobileLayoutRaf), this._initialMobileLayoutRaf = null), this._utilityClassObserver?.disconnect(), this._utilityClassObserver = null, this._rowClickHandler &&= (this.removeEventListener("click", this._rowClickHandler, !0), null), this._scrollHandler &&= (window.removeEventListener("scroll", this._scrollHandler), null);
|
|
10124
10124
|
}
|
|
10125
10125
|
attributeChangedCallback(e, t, n) {
|
|
10126
10126
|
e === "configuration" && t !== n ? (!this._configuration || typeof n == "string") && (this._parseConfiguration(), this.render()) : t !== n && (e === "loading" || e === "virtual-scroll" || e === "virtual-scroll-root" || e === "virtual-row-height" || e === "virtual-max-height" || e === "fixed-header" || e === "fixed-controls") && this._configuration && this.isConnected && this.render();
|
|
@@ -10367,7 +10367,12 @@ var Gn = class extends HTMLElement {
|
|
|
10367
10367
|
this._mobileListMql && this._boundMobileListMqlListener && this._mobileListMql.removeEventListener("change", this._boundMobileListMqlListener), this._mobileListMql = null, this._boundMobileListMqlListener = null;
|
|
10368
10368
|
}
|
|
10369
10369
|
_useMobileListLayout() {
|
|
10370
|
-
return
|
|
10370
|
+
return this._mobileListMql ? this._mobileListMql.matches : typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(max-width: 767px)").matches : !1;
|
|
10371
|
+
}
|
|
10372
|
+
_scheduleInitialMobileLayoutSync(e) {
|
|
10373
|
+
this._initialMobileLayoutRaf !== null || typeof window.requestAnimationFrame != "function" || (this._initialMobileLayoutRaf = window.requestAnimationFrame(() => {
|
|
10374
|
+
this._initialMobileLayoutRaf = null, this.isConnected && this._configuration && this._useMobileListLayout() !== e && this.render();
|
|
10375
|
+
}));
|
|
10371
10376
|
}
|
|
10372
10377
|
_paginationHostPlaceholderHtml() {
|
|
10373
10378
|
if (!this._configuration?.perPage || this._virtualScrollActive()) return "";
|
|
@@ -10520,7 +10525,7 @@ var Gn = class extends HTMLElement {
|
|
|
10520
10525
|
}
|
|
10521
10526
|
_buildTableCellInnerHtml(e, t, n, r = "table") {
|
|
10522
10527
|
if (!this._configuration) return "";
|
|
10523
|
-
let i = n, a = "";
|
|
10528
|
+
let i = n, a = "", o = r === "mobile" ? "mobile" : "desktop";
|
|
10524
10529
|
if (!(!e.show || e.show(this, t))) return "";
|
|
10525
10530
|
if (e.raw) if (e.action) {
|
|
10526
10531
|
if (!e.action.show || e.action.show(this, t)) {
|
|
@@ -10528,7 +10533,7 @@ var Gn = class extends HTMLElement {
|
|
|
10528
10533
|
a += `<mint-button variant="solid" data-action="column-action" data-row-index="${i}" data-column-key="${this._configuration.columns.indexOf(e)}">${this._escapeHtml(String(n))}</mint-button>`;
|
|
10529
10534
|
}
|
|
10530
10535
|
} else if (e.actions) if (e.actionStyle !== "buttons") {
|
|
10531
|
-
let n = `actions-popover-${this._tableId}-${i}`, r = `actions-button-${this._tableId}-${i}`;
|
|
10536
|
+
let n = `actions-popover-${this._tableId}-${o}-${i}`, r = `actions-button-${this._tableId}-${o}-${i}`;
|
|
10532
10537
|
a += `<mint-button id="${r}" variant="ghost" icon="ellipsis">`, a += "</mint-button>", a += `<mint-popover id="${n}" trigger-id="${r}" direction="down">`, a += "<div class=\"mint-resource-action-menu\">", e.actions.forEach((n, r) => {
|
|
10533
10538
|
if (!n.show || n.show(this, t)) {
|
|
10534
10539
|
let o = typeof n.label == "function" ? n.label(this, t) : n.label, s = n.icon ? ` icon="${this._escapeHtml(n.icon)}"` : "", c = n.variant ? this._escapeHtml(n.variant) : "ghost", l = n.tone ? ` tone="${this._escapeHtml(n.tone)}"` : "", u = (typeof n.active == "function" ? n.active(this, t) : n.active) ? " active=\"true\"" : "";
|
|
@@ -10544,7 +10549,7 @@ var Gn = class extends HTMLElement {
|
|
|
10544
10549
|
else typeof e.format == "function" ? a += e.format(this, t) : e.data && (a += this._escapeHtml(String(t[e.data] || "")));
|
|
10545
10550
|
else if (e.action) (!e.action.show || e.action.show(this, t)) && (a += `<mint-button variant="solid" data-action="column-action" data-row-index="${i}" data-column-key="${this._configuration.columns.indexOf(e)}">${e.action.label}</mint-button>`);
|
|
10546
10551
|
else if (e.actions) if (e.actionStyle !== "buttons") {
|
|
10547
|
-
let n = `actions-popover-${this._tableId}-${i}`, r = `actions-button-${this._tableId}-${i}`;
|
|
10552
|
+
let n = `actions-popover-${this._tableId}-${o}-${i}`, r = `actions-button-${this._tableId}-${o}-${i}`;
|
|
10548
10553
|
a += `<mint-button id="${r}" variant="ghost" icon="ellipsis">`, a += "</mint-button>", a += `<mint-popover id="${n}" trigger-id="${r}" direction="down">`, a += "<div class=\"mint-resource-action-menu\">", e.actions.forEach((n, r) => {
|
|
10549
10554
|
if (!n.show || n.show(this, t)) {
|
|
10550
10555
|
let o = typeof n.label == "function" ? n.label(this, t) : n.label, s = n.icon ? ` icon="${this._escapeHtml(n.icon)}"` : "", c = n.variant ? this._escapeHtml(n.variant) : "ghost", l = n.tone ? ` tone="${this._escapeHtml(n.tone)}"` : "", u = (typeof n.active == "function" ? n.active(this, t) : n.active) ? " active=\"true\"" : "";
|
|
@@ -11047,12 +11052,14 @@ var Gn = class extends HTMLElement {
|
|
|
11047
11052
|
return;
|
|
11048
11053
|
}
|
|
11049
11054
|
this._ensureMobileListMql();
|
|
11050
|
-
let e =
|
|
11051
|
-
|
|
11052
|
-
let t =
|
|
11055
|
+
let e = this._useMobileListLayout();
|
|
11056
|
+
this._scheduleInitialMobileLayoutSync(e);
|
|
11057
|
+
let t = String(this._configuration.id || "").trim();
|
|
11058
|
+
t && (this.id = t), this._detachVirtualScroll(), this._detachFixedChromeResize(), this._virtualScrollActive() || this._virtualRowCache.clear();
|
|
11059
|
+
let n = !this._loaded || this._rows.length > 0 || this._search.length > 0 || this._searching || this._configuration.showSearch !== !1 || !!this._configuration.buttons?.length, r = this._getRows();
|
|
11053
11060
|
this._lastPage || Math.ceil(this._rows.length / this._perPage);
|
|
11054
|
-
let
|
|
11055
|
-
if (
|
|
11061
|
+
let i = this._isExternalLoading(), a = "";
|
|
11062
|
+
if (n) {
|
|
11056
11063
|
let e = this._fixedControls(), t = [
|
|
11057
11064
|
"flex",
|
|
11058
11065
|
"items-center",
|
|
@@ -11060,60 +11067,60 @@ var Gn = class extends HTMLElement {
|
|
|
11060
11067
|
this._inMintCard ? "p-3.5" : "mb-3",
|
|
11061
11068
|
e ? "sticky top-0 z-20 bg-white dark:bg-mint-nav border-b border-gray-200 dark:border-mint-divider" : ""
|
|
11062
11069
|
].filter(Boolean).join(" ");
|
|
11063
|
-
if (
|
|
11070
|
+
if (a += `<div id="mint-rt-fixed-controls-${this._tableId}" class="${t}">`, a += "<div class=\"flex min-w-0 flex-1 items-center gap-2\">", a += this._buildMobileSortToolbarHtml(), a += this._toolbarButtonsHtml("left"), this._configuration.showSearch !== !1) {
|
|
11064
11071
|
let e = `search-${this._tableId}`, t = this._escapeHtml(this._configuration.searchPlaceholder || "Search...");
|
|
11065
|
-
|
|
11072
|
+
a += `<mint-input id="${e}" type="search" label="" placeholder="${t}" class="min-w-0 flex-1" icon="search" value="${this._escapeHtml(this._search)}"></mint-input>`;
|
|
11066
11073
|
}
|
|
11067
|
-
|
|
11074
|
+
a += this._toolbarButtonsHtml("right"), a += "</div>", a += "</div>";
|
|
11068
11075
|
}
|
|
11069
|
-
if ((this._type === "ajax" && !this._loaded || this._type === "provided" &&
|
|
11076
|
+
if ((this._type === "ajax" && !this._loaded || this._type === "provided" && i) && !this._fetchError && !this._sorting) {
|
|
11070
11077
|
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 ";
|
|
11071
|
-
|
|
11078
|
+
a += "<div class=\"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>", this._configuration.columns.forEach((e, t) => {
|
|
11072
11079
|
if (e.hidden) return;
|
|
11073
11080
|
let n = e.sortable ? " data-mint-rt-sortable=\"\"" : "";
|
|
11074
|
-
if (
|
|
11075
|
-
if (
|
|
11081
|
+
if (a += `<th width="${e.width || ""}" style="${this._getStyle(e)}" class="${this._getClasses(e)}" data-column-key="${t}"${n}>`, e.showLabel !== !1) {
|
|
11082
|
+
if (a += "<div class=\"flex items-center\" data-mint-rt-sort-label>", a += `<div class="flex-1">${e.raw ? e.label : this._escapeHtml(e.label)}</div>`, e.sortable) {
|
|
11076
11083
|
let t = this._getSortClass(e);
|
|
11077
|
-
t === "spinner" ?
|
|
11084
|
+
t === "spinner" ? a += "<div class=\"ml-2 flex items-center\" data-mint-rt-sort-icon><mint-spinner class=\"w-4 h-4\"></mint-spinner></div>" : (t === "caret-up" || t === "caret-down") && (a += `<div class="ml-2 flex items-center" data-mint-rt-sort-icon><mint-icon name="${t}" class="w-4 h-4"></mint-icon></div>`);
|
|
11078
11085
|
}
|
|
11079
|
-
|
|
11086
|
+
a += "</div>";
|
|
11080
11087
|
}
|
|
11081
|
-
|
|
11082
|
-
}),
|
|
11083
|
-
for (let e = 0; e < 4; e++)
|
|
11088
|
+
a += "</th>";
|
|
11089
|
+
}), a += "</tr></thead>", a += "<tbody>";
|
|
11090
|
+
for (let e = 0; e < 4; e++) a += "<tr>", this._configuration.columns.forEach((e) => {
|
|
11084
11091
|
if (!e.hidden) {
|
|
11085
|
-
if (
|
|
11092
|
+
if (a += `<td style="${this._getStyle(e)}" class="${this._getClasses(e, !0)}">`, e.thumbnail) {
|
|
11086
11093
|
let t = this._thumbnailDesktopPx(e);
|
|
11087
|
-
|
|
11088
|
-
} else
|
|
11089
|
-
|
|
11094
|
+
a += `<div class="rounded-md bg-gray-200 dark:bg-white/15 animate-pulse" style="width:${t}px;height:${t}px;box-sizing:border-box"></div>`;
|
|
11095
|
+
} else a += "<div class=\"h-4 max-w-[95%] rounded bg-gray-200 dark:bg-white/15 animate-pulse\"></div>";
|
|
11096
|
+
a += "</td>";
|
|
11090
11097
|
}
|
|
11091
|
-
}),
|
|
11092
|
-
|
|
11098
|
+
}), a += "</tr>";
|
|
11099
|
+
a += "</tbody>", a += "</table>", a += "</mint-table>", a += "</div>", a += this._paginationHostPlaceholderHtml();
|
|
11093
11100
|
} else {
|
|
11094
|
-
let e = this._virtualScrollActive() && (this._type === "provided" || this._type === "ajax" && this._loaded && !this._fetchError), t = e && this._virtualScrollRoot() === "table-body",
|
|
11101
|
+
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 = `mint-resource-table-mobile-list m-0 min-h-0 w-full list-none border-collapse overflow-x-hidden ${this._inMintCard ? "px-3.5 py-3.5" : "py-3"} md:hidden`, d = "";
|
|
11095
11102
|
if (t) {
|
|
11096
11103
|
let e = this._renderColgroupHtml();
|
|
11097
|
-
|
|
11098
|
-
} else
|
|
11099
|
-
if (
|
|
11100
|
-
d += this._buildMobileListItemHtml(e, t, t ===
|
|
11101
|
-
let
|
|
11102
|
-
|
|
11104
|
+
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=\"hidden min-h-0 min-w-0 md:block\">", 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);
|
|
11105
|
+
} else a += "<div class=\"hidden min-h-0 min-w-0 md:block\">", a += `<mint-table class="${l}"${c}>`, a += `<table id="${this._tableId}">`, e && (a += this._renderColgroupHtml()), a += this._renderTheadHtml(!0, !0, !!e, s);
|
|
11106
|
+
if (a += "<tbody" + (e ? ` data-mint-rt-tbody="${this._tableId}"` : "") + ">", !this._fetching && !this._loading && !i && !e && r.forEach((e, t) => {
|
|
11107
|
+
d += this._buildMobileListItemHtml(e, t, t === r.length - 1);
|
|
11108
|
+
let n = typeof this._configuration.onRowClick == "function", i = n ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-mint-elevated" : "";
|
|
11109
|
+
a += `<tr data-row-index="${t}" ${n ? "data-row-clickable=\"true\"" : ""}${i ? ` class="${i}"` : ""}>`, this._configuration.columns.forEach((n) => {
|
|
11103
11110
|
if (n.hidden) return;
|
|
11104
11111
|
let r = !n.show || n.show(this, e);
|
|
11105
|
-
|
|
11106
|
-
}),
|
|
11107
|
-
}), !this._fetching && !this._loading && !
|
|
11112
|
+
a += `<td style="${this._getStyle(n)}" class="${this._getClasses(n, !0)}">`, r && (a += this._buildTableCellInnerHtml(n, e, t, "table")), a += "</td>";
|
|
11113
|
+
}), a += "</tr>";
|
|
11114
|
+
}), !this._fetching && !this._loading && !i && r.length === 0) if (this._fetchError) {
|
|
11108
11115
|
let e = this._configuration.columns.filter((e) => !e.hidden).length;
|
|
11109
|
-
|
|
11116
|
+
a += `<tr><td colspan="${e}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>`, d += `<li class="list-none px-4 py-8 text-center text-sm text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</li>`;
|
|
11110
11117
|
} else {
|
|
11111
11118
|
let e = this._configuration.columns.filter((e) => !e.hidden).length;
|
|
11112
|
-
|
|
11119
|
+
a += `<tr><td colspan="${e}" class="text-center py-8">No data available.</td></tr>`, d += "<li class=\"list-none px-4 py-8 text-center text-sm\">No data available.</li>";
|
|
11113
11120
|
}
|
|
11114
|
-
|
|
11121
|
+
a += "</tbody>", a += "</table>", a += "</mint-table>", a += "</div>", a += `<ul class="${u}" data-mint-rt-mobile-list="${this._tableId}">${e && r.length > 0 ? "" : d}</ul>`, e || (a += this._paginationHostPlaceholderHtml()), t && (a += "</div>");
|
|
11115
11122
|
}
|
|
11116
|
-
this._fixedHeader() ? this.setAttribute("data-mint-rt-fixed-header", "") : this.removeAttribute("data-mint-rt-fixed-header"), this._fixedControls() ? this.setAttribute("data-mint-rt-fixed-controls", "") : this.removeAttribute("data-mint-rt-fixed-controls"), this.innerHTML =
|
|
11123
|
+
this._fixedHeader() ? this.setAttribute("data-mint-rt-fixed-header", "") : this.removeAttribute("data-mint-rt-fixed-header"), this._fixedControls() ? this.setAttribute("data-mint-rt-fixed-controls", "") : this.removeAttribute("data-mint-rt-fixed-controls"), this.innerHTML = a, this._replaceUtilityClasses(), this._updatePagination(), this.querySelectorAll("mint-button[data-action]").forEach((e) => {
|
|
11117
11124
|
e.render && e.render();
|
|
11118
11125
|
}), this.querySelectorAll("mint-button[data-mint-rt-toolbar]").forEach((e) => {
|
|
11119
11126
|
e.render && e.render();
|