@innertia-solutions/nuxt-theme-spark 0.1.37 → 0.1.39
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { IconSearch, IconAdjustmentsHorizontal, IconLayoutColumns, IconGripVertical
|
|
2
|
+
import { IconSearch, IconAdjustmentsHorizontal, IconLayoutColumns, IconGripVertical } from '@tabler/icons-vue'
|
|
3
3
|
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
endpoint: { type: String, required: true },
|
|
@@ -41,9 +41,9 @@ const showColumnPanel = ref(false)
|
|
|
41
41
|
const columnPanelRef = ref(null)
|
|
42
42
|
|
|
43
43
|
const orderedColumns = computed(() => {
|
|
44
|
-
if (!tableRef.value) return props.columns
|
|
45
|
-
const ids = tableRef.value.table.getAllLeafColumns().map(c => c.id)
|
|
46
|
-
return ids.map(id => props.columns.find(c => c.key === id)).filter(
|
|
44
|
+
if (!tableRef.value) return props.columns.filter(c => c.label)
|
|
45
|
+
const ids = tableRef.value.table.getAllLeafColumns().map(c => c.id).filter(id => id !== 'select')
|
|
46
|
+
return ids.map(id => props.columns.find(c => c.key === id)).filter(c => c?.label)
|
|
47
47
|
})
|
|
48
48
|
|
|
49
49
|
let draggedKey = null
|
|
@@ -60,6 +60,9 @@ const onDrop = (key) => {
|
|
|
60
60
|
if (from < 0 || to < 0) return
|
|
61
61
|
ids.splice(from, 1)
|
|
62
62
|
ids.splice(to, 0, draggedKey)
|
|
63
|
+
// keep 'select' pinned first
|
|
64
|
+
const selIdx = ids.indexOf('select')
|
|
65
|
+
if (selIdx > 0) { ids.splice(selIdx, 1); ids.unshift('select') }
|
|
63
66
|
tableRef.value?.setColumnOrder(ids)
|
|
64
67
|
draggedKey = null
|
|
65
68
|
dragOverKey.value = null
|
|
@@ -123,31 +126,6 @@ defineExpose({ getSelectedRows, reload, clearCache, exportTable, tableRef })
|
|
|
123
126
|
|
|
124
127
|
<slot name="actions" />
|
|
125
128
|
|
|
126
|
-
<!-- Reload -->
|
|
127
|
-
<button
|
|
128
|
-
type="button"
|
|
129
|
-
@click="reload()"
|
|
130
|
-
class="py-1.5 px-2.5 inline-flex items-center gap-2 text-sm font-medium rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-600 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors"
|
|
131
|
-
title="Recargar"
|
|
132
|
-
>
|
|
133
|
-
<IconReload class="size-4" />
|
|
134
|
-
</button>
|
|
135
|
-
|
|
136
|
-
<!-- Cache badge -->
|
|
137
|
-
<div v-if="tableRef?.isDataFromCache && tableRef?.cached" class="group relative flex items-center">
|
|
138
|
-
<div class="flex items-center gap-x-1.5 py-1.5 px-2.5 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 rounded-lg cursor-help hover:bg-emerald-500/20 transition-colors border border-emerald-200 dark:border-emerald-800">
|
|
139
|
-
<IconBolt class="size-3.5 fill-current" />
|
|
140
|
-
<span class="text-[10px] font-bold uppercase tracking-wider">Instant</span>
|
|
141
|
-
</div>
|
|
142
|
-
<div class="absolute top-full mt-2 right-0 hidden group-hover:block w-48 p-2.5 bg-slate-900 text-white text-[11px] leading-relaxed rounded-xl shadow-2xl z-50">
|
|
143
|
-
<div class="font-bold mb-1 flex items-center gap-x-1.5 text-emerald-400">
|
|
144
|
-
<IconBolt class="size-3" /> Datos en Caché
|
|
145
|
-
</div>
|
|
146
|
-
Cargados desde memoria local. Recarga para sincronizar.
|
|
147
|
-
<div class="absolute bottom-full right-4 mb-[-1px] border-4 border-transparent border-b-slate-900"></div>
|
|
148
|
-
</div>
|
|
149
|
-
</div>
|
|
150
|
-
|
|
151
129
|
<!-- Column visibility toggle -->
|
|
152
130
|
<button
|
|
153
131
|
type="button"
|
package/components/Table.vue
CHANGED
|
@@ -294,12 +294,16 @@ const onHeaderDragOver = (e, colId) => { e.preventDefault(); dragOverHeaderId.va
|
|
|
294
294
|
const onHeaderDragLeave = () => { dragOverHeaderId.value = null }
|
|
295
295
|
const onHeaderDrop = (colId) => {
|
|
296
296
|
if (!draggedHeaderId || draggedHeaderId === colId) return
|
|
297
|
+
if (colId === 'select') return
|
|
297
298
|
const order = [...columnOrder.value]
|
|
298
299
|
const from = order.indexOf(draggedHeaderId)
|
|
299
300
|
const to = order.indexOf(colId)
|
|
300
301
|
if (from < 0 || to < 0) return
|
|
301
302
|
order.splice(from, 1)
|
|
302
303
|
order.splice(to, 0, draggedHeaderId)
|
|
304
|
+
// keep 'select' pinned first
|
|
305
|
+
const selIdx = order.indexOf('select')
|
|
306
|
+
if (selIdx > 0) { order.splice(selIdx, 1); order.unshift('select') }
|
|
303
307
|
columnOrder.value = order
|
|
304
308
|
draggedHeaderId = null
|
|
305
309
|
dragOverHeaderId.value = null
|