targetlist

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package targetlist is the selectable record list used by CRUD views.

It renders rows of Item{Label, Description}, tracks a single selected row, and gives each row a ⋮ options menu (Editar / Eliminar) in its top-right corner. It owns ONLY its own look (rows, badge, selected state, menu); the layout that hosts it decides where it sits. Reactive: call SetItems to (re)populate; the selected highlight follows the shared Selected signal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	ID          string
	Label       string
	Description string
}

Item is one selectable record: an id, a visible label, and an optional badge.

type TargetList

type TargetList struct {
	Element

	// Selected holds the id of the highlighted row. Optional — created if nil so a
	// host can share it (e.g. a CRUD view binding the form to the same signal).
	Selected *SignalString

	// Row callbacks. All optional.
	OnSelect func(it Item)   // row body clicked
	OnEdit   func(id string) // ⋮ → Editar
	OnDelete func(id string) // ⋮ → Eliminar
	// contains filtered or unexported fields
}

TargetList is a selectable list of records with a per-row options menu.

func (*TargetList) Count

func (t *TargetList) Count() int

Count reports how many rows are currently rendered (used by hosts/tests).

func (*TargetList) IconSvg

func (t *TargetList) IconSvg() *sprite.Sprite

IconSvg registers the ⋮ (vertical dots) options glyph. Uses currentColor via the sprite default so CSS controls its color.

func (*TargetList) Init

func (t *TargetList) Init(_ Ctx)

func (*TargetList) Items

func (t *TargetList) Items() []Item

Items returns the current items (the data behind the rendered rows).

func (*TargetList) Render

func (t *TargetList) Render() *Element

func (*TargetList) RenderCSS

func (t *TargetList) RenderCSS() *Stylesheet

RenderCSS owns the targetlist look only: the scroll list, the row cards, the selected highlight, the description badge and the ⋮ options menu. Consumes theme tokens; the host layout positions the list, it does not style it.

func (*TargetList) SetItems

func (t *TargetList) SetItems(items []Item)

SetItems replaces the visible rows. Safe to call from a host on every filter or reload; rows go through the keyed reconcile so their bindings stay wired.

Jump to

Keyboard shortcuts

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