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

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.
@@ -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.37",
4
4
  "description": "Innertia Solutions — Spark theme: backoffice, landing and mobile components and layouts",
5
5
  "keywords": [
6
6
  "nuxt",