Skip to content
docsv0.1.0

AbstractDashboardComponent

Shared mount/handle plumbing for the dashboard primitive family (shell, topbar, sidebar, panel, grid, metric card, data table, …): concrete subclasses only implement {@see contract()} and, optionally, {@see initialData()} / {@see meta()} to describe their own props — this base class owns wiring {@see \Milpa\Live\Events\LiveEventEmitter}'s mounting/handling emit points and the default "no actions" `handle()`.

AbstractDashboardComponent::__construct()

public function __construct(?Milpa\Interfaces\Event\MilpaEventDispatcherInterface $dispatcher = null):

Parameters

Parameters of __construct()
NameTypeDescription
$dispatcher?Milpa\Interfaces\Event\MilpaEventDispatcherInterface

AbstractDashboardComponent::contract()

abstract public static function contract(): Milpa\Live\ValueObjects\ComponentContract

The subclass's runtime contract (name, props/state schema, actions).

AbstractDashboardComponent::mount()

public function mount(array $props, Milpa\Live\ValueObjects\ComponentContext $context): Milpa\Live\ValueObjects\StateSnapshot

Builds the initial state from {@see initialData()} (the `data` half) and {@see meta()} merged with common `id`/`title`/`route`/`principal` meta (the `meta` half).

Parameters

Parameters of mount()
NameTypeDescription
$propsarray<string, mixed>
$contextMilpa\Live\ValueObjects\ComponentContext

AbstractDashboardComponent::handle()

public function handle(Milpa\Live\ValueObjects\InteractionRequest $request): Milpa\Live\ValueObjects\InteractionResult

The default dashboard primitive `handle()`: none of these primitives declare actions, so every call reports an unrecognized-action error via {@see InteractionResult::$errors}. A subclass that does need actions (e.g. {@see DataTableComponent}) overrides this method entirely.

Parameters

Parameters of handle()
NameTypeDescription
$requestMilpa\Live\ValueObjects\InteractionRequest