@innertia-solutions/nuxt-theme-spark 0.1.119 → 0.1.120
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.
|
@@ -17,7 +17,6 @@ const props = defineProps({
|
|
|
17
17
|
showExport: { type: Boolean, default: true },
|
|
18
18
|
filters: { type: Array, default: () => [] },
|
|
19
19
|
splitRatio: { type: Number, default: 60 },
|
|
20
|
-
historyEndpoint: { type: Function, default: null },
|
|
21
20
|
})
|
|
22
21
|
|
|
23
22
|
const resolvedEndpoint = computed(() => props.table?.endpoint ?? props.endpoint)
|
|
@@ -64,10 +63,14 @@ const previewCacheKey = computed(() => `table-preview-${resolvedName.value}`)
|
|
|
64
63
|
const previewFromCache = ref(false)
|
|
65
64
|
const closePreview = () => { previewRow.value = null }
|
|
66
65
|
|
|
67
|
-
const previewTab
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
)
|
|
66
|
+
const previewTab = ref('datos')
|
|
67
|
+
const tableMeta = ref(null)
|
|
68
|
+
|
|
69
|
+
const hasHistory = computed(() => !!tableMeta.value?.has_history)
|
|
70
|
+
const resolvedHistoryEndpoint = computed(() => {
|
|
71
|
+
if (!hasHistory.value || !previewRow.value?.id || !tableMeta.value?.entity_type) return null
|
|
72
|
+
return `history/${tableMeta.value.entity_type}/${previewRow.value.id}`
|
|
73
|
+
})
|
|
71
74
|
|
|
72
75
|
watch(previewRow, () => { previewTab.value = 'datos' })
|
|
73
76
|
|
|
@@ -89,6 +92,7 @@ watch(previewRow, (row) => {
|
|
|
89
92
|
// When data reloads, update previewRow with fresh data — close silently if deleted
|
|
90
93
|
const handleLoaded = (res) => {
|
|
91
94
|
emit('loaded', res)
|
|
95
|
+
if (res?.meta) tableMeta.value = res.meta
|
|
92
96
|
if (previewRow.value && Array.isArray(res?.data)) {
|
|
93
97
|
const fresh = res.data.find(r => r.id === previewRow.value.id)
|
|
94
98
|
if (fresh) previewRow.value = fresh
|
|
@@ -349,7 +353,7 @@ defineExpose({ getSelectedRows, reload, clearCache, exportTable, tableRef })
|
|
|
349
353
|
</div>
|
|
350
354
|
|
|
351
355
|
<!-- Tabs — bottom -->
|
|
352
|
-
<div v-if="
|
|
356
|
+
<div v-if="hasHistory" class="shrink-0 flex border-t border-card-line">
|
|
353
357
|
<button
|
|
354
358
|
type="button"
|
|
355
359
|
@click="previewTab = 'datos'"
|