filterpick

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package filterpick is the values list and condition of one column of a filter, in the manner of fzf: a condition on top, then the column's values with checkboxes, narrowed by a fuzzy search as you type. The sheet's filter and a pivot table's filters open it, each saying what applying and cancelling do. It knows the UI only through Host.

Index

Constants

View Source
const ID = "filter"

ID identifies the picker's box in mouse events.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host interface {
	Theme() *theme.Theme
	Size() (width, height int)
	// Line is the shared edit line the focused field is typed in.
	Line() *lineedit.Line
	// Close closes the open overlay.
	Close()
	// Locale is how the condition's value is typed and shown.
	Locale() *locale.Locale
}

Host is what the filter picker needs of the UI.

type Picker

type Picker struct {

	// OnApply gets the criteria chosen, after the picker has closed.
	OnApply func(cr sheet.Criteria)
	// OnCancel, when set, runs after Esc or a click outside closes the
	// picker.
	OnCancel func()

	overlay.List // over the rows: "Select all", then shown
	// contains filtered or unexported fields
}

Picker is the values list and condition for one column.

func New

func New(h Host, title string, x int, values []sheet.FilterValue, cond sheet.Condition, apply func(sheet.Criteria)) *Picker

New returns a picker titled title at screen column x over values, with cond as the condition, calling apply with the criteria chosen. The caller opens it, then calls Start.

func (*Picker) Answer

func (p *Picker) Answer(text string) error

Answer applies criteria a macro recorded, as sheet.Criteria.JSON writes them: the values hidden, and a condition with its value in en-US's form, as if checked and typed.

func (*Picker) Changed

func (p *Picker) Changed()

func (*Picker) Cursor

func (p *Picker) Cursor() (int, int)

func (*Picker) Indicator

func (p *Picker) Indicator() string

func (*Picker) Key

func (p *Picker) Key(k tea.KeyPressMsg) tea.Cmd

func (*Picker) Layout

func (p *Picker) Layout() []overlay.Box

func (*Picker) Mouse

func (p *Picker) Mouse(e overlay.MouseEvent) tea.Cmd

func (*Picker) OnlyCondition added in v0.6.0

func (p *Picker) OnlyCondition()

OnlyCondition has the picker ask for the condition alone, with no values to tick, for a column whose values are too many to list (a linked source's). Call it after Start.

func (*Picker) Start

func (p *Picker) Start()

Start readies the edit line for the search, once the picker is open.

func (*Picker) Status

func (p *Picker) Status() (string, string)

Jump to

Keyboard shortcuts

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