crudview

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCSS

func GenerateCSS() *Stylesheet

func IconSvg

func IconSvg() *sprite.Sprite

IconSvg returns the sprite with the captured Pa100T icons. Captured paths from Pa100T v3.0.1 (base64 SVGs in IE_MODULE_CONTENT.md §2).

Types

type CrudView

type CrudView struct {
	Element // value embed — NEVER *dom.Element

	Title  string    // h1, top-left corner of the panel (white on accent bar)
	Form   Component // LEFT slot, the protagonist (typically *form.Form)
	Source Source    // feeds the right-hand list; zero Source = full-page

	// Interaction callbacks — the composition root wires these to the form
	// and transport ONCE per app; modules never re-implement them.
	OnSelect func(it Item)                         // list card clicked → load into form
	OnNew    func()                                // (+) pressed → reset form for create
	OnSave   func(done func(err error))            // (💾) pressed; done(nil) reloads list
	OnDelete func(id string, done func(err error)) // (−) pressed on selection
	OnCancel func()                                // (↺) pressed → undo current edit
	OnError  func(err error)                       // list load/decode failures; nil = drop
	// contains filtered or unexported fields
}

func (*CrudView) Init

func (v *CrudView) Init(ctx Ctx)

func (*CrudView) Reload

func (v *CrudView) Reload()

func (*CrudView) Render

func (v *CrudView) Render() *Element

func (*CrudView) Select

func (v *CrudView) Select(id string)

type Item

type Item struct {
	ID          string // selection key
	Label       string // main text of the card
	Description string // small chip at the card's bottom-right (e.g. an IP)
}

Item is one record in the right-hand list.

type Source

type Source struct {
	Caller router.Caller
	ListOp string                 // logical operation, e.g. "list_devices"
	Args   func() model.Encodable // list request args (nil → no args)
	Decode func(raw []byte) ([]Item, error)
}

Source is the data seam: a fake in tests, a router.Caller adapter in prod.

Jump to

Keyboard shortcuts

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