@php use Filament\Tables\Actions\Position as ActionsPosition; use Filament\Tables\Actions\RecordCheckboxPosition; use Filament\Tables\Filters\Layout as FiltersLayout; $actions = $getActions(); $actionsPosition = $getActionsPosition(); $actionsColumnLabel = $getActionsColumnLabel(); $columns = $getColumns(); $collapsibleColumnsLayout = $getCollapsibleColumnsLayout(); $content = $getContent(); $contentGrid = $getContentGrid(); $contentFooter = $getContentFooter(); $filterIndicators = collect($getFilters()) ->mapWithKeys(fn (\Filament\Tables\Filters\BaseFilter $filter): array => [$filter->getName() => $filter->getIndicators()]) ->filter(fn (array $indicators): bool => count($indicators)) ->all(); $hasColumnsLayout = $hasColumnsLayout(); $header = $getHeader(); $headerActions = $getHeaderActions(); $heading = $getHeading(); $description = $getDescription(); $isReorderable = $isReorderable(); $isReordering = $isReordering(); $isColumnSearchVisible = $isSearchableByColumn(); $isGlobalSearchVisible = $isSearchable(); $isSelectionEnabled = $isSelectionEnabled(); $recordCheckboxPosition = $getRecordCheckboxPosition(); $isStriped = $isStriped(); $isLoaded = $isLoaded(); $hasFilters = $isFilterable(); $filtersLayout = $getFiltersLayout(); $hasFiltersPopover = $hasFilters && ($filtersLayout === FiltersLayout::Popover); $hasFiltersAboveContent = $hasFilters && in_array($filtersLayout, [FiltersLayout::AboveContent, FiltersLayout::AboveContentCollapsible]); $hasFiltersAboveContentCollapsible = $hasFilters && ($filtersLayout === FiltersLayout::AboveContentCollapsible); $hasFiltersAfterContent = $hasFilters && ($filtersLayout === FiltersLayout::BelowContent); $isColumnToggleFormVisible = $hasToggleableColumns(); $records = $isLoaded ? $getRecords() : null; $allSelectableRecordsCount = $isLoaded ? $getAllSelectableRecordsCount() : null; $columnsCount = count($columns); if (count($actions) && (! $isReordering)) { $columnsCount++; } if ($isSelectionEnabled || $isReordering) { $columnsCount++; } $getHiddenClasses = function (Filament\Tables\Columns\Column $column): ?string { if ($breakpoint = $column->getHiddenFrom()) { return match ($breakpoint) { 'sm' => 'sm:hidden', 'md' => 'md:hidden', 'lg' => 'lg:hidden', 'xl' => 'xl:hidden', '2xl' => '2xl:hidden', }; } if ($breakpoint = $column->getVisibleFrom()) { return match ($breakpoint) { 'sm' => 'hidden sm:table-cell', 'md' => 'hidden md:table-cell', 'lg' => 'hidden lg:table-cell', 'xl' => 'hidden xl:table-cell', '2xl' => 'hidden 2xl:table-cell', }; } return null; }; @endphp
@if ($header) {{ $header }} @elseif ($heading || $headerActions)
! $heading && $isReordering, ]) > {{ $heading }} {{ $description }}
@endif @if ($hasFiltersAboveContent)
@if ($hasFiltersAboveContentCollapsible)
@endif
@endif
@if ($isReorderable) @endif @if (! $isReordering) @endif
@if ($isGlobalSearchVisible || $hasFiltersPopover || $isColumnToggleFormVisible)
@if ($isGlobalSearchVisible)
@endif @if ($hasFiltersPopover) @endif @if ($isColumnToggleFormVisible) @endif
@endif
@if ($isReordering) @elseif ($isSelectionEnabled && $isLoaded) @endif
config('tables.dark_mode'), 'overflow-x-auto' => $content || $hasColumnsLayout, 'rounded-t-xl' => ! $renderHeader, 'border-t' => $renderHeader, ]) x-bind:class="{ 'rounded-t-xl': ! hasHeader, 'border-t': hasHeader, }" > @if (($content || $hasColumnsLayout) && ($records !== null) && count($records)) @if (($content || $hasColumnsLayout) && (! $isReordering)) @php $sortableColumns = array_filter( $columns, fn (\Filament\Tables\Columns\Column $column): bool => $column->isSortable(), ); @endphp
config('tables.dark_mode'), 'hidden' => (! $isSelectionEnabled) && (! count($sortableColumns)), ]) > @if ($isSelectionEnabled) @endif @if (count($sortableColumns))
@endif
@endif @if ($content) {{ $content->with(['records' => $records]) }} @else @foreach ($records as $record) @php $recordAction = $getRecordAction($record); $recordKey = $getRecordKey($record); $recordUrl = $getRecordUrl($record); $collapsibleColumnsLayout?->record($record); $hasCollapsibleColumnsLayout = $collapsibleColumnsLayout && (! $collapsibleColumnsLayout->isHidden()); @endphp
$recordUrl || $recordAction, 'dark:hover:bg-gray-500/10' => ($recordUrl || $recordAction) && config('tables.dark_mode'), 'dark:border-gray-600' => (! $contentGrid) && config('tables.dark_mode'), 'group' => $isReordering, 'rounded-xl border border-gray-200 shadow-sm' => $contentGrid, 'dark:border-gray-700 dark:bg-gray-700/40' => $contentGrid && config('tables.dark_mode'), ], $getRecordClasses($record), )) >
(! $contentGrid), 'mr-6 rtl:ml-6 rtl:mr-0' => $isSelectionEnabled || $hasCollapsibleColumnsLayout || $isReordering, ]) > @if ($isSelectionEnabled) @endif @if ($hasCollapsibleColumnsLayout)
$isSelectionEnabled, 'top-1' => ! $isSelectionEnabled, 'md:relative md:right-0 md:top-0 rtl:md:left-0' => ! $contentGrid, 'hidden' => $isReordering, ]) >
@endif @if ($recordUrl) @elseif ($recordAction) @php if ($this->getCachedTableAction($recordAction)) { $recordWireClickAction = "mountTableAction('{$recordAction}', '{$recordKey}')"; } else { $recordWireClickAction = "{$recordAction}('{$recordKey}')"; } @endphp @else
@endif @if (count($actions)) @endif
@if ($hasCollapsibleColumnsLayout)
(! $contentGrid) && $isSelectionEnabled, 'md:pl-12 rtl:md:pl-0 rtl:md:pr-12' => (! $contentGrid) && (! $isSelectionEnabled), 'hidden' => $isReordering, ]) > {{ $collapsibleColumnsLayout->viewData(['recordKey' => $recordKey]) }}
@endif
@endforeach
@endif @if (($content || $hasColumnsLayout) && $contentFooter) {{ $contentFooter->with(['columns' => $columns, 'records' => $records]) }} @endif @elseif (($records !== null) && count($records)) @if ($isReordering) @else @if (count($actions) && $actionsPosition === ActionsPosition::BeforeCells) @if ($actionsColumnLabel) {{ $actionsColumnLabel }} @else @endif @endif @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::BeforeCells) @endif @if (count($actions) && $actionsPosition === ActionsPosition::BeforeColumns) @if ($actionsColumnLabel) {{ $actionsColumnLabel }} @else @endif @endif @endif @foreach ($columns as $column) {{ $column->getLabel() }} @endforeach @if (! $isReordering) @if (count($actions) && $actionsPosition === ActionsPosition::AfterColumns) @if ($actionsColumnLabel) {{ $actionsColumnLabel }} @else @endif @endif @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::AfterCells) @endif @if (count($actions) && $actionsPosition === ActionsPosition::AfterCells) @if ($actionsColumnLabel) {{ $actionsColumnLabel }} @else @endif @endif @endif @if ($isColumnSearchVisible) @if ($isReordering) @else @if (count($actions) && in_array($actionsPosition, [ActionsPosition::BeforeCells, ActionsPosition::BeforeColumns])) @endif @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::BeforeCells) @endif @endif @foreach ($columns as $column) @if ($column->isIndividuallySearchable()) @endif @endforeach @if (! $isReordering) @if (count($actions) && in_array($actionsPosition, [ActionsPosition::AfterColumns, ActionsPosition::AfterCells])) @endif @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::AfterCells) @endif @endif @endif @if (($records !== null) && count($records)) @foreach ($records as $record) @php $recordAction = $getRecordAction($record); $recordKey = $getRecordKey($record); $recordUrl = $getRecordUrl($record); @endphp @if ($isReordering) @endif @if (count($actions) && $actionsPosition === ActionsPosition::BeforeCells) @endif @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::BeforeCells) @if ($isRecordSelectable($record)) @else @endif @endif @if (count($actions) && $actionsPosition === ActionsPosition::BeforeColumns) @endif @foreach ($columns as $column) @php $column->record($record); $column->rowLoop($loop->parent); @endphp @endforeach @if (count($actions) && $actionsPosition === ActionsPosition::AfterColumns) @endif @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::AfterCells) @if ($isRecordSelectable($record)) @else @endif @endif @if (count($actions) && $actionsPosition === ActionsPosition::AfterCells) @endif @endforeach @if ($contentFooter) {{ $contentFooter->with(['columns' => $columns, 'records' => $records]) }} @endif @endif @elseif ($records === null)
config('tables.dark_mode'), ]) >
@else @if ($emptyState = $getEmptyState()) {{ $emptyState }} @else
{{ $getEmptyStateHeading() }} {{ $getEmptyStateDescription() }}
@endif @endif
@if ($records instanceof \Illuminate\Contracts\Pagination\Paginator && ((! $records instanceof \Illuminate\Contracts\Pagination\LengthAwarePaginator) || $records->total()))
config('tables.dark_mode'), ]) >
@endif @if ($hasFiltersAfterContent)
@endif
@php $action = $getMountedAction(); @endphp @if ($action) @if ($action->isModalCentered()) @if ($heading = $action->getModalHeading()) {{ $heading }} @endif @if ($subheading = $action->getModalSubheading()) {{ $subheading }} @endif @else @if ($heading = $action->getModalHeading()) {{ $heading }} @endif @if ($subheading = $action->getModalSubheading()) {{ $subheading }} @endif @endif {{ $action->getModalContent() }} @if ($action->hasFormSchema()) {{ $getMountedActionForm() }} @endif {{ $action->getModalFooter() }} @if (count($action->getModalActions())) @foreach ($action->getModalActions() as $modalAction) {{ $modalAction }} @endforeach @endif @endif
@php $action = $getMountedBulkAction(); @endphp @if ($action) @if ($action->isModalCentered()) @if ($heading = $action->getModalHeading()) {{ $heading }} @endif @if ($subheading = $action->getModalSubheading()) {{ $subheading }} @endif @else @if ($heading = $action->getModalHeading()) {{ $heading }} @endif @if ($subheading = $action->getModalSubheading()) {{ $subheading }} @endif @endif {{ $action->getModalContent() }} @if ($action->hasFormSchema()) {{ $getMountedBulkActionForm() }} @endif {{ $action->getModalFooter() }} @if (count($action->getModalActions())) @foreach ($action->getModalActions() as $modalAction) {{ $modalAction }} @endforeach @endif @endif
@if (! $this instanceof \Filament\Tables\Contracts\RendersFormComponentActionModal) {{ $this->modal }} @endif