avances en tablas

This commit is contained in:
JACS 2026-05-02 21:38:15 -05:00
parent 65f7715b05
commit cc0c524337
7 changed files with 339 additions and 255 deletions

View file

@ -17,30 +17,60 @@ type TablerMenuItem struct {
// TablerMenu is a map of menu sections keyed by identifier
type TablerMenu map[string]*TablerMenuItem
// TableHeader represents a column header
type TableHeader struct {
// TableComponent represents a reusable table component with headers and rows.
type TableComponent struct {
ID string
Title string
Headers []TableComponentHeader
Rows []TableComponentRow
EmptyMessage string
PerPageOptions []string
Striped bool
Hover bool
CardClass string
TableClass string
}
// TableComponentHeader defines a single column header.
type TableComponentHeader struct {
Name string
Sort string
Width string
Align string
}
// TableRow represents a single row of mock data
type TableRow struct {
ID string
Name string
AvatarID string
Email string
City string
Country string
Status string
JobTitle string
Department string
Date string
Tags []string
Category string
// TableComponentRow represents a single row as a slice of cells.
type TableComponentRow struct {
Cells []TableCell
}
// TablerPageData holds the common data for all tabler pages
// TableCell represents a single cell in a table row.
// Type controls how the cell is rendered in the template:
// "text" - plain text
// "avatar" - avatar with name/email
// "status" - status dot + text
// "badge" - colored badge
// "tags" - list of tag badges
// "actions" - dropdown action button
// "date" - date display
type TableCell struct {
Type string
Value string
// Used by "avatar" type
AvatarID string
Subtext string
// Used by "status" type
StatusColor string
// Used by "badge" type
BadgeColor string
// Used by "tags" type
Tags []string
}
// TablerPageData holds the common data for all tabler pages.
// It should NOT contain component-specific fields like tables or forms.
// Add those by creating a page-specific struct that embeds TablerPageData
// and defines the component fields, then use hasField in the template.
type TablerPageData struct {
PageTitle string
PageDescription string
@ -60,8 +90,4 @@ type TablerPageData struct {
UserRole string
NavbarMenu TablerMenu
CurrentPage string
// Table data
TableHeaders []TableHeader
TableRows []TableRow
PerPageOptions []string
}