Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCSS ¶
func GenerateCSS() *Stylesheet
Types ¶
type Config ¶ added in v0.0.11
type Config struct {
// ParentID is the DOM id the form mounts under (a module passes its own ID).
ParentID string
Caller router.Caller
Title string // h1, top-left
// Record is BOTH the form's source of truth and the payload sent over the wire.
// model.Model (v0.0.14) is exactly that contract — never declare a local intersection.
Record model.Model
ListOp string // required
SaveOp string // "" → no save button
DeleteOp string // "" → no delete button
Args func() model.Encodable // list args (nil → none)
Decode func(raw []byte) ([]Item, error) // list response → cards
// Fill returns the full record for id, from what the module ALREADY decoded in Decode.
// A nil return (including a typed-nil pointer) resets the form — that is not an error.
Fill func(id string) model.Model
OnError func(err error)
// SearchPlaceholder overrides the search box text ("" → "Search…").
SearchPlaceholder string
}
Config is everything a module decides about its CRUD view: its record and its ops. Everything else — generating the form from the record, filling it on select, validating and shipping it on save, reloading the list — is wired HERE, once, for every app.
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
SearchPlaceholder string
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.