list

package
v1.6.9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

templ: version: v0.2.707

templ: version: v0.2.707

templ: version: v0.2.707

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnGroup

type ColumnGroup[T attrs.Definer] struct {
	Definitons attrs.Definitions
	Columns    []ListColumn[T]
	Instance   T
}

func (*ColumnGroup[T]) AddColumn

func (c *ColumnGroup[T]) AddColumn(column ListColumn[T])

func (*ColumnGroup[T]) Component

func (c *ColumnGroup[T]) Component() templ.Component

func (*ColumnGroup[T]) Render

func (c *ColumnGroup[T]) Render() string

type List

type List[T attrs.Definer] struct {
	Columns []ListColumn[T]
	// contains filtered or unexported fields
}

func NewList

func NewList[T attrs.Definer](list []T, columns ...ListColumn[T]) *List[T]

func (*List[T]) Component

func (l *List[T]) Component() templ.Component

func (*List[T]) Render

func (l *List[T]) Render() string

type ListColumn

type ListColumn[T attrs.Definer] interface {
	Header() templ.Component
	Component(defs attrs.Definitions, row T) templ.Component
}

func Column

func Column[T attrs.Definer](header func() string, getter any) ListColumn[T]

func FieldColumn

func FieldColumn[T attrs.Definer](header func() string, fieldName string) ListColumn[T]

func FuncColumn

func FuncColumn[T attrs.Definer](header func() string, data func(defs attrs.Definitions, row T) interface{}) ListColumn[T]

func HTMLColumn

func HTMLColumn[T attrs.Definer](header func() string, getHTML func(defs attrs.Definitions, row T) template.HTML) ListColumn[T]

func LinkColumn

func LinkColumn[T attrs.Definer](header func() string, fieldName string, getURL func(defs attrs.Definitions, row T) string) ListColumn[T]

func TitleFieldColumn

func TitleFieldColumn[T attrs.Definer](wraps ListColumn[T], getURL func(defs attrs.Definitions, row T) string) ListColumn[T]

type View

type View[T attrs.Definer] struct {
	views.BaseView
	AmountParam      string
	PageParam        string
	MaxAmount        uint64
	DefaultAmount    uint64
	ListColumns      []ListColumn[T]
	TitleFieldColumn func(ListColumn[T]) ListColumn[T]
	GetListFn        func(amount, offset uint) ([]T, error)
}

func (*View[T]) Columns

func (v *View[T]) Columns() []ListColumn[T]

func (*View[T]) GetContext

func (v *View[T]) GetContext(req *http.Request) (ctx.Context, error)

Jump to

Keyboard shortcuts

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