package html_components import ( "fmt" "maragu.dev/gomponents" ) type TableColumnType string const ( TableColumnTypeText TableColumnType = "text" TableColumnTypeImage TableColumnType = "image" ) type TableColumn struct { Value string Type TableColumnType } type TableComponentColumnsStrikethrough struct { Active bool Url string Value bool } type TableComponentColumns struct { Nodes []gomponents.Node Strikethrough TableComponentColumnsStrikethrough } type TableRow struct { Id string Columns []TableColumn ComponentColumns TableComponentColumns EntityUrl string EditItemUrl string DeleteItemUrl string } type Pagination struct { PreviousDisabled bool NextDisabled bool Page int TotalNumberOfItems int CurrenItemStart int CurrentItemEnd int PreviousPage int NextPage int } type TableSortable struct { IsSortable bool EntityUrl string } type TableHeader struct { Label string OrderBy string } func (t TableSortable) UpUrl(id string) string { return fmt.Sprint(t.EntityUrl, "/", id, "/up") } func (t TableSortable) DownUrl(id string) string { return fmt.Sprint(t.EntityUrl, "/", id, "/down") } type GohtmlTable struct { Headers []string TableHeaders []TableHeader Rows []TableRow EntityUrl string OrderBy string OrderDirection string FilterValue string FilterSelect SelectInput Pagination Pagination ShowBack bool BackUrl string CreateItemUrl string Sortable TableSortable QueryParams string }