Documentation
¶
Overview ¶
Package targetlist is the selectable record list used by CRUD views.
Index ¶
- Constants
- type Item
- type TargetList
- func (t *TargetList) CloseMenus()
- func (t *TargetList) Count() int
- func (t *TargetList) IconSvg() *sprite.Sprite
- func (t *TargetList) Init(_ Ctx)
- func (t *TargetList) Items() []Item
- func (t *TargetList) Render() *Element
- func (t *TargetList) RenderCSS() *css.Stylesheet
- func (t *TargetList) SetItems(items []Item)
- func (t *TargetList) WidgetKind() widget.Kind
- func (t *TargetList) WidgetName() widget.Name
Constants ¶
const ( PartRow = widget.Part("row") PartOptions = widget.Part("options") PartBadge = widget.Part("badge") PartLabel = widget.Part("label") PartList = widget.Part("list") // PartMenu (the <details> wrapper) and PartBackdrop are gone with the // overlay: the trigger is a plain button and the options are an in-flow // accordion, so there is no wrapper to style and nothing floating for a // backdrop to dismiss. PartButton = widget.Part("button") PartIcon = widget.Part("icon") PartItemDanger = widget.Part("item-danger") PartItemIcon = widget.Part("item-icon") PartItemLabel = widget.Part("item-label") )
const NameTargetList = widget.Name("targetlist")
NameTargetList is the widget identity.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
Item is view.Item, not a copy: a shared shape means crudview.filter's []view.Item flows straight into SetItems, and a host swapping this widget for targethour (also view.Item-based) needs no re-mapping either. TargetList itself only ever reads ID/Label/Description — LeadTop/Main/Bottom are targethour's slot, ignored here.
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
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) CloseMenus ¶ added in v0.4.17
func (t *TargetList) CloseMenus()
CloseMenus is closeAllMenus, exported for a host that shares Selected (see crudview) to call when ITS OWN cancel path clears the selection. The ⋮ trigger sets Selected directly (see buildRow) so the expanded options read as belonging to a highlighted row, but the two are separate signals — clearing Selected elsewhere does not, by itself, collapse a row left open. A host that lets a row's ⋮ drive its own "active" state is responsible for closing it back up when that state resets.
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 and the trash can (Eliminar), both currentColor so CSS controls their color per the surface (Danger) the mobile icon button underneath them resolves to. The pencil that used to back Editar is gone with the menu entry itself.
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() *css.Stylesheet
RenderCSS defines the targetlist visual contract using the style DSL.
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.
func (*TargetList) WidgetKind ¶ added in v0.1.13
func (t *TargetList) WidgetKind() widget.Kind
func (*TargetList) WidgetName ¶ added in v0.1.13
func (t *TargetList) WidgetName() widget.Name