@innertia-solutions/nuxt-theme-spark 0.1.36 → 0.1.38

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, IconBolt, IconReload } from '@tabler/icons-vue'
2
+ import { IconSearch, IconAdjustmentsHorizontal, IconLayoutColumns, IconGripVertical } from '@tabler/icons-vue'
3
3
 
4
4
  const props = defineProps({
5
5
  endpoint: { type: String, required: true },
@@ -123,31 +123,6 @@ defineExpose({ getSelectedRows, reload, clearCache, exportTable, tableRef })
123
123
 
124
124
  <slot name="actions" />
125
125
 
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
126
  <!-- Column visibility toggle -->
152
127
  <button
153
128
  type="button"
@@ -314,7 +314,7 @@ const getSelectedRows = () => {
314
314
  }
315
315
 
316
316
  // ─── Export ───────────────────────────────────────────────────────────────────
317
- const exportTable = async (format, exportAllPages, exportFilteredRows) => {
317
+ const exportTable = async (format, exportAllPages, exportFilteredRows, selectedIds = null) => {
318
318
  const { download } = useDownload()
319
319
  const id = crypto.randomUUID()
320
320
  toast.show({
@@ -328,6 +328,7 @@ const exportTable = async (format, exportAllPages, exportFilteredRows) => {
328
328
  exportType: validFormats.includes(format) ? format : 'csv',
329
329
  exportAllPages,
330
330
  exportFilteredRows,
331
+ ...(selectedIds?.length ? { selectedIds } : {}),
331
332
  }
332
333
 
333
334
  try {
@@ -76,8 +76,19 @@ watch(isOpen, (v) => {
76
76
  else document.removeEventListener('mousedown', onOutsideClick)
77
77
  })
78
78
 
79
+ const selectedRows = computed(() => {
80
+ if (!props.tableRef) return { meta: { all: false }, rows: [] }
81
+ return props.tableRef.getSelectedRows() ?? { meta: { all: false }, rows: [] }
82
+ })
83
+
84
+ const hasSelection = computed(() => selectedRows.value.rows.length > 0)
85
+
79
86
  const doExport = () => {
80
- if (props.tableRef) {
87
+ if (!props.tableRef) return
88
+ if (hasSelection.value) {
89
+ const ids = selectedRows.value.rows.map(r => r.id)
90
+ props.tableRef.exportTable(format.value, false, false, ids)
91
+ } else {
81
92
  props.tableRef.exportTable(format.value, true, true)
82
93
  }
83
94
  isOpen.value = false
@@ -177,6 +188,16 @@ defineExpose({ open })
177
188
  </div>
178
189
  </div>
179
190
 
191
+ <!-- Selection info -->
192
+ <div class="px-3 pb-2">
193
+ <p v-if="hasSelection" class="text-xs text-blue-600 dark:text-blue-400 font-medium">
194
+ Se exportarán {{ selectedRows.rows.length }} fila{{ selectedRows.rows.length !== 1 ? 's' : '' }} seleccionada{{ selectedRows.rows.length !== 1 ? 's' : '' }}
195
+ </p>
196
+ <p v-else class="text-xs text-slate-400 dark:text-slate-500">
197
+ Se exportarán todos los registros
198
+ </p>
199
+ </div>
200
+
180
201
  <!-- Footer -->
181
202
  <div class="flex gap-2 px-3 pb-3">
182
203
  <button
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/nuxt-theme-spark",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "description": "Innertia Solutions — Spark theme: backoffice, landing and mobile components and layouts",
5
5
  "keywords": [
6
6
  "nuxt",