AshTui.Views.NavPanel (AshTui v0.3.1)

Copy Markdown View Source

Left panel view: domain list with expanded resources, with optional search.

Pure function — takes state and rect, returns [{widget, rect}].

Summary

Functions

Renders the navigation panel with domain/resource tree and search input.

Functions

render(state, rect)

Renders the navigation panel with domain/resource tree and search input.

Returns a list of {widget, rect} tuples containing the navigation list (and optionally a scrollbar and search input).

Examples

iex> domains = AshTui.Introspection.from_data([
...>   %{
...>     name: MyApp.Accounts,
...>     resources: [
...>       %{
...>         name: MyApp.Accounts.User,
...>         attributes: [%{name: :id, type: :uuid, primary_key?: true}],
...>         actions: [],
...>         relationships: []
...>       }
...>     ]
...>   }
...> ])
iex> state = AshTui.State.new(domains)
iex> rect = %ExRatatui.Layout.Rect{x: 0, y: 0, width: 30, height: 20}
iex> [{%ExRatatui.Widgets.List{}, ^rect}] = AshTui.Views.NavPanel.render(state, rect)