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

@ -44,133 +44,173 @@ func SampleNavbarMenu() TablerMenu {
}
}
// SampleTableRows returns sample data for table demos
// Migrated from liquid/data/people.json
func SampleTableRows() []TableRow {
return []TableRow{
{
ID: "1",
Name: "Paweł Kuna",
AvatarID: "000m",
Email: "paweluna@howstuffworks.com",
City: "Peimei",
Country: "China",
Status: "VIP",
JobTitle: "UI Designer",
Department: "Training",
Date: "2025-04-07",
Tags: []string{"High Volume"},
Category: "Training",
// SampleTables returns two sample table components for the tables demo page.
// Table 1: Users table (avatar, name, city, status, date, tags, category).
// Table 2: Projects table (name, description, progress, priority, assignee, deadline).
func SampleTables() []TableComponent {
table1 := TableComponent{
ID: "users-table",
Title: "Users",
Striped: false,
Hover: true,
Headers: []TableComponentHeader{
{Name: "Name", Sort: "sort-name"},
{Name: "City", Sort: "sort-city"},
{Name: "Status", Sort: "sort-status"},
{Name: "Start date", Sort: "sort-date"},
{Name: "Tags", Sort: "sort-tags"},
{Name: "Category", Sort: "sort-category"},
},
{
ID: "2",
Name: "Jeffie Lewzey",
AvatarID: "052f",
Email: "jlewzey1@seesaa.net",
City: "Indaial",
Country: "Brazil",
Status: "New",
JobTitle: "Chemical Engineer",
Department: "Support",
Date: "2024-12-12",
Tags: []string{"No Refunds"},
Category: "Support",
},
{
ID: "3",
Name: "Mallory Hulme",
AvatarID: "002m",
Email: "mhulme2@domainmarket.com",
City: "Cimuncang",
Country: "Indonesia",
Status: "VIP",
JobTitle: "Geologist IV",
Department: "Support",
Date: "2025-01-09",
Tags: []string{"High Value", "No Refunds", "Loyal"},
Category: "Support",
},
{
ID: "4",
Name: "Dunn Slane",
AvatarID: "003m",
Email: "dslane3@epa.gov",
City: "Liutang",
Country: "China",
Status: "Regular",
JobTitle: "Research Nurse",
Department: "Sales",
Date: "2022-10-01",
Tags: []string{"No Refunds"},
Category: "Sales",
},
{
ID: "5",
Name: "Emmy Levet",
AvatarID: "000f",
Email: "elevet4@senate.gov",
City: "Kaliprak",
Country: "Indonesia",
Status: "Regular",
JobTitle: "VP Product Management",
Department: "Accounting",
Date: "2025-05-18",
Tags: []string{"Standard"},
Category: "Accounting",
},
{
ID: "6",
Name: "Maryjo Lebarree",
AvatarID: "001f",
Email: "mlebarree5@unc.edu",
City: "Hantai",
Country: "China",
Status: "Regular",
JobTitle: "Civil Engineer",
Department: "Product Management",
Date: "2025-06-06",
Tags: []string{"No Refunds", "Loyal"},
Category: "Product Management",
},
{
ID: "7",
Name: "Egan Poetz",
AvatarID: "004m",
Email: "epoetz6@free.fr",
City: "Villaguay",
Country: "Argentina",
Status: "New",
JobTitle: "Research Nurse",
Department: "Engineering",
Date: "2024-08-21",
Tags: []string{"No Refunds"},
Category: "Engineering",
},
{
ID: "8",
Name: "Kellie Skingley",
AvatarID: "002f",
Email: "kskingley7@columbia.edu",
City: "Sidon",
Country: "Lebanon",
Status: "VIP",
JobTitle: "Teacher",
Department: "Services",
Date: "2025-02-23",
Tags: []string{"No Refunds", "Loyal"},
Category: "Services",
Rows: []TableComponentRow{
{
Cells: []TableCell{
{Type: "avatar", Value: "Paweł Kuna", AvatarID: "000m", Subtext: "paweluna@howstuffworks.com"},
{Type: "text", Value: "Peimei, China"},
{Type: "status", Value: "VIP", StatusColor: "bg-blue"},
{Type: "date", Value: "2025-04-07"},
{Type: "tags", Tags: []string{"High Volume"}},
{Type: "badge", Value: "Training", BadgeColor: "bg-muted-lt"},
},
},
{
Cells: []TableCell{
{Type: "avatar", Value: "Jeffie Lewzey", AvatarID: "052f", Subtext: "jlewzey1@seesaa.net"},
{Type: "text", Value: "Indaial, Brazil"},
{Type: "status", Value: "New", StatusColor: "bg-green"},
{Type: "date", Value: "2024-12-12"},
{Type: "tags", Tags: []string{"No Refunds"}},
{Type: "badge", Value: "Support", BadgeColor: "bg-blue-lt"},
},
},
{
Cells: []TableCell{
{Type: "avatar", Value: "Mallory Hulme", AvatarID: "002m", Subtext: "mhulme2@domainmarket.com"},
{Type: "text", Value: "Cimuncang, Indonesia"},
{Type: "status", Value: "VIP", StatusColor: "bg-blue"},
{Type: "date", Value: "2025-01-09"},
{Type: "tags", Tags: []string{"High Value", "No Refunds", "Loyal"}},
{Type: "badge", Value: "Support", BadgeColor: "bg-blue-lt"},
},
},
{
Cells: []TableCell{
{Type: "avatar", Value: "Dunn Slane", AvatarID: "003m", Subtext: "dslane3@epa.gov"},
{Type: "text", Value: "Liutang, China"},
{Type: "status", Value: "Regular", StatusColor: "bg-muted"},
{Type: "date", Value: "2022-10-01"},
{Type: "tags", Tags: []string{"No Refunds"}},
{Type: "badge", Value: "Sales", BadgeColor: "bg-green-lt"},
},
},
{
Cells: []TableCell{
{Type: "avatar", Value: "Emmy Levet", AvatarID: "000f", Subtext: "elevet4@senate.gov"},
{Type: "text", Value: "Kaliprak, Indonesia"},
{Type: "status", Value: "Regular", StatusColor: "bg-muted"},
{Type: "date", Value: "2025-05-18"},
{Type: "tags", Tags: []string{"Standard"}},
{Type: "badge", Value: "Accounting", BadgeColor: "bg-yellow-lt"},
},
},
{
Cells: []TableCell{
{Type: "avatar", Value: "Maryjo Lebarree", AvatarID: "001f", Subtext: "mlebarree5@unc.edu"},
{Type: "text", Value: "Hantai, China"},
{Type: "status", Value: "Regular", StatusColor: "bg-muted"},
{Type: "date", Value: "2025-06-06"},
{Type: "tags", Tags: []string{"No Refunds", "Loyal"}},
{Type: "badge", Value: "Product Management", BadgeColor: "bg-orange-lt"},
},
},
{
Cells: []TableCell{
{Type: "avatar", Value: "Egan Poetz", AvatarID: "004m", Subtext: "epoetz6@free.fr"},
{Type: "text", Value: "Villaguay, Argentina"},
{Type: "status", Value: "New", StatusColor: "bg-green"},
{Type: "date", Value: "2024-08-21"},
{Type: "tags", Tags: []string{"No Refunds"}},
{Type: "badge", Value: "Engineering", BadgeColor: "bg-blue-lt"},
},
},
{
Cells: []TableCell{
{Type: "avatar", Value: "Kellie Skingley", AvatarID: "002f", Subtext: "kskingley7@columbia.edu"},
{Type: "text", Value: "Sidon, Lebanon"},
{Type: "status", Value: "VIP", StatusColor: "bg-blue"},
{Type: "date", Value: "2025-02-23"},
{Type: "tags", Tags: []string{"No Refunds", "Loyal"}},
{Type: "badge", Value: "Services", BadgeColor: "bg-purple-lt"},
},
},
},
}
}
// SampleTableHeaders returns headers for the advanced table
func SampleTableHeaders() []TableHeader {
return []TableHeader{
{Name: "Name", Sort: "sort-name"},
{Name: "City", Sort: "sort-city"},
{Name: "Status", Sort: "sort-status"},
{Name: "Start date", Sort: "sort-date"},
{Name: "Tags", Sort: "sort-tags"},
{Name: "Category", Sort: "sort-category"},
table2 := TableComponent{
ID: "projects-table",
Title: "Projects",
Striped: true,
Hover: true,
Headers: []TableComponentHeader{
{Name: "Project", Sort: "sort-project"},
{Name: "Progress", Sort: "sort-progress"},
{Name: "Priority"},
{Name: "Assignee", Sort: "sort-assignee"},
{Name: "Deadline", Sort: "sort-deadline"},
{Name: "", Width: "w-1"},
},
Rows: []TableComponentRow{
{
Cells: []TableCell{
{Type: "text", Value: "Tabler UI Kit"},
{Type: "text", Value: "75%"},
{Type: "badge", Value: "High", BadgeColor: "bg-red-lt"},
{Type: "avatar", Value: "Paweł Kuna", AvatarID: "000m", Subtext: "Lead Designer"},
{Type: "date", Value: "2025-06-30"},
{Type: "actions"},
},
},
{
Cells: []TableCell{
{Type: "text", Value: "Mobile App v2"},
{Type: "text", Value: "45%"},
{Type: "badge", Value: "Medium", BadgeColor: "bg-yellow-lt"},
{Type: "avatar", Value: "Jeffie Lewzey", AvatarID: "052f", Subtext: "Developer"},
{Type: "date", Value: "2025-07-15"},
{Type: "actions"},
},
},
{
Cells: []TableCell{
{Type: "text", Value: "API Gateway"},
{Type: "text", Value: "90%"},
{Type: "badge", Value: "Low", BadgeColor: "bg-green-lt"},
{Type: "avatar", Value: "Mallory Hulme", AvatarID: "002m", Subtext: "Backend Engineer"},
{Type: "date", Value: "2025-05-01"},
{Type: "actions"},
},
},
{
Cells: []TableCell{
{Type: "text", Value: "Admin Dashboard"},
{Type: "text", Value: "30%"},
{Type: "badge", Value: "Critical", BadgeColor: "bg-red-lt"},
{Type: "avatar", Value: "Dunn Slane", AvatarID: "003m", Subtext: "Frontend Dev"},
{Type: "date", Value: "2025-08-20"},
{Type: "actions"},
},
},
{
Cells: []TableCell{
{Type: "text", Value: "Data Pipeline"},
{Type: "text", Value: "60%"},
{Type: "badge", Value: "Medium", BadgeColor: "bg-yellow-lt"},
{Type: "avatar", Value: "Emmy Levet", AvatarID: "000f", Subtext: "Data Engineer"},
{Type: "date", Value: "2025-06-15"},
{Type: "actions"},
},
},
},
}
return []TableComponent{table1, table2}
}