Preskoči na vsebino

std-detail

Level: Molecule | Entity: DetailRecord | Persistence: persistent

1 states, 4 events, 2 transitions

Live Preview

orbital DetailRecordOrbital {
entity DetailRecord [persistent: detailrecords] {
id : string
name : string
description : string
status : string
createdAt : string
}
trait DetailRecordBrowse -> DetailRecord [interaction] {
state browsing {
INIT -> browsing
(fetch DetailRecord)
(render-ui main { type: "stack", direction: "vertical", gap: "lg", className: "max-w-5xl mx-auto w-full", children: [{ type: "stack", direction: "horizontal", gap: "md", justify: "space-between", align: "center", children: [{ type: "stack", direction: "horizontal", gap: "sm", align: "center", children: [{ type: "icon", name: "file-text", size: "lg" }, { type: "typography", content: "DetailRecords", variant: "h2" }] }, { type: "stack", direction: "horizontal", gap: "sm", children: [{ type: "button", label: "Create DetailRecord", event: "CREATE", variant: "primary", icon: "plus" }] }] }, { type: "divider" }, { type: "data-grid", entity: "DetailRecord", emptyIcon: "inbox", emptyTitle: "No detailrecords yet", emptyDescription: "Create your first detailrecord to get started.", itemActions: [{ label: "View", event: "VIEW", variant: "ghost", size: "sm" }], columns: [{ name: "name", label: "Name", variant: "h4", icon: "file-text" }, { name: "description", label: "Description", variant: "badge", colorMap: { active: "success", completed: "success", done: "success", pending: "warning", draft: "warning", scheduled: "warning", inactive: "neutral", archived: "neutral", disabled: "neutral", error: "destructive", cancelled: "destructive", failed: "destructive" } }, { name: "status", label: "Status", variant: "caption" }] }] })
SAVE -> browsing
(fetch DetailRecord)
}
listens {
* SAVE -> SAVE
}
}
trait DetailRecordCreate -> DetailRecord [interaction] {
initial: closed
state closed {
INIT -> closed
(fetch DetailRecord)
CREATE -> open
(fetch DetailRecord)
(render-ui modal { type: "stack", direction: "vertical", gap: "md", children: [{ type: "stack", direction: "horizontal", gap: "sm", children: [{ type: "icon", name: "plus-circle", size: "md" }, { type: "typography", content: "New DetailRecord", variant: "h3" }] }, { type: "divider" }, { type: "form-section", entity: "DetailRecord", mode: "create", submitEvent: "SAVE", cancelEvent: "CLOSE", fields: ["name", "description", "status"] }] })
}
state open {
CLOSE -> closed
(render-ui modal null)
(notify Cancelled info)
SAVE -> closed
(persist create DetailRecord @payload.data)
(fetch DetailRecord)
(render-ui modal null)
(emit SAVE)
(notify "DetailRecord created successfully")
}
emits {
SAVE
}
}
trait DetailRecordView -> DetailRecord [interaction] {
initial: closed
state closed {
INIT -> closed
(fetch DetailRecord)
VIEW -> open
(fetch DetailRecord { id: "@payload.id" })
(render-ui modal { type: "stack", direction: "vertical", gap: "md", children: [{ type: "stack", direction: "horizontal", gap: "sm", align: "center", children: [{ type: "icon", name: "eye", size: "md" }, { type: "typography", variant: "h3", content: "@entity.name" }] }, { type: "divider" }, { type: "stack", direction: "horizontal", gap: "md", children: [{ type: "typography", variant: "caption", content: "Name" }, { type: "typography", variant: "body", content: "@entity.name" }] }, { type: "stack", direction: "horizontal", gap: "md", children: [{ type: "typography", variant: "caption", content: "Description" }, { type: "typography", variant: "body", content: "@entity.description" }] }, { type: "stack", direction: "horizontal", gap: "md", children: [{ type: "typography", variant: "caption", content: "Status" }, { type: "typography", variant: "body", content: "@entity.status" }] }, { type: "stack", direction: "horizontal", gap: "md", children: [{ type: "typography", variant: "caption", content: "Created At" }, { type: "typography", variant: "body", content: "@entity.createdAt" }] }, { type: "divider" }, { type: "stack", direction: "horizontal", gap: "sm", justify: "end", children: [{ type: "button", label: "Close", event: "CLOSE", variant: "ghost" }] }] })
}
state open {
CLOSE -> closed
(render-ui modal null)
(notify Cancelled info)
}
}
page "/detailrecords" -> DetailRecordBrowse, DetailRecordCreate, DetailRecordView
}
Loading preview...

Orbital Visualization

Loading visualization...

Entity Fields

FieldTypeDefault
idstring-
namestring-
descriptionstring-
statusstring"active"
createdAtstring-

States

StateType
browsingInitial

Events

EventPayload
INIT-
CREATE-
VIEWid: string
SAVEdata: object

Transitions

FromEventToEffects
browsingINITbrowsing2 effects
browsingSAVEbrowsing1 effect

Listens

  • [object Object]