A collection as a Hakushi canvas: each record a node, where people put it, and the links of a relation of the collection to itself as edges. A person who draws an edge links two records; who deletes one unlinks them; who moves a node moves it in the view, for everyone who opens it.
<Cardbox.Hakushi.canvas cardbox={MyApp.Cardbox} collection={@collection} view={@view}
records={@records} actor={@user} class="h-[40rem]">
<:record :let={record}>{record.data["title"]}</:record>
</Cardbox.Hakushi.canvas>The view is a saved Cardbox.View of type canvas: its edges option
names the relation whose links are the edges, and its layout keeps
where each record is (%{"7" => %{"x" => 120, "y" => 40}}). Records it
has no place for yet are laid out in layers, along their links, as the
canvas opens.
An edge goes from a record to the record whose relation links to it: on a "Blocked by" relation, from the blocking record to the one it blocks. A node is not deleted on the canvas: records are deleted where people see all of them.
Summary
Functions
A collection as a canvas of its records, joined by a relation's links.
Saves a change of the canvas: places into the view's layout, edges
drawn and deleted as links of its relation. The on_change of a canvas
of your own (Hakushi.Components.canvas/1).
The graph of a canvas view: a node for each record, at its place in the view (or in a column, for the layout to place), and an edge for each link of the view's relation between two of them.
Functions
A collection as a canvas of its records, joined by a relation's links.
Attributes
cardbox(:atom) (required) - your Cardbox module.collection(Cardbox.Collection) (required)view(Cardbox.View) (required)records(:list) (required) - the records to show (list/3of the view).actor(:any) - Defaults tonil.id(:string) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["class", "background", "grid", "snap", "minimap", "controls", "fit", "wheel", "readonly"].
Slots
record- a record's node, given the record as:let; its title by default.
@spec change( module(), Cardbox.Collection.t(), Cardbox.View.t(), Hakushi.Change.t(), map(), keyword() ) :: :ok | {:error, String.t()}
Saves a change of the canvas: places into the view's layout, edges
drawn and deleted as links of its relation. The on_change of a canvas
of your own (Hakushi.Components.canvas/1).
@spec graph(Cardbox.Collection.t(), Cardbox.View.t(), [Cardbox.Record.t()]) :: Hakushi.Graph.t()
The graph of a canvas view: a node for each record, at its place in the view (or in a column, for the layout to place), and an edge for each link of the view's relation between two of them.