table

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const PageRefCellAlias = -10

PageRefCellAlias is used an alias to request the page reference cell, if any.

Variables

View Source
var All = []Enum{
	Start,
	Middle,
	End,
	Fill,
}

All possible values.

View Source
var Types = []Type{
	Text,
	Tags,
	Toggle,
	PageRef,
	Markdown,
}

Types holds all possible values.

Functions

func SanitizeID

func SanitizeID(id string, permitLeadingDigits bool, reserved ...string) string

SanitizeID ensures the ID is not empty and consists of only lowercase alphanumeric characters. If permitLeadingDigits is false, then leading digits are stripped. A list of reserved values can be passed in to disallow specific IDs.

Types

type CellData

type CellData struct {
	Type     Type
	Disabled bool
	Dim      bool
	Checked  bool
	//Alignment         Enum
	Primary           string
	Secondary         string
	Tooltip           string
	UnsatisfiedReason string
	TemplateInfo      string
	InlineTag         string
}

CellData holds data for creating a cell's visual representation.

func (*CellData) ForSort

func (c *CellData) ForSort() string

ForSort returns a string that can be used to sort or search against for this data.

type Enum

type Enum byte

Enum specifies how to align an object within its available space.

const (
	Start Enum = iota
	Middle
	End
	Fill
)

Possible values.

func Extract

func Extract(str string) Enum

Extract the value from a string.

func (Enum) EnsureValid

func (e Enum) EnsureValid() Enum

EnsureValid ensures this is of a known value.

func (Enum) Key

func (e Enum) Key() string

Key returns the key used in serialization.

func (Enum) MarshalText

func (e Enum) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface.

func (Enum) String

func (e Enum) String() string

String implements fmt.Stringer.

func (*Enum) UnmarshalText

func (e *Enum) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type ItemVariant

type ItemVariant int

ItemVariant holds the type of item variant to create.

const (
	NoItemVariant ItemVariant = iota
	ContainerItemVariant
	AlternateItemVariant
)

Possible values for ItemVariant.

type Model

type Model[T RowConstraint[T]] interface {
	RootRowCount() int
	RootRows() []T
	SetRootRows(rows []T)
}

type Provider

type Provider[T any] interface {
	//Model[*Node[T]]
	//SetTable(table *tree.Node[T]) //todo
	RootData() []T
	SetRootData(data []T)
	DragKey() string
	//DragSVG() *SVG
	//DropShouldMoveData(from, to *unison.Table[*Node[T]]) bool
	//ProcessDropData(from, to *unison.Table[*Node[T]])
	//AltDropSupport() *AltDropSupport
	ItemNames() (singular, plural string)
	//Headers() []unison.TableColumnHeader[*Node[T]]
	//SyncHeader(headers []unison.TableColumnHeader[*Node[T]])
	ColumnIDs() []int
	HierarchyColumnID() int
	ExcessWidthColumnID() int

	RefKey() string
	AllTags() []string
	CellFromCellData()

	Match(text string) bool
	CellData(columnID int, data any)
}

type RowConstraint

type RowConstraint[T any] interface {
	comparable
}

type RowData

type RowData[T RowConstraint[T]] struct {
	// contains filtered or unexported fields
}

func (*RowData[T]) RootRowCount

func (m *RowData[T]) RootRowCount() int

func (*RowData[T]) RootRows

func (m *RowData[T]) RootRows() []T

func (*RowData[T]) SetRootRows

func (m *RowData[T]) SetRootRows(rows []T)

type Type

type Type byte

Type holds the type of table cell.

const (
	Text Type = iota
	Tags
	Toggle
	PageRef
	Markdown
)

Possible values.

const LastType Type = Markdown

LastType is the last valid value.

func ExtractType

func ExtractType(str string) Type

ExtractType extracts the value from a string.

func (Type) EnsureValid

func (enum Type) EnsureValid() Type

EnsureValid ensures this is of a known value.

func (Type) Key

func (enum Type) Key() string

Key returns the key used in serialization.

func (Type) MarshalText

func (enum Type) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface.

func (Type) String

func (enum Type) String() string

String implements fmt.Stringer.

func (*Type) UnmarshalText

func (enum *Type) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

Jump to

Keyboard shortcuts

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