monobill-mintui 0.6.705 → 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/form/Form.d.ts.map +1 -1
- package/dist/components/form/browser.js +25 -8
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +25 -8
- 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 +75 -51
- package/package.json +1 -1
|
@@ -198,7 +198,7 @@ var n = {
|
|
|
198
198
|
return e !== null && e !== "false";
|
|
199
199
|
}
|
|
200
200
|
constructor() {
|
|
201
|
-
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;
|
|
201
|
+
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;
|
|
202
202
|
}
|
|
203
203
|
get inMintCard() {
|
|
204
204
|
return this._inMintCard;
|
|
@@ -218,7 +218,7 @@ var n = {
|
|
|
218
218
|
}), this._inMintCard = this.closest("mint-card") !== null, this._configuration || this._parseConfiguration(), this._initializeColumns(), this._loadPageFromUrl(), this._attachRowClickHandler(), this.render();
|
|
219
219
|
}
|
|
220
220
|
disconnectedCallback() {
|
|
221
|
-
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);
|
|
221
|
+
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);
|
|
222
222
|
}
|
|
223
223
|
attributeChangedCallback(e, t, n) {
|
|
224
224
|
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();
|
|
@@ -465,7 +465,12 @@ var n = {
|
|
|
465
465
|
this._mobileListMql && this._boundMobileListMqlListener && this._mobileListMql.removeEventListener("change", this._boundMobileListMqlListener), this._mobileListMql = null, this._boundMobileListMqlListener = null;
|
|
466
466
|
}
|
|
467
467
|
_useMobileListLayout() {
|
|
468
|
-
return
|
|
468
|
+
return this._mobileListMql ? this._mobileListMql.matches : typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(max-width: 767px)").matches : !1;
|
|
469
|
+
}
|
|
470
|
+
_scheduleInitialMobileLayoutSync(e) {
|
|
471
|
+
this._initialMobileLayoutRaf !== null || typeof window.requestAnimationFrame != "function" || (this._initialMobileLayoutRaf = window.requestAnimationFrame(() => {
|
|
472
|
+
this._initialMobileLayoutRaf = null, this.isConnected && this._configuration && this._useMobileListLayout() !== e && this.render();
|
|
473
|
+
}));
|
|
469
474
|
}
|
|
470
475
|
_paginationHostPlaceholderHtml() {
|
|
471
476
|
if (!this._configuration?.perPage || this._virtualScrollActive()) return "";
|
|
@@ -618,7 +623,7 @@ var n = {
|
|
|
618
623
|
}
|
|
619
624
|
_buildTableCellInnerHtml(e, t, n, r = "table") {
|
|
620
625
|
if (!this._configuration) return "";
|
|
621
|
-
let i = n, a = "";
|
|
626
|
+
let i = n, a = "", o = r === "mobile" ? "mobile" : "desktop";
|
|
622
627
|
if (!(!e.show || e.show(this, t))) return "";
|
|
623
628
|
if (e.raw) if (e.action) {
|
|
624
629
|
if (!e.action.show || e.action.show(this, t)) {
|
|
@@ -626,7 +631,7 @@ var n = {
|
|
|
626
631
|
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>`;
|
|
627
632
|
}
|
|
628
633
|
} else if (e.actions) if (e.actionStyle !== "buttons") {
|
|
629
|
-
let n = `actions-popover-${this._tableId}-${i}`, r = `actions-button-${this._tableId}-${i}`;
|
|
634
|
+
let n = `actions-popover-${this._tableId}-${o}-${i}`, r = `actions-button-${this._tableId}-${o}-${i}`;
|
|
630
635
|
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) => {
|
|
631
636
|
if (!n.show || n.show(this, t)) {
|
|
632
637
|
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\"" : "";
|
|
@@ -642,7 +647,7 @@ var n = {
|
|
|
642
647
|
else typeof e.format == "function" ? a += e.format(this, t) : e.data && (a += this._escapeHtml(String(t[e.data] || "")));
|
|
643
648
|
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>`);
|
|
644
649
|
else if (e.actions) if (e.actionStyle !== "buttons") {
|
|
645
|
-
let n = `actions-popover-${this._tableId}-${i}`, r = `actions-button-${this._tableId}-${i}`;
|
|
650
|
+
let n = `actions-popover-${this._tableId}-${o}-${i}`, r = `actions-button-${this._tableId}-${o}-${i}`;
|
|
646
651
|
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) => {
|
|
647
652
|
if (!n.show || n.show(this, t)) {
|
|
648
653
|
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\"" : "";
|
|
@@ -1145,12 +1150,14 @@ var n = {
|
|
|
1145
1150
|
return;
|
|
1146
1151
|
}
|
|
1147
1152
|
this._ensureMobileListMql();
|
|
1148
|
-
let e =
|
|
1149
|
-
|
|
1150
|
-
let t =
|
|
1153
|
+
let e = this._useMobileListLayout();
|
|
1154
|
+
this._scheduleInitialMobileLayoutSync(e);
|
|
1155
|
+
let t = String(this._configuration.id || "").trim();
|
|
1156
|
+
t && (this.id = t), this._detachVirtualScroll(), this._detachFixedChromeResize(), this._virtualScrollActive() || this._virtualRowCache.clear();
|
|
1157
|
+
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();
|
|
1151
1158
|
this._lastPage || Math.ceil(this._rows.length / this._perPage);
|
|
1152
|
-
let
|
|
1153
|
-
if (
|
|
1159
|
+
let i = this._isExternalLoading(), a = "";
|
|
1160
|
+
if (n) {
|
|
1154
1161
|
let e = this._fixedControls(), t = [
|
|
1155
1162
|
"flex",
|
|
1156
1163
|
"items-center",
|
|
@@ -1158,60 +1165,60 @@ var n = {
|
|
|
1158
1165
|
this._inMintCard ? "p-3.5" : "mb-3",
|
|
1159
1166
|
e ? "sticky top-0 z-20 bg-white dark:bg-mint-nav border-b border-gray-200 dark:border-mint-divider" : ""
|
|
1160
1167
|
].filter(Boolean).join(" ");
|
|
1161
|
-
if (
|
|
1168
|
+
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) {
|
|
1162
1169
|
let e = `search-${this._tableId}`, t = this._escapeHtml(this._configuration.searchPlaceholder || "Search...");
|
|
1163
|
-
|
|
1170
|
+
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>`;
|
|
1164
1171
|
}
|
|
1165
|
-
|
|
1172
|
+
a += this._toolbarButtonsHtml("right"), a += "</div>", a += "</div>";
|
|
1166
1173
|
}
|
|
1167
|
-
if ((this._type === "ajax" && !this._loaded || this._type === "provided" &&
|
|
1174
|
+
if ((this._type === "ajax" && !this._loaded || this._type === "provided" && i) && !this._fetchError && !this._sorting) {
|
|
1168
1175
|
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 ";
|
|
1169
|
-
|
|
1176
|
+
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) => {
|
|
1170
1177
|
if (e.hidden) return;
|
|
1171
1178
|
let n = e.sortable ? " data-mint-rt-sortable=\"\"" : "";
|
|
1172
|
-
if (
|
|
1173
|
-
if (
|
|
1179
|
+
if (a += `<th width="${e.width || ""}" style="${this._getStyle(e)}" class="${this._getClasses(e)}" data-column-key="${t}"${n}>`, e.showLabel !== !1) {
|
|
1180
|
+
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) {
|
|
1174
1181
|
let t = this._getSortClass(e);
|
|
1175
|
-
t === "spinner" ?
|
|
1182
|
+
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>`);
|
|
1176
1183
|
}
|
|
1177
|
-
|
|
1184
|
+
a += "</div>";
|
|
1178
1185
|
}
|
|
1179
|
-
|
|
1180
|
-
}),
|
|
1181
|
-
for (let e = 0; e < 4; e++)
|
|
1186
|
+
a += "</th>";
|
|
1187
|
+
}), a += "</tr></thead>", a += "<tbody>";
|
|
1188
|
+
for (let e = 0; e < 4; e++) a += "<tr>", this._configuration.columns.forEach((e) => {
|
|
1182
1189
|
if (!e.hidden) {
|
|
1183
|
-
if (
|
|
1190
|
+
if (a += `<td style="${this._getStyle(e)}" class="${this._getClasses(e, !0)}">`, e.thumbnail) {
|
|
1184
1191
|
let t = this._thumbnailDesktopPx(e);
|
|
1185
|
-
|
|
1186
|
-
} else
|
|
1187
|
-
|
|
1192
|
+
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>`;
|
|
1193
|
+
} else a += "<div class=\"h-4 max-w-[95%] rounded bg-gray-200 dark:bg-white/15 animate-pulse\"></div>";
|
|
1194
|
+
a += "</td>";
|
|
1188
1195
|
}
|
|
1189
|
-
}),
|
|
1190
|
-
|
|
1196
|
+
}), a += "</tr>";
|
|
1197
|
+
a += "</tbody>", a += "</table>", a += "</mint-table>", a += "</div>", a += this._paginationHostPlaceholderHtml();
|
|
1191
1198
|
} else {
|
|
1192
|
-
let e = this._virtualScrollActive() && (this._type === "provided" || this._type === "ajax" && this._loaded && !this._fetchError), t = e && this._virtualScrollRoot() === "table-body",
|
|
1199
|
+
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 = "";
|
|
1193
1200
|
if (t) {
|
|
1194
1201
|
let e = this._renderColgroupHtml();
|
|
1195
|
-
|
|
1196
|
-
} else
|
|
1197
|
-
if (
|
|
1198
|
-
d += this._buildMobileListItemHtml(e, t, t ===
|
|
1199
|
-
let
|
|
1200
|
-
|
|
1202
|
+
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);
|
|
1203
|
+
} 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);
|
|
1204
|
+
if (a += "<tbody" + (e ? ` data-mint-rt-tbody="${this._tableId}"` : "") + ">", !this._fetching && !this._loading && !i && !e && r.forEach((e, t) => {
|
|
1205
|
+
d += this._buildMobileListItemHtml(e, t, t === r.length - 1);
|
|
1206
|
+
let n = typeof this._configuration.onRowClick == "function", i = n ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-mint-elevated" : "";
|
|
1207
|
+
a += `<tr data-row-index="${t}" ${n ? "data-row-clickable=\"true\"" : ""}${i ? ` class="${i}"` : ""}>`, this._configuration.columns.forEach((n) => {
|
|
1201
1208
|
if (n.hidden) return;
|
|
1202
1209
|
let r = !n.show || n.show(this, e);
|
|
1203
|
-
|
|
1204
|
-
}),
|
|
1205
|
-
}), !this._fetching && !this._loading && !
|
|
1210
|
+
a += `<td style="${this._getStyle(n)}" class="${this._getClasses(n, !0)}">`, r && (a += this._buildTableCellInnerHtml(n, e, t, "table")), a += "</td>";
|
|
1211
|
+
}), a += "</tr>";
|
|
1212
|
+
}), !this._fetching && !this._loading && !i && r.length === 0) if (this._fetchError) {
|
|
1206
1213
|
let e = this._configuration.columns.filter((e) => !e.hidden).length;
|
|
1207
|
-
|
|
1214
|
+
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>`;
|
|
1208
1215
|
} else {
|
|
1209
1216
|
let e = this._configuration.columns.filter((e) => !e.hidden).length;
|
|
1210
|
-
|
|
1217
|
+
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>";
|
|
1211
1218
|
}
|
|
1212
|
-
|
|
1219
|
+
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>");
|
|
1213
1220
|
}
|
|
1214
|
-
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 =
|
|
1221
|
+
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) => {
|
|
1215
1222
|
e.render && e.render();
|
|
1216
1223
|
}), this.querySelectorAll("mint-button[data-mint-rt-toolbar]").forEach((e) => {
|
|
1217
1224
|
e.render && e.render();
|