@innertia-solutions/innertia-nuxt 0.1.1
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/.github/workflows/auto-publish.yml +64 -0
- package/.github/workflows/release.yml +59 -0
- package/README.md +60 -0
- package/app.config.ts +70 -0
- package/components/Admin/Base.vue +144 -0
- package/components/Admin/Header.vue +32 -0
- package/components/Admin/Page.vue +65 -0
- package/components/Admin/PageHeader.vue +31 -0
- package/components/App/Button.vue +59 -0
- package/components/App/DevEnvironmentBar.vue +43 -0
- package/components/App/Dropdown.vue +286 -0
- package/components/App/EmptyState.vue +433 -0
- package/components/App/LoadingState.vue +40 -0
- package/components/App/PageLoadingSpinner.vue +118 -0
- package/components/App/PreviewDock.vue +64 -0
- package/components/App/SwitchColorTheme.vue +51 -0
- package/components/App/Tag.vue +193 -0
- package/components/DataTable.vue +713 -0
- package/components/Forms/DatePicker.vue +255 -0
- package/components/Forms/Input.vue +75 -0
- package/components/Forms/Select.vue +100 -0
- package/components/Forms/SelectServer.vue +726 -0
- package/components/Layout/Admin.vue +32 -0
- package/components/Layout/Auth.vue +29 -0
- package/components/Layout/SidebarWithAppColumn.vue +388 -0
- package/components/Layout/TopBar.vue +113 -0
- package/components/MobileBlocker.vue +85 -0
- package/components/MobileLoginPicker.vue +83 -0
- package/components/Modal/Base.vue +29 -0
- package/components/Modal/DeleteConfirm.vue +48 -0
- package/components/Modal.vue +103 -0
- package/components/Nav/Tabs.vue +55 -0
- package/components/PermissionsTree.vue +272 -0
- package/components/Table/Database.vue +183 -0
- package/components/Table/DownloadDropdown.vue +111 -0
- package/components/Table/Enterprise.vue +540 -0
- package/components/Table/FilterDropdown.vue +226 -0
- package/components/Table/Grid.vue +62 -0
- package/components/Table/Kanban.vue +188 -0
- package/components/Table/List.vue +128 -0
- package/components/Table/PreviewTimeline.vue +118 -0
- package/components/Table/Standard.vue +1217 -0
- package/components/Table/index.vue +974 -0
- package/components/TableExportable.vue +172 -0
- package/components/TableFilter.vue +93 -0
- package/components/Toast/Alert.vue +113 -0
- package/components/Toast/Container.vue +34 -0
- package/components/Toast/Notification.vue +45 -0
- package/components/Toast/Process.vue +88 -0
- package/composables/useApi.js +95 -0
- package/composables/useApp.ts +46 -0
- package/composables/useAuth.js +82 -0
- package/composables/useContext.js +44 -0
- package/composables/useDate.js +241 -0
- package/composables/useDevice.js +21 -0
- package/composables/useDockedPreviews.js +56 -0
- package/composables/useDownload.js +87 -0
- package/composables/useEntity.js +82 -0
- package/composables/useForm.js +119 -0
- package/composables/useInnertiaMode.ts +25 -0
- package/composables/useMobileGuard.ts +81 -0
- package/composables/useNotifications.js +22 -0
- package/composables/usePermissions.js +23 -0
- package/composables/useRealtime.js +123 -0
- package/composables/useRequestInterceptors.js +27 -0
- package/composables/useRoles.js +53 -0
- package/composables/useRutFormatter.js +39 -0
- package/composables/useTable.ts +94 -0
- package/composables/useTablePreferences.ts +33 -0
- package/composables/useTenant.js +27 -0
- package/composables/useTimeAgo.js +37 -0
- package/composables/useToast.js +69 -0
- package/composables/useUserRealtime.js +17 -0
- package/composables/useUsers.js +111 -0
- package/css/themes/autumn.css +401 -0
- package/css/themes/bubblegum.css +408 -0
- package/css/themes/cashmere.css +412 -0
- package/css/themes/harvest.css +416 -0
- package/css/themes/moon.css +140 -0
- package/css/themes/ocean.css +273 -0
- package/css/themes/olive.css +413 -0
- package/css/themes/retro.css +431 -0
- package/css/themes/theme.css +725 -0
- package/error.vue +78 -0
- package/middleware/01.detect-subdomain.global.ts +43 -0
- package/middleware/02.validate-tenant.global.ts +67 -0
- package/middleware/03.apps.global.ts +88 -0
- package/middleware/auth.ts +9 -0
- package/middleware/guest.ts +9 -0
- package/nuxt.config.ts +42 -0
- package/package.json +60 -0
- package/pages/tenant-error.vue +50 -0
- package/plugins/api-auth.ts +12 -0
- package/plugins/api-tenant.client.ts +21 -0
- package/plugins/appearance.ts +8 -0
- package/plugins/auth-init.ts +34 -0
- package/plugins/dark-state.client.ts +29 -0
- package/plugins/dockedPreviewsSync.client.js +17 -0
- package/plugins/preline.client.ts +68 -0
- package/plugins/theme.client.ts +7 -0
- package/plugins/vue-query.ts +29 -0
- package/public/init-theme.js +15 -0
- package/spark.css +721 -0
- package/stores/auth.js +130 -0
- package/stores/dockedPreviews.js +34 -0
- package/stores/notifications.js +24 -0
- package/stores/tenant.js +54 -0
- package/stores/toast.js +129 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
endpoint: { type: String, required: true },
|
|
4
|
+
})
|
|
5
|
+
|
|
6
|
+
const api = useApi()
|
|
7
|
+
const events = ref([])
|
|
8
|
+
const pending = ref(false)
|
|
9
|
+
const error = ref(null)
|
|
10
|
+
|
|
11
|
+
const fetchHistory = async () => {
|
|
12
|
+
pending.value = true
|
|
13
|
+
error.value = null
|
|
14
|
+
try {
|
|
15
|
+
const data = await api.get(props.endpoint)
|
|
16
|
+
events.value = Array.isArray(data) ? data : (data.data ?? [])
|
|
17
|
+
} catch (e) {
|
|
18
|
+
error.value = e
|
|
19
|
+
} finally {
|
|
20
|
+
pending.value = false
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const refresh = fetchHistory
|
|
25
|
+
|
|
26
|
+
watch(() => props.endpoint, fetchHistory, { immediate: true })
|
|
27
|
+
|
|
28
|
+
const typeConfig = {
|
|
29
|
+
created: { color: 'bg-green-500', label: 'Creado', textColor: 'text-green-600 dark:text-green-400' },
|
|
30
|
+
updated: { color: 'bg-blue-500', label: 'Actualizado', textColor: 'text-blue-600 dark:text-blue-400' },
|
|
31
|
+
deleted: { color: 'bg-red-500', label: 'Eliminado', textColor: 'text-red-600 dark:text-red-400' },
|
|
32
|
+
restored: { color: 'bg-amber-500', label: 'Restaurado', textColor: 'text-amber-600 dark:text-amber-400' },
|
|
33
|
+
default: { color: 'bg-muted-foreground', label: 'Evento', textColor: 'text-muted-foreground' },
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const getConfig = (type) => typeConfig[type] ?? typeConfig.default
|
|
37
|
+
|
|
38
|
+
const formatDate = (iso) => {
|
|
39
|
+
if (!iso) return ''
|
|
40
|
+
const d = new Date(iso)
|
|
41
|
+
return d.toLocaleDateString('es-CL', { day: '2-digit', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' })
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<div class="px-4 py-3">
|
|
47
|
+
|
|
48
|
+
<!-- Loading -->
|
|
49
|
+
<div v-if="pending" class="flex flex-col gap-3">
|
|
50
|
+
<div v-for="i in 3" :key="i" class="flex gap-3 animate-pulse">
|
|
51
|
+
<div class="flex flex-col items-center gap-1 shrink-0">
|
|
52
|
+
<div class="size-2.5 rounded-full bg-muted mt-1.5" />
|
|
53
|
+
<div class="w-px flex-1 bg-muted min-h-8" />
|
|
54
|
+
</div>
|
|
55
|
+
<div class="space-y-1.5 pb-4 flex-1">
|
|
56
|
+
<div class="h-3 w-24 bg-muted rounded" />
|
|
57
|
+
<div class="h-3 w-40 bg-muted rounded" />
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<!-- Error -->
|
|
63
|
+
<div v-else-if="error" class="text-center py-6">
|
|
64
|
+
<p class="text-sm text-red-500">No se pudo cargar la bitácora</p>
|
|
65
|
+
<button @click="refresh()" class="mt-2 text-xs text-muted-foreground hover:text-foreground underline">Reintentar</button>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<!-- Empty -->
|
|
69
|
+
<div v-else-if="!events.length" class="text-center py-8">
|
|
70
|
+
<p class="text-sm text-muted-foreground">Sin registros en la bitácora</p>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<!-- Timeline -->
|
|
74
|
+
<div v-else class="flex flex-col">
|
|
75
|
+
<div
|
|
76
|
+
v-for="(event, idx) in events"
|
|
77
|
+
:key="event.id ?? idx"
|
|
78
|
+
class="flex gap-3"
|
|
79
|
+
>
|
|
80
|
+
<!-- Dot + line -->
|
|
81
|
+
<div class="flex flex-col items-center shrink-0">
|
|
82
|
+
<div class="size-2.5 rounded-full mt-1.5 shrink-0" :class="getConfig(event.type).color" />
|
|
83
|
+
<div v-if="idx < events.length - 1" class="w-px flex-1 bg-card-line min-h-4 my-1" />
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<!-- Content -->
|
|
87
|
+
<div class="pb-4 flex-1 min-w-0">
|
|
88
|
+
<div class="flex items-baseline gap-2 flex-wrap">
|
|
89
|
+
<span class="text-xs font-semibold" :class="getConfig(event.type).textColor">
|
|
90
|
+
{{ event.action ?? getConfig(event.type).label }}
|
|
91
|
+
</span>
|
|
92
|
+
<span class="text-[10px] text-muted-foreground">{{ formatDate(event.created_at) }}</span>
|
|
93
|
+
</div>
|
|
94
|
+
<p v-if="event.description" class="text-xs text-foreground mt-0.5">{{ event.description }}</p>
|
|
95
|
+
<p v-if="event.user?.name" class="text-[10px] text-muted-foreground mt-0.5">por {{ event.user.name }}</p>
|
|
96
|
+
|
|
97
|
+
<!-- Properties diff -->
|
|
98
|
+
<div v-if="event.properties && Object.keys(event.properties).length" class="mt-1.5 space-y-0.5">
|
|
99
|
+
<div
|
|
100
|
+
v-for="(val, field) in event.properties"
|
|
101
|
+
:key="field"
|
|
102
|
+
class="flex items-center gap-1.5 text-[10px] text-muted-foreground bg-surface rounded px-1.5 py-0.5"
|
|
103
|
+
>
|
|
104
|
+
<span class="font-medium text-foreground">{{ field }}</span>
|
|
105
|
+
<span v-if="val?.old !== undefined">
|
|
106
|
+
<span class="line-through opacity-60">{{ val.old ?? '—' }}</span>
|
|
107
|
+
<span class="mx-1">→</span>
|
|
108
|
+
<span>{{ val.new ?? '—' }}</span>
|
|
109
|
+
</span>
|
|
110
|
+
<span v-else>{{ val }}</span>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
</div>
|
|
118
|
+
</template>
|