Documentation
¶
Overview ¶
Package listselect owns one concern: the multi-selection mode a record list enters when its host is about to act on several rows at once. It is a lego piece — targetlist and targetdate assemble it, they do not re-declare it.
Sibling of listgap, and for the same reason: two lists that must stay visually and behaviourally interchangeable (crudview swaps one for the other) cannot each own a private copy of the rule.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply adds the check part's skin to s and returns s for chaining. Both target* lists call this instead of hand-writing the block, so the check cannot drift between them.
The check rides its row's top-end corner (OnEdge), out of the flow: the label never shifts when selection mode opens, and the box reads as a badge on the row rather than a column of its own. checkIcon is the glyph inside the box, hidden until the row is actually marked — an always painted tick reads as pre-selected. row carries the danger wash while the host's danger tone is armed (see Mode.SetDanger); Selected and Invalid never coincide on one row (the row binds Selected only when the tone is off), so the two fills cannot race.
Types ¶
type Mode ¶
type Mode struct {
// OnChange fires after every toggle with the current count, so a host can
// label its commit button ("🗑 3") and disable it at zero.
OnChange func(n int)
// contains filtered or unexported fields
}
Mode is the selection state of one list. The zero value is a usable list in normal mode — a list is a list until its host says otherwise.
func (*Mode) Changed ¶ added in v0.6.5
func (m *Mode) Changed() *SignalBool
Changed flips on every Toggle. Rows read it first in their state derives (see the changed field); without that read a tap would update nothing on screen.
func (*Mode) CheckedIDs ¶
CheckedIDs returns the marked ids in the order given by ids, which the caller passes as its current render order.
Ordering is NOT optional and NOT the caller's problem to remember: checked accumulates in TAP order, and a host building a confirmation message from tap order would list rows in an order that matches nothing on screen. Taking the render order as a parameter is what makes the wrong version unwritable — there is no accessor that returns the raw slice.
func (*Mode) Danger ¶ added in v0.6.5
func (m *Mode) Danger() *SignalBool
Danger reports the tone signal a row binds its Invalid state to. Never a bool: the skin has to react.
func (*Mode) On ¶
func (m *Mode) On() *SignalBool
On reports the signal a component binds its root state to, so the stylesheet can reveal the checks. Never a bool: the skin has to react.
func (*Mode) SetDanger ¶ added in v0.6.5
SetDanger arms or disarms the danger tone. Additive: a host that never calls it gets no red anywhere, whatever the selection does.