@stsdti/auditing-vue 0.0.0-stage → 0.1.5
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/LICENSE +21 -0
- package/README.md +197 -2
- package/dist/auditing-vue.mjs +2278 -0
- package/dist/auditing-vue.mjs.map +1 -0
- package/package.json +68 -4
- package/scripts/vendor-funky-styles.mjs +135 -0
- package/src/components/audit/AuditChanges.vue +181 -0
- package/src/components/audit/AuditChangesDialog.vue +106 -0
- package/src/components/audit/AuditEventBadge.vue +51 -0
- package/src/components/audit/AuditFilterSelect.vue +303 -0
- package/src/components/audit/AuditFilters.vue +164 -0
- package/src/components/audit/AuditHistory.vue +133 -0
- package/src/components/audit/AuditHistoryButton.vue +99 -0
- package/src/components/audit/AuditTable.vue +622 -0
- package/src/components/audit/AuditTimeline.vue +311 -0
- package/src/components/ui/UiDialog.vue +166 -0
- package/src/components/ui/UiLoadingBlur.vue +29 -0
- package/src/index.js +61 -0
- package/src/shared.js +95 -0
- package/src/styles/base.css +104 -0
- package/src/styles/generated/style-nova.css +256 -0
- package/src/styles/generated/style-rhea.css +256 -0
- package/src/styles/generated/tokens.css +288 -0
- package/src/styles/nova.css +8 -0
- package/src/styles/rhea.css +8 -0
- package/src/themes/nova.css +2 -0
- package/src/themes/rhea.css +2 -0
|
@@ -0,0 +1,2278 @@
|
|
|
1
|
+
import { Fragment as e, Teleport as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createSlots as s, createTextVNode as c, createVNode as l, guardReactiveProps as u, h as d, inject as f, mergeModels as p, mergeProps as m, nextTick as h, normalizeClass as g, normalizeProps as _, normalizeStyle as v, onBeforeUnmount as y, onMounted as b, openBlock as x, ref as S, renderList as C, renderSlot as w, resolveDynamicComponent as T, shallowRef as E, toDisplayString as D, unref as O, useId as k, useModel as A, useSlots as j, vModelSelect as ee, vModelText as te, watch as M, withCtx as N, withDirectives as ne, withKeys as P, withModifiers as F } from "vue";
|
|
2
|
+
import { ArrowRightIcon as I, CheckIcon as L, ChevronDownIcon as re, ChevronLeftIcon as ie, ChevronRightIcon as R, CircleAlertIcon as ae, CircleSmallIcon as z, ClockIcon as oe, CpuIcon as se, EyeIcon as B, HistoryIcon as V, InboxIcon as ce, LayersIcon as le, LinkIcon as ue, LoaderCircleIcon as de, PencilIcon as H, PlusIcon as fe, RefreshCwIcon as pe, RotateCcwIcon as U, SearchIcon as me, SlidersHorizontalIcon as he, TargetIcon as W, TrashIcon as ge, UnlinkIcon as _e, UserRoundIcon as ve, XIcon as ye } from "@lucide/vue";
|
|
3
|
+
import { AUDIT_EVENTS as G, AUDIT_EVENTS as be, DEFAULT_MESSAGES as xe, auditChanges as K, auditEvent as Se, clip as q, emptyFilters as Ce, emptyFilters as we, eventLabel as J, filterChips as Te, formatDateTime as Ee, formatMessage as Y, formatValue as De, groupByBatch as Oe, mergeMessages as ke, pageRange as Ae, pageWindow as je, setAuditingColorScheme as Me, setAuditingDateFormatter as Ne, shortClassName as Pe, shortClassName as Fe, showsNewValues as Ie, showsOldValues as Le, toParams as Re, userName as ze } from "@stsdti/auditing-core";
|
|
4
|
+
import { clsx as Be } from "clsx";
|
|
5
|
+
import { extendTailwindMerge as Ve } from "tailwind-merge";
|
|
6
|
+
// src/shared.js
|
|
7
|
+
var He = Symbol("auditing.messages");
|
|
8
|
+
function X(e = null) {
|
|
9
|
+
return ke(f(He, null), e);
|
|
10
|
+
}
|
|
11
|
+
var Ue = Ve({ extend: { theme: { radius: [
|
|
12
|
+
"surface",
|
|
13
|
+
"control",
|
|
14
|
+
"item"
|
|
15
|
+
] } } });
|
|
16
|
+
function Z(...e) {
|
|
17
|
+
return Ue(Be(e));
|
|
18
|
+
}
|
|
19
|
+
var We = {
|
|
20
|
+
plus: fe,
|
|
21
|
+
pencil: H,
|
|
22
|
+
trash: ge,
|
|
23
|
+
restore: U,
|
|
24
|
+
link: ue,
|
|
25
|
+
unlink: _e,
|
|
26
|
+
dot: z
|
|
27
|
+
}, Ge = (e) => We[e] ?? z, Ke = ({ variant: e = "default", size: t = "default" } = {}) => Z("cn-button group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", `cn-button-variant-${e}`, `cn-button-size-${t}`), qe = ({ variant: e = "default" } = {}) => Z("cn-badge group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap focus-visible:border-ring focus-ring aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none", `cn-badge-variant-${e}`), Je = "cn-input w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", Ye = "cn-button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 [&>input]:flex-1 cn-button-group-orientation-horizontal [&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none", Xe = "cn-field group/field flex w-full cn-field-orientation-vertical flex-col *:w-full [&>.sr-only]:w-auto", Ze = "cn-field-group group/field-group @container/field-group flex w-full flex-col gap-(--form-gap)", Qe = "cn-label flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed cn-field-label group/field-label peer/field-label w-fit leading-snug", $e = "bg-card text-muted-foreground hover:text-foreground", et = {
|
|
28
|
+
success: "success",
|
|
29
|
+
info: "info",
|
|
30
|
+
danger: "destructive",
|
|
31
|
+
warning: "warning",
|
|
32
|
+
accent: "outline",
|
|
33
|
+
neutral: "secondary"
|
|
34
|
+
}, tt = {
|
|
35
|
+
success: "bg-success/10 text-success dark:bg-success/20",
|
|
36
|
+
info: "bg-info/10 text-info dark:bg-info/20",
|
|
37
|
+
danger: "bg-destructive/10 text-destructive dark:bg-destructive/20",
|
|
38
|
+
warning: "bg-warning/10 text-warning dark:bg-warning/20",
|
|
39
|
+
accent: "bg-primary/10 text-primary dark:bg-primary/20",
|
|
40
|
+
neutral: "bg-muted text-muted-foreground"
|
|
41
|
+
}, Q = ({ as: e, type: t, variant: n, size: r }, { slots: i }) => d(e, {
|
|
42
|
+
type: e === "button" ? t : void 0,
|
|
43
|
+
"data-slot": "button",
|
|
44
|
+
"data-variant": n,
|
|
45
|
+
"data-size": r,
|
|
46
|
+
class: Ke({
|
|
47
|
+
variant: n,
|
|
48
|
+
size: r
|
|
49
|
+
})
|
|
50
|
+
}, i.default?.());
|
|
51
|
+
Q.props = {
|
|
52
|
+
as: {
|
|
53
|
+
type: [String, Object],
|
|
54
|
+
default: "button"
|
|
55
|
+
},
|
|
56
|
+
type: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "button"
|
|
59
|
+
},
|
|
60
|
+
variant: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: "default"
|
|
63
|
+
},
|
|
64
|
+
size: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: "default"
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var $ = ({ variant: e }, { slots: t }) => d("span", {
|
|
70
|
+
"data-slot": "badge",
|
|
71
|
+
"data-variant": e,
|
|
72
|
+
class: qe({ variant: e })
|
|
73
|
+
}, t.default?.());
|
|
74
|
+
$.props = { variant: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: "default"
|
|
77
|
+
} };
|
|
78
|
+
// src/components/audit/AuditChanges.vue
|
|
79
|
+
var nt = { class: "flex flex-col gap-1.5" }, rt = ["title"], it = ["title"], at = { class: "sr-only" }, ot = ["title"], st = ["title"], ct = ["title"], lt = {
|
|
80
|
+
"data-slot": "table-header",
|
|
81
|
+
class: "cn-table-header bg-muted/50"
|
|
82
|
+
}, ut = {
|
|
83
|
+
"data-slot": "table-row",
|
|
84
|
+
class: "cn-table-row hover:bg-transparent"
|
|
85
|
+
}, dt = {
|
|
86
|
+
"data-slot": "table-body",
|
|
87
|
+
class: "cn-table-body"
|
|
88
|
+
}, ft = ["title"], pt = ["title"], mt = ["textContent"], ht = ["title"], gt = ["textContent"], _t = {
|
|
89
|
+
key: 2,
|
|
90
|
+
class: "text-xs text-muted-foreground"
|
|
91
|
+
}, vt = {
|
|
92
|
+
__name: "AuditChanges",
|
|
93
|
+
props: {
|
|
94
|
+
value: {
|
|
95
|
+
type: Object,
|
|
96
|
+
required: !0
|
|
97
|
+
},
|
|
98
|
+
layout: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: "table"
|
|
101
|
+
},
|
|
102
|
+
size: {
|
|
103
|
+
type: String,
|
|
104
|
+
default: "default"
|
|
105
|
+
},
|
|
106
|
+
limit: {
|
|
107
|
+
type: Number,
|
|
108
|
+
default: null
|
|
109
|
+
},
|
|
110
|
+
maxLength: {
|
|
111
|
+
type: Number,
|
|
112
|
+
default: null
|
|
113
|
+
},
|
|
114
|
+
formatValue: {
|
|
115
|
+
type: Function,
|
|
116
|
+
default: De
|
|
117
|
+
},
|
|
118
|
+
fieldLabel: {
|
|
119
|
+
type: Function,
|
|
120
|
+
default: (e) => e
|
|
121
|
+
},
|
|
122
|
+
messages: {
|
|
123
|
+
type: Object,
|
|
124
|
+
default: null
|
|
125
|
+
},
|
|
126
|
+
ui: {
|
|
127
|
+
type: Object,
|
|
128
|
+
default: null
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
emits: ["expand"],
|
|
132
|
+
setup(t, { emit: s }) {
|
|
133
|
+
let u = t, d = s, f = X(u.messages), p = n(() => K(u.value, { format: u.formatValue })), h = n(() => u.limit === null ? p.value : p.value.slice(0, u.limit)), _ = n(() => Le(u.value)), v = n(() => Ie(u.value)), y = n(() => u.size === "sm"), b = n(() => y.value ? "px-2.5 py-1.5" : "px-3 py-2.5");
|
|
134
|
+
function S(e, t) {
|
|
135
|
+
let n = t === "old" ? u.value.old_values : u.value.new_values;
|
|
136
|
+
return {
|
|
137
|
+
audit: u.value,
|
|
138
|
+
field: e.field,
|
|
139
|
+
side: t,
|
|
140
|
+
value: n?.[e.field] ?? null,
|
|
141
|
+
text: q(t === "old" ? e.oldValue : e.newValue, u.maxLength) || "—"
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return (n, s) => (x(), a("div", {
|
|
145
|
+
class: g(O(Z)("laravel-auditing", t.ui?.root)),
|
|
146
|
+
"data-slot": "audit-changes"
|
|
147
|
+
}, [o("div", nt, [h.value.length && t.layout === "list" ? (x(), a("ul", {
|
|
148
|
+
key: 0,
|
|
149
|
+
"data-slot": "timeline-changes",
|
|
150
|
+
class: g(O(Z)("flex flex-col gap-1 rounded-item bg-muted/50 px-2.5 py-2 text-xs", t.ui?.list))
|
|
151
|
+
}, [(x(!0), a(e, null, C(h.value, (r) => (x(), a("li", {
|
|
152
|
+
key: r.field,
|
|
153
|
+
class: "flex flex-wrap items-baseline gap-x-1.5 gap-y-0.5"
|
|
154
|
+
}, [o("span", {
|
|
155
|
+
class: "font-medium text-foreground",
|
|
156
|
+
title: r.field
|
|
157
|
+
}, D(t.fieldLabel(r.field, t.value)) + ": ", 9, rt), _.value && v.value ? (x(), a(e, { key: 0 }, [
|
|
158
|
+
o("span", {
|
|
159
|
+
class: "whitespace-pre-wrap text-muted-foreground line-through decoration-muted-foreground/50 wrap-anywhere",
|
|
160
|
+
title: r.oldValue
|
|
161
|
+
}, [w(n.$slots, "value", m({ ref_for: !0 }, S(r, "old")), () => [c(D(O(q)(r.oldValue, t.maxLength) || "—"), 1)])], 8, it),
|
|
162
|
+
l(O(I), {
|
|
163
|
+
class: "cn-rtl-flip size-3 shrink-0 self-center text-muted-foreground",
|
|
164
|
+
"aria-hidden": "true"
|
|
165
|
+
}),
|
|
166
|
+
o("span", at, D(O(f).becomes), 1),
|
|
167
|
+
o("span", {
|
|
168
|
+
class: "whitespace-pre-wrap text-foreground wrap-anywhere",
|
|
169
|
+
title: r.newValue
|
|
170
|
+
}, [w(n.$slots, "value", m({ ref_for: !0 }, S(r, "new")), () => [c(D(O(q)(r.newValue, t.maxLength) || "—"), 1)])], 8, ot)
|
|
171
|
+
], 64)) : v.value ? (x(), a("span", {
|
|
172
|
+
key: 1,
|
|
173
|
+
class: "whitespace-pre-wrap text-foreground wrap-anywhere",
|
|
174
|
+
title: r.newValue
|
|
175
|
+
}, [w(n.$slots, "value", m({ ref_for: !0 }, S(r, "new")), () => [c(D(O(q)(r.newValue, t.maxLength) || "—"), 1)])], 8, st)) : (x(), a("span", {
|
|
176
|
+
key: 2,
|
|
177
|
+
class: "whitespace-pre-wrap text-muted-foreground line-through decoration-muted-foreground/50 wrap-anywhere",
|
|
178
|
+
title: r.oldValue
|
|
179
|
+
}, [w(n.$slots, "value", m({ ref_for: !0 }, S(r, "old")), () => [c(D(O(q)(r.oldValue, t.maxLength) || "—"), 1)])], 8, ct))]))), 128))], 2)) : h.value.length ? (x(), a("div", {
|
|
180
|
+
key: 1,
|
|
181
|
+
"data-slot": "table-container",
|
|
182
|
+
class: g(O(Z)("cn-table-container overflow-hidden rounded-item border", t.ui?.table))
|
|
183
|
+
}, [o("table", {
|
|
184
|
+
"data-slot": "table",
|
|
185
|
+
class: g(O(Z)("cn-table table-fixed", y.value ? "text-xs" : "text-sm"))
|
|
186
|
+
}, [o("thead", lt, [o("tr", ut, [
|
|
187
|
+
o("th", {
|
|
188
|
+
"data-slot": "table-head",
|
|
189
|
+
class: g(O(Z)("cn-table-head font-medium text-muted-foreground", y.value ? "h-8 w-36 px-2.5 text-xs" : "h-10 w-1/3 px-3"))
|
|
190
|
+
}, D(O(f).field), 3),
|
|
191
|
+
_.value ? (x(), a("th", {
|
|
192
|
+
key: 0,
|
|
193
|
+
"data-slot": "table-head",
|
|
194
|
+
class: g(O(Z)("cn-table-head font-medium text-muted-foreground", y.value ? "h-8 px-2.5 text-xs" : "h-10 px-3"))
|
|
195
|
+
}, D(O(f).oldValue), 3)) : i("", !0),
|
|
196
|
+
v.value ? (x(), a("th", {
|
|
197
|
+
key: 1,
|
|
198
|
+
"data-slot": "table-head",
|
|
199
|
+
class: g(O(Z)("cn-table-head font-medium text-muted-foreground", y.value ? "h-8 px-2.5 text-xs" : "h-10 px-3"))
|
|
200
|
+
}, D(O(f).newValue), 3)) : i("", !0)
|
|
201
|
+
])]), o("tbody", dt, [(x(!0), a(e, null, C(h.value, (e) => (x(), a("tr", {
|
|
202
|
+
key: e.field,
|
|
203
|
+
"data-slot": "table-row",
|
|
204
|
+
class: "cn-table-row hover:bg-transparent"
|
|
205
|
+
}, [
|
|
206
|
+
o("td", {
|
|
207
|
+
"data-slot": "table-cell",
|
|
208
|
+
class: g(O(Z)("cn-table-cell align-top font-medium whitespace-normal text-foreground wrap-anywhere", b.value)),
|
|
209
|
+
title: e.field
|
|
210
|
+
}, D(t.fieldLabel(e.field, t.value)), 11, ft),
|
|
211
|
+
_.value ? (x(), a("td", {
|
|
212
|
+
key: 0,
|
|
213
|
+
"data-slot": "table-cell",
|
|
214
|
+
class: g(O(Z)("cn-table-cell align-top text-muted-foreground wrap-anywhere", b.value)),
|
|
215
|
+
title: e.oldValue
|
|
216
|
+
}, [w(n.$slots, "value", m({ ref_for: !0 }, S(e, "old")), () => [o("span", {
|
|
217
|
+
class: g(O(Z)("whitespace-pre-wrap", e.oldValue && "line-through decoration-muted-foreground/50")),
|
|
218
|
+
textContent: D(O(q)(e.oldValue, t.maxLength) || "—")
|
|
219
|
+
}, null, 10, mt)])], 10, pt)) : i("", !0),
|
|
220
|
+
v.value ? (x(), a("td", {
|
|
221
|
+
key: 1,
|
|
222
|
+
"data-slot": "table-cell",
|
|
223
|
+
class: g(O(Z)("cn-table-cell align-top text-foreground wrap-anywhere", b.value)),
|
|
224
|
+
title: e.newValue
|
|
225
|
+
}, [w(n.$slots, "value", m({ ref_for: !0 }, S(e, "new")), () => [o("span", {
|
|
226
|
+
class: "whitespace-pre-wrap",
|
|
227
|
+
textContent: D(O(q)(e.newValue, t.maxLength) || "—")
|
|
228
|
+
}, null, 8, gt)])], 10, ht)) : i("", !0)
|
|
229
|
+
]))), 128))])], 2)], 2)) : (x(), a("p", _t, D(O(f).noChanges), 1)), h.value.length < p.value.length ? (x(), r(O(Q), {
|
|
230
|
+
key: 3,
|
|
231
|
+
variant: "link",
|
|
232
|
+
size: "xs",
|
|
233
|
+
class: "self-start px-0",
|
|
234
|
+
onClick: s[0] ||= (e) => d("expand", t.value)
|
|
235
|
+
}, {
|
|
236
|
+
default: N(() => [c(D(O(Y)(O(f).showAllChanges, { count: p.value.length })) + " ", 1), l(O(I), {
|
|
237
|
+
class: "cn-rtl-flip",
|
|
238
|
+
"data-icon": "inline-end",
|
|
239
|
+
"aria-hidden": "true"
|
|
240
|
+
})]),
|
|
241
|
+
_: 1
|
|
242
|
+
})) : i("", !0)])], 2));
|
|
243
|
+
}
|
|
244
|
+
}, yt = {
|
|
245
|
+
key: 0,
|
|
246
|
+
class: "laravel-auditing"
|
|
247
|
+
}, bt = ["data-slot"], xt = [
|
|
248
|
+
"aria-labelledby",
|
|
249
|
+
"aria-describedby",
|
|
250
|
+
"data-slot",
|
|
251
|
+
"data-side"
|
|
252
|
+
], St = ["data-slot"], Ct = { class: "flex min-w-0 flex-col gap-0.5" }, wt = ["id"], Tt = ["id"], Et = {
|
|
253
|
+
key: 0,
|
|
254
|
+
"data-slot": "modal-header-actions",
|
|
255
|
+
class: "ml-auto flex shrink-0 items-center gap-1"
|
|
256
|
+
}, Dt = ["data-slot"], Ot = ["data-slot"], kt = {
|
|
257
|
+
__name: "UiDialog",
|
|
258
|
+
props: /*@__PURE__*/ p({
|
|
259
|
+
variant: {
|
|
260
|
+
type: String,
|
|
261
|
+
default: "dialog"
|
|
262
|
+
},
|
|
263
|
+
title: {
|
|
264
|
+
type: String,
|
|
265
|
+
default: ""
|
|
266
|
+
},
|
|
267
|
+
description: {
|
|
268
|
+
type: String,
|
|
269
|
+
default: ""
|
|
270
|
+
},
|
|
271
|
+
width: {
|
|
272
|
+
type: String,
|
|
273
|
+
default: "sm:max-w-lg"
|
|
274
|
+
},
|
|
275
|
+
closeLabel: {
|
|
276
|
+
type: String,
|
|
277
|
+
default: "Închide"
|
|
278
|
+
},
|
|
279
|
+
ui: {
|
|
280
|
+
type: Object,
|
|
281
|
+
default: null
|
|
282
|
+
}
|
|
283
|
+
}, {
|
|
284
|
+
open: {
|
|
285
|
+
type: Boolean,
|
|
286
|
+
default: !1
|
|
287
|
+
},
|
|
288
|
+
openModifiers: {}
|
|
289
|
+
}),
|
|
290
|
+
emits: ["update:open"],
|
|
291
|
+
setup(e) {
|
|
292
|
+
let s = e, u = A(e, "open"), d = j(), f = S(null), p = k(), m = k(), _ = n(() => s.variant === "drawer"), v = n(() => !!(s.description || d.description)), b = null, C = "", T = !1;
|
|
293
|
+
function E(e) {
|
|
294
|
+
if (u.value) {
|
|
295
|
+
if (e.key === "Escape") e.stopPropagation(), u.value = !1;
|
|
296
|
+
else if (e.key === "Tab" && f.value) {
|
|
297
|
+
let t = [...f.value.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])")];
|
|
298
|
+
if (!t.length) return;
|
|
299
|
+
let n = t[0], r = t.at(-1), i = f.value.contains(document.activeElement);
|
|
300
|
+
e.shiftKey && (!i || document.activeElement === n || document.activeElement === f.value) ? (e.preventDefault(), r.focus()) : e.shiftKey || i && document.activeElement !== r || (e.preventDefault(), n.focus());
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return M(u, async (e) => {
|
|
305
|
+
typeof document < "u" && (e && !T ? (T = !0, b = document.activeElement, C = document.documentElement.style.overflow, document.documentElement.style.overflow = "hidden", document.addEventListener("keydown", E), await h(), f.value?.focus()) : !e && T && (T = !1, document.documentElement.style.overflow = C, document.removeEventListener("keydown", E), b?.focus?.()));
|
|
306
|
+
}, { immediate: !0 }), y(() => {
|
|
307
|
+
T && typeof document < "u" && (document.documentElement.style.overflow = C, document.removeEventListener("keydown", E));
|
|
308
|
+
}), (n, s) => (x(), r(t, { to: "body" }, [u.value ? (x(), a("div", yt, [o("div", {
|
|
309
|
+
"data-slot": _.value ? "sheet-overlay" : "dialog-overlay",
|
|
310
|
+
"data-state": "open",
|
|
311
|
+
class: g(O(Z)(_.value ? "cn-sheet-overlay fixed inset-0 z-50 animate-in fade-in-0 duration-200" : "cn-dialog-overlay fixed inset-0 isolate z-50", e.ui?.overlay)),
|
|
312
|
+
onClick: s[0] ||= (e) => u.value = !1
|
|
313
|
+
}, null, 10, bt), o("div", {
|
|
314
|
+
ref_key: "panel",
|
|
315
|
+
ref: f,
|
|
316
|
+
role: "dialog",
|
|
317
|
+
"aria-modal": "true",
|
|
318
|
+
tabindex: "-1",
|
|
319
|
+
"aria-labelledby": O(p),
|
|
320
|
+
"aria-describedby": v.value ? O(m) : void 0,
|
|
321
|
+
"data-slot": _.value ? "sheet-content" : "dialog-content",
|
|
322
|
+
"data-state": "open",
|
|
323
|
+
"data-side": _.value ? "right" : void 0,
|
|
324
|
+
class: g(O(Z)(_.value ? "cn-sheet-content gap-0 outline-none animate-in fade-in-0 slide-in-from-right-10 sm:max-w-sm" : "cn-dialog-content fixed top-1/2 left-1/2 z-50 flex max-h-[90vh] w-full max-w-[calc(100%-2*var(--overlay-margin))] -translate-x-1/2 -translate-y-1/2 flex-col gap-0 overflow-hidden p-0 outline-none", !_.value && e.width, e.ui?.content))
|
|
325
|
+
}, [
|
|
326
|
+
o("div", {
|
|
327
|
+
"data-slot": _.value ? "drawer-header" : "modal-header",
|
|
328
|
+
class: g(O(Z)("flex shrink-0 items-center gap-2 border-b px-(--layout-gap) py-3 pr-12", e.ui?.header))
|
|
329
|
+
}, [o("div", Ct, [o("h2", {
|
|
330
|
+
id: O(p),
|
|
331
|
+
"data-slot": "dialog-title",
|
|
332
|
+
class: g(O(Z)("cn-font-heading text-base font-medium text-foreground", e.ui?.title))
|
|
333
|
+
}, [w(n.$slots, "title", {}, () => [c(D(e.title), 1)])], 10, wt), v.value ? (x(), a("div", {
|
|
334
|
+
key: 0,
|
|
335
|
+
id: O(m),
|
|
336
|
+
"data-slot": "dialog-description",
|
|
337
|
+
class: g(O(Z)("text-sm text-muted-foreground", e.ui?.description))
|
|
338
|
+
}, [w(n.$slots, "description", {}, () => [c(D(e.description), 1)])], 10, Tt)) : i("", !0)]), n.$slots.actions ? (x(), a("div", Et, [w(n.$slots, "actions")])) : i("", !0)], 10, St),
|
|
339
|
+
o("div", {
|
|
340
|
+
"data-slot": _.value ? "drawer-body" : "modal-body",
|
|
341
|
+
class: g(O(Z)("flex min-h-0 flex-1 flex-col gap-(--form-gap) overflow-y-auto p-(--layout-gap)", e.ui?.body))
|
|
342
|
+
}, [w(n.$slots, "default")], 10, Dt),
|
|
343
|
+
n.$slots.footer ? (x(), a("div", {
|
|
344
|
+
key: 0,
|
|
345
|
+
"data-slot": _.value ? "drawer-footer" : "modal-footer",
|
|
346
|
+
class: g(O(Z)("flex shrink-0 flex-col-reverse gap-2 border-t px-(--layout-gap) py-3 sm:flex-row sm:justify-end", e.ui?.footer))
|
|
347
|
+
}, [w(n.$slots, "footer")], 10, Ot)) : i("", !0),
|
|
348
|
+
l(O(Q), {
|
|
349
|
+
variant: "ghost",
|
|
350
|
+
size: "icon-sm",
|
|
351
|
+
class: g(O(Z)(_.value ? "cn-sheet-close" : "cn-dialog-close", "top-2.5 right-2.5", e.ui?.close)),
|
|
352
|
+
"aria-label": e.closeLabel,
|
|
353
|
+
onClick: s[1] ||= (e) => u.value = !1
|
|
354
|
+
}, {
|
|
355
|
+
default: N(() => [l(O(ye), { "aria-hidden": "true" })]),
|
|
356
|
+
_: 1
|
|
357
|
+
}, 8, ["class", "aria-label"])
|
|
358
|
+
], 10, xt)])) : i("", !0)]));
|
|
359
|
+
}
|
|
360
|
+
}, At = ["data-event"], jt = {
|
|
361
|
+
__name: "AuditEventBadge",
|
|
362
|
+
props: {
|
|
363
|
+
event: {
|
|
364
|
+
type: String,
|
|
365
|
+
required: !0
|
|
366
|
+
},
|
|
367
|
+
label: {
|
|
368
|
+
type: String,
|
|
369
|
+
default: null
|
|
370
|
+
},
|
|
371
|
+
variant: {
|
|
372
|
+
type: String,
|
|
373
|
+
default: null
|
|
374
|
+
},
|
|
375
|
+
icon: {
|
|
376
|
+
type: Boolean,
|
|
377
|
+
default: !0
|
|
378
|
+
},
|
|
379
|
+
iconOnly: {
|
|
380
|
+
type: Boolean,
|
|
381
|
+
default: !1
|
|
382
|
+
},
|
|
383
|
+
messages: {
|
|
384
|
+
type: Object,
|
|
385
|
+
default: null
|
|
386
|
+
},
|
|
387
|
+
ui: {
|
|
388
|
+
type: Object,
|
|
389
|
+
default: null
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
setup(e) {
|
|
393
|
+
let t = e, o = X(t.messages), s = n(() => Se(t.event)), l = n(() => t.label ?? J(o, t.event));
|
|
394
|
+
return (t, n) => (x(), a("span", {
|
|
395
|
+
class: g(O(Z)("laravel-auditing", e.ui?.root)),
|
|
396
|
+
"data-slot": "audit-event-badge",
|
|
397
|
+
"data-event": e.event
|
|
398
|
+
}, [e.iconOnly ? (x(), r(O($), {
|
|
399
|
+
key: 0,
|
|
400
|
+
variant: e.variant ?? O(et)[s.value.tone],
|
|
401
|
+
class: g(O(Z)("h-6 min-w-6 px-0 [&>svg]:size-3.5!", e.ui?.badge)),
|
|
402
|
+
title: l.value,
|
|
403
|
+
role: "img",
|
|
404
|
+
"aria-label": l.value
|
|
405
|
+
}, {
|
|
406
|
+
default: N(() => [(x(), r(T(O(Ge)(s.value.glyph)), { "aria-hidden": "true" }))]),
|
|
407
|
+
_: 1
|
|
408
|
+
}, 8, [
|
|
409
|
+
"variant",
|
|
410
|
+
"class",
|
|
411
|
+
"title",
|
|
412
|
+
"aria-label"
|
|
413
|
+
])) : (x(), r(O($), {
|
|
414
|
+
key: 1,
|
|
415
|
+
variant: e.variant ?? O(et)[s.value.tone],
|
|
416
|
+
class: g(e.ui?.badge)
|
|
417
|
+
}, {
|
|
418
|
+
default: N(() => [e.icon ? (x(), r(T(O(Ge)(s.value.glyph)), {
|
|
419
|
+
key: 0,
|
|
420
|
+
"data-icon": "inline-start",
|
|
421
|
+
"aria-hidden": "true"
|
|
422
|
+
})) : i("", !0), c(" " + D(l.value), 1)]),
|
|
423
|
+
_: 1
|
|
424
|
+
}, 8, ["variant", "class"]))], 10, At));
|
|
425
|
+
}
|
|
426
|
+
}, Mt = {
|
|
427
|
+
key: 0,
|
|
428
|
+
class: "flex flex-wrap items-center gap-x-2 gap-y-1"
|
|
429
|
+
}, Nt = { class: "font-medium text-foreground" }, Pt = { class: "tabular-nums" }, Ft = ["datetime"], It = {
|
|
430
|
+
key: 0,
|
|
431
|
+
class: "flex flex-col gap-4"
|
|
432
|
+
}, Lt = { class: "text-muted-foreground" }, Rt = { class: "font-mono wrap-anywhere" }, zt = {
|
|
433
|
+
__name: "AuditChangesDialog",
|
|
434
|
+
props: /*@__PURE__*/ p({
|
|
435
|
+
audit: {
|
|
436
|
+
type: Object,
|
|
437
|
+
default: null
|
|
438
|
+
},
|
|
439
|
+
typeLabel: {
|
|
440
|
+
type: Function,
|
|
441
|
+
default: Fe
|
|
442
|
+
},
|
|
443
|
+
userLabel: {
|
|
444
|
+
type: [String, Function],
|
|
445
|
+
default: "name"
|
|
446
|
+
},
|
|
447
|
+
formatValue: {
|
|
448
|
+
type: Function,
|
|
449
|
+
default: De
|
|
450
|
+
},
|
|
451
|
+
fieldLabel: {
|
|
452
|
+
type: Function,
|
|
453
|
+
default: (e) => e
|
|
454
|
+
},
|
|
455
|
+
showContext: {
|
|
456
|
+
type: Boolean,
|
|
457
|
+
default: !0
|
|
458
|
+
},
|
|
459
|
+
messages: {
|
|
460
|
+
type: Object,
|
|
461
|
+
default: null
|
|
462
|
+
},
|
|
463
|
+
ui: {
|
|
464
|
+
type: Object,
|
|
465
|
+
default: null
|
|
466
|
+
}
|
|
467
|
+
}, {
|
|
468
|
+
open: {
|
|
469
|
+
type: Boolean,
|
|
470
|
+
default: !1
|
|
471
|
+
},
|
|
472
|
+
openModifiers: {}
|
|
473
|
+
}),
|
|
474
|
+
emits: ["update:open"],
|
|
475
|
+
setup(t) {
|
|
476
|
+
let s = t, u = A(t, "open"), d = X(s.messages), f = n(() => K(s.audit).length), p = n(() => !s.showContext || !s.audit ? [] : [
|
|
477
|
+
{
|
|
478
|
+
label: d.contextUrl,
|
|
479
|
+
value: s.audit.url
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
label: d.contextIp,
|
|
483
|
+
value: s.audit.ip_address
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
label: d.contextUserAgent,
|
|
487
|
+
value: s.audit.user_agent
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
label: d.contextBatch,
|
|
491
|
+
value: s.audit.batch
|
|
492
|
+
}
|
|
493
|
+
].filter((e) => e.value));
|
|
494
|
+
return (n, s) => (x(), r(kt, {
|
|
495
|
+
open: u.value,
|
|
496
|
+
"onUpdate:open": s[1] ||= (e) => u.value = e,
|
|
497
|
+
width: "sm:max-w-2xl",
|
|
498
|
+
"close-label": O(d).close,
|
|
499
|
+
ui: t.ui,
|
|
500
|
+
title: t.audit ? O(Y)(O(d).changesTitle, { count: f.value }) : ""
|
|
501
|
+
}, {
|
|
502
|
+
description: N(() => [t.audit ? (x(), a("span", Mt, [
|
|
503
|
+
l(jt, {
|
|
504
|
+
event: t.audit.event,
|
|
505
|
+
messages: t.messages
|
|
506
|
+
}, null, 8, ["event", "messages"]),
|
|
507
|
+
o("span", Nt, D(t.typeLabel(t.audit.auditable_type)), 1),
|
|
508
|
+
o("span", Pt, " #" + D(t.audit.auditable_id), 1),
|
|
509
|
+
s[2] ||= o("span", { "aria-hidden": "true" }, " · ", -1),
|
|
510
|
+
o("span", null, D(t.audit.user ? O(ze)(t.audit.user, t.userLabel) : O(d).system), 1),
|
|
511
|
+
s[3] ||= o("span", { "aria-hidden": "true" }, " · ", -1),
|
|
512
|
+
o("time", {
|
|
513
|
+
datetime: t.audit.created_at,
|
|
514
|
+
class: "tabular-nums"
|
|
515
|
+
}, D(O(Ee)(t.audit.created_at)), 9, Ft)
|
|
516
|
+
])) : i("", !0)]),
|
|
517
|
+
footer: N(() => [w(n.$slots, "footer", { audit: t.audit }), l(O(Q), {
|
|
518
|
+
variant: "outline",
|
|
519
|
+
onClick: s[0] ||= (e) => u.value = !1
|
|
520
|
+
}, {
|
|
521
|
+
default: N(() => [c(D(O(d).close), 1)]),
|
|
522
|
+
_: 1
|
|
523
|
+
})]),
|
|
524
|
+
default: N(() => [t.audit ? (x(), a("div", It, [
|
|
525
|
+
l(vt, {
|
|
526
|
+
layout: "table",
|
|
527
|
+
value: t.audit,
|
|
528
|
+
ui: { table: t.ui?.changes },
|
|
529
|
+
"format-value": t.formatValue,
|
|
530
|
+
"field-label": t.fieldLabel,
|
|
531
|
+
messages: t.messages
|
|
532
|
+
}, null, 8, [
|
|
533
|
+
"value",
|
|
534
|
+
"ui",
|
|
535
|
+
"format-value",
|
|
536
|
+
"field-label",
|
|
537
|
+
"messages"
|
|
538
|
+
]),
|
|
539
|
+
p.value.length ? (x(), a("dl", {
|
|
540
|
+
key: 0,
|
|
541
|
+
"data-slot": "audit-context",
|
|
542
|
+
class: g(O(Z)("grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 rounded-item bg-muted/50 px-2.5 py-2 text-xs", t.ui?.details))
|
|
543
|
+
}, [(x(!0), a(e, null, C(p.value, (t) => (x(), a(e, { key: t.label }, [o("dt", Lt, D(t.label), 1), o("dd", Rt, D(t.value), 1)], 64))), 128))], 2)) : i("", !0),
|
|
544
|
+
w(n.$slots, "default", { audit: t.audit })
|
|
545
|
+
])) : i("", !0)]),
|
|
546
|
+
_: 3
|
|
547
|
+
}, 8, [
|
|
548
|
+
"open",
|
|
549
|
+
"close-label",
|
|
550
|
+
"ui",
|
|
551
|
+
"title"
|
|
552
|
+
]));
|
|
553
|
+
}
|
|
554
|
+
}, Bt = [
|
|
555
|
+
"aria-expanded",
|
|
556
|
+
"aria-controls",
|
|
557
|
+
"aria-label",
|
|
558
|
+
"onKeydown"
|
|
559
|
+
], Vt = {
|
|
560
|
+
key: 0,
|
|
561
|
+
class: "truncate text-muted-foreground"
|
|
562
|
+
}, Ht = { class: "truncate" }, Ut = ["aria-label", "onClick"], Wt = ["id", "data-empty"], Gt = {
|
|
563
|
+
key: 0,
|
|
564
|
+
"data-slot": "input-group",
|
|
565
|
+
role: "group",
|
|
566
|
+
class: "group/input-group cn-input-group relative flex min-w-0 items-center outline-none"
|
|
567
|
+
}, Kt = ["placeholder", "onKeydown"], qt = {
|
|
568
|
+
"data-slot": "input-group-addon",
|
|
569
|
+
"data-align": "inline-start",
|
|
570
|
+
class: "cn-input-group-addon flex cursor-text items-center justify-center select-none cn-input-group-addon-align-inline-start order-first"
|
|
571
|
+
}, Jt = ["onKeydown"], Yt = {
|
|
572
|
+
key: 0,
|
|
573
|
+
class: "flex items-center justify-center gap-2 py-2 text-sm text-muted-foreground"
|
|
574
|
+
}, Xt = [
|
|
575
|
+
"aria-selected",
|
|
576
|
+
"data-highlighted",
|
|
577
|
+
"onMousemove",
|
|
578
|
+
"onClick"
|
|
579
|
+
], Zt = { class: "cn-combobox-item-text" }, Qt = {
|
|
580
|
+
key: 0,
|
|
581
|
+
"data-slot": "combobox-item-indicator",
|
|
582
|
+
class: "cn-combobox-item-indicator"
|
|
583
|
+
}, $t = {
|
|
584
|
+
"data-slot": "combobox-empty",
|
|
585
|
+
class: "cn-combobox-empty"
|
|
586
|
+
}, en = {
|
|
587
|
+
__name: "AuditFilterSelect",
|
|
588
|
+
props: /*@__PURE__*/ p({
|
|
589
|
+
label: {
|
|
590
|
+
type: String,
|
|
591
|
+
required: !0
|
|
592
|
+
},
|
|
593
|
+
placeholder: {
|
|
594
|
+
type: String,
|
|
595
|
+
default: ""
|
|
596
|
+
},
|
|
597
|
+
options: {
|
|
598
|
+
type: Array,
|
|
599
|
+
default: () => []
|
|
600
|
+
},
|
|
601
|
+
search: {
|
|
602
|
+
type: Function,
|
|
603
|
+
default: null
|
|
604
|
+
},
|
|
605
|
+
optionKey: {
|
|
606
|
+
type: [String, Function],
|
|
607
|
+
default: "id"
|
|
608
|
+
},
|
|
609
|
+
optionLabel: {
|
|
610
|
+
type: [String, Function],
|
|
611
|
+
default: "name"
|
|
612
|
+
},
|
|
613
|
+
messages: {
|
|
614
|
+
type: Object,
|
|
615
|
+
default: null
|
|
616
|
+
},
|
|
617
|
+
ui: {
|
|
618
|
+
type: Object,
|
|
619
|
+
default: null
|
|
620
|
+
}
|
|
621
|
+
}, {
|
|
622
|
+
modelValue: {
|
|
623
|
+
type: Array,
|
|
624
|
+
default: () => []
|
|
625
|
+
},
|
|
626
|
+
modelModifiers: {}
|
|
627
|
+
}),
|
|
628
|
+
emits: ["update:modelValue"],
|
|
629
|
+
setup(t) {
|
|
630
|
+
let r = t, s = A(t, "modelValue"), u = X(r.messages), d = k(), f = S(!1), p = S(null), m = S(null), _ = S(null), b = S(null), T = S(""), j = E([]), ee = S(!1), N = S(-1), I = S(288), ie = (e, t) => typeof t == "function" ? t(e) : typeof e == "object" && e ? e[t] : e, R = (e) => String(ie(e, r.optionKey)), ae = (e) => ie(e, r.optionLabel) ?? R(e), z = n(() => !!r.search || r.options.length > 7), oe = n(() => new Set(s.value.map(R))), se = (e) => oe.value.has(R(e)), B = n(() => {
|
|
631
|
+
if (r.search) {
|
|
632
|
+
let e = new Set(j.value.map(R));
|
|
633
|
+
return [...T.value ? [] : s.value.filter((t) => !e.has(R(t))), ...j.value];
|
|
634
|
+
}
|
|
635
|
+
let e = T.value.trim().toLowerCase();
|
|
636
|
+
return e ? r.options.filter((t) => String(ae(t)).toLowerCase().includes(e)) : r.options;
|
|
637
|
+
}), V = null, ce = null;
|
|
638
|
+
async function le() {
|
|
639
|
+
V?.abort(), V = new AbortController();
|
|
640
|
+
let { signal: e } = V;
|
|
641
|
+
ee.value = !0;
|
|
642
|
+
try {
|
|
643
|
+
let t = await r.search(T.value, { signal: e });
|
|
644
|
+
e.aborted || (j.value = Array.isArray(t) ? t : []);
|
|
645
|
+
} catch {
|
|
646
|
+
e.aborted || (j.value = []);
|
|
647
|
+
} finally {
|
|
648
|
+
e.aborted || (ee.value = !1);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
M(T, () => {
|
|
652
|
+
N.value = 0, r.search && (clearTimeout(ce), ce = setTimeout(le, 250));
|
|
653
|
+
});
|
|
654
|
+
function ue(e) {
|
|
655
|
+
s.value = se(e) ? s.value.filter((t) => R(t) !== R(e)) : [...s.value, e];
|
|
656
|
+
}
|
|
657
|
+
function H(e) {
|
|
658
|
+
B.value.length && (N.value = (N.value + e + B.value.length) % B.value.length, h(() => b.value?.querySelector("[data-highlighted]")?.scrollIntoView({ block: "nearest" })));
|
|
659
|
+
}
|
|
660
|
+
function fe() {
|
|
661
|
+
let e = B.value[N.value];
|
|
662
|
+
e !== void 0 && ue(e);
|
|
663
|
+
}
|
|
664
|
+
async function pe() {
|
|
665
|
+
f.value || await U();
|
|
666
|
+
}
|
|
667
|
+
async function U() {
|
|
668
|
+
if (f.value = !f.value, !f.value) return;
|
|
669
|
+
T.value = "", N.value = 0;
|
|
670
|
+
let e = m.value?.getBoundingClientRect().bottom ?? 0;
|
|
671
|
+
I.value = Math.max(220, Math.min(288, window.innerHeight - e - 16)), r.search && le(), await h(), (_.value ?? b.value)?.focus();
|
|
672
|
+
}
|
|
673
|
+
function he(e) {
|
|
674
|
+
f.value && (e.stopPropagation(), f.value = !1, m.value?.focus());
|
|
675
|
+
}
|
|
676
|
+
function W(e) {
|
|
677
|
+
f.value && p.value && !p.value.contains(e.target) && (f.value = !1);
|
|
678
|
+
}
|
|
679
|
+
return M(f, (e) => {
|
|
680
|
+
typeof document < "u" && (e ? document.addEventListener("pointerdown", W, !0) : document.removeEventListener("pointerdown", W, !0));
|
|
681
|
+
}), y(() => {
|
|
682
|
+
V?.abort(), clearTimeout(ce), typeof document < "u" && document.removeEventListener("pointerdown", W, !0);
|
|
683
|
+
}), (n, r) => (x(), a("div", {
|
|
684
|
+
class: g(O(Z)("laravel-auditing", t.ui?.root)),
|
|
685
|
+
"data-slot": "audit-filter-select"
|
|
686
|
+
}, [o("div", {
|
|
687
|
+
ref_key: "root",
|
|
688
|
+
ref: p,
|
|
689
|
+
class: "relative w-full",
|
|
690
|
+
onKeydown: P(he, ["esc"])
|
|
691
|
+
}, [o("div", {
|
|
692
|
+
ref_key: "trigger",
|
|
693
|
+
ref: m,
|
|
694
|
+
role: "combobox",
|
|
695
|
+
tabindex: "0",
|
|
696
|
+
"aria-expanded": f.value,
|
|
697
|
+
"aria-controls": O(d),
|
|
698
|
+
"aria-label": t.label,
|
|
699
|
+
"data-slot": "combobox-chips",
|
|
700
|
+
class: g(O(Z)("cn-combobox-chips cursor-pointer pr-8", t.ui?.trigger)),
|
|
701
|
+
onClick: U,
|
|
702
|
+
onKeydown: [
|
|
703
|
+
P(F(U, ["prevent"]), ["enter"]),
|
|
704
|
+
P(F(U, ["prevent"]), ["space"]),
|
|
705
|
+
P(F(pe, ["prevent"]), ["down"])
|
|
706
|
+
]
|
|
707
|
+
}, [
|
|
708
|
+
s.value.length ? i("", !0) : (x(), a("span", Vt, D(t.placeholder || O(u).allPlaceholder), 1)),
|
|
709
|
+
(x(!0), a(e, null, C(s.value, (e) => (x(), a("span", {
|
|
710
|
+
key: R(e),
|
|
711
|
+
"data-slot": "combobox-chip",
|
|
712
|
+
class: "cn-combobox-chip max-w-48"
|
|
713
|
+
}, [o("span", Ht, D(ae(e)), 1), o("button", {
|
|
714
|
+
type: "button",
|
|
715
|
+
"data-slot": "combobox-chip-remove",
|
|
716
|
+
class: "cn-combobox-chip-remove inline-flex size-4 items-center justify-center rounded-item focus-ring",
|
|
717
|
+
"aria-label": O(Y)(O(u).removeFilter, { filter: ae(e) }),
|
|
718
|
+
onClick: F((t) => ue(e), ["stop"])
|
|
719
|
+
}, [l(O(ye), {
|
|
720
|
+
class: "size-3",
|
|
721
|
+
"aria-hidden": "true"
|
|
722
|
+
})], 8, Ut)]))), 128)),
|
|
723
|
+
l(O(re), {
|
|
724
|
+
class: "cn-combobox-trigger-icon pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2",
|
|
725
|
+
"aria-hidden": "true"
|
|
726
|
+
})
|
|
727
|
+
], 42, Bt), f.value ? (x(), a("div", {
|
|
728
|
+
key: 0,
|
|
729
|
+
id: O(d),
|
|
730
|
+
"data-slot": "combobox-content",
|
|
731
|
+
"data-state": "open",
|
|
732
|
+
"data-side": "bottom",
|
|
733
|
+
"data-empty": !ee.value && !B.value.length ? "" : void 0,
|
|
734
|
+
style: v({ "--available-height": `${I.value}px` }),
|
|
735
|
+
class: g(O(Z)("cn-combobox-content cn-menu-target group/combobox-content absolute top-full left-0 z-50 mt-1 w-full", t.ui?.content))
|
|
736
|
+
}, [
|
|
737
|
+
z.value ? (x(), a("div", Gt, [ne(o("input", {
|
|
738
|
+
ref_key: "searchInput",
|
|
739
|
+
ref: _,
|
|
740
|
+
"onUpdate:modelValue": r[0] ||= (e) => T.value = e,
|
|
741
|
+
type: "text",
|
|
742
|
+
"data-slot": "input-group-control",
|
|
743
|
+
placeholder: O(u).selectSearch,
|
|
744
|
+
class: g(["cn-input-group-input flex-1", [O(Je)]]),
|
|
745
|
+
onKeydown: [
|
|
746
|
+
r[1] ||= P(F((e) => H(1), ["prevent"]), ["down"]),
|
|
747
|
+
r[2] ||= P(F((e) => H(-1), ["prevent"]), ["up"]),
|
|
748
|
+
P(F(fe, ["prevent"]), ["enter"])
|
|
749
|
+
]
|
|
750
|
+
}, null, 42, Kt), [[te, T.value]]), o("div", qt, [l(O(me), { "aria-hidden": "true" })])])) : i("", !0),
|
|
751
|
+
o("div", {
|
|
752
|
+
ref_key: "list",
|
|
753
|
+
ref: b,
|
|
754
|
+
role: "listbox",
|
|
755
|
+
"aria-multiselectable": "true",
|
|
756
|
+
tabindex: "-1",
|
|
757
|
+
"data-slot": "combobox-list",
|
|
758
|
+
class: "cn-combobox-list outline-none",
|
|
759
|
+
onKeydown: [
|
|
760
|
+
r[3] ||= P(F((e) => H(1), ["prevent"]), ["down"]),
|
|
761
|
+
r[4] ||= P(F((e) => H(-1), ["prevent"]), ["up"]),
|
|
762
|
+
P(F(fe, ["prevent"]), ["enter"]),
|
|
763
|
+
P(F(fe, ["prevent"]), ["space"])
|
|
764
|
+
]
|
|
765
|
+
}, [ee.value ? (x(), a("div", Yt, [l(O(de), {
|
|
766
|
+
class: "size-4 animate-spin motion-reduce:animate-none",
|
|
767
|
+
"aria-hidden": "true"
|
|
768
|
+
}), c(" " + D(O(u).selectLoading), 1)])) : (x(!0), a(e, { key: 1 }, C(B.value, (e, r) => (x(), a("div", {
|
|
769
|
+
key: R(e),
|
|
770
|
+
role: "option",
|
|
771
|
+
"data-slot": "combobox-item",
|
|
772
|
+
"aria-selected": se(e),
|
|
773
|
+
"data-highlighted": r === N.value ? "" : void 0,
|
|
774
|
+
class: g(O(Z)("cn-combobox-item relative flex w-full cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0", t.ui?.item)),
|
|
775
|
+
onMousemove: (e) => N.value = r,
|
|
776
|
+
onClick: (t) => ue(e)
|
|
777
|
+
}, [o("span", Zt, [w(n.$slots, "option", {
|
|
778
|
+
option: e,
|
|
779
|
+
label: ae(e)
|
|
780
|
+
}, () => [c(D(ae(e)), 1)])]), se(e) ? (x(), a("span", Qt, [l(O(L), { "aria-hidden": "true" })])) : i("", !0)], 42, Xt))), 128))], 40, Jt),
|
|
781
|
+
o("div", $t, D(O(u).selectEmpty), 1)
|
|
782
|
+
], 14, Wt)) : i("", !0)], 544)], 2));
|
|
783
|
+
}
|
|
784
|
+
}, tn = {
|
|
785
|
+
class: "laravel-auditing",
|
|
786
|
+
"data-slot": "audit-filters"
|
|
787
|
+
}, nn = ["for"], rn = ["id", "placeholder"], an = { class: "flex min-w-0 flex-col" }, on = { class: "truncate" }, sn = {
|
|
788
|
+
key: 0,
|
|
789
|
+
class: "truncate text-xs text-muted-foreground"
|
|
790
|
+
}, cn = { class: "grid grid-cols-2 gap-2" }, ln = { class: "grid gap-1.5" }, un = { class: "text-xs text-muted-foreground" }, dn = ["max"], fn = { class: "grid gap-1.5" }, pn = { class: "text-xs text-muted-foreground" }, mn = ["min"], hn = {
|
|
791
|
+
__name: "AuditFilters",
|
|
792
|
+
props: /*@__PURE__*/ p({
|
|
793
|
+
events: {
|
|
794
|
+
type: Array,
|
|
795
|
+
default: () => be.map((e) => e.code)
|
|
796
|
+
},
|
|
797
|
+
searchUsers: {
|
|
798
|
+
type: Function,
|
|
799
|
+
default: null
|
|
800
|
+
},
|
|
801
|
+
searchResources: {
|
|
802
|
+
type: Function,
|
|
803
|
+
default: null
|
|
804
|
+
},
|
|
805
|
+
resources: {
|
|
806
|
+
type: Array,
|
|
807
|
+
default: () => []
|
|
808
|
+
},
|
|
809
|
+
userLabel: {
|
|
810
|
+
type: [String, Function],
|
|
811
|
+
default: "name"
|
|
812
|
+
},
|
|
813
|
+
typeLabel: {
|
|
814
|
+
type: Function,
|
|
815
|
+
default: Fe
|
|
816
|
+
},
|
|
817
|
+
showSearch: {
|
|
818
|
+
type: Boolean,
|
|
819
|
+
default: !1
|
|
820
|
+
},
|
|
821
|
+
messages: {
|
|
822
|
+
type: Object,
|
|
823
|
+
default: null
|
|
824
|
+
}
|
|
825
|
+
}, {
|
|
826
|
+
modelValue: {
|
|
827
|
+
type: Object,
|
|
828
|
+
required: !0
|
|
829
|
+
},
|
|
830
|
+
modelModifiers: {}
|
|
831
|
+
}),
|
|
832
|
+
emits: ["update:modelValue"],
|
|
833
|
+
setup(e) {
|
|
834
|
+
let t = e, n = A(e, "modelValue"), r = X(t.messages), s = { search: k() };
|
|
835
|
+
return (t, c) => (x(), a("div", tn, [o("div", {
|
|
836
|
+
"data-slot": "field-group",
|
|
837
|
+
class: g(O(Ze))
|
|
838
|
+
}, [
|
|
839
|
+
e.showSearch ? (x(), a("div", {
|
|
840
|
+
key: 0,
|
|
841
|
+
role: "group",
|
|
842
|
+
"data-slot": "field",
|
|
843
|
+
"data-orientation": "vertical",
|
|
844
|
+
class: g(O(Xe))
|
|
845
|
+
}, [o("label", {
|
|
846
|
+
for: s.search,
|
|
847
|
+
"data-slot": "field-label",
|
|
848
|
+
class: g(O(Qe))
|
|
849
|
+
}, D(O(r).filterSearch), 11, nn), ne(o("input", {
|
|
850
|
+
id: s.search,
|
|
851
|
+
"onUpdate:modelValue": c[0] ||= (e) => n.value.search = e,
|
|
852
|
+
type: "search",
|
|
853
|
+
"data-slot": "input",
|
|
854
|
+
class: g(O(Je)),
|
|
855
|
+
placeholder: O(r).searchPlaceholder
|
|
856
|
+
}, null, 10, rn), [[te, n.value.search]])], 2)) : i("", !0),
|
|
857
|
+
o("div", {
|
|
858
|
+
role: "group",
|
|
859
|
+
"data-slot": "field",
|
|
860
|
+
"data-orientation": "vertical",
|
|
861
|
+
class: g(O(Xe))
|
|
862
|
+
}, [o("span", {
|
|
863
|
+
"data-slot": "field-label",
|
|
864
|
+
class: g(O(Qe))
|
|
865
|
+
}, D(O(r).filterEvent), 3), l(en, {
|
|
866
|
+
modelValue: n.value.event,
|
|
867
|
+
"onUpdate:modelValue": c[1] ||= (e) => n.value.event = e,
|
|
868
|
+
label: O(r).filterEvent,
|
|
869
|
+
options: e.events,
|
|
870
|
+
"option-key": (e) => e,
|
|
871
|
+
"option-label": (e) => O(J)(O(r), e),
|
|
872
|
+
messages: e.messages
|
|
873
|
+
}, {
|
|
874
|
+
option: N(({ option: t }) => [l(jt, {
|
|
875
|
+
event: t,
|
|
876
|
+
messages: e.messages
|
|
877
|
+
}, null, 8, ["event", "messages"])]),
|
|
878
|
+
_: 1
|
|
879
|
+
}, 8, [
|
|
880
|
+
"modelValue",
|
|
881
|
+
"label",
|
|
882
|
+
"options",
|
|
883
|
+
"option-key",
|
|
884
|
+
"option-label",
|
|
885
|
+
"messages"
|
|
886
|
+
])], 2),
|
|
887
|
+
e.searchUsers ? (x(), a("div", {
|
|
888
|
+
key: 1,
|
|
889
|
+
role: "group",
|
|
890
|
+
"data-slot": "field",
|
|
891
|
+
"data-orientation": "vertical",
|
|
892
|
+
class: g(O(Xe))
|
|
893
|
+
}, [o("span", {
|
|
894
|
+
"data-slot": "field-label",
|
|
895
|
+
class: g(O(Qe))
|
|
896
|
+
}, D(O(r).filterUser), 3), l(en, {
|
|
897
|
+
modelValue: n.value.user,
|
|
898
|
+
"onUpdate:modelValue": c[2] ||= (e) => n.value.user = e,
|
|
899
|
+
label: O(r).filterUser,
|
|
900
|
+
search: e.searchUsers,
|
|
901
|
+
"option-label": (t) => O(ze)(t, e.userLabel),
|
|
902
|
+
messages: e.messages
|
|
903
|
+
}, null, 8, [
|
|
904
|
+
"modelValue",
|
|
905
|
+
"label",
|
|
906
|
+
"search",
|
|
907
|
+
"option-label",
|
|
908
|
+
"messages"
|
|
909
|
+
])], 2)) : i("", !0),
|
|
910
|
+
e.searchResources || e.resources.length ? (x(), a("div", {
|
|
911
|
+
key: 2,
|
|
912
|
+
role: "group",
|
|
913
|
+
"data-slot": "field",
|
|
914
|
+
"data-orientation": "vertical",
|
|
915
|
+
class: g(O(Xe))
|
|
916
|
+
}, [o("span", {
|
|
917
|
+
"data-slot": "field-label",
|
|
918
|
+
class: g(O(Qe))
|
|
919
|
+
}, D(O(r).filterResource), 3), l(en, {
|
|
920
|
+
modelValue: n.value.auditable_type,
|
|
921
|
+
"onUpdate:modelValue": c[3] ||= (e) => n.value.auditable_type = e,
|
|
922
|
+
label: O(r).filterResource,
|
|
923
|
+
search: e.searchResources,
|
|
924
|
+
options: e.resources,
|
|
925
|
+
"option-key": (e) => e,
|
|
926
|
+
"option-label": e.typeLabel,
|
|
927
|
+
messages: e.messages
|
|
928
|
+
}, {
|
|
929
|
+
option: N(({ option: t }) => [o("span", an, [o("span", on, D(e.typeLabel(t)), 1), e.typeLabel(t) === t ? i("", !0) : (x(), a("span", sn, D(t), 1))])]),
|
|
930
|
+
_: 1
|
|
931
|
+
}, 8, [
|
|
932
|
+
"modelValue",
|
|
933
|
+
"label",
|
|
934
|
+
"search",
|
|
935
|
+
"options",
|
|
936
|
+
"option-key",
|
|
937
|
+
"option-label",
|
|
938
|
+
"messages"
|
|
939
|
+
])], 2)) : i("", !0),
|
|
940
|
+
o("div", {
|
|
941
|
+
role: "group",
|
|
942
|
+
"data-slot": "field",
|
|
943
|
+
"data-orientation": "vertical",
|
|
944
|
+
class: g(O(Xe))
|
|
945
|
+
}, [o("span", {
|
|
946
|
+
"data-slot": "field-label",
|
|
947
|
+
class: g(O(Qe))
|
|
948
|
+
}, D(O(r).filterPeriod), 3), o("div", cn, [o("label", ln, [o("span", un, D(O(r).filterFrom), 1), ne(o("input", {
|
|
949
|
+
"onUpdate:modelValue": c[4] ||= (e) => n.value.start_date = e,
|
|
950
|
+
type: "date",
|
|
951
|
+
"data-slot": "input",
|
|
952
|
+
class: g(O(Je)),
|
|
953
|
+
max: n.value.end_date || void 0
|
|
954
|
+
}, null, 10, dn), [[te, n.value.start_date]])]), o("label", fn, [o("span", pn, D(O(r).filterTo), 1), ne(o("input", {
|
|
955
|
+
"onUpdate:modelValue": c[5] ||= (e) => n.value.end_date = e,
|
|
956
|
+
type: "date",
|
|
957
|
+
"data-slot": "input",
|
|
958
|
+
class: g(O(Je)),
|
|
959
|
+
min: n.value.start_date || void 0
|
|
960
|
+
}, null, 10, mn), [[te, n.value.end_date]])])])], 2)
|
|
961
|
+
], 2)]));
|
|
962
|
+
}
|
|
963
|
+
}, gn = ["aria-busy"], _n = {
|
|
964
|
+
__name: "UiLoadingBlur",
|
|
965
|
+
props: {
|
|
966
|
+
loading: {
|
|
967
|
+
type: Boolean,
|
|
968
|
+
default: !1
|
|
969
|
+
},
|
|
970
|
+
label: {
|
|
971
|
+
type: String,
|
|
972
|
+
default: ""
|
|
973
|
+
},
|
|
974
|
+
ui: {
|
|
975
|
+
type: Object,
|
|
976
|
+
default: null
|
|
977
|
+
}
|
|
978
|
+
},
|
|
979
|
+
setup(e) {
|
|
980
|
+
return (t, n) => (x(), a("div", {
|
|
981
|
+
"data-slot": "loading-blur",
|
|
982
|
+
class: g(O(Z)("relative", e.ui?.root))
|
|
983
|
+
}, [e.loading ? (x(), a("div", {
|
|
984
|
+
key: 0,
|
|
985
|
+
role: "status",
|
|
986
|
+
class: g(O(Z)("pointer-events-none absolute top-[min(22%,--spacing(21))] left-1/2 z-10 inline-flex -translate-x-1/2 animate-in items-center gap-2 rounded-full bg-foreground px-3.5 py-2 text-sm font-medium whitespace-nowrap text-background shadow-lg duration-300 fade-in slide-in-from-top-2 motion-reduce:animate-none", e.ui?.label))
|
|
987
|
+
}, [l(O(de), {
|
|
988
|
+
class: "size-4 animate-spin opacity-85 motion-reduce:animate-none",
|
|
989
|
+
"aria-hidden": "true"
|
|
990
|
+
}), c(" " + D(e.label), 1)], 2)) : i("", !0), o("div", {
|
|
991
|
+
class: g(O(Z)("transition-[opacity,filter] duration-200 motion-reduce:transition-none", e.loading && "pointer-events-none opacity-55 blur-2xs", e.ui?.content)),
|
|
992
|
+
"aria-busy": e.loading
|
|
993
|
+
}, [w(t.$slots, "default")], 10, gn)], 2));
|
|
994
|
+
}
|
|
995
|
+
}, vn = { class: "flex min-w-0 flex-wrap items-center gap-2" }, yn = {
|
|
996
|
+
"data-slot": "card-title",
|
|
997
|
+
class: "cn-card-title cn-font-heading"
|
|
998
|
+
}, bn = {
|
|
999
|
+
key: 0,
|
|
1000
|
+
"data-slot": "card-description",
|
|
1001
|
+
class: "cn-card-description"
|
|
1002
|
+
}, xn = {
|
|
1003
|
+
key: 1,
|
|
1004
|
+
"data-slot": "card-action",
|
|
1005
|
+
class: "cn-card-action col-start-2 row-span-2 row-start-1 flex items-center gap-2 self-start justify-self-end"
|
|
1006
|
+
}, Sn = {
|
|
1007
|
+
key: 1,
|
|
1008
|
+
class: "flex items-center justify-end gap-2"
|
|
1009
|
+
}, Cn = ["data-slot"], wn = ["aria-label"], Tn = {
|
|
1010
|
+
key: 1,
|
|
1011
|
+
role: "alert",
|
|
1012
|
+
class: "flex flex-col items-center gap-2 px-5 py-10 text-center text-muted-foreground"
|
|
1013
|
+
}, En = { class: "text-sm font-semibold text-foreground" }, Dn = {
|
|
1014
|
+
"data-slot": "empty",
|
|
1015
|
+
class: "cn-empty flex w-full min-w-0 flex-1 flex-col items-center justify-center text-center text-balance"
|
|
1016
|
+
}, On = {
|
|
1017
|
+
"data-slot": "empty-header",
|
|
1018
|
+
class: "cn-empty-header flex max-w-sm flex-col items-center"
|
|
1019
|
+
}, kn = {
|
|
1020
|
+
"data-slot": "empty-icon",
|
|
1021
|
+
class: "cn-empty-media flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0 cn-empty-media-icon"
|
|
1022
|
+
}, An = {
|
|
1023
|
+
"data-slot": "empty-title",
|
|
1024
|
+
class: "cn-empty-title cn-font-heading"
|
|
1025
|
+
}, jn = {
|
|
1026
|
+
key: 3,
|
|
1027
|
+
"data-slot": "timeline",
|
|
1028
|
+
class: "app-timeline flex min-w-0 flex-col text-sm"
|
|
1029
|
+
}, Mn = ["data-tone", "aria-current"], Nn = { class: "flex flex-col items-center" }, Pn = {
|
|
1030
|
+
key: 0,
|
|
1031
|
+
"data-slot": "timeline-line",
|
|
1032
|
+
class: "my-2 w-px flex-1 bg-border"
|
|
1033
|
+
}, Fn = { class: "flex flex-wrap items-baseline justify-between gap-x-3 gap-y-0.5" }, In = { class: "flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1" }, Ln = { class: "text-base font-semibold text-foreground" }, Rn = {
|
|
1034
|
+
key: 0,
|
|
1035
|
+
class: "text-muted-foreground"
|
|
1036
|
+
}, zn = ["title"], Bn = { class: "tabular-nums" }, Vn = {
|
|
1037
|
+
"data-slot": "timeline-meta",
|
|
1038
|
+
class: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-muted-foreground"
|
|
1039
|
+
}, Hn = {
|
|
1040
|
+
"data-slot": "avatar",
|
|
1041
|
+
class: "flex size-6 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted text-muted-foreground",
|
|
1042
|
+
"aria-hidden": "true"
|
|
1043
|
+
}, Un = ["src", "onError"], Wn = ["datetime"], Gn = {
|
|
1044
|
+
key: 0,
|
|
1045
|
+
class: "flex flex-wrap items-center gap-2"
|
|
1046
|
+
}, Kn = {
|
|
1047
|
+
__name: "AuditTimeline",
|
|
1048
|
+
props: {
|
|
1049
|
+
audits: {
|
|
1050
|
+
type: Array,
|
|
1051
|
+
default: () => []
|
|
1052
|
+
},
|
|
1053
|
+
loading: {
|
|
1054
|
+
type: Boolean,
|
|
1055
|
+
default: !1
|
|
1056
|
+
},
|
|
1057
|
+
error: {
|
|
1058
|
+
type: [Boolean, String],
|
|
1059
|
+
default: !1
|
|
1060
|
+
},
|
|
1061
|
+
retry: {
|
|
1062
|
+
type: Function,
|
|
1063
|
+
default: null
|
|
1064
|
+
},
|
|
1065
|
+
highlight: {
|
|
1066
|
+
type: [String, Number],
|
|
1067
|
+
default: null
|
|
1068
|
+
},
|
|
1069
|
+
groupBatches: {
|
|
1070
|
+
type: Boolean,
|
|
1071
|
+
default: !0
|
|
1072
|
+
},
|
|
1073
|
+
showResource: {
|
|
1074
|
+
type: Boolean,
|
|
1075
|
+
default: !0
|
|
1076
|
+
},
|
|
1077
|
+
bare: {
|
|
1078
|
+
type: Boolean,
|
|
1079
|
+
default: !1
|
|
1080
|
+
},
|
|
1081
|
+
changesLimit: {
|
|
1082
|
+
type: Number,
|
|
1083
|
+
default: null
|
|
1084
|
+
},
|
|
1085
|
+
typeLabel: {
|
|
1086
|
+
type: Function,
|
|
1087
|
+
default: Fe
|
|
1088
|
+
},
|
|
1089
|
+
userLabel: {
|
|
1090
|
+
type: [String, Function],
|
|
1091
|
+
default: "name"
|
|
1092
|
+
},
|
|
1093
|
+
userAvatar: {
|
|
1094
|
+
type: Function,
|
|
1095
|
+
default: null
|
|
1096
|
+
},
|
|
1097
|
+
formatValue: {
|
|
1098
|
+
type: Function,
|
|
1099
|
+
default: De
|
|
1100
|
+
},
|
|
1101
|
+
fieldLabel: {
|
|
1102
|
+
type: Function,
|
|
1103
|
+
default: (e) => e
|
|
1104
|
+
},
|
|
1105
|
+
title: {
|
|
1106
|
+
type: String,
|
|
1107
|
+
default: null
|
|
1108
|
+
},
|
|
1109
|
+
description: {
|
|
1110
|
+
type: String,
|
|
1111
|
+
default: null
|
|
1112
|
+
},
|
|
1113
|
+
subject: {
|
|
1114
|
+
type: String,
|
|
1115
|
+
default: null
|
|
1116
|
+
},
|
|
1117
|
+
messages: {
|
|
1118
|
+
type: Object,
|
|
1119
|
+
default: null
|
|
1120
|
+
},
|
|
1121
|
+
ui: {
|
|
1122
|
+
type: Object,
|
|
1123
|
+
default: null
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
1126
|
+
emits: ["expand"],
|
|
1127
|
+
setup(t, { emit: u }) {
|
|
1128
|
+
let d = t, f = u, p = X(d.messages), _ = n(() => {
|
|
1129
|
+
let e = /* @__PURE__ */ new Map();
|
|
1130
|
+
if (d.groupBatches) for (let t of Oe(d.audits)) t.audits.length > 1 && e.set(t.audits[0].id, t.audits.length);
|
|
1131
|
+
return d.audits.map((t) => ({
|
|
1132
|
+
audit: t,
|
|
1133
|
+
meta: Se(t.event),
|
|
1134
|
+
batchSize: e.get(t.id) ?? 0,
|
|
1135
|
+
fieldCount: (/* @__PURE__ */ new Set([...Object.keys(t.old_values ?? {}), ...Object.keys(t.new_values ?? {})])).size,
|
|
1136
|
+
selected: d.highlight !== null && String(t.id) === String(d.highlight)
|
|
1137
|
+
}));
|
|
1138
|
+
}), v = E(/* @__PURE__ */ new Set());
|
|
1139
|
+
function y(e) {
|
|
1140
|
+
v.value = new Set(v.value).add(e.id), f("expand", e);
|
|
1141
|
+
}
|
|
1142
|
+
let b = (e) => e.user ? ze(e.user, d.userLabel) : p.system, S = E(/* @__PURE__ */ new Set());
|
|
1143
|
+
function k(e) {
|
|
1144
|
+
let t = d.userAvatar?.(e.user) ?? null;
|
|
1145
|
+
return t && !S.value.has(t) ? t : null;
|
|
1146
|
+
}
|
|
1147
|
+
function A(e) {
|
|
1148
|
+
S.value = new Set(S.value).add(e);
|
|
1149
|
+
}
|
|
1150
|
+
let j = /* @__PURE__ */ new Map();
|
|
1151
|
+
function ee(e, t) {
|
|
1152
|
+
t ? j.set(String(e.id), t) : j.delete(String(e.id));
|
|
1153
|
+
}
|
|
1154
|
+
return M(() => [d.highlight, d.audits.length], async () => {
|
|
1155
|
+
d.highlight !== null && (await h(), j.get(String(d.highlight))?.scrollIntoView?.({
|
|
1156
|
+
block: "center",
|
|
1157
|
+
behavior: "smooth"
|
|
1158
|
+
}));
|
|
1159
|
+
}, { immediate: !0 }), (n, u) => (x(), a("div", {
|
|
1160
|
+
class: g(O(Z)("laravel-auditing", t.ui?.root)),
|
|
1161
|
+
"data-slot": "audit-timeline"
|
|
1162
|
+
}, [(x(), r(T(t.bare ? "div" : "section"), {
|
|
1163
|
+
"data-slot": t.bare ? void 0 : "card",
|
|
1164
|
+
class: g(O(Z)(t.bare ? "flex flex-col gap-4" : "cn-card group/card flex flex-col", t.ui?.card))
|
|
1165
|
+
}, {
|
|
1166
|
+
default: N(() => [t.bare ? n.$slots.actions ? (x(), a("div", Sn, [w(n.$slots, "actions")])) : i("", !0) : (x(), a("div", {
|
|
1167
|
+
key: 0,
|
|
1168
|
+
"data-slot": "card-header",
|
|
1169
|
+
class: g(O(Z)("cn-card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]", t.ui?.header))
|
|
1170
|
+
}, [
|
|
1171
|
+
o("div", vn, [o("h2", yn, D(t.title ?? O(p).historyTitle), 1), t.subject ? (x(), r(O($), {
|
|
1172
|
+
key: 0,
|
|
1173
|
+
variant: "secondary"
|
|
1174
|
+
}, {
|
|
1175
|
+
default: N(() => [c(D(t.subject), 1)]),
|
|
1176
|
+
_: 1
|
|
1177
|
+
})) : i("", !0)]),
|
|
1178
|
+
t.description ?? O(p).historyDescription ? (x(), a("p", bn, D(t.description ?? O(p).historyDescription), 1)) : i("", !0),
|
|
1179
|
+
n.$slots.actions ? (x(), a("div", xn, [w(n.$slots, "actions")])) : i("", !0)
|
|
1180
|
+
], 2)), o("div", {
|
|
1181
|
+
"data-slot": t.bare ? void 0 : "card-content",
|
|
1182
|
+
class: g(O(Z)(!t.bare && "cn-card-content", t.ui?.content))
|
|
1183
|
+
}, [l(_n, {
|
|
1184
|
+
loading: t.loading && t.audits.length > 0,
|
|
1185
|
+
label: O(p).loading
|
|
1186
|
+
}, {
|
|
1187
|
+
default: N(() => [t.loading && !t.audits.length ? (x(), a("ol", {
|
|
1188
|
+
key: 0,
|
|
1189
|
+
class: "flex flex-col gap-5",
|
|
1190
|
+
"aria-label": O(p).loading
|
|
1191
|
+
}, [(x(), a(e, null, C(3, (e) => o("li", {
|
|
1192
|
+
key: e,
|
|
1193
|
+
class: "flex gap-3"
|
|
1194
|
+
}, [...u[0] ||= [o("div", {
|
|
1195
|
+
"data-slot": "skeleton",
|
|
1196
|
+
class: "cn-skeleton animate-pulse size-8 shrink-0 rounded-full"
|
|
1197
|
+
}, null, -1), o("div", { class: "flex flex-1 flex-col gap-2 pt-1" }, [
|
|
1198
|
+
o("div", {
|
|
1199
|
+
"data-slot": "skeleton",
|
|
1200
|
+
class: "cn-skeleton animate-pulse h-4 w-48"
|
|
1201
|
+
}),
|
|
1202
|
+
o("div", {
|
|
1203
|
+
"data-slot": "skeleton",
|
|
1204
|
+
class: "cn-skeleton animate-pulse h-3 w-28"
|
|
1205
|
+
}),
|
|
1206
|
+
o("div", {
|
|
1207
|
+
"data-slot": "skeleton",
|
|
1208
|
+
class: "cn-skeleton animate-pulse h-12 w-full"
|
|
1209
|
+
})
|
|
1210
|
+
], -1)]])), 64))], 8, wn)) : t.error ? (x(), a("div", Tn, [
|
|
1211
|
+
l(O(ae), {
|
|
1212
|
+
class: "size-7 text-destructive",
|
|
1213
|
+
"aria-hidden": "true"
|
|
1214
|
+
}),
|
|
1215
|
+
o("b", En, D(typeof t.error == "string" ? t.error : O(p).loadFailed), 1),
|
|
1216
|
+
t.retry ? (x(), r(O(Q), {
|
|
1217
|
+
key: 0,
|
|
1218
|
+
variant: "outline",
|
|
1219
|
+
size: "sm",
|
|
1220
|
+
onClick: t.retry
|
|
1221
|
+
}, {
|
|
1222
|
+
default: N(() => [l(O(U), {
|
|
1223
|
+
"data-icon": "inline-start",
|
|
1224
|
+
"aria-hidden": "true"
|
|
1225
|
+
}), c(" " + D(O(p).retry), 1)]),
|
|
1226
|
+
_: 1
|
|
1227
|
+
}, 8, ["onClick"])) : i("", !0)
|
|
1228
|
+
])) : t.audits.length ? (x(), a("ol", jn, [(x(!0), a(e, null, C(_.value, (e, d) => (x(), a("li", {
|
|
1229
|
+
key: e.audit.id,
|
|
1230
|
+
ref_for: !0,
|
|
1231
|
+
ref: (t) => ee(e.audit, t),
|
|
1232
|
+
"data-slot": "timeline-item",
|
|
1233
|
+
"data-tone": e.meta.tone,
|
|
1234
|
+
"aria-current": e.selected ? "true" : void 0,
|
|
1235
|
+
class: g(O(Z)("flex break-inside-avoid gap-3", t.ui?.item))
|
|
1236
|
+
}, [o("div", Nn, [o("span", {
|
|
1237
|
+
"data-slot": "timeline-marker",
|
|
1238
|
+
class: g(O(Z)("flex size-8 shrink-0 items-center justify-center rounded-full", O(tt)[e.meta.tone], e.selected && "ring-2 ring-ring/60 ring-offset-2 ring-offset-background", t.ui?.marker))
|
|
1239
|
+
}, [(x(), r(T(O(Ge)(e.meta.glyph)), {
|
|
1240
|
+
class: "size-4",
|
|
1241
|
+
"aria-hidden": "true"
|
|
1242
|
+
}))], 2), d < _.value.length - 1 ? (x(), a("span", Pn)) : i("", !0)]), o("div", {
|
|
1243
|
+
"data-slot": "timeline-content",
|
|
1244
|
+
class: g(["flex min-w-0 flex-1 flex-col gap-3 pb-8", [d === _.value.length - 1 && "pb-0"]])
|
|
1245
|
+
}, [
|
|
1246
|
+
o("div", Fn, [o("div", In, [
|
|
1247
|
+
o("span", Ln, D(O(J)(O(p), e.audit.event)), 1),
|
|
1248
|
+
e.fieldCount ? (x(), a("span", Rn, D(e.fieldCount === 1 ? O(p).fieldCountOne : O(Y)(O(p).fieldCount, { count: e.fieldCount })), 1)) : i("", !0),
|
|
1249
|
+
t.showResource ? (x(), a("span", {
|
|
1250
|
+
key: 1,
|
|
1251
|
+
class: "font-normal text-muted-foreground",
|
|
1252
|
+
title: e.audit.auditable_type
|
|
1253
|
+
}, [c(D(t.typeLabel(e.audit.auditable_type)) + " ", 1), o("span", Bn, " #" + D(e.audit.auditable_id), 1)], 8, zn)) : i("", !0),
|
|
1254
|
+
e.batchSize > 1 ? (x(), r(O($), {
|
|
1255
|
+
key: 2,
|
|
1256
|
+
variant: "outline",
|
|
1257
|
+
title: e.audit.batch
|
|
1258
|
+
}, {
|
|
1259
|
+
default: N(() => [l(O(le), {
|
|
1260
|
+
"data-icon": "inline-start",
|
|
1261
|
+
"aria-hidden": "true"
|
|
1262
|
+
}), c(" " + D(O(Y)(O(p).sameBatch, { count: e.batchSize })), 1)]),
|
|
1263
|
+
_: 2
|
|
1264
|
+
}, 1032, ["title"])) : i("", !0),
|
|
1265
|
+
e.selected ? (x(), r(O($), {
|
|
1266
|
+
key: 3,
|
|
1267
|
+
variant: "secondary"
|
|
1268
|
+
}, {
|
|
1269
|
+
default: N(() => [l(O(W), {
|
|
1270
|
+
"data-icon": "inline-start",
|
|
1271
|
+
"aria-hidden": "true"
|
|
1272
|
+
}), c(" " + D(O(p).selectedRecord), 1)]),
|
|
1273
|
+
_: 1
|
|
1274
|
+
})) : i("", !0)
|
|
1275
|
+
])]),
|
|
1276
|
+
o("div", Vn, [
|
|
1277
|
+
o("span", Hn, [e.audit.user ? k(e.audit) ? (x(), a("img", {
|
|
1278
|
+
key: 1,
|
|
1279
|
+
src: k(e.audit),
|
|
1280
|
+
alt: "",
|
|
1281
|
+
loading: "lazy",
|
|
1282
|
+
draggable: "false",
|
|
1283
|
+
class: "size-full object-cover object-top",
|
|
1284
|
+
onError: (t) => A(k(e.audit))
|
|
1285
|
+
}, null, 40, Un)) : (x(), r(O(ve), {
|
|
1286
|
+
key: 2,
|
|
1287
|
+
class: "size-3.5"
|
|
1288
|
+
})) : (x(), r(O(se), {
|
|
1289
|
+
key: 0,
|
|
1290
|
+
class: "size-3"
|
|
1291
|
+
}))]),
|
|
1292
|
+
o("span", { class: g(["truncate", [e.audit.user && "text-foreground/80"]]) }, D(b(e.audit)), 3),
|
|
1293
|
+
u[1] ||= o("span", { "aria-hidden": "true" }, " · ", -1),
|
|
1294
|
+
o("time", {
|
|
1295
|
+
datetime: e.audit.created_at,
|
|
1296
|
+
class: "font-mono text-xs tabular-nums"
|
|
1297
|
+
}, D(O(Ee)(e.audit.created_at)), 9, Wn)
|
|
1298
|
+
]),
|
|
1299
|
+
l(vt, {
|
|
1300
|
+
value: e.audit,
|
|
1301
|
+
limit: v.value.has(e.audit.id) ? null : t.changesLimit,
|
|
1302
|
+
"format-value": t.formatValue,
|
|
1303
|
+
"field-label": t.fieldLabel,
|
|
1304
|
+
messages: t.messages,
|
|
1305
|
+
onExpand: y
|
|
1306
|
+
}, s({ _: 2 }, [n.$slots["change-value"] ? {
|
|
1307
|
+
name: "value",
|
|
1308
|
+
fn: N((e) => [w(n.$slots, "change-value", m({ ref_for: !0 }, e))]),
|
|
1309
|
+
key: "0"
|
|
1310
|
+
} : void 0]), 1032, [
|
|
1311
|
+
"value",
|
|
1312
|
+
"limit",
|
|
1313
|
+
"format-value",
|
|
1314
|
+
"field-label",
|
|
1315
|
+
"messages"
|
|
1316
|
+
]),
|
|
1317
|
+
n.$slots["entry-actions"] ? (x(), a("div", Gn, [w(n.$slots, "entry-actions", { audit: e.audit })])) : i("", !0)
|
|
1318
|
+
], 2)], 10, Mn))), 128))])) : w(n.$slots, "empty", {}, () => [o("div", Dn, [o("div", On, [o("div", kn, [l(O(V), { "aria-hidden": "true" })]), o("div", An, D(O(p).historyEmpty), 1)])])], void 0, 2)]),
|
|
1319
|
+
_: 3
|
|
1320
|
+
}, 8, ["loading", "label"])], 10, Cn)]),
|
|
1321
|
+
_: 3
|
|
1322
|
+
}, 8, ["data-slot", "class"]))], 2));
|
|
1323
|
+
}
|
|
1324
|
+
}, qn = /*@__PURE__*/ Object.assign({ inheritAttrs: !1 }, {
|
|
1325
|
+
__name: "AuditHistory",
|
|
1326
|
+
props: {
|
|
1327
|
+
auditableType: {
|
|
1328
|
+
type: String,
|
|
1329
|
+
default: null
|
|
1330
|
+
},
|
|
1331
|
+
auditableId: {
|
|
1332
|
+
type: [String, Number],
|
|
1333
|
+
default: null
|
|
1334
|
+
},
|
|
1335
|
+
batch: {
|
|
1336
|
+
type: String,
|
|
1337
|
+
default: null
|
|
1338
|
+
},
|
|
1339
|
+
load: {
|
|
1340
|
+
type: Function,
|
|
1341
|
+
required: !0
|
|
1342
|
+
},
|
|
1343
|
+
order: {
|
|
1344
|
+
type: String,
|
|
1345
|
+
default: "desc"
|
|
1346
|
+
},
|
|
1347
|
+
highlight: {
|
|
1348
|
+
type: [String, Number],
|
|
1349
|
+
default: null
|
|
1350
|
+
},
|
|
1351
|
+
bare: {
|
|
1352
|
+
type: Boolean,
|
|
1353
|
+
default: !1
|
|
1354
|
+
},
|
|
1355
|
+
showResource: {
|
|
1356
|
+
type: Boolean,
|
|
1357
|
+
default: null
|
|
1358
|
+
},
|
|
1359
|
+
refreshable: {
|
|
1360
|
+
type: Boolean,
|
|
1361
|
+
default: !0
|
|
1362
|
+
},
|
|
1363
|
+
title: {
|
|
1364
|
+
type: String,
|
|
1365
|
+
default: null
|
|
1366
|
+
},
|
|
1367
|
+
description: {
|
|
1368
|
+
type: String,
|
|
1369
|
+
default: null
|
|
1370
|
+
},
|
|
1371
|
+
subject: {
|
|
1372
|
+
type: [String, Boolean],
|
|
1373
|
+
default: null
|
|
1374
|
+
},
|
|
1375
|
+
typeLabel: {
|
|
1376
|
+
type: Function,
|
|
1377
|
+
default: Fe
|
|
1378
|
+
},
|
|
1379
|
+
messages: {
|
|
1380
|
+
type: Object,
|
|
1381
|
+
default: null
|
|
1382
|
+
}
|
|
1383
|
+
},
|
|
1384
|
+
emits: [
|
|
1385
|
+
"loaded",
|
|
1386
|
+
"error",
|
|
1387
|
+
"expand"
|
|
1388
|
+
],
|
|
1389
|
+
setup(e, { expose: t, emit: a }) {
|
|
1390
|
+
let o = e, c = a, d = X(o.messages), f = n(() => o.subject === !1 || o.bare || o.batch ? null : typeof o.subject == "string" ? o.subject : o.auditableType && o.auditableId !== null ? `${o.typeLabel(o.auditableType)} #${o.auditableId}` : null), p = E([]), h = S(!1), v = S(!1), b = n(() => {
|
|
1391
|
+
let e = [...p.value].sort((e, t) => (e.id ?? 0) - (t.id ?? 0));
|
|
1392
|
+
return o.order === "desc" ? e.reverse() : e;
|
|
1393
|
+
}), C = null;
|
|
1394
|
+
async function T() {
|
|
1395
|
+
if (!o.batch && (!o.auditableType || o.auditableId === null)) {
|
|
1396
|
+
p.value = [];
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1399
|
+
C?.abort(), C = new AbortController();
|
|
1400
|
+
let { signal: e } = C, t = {
|
|
1401
|
+
auditableType: o.auditableType,
|
|
1402
|
+
auditableId: o.auditableId,
|
|
1403
|
+
batch: o.batch,
|
|
1404
|
+
signal: e
|
|
1405
|
+
};
|
|
1406
|
+
h.value = !0, v.value = !1;
|
|
1407
|
+
try {
|
|
1408
|
+
let n = await o.load(t);
|
|
1409
|
+
if (e.aborted) return;
|
|
1410
|
+
p.value = Array.isArray(n) ? n : [], c("loaded", p.value);
|
|
1411
|
+
} catch (t) {
|
|
1412
|
+
if (e.aborted) return;
|
|
1413
|
+
p.value = [], v.value = !0, c("error", t);
|
|
1414
|
+
} finally {
|
|
1415
|
+
e.aborted || (h.value = !1);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
return M(() => [
|
|
1419
|
+
o.auditableType,
|
|
1420
|
+
o.auditableId,
|
|
1421
|
+
o.batch,
|
|
1422
|
+
o.load
|
|
1423
|
+
], T, { immediate: !0 }), y(() => C?.abort()), t({
|
|
1424
|
+
refresh: T,
|
|
1425
|
+
audits: p
|
|
1426
|
+
}), (t, n) => (x(), r(Kn, m(t.$attrs, {
|
|
1427
|
+
audits: b.value,
|
|
1428
|
+
loading: h.value,
|
|
1429
|
+
error: v.value,
|
|
1430
|
+
retry: T,
|
|
1431
|
+
highlight: e.highlight,
|
|
1432
|
+
bare: e.bare,
|
|
1433
|
+
"show-resource": e.showResource ?? !!e.batch,
|
|
1434
|
+
title: e.title ?? (e.batch ? O(d).batchTitle : null),
|
|
1435
|
+
description: e.description ?? (e.batch ? O(d).batchDescription : null),
|
|
1436
|
+
subject: f.value,
|
|
1437
|
+
"type-label": e.typeLabel,
|
|
1438
|
+
messages: e.messages,
|
|
1439
|
+
onExpand: n[0] ||= (e) => c("expand", e)
|
|
1440
|
+
}), s({ _: 2 }, [
|
|
1441
|
+
e.refreshable || t.$slots.actions ? {
|
|
1442
|
+
name: "actions",
|
|
1443
|
+
fn: N(() => [w(t.$slots, "actions", { refresh: T }), e.refreshable ? (x(), r(O(Q), {
|
|
1444
|
+
key: 0,
|
|
1445
|
+
variant: "outline",
|
|
1446
|
+
size: "icon",
|
|
1447
|
+
"aria-label": O(d).refresh,
|
|
1448
|
+
title: O(d).refresh,
|
|
1449
|
+
disabled: h.value,
|
|
1450
|
+
onClick: T
|
|
1451
|
+
}, {
|
|
1452
|
+
default: N(() => [l(O(pe), {
|
|
1453
|
+
class: g(h.value && "animate-spin motion-reduce:animate-none"),
|
|
1454
|
+
"aria-hidden": "true"
|
|
1455
|
+
}, null, 8, ["class"])]),
|
|
1456
|
+
_: 1
|
|
1457
|
+
}, 8, [
|
|
1458
|
+
"aria-label",
|
|
1459
|
+
"title",
|
|
1460
|
+
"disabled"
|
|
1461
|
+
])) : i("", !0)]),
|
|
1462
|
+
key: "0"
|
|
1463
|
+
} : void 0,
|
|
1464
|
+
t.$slots["entry-actions"] ? {
|
|
1465
|
+
name: "entry-actions",
|
|
1466
|
+
fn: N((e) => [w(t.$slots, "entry-actions", _(u(e)))]),
|
|
1467
|
+
key: "1"
|
|
1468
|
+
} : void 0,
|
|
1469
|
+
t.$slots["change-value"] ? {
|
|
1470
|
+
name: "change-value",
|
|
1471
|
+
fn: N((e) => [w(t.$slots, "change-value", _(u(e)))]),
|
|
1472
|
+
key: "2"
|
|
1473
|
+
} : void 0,
|
|
1474
|
+
t.$slots.empty ? {
|
|
1475
|
+
name: "empty",
|
|
1476
|
+
fn: N(() => [w(t.$slots, "empty")]),
|
|
1477
|
+
key: "3"
|
|
1478
|
+
} : void 0
|
|
1479
|
+
]), 1040, [
|
|
1480
|
+
"audits",
|
|
1481
|
+
"loading",
|
|
1482
|
+
"error",
|
|
1483
|
+
"highlight",
|
|
1484
|
+
"bare",
|
|
1485
|
+
"show-resource",
|
|
1486
|
+
"title",
|
|
1487
|
+
"description",
|
|
1488
|
+
"subject",
|
|
1489
|
+
"type-label",
|
|
1490
|
+
"messages"
|
|
1491
|
+
]));
|
|
1492
|
+
}
|
|
1493
|
+
}), Jn = /*@__PURE__*/ Object.assign({ inheritAttrs: !1 }, {
|
|
1494
|
+
__name: "AuditHistoryButton",
|
|
1495
|
+
props: {
|
|
1496
|
+
auditableType: {
|
|
1497
|
+
type: String,
|
|
1498
|
+
default: null
|
|
1499
|
+
},
|
|
1500
|
+
auditableId: {
|
|
1501
|
+
type: [String, Number],
|
|
1502
|
+
default: null
|
|
1503
|
+
},
|
|
1504
|
+
batch: {
|
|
1505
|
+
type: String,
|
|
1506
|
+
default: null
|
|
1507
|
+
},
|
|
1508
|
+
load: {
|
|
1509
|
+
type: Function,
|
|
1510
|
+
required: !0
|
|
1511
|
+
},
|
|
1512
|
+
highlight: {
|
|
1513
|
+
type: [String, Number],
|
|
1514
|
+
default: null
|
|
1515
|
+
},
|
|
1516
|
+
label: {
|
|
1517
|
+
type: String,
|
|
1518
|
+
default: null
|
|
1519
|
+
},
|
|
1520
|
+
title: {
|
|
1521
|
+
type: String,
|
|
1522
|
+
default: null
|
|
1523
|
+
},
|
|
1524
|
+
description: {
|
|
1525
|
+
type: String,
|
|
1526
|
+
default: null
|
|
1527
|
+
},
|
|
1528
|
+
variant: {
|
|
1529
|
+
type: String,
|
|
1530
|
+
default: "outline"
|
|
1531
|
+
},
|
|
1532
|
+
size: {
|
|
1533
|
+
type: String,
|
|
1534
|
+
default: "sm"
|
|
1535
|
+
},
|
|
1536
|
+
iconOnly: {
|
|
1537
|
+
type: Boolean,
|
|
1538
|
+
default: !1
|
|
1539
|
+
},
|
|
1540
|
+
count: {
|
|
1541
|
+
type: Number,
|
|
1542
|
+
default: null
|
|
1543
|
+
},
|
|
1544
|
+
messages: {
|
|
1545
|
+
type: Object,
|
|
1546
|
+
default: null
|
|
1547
|
+
},
|
|
1548
|
+
ui: {
|
|
1549
|
+
type: Object,
|
|
1550
|
+
default: null
|
|
1551
|
+
}
|
|
1552
|
+
},
|
|
1553
|
+
setup(e) {
|
|
1554
|
+
let t = X(e.messages), n = S(!1), o = S(null);
|
|
1555
|
+
return (s, u) => (x(), a("span", {
|
|
1556
|
+
class: g(O(Z)("laravel-auditing", e.ui?.root)),
|
|
1557
|
+
"data-slot": "audit-history-button"
|
|
1558
|
+
}, [e.iconOnly ? (x(), r(O(Q), {
|
|
1559
|
+
key: 0,
|
|
1560
|
+
variant: "outline",
|
|
1561
|
+
size: "icon-sm",
|
|
1562
|
+
class: g(O(Z)(O($e), e.ui?.button)),
|
|
1563
|
+
title: e.label ?? O(t).historyButton,
|
|
1564
|
+
"aria-label": e.label ?? O(t).historyButton,
|
|
1565
|
+
onClick: u[0] ||= (e) => n.value = !0
|
|
1566
|
+
}, {
|
|
1567
|
+
default: N(() => [l(O(B), { "aria-hidden": "true" })]),
|
|
1568
|
+
_: 1
|
|
1569
|
+
}, 8, [
|
|
1570
|
+
"class",
|
|
1571
|
+
"title",
|
|
1572
|
+
"aria-label"
|
|
1573
|
+
])) : (x(), r(O(Q), {
|
|
1574
|
+
key: 1,
|
|
1575
|
+
variant: e.variant,
|
|
1576
|
+
size: e.size,
|
|
1577
|
+
class: g(e.ui?.button),
|
|
1578
|
+
onClick: u[1] ||= (e) => n.value = !0
|
|
1579
|
+
}, {
|
|
1580
|
+
default: N(() => [
|
|
1581
|
+
l(O(V), {
|
|
1582
|
+
"data-icon": "inline-start",
|
|
1583
|
+
"aria-hidden": "true"
|
|
1584
|
+
}),
|
|
1585
|
+
w(s.$slots, "default", {}, () => [c(D(e.label ?? O(t).historyButton), 1)]),
|
|
1586
|
+
e.count === null ? i("", !0) : (x(), r(O($), {
|
|
1587
|
+
key: 0,
|
|
1588
|
+
variant: "secondary",
|
|
1589
|
+
class: "ml-0.5 tabular-nums"
|
|
1590
|
+
}, {
|
|
1591
|
+
default: N(() => [c(D(e.count), 1)]),
|
|
1592
|
+
_: 1
|
|
1593
|
+
}))
|
|
1594
|
+
]),
|
|
1595
|
+
_: 3
|
|
1596
|
+
}, 8, [
|
|
1597
|
+
"variant",
|
|
1598
|
+
"size",
|
|
1599
|
+
"class"
|
|
1600
|
+
])), l(kt, {
|
|
1601
|
+
open: n.value,
|
|
1602
|
+
"onUpdate:open": u[3] ||= (e) => n.value = e,
|
|
1603
|
+
width: "sm:max-w-4xl",
|
|
1604
|
+
title: e.title ?? (e.batch ? O(t).batchTitle : O(t).historyTitle),
|
|
1605
|
+
description: e.description ?? (e.batch ? O(t).batchDescription : O(t).historyDescription),
|
|
1606
|
+
"close-label": O(t).close,
|
|
1607
|
+
ui: e.ui?.dialog
|
|
1608
|
+
}, {
|
|
1609
|
+
actions: N(() => [l(O(Q), {
|
|
1610
|
+
variant: "ghost",
|
|
1611
|
+
size: "icon-sm",
|
|
1612
|
+
"aria-label": O(t).refresh,
|
|
1613
|
+
title: O(t).refresh,
|
|
1614
|
+
onClick: u[2] ||= (e) => o.value?.refresh()
|
|
1615
|
+
}, {
|
|
1616
|
+
default: N(() => [l(O(pe), { "aria-hidden": "true" })]),
|
|
1617
|
+
_: 1
|
|
1618
|
+
}, 8, ["aria-label", "title"])]),
|
|
1619
|
+
default: N(() => [n.value ? (x(), r(qn, m({
|
|
1620
|
+
key: 0,
|
|
1621
|
+
ref_key: "history",
|
|
1622
|
+
ref: o
|
|
1623
|
+
}, s.$attrs, {
|
|
1624
|
+
bare: "",
|
|
1625
|
+
refreshable: !1,
|
|
1626
|
+
"auditable-type": e.auditableType,
|
|
1627
|
+
"auditable-id": e.auditableId,
|
|
1628
|
+
batch: e.batch,
|
|
1629
|
+
load: e.load,
|
|
1630
|
+
highlight: e.highlight,
|
|
1631
|
+
messages: e.messages
|
|
1632
|
+
}), null, 16, [
|
|
1633
|
+
"auditable-type",
|
|
1634
|
+
"auditable-id",
|
|
1635
|
+
"batch",
|
|
1636
|
+
"load",
|
|
1637
|
+
"highlight",
|
|
1638
|
+
"messages"
|
|
1639
|
+
])) : i("", !0)]),
|
|
1640
|
+
_: 1
|
|
1641
|
+
}, 8, [
|
|
1642
|
+
"open",
|
|
1643
|
+
"title",
|
|
1644
|
+
"description",
|
|
1645
|
+
"close-label",
|
|
1646
|
+
"ui"
|
|
1647
|
+
])], 2));
|
|
1648
|
+
}
|
|
1649
|
+
}), Yn = { class: "flex min-w-0 flex-col gap-1" }, Xn = { class: "cn-font-heading m-0 text-xl font-semibold tracking-tight" }, Zn = {
|
|
1650
|
+
key: 0,
|
|
1651
|
+
class: "text-sm text-muted-foreground"
|
|
1652
|
+
}, Qn = {
|
|
1653
|
+
key: 0,
|
|
1654
|
+
class: "ml-auto flex flex-wrap items-center gap-2"
|
|
1655
|
+
}, $n = {
|
|
1656
|
+
"data-slot": "input-group",
|
|
1657
|
+
role: "group",
|
|
1658
|
+
class: "group/input-group cn-input-group relative flex w-full min-w-0 items-center outline-none"
|
|
1659
|
+
}, er = ["aria-label", "placeholder"], tr = { class: "cn-input-group-addon cn-input-group-addon-align-inline-start order-first flex cursor-text items-center justify-center select-none" }, nr = {
|
|
1660
|
+
key: 0,
|
|
1661
|
+
class: "cn-input-group-addon cn-input-group-addon-align-inline-end order-last flex items-center justify-center select-none"
|
|
1662
|
+
}, rr = { class: "ml-auto flex flex-wrap items-center gap-2" }, ir = { class: "flex min-w-0 grow basis-90 flex-wrap items-center gap-1.5" }, ar = { class: "mr-1.5 inline-flex gap-1 whitespace-nowrap text-muted-foreground tabular-nums" }, or = { class: "font-semibold text-foreground" }, sr = { class: "font-normal text-muted-foreground" }, cr = ["aria-label", "onClick"], lr = {
|
|
1663
|
+
key: 0,
|
|
1664
|
+
role: "alert",
|
|
1665
|
+
class: "flex flex-col items-center gap-2 px-5 py-14 text-center text-muted-foreground"
|
|
1666
|
+
}, ur = { class: "text-sm font-semibold text-foreground" }, dr = {
|
|
1667
|
+
"data-slot": "table",
|
|
1668
|
+
class: "cn-table"
|
|
1669
|
+
}, fr = {
|
|
1670
|
+
"data-slot": "table-header",
|
|
1671
|
+
class: "cn-table-header"
|
|
1672
|
+
}, pr = {
|
|
1673
|
+
"data-slot": "table-row",
|
|
1674
|
+
class: "cn-table-row hover:bg-transparent"
|
|
1675
|
+
}, mr = { class: "sr-only" }, hr = {
|
|
1676
|
+
"data-slot": "table-body",
|
|
1677
|
+
class: "cn-table-body"
|
|
1678
|
+
}, gr = { key: 0 }, _r = ["colspan"], vr = {
|
|
1679
|
+
key: 0,
|
|
1680
|
+
class: "h-56"
|
|
1681
|
+
}, yr = { class: "flex flex-col items-center gap-2 px-5 py-14 text-center whitespace-normal text-muted-foreground" }, br = { class: "text-sm font-semibold text-foreground" }, xr = ["title"], Sr = { class: "font-medium" }, Cr = { class: "text-xs text-muted-foreground tabular-nums" }, wr = { class: "flex flex-col gap-0.5 leading-tight" }, Tr = ["datetime"], Er = [
|
|
1682
|
+
"title",
|
|
1683
|
+
"onClick",
|
|
1684
|
+
"onKeydown"
|
|
1685
|
+
], Dr = { class: "flex items-center gap-2" }, Or = {
|
|
1686
|
+
class: "cn-native-select-wrapper group/native-select relative w-fit text-muted-foreground-strong",
|
|
1687
|
+
"data-size": "default"
|
|
1688
|
+
}, kr = ["value"], Ar = {
|
|
1689
|
+
class: "tabular-nums",
|
|
1690
|
+
"aria-live": "polite"
|
|
1691
|
+
}, jr = ["aria-label"], Mr = { class: "cn-pagination-content flex items-center gap-1" }, Nr = "cn-table-head h-10 px-3 text-xs font-medium text-muted-foreground first:pl-(--surface-padding) last:pr-4", Pr = "cn-table-cell h-14 px-3 first:pl-(--surface-padding) last:pr-4", Fr = "sticky left-0 z-1 w-px bg-card pr-2.5", Ir = {
|
|
1692
|
+
__name: "AuditTable",
|
|
1693
|
+
props: {
|
|
1694
|
+
load: {
|
|
1695
|
+
type: Function,
|
|
1696
|
+
required: !0
|
|
1697
|
+
},
|
|
1698
|
+
searchUsers: {
|
|
1699
|
+
type: Function,
|
|
1700
|
+
default: null
|
|
1701
|
+
},
|
|
1702
|
+
searchResources: {
|
|
1703
|
+
type: Function,
|
|
1704
|
+
default: null
|
|
1705
|
+
},
|
|
1706
|
+
resources: {
|
|
1707
|
+
type: Array,
|
|
1708
|
+
default: () => []
|
|
1709
|
+
},
|
|
1710
|
+
events: {
|
|
1711
|
+
type: Array,
|
|
1712
|
+
default: () => be.map((e) => e.code)
|
|
1713
|
+
},
|
|
1714
|
+
initialFilters: {
|
|
1715
|
+
type: Object,
|
|
1716
|
+
default: null
|
|
1717
|
+
},
|
|
1718
|
+
userLabel: {
|
|
1719
|
+
type: [String, Function],
|
|
1720
|
+
default: "name"
|
|
1721
|
+
},
|
|
1722
|
+
typeLabel: {
|
|
1723
|
+
type: Function,
|
|
1724
|
+
default: Fe
|
|
1725
|
+
},
|
|
1726
|
+
formatValue: {
|
|
1727
|
+
type: Function,
|
|
1728
|
+
default: De
|
|
1729
|
+
},
|
|
1730
|
+
fieldLabel: {
|
|
1731
|
+
type: Function,
|
|
1732
|
+
default: (e) => e
|
|
1733
|
+
},
|
|
1734
|
+
title: {
|
|
1735
|
+
type: String,
|
|
1736
|
+
default: null
|
|
1737
|
+
},
|
|
1738
|
+
description: {
|
|
1739
|
+
type: String,
|
|
1740
|
+
default: null
|
|
1741
|
+
},
|
|
1742
|
+
perPageOptions: {
|
|
1743
|
+
type: Array,
|
|
1744
|
+
default: () => [
|
|
1745
|
+
10,
|
|
1746
|
+
25,
|
|
1747
|
+
50
|
|
1748
|
+
]
|
|
1749
|
+
},
|
|
1750
|
+
changesLimit: {
|
|
1751
|
+
type: Number,
|
|
1752
|
+
default: 3
|
|
1753
|
+
},
|
|
1754
|
+
persistenceKey: {
|
|
1755
|
+
type: String,
|
|
1756
|
+
default: null
|
|
1757
|
+
},
|
|
1758
|
+
showHeader: {
|
|
1759
|
+
type: Boolean,
|
|
1760
|
+
default: !0
|
|
1761
|
+
},
|
|
1762
|
+
showToolbar: {
|
|
1763
|
+
type: Boolean,
|
|
1764
|
+
default: !0
|
|
1765
|
+
},
|
|
1766
|
+
showFilters: {
|
|
1767
|
+
type: Boolean,
|
|
1768
|
+
default: !0
|
|
1769
|
+
},
|
|
1770
|
+
messages: {
|
|
1771
|
+
type: Object,
|
|
1772
|
+
default: null
|
|
1773
|
+
},
|
|
1774
|
+
ui: {
|
|
1775
|
+
type: Object,
|
|
1776
|
+
default: null
|
|
1777
|
+
}
|
|
1778
|
+
},
|
|
1779
|
+
emits: [
|
|
1780
|
+
"loaded",
|
|
1781
|
+
"error",
|
|
1782
|
+
"update:filters"
|
|
1783
|
+
],
|
|
1784
|
+
setup(t, { expose: s, emit: u }) {
|
|
1785
|
+
let d = t, f = u, p = X(d.messages), m = [
|
|
1786
|
+
"columnEvent",
|
|
1787
|
+
"columnResource",
|
|
1788
|
+
"columnUser",
|
|
1789
|
+
"columnChanges"
|
|
1790
|
+
], h = d.persistenceKey ? `laravel-auditing:v4:${d.persistenceKey}` : null, _ = Oe(), v = S({
|
|
1791
|
+
...we(),
|
|
1792
|
+
...d.initialFilters,
|
|
1793
|
+
..._.filters
|
|
1794
|
+
}), k = S(v.value.search), A = S(1), j = S(d.perPageOptions.includes(_.perPage) ? _.perPage : d.perPageOptions[0]), I = E([]), L = S(0), z = S(!1), se = S(!1), B = S(!1), V = S(null), le = S(!1), ue = S(null), H = n(() => Math.max(1, Math.ceil(L.value / j.value))), fe = n(() => [
|
|
1795
|
+
{
|
|
1796
|
+
key: "prev",
|
|
1797
|
+
icon: ie,
|
|
1798
|
+
label: p.previousPage,
|
|
1799
|
+
page: A.value - 1,
|
|
1800
|
+
disabled: A.value <= 1 || z.value
|
|
1801
|
+
},
|
|
1802
|
+
...je(A.value, H.value).map((e) => ({
|
|
1803
|
+
key: e,
|
|
1804
|
+
page: e,
|
|
1805
|
+
current: e === A.value
|
|
1806
|
+
})),
|
|
1807
|
+
{
|
|
1808
|
+
key: "next",
|
|
1809
|
+
icon: R,
|
|
1810
|
+
label: p.nextPage,
|
|
1811
|
+
page: A.value + 1,
|
|
1812
|
+
disabled: A.value >= H.value || z.value
|
|
1813
|
+
}
|
|
1814
|
+
]), pe = n(() => {
|
|
1815
|
+
let e = Ae(A.value, j.value, L.value);
|
|
1816
|
+
return e ? Y(p.pageRange, e) : p.pageRangeEmpty;
|
|
1817
|
+
}), W = n(() => Te(v.value, {
|
|
1818
|
+
messages: p,
|
|
1819
|
+
userLabel: d.userLabel,
|
|
1820
|
+
typeLabel: d.typeLabel
|
|
1821
|
+
})), ge = n(() => W.value.filter((e) => e.key !== "search").length), _e = (e) => e.user ? ze(e.user, d.userLabel) : p.system, ve = null;
|
|
1822
|
+
async function G() {
|
|
1823
|
+
ve?.abort(), ve = new AbortController();
|
|
1824
|
+
let { signal: e } = ve;
|
|
1825
|
+
z.value = !0, se.value = !1;
|
|
1826
|
+
try {
|
|
1827
|
+
let t = {
|
|
1828
|
+
filters: v.value,
|
|
1829
|
+
page: A.value,
|
|
1830
|
+
perPage: j.value,
|
|
1831
|
+
signal: e
|
|
1832
|
+
}, n = await d.load(t);
|
|
1833
|
+
if (e.aborted) return;
|
|
1834
|
+
if (I.value = n?.rows ?? [], L.value = n?.total ?? 0, !I.value.length && A.value > H.value) {
|
|
1835
|
+
A.value = H.value;
|
|
1836
|
+
return;
|
|
1837
|
+
}
|
|
1838
|
+
f("loaded", {
|
|
1839
|
+
rows: I.value,
|
|
1840
|
+
total: L.value
|
|
1841
|
+
});
|
|
1842
|
+
} catch (t) {
|
|
1843
|
+
if (e.aborted) return;
|
|
1844
|
+
I.value = [], L.value = 0, se.value = !0, f("error", t);
|
|
1845
|
+
} finally {
|
|
1846
|
+
e.aborted || (z.value = !1);
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
function be() {
|
|
1850
|
+
v.value = {
|
|
1851
|
+
...v.value,
|
|
1852
|
+
search: k.value.trim()
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1855
|
+
function xe() {
|
|
1856
|
+
k.value.trim() === v.value.search ? G() : be();
|
|
1857
|
+
}
|
|
1858
|
+
function K() {
|
|
1859
|
+
v.value = we(), k.value = "";
|
|
1860
|
+
}
|
|
1861
|
+
function Se(e) {
|
|
1862
|
+
v.value = e.remove(v.value), e.key === "search" && (k.value = "");
|
|
1863
|
+
}
|
|
1864
|
+
function q() {
|
|
1865
|
+
V.value = JSON.parse(JSON.stringify(v.value)), B.value = !0;
|
|
1866
|
+
}
|
|
1867
|
+
function Ce() {
|
|
1868
|
+
v.value = {
|
|
1869
|
+
...V.value,
|
|
1870
|
+
search: v.value.search,
|
|
1871
|
+
start_date: V.value.start_date || null,
|
|
1872
|
+
end_date: V.value.end_date || null
|
|
1873
|
+
}, B.value = !1;
|
|
1874
|
+
}
|
|
1875
|
+
function J(e) {
|
|
1876
|
+
ue.value = e, le.value = !0;
|
|
1877
|
+
}
|
|
1878
|
+
function De(e) {
|
|
1879
|
+
window.getSelection?.()?.toString() || J(e);
|
|
1880
|
+
}
|
|
1881
|
+
function Oe() {
|
|
1882
|
+
try {
|
|
1883
|
+
return h && JSON.parse(localStorage.getItem(h)) || {};
|
|
1884
|
+
} catch {
|
|
1885
|
+
return {};
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
let ke = () => A.value === 1 ? G() : A.value = 1;
|
|
1889
|
+
return M(v, (e) => {
|
|
1890
|
+
f("update:filters", e), ke();
|
|
1891
|
+
}, { deep: !0 }), M(j, ke), M(A, G), M([v, j], () => {
|
|
1892
|
+
try {
|
|
1893
|
+
h && localStorage.setItem(h, JSON.stringify({
|
|
1894
|
+
filters: v.value,
|
|
1895
|
+
perPage: j.value
|
|
1896
|
+
}));
|
|
1897
|
+
} catch {}
|
|
1898
|
+
}, { deep: !0 }), b(G), y(() => {
|
|
1899
|
+
ve?.abort();
|
|
1900
|
+
}), s({
|
|
1901
|
+
refresh: G,
|
|
1902
|
+
reset: K,
|
|
1903
|
+
filters: v,
|
|
1904
|
+
openChanges: J
|
|
1905
|
+
}), (n, s) => (x(), a("div", {
|
|
1906
|
+
class: g(O(Z)("laravel-auditing", t.ui?.root)),
|
|
1907
|
+
"data-slot": "audit-table"
|
|
1908
|
+
}, [
|
|
1909
|
+
o("section", {
|
|
1910
|
+
"data-slot": "audit-table-card",
|
|
1911
|
+
class: g(O(Z)("relative flex min-w-0 flex-col rounded-surface border bg-card text-sm text-card-foreground shadow-xs", t.ui?.card))
|
|
1912
|
+
}, [
|
|
1913
|
+
t.showHeader ? (x(), a("div", {
|
|
1914
|
+
key: 0,
|
|
1915
|
+
"data-slot": "audit-table-header",
|
|
1916
|
+
class: g(O(Z)("flex flex-wrap items-center justify-between gap-4 px-(--surface-padding) pt-(--surface-padding) pb-4", t.ui?.header))
|
|
1917
|
+
}, [o("div", Yn, [o("h2", Xn, [w(n.$slots, "title", {}, () => [c(D(t.title ?? O(p).title), 1)])]), t.description ?? O(p).description ? (x(), a("p", Zn, D(t.description ?? O(p).description), 1)) : i("", !0)]), n.$slots.actions ? (x(), a("div", Qn, [w(n.$slots, "actions")])) : i("", !0)], 2)) : i("", !0),
|
|
1918
|
+
t.showToolbar ? (x(), a("div", {
|
|
1919
|
+
key: 1,
|
|
1920
|
+
"data-slot": "audit-table-toolbar",
|
|
1921
|
+
class: g(O(Z)("flex flex-wrap items-center gap-2.5 px-(--surface-padding) pb-3.5", !t.showHeader && "pt-3.5", t.ui?.toolbar))
|
|
1922
|
+
}, [o("form", {
|
|
1923
|
+
class: "min-w-0 grow basis-60 sm:max-w-100",
|
|
1924
|
+
role: "search",
|
|
1925
|
+
onSubmit: F(xe, ["prevent"])
|
|
1926
|
+
}, [o("div", $n, [
|
|
1927
|
+
ne(o("input", {
|
|
1928
|
+
"onUpdate:modelValue": s[0] ||= (e) => k.value = e,
|
|
1929
|
+
type: "search",
|
|
1930
|
+
"data-slot": "input-group-control",
|
|
1931
|
+
"aria-label": O(p).filterSearch,
|
|
1932
|
+
placeholder: O(p).searchPlaceholder,
|
|
1933
|
+
class: g(["cn-input-group-input flex-1 [&::-webkit-search-cancel-button]:hidden", [O(Je)]]),
|
|
1934
|
+
onKeydown: s[1] ||= P((e) => k.value = "", ["esc"])
|
|
1935
|
+
}, null, 42, er), [[te, k.value]]),
|
|
1936
|
+
o("div", tr, [l(O(me), { "aria-hidden": "true" })]),
|
|
1937
|
+
k.value ? (x(), a("div", nr, [l(O(Q), {
|
|
1938
|
+
variant: "ghost",
|
|
1939
|
+
size: "icon-xs",
|
|
1940
|
+
class: "cn-input-group-button",
|
|
1941
|
+
"aria-label": O(p).clearFilters,
|
|
1942
|
+
onClick: s[2] ||= (e) => {
|
|
1943
|
+
k.value = "", be();
|
|
1944
|
+
}
|
|
1945
|
+
}, {
|
|
1946
|
+
default: N(() => [l(O(ye), { "aria-hidden": "true" })]),
|
|
1947
|
+
_: 1
|
|
1948
|
+
}, 8, ["aria-label"])])) : i("", !0)
|
|
1949
|
+
])], 32), o("div", rr, [w(n.$slots, "toolbar", { filters: v.value }), o("div", {
|
|
1950
|
+
role: "group",
|
|
1951
|
+
"data-slot": "button-group",
|
|
1952
|
+
"data-orientation": "horizontal",
|
|
1953
|
+
class: g(O(Ye))
|
|
1954
|
+
}, [t.showFilters ? (x(), r(O(Q), {
|
|
1955
|
+
key: 0,
|
|
1956
|
+
variant: "outline",
|
|
1957
|
+
"aria-haspopup": "dialog",
|
|
1958
|
+
"aria-expanded": B.value,
|
|
1959
|
+
onClick: q
|
|
1960
|
+
}, {
|
|
1961
|
+
default: N(() => [
|
|
1962
|
+
l(O(he), {
|
|
1963
|
+
"data-icon": "inline-start",
|
|
1964
|
+
"aria-hidden": "true"
|
|
1965
|
+
}),
|
|
1966
|
+
c(" " + D(O(p).filters) + " ", 1),
|
|
1967
|
+
ge.value ? (x(), r(O($), {
|
|
1968
|
+
key: 0,
|
|
1969
|
+
class: "min-w-5 px-1 tabular-nums"
|
|
1970
|
+
}, {
|
|
1971
|
+
default: N(() => [c(D(ge.value), 1)]),
|
|
1972
|
+
_: 1
|
|
1973
|
+
})) : i("", !0)
|
|
1974
|
+
]),
|
|
1975
|
+
_: 1
|
|
1976
|
+
}, 8, ["aria-expanded"])) : i("", !0), l(O(Q), {
|
|
1977
|
+
variant: "outline",
|
|
1978
|
+
class: "relative disabled:opacity-100",
|
|
1979
|
+
disabled: z.value,
|
|
1980
|
+
"aria-busy": z.value,
|
|
1981
|
+
onClick: xe
|
|
1982
|
+
}, {
|
|
1983
|
+
default: N(() => [o("span", { class: g(z.value && "opacity-0") }, D(O(p).apply), 3), z.value ? (x(), r(O(de), {
|
|
1984
|
+
key: 0,
|
|
1985
|
+
class: "absolute inset-0 m-auto animate-spin opacity-70 motion-reduce:animate-none",
|
|
1986
|
+
"aria-hidden": "true"
|
|
1987
|
+
})) : i("", !0)]),
|
|
1988
|
+
_: 1
|
|
1989
|
+
}, 8, ["disabled", "aria-busy"])], 2)])], 2)) : i("", !0),
|
|
1990
|
+
t.showToolbar ? (x(), a("div", {
|
|
1991
|
+
key: 2,
|
|
1992
|
+
"data-slot": "audit-table-chips",
|
|
1993
|
+
class: g(O(Z)("flex flex-wrap items-center gap-x-4 gap-y-2.5 px-(--surface-padding) pb-3.5", t.ui?.chips))
|
|
1994
|
+
}, [o("div", ir, [
|
|
1995
|
+
o("span", ar, [o("b", or, D(L.value), 1), c(" " + D(L.value === 1 ? O(p).result : O(p).results), 1)]),
|
|
1996
|
+
(x(!0), a(e, null, C(W.value, (e) => (x(), a("span", {
|
|
1997
|
+
key: e.key,
|
|
1998
|
+
"data-slot": "audit-filter-chip",
|
|
1999
|
+
class: "inline-flex h-6.5 items-center gap-1 rounded-full border border-input pr-0.5 pl-2.5 text-xs font-medium whitespace-nowrap"
|
|
2000
|
+
}, [
|
|
2001
|
+
o("span", sr, D(e.field) + ": ", 1),
|
|
2002
|
+
c(D(e.label) + " ", 1),
|
|
2003
|
+
o("button", {
|
|
2004
|
+
type: "button",
|
|
2005
|
+
class: "grid size-5 place-items-center rounded-full text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-ring",
|
|
2006
|
+
"aria-label": O(Y)(O(p).removeFilter, { filter: `${e.field}: ${e.label}` }),
|
|
2007
|
+
onClick: (t) => Se(e)
|
|
2008
|
+
}, [l(O(ye), {
|
|
2009
|
+
class: "size-3",
|
|
2010
|
+
"aria-hidden": "true"
|
|
2011
|
+
})], 8, cr)
|
|
2012
|
+
]))), 128)),
|
|
2013
|
+
W.value.length ? (x(), a("button", {
|
|
2014
|
+
key: 0,
|
|
2015
|
+
type: "button",
|
|
2016
|
+
class: "rounded-item px-1.5 py-1 text-xs font-medium whitespace-nowrap text-muted-foreground underline decoration-input underline-offset-3 outline-none hover:text-foreground hover:decoration-current focus-ring",
|
|
2017
|
+
onClick: K
|
|
2018
|
+
}, D(O(p).clearFilters), 1)) : i("", !0)
|
|
2019
|
+
])], 2)) : i("", !0),
|
|
2020
|
+
l(_n, {
|
|
2021
|
+
class: "overflow-clip border-t",
|
|
2022
|
+
loading: z.value,
|
|
2023
|
+
label: O(p).loading,
|
|
2024
|
+
ui: t.ui?.loading
|
|
2025
|
+
}, {
|
|
2026
|
+
default: N(() => [se.value ? (x(), a("div", lr, [
|
|
2027
|
+
l(O(ae), {
|
|
2028
|
+
class: "size-7 text-destructive",
|
|
2029
|
+
"aria-hidden": "true"
|
|
2030
|
+
}),
|
|
2031
|
+
o("b", ur, D(O(p).loadFailed), 1),
|
|
2032
|
+
l(O(Q), {
|
|
2033
|
+
variant: "outline",
|
|
2034
|
+
size: "sm",
|
|
2035
|
+
onClick: G
|
|
2036
|
+
}, {
|
|
2037
|
+
default: N(() => [l(O(U), {
|
|
2038
|
+
"data-icon": "inline-start",
|
|
2039
|
+
"aria-hidden": "true"
|
|
2040
|
+
}), c(" " + D(O(p).retry), 1)]),
|
|
2041
|
+
_: 1
|
|
2042
|
+
})
|
|
2043
|
+
])) : (x(), a(e, { key: 1 }, [o("div", {
|
|
2044
|
+
"data-slot": "table-container",
|
|
2045
|
+
class: g(O(Z)("cn-table-container [&_tbody_tr:hover>.sticky]:bg-[color-mix(in_oklch,var(--muted)_50%,var(--card))]", t.ui?.table))
|
|
2046
|
+
}, [o("table", dr, [o("thead", fr, [o("tr", pr, [n.$slots["row-actions"] ? (x(), a("th", {
|
|
2047
|
+
key: 0,
|
|
2048
|
+
class: g([Nr, Fr])
|
|
2049
|
+
}, [o("span", mr, D(O(p).columnActions), 1)], 2)) : i("", !0), (x(), a(e, null, C(m, (e) => o("th", {
|
|
2050
|
+
key: e,
|
|
2051
|
+
class: g([Nr, e === "columnChanges" && "min-w-96"])
|
|
2052
|
+
}, D(O(p)[e]), 3)), 64))])]), o("tbody", hr, [I.value.length ? i("", !0) : (x(), a("tr", gr, [o("td", {
|
|
2053
|
+
colspan: m.length + +!!n.$slots["row-actions"],
|
|
2054
|
+
class: "cn-table-cell px-3"
|
|
2055
|
+
}, [z.value ? (x(), a("div", vr)) : w(n.$slots, "empty", { reset: K }, () => [o("div", yr, [
|
|
2056
|
+
l(O(ce), {
|
|
2057
|
+
class: "size-7",
|
|
2058
|
+
"aria-hidden": "true"
|
|
2059
|
+
}),
|
|
2060
|
+
o("b", br, D(O(p).empty), 1),
|
|
2061
|
+
W.value.length ? (x(), a(e, { key: 0 }, [o("span", null, D(O(p).emptyHint), 1), l(O(Q), {
|
|
2062
|
+
variant: "outline",
|
|
2063
|
+
size: "sm",
|
|
2064
|
+
onClick: K
|
|
2065
|
+
}, {
|
|
2066
|
+
default: N(() => [l(O(U), {
|
|
2067
|
+
"data-icon": "inline-start",
|
|
2068
|
+
"aria-hidden": "true"
|
|
2069
|
+
}), c(" " + D(O(p).resetFilters), 1)]),
|
|
2070
|
+
_: 1
|
|
2071
|
+
})], 64)) : i("", !0)
|
|
2072
|
+
])], void 0, 1)], 8, _r)])), (x(!0), a(e, null, C(I.value, (e) => (x(), a("tr", {
|
|
2073
|
+
key: e.id,
|
|
2074
|
+
"data-slot": "table-row",
|
|
2075
|
+
class: g(O(Z)("cn-table-row", t.ui?.row))
|
|
2076
|
+
}, [
|
|
2077
|
+
n.$slots["row-actions"] ? (x(), a("td", {
|
|
2078
|
+
key: 0,
|
|
2079
|
+
class: g([Pr, Fr])
|
|
2080
|
+
}, [o("div", {
|
|
2081
|
+
role: "group",
|
|
2082
|
+
"data-slot": "button-group",
|
|
2083
|
+
"data-orientation": "horizontal",
|
|
2084
|
+
class: g(O(Ye))
|
|
2085
|
+
}, [w(n.$slots, "row-actions", {
|
|
2086
|
+
audit: e,
|
|
2087
|
+
openChanges: () => J(e)
|
|
2088
|
+
})], 2)], 2)) : i("", !0),
|
|
2089
|
+
o("td", { class: g(Pr) }, [l(jt, {
|
|
2090
|
+
event: e.event,
|
|
2091
|
+
messages: t.messages
|
|
2092
|
+
}, null, 8, ["event", "messages"])]),
|
|
2093
|
+
o("td", { class: g(Pr) }, [w(n.$slots, "cell-resource", { audit: e }, () => [o("div", {
|
|
2094
|
+
class: "flex flex-col leading-tight",
|
|
2095
|
+
title: e.auditable_type
|
|
2096
|
+
}, [o("span", Sr, D(t.typeLabel(e.auditable_type)), 1), o("span", Cr, " #" + D(e.auditable_id), 1)], 8, xr)])]),
|
|
2097
|
+
o("td", { class: g(Pr) }, [w(n.$slots, "cell-user", { audit: e }, () => [o("div", wr, [o("span", { class: g(["font-medium", [!e.user && "text-muted-foreground"]]) }, D(_e(e)), 3), o("time", {
|
|
2098
|
+
datetime: e.created_at,
|
|
2099
|
+
class: "inline-flex items-center gap-1 text-xs text-muted-foreground tabular-nums"
|
|
2100
|
+
}, [l(O(oe), {
|
|
2101
|
+
class: "size-3",
|
|
2102
|
+
"aria-hidden": "true"
|
|
2103
|
+
}), c(" " + D(O(Ee)(e.created_at)), 1)], 8, Tr)])])]),
|
|
2104
|
+
o("td", {
|
|
2105
|
+
class: g(["cursor-pointer py-2.5 whitespace-normal outline-none hover:bg-muted/40 focus-ring", [Pr]]),
|
|
2106
|
+
tabindex: "0",
|
|
2107
|
+
title: O(p).showDetails,
|
|
2108
|
+
onClick: (t) => De(e),
|
|
2109
|
+
onKeydown: P(F((t) => J(e), ["self"]), ["enter"])
|
|
2110
|
+
}, [l(vt, {
|
|
2111
|
+
value: e,
|
|
2112
|
+
size: "sm",
|
|
2113
|
+
limit: t.changesLimit,
|
|
2114
|
+
"max-length": 140,
|
|
2115
|
+
"format-value": t.formatValue,
|
|
2116
|
+
"field-label": t.fieldLabel,
|
|
2117
|
+
messages: t.messages
|
|
2118
|
+
}, null, 8, [
|
|
2119
|
+
"value",
|
|
2120
|
+
"limit",
|
|
2121
|
+
"format-value",
|
|
2122
|
+
"field-label",
|
|
2123
|
+
"messages"
|
|
2124
|
+
])], 42, Er)
|
|
2125
|
+
], 2))), 128))])])], 2), L.value ? (x(), a("div", {
|
|
2126
|
+
key: 0,
|
|
2127
|
+
"data-slot": "audit-table-footer",
|
|
2128
|
+
class: g(O(Z)("flex flex-wrap items-center justify-between gap-3 border-t py-3 pr-4 pl-(--surface-padding) text-muted-foreground", t.ui?.footer))
|
|
2129
|
+
}, [
|
|
2130
|
+
o("label", Dr, [c(D(O(p).rowsPerPage) + " ", 1), o("span", Or, [ne(o("select", {
|
|
2131
|
+
"onUpdate:modelValue": s[3] ||= (e) => j.value = e,
|
|
2132
|
+
"data-size": "default",
|
|
2133
|
+
class: "cn-native-select outline-none"
|
|
2134
|
+
}, [(x(!0), a(e, null, C(t.perPageOptions, (e) => (x(), a("option", {
|
|
2135
|
+
key: e,
|
|
2136
|
+
value: e
|
|
2137
|
+
}, D(e), 9, kr))), 128))], 512), [[
|
|
2138
|
+
ee,
|
|
2139
|
+
j.value,
|
|
2140
|
+
void 0,
|
|
2141
|
+
{ number: !0 }
|
|
2142
|
+
]]), l(O(re), {
|
|
2143
|
+
class: "cn-native-select-icon pointer-events-none absolute select-none",
|
|
2144
|
+
"aria-hidden": "true"
|
|
2145
|
+
})])]),
|
|
2146
|
+
o("span", Ar, D(pe.value), 1),
|
|
2147
|
+
o("nav", {
|
|
2148
|
+
"aria-label": O(p).pagination,
|
|
2149
|
+
class: "cn-pagination flex"
|
|
2150
|
+
}, [o("ul", Mr, [(x(!0), a(e, null, C(fe.value, (t) => (x(), a("li", {
|
|
2151
|
+
key: t.key,
|
|
2152
|
+
class: "flex"
|
|
2153
|
+
}, [l(O(Q), {
|
|
2154
|
+
variant: t.current ? "outline" : "ghost",
|
|
2155
|
+
size: "icon",
|
|
2156
|
+
class: g(["cn-pagination-link h-8 min-w-8", [t.icon ? "size-8" : "size-auto px-2 text-foreground tabular-nums", t.current && "bg-muted font-semibold"]]),
|
|
2157
|
+
"aria-label": t.label,
|
|
2158
|
+
"aria-current": t.current ? "page" : void 0,
|
|
2159
|
+
disabled: t.disabled,
|
|
2160
|
+
onClick: (e) => A.value = t.page
|
|
2161
|
+
}, {
|
|
2162
|
+
default: N(() => [t.icon ? (x(), r(T(t.icon), {
|
|
2163
|
+
key: 0,
|
|
2164
|
+
class: "cn-rtl-flip",
|
|
2165
|
+
"aria-hidden": "true"
|
|
2166
|
+
})) : (x(), a(e, { key: 1 }, [c(D(t.page), 1)], 64))]),
|
|
2167
|
+
_: 2
|
|
2168
|
+
}, 1032, [
|
|
2169
|
+
"variant",
|
|
2170
|
+
"class",
|
|
2171
|
+
"aria-label",
|
|
2172
|
+
"aria-current",
|
|
2173
|
+
"disabled",
|
|
2174
|
+
"onClick"
|
|
2175
|
+
])]))), 128))])], 8, jr)
|
|
2176
|
+
], 2)) : i("", !0)], 64))]),
|
|
2177
|
+
_: 3
|
|
2178
|
+
}, 8, [
|
|
2179
|
+
"loading",
|
|
2180
|
+
"label",
|
|
2181
|
+
"ui"
|
|
2182
|
+
])
|
|
2183
|
+
], 2),
|
|
2184
|
+
t.showFilters ? (x(), r(kt, {
|
|
2185
|
+
key: 0,
|
|
2186
|
+
open: B.value,
|
|
2187
|
+
"onUpdate:open": s[6] ||= (e) => B.value = e,
|
|
2188
|
+
variant: "drawer",
|
|
2189
|
+
title: O(p).filtersTitle,
|
|
2190
|
+
description: O(p).filtersDescription,
|
|
2191
|
+
"close-label": O(p).close,
|
|
2192
|
+
ui: t.ui?.drawer
|
|
2193
|
+
}, {
|
|
2194
|
+
footer: N(() => [l(O(Q), { onClick: Ce }, {
|
|
2195
|
+
default: N(() => [c(D(O(p).applyFilters), 1)]),
|
|
2196
|
+
_: 1
|
|
2197
|
+
}), l(O(Q), {
|
|
2198
|
+
variant: "outline",
|
|
2199
|
+
onClick: s[5] ||= (e) => {
|
|
2200
|
+
K(), B.value = !1;
|
|
2201
|
+
}
|
|
2202
|
+
}, {
|
|
2203
|
+
default: N(() => [l(O(U), {
|
|
2204
|
+
"data-icon": "inline-start",
|
|
2205
|
+
"aria-hidden": "true"
|
|
2206
|
+
}), c(" " + D(O(p).resetShort), 1)]),
|
|
2207
|
+
_: 1
|
|
2208
|
+
})]),
|
|
2209
|
+
default: N(() => [V.value ? (x(), r(hn, {
|
|
2210
|
+
key: 0,
|
|
2211
|
+
modelValue: V.value,
|
|
2212
|
+
"onUpdate:modelValue": s[4] ||= (e) => V.value = e,
|
|
2213
|
+
events: t.events,
|
|
2214
|
+
"search-users": t.searchUsers,
|
|
2215
|
+
"search-resources": t.searchResources,
|
|
2216
|
+
resources: t.resources,
|
|
2217
|
+
"user-label": t.userLabel,
|
|
2218
|
+
"type-label": t.typeLabel,
|
|
2219
|
+
messages: t.messages
|
|
2220
|
+
}, null, 8, [
|
|
2221
|
+
"modelValue",
|
|
2222
|
+
"events",
|
|
2223
|
+
"search-users",
|
|
2224
|
+
"search-resources",
|
|
2225
|
+
"resources",
|
|
2226
|
+
"user-label",
|
|
2227
|
+
"type-label",
|
|
2228
|
+
"messages"
|
|
2229
|
+
])) : i("", !0)]),
|
|
2230
|
+
_: 1
|
|
2231
|
+
}, 8, [
|
|
2232
|
+
"open",
|
|
2233
|
+
"title",
|
|
2234
|
+
"description",
|
|
2235
|
+
"close-label",
|
|
2236
|
+
"ui"
|
|
2237
|
+
])) : i("", !0),
|
|
2238
|
+
l(zt, {
|
|
2239
|
+
open: le.value,
|
|
2240
|
+
"onUpdate:open": s[7] ||= (e) => le.value = e,
|
|
2241
|
+
audit: ue.value,
|
|
2242
|
+
"type-label": t.typeLabel,
|
|
2243
|
+
"user-label": t.userLabel,
|
|
2244
|
+
"format-value": t.formatValue,
|
|
2245
|
+
"field-label": t.fieldLabel,
|
|
2246
|
+
messages: t.messages,
|
|
2247
|
+
ui: t.ui?.dialog
|
|
2248
|
+
}, {
|
|
2249
|
+
footer: N(({ audit: e }) => [w(n.$slots, "dialog-actions", { audit: e })]),
|
|
2250
|
+
_: 3
|
|
2251
|
+
}, 8, [
|
|
2252
|
+
"open",
|
|
2253
|
+
"audit",
|
|
2254
|
+
"type-label",
|
|
2255
|
+
"user-label",
|
|
2256
|
+
"format-value",
|
|
2257
|
+
"field-label",
|
|
2258
|
+
"messages",
|
|
2259
|
+
"ui"
|
|
2260
|
+
])
|
|
2261
|
+
], 2));
|
|
2262
|
+
}
|
|
2263
|
+
}, Lr = {
|
|
2264
|
+
AuditTable: Ir,
|
|
2265
|
+
AuditFilters: hn,
|
|
2266
|
+
AuditFilterSelect: en,
|
|
2267
|
+
AuditTimeline: Kn,
|
|
2268
|
+
AuditHistory: qn,
|
|
2269
|
+
AuditHistoryButton: Jn,
|
|
2270
|
+
AuditChanges: vt,
|
|
2271
|
+
AuditChangesDialog: zt,
|
|
2272
|
+
AuditEventBadge: jt
|
|
2273
|
+
}, Rr = { install(e, { messages: t = null, register: n = !0 } = {}) {
|
|
2274
|
+
if (t && e.provide(He, t), n) for (let [t, n] of Object.entries(Lr)) e.component(t, n);
|
|
2275
|
+
} };
|
|
2276
|
+
export { He as AUDITING_MESSAGES, G as AUDIT_EVENTS, vt as AuditChanges, zt as AuditChangesDialog, jt as AuditEventBadge, en as AuditFilterSelect, hn as AuditFilters, qn as AuditHistory, Jn as AuditHistoryButton, Ir as AuditTable, Kn as AuditTimeline, xe as DEFAULT_MESSAGES, Rr as default, Ce as emptyFilters, Me as setAuditingColorScheme, Ne as setAuditingDateFormatter, Pe as shortClassName, Re as toParams, X as useMessages };
|
|
2277
|
+
|
|
2278
|
+
//# sourceMappingURL=auditing-vue.mjs.map
|