@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.
- package/components/Table/Standard.vue +62 -28
- package/package.json +1 -1
|
@@ -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
|
-
...
|
|
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
|
-
<!--
|
|
429
|
-
<
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
'
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
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
|
-
|
|
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
|
-
<
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
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
|
|