Documentation
¶
Overview ¶
Package sortbar is the bar that picks the columns and order to sort a range by, as Sheets' "Advanced range sorting options" dialog, on the context line. It shows each sort column as a chip; arrows change the focused one, and the model highlights the range being sorted with the sort column's header lit. It knows the UI only through Host.
Index ¶
- func OrderName(desc bool) string
- type Bar
- func (b *Bar) Active() sheet.Addr
- func (b *Bar) Answer(text string) (tea.Cmd, error)
- func (b *Bar) ContextLine() (string, string)
- func (b *Bar) Data() sheet.Rect
- func (b *Bar) Indicator() string
- func (b *Bar) Key(k tea.KeyPressMsg) tea.Cmd
- func (b *Bar) Layout() []overlay.Box
- func (b *Bar) Mouse(e overlay.MouseEvent) tea.Cmd
- func (b *Bar) Status() (string, string)
- type Host
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bar ¶
type Bar struct {
// contains filtered or unexported fields
}
Bar is the sort bar over a range.
func (*Bar) Active ¶
Active is the cell drawn as active while the bar is open: the top of the focused sort column, so its header lights up.
func (*Bar) Answer ¶
Answer makes the choices a macro recorded (see answerJSON) and sorts, as if they were picked and Enter pressed.
func (*Bar) ContextLine ¶
ContextLine renders the bar for the context line.
type Host ¶
type Host interface {
Theme() *theme.Theme
Size() (width, height int)
// Sheet is the sheet sorted, for the headers' text.
Sheet() *sheet.Sheet
// Close closes the open overlay.
Close()
// Sort sorts data by keys, after the bar has closed. answer is the
// bar's choices as a macro records them, the answer Answer takes.
Sort(data sheet.Rect, keys []sheet.SortKey, answer string) tea.Cmd
}
Host is what the sort bar needs of the UI.