vface

package module
v0.0.0-...-d933c9e Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 4 Imported by: 0

README

vface

MVC library based on vugu

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultViewFactory

func DefaultViewFactory(m IModel) vugu.Builder

Types

type Button

type Button struct {
	View[IButtonModel]
}

type ButtonModel

type ButtonModel struct {
	Model
	Label  string
	Action func(IEventContext)
}

func (*ButtonModel) GetLabel

func (m *ButtonModel) GetLabel() string

func (*ButtonModel) Pressed

func (m *ButtonModel) Pressed(event IEventContext)

type Composite

type Composite struct {
	View[IList]
}

type Control

type Control interface {
	/* Indicates that the given model is changed by a control */
	Update(IModel, vugu.DOMEvent)
	Close()
	Run(root vugu.Builder) error
}

func NewControl

func NewControl[T IModel](config *ControlConfig, IModel T) Control

type ControlConfig

type ControlConfig struct {
	MountPoint  string
	ViewFactory ViewFactory
	SetUp       []SetUpFunc
	ModelSetup  []ModelSetupFunc
}

func NewDefaultConfig

func NewDefaultConfig() *ControlConfig

func (*ControlConfig) CascadeViewFactory

func (c *ControlConfig) CascadeViewFactory(viewfactory ViewFactory) *ControlConfig

func (*ControlConfig) OverrideViewFactory

func (c *ControlConfig) OverrideViewFactory(viewfactory ViewFactory) *ControlConfig

func (*ControlConfig) WithModelSetUp

func (c *ControlConfig) WithModelSetUp(setup ModelSetupFunc) *ControlConfig

func (*ControlConfig) WithMountPoint

func (c *ControlConfig) WithMountPoint(mountpoint string) *ControlConfig

func (*ControlConfig) WithSetUp

func (c *ControlConfig) WithSetUp(setup SetUpFunc) *ControlConfig

type DynamicView

type DynamicView struct {
	View[IModel]
	// contains filtered or unexported fields
}

type IButtonModel

type IButtonModel interface {
	IModel
	GetLabel() string
	Pressed(IEventContext)
}

type ICell

type ICell interface {
	IModel
	IsHeader() bool
}

Optional interface for models denoting cells

type IClassProvider

type IClassProvider interface {
	GetClass() string
}

type IDynamicView

type IDynamicView interface {
	IView
	// contains filtered or unexported methods
}

type IEventContext

type IEventContext interface {
	TriggerChanged(IModel)
}

func WrapEvent

func WrapEvent(event vugu.DOMEvent) IEventContext

type IList

type IList interface {
	IModel
	GetElements() []IModel
}

type IModel

type IModel interface {
	IsReadonly() bool
}

type IRenderedTexteditModel

type IRenderedTexteditModel interface {
	ITexteditModel
	GetRenderedContent() string
}

type IRow

type IRow interface {
	IModel
	Cells() []IModel
}

type ITable

type ITable interface {
	IModel
	Rows() []IRow
}

type ITexteditModel

type ITexteditModel interface {
	IModel
	GetContent() string
	SetContent(string, IEventContext)
}

type ITree

type ITree interface {
	IModel

	Item() IModel
	IsExpanded() bool
	SetExpanded(event IEventContext, expanded bool)
	Children() []ITree
}

type IView

type IView interface {
	vugu.Builder
	// contains filtered or unexported methods
}

type Identifiable

type Identifiable interface {
	Identifier() string
}

type KeyEvent

type KeyEvent struct {
	vugu.DOMEvent
	Kind KeyEventKind
	Key  string
}

type KeyEventKind

type KeyEventKind int
const (
	PRESS KeyEventKind = 0
	DOWN  KeyEventKind = 1
	UP    KeyEventKind = 2
)

type KeyFunc

type KeyFunc func(KeyEvent)

func (KeyFunc) HandleKey

func (f KeyFunc) HandleKey(event KeyEvent)

type KeyHandler

type KeyHandler interface {
	HandleKey(KeyEvent)
}

type List

type List struct {
	Model
	Elements []IModel
}

func (*List) GetElements

func (l *List) GetElements() []IModel

type Model

type Model struct {
	Readonly bool
	ID       string
}

Base struct for the Model

func (*Model) Identifier

func (m *Model) Identifier() string

func (*Model) IsReadonly

func (m *Model) IsReadonly() bool

type ModelSetupFunc

type ModelSetupFunc func(model IModel)

type Row

type Row struct {
	Model
	CellModels []IModel
}

func (*Row) Cells

func (row *Row) Cells() []IModel

type RowView

type RowView struct{ View[IRow] }

func (*RowView) Build

func (c *RowView) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

<tr> for m in c.Model.Cells():

if m.header: <th> else: <td>
	<DynamicView>
</th> or </td> respectively

</tr>

type Selector

type Selector struct {
	View[*SelectorModel]
}

type SelectorModel

type SelectorModel struct {
	Model
	Options   []string
	Labels    []string
	Selection string
}

type SetUpFunc

type SetUpFunc func(component vugu.Builder)

type Table

type Table struct {
	Model
	RowModels []IRow
}

func (*Table) Rows

func (tabke *Table) Rows() []IRow

type TableView

type TableView struct{ View[ITable] }

func (*TableView) Build

func (c *TableView) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

type Textedit

type Textedit struct {
	View[ITexteditModel]
	Multiline    bool
	DefaultValue string
	DatalistID   string
	// contains filtered or unexported fields
}

type TexteditModel

type TexteditModel struct {
	Model
	Content string
}

func (*TexteditModel) GetContent

func (m *TexteditModel) GetContent() string

func (*TexteditModel) SetContent

func (m *TexteditModel) SetContent(updated string, _ IEventContext)

type TreeView

type TreeView struct {
	View[ITree]
}

type View

type View[M IModel] struct {
	Model M

	/* CSS Class */
	Class string
	// contains filtered or unexported fields
}

Base struct for every Component

func (*View[T]) GetKey

func (v *View[T]) GetKey(iterator int, model IModel) string

func (*View[T]) Update

func (v *View[T]) Update(event vugu.DOMEvent)

type ViewFactory

type ViewFactory interface {
	CreateView(IModel) vugu.Builder
}

type ViewFactoryFunc

type ViewFactoryFunc func(IModel) vugu.Builder

func (ViewFactoryFunc) CreateView

func (f ViewFactoryFunc) CreateView(v IModel) vugu.Builder

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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