monobill-mintui 0.3.24 → 0.3.26
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 +7 -0
- package/dist/components/form/Form.d.ts.map +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.js +123 -84
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2570,7 +2570,7 @@ class tt extends HTMLElement {
|
|
|
2570
2570
|
return this.hasAttribute("loading");
|
|
2571
2571
|
}
|
|
2572
2572
|
render() {
|
|
2573
|
-
var b, k,
|
|
2573
|
+
var b, k, x, E;
|
|
2574
2574
|
this.getType();
|
|
2575
2575
|
const t = this._getNormalizedType(), e = this._isTextarea(), i = this._isMoney(), s = this._isColor(), n = this.getPlaceholder(), r = this.isDisabled(), a = this.isReadonly(), l = this.isRequired(), o = this.getId(), c = this.getName(), d = this.getAttribute("value") || (s ? "#000000" : ""), p = this.getRows(), h = this.getIcon(), m = this.getLabel(), f = this.getInfo(), u = this.isLoading();
|
|
2576
2576
|
if (this._renderSkeleton(u), s) {
|
|
@@ -2630,15 +2630,15 @@ class tt extends HTMLElement {
|
|
|
2630
2630
|
const y = document.createElement("mint-icon");
|
|
2631
2631
|
y.setAttribute("name", "caret-down"), y.className = "w-[1rem] h-[1rem]", this._numberDecrementButton.appendChild(y), this._numberSpinnerContainer.appendChild(this._numberDecrementButton), this._numberIncrementButton.addEventListener("click", (w) => {
|
|
2632
2632
|
if (w.preventDefault(), w.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
|
|
2633
|
-
const A = parseFloat(this._input.value) || 0, I = parseFloat(this._input.step) || 1, S = this._input.min ? parseFloat(this._input.min) : void 0,
|
|
2633
|
+
const A = parseFloat(this._input.value) || 0, I = parseFloat(this._input.step) || 1, S = this._input.min ? parseFloat(this._input.min) : void 0, D = this._input.max ? parseFloat(this._input.max) : void 0;
|
|
2634
2634
|
let L = A + I;
|
|
2635
|
-
|
|
2635
|
+
D !== void 0 && L > D && (L = D), S !== void 0 && L < S && (L = S), this._input.value = L.toString(), this.setAttribute("value", L.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2636
2636
|
}
|
|
2637
2637
|
}), this._numberDecrementButton.addEventListener("click", (w) => {
|
|
2638
2638
|
if (w.preventDefault(), w.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
|
|
2639
|
-
const A = parseFloat(this._input.value) || 0, I = parseFloat(this._input.step) || 1, S = this._input.min ? parseFloat(this._input.min) : void 0,
|
|
2639
|
+
const A = parseFloat(this._input.value) || 0, I = parseFloat(this._input.step) || 1, S = this._input.min ? parseFloat(this._input.min) : void 0, D = this._input.max ? parseFloat(this._input.max) : void 0;
|
|
2640
2640
|
let L = A - I;
|
|
2641
|
-
S !== void 0 && L < S && (L = S),
|
|
2641
|
+
S !== void 0 && L < S && (L = S), D !== void 0 && L > D && (L = D), this._input.value = L.toString(), this.setAttribute("value", L.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2642
2642
|
}
|
|
2643
2643
|
});
|
|
2644
2644
|
}
|
|
@@ -2659,7 +2659,7 @@ class tt extends HTMLElement {
|
|
|
2659
2659
|
let v = g.querySelector(".mint-input-label");
|
|
2660
2660
|
if (m) {
|
|
2661
2661
|
v || (v = document.createElement("label"), v.className = "mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", g.insertBefore(v, g.firstChild)), v.textContent = m;
|
|
2662
|
-
const w = o || ((b = this._element) == null ? void 0 : b.id) || ((k = this._colorTextInput) == null ? void 0 : k.id) || ((
|
|
2662
|
+
const w = o || ((b = this._element) == null ? void 0 : b.id) || ((k = this._colorTextInput) == null ? void 0 : k.id) || ((x = this._input) == null ? void 0 : x.id) || ((E = this._textarea) == null ? void 0 : E.id);
|
|
2663
2663
|
if (w)
|
|
2664
2664
|
v.setAttribute("for", w);
|
|
2665
2665
|
else {
|
|
@@ -2980,22 +2980,22 @@ class et extends HTMLElement {
|
|
|
2980
2980
|
const u = t.split(i).filter((g) => g.length > 0), _ = e.split(/[\/\-\.\s]+/).filter((g) => g.length > 0);
|
|
2981
2981
|
if (u.length === _.length) {
|
|
2982
2982
|
let g = 0, b = 0, k = 0;
|
|
2983
|
-
for (let
|
|
2984
|
-
const
|
|
2985
|
-
if (
|
|
2983
|
+
for (let x = 0; x < _.length; x++) {
|
|
2984
|
+
const E = _[x].toLowerCase(), v = u[x];
|
|
2985
|
+
if (E.includes("d"))
|
|
2986
2986
|
g = parseInt(v, 10);
|
|
2987
|
-
else if (
|
|
2987
|
+
else if (E.includes("m"))
|
|
2988
2988
|
b = parseInt(v, 10) - 1;
|
|
2989
|
-
else if (
|
|
2989
|
+
else if (E.includes("y")) {
|
|
2990
2990
|
let y = parseInt(v, 10);
|
|
2991
|
-
const w =
|
|
2991
|
+
const w = E.length, A = v.length;
|
|
2992
2992
|
A === 2 && w === 4 ? y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y : A === 2 && w === 2 && (y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y), k = y;
|
|
2993
2993
|
}
|
|
2994
2994
|
}
|
|
2995
2995
|
if (g && b >= 0 && b <= 11 && k) {
|
|
2996
|
-
const
|
|
2997
|
-
if (!isNaN(
|
|
2998
|
-
return
|
|
2996
|
+
const x = new Date(k, b, g);
|
|
2997
|
+
if (!isNaN(x.getTime()) && x.getDate() === g && x.getMonth() === b && x.getFullYear() === k)
|
|
2998
|
+
return x;
|
|
2999
2999
|
}
|
|
3000
3000
|
}
|
|
3001
3001
|
}
|
|
@@ -3020,8 +3020,8 @@ class et extends HTMLElement {
|
|
|
3020
3020
|
} else if (u.char === "y") {
|
|
3021
3021
|
const _ = r.lastIndexOf("y") - r.indexOf("y") + 1, g = n.substr(m), b = Math.min(_, g.length), k = g.substr(0, b);
|
|
3022
3022
|
if (k.length === 0) return null;
|
|
3023
|
-
let
|
|
3024
|
-
b === 2 && _ === 4 ?
|
|
3023
|
+
let x = parseInt(k, 10);
|
|
3024
|
+
b === 2 && _ === 4 ? x = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + x : b === 2 && _ === 2 && (x = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + x), h = x, m += b;
|
|
3025
3025
|
}
|
|
3026
3026
|
if (!d || p < 0 || p > 11 || !h) return null;
|
|
3027
3027
|
const f = new Date(h, p, d);
|
|
@@ -3114,12 +3114,12 @@ class et extends HTMLElement {
|
|
|
3114
3114
|
this._startPartInputs = [], this._endPartInputs = [];
|
|
3115
3115
|
const _ = (b) => {
|
|
3116
3116
|
const k = document.createDocumentFragment();
|
|
3117
|
-
return u.forEach((
|
|
3118
|
-
if (
|
|
3119
|
-
const
|
|
3120
|
-
|
|
3117
|
+
return u.forEach((x) => {
|
|
3118
|
+
if (x.type === "sep") {
|
|
3119
|
+
const E = document.createElement("span");
|
|
3120
|
+
E.textContent = x.value, E.className = "text-gray-400 dark:text-gray-500 select-none", k.appendChild(E);
|
|
3121
3121
|
} else {
|
|
3122
|
-
const
|
|
3122
|
+
const E = x.part === "d" ? "dd" : x.part === "m" ? "mm" : x.len === 2 ? "yy" : "yyyy", v = this._createPartInput(x.len, E, n, r, a);
|
|
3123
3123
|
b === "start" ? this._startPartInputs.push(v) : this._endPartInputs.push(v), k.appendChild(v);
|
|
3124
3124
|
}
|
|
3125
3125
|
}), k;
|
|
@@ -3325,34 +3325,34 @@ class et extends HTMLElement {
|
|
|
3325
3325
|
this._currentMonth === 11 ? (this._currentMonth = 0, this._currentYear++) : this._currentMonth++, this._buildCalendar();
|
|
3326
3326
|
}), o.appendChild(f);
|
|
3327
3327
|
const _ = document.createElement("div");
|
|
3328
|
-
_.className = "grid grid-cols-7 mb-2", s.forEach((
|
|
3329
|
-
const
|
|
3330
|
-
|
|
3328
|
+
_.className = "grid grid-cols-7 mb-2", s.forEach((x) => {
|
|
3329
|
+
const E = document.createElement("div");
|
|
3330
|
+
E.className = "text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1", E.textContent = x, _.appendChild(E);
|
|
3331
3331
|
});
|
|
3332
3332
|
const g = document.createElement("div");
|
|
3333
3333
|
g.className = "grid grid-cols-7";
|
|
3334
|
-
for (let
|
|
3335
|
-
const
|
|
3336
|
-
|
|
3334
|
+
for (let x = 0; x < e; x++) {
|
|
3335
|
+
const E = document.createElement("div");
|
|
3336
|
+
E.className = "w-8 h-8", g.appendChild(E);
|
|
3337
3337
|
}
|
|
3338
3338
|
const b = this.getMin() ? this._parseDateString(this.getMin(), this.getFormat()) : null, k = this.getMax() ? this._parseDateString(this.getMax(), this.getFormat()) : null;
|
|
3339
|
-
for (let
|
|
3340
|
-
const
|
|
3339
|
+
for (let x = 1; x <= t; x++) {
|
|
3340
|
+
const E = new Date(this._currentYear, this._currentMonth, x), v = this._isToday(E), y = this._isDateSelected(E), w = this._isDateInRange(E), A = b && E < b || k && E > k;
|
|
3341
3341
|
let I = "rounded-md";
|
|
3342
3342
|
if (this._isRange && this._selectedStartDate && this._selectedEndDate) {
|
|
3343
|
-
const
|
|
3344
|
-
|
|
3343
|
+
const D = this._isSameDate(E, this._selectedStartDate), L = this._isSameDate(E, this._selectedEndDate);
|
|
3344
|
+
D && L ? I = "rounded-md" : D ? I = "rounded-l-md" : L ? I = "rounded-r-md" : w && (I = "rounded-none");
|
|
3345
3345
|
} else y && !this._isRange && (I = "rounded-md");
|
|
3346
3346
|
const S = document.createElement("button");
|
|
3347
|
-
S.type = "button", S.disabled = !!A, S.tabIndex = A ? -1 : 0, S.className = `w-full h-8 ${I} border-0 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${y ? "bg-slate-800 dark:bg-slate-600 text-white" : w ? "bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : v ? "text-gray-900 dark:text-gray-100 font-semibold" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"} ${A ? "opacity-40 cursor-not-allowed" : ""}`, S.textContent =
|
|
3348
|
-
this._handleDateClick(
|
|
3347
|
+
S.type = "button", S.disabled = !!A, S.tabIndex = A ? -1 : 0, S.className = `w-full h-8 ${I} border-0 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${y ? "bg-slate-800 dark:bg-slate-600 text-white" : w ? "bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : v ? "text-gray-900 dark:text-gray-100 font-semibold" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"} ${A ? "opacity-40 cursor-not-allowed" : ""}`, S.textContent = x.toString(), A || S.addEventListener("click", () => {
|
|
3348
|
+
this._handleDateClick(E);
|
|
3349
3349
|
}), g.appendChild(S);
|
|
3350
3350
|
}
|
|
3351
3351
|
if (r) {
|
|
3352
|
-
const E = document.createElement("div");
|
|
3353
|
-
E.className = "mb-4 pb-4 border-b border-gray-200 dark:border-gray-700 md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-gray-700 md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col";
|
|
3354
3352
|
const x = document.createElement("div");
|
|
3355
|
-
x.className = "
|
|
3353
|
+
x.className = "mb-4 pb-4 border-b border-gray-200 dark:border-gray-700 md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-gray-700 md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col";
|
|
3354
|
+
const E = document.createElement("div");
|
|
3355
|
+
E.className = "relative md:relative md:flex-1 md:min-h-0";
|
|
3356
3356
|
const v = document.createElement("div");
|
|
3357
3357
|
v.className = "flex gap-2 overflow-x-auto pb-1 md:flex-col md:overflow-x-visible md:overflow-y-auto md:pb-0 md:gap-2", v.style.scrollbarWidth = "none", v.style.msOverflowStyle = "none", v.style.setProperty("-webkit-overflow-scrolling", "touch");
|
|
3358
3358
|
const y = document.createElement("style");
|
|
@@ -3382,25 +3382,25 @@ class et extends HTMLElement {
|
|
|
3382
3382
|
}
|
|
3383
3383
|
`, v.classList.add("mint-date-shortcuts-row"), document.head.querySelector("style[data-mint-date-shortcuts]") || (y.setAttribute("data-mint-date-shortcuts", "true"), document.head.appendChild(y));
|
|
3384
3384
|
const w = document.createElement("div");
|
|
3385
|
-
w.className = "absolute left-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-r from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200 md:hidden",
|
|
3385
|
+
w.className = "absolute left-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-r from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200 md:hidden", E.appendChild(w);
|
|
3386
3386
|
const A = document.createElement("div");
|
|
3387
|
-
A.className = "absolute right-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-l from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200 md:hidden",
|
|
3387
|
+
A.className = "absolute right-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-l from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200 md:hidden", E.appendChild(A);
|
|
3388
3388
|
const I = document.createElement("div");
|
|
3389
|
-
I.className = "hidden md:block absolute top-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-b from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200",
|
|
3389
|
+
I.className = "hidden md:block absolute top-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-b from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200", E.appendChild(I);
|
|
3390
3390
|
const S = document.createElement("div");
|
|
3391
|
-
S.className = "hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200",
|
|
3392
|
-
const
|
|
3391
|
+
S.className = "hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200", E.appendChild(S);
|
|
3392
|
+
const D = () => {
|
|
3393
3393
|
if (window.innerWidth >= 768) {
|
|
3394
|
-
const
|
|
3395
|
-
|
|
3394
|
+
const H = v.scrollTop, T = v.scrollHeight, N = v.clientHeight;
|
|
3395
|
+
H > 0 ? I.style.opacity = "1" : I.style.opacity = "0", H + N < T - 1 ? S.style.opacity = "1" : S.style.opacity = "0", w.style.opacity = "0", A.style.opacity = "0";
|
|
3396
3396
|
} else {
|
|
3397
|
-
const
|
|
3398
|
-
|
|
3397
|
+
const H = v.scrollLeft, T = v.scrollWidth, N = v.clientWidth;
|
|
3398
|
+
H > 0 ? w.style.opacity = "1" : w.style.opacity = "0", H + N < T - 1 ? A.style.opacity = "1" : A.style.opacity = "0", I.style.opacity = "0", S.style.opacity = "0";
|
|
3399
3399
|
}
|
|
3400
3400
|
};
|
|
3401
|
-
v.addEventListener("scroll",
|
|
3402
|
-
const
|
|
3403
|
-
|
|
3401
|
+
v.addEventListener("scroll", D), window.addEventListener("resize", D), setTimeout(D, 0), n.forEach((L) => {
|
|
3402
|
+
const H = document.createElement("button");
|
|
3403
|
+
H.type = "button", H.tabIndex = 0, H.className = "px-3 py-1.5 text-xs font-medium rounded-md bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors whitespace-nowrap flex-shrink-0 md:w-full md:text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", H.textContent = L.label, H.setAttribute("data-keep-popover-open", "true"), H.addEventListener("click", () => {
|
|
3404
3404
|
const T = L.action();
|
|
3405
3405
|
if (T) {
|
|
3406
3406
|
if (this._isRange && "start" in T && "end" in T) {
|
|
@@ -3422,8 +3422,8 @@ class et extends HTMLElement {
|
|
|
3422
3422
|
cancelable: !0
|
|
3423
3423
|
}));
|
|
3424
3424
|
}
|
|
3425
|
-
}), v.appendChild(
|
|
3426
|
-
}),
|
|
3425
|
+
}), v.appendChild(H);
|
|
3426
|
+
}), E.appendChild(v), x.appendChild(E), a.appendChild(x);
|
|
3427
3427
|
}
|
|
3428
3428
|
l.appendChild(o), l.appendChild(_), l.appendChild(g), a.appendChild(l), this._calendarContainer.appendChild(a);
|
|
3429
3429
|
}
|
|
@@ -4123,13 +4123,9 @@ class rt extends HTMLElement {
|
|
|
4123
4123
|
const t = this.getAttribute("headers");
|
|
4124
4124
|
t && this._parseHeaders(t), requestAnimationFrame(() => {
|
|
4125
4125
|
requestAnimationFrame(() => {
|
|
4126
|
-
if (this._formData)
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
e && typeof e == "object" && !Array.isArray(e) && (this._lastDataSnapshot = this._createDataSnapshot(e), this._setupReactiveDataObserver(this._formData));
|
|
4130
|
-
}
|
|
4131
|
-
this._applyFormData();
|
|
4132
|
-
} else {
|
|
4126
|
+
if (this._formData)
|
|
4127
|
+
this._isReactiveObject(this._formData) ? this._setupReactiveDataObserver(this._formData) : this._lastDataSnapshot || (this._lastDataSnapshot = this._createDataSnapshot(this._formData)), this._applyFormData();
|
|
4128
|
+
else {
|
|
4133
4129
|
const e = this.getAttribute("data-form-data");
|
|
4134
4130
|
e && (this._parseFormData(e), this._applyFormData());
|
|
4135
4131
|
}
|
|
@@ -4168,7 +4164,7 @@ class rt extends HTMLElement {
|
|
|
4168
4164
|
return this._formData;
|
|
4169
4165
|
}
|
|
4170
4166
|
set data(t) {
|
|
4171
|
-
this._stopReactiveDataObserver(), this._reactiveDataProxy = null, this._lastDataSnapshot = null, t && typeof t == "object" && !Array.isArray(t) ? (this._formData = t, this._isReactiveObject(t)
|
|
4167
|
+
this._stopReactiveDataObserver(), this._reactiveDataProxy = null, this._lastDataSnapshot = null, t && typeof t == "object" && !Array.isArray(t) ? (this._formData = t, this._isReactiveObject(t) ? this._setupReactiveDataObserver(t) : this._lastDataSnapshot = this._createDataSnapshot(t)) : t == null ? this._formData = null : this._parseFormData(t), this.isConnected && this._form && requestAnimationFrame(() => {
|
|
4172
4168
|
requestAnimationFrame(() => {
|
|
4173
4169
|
requestAnimationFrame(() => {
|
|
4174
4170
|
this._applyFormData();
|
|
@@ -4319,8 +4315,8 @@ class rt extends HTMLElement {
|
|
|
4319
4315
|
} catch {
|
|
4320
4316
|
}
|
|
4321
4317
|
try {
|
|
4322
|
-
const k = { status: _, ok: !0, data: b },
|
|
4323
|
-
m(
|
|
4318
|
+
const k = { status: _, ok: !0, data: b }, x = await c._applySuccessInterceptors(k);
|
|
4319
|
+
m(x);
|
|
4324
4320
|
} catch (k) {
|
|
4325
4321
|
f(k);
|
|
4326
4322
|
}
|
|
@@ -4331,8 +4327,8 @@ class rt extends HTMLElement {
|
|
|
4331
4327
|
} catch {
|
|
4332
4328
|
}
|
|
4333
4329
|
try {
|
|
4334
|
-
const k = { status: _, data: b, response: { status: _, data: b } },
|
|
4335
|
-
f(
|
|
4330
|
+
const k = { status: _, data: b, response: { status: _, data: b } }, x = await c._applyErrorInterceptors(k);
|
|
4331
|
+
f(x);
|
|
4336
4332
|
} catch (k) {
|
|
4337
4333
|
f(k);
|
|
4338
4334
|
}
|
|
@@ -4877,14 +4873,17 @@ class rt extends HTMLElement {
|
|
|
4877
4873
|
_isReactiveObject(t) {
|
|
4878
4874
|
if (!t || typeof t != "object" || Array.isArray(t))
|
|
4879
4875
|
return !1;
|
|
4880
|
-
if ("__v_isRef" in t || "_value" in t || "__v_raw" in t || "__ob__" in t)
|
|
4876
|
+
if ("__v_isRef" in t || "_value" in t || "__v_raw" in t || "__v_isReactive" in t || "__ob__" in t)
|
|
4881
4877
|
return !0;
|
|
4882
4878
|
try {
|
|
4883
|
-
const e =
|
|
4884
|
-
if (e
|
|
4885
|
-
const i = Object.
|
|
4886
|
-
if (i
|
|
4887
|
-
|
|
4879
|
+
const e = t.toString();
|
|
4880
|
+
if (e === "[object Object]" || e.includes("Proxy")) {
|
|
4881
|
+
const i = Object.keys(t)[0];
|
|
4882
|
+
if (i) {
|
|
4883
|
+
const s = Object.getOwnPropertyDescriptor(t, i);
|
|
4884
|
+
if (s && (s.get || s.set))
|
|
4885
|
+
return !0;
|
|
4886
|
+
}
|
|
4888
4887
|
}
|
|
4889
4888
|
} catch {
|
|
4890
4889
|
return !0;
|
|
@@ -4893,13 +4892,32 @@ class rt extends HTMLElement {
|
|
|
4893
4892
|
}
|
|
4894
4893
|
/**
|
|
4895
4894
|
* Create a deep snapshot of the data object for comparison
|
|
4895
|
+
* Handles reactive objects by extracting their actual values
|
|
4896
4896
|
*/
|
|
4897
4897
|
_createDataSnapshot(t) {
|
|
4898
4898
|
try {
|
|
4899
|
-
|
|
4899
|
+
const e = this._extractReactiveData(t);
|
|
4900
|
+
return JSON.parse(JSON.stringify(e));
|
|
4900
4901
|
} catch {
|
|
4901
|
-
return { ...t };
|
|
4902
|
+
return { ...this._extractReactiveData(t) };
|
|
4903
|
+
}
|
|
4904
|
+
}
|
|
4905
|
+
/**
|
|
4906
|
+
* Extract actual values from reactive objects recursively
|
|
4907
|
+
*/
|
|
4908
|
+
_extractReactiveData(t) {
|
|
4909
|
+
if (!t || typeof t != "object")
|
|
4910
|
+
return t;
|
|
4911
|
+
if (Array.isArray(t))
|
|
4912
|
+
return t.map((i) => this._extractReactiveData(i));
|
|
4913
|
+
const e = this._getReactiveValue(t);
|
|
4914
|
+
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
4915
|
+
const i = {};
|
|
4916
|
+
for (const s in e)
|
|
4917
|
+
Object.prototype.hasOwnProperty.call(e, s) && (i[s] = this._extractReactiveData(e[s]));
|
|
4918
|
+
return i;
|
|
4902
4919
|
}
|
|
4920
|
+
return e;
|
|
4903
4921
|
}
|
|
4904
4922
|
/**
|
|
4905
4923
|
* Check if data has changed by comparing current state with snapshot
|
|
@@ -4913,27 +4931,48 @@ class rt extends HTMLElement {
|
|
|
4913
4931
|
}
|
|
4914
4932
|
/**
|
|
4915
4933
|
* Get the actual value from a potentially reactive object
|
|
4934
|
+
* Handles Vue 3 refs, reactive, Vue 2, React state, and other reactivity systems
|
|
4916
4935
|
*/
|
|
4917
4936
|
_getReactiveValue(t) {
|
|
4918
|
-
|
|
4937
|
+
if (!t || typeof t != "object")
|
|
4938
|
+
return t;
|
|
4939
|
+
if ("_value" in t || "__v_isRef" in t) {
|
|
4940
|
+
if (typeof t.value < "u")
|
|
4941
|
+
return t.value;
|
|
4942
|
+
if ("_value" in t)
|
|
4943
|
+
return t._value;
|
|
4944
|
+
}
|
|
4945
|
+
return "__v_raw" in t || "__v_isReactive" in t || "__ob__" in t, t;
|
|
4919
4946
|
}
|
|
4920
4947
|
/**
|
|
4921
4948
|
* Set up observer for reactive data changes
|
|
4949
|
+
* Works with Vue 3 (ref, reactive), Vue 2, React, and other reactivity systems
|
|
4922
4950
|
*/
|
|
4923
4951
|
_setupReactiveDataObserver(t) {
|
|
4924
|
-
if (!this.isConnected)
|
|
4952
|
+
if (this._stopReactiveDataObserver(), !this.isConnected)
|
|
4925
4953
|
return;
|
|
4926
|
-
const e = ()
|
|
4954
|
+
const e = this._getReactiveValue(t);
|
|
4955
|
+
if (e && typeof e == "object" && !Array.isArray(e))
|
|
4956
|
+
this._lastDataSnapshot = this._createDataSnapshot(e);
|
|
4957
|
+
else {
|
|
4958
|
+
this._lastDataSnapshot = null;
|
|
4959
|
+
return;
|
|
4960
|
+
}
|
|
4961
|
+
const i = () => {
|
|
4927
4962
|
if (!this._formData || !this._lastDataSnapshot) {
|
|
4928
4963
|
this._stopReactiveDataObserver();
|
|
4929
4964
|
return;
|
|
4930
4965
|
}
|
|
4931
|
-
const
|
|
4932
|
-
|
|
4933
|
-
this.
|
|
4934
|
-
|
|
4966
|
+
const s = this._getReactiveValue(this._formData);
|
|
4967
|
+
if (s && typeof s == "object" && !Array.isArray(s)) {
|
|
4968
|
+
const n = this._createDataSnapshot(s);
|
|
4969
|
+
this._hasDataChanged(n, this._lastDataSnapshot) && (this._lastDataSnapshot = n, requestAnimationFrame(() => {
|
|
4970
|
+
this._applyFormData();
|
|
4971
|
+
}));
|
|
4972
|
+
}
|
|
4973
|
+
this.isConnected && this._formData ? this._reactiveDataObserver = requestAnimationFrame(i) : this._stopReactiveDataObserver();
|
|
4935
4974
|
};
|
|
4936
|
-
this._reactiveDataObserver = requestAnimationFrame(
|
|
4975
|
+
this._reactiveDataObserver = requestAnimationFrame(i);
|
|
4937
4976
|
}
|
|
4938
4977
|
/**
|
|
4939
4978
|
* Stop observing reactive data changes
|
|
@@ -5849,15 +5888,15 @@ class ht extends HTMLElement {
|
|
|
5849
5888
|
const g = await fetch(`${n}?${u.toString()}`, _);
|
|
5850
5889
|
if (!g.ok)
|
|
5851
5890
|
throw new Error(`HTTP error! status: ${g.status}`);
|
|
5852
|
-
const b = await g.json(), k = ((l = b.content) == null ? void 0 : l.rows) || [],
|
|
5891
|
+
const b = await g.json(), k = ((l = b.content) == null ? void 0 : l.rows) || [], x = ((o = b.content) == null ? void 0 : o.total) || 0;
|
|
5853
5892
|
if (this._configuration.loadMore && a !== 0)
|
|
5854
5893
|
this._rows = this._rows.concat(k);
|
|
5855
5894
|
else {
|
|
5856
5895
|
let w = k;
|
|
5857
|
-
this._configuration.predefinedData ? (w = [...this._configuration.predefinedData, ...k], this._totalRows =
|
|
5896
|
+
this._configuration.predefinedData ? (w = [...this._configuration.predefinedData, ...k], this._totalRows = x + this._configuration.predefinedData.length) : this._totalRows = x, this._rows = w;
|
|
5858
5897
|
}
|
|
5859
|
-
const
|
|
5860
|
-
this._configuration.loadMore || (((c = b.content) == null ? void 0 : c.current_page) !== void 0 && b.content.current_page ===
|
|
5898
|
+
const E = Math.floor(a / r) + 1;
|
|
5899
|
+
this._configuration.loadMore || (((c = b.content) == null ? void 0 : c.current_page) !== void 0 && b.content.current_page === E ? this._currentPage = b.content.current_page : this._currentPage = E, this._offset = (this._currentPage - 1) * r), this._lastPage = ((d = b.content) == null ? void 0 : d.last_page) || 1, this._fetching = !1, this._loaded = !0, this._loading = !1, this._fetchError = null, this._searching = !1;
|
|
5861
5900
|
const v = this._sorting;
|
|
5862
5901
|
if (v && this._updateSortIcons(), this._sorting = !1, this._sortingColumn = null, v && this._updateSortIcons(), this.dispatchEvent(new CustomEvent("loaded", { detail: { rows: this._rows } })), this._updateSearchIcon(), (h = (p = this.querySelector(`#${this._tableId}`)) == null ? void 0 : p.closest("table")) == null ? void 0 : h.querySelector("tbody")) {
|
|
5863
5902
|
if (v) {
|
|
@@ -6175,7 +6214,7 @@ class ht extends HTMLElement {
|
|
|
6175
6214
|
s += '<mint-table class="table-section' + (this._inMintCard ? " rounded-t-none" : "") + '">', s += `<table id="${this._tableId}">`, s += "<thead><tr>", this._configuration.columns.forEach((r, a) => {
|
|
6176
6215
|
r.hidden || (s += `<th width="${r.width || ""}" style="${this._getStyle(r)}" class="${this._getClasses(r)}" data-column-key="${a}">`, r.showLabel !== !1 && (s += '<div class="flex items-center">', s += `<div class="flex-1">${r.raw ? r.label : this._escapeHtml(r.label)}</div>`, r.sortable && (s += '<div class="ml-2 flex items-center">', s += '<mint-icon name="" class="w-4 h-4 text-gray-400"></mint-icon>', s += "</div>"), s += "</div>"), s += "</th>");
|
|
6177
6216
|
}), s += "</tr></thead>", s += "<tbody>";
|
|
6178
|
-
for (let r = 0; r <
|
|
6217
|
+
for (let r = 0; r < 4; r++)
|
|
6179
6218
|
s += "<tr>", this._configuration.columns.forEach((a) => {
|
|
6180
6219
|
a.hidden || (s += `<td style="${this._getStyle(a)}" class="${this._getClasses(a, !0)}">`, s += '<div class="h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"></div>', s += "</td>");
|
|
6181
6220
|
}), s += "</tr>";
|