golden-logic-ui 1.3.26 → 1.3.28
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/GeneralComponents/DataTable/DatatableAction.vue.js +38 -36
- package/dist/components/GeneralComponents/DataTable/DatatableActionsMenu.vue.js +99 -0
- package/dist/components/GeneralComponents/DataTable/DatatableDeleteAction.vue.js +42 -40
- package/dist/components/GeneralComponents/DataTable/DatatableDeleteEditAction.vue.js +58 -56
- package/dist/components/GeneralComponents/DataTable/GLDataTable.vue.js +52 -49
- package/dist/components/GeneralComponents/DataTable/GLDataTableServerSide.vue.js +74 -74
- package/dist/components/GeneralComponents/DataTable/GlDataTableComponent.vue.js +30 -27
- package/dist/components/GeneralComponents/DataTable/useGlFloatingMenu.js +31 -0
- package/dist/components/GeneralComponents/GlTabsWrapper.vue.js +69 -62
- package/dist/golden-logic-ui.css +1 -1
- package/dist/main.js +83 -79
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { ref as C, resolveDirective as M, createElementBlock as s, openBlock as i, Fragment as $, createVNode as A, withDirectives as m, createCommentVNode as n, createElementVNode as e, unref as l, normalizeStyle as O, createTextVNode as p, withModifiers as j, vShow as B } from "vue";
|
|
2
|
+
import { useGlFloatingMenu as N } from "./useGlFloatingMenu.js";
|
|
3
|
+
import S from "../DeleteConfirmationModal.vue.js";
|
|
4
|
+
import V from "../../../Stores/toast.js";
|
|
5
|
+
const E = {
|
|
5
6
|
key: 0,
|
|
6
7
|
class: "flex lg:justify-center"
|
|
7
|
-
},
|
|
8
|
+
}, Z = {
|
|
8
9
|
class: "py-2 text-sm text-gray-700 dark:text-gray-200",
|
|
9
10
|
"aria-labelledby": "dropdownDividerButton"
|
|
10
|
-
},
|
|
11
|
+
}, z = { key: 0 }, F = ["href"], G = { key: 1 }, R = {
|
|
11
12
|
__name: "DatatableAction",
|
|
12
13
|
props: {
|
|
13
14
|
field: {
|
|
@@ -32,18 +33,14 @@ const O = {
|
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
35
|
emits: ["deleteAction"],
|
|
35
|
-
setup(t, { emit:
|
|
36
|
-
const d = t,
|
|
37
|
-
i.value = !1;
|
|
38
|
-
}, h = () => {
|
|
39
|
-
i.value = !0;
|
|
40
|
-
}, c = () => {
|
|
36
|
+
setup(t, { emit: f }) {
|
|
37
|
+
const d = t, { open: y, menu: h, style: v, toggle: c, close: u } = N(), a = C(!1), g = () => {
|
|
41
38
|
a.value = !1;
|
|
42
|
-
},
|
|
43
|
-
a.value = !0;
|
|
44
|
-
},
|
|
39
|
+
}, x = () => {
|
|
40
|
+
u(), a.value = !0;
|
|
41
|
+
}, k = f, b = () => {
|
|
45
42
|
axios.delete(`${d.xprops.route}/${d.row.id}`).then(() => {
|
|
46
|
-
|
|
43
|
+
g(), k("deleteAction"), V.methods.add({
|
|
47
44
|
message: "Item deleted successfully.",
|
|
48
45
|
type: "success",
|
|
49
46
|
duration: 5e3
|
|
@@ -53,19 +50,19 @@ const O = {
|
|
|
53
50
|
});
|
|
54
51
|
};
|
|
55
52
|
return (r, o) => {
|
|
56
|
-
const
|
|
57
|
-
return
|
|
58
|
-
|
|
53
|
+
const w = M("click-outside");
|
|
54
|
+
return i(), s($, null, [
|
|
55
|
+
A(S, {
|
|
59
56
|
isOpen: a.value,
|
|
60
|
-
onConfirmDelete:
|
|
61
|
-
onCancelDelete:
|
|
57
|
+
onConfirmDelete: b,
|
|
58
|
+
onCancelDelete: g
|
|
62
59
|
}, null, 8, ["isOpen"]),
|
|
63
|
-
t.row && r.can(`edit_${t.xprops.permission} || delete_${t.xprops.permission}`) ?
|
|
60
|
+
t.row && r.can(`edit_${t.xprops.permission} || delete_${t.xprops.permission}`) ? m((i(), s("div", E, [
|
|
64
61
|
e("button", {
|
|
65
|
-
onClick:
|
|
62
|
+
onClick: o[0] || (o[0] = (...D) => l(c) && l(c)(...D)),
|
|
66
63
|
class: "inline-flex items-center p-2 text-sm font-medium text-center text-gray-900 bg-white rounded-lg hover:bg-gray-100 focus:ring-4 focus:outline-hidden dark:text-white focus:ring-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-600",
|
|
67
64
|
type: "button"
|
|
68
|
-
}, o[
|
|
65
|
+
}, o[1] || (o[1] = [
|
|
69
66
|
e("svg", {
|
|
70
67
|
class: "w-5 h-5",
|
|
71
68
|
"aria-hidden": "true",
|
|
@@ -76,38 +73,43 @@ const O = {
|
|
|
76
73
|
e("path", { d: "M3.5 1.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 6.041a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 5.959a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z" })
|
|
77
74
|
], -1)
|
|
78
75
|
])),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
m(e("div", {
|
|
77
|
+
ref_key: "menu",
|
|
78
|
+
ref: h,
|
|
79
|
+
style: O(l(v)),
|
|
80
|
+
class: "fixed z-50 bg-white rounded-lg w-44 dark:bg-gray-800 shadow-lg border dark:border-gray-700"
|
|
81
|
+
}, [
|
|
82
|
+
e("ul", Z, [
|
|
83
|
+
r.can(`edit_${t.xprops.permission}`) ? (i(), s("li", z, [
|
|
82
84
|
e("a", {
|
|
83
85
|
href: t.xprops.route + "/" + t.row.id + "/edit",
|
|
84
86
|
class: "block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
85
|
-
}, o[
|
|
87
|
+
}, o[2] || (o[2] = [
|
|
86
88
|
e("i", { class: "mr-2 fa-solid fa-list-ul opacity-80" }, null, -1),
|
|
87
89
|
p(" Edit")
|
|
88
|
-
]), 8,
|
|
90
|
+
]), 8, F)
|
|
89
91
|
])) : n("", !0),
|
|
90
|
-
r.can(`delete_${t.xprops.permission}`) ? (
|
|
92
|
+
r.can(`delete_${t.xprops.permission}`) ? (i(), s("li", G, [
|
|
91
93
|
e("a", {
|
|
92
94
|
href: "#",
|
|
93
|
-
onClick:
|
|
95
|
+
onClick: j(x, ["prevent"]),
|
|
94
96
|
class: "block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
95
|
-
}, o[
|
|
97
|
+
}, o[3] || (o[3] = [
|
|
96
98
|
e("i", { class: "mr-2 fa-solid fa-trash-can opacity-80" }, null, -1),
|
|
97
99
|
p(" Remove")
|
|
98
100
|
]))
|
|
99
101
|
])) : n("", !0)
|
|
100
102
|
])
|
|
101
|
-
],
|
|
102
|
-
[
|
|
103
|
+
], 4), [
|
|
104
|
+
[B, l(y)]
|
|
103
105
|
])
|
|
104
106
|
])), [
|
|
105
|
-
[
|
|
107
|
+
[w, l(u)]
|
|
106
108
|
]) : n("", !0)
|
|
107
109
|
], 64);
|
|
108
110
|
};
|
|
109
111
|
}
|
|
110
112
|
};
|
|
111
113
|
export {
|
|
112
|
-
|
|
114
|
+
R as default
|
|
113
115
|
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { getCurrentInstance as B, computed as S, resolveDirective as z, withDirectives as b, createCommentVNode as u, createElementBlock as i, openBlock as s, createElementVNode as a, unref as n, normalizeStyle as M, Fragment as N, renderList as O, normalizeClass as d, createTextVNode as x, toDisplayString as k, vShow as V } from "vue";
|
|
2
|
+
import { useGlFloatingMenu as Z } from "./useGlFloatingMenu.js";
|
|
3
|
+
const E = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "flex lg:justify-center"
|
|
6
|
+
}, F = ["aria-label", "aria-expanded"], G = ["href", "target"], I = ["disabled", "onClick"], $ = {
|
|
7
|
+
__name: "DatatableActionsMenu",
|
|
8
|
+
props: {
|
|
9
|
+
field: { type: String, default: "" },
|
|
10
|
+
row: { type: [Array, Object], default: () => ({}) },
|
|
11
|
+
xprops: { type: Object, default: () => ({}) },
|
|
12
|
+
tdProps: { type: Object, default: () => ({}) }
|
|
13
|
+
},
|
|
14
|
+
emits: ["cellAction"],
|
|
15
|
+
setup(c, { emit: v }) {
|
|
16
|
+
const o = c, C = v, { open: p, menu: A, style: _, toggle: g, close: l } = Z(), y = B()?.proxy, P = (t) => !t || typeof y?.can != "function" || y.can(t), m = S(() => (typeof o.tdProps?.actions == "function" ? o.tdProps.actions(o.row) : o.tdProps?.actions || []).filter((r) => P(r.permission) && (!r.show || r.show(o.row)))), f = (t) => t.disabled ? !!t.disabled(o.row) : !1, h = (t) => t.danger ? "text-red-600 hover:text-white hover:bg-red-600 dark:text-red-500 dark:hover:text-white dark:hover:bg-red-600" : "hover:bg-gray-100 dark:hover:bg-gray-700 dark:hover:text-white", D = (t) => {
|
|
17
|
+
if (l(), f(t))
|
|
18
|
+
return;
|
|
19
|
+
const r = o.tdProps?.onAction || o.xprops?.onAction;
|
|
20
|
+
if (r) {
|
|
21
|
+
r(t.key, o.row);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
C("cellAction", t.key);
|
|
25
|
+
};
|
|
26
|
+
return (t, r) => {
|
|
27
|
+
const j = z("click-outside");
|
|
28
|
+
return m.value.length ? b((s(), i("div", E, [
|
|
29
|
+
a("button", {
|
|
30
|
+
type: "button",
|
|
31
|
+
"aria-label": c.tdProps?.label ?? "Actions",
|
|
32
|
+
"aria-haspopup": "menu",
|
|
33
|
+
"aria-expanded": n(p) ? "true" : "false",
|
|
34
|
+
class: "inline-flex items-center p-2 text-sm font-medium text-center text-gray-900 bg-white rounded-lg hover:bg-gray-100 focus:ring-4 focus:outline-hidden dark:text-white focus:ring-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-600",
|
|
35
|
+
onClick: r[0] || (r[0] = (...e) => n(g) && n(g)(...e))
|
|
36
|
+
}, r[2] || (r[2] = [
|
|
37
|
+
a("svg", {
|
|
38
|
+
class: "w-5 h-5",
|
|
39
|
+
"aria-hidden": "true",
|
|
40
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
+
fill: "currentColor",
|
|
42
|
+
viewBox: "0 0 4 15"
|
|
43
|
+
}, [
|
|
44
|
+
a("path", { d: "M3.5 1.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 6.041a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 5.959a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z" })
|
|
45
|
+
], -1)
|
|
46
|
+
]), 8, F),
|
|
47
|
+
b(a("ul", {
|
|
48
|
+
ref_key: "menu",
|
|
49
|
+
ref: A,
|
|
50
|
+
role: "menu",
|
|
51
|
+
style: M(n(_)),
|
|
52
|
+
class: "fixed z-50 py-2 text-sm text-gray-700 bg-white border rounded-lg shadow-lg min-w-44 max-w-xs dark:bg-gray-800 dark:text-gray-200 dark:border-gray-700"
|
|
53
|
+
}, [
|
|
54
|
+
(s(!0), i(N, null, O(m.value, (e) => (s(), i("li", {
|
|
55
|
+
key: e.key,
|
|
56
|
+
role: "none"
|
|
57
|
+
}, [
|
|
58
|
+
e.href ? (s(), i("a", {
|
|
59
|
+
key: 0,
|
|
60
|
+
role: "menuitem",
|
|
61
|
+
href: e.href(c.row),
|
|
62
|
+
target: e.target || void 0,
|
|
63
|
+
class: d(["flex items-center px-4 py-2 whitespace-nowrap", h(e)]),
|
|
64
|
+
onClick: r[1] || (r[1] = (...w) => n(l) && n(l)(...w))
|
|
65
|
+
}, [
|
|
66
|
+
e.icon ? (s(), i("i", {
|
|
67
|
+
key: 0,
|
|
68
|
+
class: d(["w-4 opacity-80 me-2", e.icon]),
|
|
69
|
+
"aria-hidden": "true"
|
|
70
|
+
}, null, 2)) : u("", !0),
|
|
71
|
+
x(" " + k(e.label), 1)
|
|
72
|
+
], 10, G)) : (s(), i("button", {
|
|
73
|
+
key: 1,
|
|
74
|
+
type: "button",
|
|
75
|
+
role: "menuitem",
|
|
76
|
+
disabled: f(e),
|
|
77
|
+
class: d(["flex items-center w-full px-4 py-2 whitespace-nowrap text-start disabled:opacity-50 disabled:cursor-not-allowed", h(e)]),
|
|
78
|
+
onClick: (w) => D(e)
|
|
79
|
+
}, [
|
|
80
|
+
e.icon ? (s(), i("i", {
|
|
81
|
+
key: 0,
|
|
82
|
+
class: d(["w-4 opacity-80 me-2", e.icon]),
|
|
83
|
+
"aria-hidden": "true"
|
|
84
|
+
}, null, 2)) : u("", !0),
|
|
85
|
+
x(" " + k(e.label), 1)
|
|
86
|
+
], 10, I))
|
|
87
|
+
]))), 128))
|
|
88
|
+
], 4), [
|
|
89
|
+
[V, n(p)]
|
|
90
|
+
])
|
|
91
|
+
])), [
|
|
92
|
+
[j, n(l)]
|
|
93
|
+
]) : u("", !0);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
export {
|
|
98
|
+
$ as default
|
|
99
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { ref as _, resolveDirective as C, createElementBlock as d, openBlock as n, Fragment as M, createVNode as A, withDirectives as m, createCommentVNode as g, createElementVNode as e, unref as o, normalizeStyle as O, withModifiers as j, createTextVNode as B, vShow as N } from "vue";
|
|
2
|
+
import { useGlFloatingMenu as S } from "./useGlFloatingMenu.js";
|
|
3
|
+
import V from "../DeleteConfirmationModal.vue.js";
|
|
4
|
+
import p from "../../../Stores/toast.js";
|
|
5
|
+
const $ = {
|
|
5
6
|
key: 0,
|
|
6
7
|
class: "flex lg:justify-center"
|
|
7
|
-
},
|
|
8
|
+
}, T = {
|
|
8
9
|
class: "py-2 text-sm text-gray-700 dark:text-gray-200",
|
|
9
10
|
"aria-labelledby": "dropdownDividerButton"
|
|
10
|
-
},
|
|
11
|
+
}, Z = { key: 0 }, I = {
|
|
11
12
|
__name: "DatatableDeleteAction",
|
|
12
13
|
props: {
|
|
13
14
|
field: {
|
|
@@ -32,44 +33,40 @@ const O = {
|
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
35
|
emits: ["deleteAction"],
|
|
35
|
-
setup(
|
|
36
|
-
const a =
|
|
36
|
+
setup(r, { emit: f }) {
|
|
37
|
+
const a = r, { open: y, menu: v, style: h, toggle: c, close: u } = S(), s = _(!1), i = () => {
|
|
37
38
|
s.value = !1;
|
|
38
|
-
},
|
|
39
|
-
s.value = !0;
|
|
40
|
-
},
|
|
41
|
-
l.value = !1;
|
|
42
|
-
}, h = () => {
|
|
43
|
-
l.value = !0;
|
|
44
|
-
}, v = m, w = () => {
|
|
39
|
+
}, w = () => {
|
|
40
|
+
u(), s.value = !0;
|
|
41
|
+
}, x = f, k = () => {
|
|
45
42
|
axios.delete(`${a.xprops.route}/${a.row.id}`).then(() => {
|
|
46
|
-
i(),
|
|
43
|
+
i(), x("deleteAction"), p.methods.add({
|
|
47
44
|
message: "Item deleted successfully.",
|
|
48
45
|
type: "success",
|
|
49
46
|
duration: 5e3
|
|
50
47
|
});
|
|
51
|
-
}).catch((
|
|
52
|
-
i(),
|
|
53
|
-
message:
|
|
48
|
+
}).catch((l) => {
|
|
49
|
+
i(), p.methods.add({
|
|
50
|
+
message: l.response?.data?.message ?? a.language?.delete_failed ?? "That item could not be deleted.",
|
|
54
51
|
type: "error",
|
|
55
52
|
duration: 5e3
|
|
56
53
|
});
|
|
57
54
|
});
|
|
58
55
|
};
|
|
59
|
-
return (
|
|
60
|
-
const b =
|
|
61
|
-
return n(), d(
|
|
62
|
-
|
|
63
|
-
isOpen:
|
|
64
|
-
onConfirmDelete:
|
|
56
|
+
return (l, t) => {
|
|
57
|
+
const b = C("click-outside");
|
|
58
|
+
return n(), d(M, null, [
|
|
59
|
+
A(V, {
|
|
60
|
+
isOpen: s.value,
|
|
61
|
+
onConfirmDelete: k,
|
|
65
62
|
onCancelDelete: i
|
|
66
63
|
}, null, 8, ["isOpen"]),
|
|
67
|
-
|
|
64
|
+
r.row && l.can(`delete_${r.xprops.permission}`) ? m((n(), d("div", $, [
|
|
68
65
|
e("button", {
|
|
69
|
-
onClick:
|
|
66
|
+
onClick: t[0] || (t[0] = (...D) => o(c) && o(c)(...D)),
|
|
70
67
|
class: "inline-flex items-center p-2 text-sm font-medium text-center text-gray-900 bg-white rounded-lg hover:bg-gray-100 focus:ring-4 focus:outline-hidden dark:text-white focus:ring-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-600",
|
|
71
68
|
type: "button"
|
|
72
|
-
},
|
|
69
|
+
}, t[1] || (t[1] = [
|
|
73
70
|
e("svg", {
|
|
74
71
|
class: "w-5 h-5",
|
|
75
72
|
"aria-hidden": "true",
|
|
@@ -80,29 +77,34 @@ const O = {
|
|
|
80
77
|
e("path", { d: "M3.5 1.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 6.041a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 5.959a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z" })
|
|
81
78
|
], -1)
|
|
82
79
|
])),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
m(e("div", {
|
|
81
|
+
ref_key: "menu",
|
|
82
|
+
ref: v,
|
|
83
|
+
style: O(o(h)),
|
|
84
|
+
class: "fixed z-50 bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-44 dark:bg-gray-700 dark:divide-gray-600"
|
|
85
|
+
}, [
|
|
86
|
+
e("ul", T, [
|
|
87
|
+
l.can(`delete_${r.xprops.permission}`) ? (n(), d("li", Z, [
|
|
86
88
|
e("a", {
|
|
87
89
|
href: "#",
|
|
88
|
-
onClick:
|
|
90
|
+
onClick: j(w, ["prevent"]),
|
|
89
91
|
class: "block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
90
|
-
},
|
|
92
|
+
}, t[2] || (t[2] = [
|
|
91
93
|
e("i", { class: "mr-2 fa-solid fa-trash-can opacity-80" }, null, -1),
|
|
92
|
-
|
|
94
|
+
B(" Remove")
|
|
93
95
|
]))
|
|
94
|
-
])) :
|
|
96
|
+
])) : g("", !0)
|
|
95
97
|
])
|
|
96
|
-
],
|
|
97
|
-
[
|
|
98
|
+
], 4), [
|
|
99
|
+
[N, o(y)]
|
|
98
100
|
])
|
|
99
101
|
])), [
|
|
100
|
-
[b,
|
|
101
|
-
]) :
|
|
102
|
+
[b, o(u)]
|
|
103
|
+
]) : g("", !0)
|
|
102
104
|
], 64);
|
|
103
105
|
};
|
|
104
106
|
}
|
|
105
107
|
};
|
|
106
108
|
export {
|
|
107
|
-
|
|
109
|
+
I as default
|
|
108
110
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { ref as O, resolveDirective as j, createElementBlock as i, openBlock as s, Fragment as S, createVNode as B, withDirectives as p, createCommentVNode as u, createElementVNode as o, unref as a, normalizeStyle as E, withModifiers as y, createTextVNode as v, toDisplayString as h, vShow as N } from "vue";
|
|
2
|
+
import { useGlFloatingMenu as V } from "./useGlFloatingMenu.js";
|
|
3
|
+
import T from "../DeleteConfirmationModal.vue.js";
|
|
4
|
+
import k from "../../../Stores/toast.js";
|
|
5
|
+
const Z = {
|
|
5
6
|
key: 0,
|
|
6
7
|
class: "flex lg:justify-center"
|
|
7
|
-
},
|
|
8
|
+
}, q = {
|
|
8
9
|
class: "py-2 text-sm text-gray-700 dark:text-gray-200",
|
|
9
10
|
"aria-labelledby": "dropdownDividerButton"
|
|
10
|
-
},
|
|
11
|
+
}, z = { key: 0 }, F = { key: 1 }, H = {
|
|
11
12
|
__name: "DatatableDeleteEditAction",
|
|
12
13
|
props: {
|
|
13
14
|
language: {
|
|
@@ -38,90 +39,91 @@ const B = {
|
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
emits: ["deleteAction", "editAction"],
|
|
41
|
-
setup(e, { emit:
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
n.value = !0;
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}, D = () => {
|
|
53
|
-
axios.delete(`${a.xprops.route}/${a.row.id}`).then(() => {
|
|
54
|
-
d(), u("deleteAction"), v.methods.add({
|
|
55
|
-
message: a.language?.item_deleted_successfully ?? "Item deleted successfully.",
|
|
42
|
+
setup(e, { emit: x }) {
|
|
43
|
+
const l = e, { open: w, menu: b, style: D, toggle: g, close: n } = V(), d = O(!1), c = () => {
|
|
44
|
+
d.value = !1;
|
|
45
|
+
}, A = () => {
|
|
46
|
+
n(), d.value = !0;
|
|
47
|
+
}, m = x, C = (r) => {
|
|
48
|
+
n(), m("editAction", r);
|
|
49
|
+
}, $ = () => {
|
|
50
|
+
axios.delete(`${l.xprops.route}/${l.row.id}`).then(() => {
|
|
51
|
+
c(), m("deleteAction"), k.methods.add({
|
|
52
|
+
message: l.language?.item_deleted_successfully ?? "Item deleted successfully.",
|
|
56
53
|
type: "success",
|
|
57
54
|
duration: 5e3
|
|
58
55
|
});
|
|
59
|
-
}).catch((
|
|
60
|
-
|
|
61
|
-
message:
|
|
56
|
+
}).catch((r) => {
|
|
57
|
+
c(), k.methods.add({
|
|
58
|
+
message: r.response?.data?.message ?? l.language?.delete_failed ?? "That item could not be deleted.",
|
|
62
59
|
type: "error",
|
|
63
60
|
duration: 5e3
|
|
64
61
|
});
|
|
65
62
|
});
|
|
66
63
|
};
|
|
67
|
-
return (
|
|
68
|
-
const
|
|
69
|
-
return
|
|
70
|
-
|
|
64
|
+
return (r, t) => {
|
|
65
|
+
const M = j("click-outside");
|
|
66
|
+
return s(), i(S, null, [
|
|
67
|
+
B(T, {
|
|
71
68
|
language: e.language,
|
|
72
|
-
isOpen:
|
|
73
|
-
onConfirmDelete:
|
|
74
|
-
onCancelDelete:
|
|
69
|
+
isOpen: d.value,
|
|
70
|
+
onConfirmDelete: $,
|
|
71
|
+
onCancelDelete: c
|
|
75
72
|
}, null, 8, ["language", "isOpen"]),
|
|
76
|
-
e.row && (
|
|
77
|
-
|
|
78
|
-
onClick:
|
|
73
|
+
e.row && (r.can(`delete_${e.xprops.permission}`) || r.can(`access_${e.xprops.permission}`)) ? p((s(), i("div", Z, [
|
|
74
|
+
o("button", {
|
|
75
|
+
onClick: t[0] || (t[0] = (...f) => a(g) && a(g)(...f)),
|
|
79
76
|
class: "inline-flex items-center p-2 text-sm font-medium text-center text-gray-900 bg-white rounded-lg hover:bg-gray-100 focus:ring-4 focus:outline-hidden dark:text-white focus:ring-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-600",
|
|
80
77
|
type: "button"
|
|
81
|
-
},
|
|
82
|
-
|
|
78
|
+
}, t[2] || (t[2] = [
|
|
79
|
+
o("svg", {
|
|
83
80
|
class: "w-5 h-5",
|
|
84
81
|
"aria-hidden": "true",
|
|
85
82
|
xmlns: "http://www.w3.org/2000/svg",
|
|
86
83
|
fill: "currentColor",
|
|
87
84
|
viewBox: "0 0 4 15"
|
|
88
85
|
}, [
|
|
89
|
-
|
|
86
|
+
o("path", { d: "M3.5 1.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 6.041a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 5.959a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z" })
|
|
90
87
|
], -1)
|
|
91
88
|
])),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
p(o("div", {
|
|
90
|
+
ref_key: "menu",
|
|
91
|
+
ref: b,
|
|
92
|
+
style: E(a(D)),
|
|
93
|
+
class: "fixed z-50 bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-44 dark:bg-gray-700 dark:divide-gray-600"
|
|
94
|
+
}, [
|
|
95
|
+
o("ul", q, [
|
|
96
|
+
r.can(`access_${e.xprops.permission}`) ? (s(), i("li", z, [
|
|
97
|
+
o("a", {
|
|
96
98
|
href: "#",
|
|
97
|
-
onClick:
|
|
99
|
+
onClick: t[1] || (t[1] = y((f) => C(e.row), ["prevent"])),
|
|
98
100
|
class: "block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
99
101
|
}, [
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
t[3] || (t[3] = o("i", { class: "mr-1 fa-solid fa-pen-to-square opacity-80" }, null, -1)),
|
|
103
|
+
v(" " + h(e.language?.edit ?? "Edit"), 1)
|
|
102
104
|
])
|
|
103
|
-
])) :
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
])) : u("", !0),
|
|
106
|
+
r.can(`delete_${e.xprops.permission}`) ? (s(), i("li", F, [
|
|
107
|
+
o("a", {
|
|
106
108
|
href: "#",
|
|
107
|
-
onClick:
|
|
109
|
+
onClick: y(A, ["prevent"]),
|
|
108
110
|
class: "block px-4 py-2 text-red-600 hover:text-white hover:bg-red-600 dark:text-red-500 dark:hover:text-white dark:hover:bg-red-600"
|
|
109
111
|
}, [
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
t[4] || (t[4] = o("i", { class: "mr-1 fa-solid fa-trash-can opacity-80" }, null, -1)),
|
|
113
|
+
v(" " + h(e.language?.remove ?? "Remove"), 1)
|
|
112
114
|
])
|
|
113
|
-
])) :
|
|
115
|
+
])) : u("", !0)
|
|
114
116
|
])
|
|
115
|
-
],
|
|
116
|
-
[
|
|
117
|
+
], 4), [
|
|
118
|
+
[N, a(w)]
|
|
117
119
|
])
|
|
118
120
|
])), [
|
|
119
|
-
[
|
|
120
|
-
]) :
|
|
121
|
+
[M, a(n)]
|
|
122
|
+
]) : u("", !0)
|
|
121
123
|
], 64);
|
|
122
124
|
};
|
|
123
125
|
}
|
|
124
126
|
};
|
|
125
127
|
export {
|
|
126
|
-
|
|
128
|
+
H as default
|
|
127
129
|
};
|