diff --git a/resources/views/components/row.blade.php b/resources/views/components/row.blade.php index 4d63c202..4fa6f6ed 100644 --- a/resources/views/components/row.blade.php +++ b/resources/views/components/row.blade.php @@ -5,8 +5,8 @@ ]) @includeWhen(isset($setUp['responsive']), data_get($theme, 'root') . '.toggle-detail-responsive', [ - 'view' => data_get($setUp, 'detail.viewIcon') ?? null, - ]) + 'view' => data_get($setUp, 'detail.viewIcon') ?? null, +]) @php $defaultCollapseIcon = data_get($theme, 'root') . '.toggle-detail'; @@ -62,57 +62,61 @@ ]) wire:key="row-{{ substr($rowId, 0, 6) }}-{{ $field }}-{{ $childIndex ?? 0 }}" > - @if (empty(data_get($row, 'actions')) && data_get($column, 'isAction')) -
- @if (method_exists($this, 'actionsFromView') && ($actionsFromView = $this->actionsFromView($row))) -
- {!! $actionsFromView !!} -
- @endif - -
- @if (data_get($column, 'isAction')) -
+ @if (count(data_get($column, 'customContent')) > 0) + @include(data_get($column, 'customContent.view'), data_get($column, 'customContent.params')) + @else + @if (empty(data_get($row, 'actions')) && data_get($column, 'isAction')) +
+ @if (method_exists($this, 'actionsFromView') && ($actionsFromView = $this->actionsFromView($row))) +
+ {!! $actionsFromView !!}
@endif -
-
- @endif - @php - $showEditOnClick = $this->shouldShowEditOnClick($column, $row); - @endphp +
+ @if (data_get($column, 'isAction')) +
+
+ @endif +
+
+ @endif - @if ($showEditOnClick === true) - - @include(theme_style($theme, 'editable.view') ?? null, [ - 'editable' => data_get($column, 'editable'), - ]) - - @elseif(count(data_get($column, 'toggleable')) > 0) @php - $showToggleable = $this->shouldShowToggleable($column, $row); + $showEditOnClick = $this->shouldShowEditOnClick($column, $row); @endphp - @includeWhen($showToggleable, theme_style($theme, 'toggleable.view'), ['tableName' => $tableName]) - @else - - @if (filled($templateContent)) -
-
- @else -
{!! data_get($column, 'index') ? $rowIndex : $content !!}
- @endif -
+ + @if ($showEditOnClick === true) + + @include(theme_style($theme, 'editable.view') ?? null, [ + 'editable' => data_get($column, 'editable'), + ]) + + @elseif(count(data_get($column, 'toggleable')) > 0) + @php + $showToggleable = $this->shouldShowToggleable($column, $row); + @endphp + @include(theme_style($theme, 'toggleable.view'), ['tableName' => $tableName]) + @else + + @if (filled($templateContent)) +
+
+ @else +
{!! data_get($column, 'index') ? $rowIndex : $content !!}
+ @endif +
+ @endif @endif @endforeach diff --git a/src/Column.php b/src/Column.php index 0fc903ec..df1a38fa 100644 --- a/src/Column.php +++ b/src/Column.php @@ -64,6 +64,8 @@ final class Column implements \Livewire\Wireable public mixed $filters = null; + public array $customContent = []; + /** * Adds a new Column * @@ -259,7 +261,7 @@ public function editOnClick( public function toggleable( bool $hasPermission = true, string $trueLabel = 'Yes', - string $falseLabel = 'No' + string $falseLabel = 'No', ): Column { $this->editable = []; $this->toggleable = [