@innertia-solutions/innertia-nuxt 0.1.32 → 0.1.34
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/Tree/Node.vue
CHANGED
|
@@ -23,10 +23,14 @@ const props = defineProps({
|
|
|
23
23
|
|
|
24
24
|
// Column visibility — map { [colKey]: boolean }. Si null, todas visibles.
|
|
25
25
|
columnVisibility: { type: Object, default: null },
|
|
26
|
+
|
|
27
|
+
// Resalta la fila cuyo id coincide (selección externa via @row-click).
|
|
28
|
+
selectedId: { type: [String, Number], default: null },
|
|
26
29
|
})
|
|
27
30
|
|
|
28
31
|
const emit = defineEmits(['toggle', 'row-click', 'check'])
|
|
29
32
|
|
|
33
|
+
const isSelected = computed(() => props.selectedId != null && props.node.id === props.selectedId)
|
|
30
34
|
const isExpanded = computed(() => props.expanded.has(props.node.id))
|
|
31
35
|
const isLoading = computed(() => props.loadingSet.has(props.node.id))
|
|
32
36
|
const hasChildren = computed(() => !!props.node.has_children)
|
|
@@ -79,7 +83,7 @@ const indentPx = computed(() => props.depth * 20)
|
|
|
79
83
|
class="bg-card hover:bg-layer-hover transition-colors"
|
|
80
84
|
:class="[
|
|
81
85
|
clickableRows ? 'cursor-pointer' : '',
|
|
82
|
-
isChecked ? 'bg-primary/5' : '',
|
|
86
|
+
isSelected ? 'bg-primary/10 hover:bg-primary/10' : (isChecked ? 'bg-primary/5' : ''),
|
|
83
87
|
]"
|
|
84
88
|
@click="onRowClick"
|
|
85
89
|
>
|
|
@@ -154,6 +158,7 @@ const indentPx = computed(() => props.depth * 20)
|
|
|
154
158
|
:checked-set="checkedSet"
|
|
155
159
|
:indeterminate-set="indeterminateSet"
|
|
156
160
|
:column-visibility="columnVisibility"
|
|
161
|
+
:selected-id="selectedId"
|
|
157
162
|
@toggle="(n) => emit('toggle', n)"
|
|
158
163
|
@row-click="(n) => emit('row-click', n)"
|
|
159
164
|
@check="(n) => emit('check', n)"
|
|
@@ -171,7 +176,7 @@ const indentPx = computed(() => props.depth * 20)
|
|
|
171
176
|
class="group flex items-center gap-1.5 px-2 py-1 rounded-control hover:bg-muted-hover transition-colors"
|
|
172
177
|
:class="[
|
|
173
178
|
clickableRows ? 'cursor-pointer' : '',
|
|
174
|
-
isChecked ? 'bg-primary/5' : '',
|
|
179
|
+
isSelected ? 'bg-primary/10 hover:bg-primary/10' : (isChecked ? 'bg-primary/5' : ''),
|
|
175
180
|
]"
|
|
176
181
|
:style="{ paddingLeft: (indentPx + 8) + 'px' }"
|
|
177
182
|
@click="onRowClick"
|
|
@@ -245,6 +250,7 @@ const indentPx = computed(() => props.depth * 20)
|
|
|
245
250
|
:checked-set="checkedSet"
|
|
246
251
|
:indeterminate-set="indeterminateSet"
|
|
247
252
|
:column-visibility="columnVisibility"
|
|
253
|
+
:selected-id="selectedId"
|
|
248
254
|
@toggle="(n) => emit('toggle', n)"
|
|
249
255
|
@row-click="(n) => emit('row-click', n)"
|
|
250
256
|
@check="(n) => emit('check', n)"
|
|
@@ -75,6 +75,9 @@ const props = defineProps({
|
|
|
75
75
|
autoClosePreview: { type: Boolean, default: true },
|
|
76
76
|
/** Porcentaje inicial de la tabla (0-100). El resto lo ocupa el preview. */
|
|
77
77
|
splitRatio: { type: Number, default: 55 },
|
|
78
|
+
|
|
79
|
+
// Resalta la fila seleccionada (id del nodo). Para selección externa via @row-click.
|
|
80
|
+
selectedId: { type: [String, Number], default: null },
|
|
78
81
|
})
|
|
79
82
|
|
|
80
83
|
const sizeStyle = computed(() => {
|
|
@@ -217,7 +220,8 @@ const fetchInitial = async () => {
|
|
|
217
220
|
* Útil tras mutar un nodo (ej. marcar revisado) sin remontar el componente.
|
|
218
221
|
*/
|
|
219
222
|
const reload = async () => {
|
|
220
|
-
loading
|
|
223
|
+
// No tocamos `loading` (eso dispara el skeleton y hace desaparecer el árbol).
|
|
224
|
+
// Solo `isFetching` → spinner sutil, el árbol queda visible durante el refresh.
|
|
221
225
|
isFetching.value = true
|
|
222
226
|
isDataFromCache.value = false
|
|
223
227
|
try {
|
|
@@ -241,7 +245,6 @@ const reload = async () => {
|
|
|
241
245
|
} catch (e) {
|
|
242
246
|
console.error('[Tree.Standard] reload failed:', e)
|
|
243
247
|
} finally {
|
|
244
|
-
loading.value = false
|
|
245
248
|
isFetching.value = false
|
|
246
249
|
}
|
|
247
250
|
}
|
|
@@ -627,6 +630,9 @@ defineExpose({
|
|
|
627
630
|
<!-- Secondary actions -->
|
|
628
631
|
<div class="ml-auto flex items-center gap-1">
|
|
629
632
|
|
|
633
|
+
<!-- Spinner de refresco (reload preservando expansión) -->
|
|
634
|
+
<IconLoader2 v-if="isFetching && !loading" class="size-4 text-muted-foreground animate-spin" />
|
|
635
|
+
|
|
630
636
|
<!-- Instant + Reload SIEMPRE primero cuando infoPosition === 'none' -->
|
|
631
637
|
<InfoToolbar
|
|
632
638
|
v-if="infoPosition === 'none'"
|
|
@@ -861,6 +867,7 @@ defineExpose({
|
|
|
861
867
|
:checked-set="checkedSet"
|
|
862
868
|
:indeterminate-set="indeterminateSet"
|
|
863
869
|
:column-visibility="columnVisibility"
|
|
870
|
+
:selected-id="selectedId"
|
|
864
871
|
@toggle="toggle"
|
|
865
872
|
@check="toggleCheck"
|
|
866
873
|
@row-click="handleRowClick"
|
|
@@ -904,6 +911,7 @@ defineExpose({
|
|
|
904
911
|
:checked-set="checkedSet"
|
|
905
912
|
:indeterminate-set="indeterminateSet"
|
|
906
913
|
:column-visibility="columnVisibility"
|
|
914
|
+
:selected-id="selectedId"
|
|
907
915
|
@toggle="toggle"
|
|
908
916
|
@check="toggleCheck"
|
|
909
917
|
@row-click="handleRowClick"
|