@innertia-solutions/nuxt-theme-spark 0.1.115 → 0.1.116

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.
@@ -13,12 +13,24 @@ const props = defineProps({
13
13
  columns: { type: Array, default: () => [] },
14
14
  })
15
15
 
16
- const isOpen = ref(false)
17
- const format = ref('xlsx')
18
- const filename = ref(props.name)
16
+ const isOpen = ref(false)
17
+ const format = ref('xlsx')
18
+ const filename = ref(props.name)
19
+ const selectedColumns = ref([])
19
20
 
21
+ watch(() => props.columns, (cols) => { selectedColumns.value = cols.map(c => c.key) }, { immediate: true })
20
22
  watch(() => props.name, (v) => { filename.value = v })
21
23
 
24
+ const toggleColumn = (key) => {
25
+ const idx = selectedColumns.value.indexOf(key)
26
+ if (idx >= 0) selectedColumns.value.splice(idx, 1)
27
+ else selectedColumns.value.push(key)
28
+ }
29
+ const allSelected = computed(() => selectedColumns.value.length === props.columns.length)
30
+ const toggleAll = () => {
31
+ selectedColumns.value = allSelected.value ? [] : props.columns.map(c => c.key)
32
+ }
33
+
22
34
  const formats = [
23
35
  { value: 'xlsx', label: 'Excel' },
24
36
  { value: 'csv', label: 'CSV' },
@@ -27,7 +39,7 @@ const formats = [
27
39
  ]
28
40
 
29
41
  const doExport = () => {
30
- props.tableRef?.exportTable(format.value, true, true)
42
+ props.tableRef?.exportTable(format.value, true, true, selectedColumns.value)
31
43
  isOpen.value = false
32
44
  }
33
45
 
@@ -118,6 +130,31 @@ defineExpose({ open: () => { isOpen.value = true } })
118
130
  </div>
119
131
  </div>
120
132
 
133
+ <!-- Columns -->
134
+ <div v-if="columns.length > 0" class="mb-3 px-1">
135
+ <div class="flex items-center justify-between mb-1.5">
136
+ <label class="text-[10px] font-bold text-muted-foreground uppercase tracking-widest">Columnas</label>
137
+ <button type="button" @click="toggleAll" class="text-[10px] text-blue-600 dark:text-blue-400 hover:underline">
138
+ {{ allSelected ? 'Ninguna' : 'Todas' }}
139
+ </button>
140
+ </div>
141
+ <div class="max-h-32 overflow-y-auto space-y-0.5">
142
+ <label
143
+ v-for="col in columns"
144
+ :key="col.key"
145
+ class="flex items-center gap-2 py-1 px-1.5 rounded-lg hover:bg-muted-hover cursor-pointer"
146
+ >
147
+ <input
148
+ type="checkbox"
149
+ :checked="selectedColumns.includes(col.key)"
150
+ @change="toggleColumn(col.key)"
151
+ class="rounded border-card-line bg-surface shrink-0 cursor-pointer"
152
+ />
153
+ <span class="text-xs text-foreground truncate">{{ col.label }}</span>
154
+ </label>
155
+ </div>
156
+ </div>
157
+
121
158
  <!-- Export button -->
122
159
  <button
123
160
  type="button"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/nuxt-theme-spark",
3
- "version": "0.1.115",
3
+ "version": "0.1.116",
4
4
  "description": "Innertia Solutions — Spark theme: backoffice, landing and mobile components and layouts",
5
5
  "keywords": [
6
6
  "nuxt",