Documentation
¶
Overview ¶
Package rules is the side panel for a sheet's rules, as Sheets' Conditional formatting and Data validation sidebars: a list of the rules, and a form to add or edit one. It is docked at the right of the grid in the manner of lazygit's panels, and knows the UI only through Host.
Index ¶
- Constants
- type Editor
- func (e *Editor) Add(dropdown bool) *Editor
- func (e *Editor) Changed()
- func (e *Editor) Cursor() (int, int)
- func (e *Editor) Indicator() string
- func (e *Editor) Key(k tea.KeyPressMsg) tea.Cmd
- func (e *Editor) Layout() []overlay.Box
- func (e *Editor) Mouse(ev overlay.MouseEvent) tea.Cmd
- func (e *Editor) Status() (string, string)
- type Host
Constants ¶
const GridTop = 4
GridTop is the first screen row of the grid, under the control panel and the column headers.
const ID = "rules"
ID identifies the panel's box in mouse events.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor is the rules panel.
func Validations ¶
Validations opens the panel on the sheet's data validation.
func (*Editor) Add ¶
Add opens the form for a new rule over the selection, as Insert > Dropdown and a new rule do; with dropdown, a dropdown list.
func (*Editor) Changed ¶
func (e *Editor) Changed()
Changed keeps what's typed in the picked text row.
type Host ¶
type Host interface {
Theme() *theme.Theme
Size() (width, height int)
// Line is the shared edit line text rows are typed in.
Line() *lineedit.Line
// Close closes the open overlay.
Close()
// Sheet is the sheet whose rules are edited.
Sheet() *sheet.Sheet
// Selection is the range a new rule applies to.
Selection() sheet.Rect
// SaveFormat and SaveValidation store rule i (-1 adds one), as the
// commands macros record do, reporting why they couldn't.
SaveFormat(i int, f sheet.CondFormat) error
SaveValidation(i int, v sheet.Validation) error
// Reworked follows a rule removed or moved: the file is modified,
// and a macro being recorded notes what it can't replay.
Reworked()
// Slot is the terminal's color for an ANSI slot, for color scales.
Slot(i int) color.Color
}
Host is what the rules panel needs of the UI.