tables

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLimits = []int{5, 10, 25, 50}

Functions

func Next added in v1.0.32

func Next(p PaginationProps) htmx.Node

Next ...

func Pagination added in v1.0.22

func Pagination(p PaginationProps, children ...htmx.Node) htmx.Node

Pagination ...

func PaginationPropsFromContext added in v1.0.32

func PaginationPropsFromContext(c *fiber.Ctx) (limit int, offset int)

PaginationFromContext returns a new Pagination object based on the provided context.

func Prev added in v1.0.32

func Prev(p PaginationProps) htmx.Node

Prev ...

func Select added in v1.0.32

func Select(p SelectProps, children ...htmx.Node) htmx.Node

Select ...

func Table

func Table[R comparable](p TableProps[R], children ...htmx.Node) htmx.Node

Table is a struct that contains the properties of a table

func TablePagination added in v1.0.32

func TablePagination[R comparable](p TablePaginationProps[R], children ...htmx.Node) htmx.Node

TablePagination is a component that renders a table pagination

func TableToolbar added in v1.0.32

func TableToolbar[R comparable](p TableToolbarProps[R], children ...htmx.Node) htmx.Node

TableToolbar is a component that renders a table toolbar

Types

type ColumnDef

type ColumnDef[R comparable] struct {
	ID              string
	AccessorKey     string
	Header          func(p TableProps[R]) htmx.Node
	Cell            func(p TableProps[R], row R) htmx.Node
	EnableSorting   bool
	EnableFiltering bool
}

ColumnDef returns a new column definition.

type Columns

type Columns[R comparable] []ColumnDef[R]

Columns returns a new column definition.

type PaginationProps added in v1.0.32

type PaginationProps struct {
	ClassName htmx.ClassNames
	Total     int
	Offset    int
	Limit     int
	URL       string
}

PaginationProps is a struct that contains the properties of a pagination

type Rows

type Rows[R comparable] struct {
	Data []R
}

Rows is a struct that contains the data of a table

func NewRows

func NewRows[R comparable](data []R) Rows[R]

NewRows returns a new Rows object.

func (*Rows[T]) GetAll

func (r *Rows[T]) GetAll() []T

GetAll returns all the rows.

func (*Rows[R]) Insert

func (r *Rows[R]) Insert(data R)

Insert inserts a new row.

func (*Rows[R]) ValueByIndex

func (r *Rows[R]) ValueByIndex(index int) R

ValueByIndex is a helper function that returns the value of a row based on the provided index.

type SelectProps added in v1.0.32

type SelectProps struct {
	ClassName htmx.ClassNames
	Total     int
	Offset    int
	Limit     int
	URL       string
	Limits    []int
}

SelectProps ...

type TablePaginationProps added in v1.0.32

type TablePaginationProps[R comparable] struct {
	ClassName  htmx.ClassNames
	Pagination htmx.Node
}

TablePaginationProps is a struct that contains the properties of a table pagination

type TableProps

type TableProps[R comparable] struct {
	ClassName  htmx.ClassNames
	Columns    Columns[R]
	Rows       Rows[R]
	Toolbar    htmx.Node
	Pagination htmx.Node
}

TableProps is a struct that contains the properties of a table

type TableToolbarProps added in v1.0.32

type TableToolbarProps[R comparable] struct {
	ClassName htmx.ClassNames
}

TableToolbarProps is a struct that contains the properties of a table toolbar

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL