@php use Filament\Support\Enums\Alignment; use Filament\Tables\Enums\ActionsPosition; use Filament\Tables\Enums\FiltersLayout; use Filament\Tables\Enums\RecordCheckboxPosition; $actions = $getActions(); $actionsAlignment = $getActionsAlignment(); $actionsPosition = $getActionsPosition(); $actionsColumnLabel = $getActionsColumnLabel(); $columns = $getVisibleColumns(); $collapsibleColumnsLayout = $getCollapsibleColumnsLayout(); $content = $getContent(); $contentGrid = $getContentGrid(); $contentFooter = $getContentFooter(); $filterIndicators = [ ...($hasSearch() ? ['resetTableSearch' => $getSearchIndicator()] : []), ...collect($getColumnSearchIndicators()) ->mapWithKeys(fn (string $indicator, string $column): array => [ "resetTableColumnSearch('{$column}')" => $indicator, ]) ->all(), ...array_reduce( $getFilters(), fn (array $carry, \Filament\Tables\Filters\BaseFilter $filter): array => [ ...$carry, ...collect($filter->getIndicators()) ->mapWithKeys(fn (string $label, int | string $field) => [ "removeTableFilter('{$filter->getName()}'" . (is_string($field) ? ' , \'' . $field . '\'' : null) . ')' => $label, ]) ->all(), ], [], ), ]; $hasColumnsLayout = $hasColumnsLayout(); $hasSummary = $hasSummary(); $header = $getHeader(); $headerActions = array_filter( $getHeaderActions(), fn (\Filament\Tables\Actions\Action | \Filament\Tables\Actions\BulkAction | \Filament\Tables\Actions\ActionGroup $action): bool => $action->isVisible(), ); $headerActionsPosition = $getHeaderActionsPosition(); $heading = $getHeading(); $group = $getGrouping(); $bulkActions = array_filter( $getBulkActions(), fn (\Filament\Tables\Actions\BulkAction | \Filament\Tables\Actions\ActionGroup $action): bool => $action->isVisible(), ); $groups = $getGroups(); $description = $getDescription(); $isGroupsOnly = $isGroupsOnly() && $group; $isReorderable = $isReorderable(); $isReordering = $isReordering(); $isColumnSearchVisible = $isSearchableByColumn(); $isGlobalSearchVisible = $isSearchable(); $isSelectionEnabled = $isSelectionEnabled(); $recordCheckboxPosition = $getRecordCheckboxPosition(); $isStriped = $isStriped(); $isLoaded = $isLoaded(); $hasFilters = $isFilterable(); $filtersLayout = $getFiltersLayout(); $filtersTriggerAction = $getFiltersTriggerAction(); $hasFiltersDropdown = $hasFilters && ($filtersLayout === FiltersLayout::Dropdown); $hasFiltersAboveContent = $hasFilters && in_array($filtersLayout, [FiltersLayout::AboveContent, FiltersLayout::AboveContentCollapsible]); $hasFiltersAboveContentCollapsible = $hasFilters && ($filtersLayout === FiltersLayout::AboveContentCollapsible); $hasFiltersBelowContent = $hasFilters && ($filtersLayout === FiltersLayout::BelowContent); $hasColumnToggleDropdown = $hasToggleableColumns(); $hasHeader = $header || $heading || $description || ($headerActions && (! $isReordering)) || $isReorderable || count($groups) || $isGlobalSearchVisible || $hasFilters || $hasColumnToggleDropdown; $hasHeaderToolbar = $isReorderable || count($groups) || $isGlobalSearchVisible || $hasFiltersDropdown || $hasColumnToggleDropdown; $pluralModelLabel = $getPluralModelLabel(); $records = $isLoaded ? $getRecords() : null; $allSelectableRecordsCount = $isLoaded ? $getAllSelectableRecordsCount() : null; $columnsCount = count($columns); $reorderRecordsTriggerAction = $getReorderRecordsTriggerAction($isReordering); $toggleColumnsTriggerAction = $getToggleColumnsTriggerAction(); if (count($actions) && (! $isReordering)) { $columnsCount++; } if ($isSelectionEnabled || $isReordering) { $columnsCount++; } if ($group) { $groupedSummarySelectedState = $this->getTableSummarySelectedState($this->getAllTableSummaryQuery(), modifyQueryUsing: fn (\Illuminate\Database\Query\Builder $query) => $group->groupQuery($query, model: $getQuery()->getModel())); } $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