feat(satusehat): implement query schema and improve data table
- Add schema.query.ts for query validation with zod - Move constants to const.ts for better organization - Refactor list.vue to use new query schema and constants - Add empty state handling to data-table.vue
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '~/components/pub/ui/table'
|
||||
import type { DataTableLoader } from './type'
|
||||
import { Info } from 'lucide-vue-next'
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '~/components/pub/ui/table'
|
||||
|
||||
defineProps<{
|
||||
rows: unknown[]
|
||||
cols: any[]
|
||||
@@ -33,6 +35,16 @@ const loader = inject('table_data_loader') as DataTableLoader
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
<TableBody v-if="rows.length === 0 && !loader.isTableLoading">
|
||||
<TableRow>
|
||||
<TableCell colspan="100%" class="text-center">
|
||||
<div class="flex items-center justify-center">
|
||||
<Info class="size-5 text-muted-foreground" />
|
||||
<span class="ml-2">No data available</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
<TableBody v-else>
|
||||
<TableRow v-for="(row, rowIndex) in rows" :key="`row-${rowIndex}`">
|
||||
<TableCell v-for="(key, cellIndex) in keys" :key="`cell-${rowIndex}-${cellIndex}`">
|
||||
|
||||
Reference in New Issue
Block a user