@innertia-solutions/nuxt-theme-spark 0.1.140 → 0.1.141

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.
@@ -83,9 +83,37 @@ const activeFilterList = computed(() =>
83
83
 
84
84
  const activeFilterCount = computed(() => activeFilterList.value.length)
85
85
 
86
+ // Columns NOT yet filtered — what appears in the picker (already-active columns are hidden)
87
+ const availableFilterColumns = computed(() =>
88
+ filtersConfig.value.filter(col => {
89
+ const v = activeFilters.value[col.key]
90
+ if (col.filterType === 'daterange') return !v?.from && !v?.to
91
+ return v === null || v === undefined || v === ''
92
+ })
93
+ )
94
+
95
+ // Convert activeFilters to enriched [{field, operator, value}] for the backend DataTable
96
+ const enrichedFilters = computed(() => {
97
+ const result = []
98
+ for (const col of filtersConfig.value) {
99
+ const v = activeFilters.value[col.key]
100
+ if (v === null || v === undefined || v === '') continue
101
+ if (col.filterType === 'daterange') {
102
+ if (!v?.from && !v?.to) continue
103
+ if (v.from) result.push({ field: col.key, operator: 'after', value: v.from })
104
+ if (v.to) result.push({ field: col.key, operator: 'before', value: v.to })
105
+ } else if (col.filterType === 'select') {
106
+ result.push({ field: col.key, operator: 'is', value: v })
107
+ } else {
108
+ result.push({ field: col.key, operator: 'contains', value: v })
109
+ }
110
+ }
111
+ return result
112
+ })
113
+
86
114
  const mergedParams = computed(() => ({
87
115
  ...props.params,
88
- ...activeFilters.value,
116
+ ...(enrichedFilters.value.length ? { filters: enrichedFilters.value } : {}),
89
117
  }))
90
118
 
91
119
  const removeFilter = (key) => {
@@ -425,23 +453,25 @@ defineExpose({ getSelectedRows, reload, clearCache, exportTable, tableRef, close
425
453
  <!-- Slot for custom toolbar buttons -->
426
454
  <slot name="toolbar" />
427
455
 
428
- <!-- Columnas button -->
429
- <button
430
- ref="columnButtonRef"
431
- type="button"
432
- @click="showColumnPanel = !showColumnPanel"
433
- :class="[
434
- 'py-1.5 px-3 inline-flex items-center gap-2 text-sm font-medium rounded-lg border transition-colors',
435
- showColumnPanel
436
- ? 'border-indigo-300 bg-indigo-50 text-indigo-700 dark:bg-indigo-900/20 dark:border-indigo-700 dark:text-indigo-300'
437
- : 'border-card-line bg-card text-muted-foreground-1 hover:bg-muted-hover'
438
- ]"
439
- >
440
- <IconLayoutColumns class="size-4" />
441
- Columnas
442
- </button>
456
+ <!-- Secondary actions: pushed to the right, icon-only style -->
457
+ <div class="ml-auto flex items-center gap-1">
458
+ <button
459
+ ref="columnButtonRef"
460
+ type="button"
461
+ @click="showColumnPanel = !showColumnPanel"
462
+ :title="'Columnas'"
463
+ :class="[
464
+ 'p-1.5 inline-flex items-center justify-center rounded-lg border transition-colors',
465
+ showColumnPanel
466
+ ? 'border-indigo-300 bg-indigo-50 text-indigo-600 dark:bg-indigo-900/20 dark:border-indigo-700 dark:text-indigo-300'
467
+ : 'border-transparent text-muted-foreground hover:border-card-line hover:bg-muted-hover hover:text-foreground'
468
+ ]"
469
+ >
470
+ <IconLayoutColumns class="size-4" />
471
+ </button>
443
472
 
444
- <TableExportable v-if="showExport" :table-ref="tableRef" :name="resolvedName" :columns="columns" />
473
+ <TableExportable v-if="showExport" :table-ref="tableRef" :name="resolvedName" :columns="columns" />
474
+ </div>
445
475
  </div>
446
476
 
447
477
  <!-- Filter chips row (shown when filters active) -->
@@ -649,20 +679,24 @@ defineExpose({ getSelectedRows, reload, clearCache, exportTable, tableRef, close
649
679
  :style="filterMenuStyle"
650
680
  >
651
681
 
652
- <!-- Step 1: column picker -->
682
+ <!-- Step 1: column picker (only non-filtered columns shown) -->
653
683
  <template v-if="filterMenuStep === 'columns'">
654
684
  <p class="text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-3 pt-2.5 pb-1">Filtrar por</p>
655
685
  <div class="pb-1.5">
656
- <button
657
- v-for="col in filtersConfig"
658
- :key="col.key"
659
- type="button"
660
- @click.stop="selectFilterColumn(col)"
661
- class="w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-muted-hover transition-colors"
662
- >
663
- <span class="flex-1 text-left text-foreground">{{ col.label }}</span>
664
- <span v-if="activeFilters[col.key]" class="text-[10px] font-semibold text-indigo-500 uppercase">activo</span>
665
- </button>
686
+ <template v-if="availableFilterColumns.length">
687
+ <button
688
+ v-for="col in availableFilterColumns"
689
+ :key="col.key"
690
+ type="button"
691
+ @click.stop="selectFilterColumn(col)"
692
+ class="w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-muted-hover transition-colors text-left text-foreground"
693
+ >
694
+ {{ col.label }}
695
+ </button>
696
+ </template>
697
+ <p v-else class="px-3 py-3 text-xs text-muted-foreground italic">
698
+ Todos los filtros están configurados
699
+ </p>
666
700
  </div>
667
701
  </template>
668
702
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/nuxt-theme-spark",
3
- "version": "0.1.140",
3
+ "version": "0.1.141",
4
4
  "description": "Innertia Solutions — Spark theme: backoffice, landing and mobile components and layouts",
5
5
  "keywords": [
6
6
  "nuxt",