@innertia-solutions/innertia-nuxt 0.1.9 → 0.1.11
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/components/DataPreview.vue +323 -0
- package/components/DataTable.vue +12 -12
- package/components/Forms/DatePicker.vue +64 -39
- package/components/Forms/Input.vue +8 -2
- package/components/Forms/Select.vue +56 -20
- package/components/Forms/SelectServer.vue +39 -34
- package/components/PermissionsTree.vue +4 -4
- package/components/Table/Database.vue +5 -5
- package/components/Table/DownloadDropdown.vue +8 -8
- package/components/Table/Enterprise.vue +9 -9
- package/components/Table/FilterDropdown.vue +3 -3
- package/components/Table/Grid.vue +4 -4
- package/components/Table/Kanban.vue +3 -3
- package/components/Table/List.vue +6 -6
- package/components/Table/Standard.vue +69 -324
- package/components/Table/index.vue +13 -13
- package/components/TableExportable.vue +6 -6
- package/components/TableFilter.vue +4 -4
- package/components/Tree/Node.vue +187 -84
- package/components/Tree/Standard.vue +345 -57
- package/composables/useTable.ts +7 -3
- package/css/tokens.css +90 -0
- package/package.json +1 -1
- package/theme.css +2 -0
|
@@ -601,7 +601,7 @@ defineExpose({
|
|
|
601
601
|
:checked="table.getIsAllRowsSelected()"
|
|
602
602
|
:indeterminate="table.getIsSomeRowsSelected()"
|
|
603
603
|
@change="table.getToggleAllRowsSelectedHandler()($event)"
|
|
604
|
-
class="mx-2 shrink-0 border-card-line rounded-
|
|
604
|
+
class="mx-2 shrink-0 border-card-line rounded-control text-blue-900 focus:ring-0 focus:ring-offset-0 dark:bg-card"
|
|
605
605
|
/>
|
|
606
606
|
</template>
|
|
607
607
|
<!-- Regular column header -->
|
|
@@ -659,7 +659,7 @@ defineExpose({
|
|
|
659
659
|
:value="header.column.getFilterValue() ?? ''"
|
|
660
660
|
@input="(e) => header.column.setFilterValue(e.target.value || undefined)"
|
|
661
661
|
:placeholder="`Filtrar ${header.column.columnDef.meta?.label ?? ''}...`"
|
|
662
|
-
class="w-full bg-card border border-card-line rounded-
|
|
662
|
+
class="w-full bg-card border border-card-line rounded-control text-xs text-muted-foreground-1 px-2.5 py-1 focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-400 dark:focus:border-indigo-500 outline-none transition-all"
|
|
663
663
|
/>
|
|
664
664
|
</th>
|
|
665
665
|
</tr>
|
|
@@ -784,7 +784,7 @@ defineExpose({
|
|
|
784
784
|
<!-- Empty state overlays -->
|
|
785
785
|
<div
|
|
786
786
|
v-if="!loading && tableData.length === 0 && !search && !columnFilters.length"
|
|
787
|
-
class="absolute inset-0 z-10 pointer-events-none flex items-center justify-center backdrop-blur-sm bg-card/60 rounded-
|
|
787
|
+
class="absolute inset-0 z-10 pointer-events-none flex items-center justify-center backdrop-blur-sm bg-card/60 rounded-card"
|
|
788
788
|
>
|
|
789
789
|
<slot name="empty">
|
|
790
790
|
<p class="text-muted-foreground text-lg font-medium italic">No hay registros</p>
|
|
@@ -793,7 +793,7 @@ defineExpose({
|
|
|
793
793
|
|
|
794
794
|
<div
|
|
795
795
|
v-if="!loading && tableData.length === 0 && (search || columnFilters.length)"
|
|
796
|
-
class="absolute inset-0 z-10 pointer-events-none flex items-center justify-center backdrop-blur-sm bg-card/60 rounded-
|
|
796
|
+
class="absolute inset-0 z-10 pointer-events-none flex items-center justify-center backdrop-blur-sm bg-card/60 rounded-card"
|
|
797
797
|
>
|
|
798
798
|
<slot name="empty-search">
|
|
799
799
|
<p class="text-muted-foreground text-lg font-medium italic">No hay registros en la búsqueda</p>
|
|
@@ -806,7 +806,7 @@ defineExpose({
|
|
|
806
806
|
<div v-if="loading" :class="gridClass">
|
|
807
807
|
<div v-for="(_, i) in skeletonRows" :key="'gsk-' + i" class="animate-pulse">
|
|
808
808
|
<slot name="grid-skeleton">
|
|
809
|
-
<div class="bg-card rounded-
|
|
809
|
+
<div class="bg-card rounded-card border border-card-line p-4">
|
|
810
810
|
<div class="space-y-3">
|
|
811
811
|
<div class="h-4 bg-surface-1 rounded w-3/4"></div>
|
|
812
812
|
<div class="h-4 bg-surface-1 rounded w-1/2"></div>
|
|
@@ -828,7 +828,7 @@ defineExpose({
|
|
|
828
828
|
:checkable="checkable"
|
|
829
829
|
:toggle-row="() => row.toggleSelected()"
|
|
830
830
|
>
|
|
831
|
-
<div class="bg-card rounded-
|
|
831
|
+
<div class="bg-card rounded-card border border-card-line p-4 hover:shadow-md transition-shadow relative"
|
|
832
832
|
:class="{ 'ring-2 ring-indigo-400 dark:ring-indigo-600': row.getIsSelected() }">
|
|
833
833
|
<div v-if="checkable" class="absolute top-2 left-2 z-10">
|
|
834
834
|
<input type="checkbox" :checked="row.getIsSelected()" @change="row.toggleSelected()"
|
|
@@ -880,11 +880,11 @@ defineExpose({
|
|
|
880
880
|
|
|
881
881
|
<!-- Cache badge -->
|
|
882
882
|
<div v-if="isDataFromCache && cached" class="group relative flex items-center">
|
|
883
|
-
<div class="flex items-center gap-x-1.5 py-1 px-2.5 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 rounded-
|
|
883
|
+
<div class="flex items-center gap-x-1.5 py-1 px-2.5 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 rounded-badge cursor-help hover:bg-emerald-500/20 transition-colors">
|
|
884
884
|
<IconBolt class="size-3.5 fill-current" />
|
|
885
885
|
<span class="text-[10px] font-bold uppercase tracking-wider">Instant</span>
|
|
886
886
|
</div>
|
|
887
|
-
<div class="absolute bottom-full mb-2 left-0 hidden group-hover:block w-48 p-2.5 bg-slate-900 text-white text-[11px] leading-relaxed rounded-
|
|
887
|
+
<div class="absolute bottom-full mb-2 left-0 hidden group-hover:block w-48 p-2.5 bg-slate-900 text-white text-[11px] leading-relaxed rounded-popover shadow-2xl z-50">
|
|
888
888
|
<div class="font-bold mb-1 flex items-center gap-x-1.5 text-emerald-400">
|
|
889
889
|
<IconBolt class="size-3" /> Datos en Caché
|
|
890
890
|
</div>
|
|
@@ -904,7 +904,7 @@ defineExpose({
|
|
|
904
904
|
v-if="!isCustomPerPage"
|
|
905
905
|
:value="pagination.pageSize"
|
|
906
906
|
@change="(e) => handlePerPageChange(e.target.value)"
|
|
907
|
-
class="bg-surface border-none text-[11px] font-bold text-muted-foreground-1 rounded-
|
|
907
|
+
class="bg-surface border-none text-[11px] font-bold text-muted-foreground-1 rounded-control focus:ring-0 cursor-pointer py-1 pl-2 pr-8"
|
|
908
908
|
>
|
|
909
909
|
<option :value="10">10</option>
|
|
910
910
|
<option :value="25">25</option>
|
|
@@ -918,7 +918,7 @@ defineExpose({
|
|
|
918
918
|
:value="pagination.pageSize"
|
|
919
919
|
@change="(e) => table.setPageSize(parseInt(e.target.value) || 10)"
|
|
920
920
|
min="1" max="500"
|
|
921
|
-
class="w-14 bg-surface border-none text-[11px] font-bold text-muted-foreground-1 rounded-
|
|
921
|
+
class="w-14 bg-surface border-none text-[11px] font-bold text-muted-foreground-1 rounded-control focus:ring-2 focus:ring-indigo-500/20 py-1 px-2"
|
|
922
922
|
/>
|
|
923
923
|
<button @click="resetPerPage" class="text-[10px] text-indigo-500 font-bold hover:underline">Volver</button>
|
|
924
924
|
</div>
|
|
@@ -928,7 +928,7 @@ defineExpose({
|
|
|
928
928
|
<nav class="flex justify-end items-center gap-x-1" aria-label="Pagination">
|
|
929
929
|
<button
|
|
930
930
|
type="button"
|
|
931
|
-
class="size-8 flex items-center justify-center rounded-
|
|
931
|
+
class="size-8 flex items-center justify-center rounded-control text-foreground hover:bg-muted-hover disabled:opacity-30"
|
|
932
932
|
:disabled="!table.getCanPreviousPage()"
|
|
933
933
|
@click="table.previousPage()"
|
|
934
934
|
>
|
|
@@ -937,7 +937,7 @@ defineExpose({
|
|
|
937
937
|
</svg>
|
|
938
938
|
</button>
|
|
939
939
|
<div class="flex items-center gap-x-1 mx-2">
|
|
940
|
-
<span class="size-8 flex items-center justify-center text-xs font-bold rounded-
|
|
940
|
+
<span class="size-8 flex items-center justify-center text-xs font-bold rounded-control bg-surface text-foreground">
|
|
941
941
|
{{ pagination.pageIndex + 1 }}
|
|
942
942
|
</span>
|
|
943
943
|
<span class="text-[10px] font-bold text-muted-foreground uppercase mx-1">de</span>
|
|
@@ -945,7 +945,7 @@ defineExpose({
|
|
|
945
945
|
</div>
|
|
946
946
|
<button
|
|
947
947
|
type="button"
|
|
948
|
-
class="size-8 flex items-center justify-center rounded-
|
|
948
|
+
class="size-8 flex items-center justify-center rounded-control text-foreground hover:bg-muted-hover disabled:opacity-30"
|
|
949
949
|
:disabled="!table.getCanNextPage()"
|
|
950
950
|
@click="table.nextPage()"
|
|
951
951
|
>
|
|
@@ -73,7 +73,7 @@ defineExpose({ open: () => { isOpen.value = true } })
|
|
|
73
73
|
@click="isOpen = !isOpen"
|
|
74
74
|
title="Exportar"
|
|
75
75
|
:class="[
|
|
76
|
-
'p-1.5 inline-flex items-center justify-center rounded-
|
|
76
|
+
'p-1.5 inline-flex items-center justify-center rounded-control border transition-colors',
|
|
77
77
|
isOpen
|
|
78
78
|
? 'border-primary/40 bg-primary/10 text-primary'
|
|
79
79
|
: 'border-transparent text-muted-foreground hover:border-card-line hover:bg-muted-hover hover:text-foreground'
|
|
@@ -93,7 +93,7 @@ defineExpose({ open: () => { isOpen.value = true } })
|
|
|
93
93
|
<div
|
|
94
94
|
v-if="isOpen"
|
|
95
95
|
ref="panelRef"
|
|
96
|
-
class="absolute top-full right-0 z-50 mt-1.5 bg-dropdown border border-dropdown-line rounded-
|
|
96
|
+
class="absolute top-full right-0 z-50 mt-1.5 bg-dropdown border border-dropdown-line rounded-popover shadow-2xl p-3 w-64"
|
|
97
97
|
>
|
|
98
98
|
<p class="text-[10px] font-bold text-muted-foreground uppercase tracking-widest mb-3 px-1">Exportar</p>
|
|
99
99
|
|
|
@@ -105,7 +105,7 @@ defineExpose({ open: () => { isOpen.value = true } })
|
|
|
105
105
|
type="button"
|
|
106
106
|
@click="format = f.value"
|
|
107
107
|
:class="[
|
|
108
|
-
'flex flex-col items-center gap-1 py-2 rounded-
|
|
108
|
+
'flex flex-col items-center gap-1 py-2 rounded-control border text-xs font-medium transition-colors',
|
|
109
109
|
format === f.value
|
|
110
110
|
? 'border-primary/40 bg-primary/10 text-primary'
|
|
111
111
|
: 'border-card-line text-muted-foreground-1 hover:bg-muted-hover'
|
|
@@ -126,7 +126,7 @@ defineExpose({ open: () => { isOpen.value = true } })
|
|
|
126
126
|
<input
|
|
127
127
|
v-model="filename"
|
|
128
128
|
type="text"
|
|
129
|
-
class="flex-1
|
|
129
|
+
class="flex-1 innertia-field innertia-field-sm min-w-0"
|
|
130
130
|
/>
|
|
131
131
|
<span class="text-xs text-muted-foreground shrink-0">.{{ format }}</span>
|
|
132
132
|
</div>
|
|
@@ -144,7 +144,7 @@ defineExpose({ open: () => { isOpen.value = true } })
|
|
|
144
144
|
<label
|
|
145
145
|
v-for="col in columns"
|
|
146
146
|
:key="col.key"
|
|
147
|
-
class="flex items-center gap-2 py-1 px-1.5 rounded-
|
|
147
|
+
class="flex items-center gap-2 py-1 px-1.5 rounded-control hover:bg-muted-hover cursor-pointer"
|
|
148
148
|
>
|
|
149
149
|
<input
|
|
150
150
|
type="checkbox"
|
|
@@ -161,7 +161,7 @@ defineExpose({ open: () => { isOpen.value = true } })
|
|
|
161
161
|
<button
|
|
162
162
|
type="button"
|
|
163
163
|
@click="doExport"
|
|
164
|
-
class="w-full py-1.5 px-3 rounded-
|
|
164
|
+
class="w-full py-1.5 px-3 rounded-control bg-primary hover:bg-primary/90 text-white text-sm font-medium transition-colors inline-flex items-center justify-center gap-2"
|
|
165
165
|
>
|
|
166
166
|
<IconDownload class="size-4" stroke="1.5" />
|
|
167
167
|
Exportar
|
|
@@ -41,7 +41,7 @@ const activeCount = computed(() =>
|
|
|
41
41
|
:value="localFilters[col.key] ?? ''"
|
|
42
42
|
@input="updateFilter(col.key, $event.target.value)"
|
|
43
43
|
:placeholder="`Filtrar ${col.label.toLowerCase()}...`"
|
|
44
|
-
class="
|
|
44
|
+
class="innertia-field innertia-field-sm"
|
|
45
45
|
/>
|
|
46
46
|
</div>
|
|
47
47
|
|
|
@@ -63,14 +63,14 @@ const activeCount = computed(() =>
|
|
|
63
63
|
type="date"
|
|
64
64
|
:value="localFilters[col.key]?.from ?? ''"
|
|
65
65
|
@change="updateFilter(col.key, { ...localFilters[col.key], from: $event.target.value || null })"
|
|
66
|
-
class="flex-1
|
|
66
|
+
class="flex-1 innertia-field innertia-field-sm"
|
|
67
67
|
/>
|
|
68
68
|
<span class="text-slate-400 text-xs shrink-0">—</span>
|
|
69
69
|
<input
|
|
70
70
|
type="date"
|
|
71
71
|
:value="localFilters[col.key]?.to ?? ''"
|
|
72
72
|
@change="updateFilter(col.key, { ...localFilters[col.key], to: $event.target.value || null })"
|
|
73
|
-
class="flex-1
|
|
73
|
+
class="flex-1 innertia-field innertia-field-sm"
|
|
74
74
|
/>
|
|
75
75
|
</div>
|
|
76
76
|
</div>
|
|
@@ -82,7 +82,7 @@ const activeCount = computed(() =>
|
|
|
82
82
|
v-if="activeCount > 0"
|
|
83
83
|
type="button"
|
|
84
84
|
@click="clearAll"
|
|
85
|
-
class="w-full py-1.5 px-3 text-sm text-rose-600 dark:text-rose-400 hover:bg-rose-50 dark:hover:bg-rose-500/10 rounded-
|
|
85
|
+
class="w-full py-1.5 px-3 text-sm text-rose-600 dark:text-rose-400 hover:bg-rose-50 dark:hover:bg-rose-500/10 rounded-control transition-colors flex items-center justify-center gap-1.5"
|
|
86
86
|
>
|
|
87
87
|
<svg class="size-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
|
88
88
|
Limpiar filtros
|
package/components/Tree/Node.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { IconChevronDown, IconChevronRight, IconLoader2 } from '@tabler/icons-vue'
|
|
2
|
+
import { IconChevronDown, IconChevronRight, IconLoader2, IconPlus, IconMinus } from '@tabler/icons-vue'
|
|
3
3
|
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
node: { type: Object, required: true },
|
|
@@ -12,9 +12,14 @@ const props = defineProps({
|
|
|
12
12
|
clickableRows: { type: Boolean, default: true },
|
|
13
13
|
nameColKey: { type: String, default: 'name' },
|
|
14
14
|
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
// 'table' — clásico con filas y columnas
|
|
16
|
+
// 'list' — vista compacta estilo file-tree (sin tabla, sin bordes de fila)
|
|
17
|
+
variant: { type: String, default: 'table' },
|
|
18
|
+
|
|
19
|
+
// Checkbox selection (con cascada padre/hijo)
|
|
20
|
+
checkable: { type: Boolean, default: false },
|
|
21
|
+
checkedSet: { type: Object, default: null },
|
|
22
|
+
indeterminateSet: { type: Object, default: null },
|
|
18
23
|
|
|
19
24
|
// Column visibility — map { [colKey]: boolean }. Si null, todas visibles.
|
|
20
25
|
columnVisibility: { type: Object, default: null },
|
|
@@ -25,7 +30,8 @@ const emit = defineEmits(['toggle', 'row-click', 'check'])
|
|
|
25
30
|
const isExpanded = computed(() => props.expanded.has(props.node.id))
|
|
26
31
|
const isLoading = computed(() => props.loadingSet.has(props.node.id))
|
|
27
32
|
const hasChildren = computed(() => !!props.node.has_children)
|
|
28
|
-
const isChecked
|
|
33
|
+
const isChecked = computed(() => props.checkable && props.checkedSet?.has(props.node.id))
|
|
34
|
+
const isIndeterminate = computed(() => props.checkable && !isChecked.value && props.indeterminateSet?.has(props.node.id))
|
|
29
35
|
|
|
30
36
|
const children = computed(() => {
|
|
31
37
|
if (Array.isArray(props.node.children)) return props.node.children
|
|
@@ -37,12 +43,17 @@ const visibleColumns = computed(() => {
|
|
|
37
43
|
return props.columns.filter(c => props.columnVisibility[c.key] !== false)
|
|
38
44
|
})
|
|
39
45
|
|
|
46
|
+
// Columnas adicionales (excluyendo la principal con el chevron)
|
|
47
|
+
const extraColumns = computed(() =>
|
|
48
|
+
visibleColumns.value.filter(c => c.key !== props.nameColKey)
|
|
49
|
+
)
|
|
50
|
+
|
|
40
51
|
const onToggle = (e) => {
|
|
41
52
|
e?.stopPropagation?.()
|
|
42
53
|
emit('toggle', props.node)
|
|
43
54
|
}
|
|
44
55
|
|
|
45
|
-
const onRowClick = (
|
|
56
|
+
const onRowClick = () => {
|
|
46
57
|
if (!props.clickableRows) return
|
|
47
58
|
if (props.rowHref) return
|
|
48
59
|
emit('row-click', props.node)
|
|
@@ -62,94 +73,186 @@ const indentPx = computed(() => props.depth * 20)
|
|
|
62
73
|
</script>
|
|
63
74
|
|
|
64
75
|
<template>
|
|
65
|
-
<!--
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
<!-- ════════════ Variante 'table' (clásica con <tr>) ════════════ -->
|
|
77
|
+
<template v-if="variant === 'table'">
|
|
78
|
+
<tr
|
|
79
|
+
class="bg-card hover:bg-layer-hover transition-colors"
|
|
80
|
+
:class="[
|
|
81
|
+
clickableRows ? 'cursor-pointer' : '',
|
|
82
|
+
isChecked ? 'bg-primary/5' : '',
|
|
83
|
+
]"
|
|
84
|
+
@click="onRowClick"
|
|
85
|
+
>
|
|
86
|
+
<td v-if="checkable" class="w-10 px-4 py-2.5 align-middle" @click.stop>
|
|
87
|
+
<input
|
|
88
|
+
type="checkbox"
|
|
89
|
+
:checked="isChecked"
|
|
90
|
+
:indeterminate.prop="isIndeterminate"
|
|
91
|
+
class="size-4 rounded border-card-line text-primary focus:ring-primary/30 cursor-pointer"
|
|
92
|
+
@change="onCheck"
|
|
93
|
+
/>
|
|
94
|
+
</td>
|
|
95
|
+
|
|
96
|
+
<td
|
|
97
|
+
v-for="col in visibleColumns"
|
|
98
|
+
:key="col.key"
|
|
99
|
+
class="px-4 py-2.5 text-sm align-middle"
|
|
100
|
+
>
|
|
101
|
+
<template v-if="col.key === nameColKey">
|
|
102
|
+
<div class="flex items-center min-w-0" :style="{ paddingLeft: indentPx + 'px' }">
|
|
103
|
+
<button
|
|
104
|
+
v-if="hasChildren"
|
|
105
|
+
type="button"
|
|
106
|
+
class="size-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground mr-1.5 shrink-0"
|
|
107
|
+
@click.stop="onToggle"
|
|
108
|
+
>
|
|
109
|
+
<IconLoader2 v-if="isLoading" class="size-3.5 animate-spin" />
|
|
110
|
+
<IconChevronDown v-else-if="isExpanded" class="size-3.5" />
|
|
111
|
+
<IconChevronRight v-else class="size-3.5" />
|
|
112
|
+
</button>
|
|
113
|
+
<span v-else class="size-5 mr-1.5 shrink-0" />
|
|
114
|
+
|
|
115
|
+
<component
|
|
116
|
+
:is="href ? 'NuxtLink' : 'span'"
|
|
117
|
+
:to="href || undefined"
|
|
118
|
+
class="min-w-0 flex items-center gap-x-2 truncate"
|
|
119
|
+
:class="href ? 'hover:text-primary' : ''"
|
|
120
|
+
@click="href ? $event.stopPropagation() : null"
|
|
121
|
+
>
|
|
122
|
+
<slot :name="`cell-${col.key}`" :row="node" :value="node[col.key]">
|
|
123
|
+
<span class="truncate font-medium text-foreground">{{ node[col.key] }}</span>
|
|
124
|
+
</slot>
|
|
125
|
+
</component>
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<template v-else>
|
|
130
|
+
<div class="truncate text-muted-foreground-1">
|
|
131
|
+
<slot :name="`cell-${col.key}`" :row="node" :value="node[col.key]">
|
|
132
|
+
{{ node[col.key] ?? '—' }}
|
|
133
|
+
</slot>
|
|
134
|
+
</div>
|
|
135
|
+
</template>
|
|
136
|
+
</td>
|
|
137
|
+
</tr>
|
|
138
|
+
|
|
139
|
+
<template v-if="isExpanded && children.length">
|
|
140
|
+
<TreeNode
|
|
141
|
+
v-for="child in children"
|
|
142
|
+
:key="child.id"
|
|
143
|
+
:node="child"
|
|
144
|
+
:columns="columns"
|
|
145
|
+
:depth="depth + 1"
|
|
146
|
+
:variant="variant"
|
|
147
|
+
:expanded="expanded"
|
|
148
|
+
:loading-set="loadingSet"
|
|
149
|
+
:children-by-id="childrenById"
|
|
150
|
+
:row-href="rowHref"
|
|
151
|
+
:clickable-rows="clickableRows"
|
|
152
|
+
:name-col-key="nameColKey"
|
|
153
|
+
:checkable="checkable"
|
|
154
|
+
:checked-set="checkedSet"
|
|
155
|
+
:indeterminate-set="indeterminateSet"
|
|
156
|
+
:column-visibility="columnVisibility"
|
|
157
|
+
@toggle="(n) => emit('toggle', n)"
|
|
158
|
+
@row-click="(n) => emit('row-click', n)"
|
|
159
|
+
@check="(n) => emit('check', n)"
|
|
160
|
+
>
|
|
161
|
+
<template v-for="col in columns" :key="col.key" #[`cell-${col.key}`]="slotProps">
|
|
162
|
+
<slot :name="`cell-${col.key}`" v-bind="slotProps" />
|
|
163
|
+
</template>
|
|
164
|
+
</TreeNode>
|
|
165
|
+
</template>
|
|
166
|
+
</template>
|
|
167
|
+
|
|
168
|
+
<!-- ════════════ Variante 'list' (compacta tipo file-tree) ════════════ -->
|
|
169
|
+
<template v-else>
|
|
170
|
+
<div
|
|
171
|
+
class="group flex items-center gap-1.5 px-2 py-1 rounded-control hover:bg-muted-hover transition-colors"
|
|
172
|
+
:class="[
|
|
173
|
+
clickableRows ? 'cursor-pointer' : '',
|
|
174
|
+
isChecked ? 'bg-primary/5' : '',
|
|
175
|
+
]"
|
|
176
|
+
:style="{ paddingLeft: (indentPx + 8) + 'px' }"
|
|
177
|
+
@click="onRowClick"
|
|
178
|
+
>
|
|
179
|
+
<!-- Expand button (+/-) o spacer -->
|
|
180
|
+
<button
|
|
181
|
+
v-if="hasChildren"
|
|
182
|
+
type="button"
|
|
183
|
+
class="size-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground shrink-0"
|
|
184
|
+
@click.stop="onToggle"
|
|
185
|
+
>
|
|
186
|
+
<IconLoader2 v-if="isLoading" class="size-3.5 animate-spin" />
|
|
187
|
+
<IconMinus v-else-if="isExpanded" class="size-3.5" />
|
|
188
|
+
<IconPlus v-else class="size-3.5" />
|
|
189
|
+
</button>
|
|
190
|
+
<span v-else class="size-5 shrink-0" />
|
|
191
|
+
|
|
192
|
+
<!-- Checkbox -->
|
|
76
193
|
<input
|
|
194
|
+
v-if="checkable"
|
|
77
195
|
type="checkbox"
|
|
78
196
|
:checked="isChecked"
|
|
79
|
-
|
|
197
|
+
:indeterminate.prop="isIndeterminate"
|
|
198
|
+
class="size-4 rounded border-card-line text-primary focus:ring-primary/30 cursor-pointer shrink-0"
|
|
199
|
+
@click.stop
|
|
80
200
|
@change="onCheck"
|
|
81
201
|
/>
|
|
82
|
-
</td>
|
|
83
202
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
@click.stop="onToggle"
|
|
97
|
-
>
|
|
98
|
-
<IconLoader2 v-if="isLoading" class="size-3.5 animate-spin" />
|
|
99
|
-
<IconChevronDown v-else-if="isExpanded" class="size-3.5" />
|
|
100
|
-
<IconChevronRight v-else class="size-3.5" />
|
|
101
|
-
</button>
|
|
102
|
-
<span v-else class="size-5 mr-1.5 shrink-0" />
|
|
103
|
-
|
|
104
|
-
<component
|
|
105
|
-
:is="href ? 'NuxtLink' : 'span'"
|
|
106
|
-
:to="href || undefined"
|
|
107
|
-
class="min-w-0 flex items-center gap-x-2 truncate"
|
|
108
|
-
:class="href ? 'hover:text-primary' : ''"
|
|
109
|
-
@click.stop
|
|
110
|
-
>
|
|
111
|
-
<slot :name="`cell-${col.key}`" :row="node" :value="node[col.key]">
|
|
112
|
-
<span class="truncate font-medium text-foreground">{{ node[col.key] }}</span>
|
|
113
|
-
</slot>
|
|
114
|
-
</component>
|
|
115
|
-
</div>
|
|
116
|
-
</template>
|
|
203
|
+
<!-- Label (columna principal) -->
|
|
204
|
+
<component
|
|
205
|
+
:is="href ? 'NuxtLink' : 'span'"
|
|
206
|
+
:to="href || undefined"
|
|
207
|
+
class="min-w-0 flex items-center gap-x-2 truncate text-sm"
|
|
208
|
+
:class="href ? 'hover:text-primary' : ''"
|
|
209
|
+
@click="href ? $event.stopPropagation() : null"
|
|
210
|
+
>
|
|
211
|
+
<slot :name="`cell-${nameColKey}`" :row="node" :value="node[nameColKey]">
|
|
212
|
+
<span class="truncate text-foreground">{{ node[nameColKey] }}</span>
|
|
213
|
+
</slot>
|
|
214
|
+
</component>
|
|
117
215
|
|
|
118
|
-
<!--
|
|
119
|
-
<
|
|
120
|
-
<
|
|
216
|
+
<!-- Columnas extra: a la derecha, mutadas -->
|
|
217
|
+
<div v-if="extraColumns.length" class="ml-auto flex items-center gap-3 text-xs text-muted-foreground shrink-0">
|
|
218
|
+
<span v-for="col in extraColumns" :key="col.key" class="tabular-nums">
|
|
121
219
|
<slot :name="`cell-${col.key}`" :row="node" :value="node[col.key]">
|
|
122
220
|
{{ node[col.key] ?? '—' }}
|
|
123
221
|
</slot>
|
|
124
|
-
</
|
|
125
|
-
</
|
|
126
|
-
</
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
v-for="child in children"
|
|
133
|
-
:key="child.id"
|
|
134
|
-
:node="child"
|
|
135
|
-
:columns="columns"
|
|
136
|
-
:depth="depth + 1"
|
|
137
|
-
:expanded="expanded"
|
|
138
|
-
:loading-set="loadingSet"
|
|
139
|
-
:children-by-id="childrenById"
|
|
140
|
-
:row-href="rowHref"
|
|
141
|
-
:clickable-rows="clickableRows"
|
|
142
|
-
:name-col-key="nameColKey"
|
|
143
|
-
:checkable="checkable"
|
|
144
|
-
:checked-set="checkedSet"
|
|
145
|
-
:column-visibility="columnVisibility"
|
|
146
|
-
@toggle="(n) => emit('toggle', n)"
|
|
147
|
-
@row-click="(n) => emit('row-click', n)"
|
|
148
|
-
@check="(n) => emit('check', n)"
|
|
222
|
+
</span>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
|
|
226
|
+
<!-- Children con indent guide vertical -->
|
|
227
|
+
<div
|
|
228
|
+
v-if="isExpanded && children.length"
|
|
229
|
+
class="relative"
|
|
149
230
|
>
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
231
|
+
<TreeNode
|
|
232
|
+
v-for="child in children"
|
|
233
|
+
:key="child.id"
|
|
234
|
+
:node="child"
|
|
235
|
+
:columns="columns"
|
|
236
|
+
:depth="depth + 1"
|
|
237
|
+
:variant="variant"
|
|
238
|
+
:expanded="expanded"
|
|
239
|
+
:loading-set="loadingSet"
|
|
240
|
+
:children-by-id="childrenById"
|
|
241
|
+
:row-href="rowHref"
|
|
242
|
+
:clickable-rows="clickableRows"
|
|
243
|
+
:name-col-key="nameColKey"
|
|
244
|
+
:checkable="checkable"
|
|
245
|
+
:checked-set="checkedSet"
|
|
246
|
+
:indeterminate-set="indeterminateSet"
|
|
247
|
+
:column-visibility="columnVisibility"
|
|
248
|
+
@toggle="(n) => emit('toggle', n)"
|
|
249
|
+
@row-click="(n) => emit('row-click', n)"
|
|
250
|
+
@check="(n) => emit('check', n)"
|
|
251
|
+
>
|
|
252
|
+
<template v-for="col in columns" :key="col.key" #[`cell-${col.key}`]="slotProps">
|
|
253
|
+
<slot :name="`cell-${col.key}`" v-bind="slotProps" />
|
|
254
|
+
</template>
|
|
255
|
+
</TreeNode>
|
|
256
|
+
</div>
|
|
154
257
|
</template>
|
|
155
258
|
</template>
|