dev: hotfix, improvements

+ components/pub/my-ui/data-table
+ components/pub/ui/badge
+ lib/date
This commit is contained in:
2025-10-17 02:18:25 +07:00
parent 60f2d8378c
commit 397d744f34
4 changed files with 71 additions and 16 deletions
@@ -71,14 +71,14 @@ function handleActionCellClick(event: Event, _cellRef: string) {
<template>
<Table>
<TableHeader v-if="headers" class="bg-gray-50 dark:bg-gray-800">
<TableRow>
<TableRow v-for="(hr, hrIdx) in headers">
<TableHead
v-for="(h, idx) in headers[0]"
v-for="(th, idx) in headers[hrIdx]"
:key="`head-${idx}`"
class="border"
:class="`border ${th.classVal || ''}`"
:style="{ width: cols[idx]?.width ? `${cols[idx].width}px` : undefined }"
>
{{ h.label }}
{{ th.label }}
</TableHead>
</TableRow>
</TableHeader>
+2 -3
View File
@@ -31,7 +31,7 @@ function btnClick() {
<div class="font-semibold text-gray-900 md:text-base xl:text-lg">
<Icon
:name="props.prep.icon!"
class="mr-2 size-4 align-middle md:size-6"
class="mr-2 align-middle md:size-6"
/>
{{ props.prep.title }}
</div>
@@ -44,7 +44,6 @@ function btnClick() {
<Input
type="text"
placeholder="Search"
class="sm:text-sm"
@click="emitSearchNavClick"
@input="onInput"
/>
@@ -59,7 +58,7 @@ function btnClick() {
>
<Icon
name="i-lucide-plus"
class="mr-2 h-4 w-4 align-middle"
class="align-middle"
/>
{{ prep.addNav.label }}
</Button>
+21 -9
View File
@@ -3,19 +3,31 @@ import { cva } from 'class-variance-authority'
export { default as Badge } from './Badge.vue'
export type Variants = | 'default' | 'secondary' | 'fresh' | 'positive' | 'negative' | 'warning' | 'destructive' | 'outline'
const variants: Record<Variants, string> = {
default:
'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80',
secondary:
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
fresh:
'border-transparent bg-teal-400 text-primary-foreground shadow hover:bg-teal-400/80',
positive:
'border-transparent bg-sky-400 text-primary-foreground shadow hover:bg-sky-400/80',
negative:
'border-transparent bg-neutral-400 text-destructive-foreground shadow hover:bg-neutral-400/80',
warning:
'border-transparent bg-orange-400 text-destructive-foreground shadow hover:bg-orange-400/80',
destructive:
'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
outline: 'text-foreground',
}
export const badgeVariants = cva(
'inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
{
variants: {
variant: {
default:
'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80',
secondary:
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
destructive:
'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
outline: 'text-foreground',
},
variant: variants,
},
defaultVariants: {
variant: 'default',