@wishbone-media/spark 0.33.0 → 0.34.0
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/index.js +180 -180
- package/package.json +1 -1
- package/src/composables/useFormSubmission.js +19 -16
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { computed as L, resolveComponent as A, createElementBlock as v, openBlock as m, normalizeClass as V, createElementVNode as g, createCommentVNode as $, createVNode as S, unref as C, renderSlot as z, reactive as G, Fragment as E, renderList as N, toDisplayString as M, createBlock as H, resolveDynamicComponent as W, markRaw as ce, ref as D, watch as U, onMounted as pe, Transition as ht, withCtx as P, normalizeProps as yt, mergeProps as K, createTextVNode as I, Teleport as vt, TransitionGroup as ue, inject as be, provide as bt, withModifiers as O, toHandlers as Be, useSlots as je, onUnmounted as ze, withDirectives as xt, vShow as
|
|
1
|
+
import { computed as L, resolveComponent as A, createElementBlock as v, openBlock as m, normalizeClass as V, createElementVNode as g, createCommentVNode as $, createVNode as S, unref as C, renderSlot as z, reactive as G, Fragment as E, renderList as N, toDisplayString as M, createBlock as H, resolveDynamicComponent as W, markRaw as ce, ref as D, watch as U, onMounted as pe, Transition as ht, withCtx as P, normalizeProps as yt, mergeProps as K, createTextVNode as I, Teleport as vt, TransitionGroup as ue, inject as be, provide as bt, withModifiers as O, toHandlers as Be, useSlots as je, onUnmounted as ze, withDirectives as xt, vShow as wt, h as Le } from "vue";
|
|
2
2
|
import { icon as se, library as Ne } from "@fortawesome/fontawesome-svg-core";
|
|
3
3
|
import { FontAwesomeIcon as he } from "@fortawesome/vue-fontawesome";
|
|
4
|
-
import { faCircleDot as Ue, faEyeDropper as qe, faAnglesLeft as Ze, faAnglesRight as We, faStar as Ke, faSpinnerThird as Ge, faCircle as
|
|
4
|
+
import { faCircleDot as Ue, faEyeDropper as qe, faAnglesLeft as Ze, faAnglesRight as We, faStar as Ke, faSpinnerThird as Ge, faCircle as kt, faFile as Se, faCalendar as Ye, faArrowUp as Xe, faArrowDown as Je, faPlus as Qe, faCircleCheck as _t, faInbox as St, faCloudArrowUp as Ct, faCloudDownload as Tt, faBolt as $t, faUndo as Lt, faEye as Pt, faSignOut as Mt, faXmark as Ce, faTrash as et, faTimes as Vt, faStreetView as Ht, faSortUp as Ft, faSortDown as Dt, faSort as Rt, faScaleBalanced as At, faSatelliteDish as Et, faLayerPlus as It, faLaptopMobile as Ot, faInfoCircle as Bt, faGripDotsVertical as tt, faGearComplex as jt, faFlag as zt, faFaceSmileWink as Nt, faFaceSmileRelaxed as Ut, faExclamationTriangle as qt, faEllipsisVertical as Zt, faEllipsis as Wt, faEdit as Kt, faComments as Gt, faCircleXmark as Yt, faCircleUser as Xt, faChevronUp as Jt, faChevronRight as st, faChevronLeft as at, faChevronDown as ot, faCheckCircle as Qt, faCheck as Te, faBullhorn as es, faBellRing as ts, faBarsSort as ss, faArrowRightToLine as as, faArrowLeftToLine as os } from "@fortawesome/pro-regular-svg-icons";
|
|
5
5
|
import { faSortUp as rs, faSortDown as ns, faSort as ls } from "@fortawesome/pro-duotone-svg-icons";
|
|
6
6
|
import { defineStore as fe } from "pinia";
|
|
7
7
|
import { useRoute as ee, useRouter as Y, onBeforeRouteLeave as is } from "vue-router";
|
|
@@ -69,7 +69,7 @@ const R = {
|
|
|
69
69
|
farArrowUp: Xe,
|
|
70
70
|
farCalendar: Ye,
|
|
71
71
|
farFile: Se,
|
|
72
|
-
farCircle:
|
|
72
|
+
farCircle: kt,
|
|
73
73
|
farSpinner: Ge,
|
|
74
74
|
farStar: Ke,
|
|
75
75
|
farAnglesRight: We,
|
|
@@ -124,7 +124,7 @@ function sl(e) {
|
|
|
124
124
|
function al(e) {
|
|
125
125
|
Ne.add(...Object.values(R)), e.component("FontAwesomeIcon", he);
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const ws = { class: "flex items-center" }, ks = { class: "shrink-0 self-start" }, _s = { class: "ml-3" }, Ss = {
|
|
128
128
|
key: 0,
|
|
129
129
|
class: "ml-auto pl-3 pt-1 self-start"
|
|
130
130
|
}, Cs = { class: "-mx-1.5 -my-1.5" }, re = {
|
|
@@ -168,8 +168,8 @@ const ks = { class: "flex items-center" }, ws = { class: "shrink-0 self-start" }
|
|
|
168
168
|
return m(), v("div", {
|
|
169
169
|
class: V(["rounded-md border p-4", t.value])
|
|
170
170
|
}, [
|
|
171
|
-
g("div",
|
|
172
|
-
g("div",
|
|
171
|
+
g("div", ws, [
|
|
172
|
+
g("div", ks, [
|
|
173
173
|
S(r, {
|
|
174
174
|
icon: C(R)[l.value],
|
|
175
175
|
class: V(a.value)
|
|
@@ -195,7 +195,7 @@ const ks = { class: "flex items-center" }, ws = { class: "shrink-0 self-start" }
|
|
|
195
195
|
], 2);
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
},
|
|
198
|
+
}, we = [
|
|
199
199
|
{
|
|
200
200
|
name: "Bolt",
|
|
201
201
|
description: "Job management",
|
|
@@ -246,7 +246,7 @@ const ks = { class: "flex items-center" }, ws = { class: "shrink-0 self-start" }
|
|
|
246
246
|
}
|
|
247
247
|
], ct = fe("sparkAppSelector", () => {
|
|
248
248
|
const e = G({
|
|
249
|
-
apps: [...
|
|
249
|
+
apps: [...we]
|
|
250
250
|
}), s = (n = {}) => {
|
|
251
251
|
if (n.apps && Array.isArray(n.apps)) {
|
|
252
252
|
const o = n.apps.filter((i) => {
|
|
@@ -265,7 +265,7 @@ const ks = { class: "flex items-center" }, ws = { class: "shrink-0 self-start" }
|
|
|
265
265
|
const o = /* @__PURE__ */ new Map();
|
|
266
266
|
Object.keys(n.appHrefs).forEach((i) => {
|
|
267
267
|
o.set(i.toLowerCase(), n.appHrefs[i]);
|
|
268
|
-
}), e.apps =
|
|
268
|
+
}), e.apps = we.map((i) => {
|
|
269
269
|
const r = o.get(i.name.toLowerCase());
|
|
270
270
|
return {
|
|
271
271
|
...i,
|
|
@@ -274,7 +274,7 @@ const ks = { class: "flex items-center" }, ws = { class: "shrink-0 self-start" }
|
|
|
274
274
|
});
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
|
-
e.apps = [...
|
|
277
|
+
e.apps = [...we];
|
|
278
278
|
}, t = L(() => e.apps), a = (n) => {
|
|
279
279
|
if (!n) return null;
|
|
280
280
|
const o = n.toLowerCase();
|
|
@@ -423,7 +423,7 @@ function zs() {
|
|
|
423
423
|
show: (p = {}) => {
|
|
424
424
|
n();
|
|
425
425
|
const {
|
|
426
|
-
type:
|
|
426
|
+
type: k = "info",
|
|
427
427
|
message: _ = null,
|
|
428
428
|
component: b = null,
|
|
429
429
|
props: u = {},
|
|
@@ -431,9 +431,9 @@ function zs() {
|
|
|
431
431
|
duration: x = null,
|
|
432
432
|
persistent: y = !1
|
|
433
433
|
} = p;
|
|
434
|
-
e.type =
|
|
435
|
-
const
|
|
436
|
-
e.duration =
|
|
434
|
+
e.type = k, e.message = _, e.component = b ? ce(b) : null, e.props = u, e.closeable = h, e.persistent = y, e.isVisible = !0;
|
|
435
|
+
const w = x !== null ? x : dt[k];
|
|
436
|
+
e.duration = w, w > 0 && i(w);
|
|
437
437
|
},
|
|
438
438
|
hide: o,
|
|
439
439
|
reset: () => {
|
|
@@ -583,9 +583,9 @@ class Ns {
|
|
|
583
583
|
duration: f,
|
|
584
584
|
position: d,
|
|
585
585
|
createdAt: Date.now()
|
|
586
|
-
},
|
|
587
|
-
if (
|
|
588
|
-
const _ = this.toastState.newestOnTop ?
|
|
586
|
+
}, k = this.toastState.toasts.filter((_) => _.position === d);
|
|
587
|
+
if (k.length >= this.toastState.maxToasts) {
|
|
588
|
+
const _ = this.toastState.newestOnTop ? k[k.length - 1] : k[0];
|
|
589
589
|
this.hideToast(_.id);
|
|
590
590
|
}
|
|
591
591
|
if (this.toastState.newestOnTop) {
|
|
@@ -773,9 +773,9 @@ const B = new Ns(), ol = {
|
|
|
773
773
|
S(re, {
|
|
774
774
|
type: p.type,
|
|
775
775
|
closeable: p.closeable,
|
|
776
|
-
onClose: (
|
|
777
|
-
onMouseenter: (
|
|
778
|
-
onMouseleave: (
|
|
776
|
+
onClose: (k) => i(p.id),
|
|
777
|
+
onMouseenter: (k) => r(p.id),
|
|
778
|
+
onMouseleave: (k) => c(p.id)
|
|
779
779
|
}, {
|
|
780
780
|
default: P(() => [
|
|
781
781
|
p.component ? (m(), H(W(p.component), K({
|
|
@@ -809,9 +809,9 @@ const B = new Ns(), ol = {
|
|
|
809
809
|
S(re, {
|
|
810
810
|
type: p.type,
|
|
811
811
|
closeable: p.closeable,
|
|
812
|
-
onClose: (
|
|
813
|
-
onMouseenter: (
|
|
814
|
-
onMouseleave: (
|
|
812
|
+
onClose: (k) => i(p.id),
|
|
813
|
+
onMouseenter: (k) => r(p.id),
|
|
814
|
+
onMouseleave: (k) => c(p.id)
|
|
815
815
|
}, {
|
|
816
816
|
default: P(() => [
|
|
817
817
|
p.component ? (m(), H(W(p.component), K({
|
|
@@ -845,9 +845,9 @@ const B = new Ns(), ol = {
|
|
|
845
845
|
S(re, {
|
|
846
846
|
type: p.type,
|
|
847
847
|
closeable: p.closeable,
|
|
848
|
-
onClose: (
|
|
849
|
-
onMouseenter: (
|
|
850
|
-
onMouseleave: (
|
|
848
|
+
onClose: (k) => i(p.id),
|
|
849
|
+
onMouseenter: (k) => r(p.id),
|
|
850
|
+
onMouseleave: (k) => c(p.id)
|
|
851
851
|
}, {
|
|
852
852
|
default: P(() => [
|
|
853
853
|
p.component ? (m(), H(W(p.component), K({
|
|
@@ -881,9 +881,9 @@ const B = new Ns(), ol = {
|
|
|
881
881
|
S(re, {
|
|
882
882
|
type: p.type,
|
|
883
883
|
closeable: p.closeable,
|
|
884
|
-
onClose: (
|
|
885
|
-
onMouseenter: (
|
|
886
|
-
onMouseleave: (
|
|
884
|
+
onClose: (k) => i(p.id),
|
|
885
|
+
onMouseenter: (k) => r(p.id),
|
|
886
|
+
onMouseleave: (k) => c(p.id)
|
|
887
887
|
}, {
|
|
888
888
|
default: P(() => [
|
|
889
889
|
p.component ? (m(), H(W(p.component), K({
|
|
@@ -917,9 +917,9 @@ const B = new Ns(), ol = {
|
|
|
917
917
|
S(re, {
|
|
918
918
|
type: p.type,
|
|
919
919
|
closeable: p.closeable,
|
|
920
|
-
onClose: (
|
|
921
|
-
onMouseenter: (
|
|
922
|
-
onMouseleave: (
|
|
920
|
+
onClose: (k) => i(p.id),
|
|
921
|
+
onMouseenter: (k) => r(p.id),
|
|
922
|
+
onMouseleave: (k) => c(p.id)
|
|
923
923
|
}, {
|
|
924
924
|
default: P(() => [
|
|
925
925
|
p.component ? (m(), H(W(p.component), K({
|
|
@@ -1085,9 +1085,9 @@ const B = new Ns(), ol = {
|
|
|
1085
1085
|
}, o = (r, c) => {
|
|
1086
1086
|
if (!c) return r;
|
|
1087
1087
|
const d = r.split(" ").filter(Boolean), f = c.split(" ").filter(Boolean);
|
|
1088
|
-
return [...d.filter((
|
|
1088
|
+
return [...d.filter((k) => !f.some((_) => {
|
|
1089
1089
|
const b = Object.entries(n).find(
|
|
1090
|
-
([h, x]) => x.test(
|
|
1090
|
+
([h, x]) => x.test(k)
|
|
1091
1091
|
)?.[0], u = Object.entries(n).find(
|
|
1092
1092
|
([h, x]) => x.test(_)
|
|
1093
1093
|
)?.[0];
|
|
@@ -1211,10 +1211,10 @@ const B = new Ns(), ol = {
|
|
|
1211
1211
|
}, ba = { class: "text-gray-700" }, xa = {
|
|
1212
1212
|
key: 0,
|
|
1213
1213
|
class: "absolute inset-0 flex items-center justify-center bg-blue-50/80 rounded-md pointer-events-none"
|
|
1214
|
-
},
|
|
1214
|
+
}, wa = {
|
|
1215
1215
|
key: 3,
|
|
1216
1216
|
class: "flex justify-end mt-4"
|
|
1217
|
-
},
|
|
1217
|
+
}, ka = {
|
|
1218
1218
|
key: 4,
|
|
1219
1219
|
class: "text-sm text-gray-500 mt-1"
|
|
1220
1220
|
}, ll = {
|
|
@@ -1299,7 +1299,7 @@ const B = new Ns(), ol = {
|
|
|
1299
1299
|
if (r.value = !1, a.disabled || i.value) return;
|
|
1300
1300
|
const y = x.dataTransfer?.files?.[0];
|
|
1301
1301
|
if (y) {
|
|
1302
|
-
if (!
|
|
1302
|
+
if (!k(y)) {
|
|
1303
1303
|
B.show({
|
|
1304
1304
|
type: "danger",
|
|
1305
1305
|
message: "File type not accepted."
|
|
@@ -1309,16 +1309,16 @@ const B = new Ns(), ol = {
|
|
|
1309
1309
|
o.value = y, l("file-selected", y);
|
|
1310
1310
|
}
|
|
1311
1311
|
}
|
|
1312
|
-
function
|
|
1313
|
-
const y = a.accept.split(",").map((
|
|
1314
|
-
for (const
|
|
1315
|
-
if (
|
|
1316
|
-
if (
|
|
1317
|
-
const T =
|
|
1312
|
+
function k(x) {
|
|
1313
|
+
const y = a.accept.split(",").map((w) => w.trim());
|
|
1314
|
+
for (const w of y) {
|
|
1315
|
+
if (w === "*/*") return !0;
|
|
1316
|
+
if (w.endsWith("/*")) {
|
|
1317
|
+
const T = w.slice(0, -2);
|
|
1318
1318
|
if (x.type.startsWith(T + "/")) return !0;
|
|
1319
|
-
} else if (
|
|
1320
|
-
if (x.name.toLowerCase().endsWith(
|
|
1321
|
-
} else if (x.type ===
|
|
1319
|
+
} else if (w.startsWith(".")) {
|
|
1320
|
+
if (x.name.toLowerCase().endsWith(w.toLowerCase())) return !0;
|
|
1321
|
+
} else if (x.type === w) return !0;
|
|
1322
1322
|
}
|
|
1323
1323
|
return !1;
|
|
1324
1324
|
}
|
|
@@ -1347,8 +1347,8 @@ const B = new Ns(), ol = {
|
|
|
1347
1347
|
const y = await n.post(a.uploadUrl, x, {
|
|
1348
1348
|
headers: { "Content-Type": "multipart/form-data" },
|
|
1349
1349
|
params: a.extraParams
|
|
1350
|
-
}),
|
|
1351
|
-
l("upload-success",
|
|
1350
|
+
}), w = a.responseParser(y);
|
|
1351
|
+
l("upload-success", w);
|
|
1352
1352
|
} catch (x) {
|
|
1353
1353
|
l("upload-error", x), B.show({
|
|
1354
1354
|
type: "danger",
|
|
@@ -1365,7 +1365,7 @@ const B = new Ns(), ol = {
|
|
|
1365
1365
|
selectedFile: o,
|
|
1366
1366
|
uploading: i
|
|
1367
1367
|
}), (x, y) => {
|
|
1368
|
-
const
|
|
1368
|
+
const w = A("FormKit"), T = A("font-awesome-icon");
|
|
1369
1369
|
return m(), v("div", null, [
|
|
1370
1370
|
e.label ? (m(), v("label", ga, M(e.label), 1)) : $("", !0),
|
|
1371
1371
|
e.variant === "dashed" ? (m(), v("div", {
|
|
@@ -1379,7 +1379,7 @@ const B = new Ns(), ol = {
|
|
|
1379
1379
|
onDragleave: O(f, ["prevent"]),
|
|
1380
1380
|
onDrop: O(p, ["prevent"])
|
|
1381
1381
|
}, [
|
|
1382
|
-
S(
|
|
1382
|
+
S(w, {
|
|
1383
1383
|
ref_key: "formkitFileRef",
|
|
1384
1384
|
ref: c,
|
|
1385
1385
|
type: "file",
|
|
@@ -1433,7 +1433,7 @@ const B = new Ns(), ol = {
|
|
|
1433
1433
|
onDragleave: O(f, ["prevent"]),
|
|
1434
1434
|
onDrop: O(p, ["prevent"])
|
|
1435
1435
|
}, [
|
|
1436
|
-
S(
|
|
1436
|
+
S(w, {
|
|
1437
1437
|
type: "file",
|
|
1438
1438
|
name: e.name,
|
|
1439
1439
|
accept: e.accept,
|
|
@@ -1444,7 +1444,7 @@ const B = new Ns(), ol = {
|
|
|
1444
1444
|
g("span", { class: "text-sm text-blue-600 font-medium" }, "Drop file here", -1)
|
|
1445
1445
|
])])) : $("", !0)
|
|
1446
1446
|
], 34)),
|
|
1447
|
-
e.showUploadButton ? (m(), v("div",
|
|
1447
|
+
e.showUploadButton ? (m(), v("div", wa, [
|
|
1448
1448
|
S(q, {
|
|
1449
1449
|
size: "lg",
|
|
1450
1450
|
disabled: !o.value || i.value,
|
|
@@ -1461,7 +1461,7 @@ const B = new Ns(), ol = {
|
|
|
1461
1461
|
_: 1
|
|
1462
1462
|
}, 8, ["disabled"])
|
|
1463
1463
|
])) : $("", !0),
|
|
1464
|
-
i.value && !e.showUploadButton ? (m(), v("p",
|
|
1464
|
+
i.value && !e.showUploadButton ? (m(), v("p", ka, M(e.uploadingText), 1)) : $("", !0)
|
|
1465
1465
|
]);
|
|
1466
1466
|
};
|
|
1467
1467
|
}
|
|
@@ -1544,7 +1544,7 @@ const B = new Ns(), ol = {
|
|
|
1544
1544
|
});
|
|
1545
1545
|
return;
|
|
1546
1546
|
}
|
|
1547
|
-
|
|
1547
|
+
k(b);
|
|
1548
1548
|
}
|
|
1549
1549
|
}
|
|
1550
1550
|
function f(_) {
|
|
@@ -1563,9 +1563,9 @@ const B = new Ns(), ol = {
|
|
|
1563
1563
|
function p(_) {
|
|
1564
1564
|
if (!_ || _.length === 0) return;
|
|
1565
1565
|
const b = _[0].file;
|
|
1566
|
-
b &&
|
|
1566
|
+
b && k(b);
|
|
1567
1567
|
}
|
|
1568
|
-
async function
|
|
1568
|
+
async function k(_) {
|
|
1569
1569
|
n.value = !0, a("upload-start");
|
|
1570
1570
|
try {
|
|
1571
1571
|
const b = new FormData();
|
|
@@ -1748,7 +1748,7 @@ const B = new Ns(), ol = {
|
|
|
1748
1748
|
(m(!0), v(E, null, N(t.value, (f, p) => (m(), H(C(q), {
|
|
1749
1749
|
key: p,
|
|
1750
1750
|
variant: f.variant,
|
|
1751
|
-
onClick: (
|
|
1751
|
+
onClick: (k) => r.$emit(f.event, f)
|
|
1752
1752
|
}, {
|
|
1753
1753
|
default: P(() => [
|
|
1754
1754
|
I(M(f.text), 1)
|
|
@@ -2029,13 +2029,13 @@ const J = new Fa(), Da = { class: "fixed inset-0 z-10 w-screen overflow-y-auto"
|
|
|
2029
2029
|
"inline-flex items-center transition-colors cursor-pointer",
|
|
2030
2030
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-1"
|
|
2031
2031
|
];
|
|
2032
|
-
return h && x.push("opacity-50 cursor-not-allowed"), t.layout === "tabs" ? x.push(...p(u, h)) : t.layout === "vertical" && x.push(...
|
|
2032
|
+
return h && x.push("opacity-50 cursor-not-allowed"), t.layout === "tabs" ? x.push(...p(u, h)) : t.layout === "vertical" && x.push(...k(u, h)), x;
|
|
2033
2033
|
}
|
|
2034
2034
|
function p(b, u) {
|
|
2035
2035
|
const h = ["border-b-2 -mb-px rounded-t font-medium"], x = t.compact ? "text-sm px-3 py-1.5" : "text-sm px-8 py-4";
|
|
2036
2036
|
return h.push(x), b ? h.push("border-primary-600 text-primary-600") : u ? h.push("border-transparent text-gray-400") : h.push("border-transparent text-gray-600 hover:text-gray-900 hover:border-gray-300"), h;
|
|
2037
2037
|
}
|
|
2038
|
-
function
|
|
2038
|
+
function k(b, u) {
|
|
2039
2039
|
const h = ["font-medium text-sm py-1"];
|
|
2040
2040
|
return b ? h.push("text-primary-600") : u ? h.push("text-gray-400") : h.push("text-gray-600 hover:text-gray-900"), h;
|
|
2041
2041
|
}
|
|
@@ -2178,16 +2178,16 @@ const J = new Fa(), Da = { class: "fixed inset-0 z-10 w-screen overflow-y-auto"
|
|
|
2178
2178
|
f.classList.add("flex", "items-center", "gap-2"), c.forEach((p) => {
|
|
2179
2179
|
if (p.condition && typeof p.condition == "function" && !p.condition(d))
|
|
2180
2180
|
return;
|
|
2181
|
-
const
|
|
2182
|
-
if (
|
|
2181
|
+
const k = document.createElement("button");
|
|
2182
|
+
if (k.type = "button", k.classList.add("spark-table-action-button"), p.icon) {
|
|
2183
2183
|
const _ = document.createElement("span");
|
|
2184
|
-
_.innerHTML = se({ prefix: "far", iconName: p.icon }).html, _.classList.add("size-4"),
|
|
2184
|
+
_.innerHTML = se({ prefix: "far", iconName: p.icon }).html, _.classList.add("size-4"), k.appendChild(_);
|
|
2185
2185
|
}
|
|
2186
2186
|
if (p.label) {
|
|
2187
2187
|
const _ = document.createElement("span");
|
|
2188
|
-
_.textContent = p.label,
|
|
2188
|
+
_.textContent = p.label, k.appendChild(_);
|
|
2189
2189
|
}
|
|
2190
|
-
|
|
2190
|
+
k.addEventListener("click", async (_) => {
|
|
2191
2191
|
if (_.preventDefault(), _.stopPropagation(), p.confirm) {
|
|
2192
2192
|
const b = typeof p.confirm == "string" ? p.confirm : `Are you sure you want to ${p.label?.toLowerCase() || "perform this action"}?`;
|
|
2193
2193
|
if (!await J.confirm({
|
|
@@ -2201,7 +2201,7 @@ const J = new Fa(), Da = { class: "fixed inset-0 z-10 w-screen overflow-y-auto"
|
|
|
2201
2201
|
return;
|
|
2202
2202
|
}
|
|
2203
2203
|
p.event && e.methods.fireEvent(p.event, d), p.handler && typeof p.handler == "function" && p.handler(d);
|
|
2204
|
-
}), f.appendChild(
|
|
2204
|
+
}), f.appendChild(k);
|
|
2205
2205
|
}), t.appendChild(f);
|
|
2206
2206
|
}, He = {
|
|
2207
2207
|
green: "bg-green-100 text-green-800",
|
|
@@ -2248,7 +2248,7 @@ const J = new Fa(), Da = { class: "fixed inset-0 z-10 w-screen overflow-y-auto"
|
|
|
2248
2248
|
return !1;
|
|
2249
2249
|
}, Ka = (e) => (s, t, a, l, n, o, i) => {
|
|
2250
2250
|
t.innerHTML = "", t.classList.add("spark-table-cell-boolean");
|
|
2251
|
-
const r = i.rendererConfig || {}, c = Wa(o), d = c ? r.trueIcon || "check" : r.falseIcon || "xmark", f = c ? r.trueColor || "green" : r.falseColor || "red", p = r.size || 32,
|
|
2251
|
+
const r = i.rendererConfig || {}, c = Wa(o), d = c ? r.trueIcon || "check" : r.falseIcon || "xmark", f = c ? r.trueColor || "green" : r.falseColor || "red", p = r.size || 32, k = r.iconPrefix || "far", _ = Fe[f] || Fe.gray;
|
|
2252
2252
|
t.dataset.copyValue = c ? "true" : "false";
|
|
2253
2253
|
const b = document.createElement("div");
|
|
2254
2254
|
b.classList.add(
|
|
@@ -2260,7 +2260,7 @@ const J = new Fa(), Da = { class: "fixed inset-0 z-10 w-screen overflow-y-auto"
|
|
|
2260
2260
|
_.text
|
|
2261
2261
|
), b.style.width = `${p}px`, b.style.height = `${p}px`;
|
|
2262
2262
|
const u = document.createElement("span");
|
|
2263
|
-
u.innerHTML = se({ prefix:
|
|
2263
|
+
u.innerHTML = se({ prefix: k, iconName: d }).html, u.classList.add("flex", "items-center", "justify-center");
|
|
2264
2264
|
const h = Math.round(p * 0.5);
|
|
2265
2265
|
u.style.fontSize = `${h}px`, b.appendChild(u), t.appendChild(b);
|
|
2266
2266
|
}, Ga = (e, s = 2) => {
|
|
@@ -2303,24 +2303,24 @@ const J = new Fa(), Da = { class: "fixed inset-0 z-10 w-screen overflow-y-auto"
|
|
|
2303
2303
|
if (t.innerHTML = "", t.classList.add("spark-table-cell-image"), !o)
|
|
2304
2304
|
return;
|
|
2305
2305
|
const r = i.rendererConfig || {}, c = s.getSourceDataAtRow(s.toPhysicalRow(a)), d = r.size || "md", f = De[d] || De.md, p = r.rounded !== !1;
|
|
2306
|
-
let
|
|
2307
|
-
typeof r.alt == "string" && c[r.alt] && (
|
|
2306
|
+
let k = r.alt || "";
|
|
2307
|
+
typeof r.alt == "string" && c[r.alt] && (k = c[r.alt]);
|
|
2308
2308
|
const _ = document.createElement("img");
|
|
2309
|
-
_.src = o, _.alt =
|
|
2309
|
+
_.src = o, _.alt = k, _.classList.add(...f.split(" "), "object-cover"), p ? _.classList.add("rounded-full") : _.classList.add("rounded"), t.appendChild(_);
|
|
2310
2310
|
}, Qa = (e) => (s, t, a, l, n, o, i) => {
|
|
2311
2311
|
if (t.innerHTML = "", t.classList.add("spark-table-cell-date"), !o)
|
|
2312
2312
|
return;
|
|
2313
2313
|
const r = i.rendererConfig || {}, c = r.format || "short", d = r.locale || "en-US";
|
|
2314
2314
|
let f = o;
|
|
2315
2315
|
try {
|
|
2316
|
-
const
|
|
2317
|
-
isNaN(
|
|
2316
|
+
const k = new Date(o);
|
|
2317
|
+
isNaN(k.getTime()) ? f = o : typeof c == "function" ? f = c(k) : c === "short" ? f = k.toLocaleDateString(d) : c === "long" ? f = k.toLocaleDateString(d, {
|
|
2318
2318
|
year: "numeric",
|
|
2319
2319
|
month: "long",
|
|
2320
2320
|
day: "numeric"
|
|
2321
|
-
}) : c === "relative" ? f = eo(
|
|
2322
|
-
} catch (
|
|
2323
|
-
console.error("Error formatting date:",
|
|
2321
|
+
}) : c === "relative" ? f = eo(k) : c === "datetime" ? f = k.toLocaleString(d) : f = k.toLocaleDateString(d);
|
|
2322
|
+
} catch (k) {
|
|
2323
|
+
console.error("Error formatting date:", k), f = o;
|
|
2324
2324
|
}
|
|
2325
2325
|
const p = document.createElement("span");
|
|
2326
2326
|
p.textContent = f, t.appendChild(p);
|
|
@@ -2332,9 +2332,9 @@ function eo(e) {
|
|
|
2332
2332
|
const to = (e) => {
|
|
2333
2333
|
const s = ["th", "st", "nd", "rd"], t = e % 100;
|
|
2334
2334
|
return e + (s[(t - 20) % 10] || s[t] || s[0]);
|
|
2335
|
-
}, Z = (e, s = 2) => String(e).padStart(s, "0"),
|
|
2335
|
+
}, Z = (e, s = 2) => String(e).padStart(s, "0"), ke = /* @__PURE__ */ new Map(), so = (e, s) => {
|
|
2336
2336
|
const t = `${e}:${JSON.stringify(s)}`;
|
|
2337
|
-
return
|
|
2337
|
+
return ke.has(t) || ke.set(t, new Intl.DateTimeFormat(e, s)), ke.get(t);
|
|
2338
2338
|
}, de = (e, s, t, a) => {
|
|
2339
2339
|
const o = so(s, t).formatToParts(e).find((i) => i.type === a);
|
|
2340
2340
|
return o ? o.value : "";
|
|
@@ -2452,16 +2452,16 @@ const to = (e) => {
|
|
|
2452
2452
|
fromTimezone: d,
|
|
2453
2453
|
toTimezone: f,
|
|
2454
2454
|
locale: p = "en-US",
|
|
2455
|
-
emptyText:
|
|
2455
|
+
emptyText: k = ""
|
|
2456
2456
|
} = r;
|
|
2457
2457
|
if (!o) {
|
|
2458
|
-
t.textContent =
|
|
2458
|
+
t.textContent = k;
|
|
2459
2459
|
return;
|
|
2460
2460
|
}
|
|
2461
2461
|
try {
|
|
2462
2462
|
const _ = lo(o, { fromTimezone: d, toTimezone: f });
|
|
2463
2463
|
if (!_) {
|
|
2464
|
-
t.textContent =
|
|
2464
|
+
t.textContent = k;
|
|
2465
2465
|
return;
|
|
2466
2466
|
}
|
|
2467
2467
|
const b = no(_, c, { locale: p }), u = document.createElement("span");
|
|
@@ -2484,10 +2484,10 @@ const to = (e) => {
|
|
|
2484
2484
|
});
|
|
2485
2485
|
}, po = () => {
|
|
2486
2486
|
}, fo = (e, s = {}) => {
|
|
2487
|
-
const t = Y(), a = ee(), l = s.namespace, n = l === null, o = s.syncToRoute !== !1, i = s.persistToStorage === !0, r = s.restoreOnMount !== !1, c = s.storageTTL || 7, d = n ? `spark-table:${a.path}` : `spark-table:${l}`, f = (y,
|
|
2487
|
+
const t = Y(), a = ee(), l = s.namespace, n = l === null, o = s.syncToRoute !== !1, i = s.persistToStorage === !0, r = s.restoreOnMount !== !1, c = s.storageTTL || 7, d = n ? `spark-table:${a.path}` : `spark-table:${l}`, f = (y, w = "") => {
|
|
2488
2488
|
const T = {};
|
|
2489
2489
|
return Object.keys(y).forEach((F) => {
|
|
2490
|
-
const j = y[F], me =
|
|
2490
|
+
const j = y[F], me = w ? `${w}[${F}]` : F;
|
|
2491
2491
|
j != null && (typeof j == "object" && !Array.isArray(j) ? Object.assign(T, f(j, me)) : T[me] = String(j));
|
|
2492
2492
|
}), T;
|
|
2493
2493
|
}, p = () => {
|
|
@@ -2501,18 +2501,18 @@ const to = (e) => {
|
|
|
2501
2501
|
} catch (y) {
|
|
2502
2502
|
console.warn("Failed to save table state to localStorage:", y);
|
|
2503
2503
|
}
|
|
2504
|
-
},
|
|
2504
|
+
}, k = () => {
|
|
2505
2505
|
if (!i) return null;
|
|
2506
2506
|
try {
|
|
2507
2507
|
const y = localStorage.getItem(d);
|
|
2508
2508
|
if (!y) return null;
|
|
2509
|
-
const
|
|
2509
|
+
const w = JSON.parse(y);
|
|
2510
2510
|
if (c > 0) {
|
|
2511
|
-
const T = Date.now() -
|
|
2511
|
+
const T = Date.now() - w.timestamp, F = c * 24 * 60 * 60 * 1e3;
|
|
2512
2512
|
if (T > F)
|
|
2513
2513
|
return localStorage.removeItem(d), null;
|
|
2514
2514
|
}
|
|
2515
|
-
return
|
|
2515
|
+
return w.params;
|
|
2516
2516
|
} catch (y) {
|
|
2517
2517
|
return console.warn("Failed to load table state from localStorage:", y), null;
|
|
2518
2518
|
}
|
|
@@ -2529,22 +2529,22 @@ const to = (e) => {
|
|
|
2529
2529
|
Object.keys(y).forEach((T) => {
|
|
2530
2530
|
u(T) && delete y[T];
|
|
2531
2531
|
});
|
|
2532
|
-
const
|
|
2533
|
-
Object.assign(y,
|
|
2532
|
+
const w = f(e.params);
|
|
2533
|
+
Object.assign(y, w);
|
|
2534
2534
|
} else {
|
|
2535
2535
|
Object.keys(y).forEach((T) => {
|
|
2536
2536
|
(T.startsWith(`${l}[`) || T === l) && delete y[T];
|
|
2537
2537
|
});
|
|
2538
|
-
const
|
|
2539
|
-
Object.assign(y,
|
|
2538
|
+
const w = f(e.params, l);
|
|
2539
|
+
Object.assign(y, w);
|
|
2540
2540
|
}
|
|
2541
2541
|
t.replace({ query: y });
|
|
2542
|
-
}, u = (y) => !!(["page", "limit", "search", "orderBy", "sortedBy"].includes(y) || y.includes("[")), h = (y,
|
|
2543
|
-
if (["page", "limit"].includes(y) &&
|
|
2544
|
-
const F = parseInt(
|
|
2545
|
-
return isNaN(F) ?
|
|
2542
|
+
}, u = (y) => !!(["page", "limit", "search", "orderBy", "sortedBy"].includes(y) || y.includes("[")), h = (y, w) => {
|
|
2543
|
+
if (["page", "limit"].includes(y) && w !== null && w !== void 0) {
|
|
2544
|
+
const F = parseInt(w, 10);
|
|
2545
|
+
return isNaN(F) ? w : F;
|
|
2546
2546
|
}
|
|
2547
|
-
return
|
|
2547
|
+
return w;
|
|
2548
2548
|
}, x = () => {
|
|
2549
2549
|
if (n)
|
|
2550
2550
|
Object.keys(a.query).forEach((y) => {
|
|
@@ -2552,10 +2552,10 @@ const to = (e) => {
|
|
|
2552
2552
|
});
|
|
2553
2553
|
else {
|
|
2554
2554
|
const y = `${l}[`;
|
|
2555
|
-
Object.keys(a.query).forEach((
|
|
2556
|
-
if (
|
|
2557
|
-
const T =
|
|
2558
|
-
e.params[T] = h(T, a.query[
|
|
2555
|
+
Object.keys(a.query).forEach((w) => {
|
|
2556
|
+
if (w.startsWith(y)) {
|
|
2557
|
+
const T = w.slice(y.length, -1);
|
|
2558
|
+
e.params[T] = h(T, a.query[w]);
|
|
2559
2559
|
}
|
|
2560
2560
|
});
|
|
2561
2561
|
}
|
|
@@ -2569,28 +2569,28 @@ const to = (e) => {
|
|
|
2569
2569
|
), r && pe(() => {
|
|
2570
2570
|
let y = !1;
|
|
2571
2571
|
if (o) {
|
|
2572
|
-
let
|
|
2572
|
+
let w = !1;
|
|
2573
2573
|
if (n)
|
|
2574
|
-
|
|
2574
|
+
w = Object.keys(a.query).some((T) => u(T));
|
|
2575
2575
|
else {
|
|
2576
2576
|
const T = `${l}[`;
|
|
2577
|
-
|
|
2577
|
+
w = Object.keys(a.query).some(
|
|
2578
2578
|
(F) => F.startsWith(T)
|
|
2579
2579
|
);
|
|
2580
2580
|
}
|
|
2581
|
-
|
|
2581
|
+
w && (y = !0, x());
|
|
2582
2582
|
}
|
|
2583
2583
|
if (!y && i) {
|
|
2584
|
-
const
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
}), Object.assign(e.params,
|
|
2584
|
+
const w = k();
|
|
2585
|
+
w && Object.keys(w).length > 0 && (Object.keys(w).forEach((T) => {
|
|
2586
|
+
w[T] = h(T, w[T]);
|
|
2587
|
+
}), Object.assign(e.params, w));
|
|
2588
2588
|
}
|
|
2589
2589
|
}), {
|
|
2590
2590
|
syncToRoute: b,
|
|
2591
2591
|
restoreFromRoute: x,
|
|
2592
2592
|
saveToStorage: p,
|
|
2593
|
-
loadFromStorage:
|
|
2593
|
+
loadFromStorage: k,
|
|
2594
2594
|
clearStorage: _
|
|
2595
2595
|
};
|
|
2596
2596
|
}, mo = { class: "flex items-center gap-4 py-3" }, go = { class: "shrink-0" }, ho = { class: "text-sm text-gray-700" }, yo = { class: "font-medium" }, vo = { class: "font-medium" }, bo = { class: "font-medium" }, xo = {
|
|
@@ -2619,7 +2619,7 @@ const to = (e) => {
|
|
|
2619
2619
|
])
|
|
2620
2620
|
]));
|
|
2621
2621
|
}
|
|
2622
|
-
},
|
|
2622
|
+
}, wo = { class: "flex items-center gap-4 px-4 py-3" }, ko = {
|
|
2623
2623
|
key: 0,
|
|
2624
2624
|
class: "shrink-0 ml-auto"
|
|
2625
2625
|
}, _o = {
|
|
@@ -2650,32 +2650,32 @@ const to = (e) => {
|
|
|
2650
2650
|
return (d, f) => {
|
|
2651
2651
|
const p = A("font-awesome-icon");
|
|
2652
2652
|
return m(), v("div", null, [
|
|
2653
|
-
g("div",
|
|
2654
|
-
i.value.length > 1 ? (m(), v("div",
|
|
2653
|
+
g("div", wo, [
|
|
2654
|
+
i.value.length > 1 ? (m(), v("div", ko, [
|
|
2655
2655
|
g("div", null, [
|
|
2656
2656
|
g("nav", _o, [
|
|
2657
2657
|
g("a", {
|
|
2658
2658
|
class: V([c.value ? "" : "disabled", "relative inline-flex items-center rounded-l-md px-2 py-[9px] text-gray-400 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-20 focus:outline-offset-0"]),
|
|
2659
2659
|
href: "#",
|
|
2660
|
-
onClick: f[0] || (f[0] = O((
|
|
2660
|
+
onClick: f[0] || (f[0] = O((k) => l(-1), ["prevent"]))
|
|
2661
2661
|
}, [
|
|
2662
2662
|
S(p, {
|
|
2663
2663
|
icon: C(R).farChevronLeft,
|
|
2664
2664
|
class: "size-5"
|
|
2665
2665
|
}, null, 8, ["icon"])
|
|
2666
2666
|
], 2),
|
|
2667
|
-
(m(!0), v(E, null, N(i.value, (
|
|
2668
|
-
key: `page-${
|
|
2667
|
+
(m(!0), v(E, null, N(i.value, (k) => (m(), v("a", {
|
|
2668
|
+
key: `page-${k}`,
|
|
2669
2669
|
href: "#",
|
|
2670
2670
|
class: V([
|
|
2671
2671
|
"relative inline-flex items-center px-4 py-[9px] text-sm font-semibold ring-1 ring-inset",
|
|
2672
|
-
e.sparkTable.params.page ===
|
|
2672
|
+
e.sparkTable.params.page === k ? "z-10 text-white bg-primary-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 hover:bg-primary-600" : "text-gray-900 hover:bg-gray-50 ring-gray-300 focus:z-20 focus:outline-offset-0"
|
|
2673
2673
|
]),
|
|
2674
|
-
onClick: (_) => n(
|
|
2675
|
-
}, M(
|
|
2674
|
+
onClick: (_) => n(k)
|
|
2675
|
+
}, M(k), 11, So))), 128)),
|
|
2676
2676
|
g("a", {
|
|
2677
2677
|
class: V([r.value ? "" : "disabled", "relative inline-flex items-center rounded-r-md px-2 py-[9px] text-gray-400 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-20 focus:outline-offset-0"]),
|
|
2678
|
-
onClick: f[1] || (f[1] = O((
|
|
2678
|
+
onClick: f[1] || (f[1] = O((k) => l(1), ["prevent"])),
|
|
2679
2679
|
href: "#"
|
|
2680
2680
|
}, [
|
|
2681
2681
|
S(p, {
|
|
@@ -3154,8 +3154,8 @@ const to = (e) => {
|
|
|
3154
3154
|
if (c) return;
|
|
3155
3155
|
f.hotInstance.updateData(f.response.data), f.options.callback && typeof f.options.callback == "function" && await f.options.callback();
|
|
3156
3156
|
const h = f.hotInstance.getPlugin("autoColumnSize");
|
|
3157
|
-
te(a.settings, "columns", []).forEach((y,
|
|
3158
|
-
y.width || h.calculateColumnsWidth(
|
|
3157
|
+
te(a.settings, "columns", []).forEach((y, w) => {
|
|
3158
|
+
y.width || h.calculateColumnsWidth(w, w, !0);
|
|
3159
3159
|
}), l("load", {
|
|
3160
3160
|
data: f.response.data,
|
|
3161
3161
|
meta: f.response.meta
|
|
@@ -3221,11 +3221,11 @@ const to = (e) => {
|
|
|
3221
3221
|
beforeCopy: (u, h) => {
|
|
3222
3222
|
const x = o.value?.hotInstance;
|
|
3223
3223
|
x && h.forEach((y) => {
|
|
3224
|
-
for (let
|
|
3224
|
+
for (let w = y.startRow; w <= y.endRow; w++)
|
|
3225
3225
|
for (let T = y.startCol; T <= y.endCol; T++) {
|
|
3226
|
-
const F = x.getCell(
|
|
3226
|
+
const F = x.getCell(w, T);
|
|
3227
3227
|
if (F) {
|
|
3228
|
-
const j =
|
|
3228
|
+
const j = w - h[0].startRow, me = T - h[0].startCol;
|
|
3229
3229
|
u[j][me] = F.dataset.copyValue ?? F.textContent ?? "";
|
|
3230
3230
|
}
|
|
3231
3231
|
}
|
|
@@ -3235,7 +3235,7 @@ const to = (e) => {
|
|
|
3235
3235
|
}))
|
|
3236
3236
|
}), p = L(
|
|
3237
3237
|
() => f.computed.ready && f.response.data?.length === 0
|
|
3238
|
-
),
|
|
3238
|
+
), k = (u) => {
|
|
3239
3239
|
if (!u) return null;
|
|
3240
3240
|
switch (u.type) {
|
|
3241
3241
|
case "search":
|
|
@@ -3253,10 +3253,10 @@ const to = (e) => {
|
|
|
3253
3253
|
() => {
|
|
3254
3254
|
const u = [];
|
|
3255
3255
|
Object.values(a.plugins).forEach((h) => {
|
|
3256
|
-
const x =
|
|
3256
|
+
const x = k(h);
|
|
3257
3257
|
if (!x) return;
|
|
3258
|
-
const y = _(h),
|
|
3259
|
-
!y &&
|
|
3258
|
+
const y = _(h), w = f.params[x] !== void 0;
|
|
3259
|
+
!y && w && u.push(x);
|
|
3260
3260
|
}), u.length > 0 && u.forEach((h) => {
|
|
3261
3261
|
delete f.params[h];
|
|
3262
3262
|
});
|
|
@@ -3331,7 +3331,7 @@ const to = (e) => {
|
|
|
3331
3331
|
ref: o,
|
|
3332
3332
|
settings: f.tableSettings
|
|
3333
3333
|
}, null, 8, ["settings"]), [
|
|
3334
|
-
[
|
|
3334
|
+
[wt, !p.value]
|
|
3335
3335
|
]),
|
|
3336
3336
|
p.value ? (m(), v("div", Ko, [
|
|
3337
3337
|
S(x, {
|
|
@@ -3630,24 +3630,24 @@ function fl(e = {}) {
|
|
|
3630
3630
|
onError: i = null,
|
|
3631
3631
|
showNotification: r = !0,
|
|
3632
3632
|
setFieldErrors: c = !0,
|
|
3633
|
-
setFormErrors: d = !
|
|
3633
|
+
setFormErrors: d = !0
|
|
3634
3634
|
} = e, f = Y(), p = D(!1);
|
|
3635
|
-
async function
|
|
3636
|
-
const { submitFn: h, method: x = "create", node: y = null, isEditMode:
|
|
3635
|
+
async function k(u) {
|
|
3636
|
+
const { submitFn: h, method: x = "create", node: y = null, isEditMode: w = !1 } = u;
|
|
3637
3637
|
p.value = !0, y && y.clearErrors();
|
|
3638
3638
|
try {
|
|
3639
3639
|
const F = (await h()).data;
|
|
3640
|
+
if (o && await o(F), !w && n) {
|
|
3641
|
+
const j = typeof n == "function" ? n(F) : n;
|
|
3642
|
+
await f.push(j);
|
|
3643
|
+
}
|
|
3640
3644
|
if (r) {
|
|
3641
|
-
const j =
|
|
3642
|
-
B.
|
|
3645
|
+
const j = w ? l : x === "create" ? a : t;
|
|
3646
|
+
B.toast({
|
|
3643
3647
|
type: "success",
|
|
3644
3648
|
message: j
|
|
3645
3649
|
});
|
|
3646
3650
|
}
|
|
3647
|
-
if (o && await o(F), !k && n) {
|
|
3648
|
-
const j = typeof n == "function" ? n(F) : n;
|
|
3649
|
-
await f.push(j);
|
|
3650
|
-
}
|
|
3651
3651
|
return { success: !0, data: F, error: null };
|
|
3652
3652
|
} catch (T) {
|
|
3653
3653
|
const F = T.response;
|
|
@@ -3655,36 +3655,36 @@ function fl(e = {}) {
|
|
|
3655
3655
|
return { success: !1, data: null, error: T };
|
|
3656
3656
|
if (rr(F)) {
|
|
3657
3657
|
const j = or(F);
|
|
3658
|
-
j && y && c && y.setErrors([], j), d && B.show({
|
|
3658
|
+
j && y && c && y.setErrors([], j), d && (B.show({
|
|
3659
3659
|
type: "danger",
|
|
3660
3660
|
message: Oe(F)
|
|
3661
|
-
});
|
|
3661
|
+
}), window.scrollTo({ top: 0, behavior: "smooth" }));
|
|
3662
3662
|
} else
|
|
3663
3663
|
B.show({
|
|
3664
3664
|
type: "danger",
|
|
3665
3665
|
message: Oe(F)
|
|
3666
|
-
});
|
|
3666
|
+
}), window.scrollTo({ top: 0, behavior: "smooth" });
|
|
3667
3667
|
return { success: !1, data: null, error: T };
|
|
3668
3668
|
} finally {
|
|
3669
3669
|
p.value = !1;
|
|
3670
3670
|
}
|
|
3671
3671
|
}
|
|
3672
3672
|
async function _(u) {
|
|
3673
|
-
const { url: h, payload: x, method: y = "post", node:
|
|
3674
|
-
return
|
|
3673
|
+
const { url: h, payload: x, method: y = "post", node: w, isEditMode: T } = u, F = ve();
|
|
3674
|
+
return k({
|
|
3675
3675
|
submitFn: () => F[y](h, x),
|
|
3676
3676
|
method: T ? "update" : "create",
|
|
3677
|
-
node:
|
|
3677
|
+
node: w,
|
|
3678
3678
|
isEditMode: T
|
|
3679
3679
|
});
|
|
3680
3680
|
}
|
|
3681
3681
|
async function b(u) {
|
|
3682
|
-
const { payload: h, node: x, resourceId: y, isEditMode:
|
|
3683
|
-
return _({ url: T, payload: h, method:
|
|
3682
|
+
const { payload: h, node: x, resourceId: y, isEditMode: w } = u, T = w ? `/${s}/${y}` : `/${s}`;
|
|
3683
|
+
return _({ url: T, payload: h, method: w ? "put" : "post", node: x, isEditMode: w });
|
|
3684
3684
|
}
|
|
3685
3685
|
return {
|
|
3686
3686
|
submitting: p,
|
|
3687
|
-
submit:
|
|
3687
|
+
submit: k,
|
|
3688
3688
|
submitToApi: _,
|
|
3689
3689
|
...s ? { submitCrud: b } : {}
|
|
3690
3690
|
};
|
|
@@ -3705,9 +3705,9 @@ function ml(e, s = {}) {
|
|
|
3705
3705
|
p !== void 0 && (o.value = p);
|
|
3706
3706
|
} else {
|
|
3707
3707
|
const p = ve();
|
|
3708
|
-
let
|
|
3709
|
-
t && (
|
|
3710
|
-
const _ = await p.get(
|
|
3708
|
+
let k = `/${e}/${r.value}`;
|
|
3709
|
+
t && (k += `?${t}`);
|
|
3710
|
+
const _ = await p.get(k);
|
|
3711
3711
|
o.value = _.data;
|
|
3712
3712
|
}
|
|
3713
3713
|
} catch (p) {
|
|
@@ -3790,7 +3790,7 @@ function hl(e = {}) {
|
|
|
3790
3790
|
const u = r.value.find((h) => d(h));
|
|
3791
3791
|
return u || (t ? r.value.find((h) => h.id === t) || r.value[0] : r.value[0] || null);
|
|
3792
3792
|
}), p = L(() => f.value?.id || null);
|
|
3793
|
-
async function
|
|
3793
|
+
async function k(u) {
|
|
3794
3794
|
const h = typeof u == "string" ? n.value.find((x) => x.id === u) : u;
|
|
3795
3795
|
if (!h)
|
|
3796
3796
|
return console.warn(`[useSubNavigation] Item not found: ${u}`), !1;
|
|
@@ -3801,12 +3801,12 @@ function hl(e = {}) {
|
|
|
3801
3801
|
return await a.push(x), !0;
|
|
3802
3802
|
}
|
|
3803
3803
|
if (h.overlay) {
|
|
3804
|
-
const { component: x, props: y = {}, eventHandlers:
|
|
3805
|
-
return ae[T === "left" ? "showLeft" : "showRight"](ce(x), y,
|
|
3804
|
+
const { component: x, props: y = {}, eventHandlers: w = {}, position: T = "right", size: F } = h.overlay;
|
|
3805
|
+
return ae[T === "left" ? "showLeft" : "showRight"](ce(x), y, w, { size: F }), !0;
|
|
3806
3806
|
}
|
|
3807
3807
|
if (h.modal) {
|
|
3808
|
-
const { component: x, props: y = {}, eventHandlers:
|
|
3809
|
-
return J.show(ce(x), y,
|
|
3808
|
+
const { component: x, props: y = {}, eventHandlers: w = {} } = h.modal;
|
|
3809
|
+
return J.show(ce(x), y, w), !0;
|
|
3810
3810
|
}
|
|
3811
3811
|
if (h.action) {
|
|
3812
3812
|
const x = h.action(h);
|
|
@@ -3826,7 +3826,7 @@ function hl(e = {}) {
|
|
|
3826
3826
|
visibleItems: r,
|
|
3827
3827
|
activeItem: f,
|
|
3828
3828
|
activeId: p,
|
|
3829
|
-
navigateTo:
|
|
3829
|
+
navigateTo: k,
|
|
3830
3830
|
isActive: d,
|
|
3831
3831
|
isDisabled: c,
|
|
3832
3832
|
setItems: _,
|
|
@@ -3885,7 +3885,7 @@ function yl(e = {}) {
|
|
|
3885
3885
|
const p = (b) => {
|
|
3886
3886
|
if (i.value)
|
|
3887
3887
|
return b.preventDefault(), b.returnValue = "", "";
|
|
3888
|
-
},
|
|
3888
|
+
}, k = () => {
|
|
3889
3889
|
f || (window.addEventListener("beforeunload", p), f = !0);
|
|
3890
3890
|
}, _ = () => {
|
|
3891
3891
|
f && (window.removeEventListener("beforeunload", p), f = !1);
|
|
@@ -3897,7 +3897,7 @@ function yl(e = {}) {
|
|
|
3897
3897
|
setDirty: r,
|
|
3898
3898
|
setClean: c,
|
|
3899
3899
|
checkDirty: d,
|
|
3900
|
-
enableBrowserWarning:
|
|
3900
|
+
enableBrowserWarning: k,
|
|
3901
3901
|
disableBrowserWarning: _
|
|
3902
3902
|
};
|
|
3903
3903
|
}
|
|
@@ -3925,7 +3925,7 @@ const vl = [
|
|
|
3925
3925
|
}, br = ["href", "onClick"], xr = {
|
|
3926
3926
|
key: 1,
|
|
3927
3927
|
class: "text-[13px]"
|
|
3928
|
-
},
|
|
3928
|
+
}, wr = { class: "mt-auto" }, kr = { class: "p-[10px] flex-shrink-0" }, _r = { class: "flex flex-1 items-center gap-x-6" }, Sr = { class: "relative flex flex-1 items-center gap-4" }, Cr = { class: "cursor-pointer" }, Tr = ["src"], $r = { class: "ml-auto" }, Lr = { class: "mr-[10px] pb-[10px] flex-1 flex flex-col" }, bl = {
|
|
3929
3929
|
__name: "SparkDefaultContainer",
|
|
3930
3930
|
props: {
|
|
3931
3931
|
appStore: {
|
|
@@ -3960,12 +3960,12 @@ const vl = [
|
|
|
3960
3960
|
}
|
|
3961
3961
|
}
|
|
3962
3962
|
);
|
|
3963
|
-
},
|
|
3963
|
+
}, k = L(() => t.mainNavStore.state.hidden ? ["w-0 overflow-hidden"] : [t.mainNavStore.state.collapsed ? "w-[80px]" : "w-[240px]"]), _ = L(() => t.mainNavStore.state.hidden ? ["pl-2.5"] : [t.mainNavStore.state.collapsed ? "pl-[80px]" : "pl-[240px]"]);
|
|
3964
3964
|
return (b, u) => {
|
|
3965
3965
|
const h = A("font-awesome-icon"), x = A("router-view");
|
|
3966
3966
|
return m(), v(E, null, [
|
|
3967
3967
|
g("div", {
|
|
3968
|
-
class: V([
|
|
3968
|
+
class: V([k.value, "fixed inset-y-0 flex transition-all z-100"])
|
|
3969
3969
|
}, [
|
|
3970
3970
|
g("div", ur, [
|
|
3971
3971
|
g("nav", dr, [
|
|
@@ -4001,7 +4001,7 @@ const vl = [
|
|
|
4001
4001
|
"hover:bg-gray-100": y?.href
|
|
4002
4002
|
}, "h-[37px] sgroup flex items-center gap-x-2 rounded-md p-3 text-gray-800 leading-5 transition-all duration-300 ease-in-out"]),
|
|
4003
4003
|
href: y?.href,
|
|
4004
|
-
onClick: O((
|
|
4004
|
+
onClick: O((w) => e.mainNavStore.goto(y.href), ["prevent"])
|
|
4005
4005
|
}, [
|
|
4006
4006
|
y.icon ? (m(), H(h, {
|
|
4007
4007
|
key: 0,
|
|
@@ -4021,27 +4021,27 @@ const vl = [
|
|
|
4021
4021
|
}, M(y.name), 3))
|
|
4022
4022
|
], 10, hr),
|
|
4023
4023
|
y.children ? (m(), v("ul", vr, [
|
|
4024
|
-
(m(!0), v(E, null, N(y.children, (
|
|
4025
|
-
key:
|
|
4024
|
+
(m(!0), v(E, null, N(y.children, (w) => (m(), v("li", {
|
|
4025
|
+
key: w.name
|
|
4026
4026
|
}, [
|
|
4027
4027
|
g("a", {
|
|
4028
|
-
class: V([[o(
|
|
4029
|
-
href:
|
|
4030
|
-
onClick: O((T) => e.mainNavStore.goto(
|
|
4028
|
+
class: V([[o(w) ? "bg-gray-100" : "", "hover:bg-gray-100"], "h-[37px] sgroup flex items-center gap-x-2 rounded-md p-3 text-gray-800 leading-5 transition-all duration-300 ease-in-out"]),
|
|
4029
|
+
href: w.href,
|
|
4030
|
+
onClick: O((T) => e.mainNavStore.goto(w.href), ["prevent"])
|
|
4031
4031
|
}, [
|
|
4032
|
-
|
|
4032
|
+
w.icon ? (m(), H(h, {
|
|
4033
4033
|
key: 0,
|
|
4034
|
-
icon: C(R)[
|
|
4035
|
-
class: V([[(o(
|
|
4034
|
+
icon: C(R)[w.icon],
|
|
4035
|
+
class: V([[(o(w), "text-gray-400")], "size-4"])
|
|
4036
4036
|
}, null, 8, ["icon", "class"])) : $("", !0),
|
|
4037
|
-
e.mainNavStore.state.collapsed ? $("", !0) : (m(), v("span", xr, M(
|
|
4037
|
+
e.mainNavStore.state.collapsed ? $("", !0) : (m(), v("span", xr, M(w.name), 1))
|
|
4038
4038
|
], 10, br)
|
|
4039
4039
|
]))), 128))
|
|
4040
4040
|
])) : $("", !0)
|
|
4041
4041
|
], 2))), 128))
|
|
4042
4042
|
])
|
|
4043
4043
|
]),
|
|
4044
|
-
g("li",
|
|
4044
|
+
g("li", wr, [
|
|
4045
4045
|
z(b.$slots, "sidebar-footer"),
|
|
4046
4046
|
g("a", {
|
|
4047
4047
|
class: "font-medium grid place-content-center gap-x-3 rounded-md h-10 p-2.5 text-gray-800 text-[13px] hover:bg-gray-100 transition-all duration-300 ease-in-out",
|
|
@@ -4061,7 +4061,7 @@ const vl = [
|
|
|
4061
4061
|
g("div", {
|
|
4062
4062
|
class: V([_.value, "h-full transition-all flex flex-col"])
|
|
4063
4063
|
}, [
|
|
4064
|
-
g("div",
|
|
4064
|
+
g("div", kr, [
|
|
4065
4065
|
g("div", _r, [
|
|
4066
4066
|
g("div", Sr, [
|
|
4067
4067
|
z(b.$slots, "header-left", {}, () => [
|
|
@@ -4577,14 +4577,14 @@ const xl = /* @__PURE__ */ oe(Pr, [["render", Vr]]), Hr = { class: "h-full grid
|
|
|
4577
4577
|
])
|
|
4578
4578
|
]));
|
|
4579
4579
|
}
|
|
4580
|
-
}, vn = { class: "h-full grid place-content-center relative" }, bn = { class: "absolute top-8 left-8" }, xn = ["src"],
|
|
4580
|
+
}, vn = { class: "h-full grid place-content-center relative" }, bn = { class: "absolute top-8 left-8" }, xn = ["src"], wn = {
|
|
4581
4581
|
key: 1,
|
|
4582
4582
|
width: "59",
|
|
4583
4583
|
height: "23",
|
|
4584
4584
|
viewBox: "0 0 59 23",
|
|
4585
4585
|
fill: "none",
|
|
4586
4586
|
xmlns: "http://www.w3.org/2000/svg"
|
|
4587
|
-
},
|
|
4587
|
+
}, kn = { class: "max-w-lg grid gap-y-6 text-center -mt-8" }, _n = { class: "flex gap-4 justify-center" }, Sn = {
|
|
4588
4588
|
__name: "SparkError404View",
|
|
4589
4589
|
props: {
|
|
4590
4590
|
logo: {
|
|
@@ -4607,7 +4607,7 @@ const xl = /* @__PURE__ */ oe(Pr, [["render", Vr]]), Hr = { class: "h-full grid
|
|
|
4607
4607
|
src: t.logo,
|
|
4608
4608
|
alt: "Logo",
|
|
4609
4609
|
class: "h-[23px] w-auto"
|
|
4610
|
-
}, null, 8, xn)) : (m(), v("svg",
|
|
4610
|
+
}, null, 8, xn)) : (m(), v("svg", wn, [...n[0] || (n[0] = [
|
|
4611
4611
|
g("path", {
|
|
4612
4612
|
d: "M49.2029 17.1264V8.03835H44.0829V5.22235H58.0989V8.03835H52.9629V17.1264H49.2029Z",
|
|
4613
4613
|
fill: "#1C64F2"
|
|
@@ -4626,7 +4626,7 @@ const xl = /* @__PURE__ */ oe(Pr, [["render", Vr]]), Hr = { class: "h-full grid
|
|
|
4626
4626
|
}, null, -1)
|
|
4627
4627
|
])]))
|
|
4628
4628
|
]),
|
|
4629
|
-
g("div",
|
|
4629
|
+
g("div", kn, [
|
|
4630
4630
|
n[2] || (n[2] = g("div", null, [
|
|
4631
4631
|
g("div", { class: "text-primary-600 text-7xl font-bold mb-4" }, "404"),
|
|
4632
4632
|
g("h1", { class: "text-3xl text-gray-900 font-semibold tracking-tight mb-3" }, " Page Not Found "),
|
|
@@ -4653,7 +4653,7 @@ const xl = /* @__PURE__ */ oe(Pr, [["render", Vr]]), Hr = { class: "h-full grid
|
|
|
4653
4653
|
viewBox: "0 0 59 23",
|
|
4654
4654
|
fill: "none",
|
|
4655
4655
|
xmlns: "http://www.w3.org/2000/svg"
|
|
4656
|
-
}, Pn = { class: "max-w-lg grid gap-y-6 text-center -mt-8" }, Mn = { class: "text-primary-600 text-7xl font-bold mb-4" }, Vn = { class: "text-3xl text-gray-900 font-semibold tracking-tight mb-3" }, Hn = { class: "text-gray-600" }, Fn = { class: "flex gap-4 justify-center" },
|
|
4656
|
+
}, Pn = { class: "max-w-lg grid gap-y-6 text-center -mt-8" }, Mn = { class: "text-primary-600 text-7xl font-bold mb-4" }, Vn = { class: "text-3xl text-gray-900 font-semibold tracking-tight mb-3" }, Hn = { class: "text-gray-600" }, Fn = { class: "flex gap-4 justify-center" }, wl = {
|
|
4657
4657
|
__name: "SparkErrorGeneralView",
|
|
4658
4658
|
props: {
|
|
4659
4659
|
logo: {
|
|
@@ -4728,7 +4728,7 @@ const xl = /* @__PURE__ */ oe(Pr, [["render", Vr]]), Hr = { class: "h-full grid
|
|
|
4728
4728
|
]));
|
|
4729
4729
|
}
|
|
4730
4730
|
};
|
|
4731
|
-
function
|
|
4731
|
+
function kl(e = {}) {
|
|
4732
4732
|
const {
|
|
4733
4733
|
loginPath: s = "/login",
|
|
4734
4734
|
logoutPath: t = "/logout",
|
|
@@ -4937,7 +4937,7 @@ export {
|
|
|
4937
4937
|
bl as SparkDefaultContainer,
|
|
4938
4938
|
yn as SparkError403View,
|
|
4939
4939
|
Sn as SparkError404View,
|
|
4940
|
-
|
|
4940
|
+
wl as SparkErrorGeneralView,
|
|
4941
4941
|
ll as SparkFileDragUpload,
|
|
4942
4942
|
en as SparkForgotPasswordView,
|
|
4943
4943
|
il as SparkImageUpload,
|
|
@@ -4964,7 +4964,7 @@ export {
|
|
|
4964
4964
|
cr as clearAllDirtyForms,
|
|
4965
4965
|
Sl as create403Route,
|
|
4966
4966
|
Cl as create404Route,
|
|
4967
|
-
|
|
4967
|
+
kl as createAuthRoutes,
|
|
4968
4968
|
ar as createAxiosInstance,
|
|
4969
4969
|
dl as createBootstrapService,
|
|
4970
4970
|
Na as customiseHeader,
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ import { parseLaravelErrors, getFormLevelMessage, isValidationError } from '../u
|
|
|
18
18
|
* @param {Function} options.onError - Callback after error (receives error, can return true to skip default handling)
|
|
19
19
|
* @param {boolean} options.showNotification - Whether to show success notification (default: true)
|
|
20
20
|
* @param {boolean} options.setFieldErrors - Whether to set field-level errors on 422 (default: true)
|
|
21
|
-
* @param {boolean} options.setFormErrors - Whether to show form-level error notification on 422 (default:
|
|
21
|
+
* @param {boolean} options.setFormErrors - Whether to show form-level error notification on 422 (default: true)
|
|
22
22
|
*
|
|
23
23
|
* @returns {Object} Form submission helpers
|
|
24
24
|
*/
|
|
@@ -33,7 +33,7 @@ export function useFormSubmission(options = {}) {
|
|
|
33
33
|
onError = null,
|
|
34
34
|
showNotification = true,
|
|
35
35
|
setFieldErrors = true,
|
|
36
|
-
setFormErrors =
|
|
36
|
+
setFormErrors = true,
|
|
37
37
|
} = options
|
|
38
38
|
|
|
39
39
|
const router = useRouter()
|
|
@@ -64,20 +64,6 @@ export function useFormSubmission(options = {}) {
|
|
|
64
64
|
const response = await submitFn()
|
|
65
65
|
const data = response.data
|
|
66
66
|
|
|
67
|
-
// Show success notification
|
|
68
|
-
if (showNotification) {
|
|
69
|
-
const message = isEditMode
|
|
70
|
-
? updateMessage
|
|
71
|
-
: method === 'create'
|
|
72
|
-
? createMessage
|
|
73
|
-
: successMessage
|
|
74
|
-
|
|
75
|
-
sparkNotificationService.show({
|
|
76
|
-
type: 'success',
|
|
77
|
-
message,
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
|
|
81
67
|
// Execute success callback
|
|
82
68
|
if (onSuccess) {
|
|
83
69
|
await onSuccess(data)
|
|
@@ -91,6 +77,21 @@ export function useFormSubmission(options = {}) {
|
|
|
91
77
|
await router.push(location)
|
|
92
78
|
}
|
|
93
79
|
|
|
80
|
+
// Show success notification (after redirect so it appears on the destination page
|
|
81
|
+
// and isn't cleared by SparkNotificationOutlet's route-change detection)
|
|
82
|
+
if (showNotification) {
|
|
83
|
+
const message = isEditMode
|
|
84
|
+
? updateMessage
|
|
85
|
+
: method === 'create'
|
|
86
|
+
? createMessage
|
|
87
|
+
: successMessage
|
|
88
|
+
|
|
89
|
+
sparkNotificationService.toast({
|
|
90
|
+
type: 'success',
|
|
91
|
+
message,
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
94
95
|
return { success: true, data, error: null }
|
|
95
96
|
} catch (error) {
|
|
96
97
|
const response = error.response
|
|
@@ -116,6 +117,7 @@ export function useFormSubmission(options = {}) {
|
|
|
116
117
|
type: 'danger',
|
|
117
118
|
message: getFormLevelMessage(response),
|
|
118
119
|
})
|
|
120
|
+
window.scrollTo({ top: 0, behavior: 'smooth' })
|
|
119
121
|
}
|
|
120
122
|
} else {
|
|
121
123
|
// Handle non-validation errors
|
|
@@ -123,6 +125,7 @@ export function useFormSubmission(options = {}) {
|
|
|
123
125
|
type: 'danger',
|
|
124
126
|
message: getFormLevelMessage(response),
|
|
125
127
|
})
|
|
128
|
+
window.scrollTo({ top: 0, behavior: 'smooth' })
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
return { success: false, data: null, error }
|