View Source Loupe.PhoenixLiveView.LiveComponent (Loupe v0.9.0)

Live view component that renders the entities. It also support nesting preloading of the relations though events.

Link to this section Summary

Functions

Applies a function on an entity at a given path. The path can contain integer, for list indexes or atom for struct's key.

Renders a list of struct or a struct recursively. It accepts the following attributes

Link to this section Types

@type tree() :: list() | struct()
@type update_function() :: (atom(), struct() -> struct())

Link to this section Functions

Link to this function

map_entity_at(tree, string_key, function)

View Source
@spec map_entity_at(
  tree(),
  String.t() | [atom() | non_neg_integer()],
  update_function()
) :: tree()

Applies a function on an entity at a given path. The path can contain integer, for list indexes or atom for struct's key.

@spec render(map()) :: Phoenix.LiveView.Rendered.t()

Renders a list of struct or a struct recursively. It accepts the following attributes:

  • result (required): either list(struct()) or struct().
  • definition (required): Ecto definition module.
  • definition_assigns (optional): Assigns for the Ecto definition.
  • inspect_modules (optional): List of module that should be rendered directly using inspect/1.
  • renderer (optional): Implementation of Loupe.PhoenixLiveView.Renderer behaviour.