Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packages/actions/src/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ public function toArray(): array

return [
'name' => $this->getName(),
'alpineClickHandler' => $this->getCustomAlpineClickHandler(),
'color' => $this->getColor(),
'event' => $this->getEvent(),
'eventData' => $this->getEventData(),
Expand Down Expand Up @@ -225,6 +226,10 @@ public static function fromArray(array $data): static
$static->size($size);
}

if (filled($data['alpineClickHandler'] ?? null)) {
$static->alpineClickHandler($data['alpineClickHandler']);
}

$static->close($data['shouldClose'] ?? false);
$static->color($data['color'] ?? null);
$static->disabled($data['isDisabled'] ?? false);
Expand Down Expand Up @@ -382,7 +387,7 @@ public function getLivewireEventClickHandler(): ?string

public function getAlpineClickHandler(): ?string
{
if (filled($handler = $this->evaluate($this->alpineClickHandler))) {
if (filled($handler = $this->getCustomAlpineClickHandler())) {
return $handler;
}

Expand All @@ -405,6 +410,11 @@ public function getAlpineClickHandler(): ?string
return $this->getJsClickHandler();
}

public function getCustomAlpineClickHandler(): ?string
{
return $this->evaluate($this->alpineClickHandler);
}

public function livewireTarget(?string $target): static
{
$this->livewireTarget = $target;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"actions": [
{
"name": "view",
"alpineClickHandler": null,
"color": null,
"event": null,
"eventData": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"actions": [
{
"name": "view",
"alpineClickHandler": null,
"color": null,
"event": null,
"eventData": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"actions": [
{
"name": "view",
"alpineClickHandler": null,
"color": "primary",
"event": null,
"eventData": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"actions": [
{
"name": "view",
"alpineClickHandler": null,
"color": "primary",
"event": null,
"eventData": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"actions": [
{
"name": "view",
"alpineClickHandler": null,
"color": null,
"event": null,
"eventData": [],
Expand All @@ -27,6 +28,7 @@
},
{
"name": "edit",
"alpineClickHandler": null,
"color": null,
"event": null,
"eventData": [],
Expand All @@ -51,6 +53,7 @@
},
{
"name": "delete",
"alpineClickHandler": null,
"color": "danger",
"event": null,
"eventData": [],
Expand Down
Loading