diff --git a/resources/views/components/table-repeater.blade.php b/resources/views/components/table-repeater.blade.php index 90df9c5..c059417 100644 --- a/resources/views/components/table-repeater.blade.php +++ b/resources/views/components/table-repeater.blade.php @@ -1,27 +1,36 @@ - - @php - $containers = $getChildComponentContainers(); - - $addAction = $getAction($getAddActionName()); - $cloneAction = $getAction($getCloneActionName()); - $deleteAction = $getAction($getDeleteActionName()); - $moveDownAction = $getAction($getMoveDownActionName()); - $moveUpAction = $getAction($getMoveUpActionName()); - $reorderAction = $getAction($getReorderActionName()); - $isReorderableWithButtons = $isReorderableWithButtons(); - - $headers = $getHeaders(); - $columnWidths = $getColumnWidths(); - $breakPoint = $getBreakPoint(); - $hasContainers = count($containers) > 0; - $hasHiddenHeader = $shouldHideHeader(); - $statePath = $getStatePath(); - - $emptyLabel = $getEmptyLabel(); - - $hasActions = $reorderAction->isVisible() || $cloneAction->isVisible() || $deleteAction->isVisible() || $moveUpAction->isVisible() || $moveDownAction->isVisible(); - @endphp +@php + use Filament\Forms\Components\Actions\Action; + $containers = $getChildComponentContainers(); + + $addAction = $getAction($getAddActionName()); + $cloneAction = $getAction($getCloneActionName()); + $deleteAction = $getAction($getDeleteActionName()); + $moveDownAction = $getAction($getMoveDownActionName()); + $moveUpAction = $getAction($getMoveUpActionName()); + $reorderAction = $getAction($getReorderActionName()); + $isReorderableWithButtons = $isReorderableWithButtons(); + $extraItemActions = $getExtraItemActions(); + + $headers = $getHeaders(); + $columnWidths = $getColumnWidths(); + $breakPoint = $getBreakPoint(); + $hasContainers = count($containers) > 0; + $hasHiddenHeader = $shouldHideHeader(); + $statePath = $getStatePath(); + + $emptyLabel = $getEmptyLabel(); + + $hasActions = $reorderAction->isVisible() || $cloneAction->isVisible() || $deleteAction->isVisible() || $moveUpAction->isVisible() || $moveDownAction->isVisible() || count($visibleExtraItemActions); + + foreach ($containers as $uuid => $row) { + $visibleExtraItemActions = array_filter( + $extraItemActions, + fn (Action $action): bool => $action(['item' => $uuid])->isVisible(), + ); + } +@endphp +
merge($getExtraAttributes())->class([ @@ -36,7 +45,7 @@ ]) }} > @if (count($containers) || $emptyLabel !== false) -
! $hasContainers && $breakPoint === 'sm', 'md:ring-gray-950/5 dark:md:ring-white/20' => ! $hasContainers && $breakPoint === 'md', @@ -77,6 +86,10 @@ @if ($hasActions)
+ @foreach ($visibleExtraItemActions as $extraItemAction) +
+ @endforeach + @if ($reorderAction->isVisible())
@endif @@ -114,6 +127,13 @@ class="filament-table-repeater-rows-wrapper divide-y divide-gray-950/5 dark:divi > @if (count($containers)) @foreach ($containers as $uuid => $row) + @php + $itemLabel = $getItemLabel($uuid); + $visibleExtraItemActions = array_filter( + $extraItemActions, + fn (Action $action): bool => $action(['item' => $uuid])->isVisible(), + ); + @endphp -
+
    + @foreach ($visibleExtraItemActions as $extraItemAction) +
  • + {{ $extraItemAction(['item' => $uuid]) }} +
  • + @endforeach + @if ($reorderAction->isVisible()) -
    +
  • {{ $reorderAction }} -
  • + @endif @if ($isReorderableWithButtons) @if (! $loop->first) +
  • {{ $moveUpAction(['item' => $uuid]) }} +
  • @endif @if (! $loop->last) +
  • {{ $moveDownAction(['item' => $uuid]) }} +
  • @endif @endif @if ($cloneAction->isVisible()) +
  • {{ $cloneAction(['item' => $uuid]) }} +
  • @endif @if ($deleteAction->isVisible()) +
  • {{ $deleteAction(['item' => $uuid]) }} +
  • @endif -
+ @endif