This commit is contained in:
2025-10-22 20:08:22 +05:00
commit 736e3bef18
2573 changed files with 120385 additions and 0 deletions

View File

@@ -0,0 +1,193 @@
@props([
'applyAction',
'columns' => null,
'hasReorderableColumns',
'hasToggleableColumns',
'headingTag' => 'h3',
'reorderAnimationDuration' => 300,
])
@php
use Filament\Support\Enums\GridDirection;
use Illuminate\View\ComponentAttributeBag;
@endphp
<div class="fi-ta-col-manager">
<div
x-data="filamentTableColumnManager({
columns: $wire.entangle('tableColumns'),
isLive: {{ $applyAction->isVisible() ? 'false' : 'true' }},
})"
class="fi-ta-col-manager-ctn"
>
<div class="fi-ta-col-manager-header">
<{{ $headingTag }} class="fi-ta-col-manager-heading">
{{ __('filament-tables::table.column_manager.heading') }}
</{{ $headingTag }}>
<div>
<x-filament::link
:attributes="
\Filament\Support\prepare_inherited_attributes(
new ComponentAttributeBag([
'color' => 'danger',
'tag' => 'button',
'wire:click' => 'resetTableColumnManager',
'wire:loading.remove.delay.' . config('filament.livewire_loading_delay', 'default') => '',
'wire:target' => 'resetTableColumnManager',
])
)
"
>
{{ __('filament-tables::table.column_manager.actions.reset.label') }}
</x-filament::link>
</div>
</div>
<div
@if ($hasReorderableColumns)
x-sortable
x-on:end.stop="reorderColumns($event.target.sortable.toArray())"
data-sortable-animation-duration="{{ $reorderAnimationDuration }}"
@endif
{{
(new ComponentAttributeBag)
->grid($columns, GridDirection::Column)
->class(['fi-ta-col-manager-items'])
}}
>
<template
x-for="(column, index) in columns.filter((column) => ! column.isHidden && column.label)"
x-bind:key="(column.type === 'group' ? 'group::' : 'column::') + column.name + '_' + index"
>
<div
@if ($hasReorderableColumns)
x-bind:x-sortable-item="column.type === 'group' ? 'group::' + column.name : 'column::' + column.name"
@endif
>
<template x-if="column.type === 'group'">
<div class="fi-ta-col-manager-group">
<div class="fi-ta-col-manager-item">
<label class="fi-ta-col-manager-label">
@if ($hasToggleableColumns)
<input
type="checkbox"
class="fi-checkbox-input fi-valid"
x-bind:id="'group-' + column.name"
x-bind:checked="(groupedColumns[column.name] || {}).checked || false"
x-bind:disabled="(groupedColumns[column.name] || {}).disabled || false"
x-effect="$el.indeterminate = (groupedColumns[column.name] || {}).indeterminate || false"
x-on:change="toggleGroup(column.name)"
/>
@endif
<span x-html="column.label"></span>
</label>
@if ($hasReorderableColumns)
<button
x-sortable-handle
x-on:click.stop
class="fi-ta-col-manager-reorder-handle fi-icon-btn"
type="button"
>
{{ \Filament\Support\generate_icon_html(\Filament\Support\Icons\Heroicon::Bars2, alias: \Filament\Tables\View\TablesIconAlias::REORDER_HANDLE) }}
</button>
@endif
</div>
<div
@if ($hasReorderableColumns)
x-sortable
x-on:end.stop="reorderGroupColumns($event.target.sortable.toArray(), column.name)"
data-sortable-animation-duration="{{ $reorderAnimationDuration }}"
@endif
class="fi-ta-col-manager-group-items"
>
<template
x-for="
(groupColumn, index) in
column.columns.filter((column) => ! column.isHidden && column.label)
"
x-bind:key="'column::' + groupColumn.name + '_' + index"
>
<div
@if ($hasReorderableColumns)
x-bind:x-sortable-item="'column::' + groupColumn.name"
@endif
>
<div class="fi-ta-col-manager-item">
<label
class="fi-ta-col-manager-label"
>
@if ($hasToggleableColumns)
<input
type="checkbox"
class="fi-checkbox-input fi-valid"
x-bind:id="'column-' + groupColumn.name.replace('.', '-')"
x-bind:checked="(getColumn(groupColumn.name, column.name) || {}).isToggled || false"
x-bind:disabled="(getColumn(groupColumn.name, column.name) || {}).isToggleable === false"
x-on:change="toggleColumn(groupColumn.name, column.name)"
/>
@endif
<span
x-html="groupColumn.label"
></span>
</label>
@if ($hasReorderableColumns)
<button
x-sortable-handle
x-on:click.stop
class="fi-ta-col-manager-reorder-handle fi-icon-btn"
type="button"
>
{{ \Filament\Support\generate_icon_html(\Filament\Support\Icons\Heroicon::Bars2, alias: \Filament\Tables\View\TablesIconAlias::REORDER_HANDLE) }}
</button>
@endif
</div>
</div>
</template>
</div>
</div>
</template>
<template x-if="column.type !== 'group'">
<div class="fi-ta-col-manager-item">
<label class="fi-ta-col-manager-label">
@if ($hasToggleableColumns)
<input
type="checkbox"
class="fi-checkbox-input fi-valid"
x-bind:id="'column-' + column.name.replace('.', '-')"
x-bind:checked="(getColumn(column.name, null) || {}).isToggled || false"
x-bind:disabled="(getColumn(column.name, null) || {}).isToggleable === false"
x-on:change="toggleColumn(column.name)"
/>
@endif
<span x-html="column.label"></span>
</label>
@if ($hasReorderableColumns)
<button
x-sortable-handle
x-on:click.stop
class="fi-ta-col-manager-reorder-handle fi-icon-btn"
type="button"
>
{{ \Filament\Support\generate_icon_html(\Filament\Support\Icons\Heroicon::Bars2, alias: \Filament\Tables\View\TablesIconAlias::REORDER_HANDLE) }}
</button>
@endif
</div>
</template>
</div>
</template>
</div>
@if ($applyAction->isVisible())
<div class="fi-ta-col-manager-apply-action-ctn">
{{ $applyAction }}
</div>
@endif
</div>
</div>

View File

@@ -0,0 +1,18 @@
{{-- @deprecated Copy the code from this view directly into your own view to improve performance. --}}
@props([
'components',
'record',
'recordKey' => null,
'rowLoop' => null,
])
@foreach ($components as $layoutComponent)
{{
$layoutComponent
->record($record)
->recordKey($recordKey)
->rowLoop($rowLoop)
->renderInLayout()
}}
@endforeach

View File

@@ -0,0 +1,39 @@
@props([
'applyAction',
'form',
'headingTag' => 'h3',
])
<div {{ $attributes->class(['fi-ta-filters']) }}>
<div class="fi-ta-filters-header">
<{{ $headingTag }} class="fi-ta-filters-heading">
{{ __('filament-tables::table.filters.heading') }}
</{{ $headingTag }}>
<div>
<x-filament::link
:attributes="
\Filament\Support\prepare_inherited_attributes(
new \Illuminate\View\ComponentAttributeBag([
'color' => 'danger',
'tag' => 'button',
'wire:click' => 'resetTableFiltersForm',
'wire:loading.remove.delay.' . config('filament.livewire_loading_delay', 'default') => '',
'wire:target' => 'resetTableFiltersForm',
])
)
"
>
{{ __('filament-tables::table.filters.actions.reset.label') }}
</x-filament::link>
</div>
</div>
{{ $form }}
@if ($applyAction->isVisible())
<div class="fi-ta-filters-apply-action-ctn">
{{ $applyAction }}
</div>
@endif
</div>

View File

@@ -0,0 +1,46 @@
@php
use Illuminate\View\ComponentAttributeBag;
@endphp
@props([
'debounce' => '500ms',
'onBlur' => false,
'placeholder' => __('filament-tables::table.fields.search.placeholder'),
'wireModel' => 'tableSearch',
])
@php
$wireModelAttribute = $onBlur ? 'wire:model.blur' : "wire:model.live.debounce.{$debounce}";
@endphp
<div
x-id="['input']"
{{ $attributes->class(['fi-ta-search-field']) }}
>
<label x-bind:for="$id('input')" class="fi-sr-only">
{{ __('filament-tables::table.fields.search.label') }}
</label>
<x-filament::input.wrapper
inline-prefix
:prefix-icon="\Filament\Support\Icons\Heroicon::MagnifyingGlass"
:prefix-icon-alias="\Filament\Tables\View\TablesIconAlias::SEARCH_FIELD"
:wire:target="$wireModel"
>
<x-filament::input
:attributes="
(new ComponentAttributeBag)->merge([
'autocomplete' => 'off',
'inlinePrefix' => true,
'maxlength' => 1000,
'placeholder' => $placeholder,
'type' => 'search',
'wire:key' => $this->getId() . '.table.' . $wireModel . '.field.input',
$wireModelAttribute => $wireModel,
'x-bind:id' => '$id(\'input\')',
'x-on:keyup' => 'if ($event.key === \'Enter\') { $wire.$refresh() }',
], escape: false)
"
/>
</x-filament::input.wrapper>
</div>

View File

@@ -0,0 +1,129 @@
@props([
'actions' => false,
'actionsPosition' => null,
'columns',
'extraHeadingColumn' => false,
'groupColumn' => null,
'groupsOnly' => false,
'placeholderColumns' => true,
'pluralModelLabel',
'recordCheckboxPosition' => null,
'records',
'selectionEnabled' => false,
])
@php
use Filament\Support\Enums\Alignment;
use Filament\Tables\Columns\Column;
use Filament\Tables\Enums\RecordActionsPosition;
use Filament\Tables\Enums\RecordCheckboxPosition;
if ($groupsOnly && $groupColumn) {
$columns = collect($columns)
->reject(fn (Column $column): bool => $column->getName() === $groupColumn)
->all();
}
$hasPageSummary = (! $groupsOnly) && $records instanceof \Illuminate\Contracts\Pagination\Paginator && $records->hasPages();
$pageTableSummaryQuery = $hasPageSummary ? $this->getPageTableSummaryQuery() : null;
$allTableSummaryQuery = $this->getAllTableSummaryQuery();
@endphp
@if ($hasPageSummary)
<tr class="fi-ta-row fi-ta-summary-header-row fi-striped">
@if ($placeholderColumns && $actions && in_array($actionsPosition, [RecordActionsPosition::BeforeCells, RecordActionsPosition::BeforeColumns]))
<td></td>
@endif
@if ($placeholderColumns && $selectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::BeforeCells)
<td></td>
@endif
@if ($extraHeadingColumn)
<td class="fi-ta-cell fi-ta-summary-header-cell">
{{ __('filament-tables::table.summary.heading', ['label' => $pluralModelLabel]) }}
</td>
@endif
@foreach ($columns as $column)
@php
$columnHasSummary = ($pageTableSummaryQuery && $column->hasSummary($pageTableSummaryQuery)) || $column->hasSummary($allTableSummaryQuery);
@endphp
@if ($placeholderColumns || $columnHasSummary)
@php
$alignment = $column->getAlignment() ?? Alignment::Start;
if (! $alignment instanceof Alignment) {
$alignment = filled($alignment) ? (Alignment::tryFrom($alignment) ?? $alignment) : null;
}
$hasColumnHeaderLabel = (! $placeholderColumns) || $columnHasSummary;
@endphp
<td
{{
$column->getExtraHeaderAttributeBag()->class([
'fi-ta-cell fi-ta-summary-header-cell',
'fi-wrapped' => $column->canHeaderWrap(),
(($alignment instanceof Alignment) ? "fi-align-{$alignment->value}" : (is_string($alignment) ? $alignment : '')) => (! ($loop->first && (! $extraHeadingColumn))) && $hasColumnHeaderLabel,
])
}}
>
@if ($loop->first && (! $extraHeadingColumn))
{{ __('filament-tables::table.summary.heading', ['label' => $pluralModelLabel]) }}
@elseif ($hasColumnHeaderLabel)
{{ $column->getLabel() }}
@endif
</td>
@endif
@endforeach
@if ($placeholderColumns && $actions && in_array($actionsPosition, [RecordActionsPosition::AfterColumns, RecordActionsPosition::AfterCells]))
<td></td>
@endif
@if ($placeholderColumns && $selectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::AfterCells)
<td></td>
@endif
</tr>
@php
$selectedState = $this->getTableSummarySelectedState($pageTableSummaryQuery)[0] ?? [];
@endphp
<x-filament-tables::summary.row
:actions="$actions"
:actions-position="$actionsPosition"
:columns="$columns"
:extra-heading-column="$extraHeadingColumn"
:heading="__('filament-tables::table.summary.subheadings.page', ['label' => $pluralModelLabel])"
:placeholder-columns="$placeholderColumns"
:query="$pageTableSummaryQuery"
:record-checkbox-position="$recordCheckboxPosition"
:selected-state="$selectedState"
:selection-enabled="$selectionEnabled"
/>
@endif
@php
$selectedState = $this->getTableSummarySelectedState($allTableSummaryQuery)[0] ?? [];
@endphp
<x-filament-tables::summary.row
:actions="$actions"
:actions-position="$actionsPosition"
:columns="$columns"
:extra-heading-column="$extraHeadingColumn"
:groups-only="$groupsOnly"
:heading="__(($hasPageSummary ? 'filament-tables::table.summary.subheadings.all' : 'filament-tables::table.summary.heading'), ['label' => $pluralModelLabel])"
:placeholder-columns="$placeholderColumns"
:query="$allTableSummaryQuery"
:record-checkbox-position="$recordCheckboxPosition"
:selected-state="$selectedState"
:selection-enabled="$selectionEnabled"
@class([
'fi-striped' => ! $hasPageSummary,
])
/>

View File

@@ -0,0 +1,96 @@
@props([
'actions' => false,
'actionsPosition' => null,
'columns',
'extraHeadingColumn' => false,
'groupColumn' => null,
'groupsOnly' => false,
'heading',
'placeholderColumns' => true,
'query',
'selectionEnabled' => false,
'selectedState',
'recordCheckboxPosition' => null,
])
@php
use Filament\Support\Enums\Alignment;
use Filament\Tables\Columns\Column;
use Filament\Tables\Enums\RecordActionsPosition;
use Filament\Tables\Enums\RecordCheckboxPosition;
if ($groupsOnly && $groupColumn) {
$columns = collect($columns)
->reject(fn (Column $column): bool => $column->getName() === $groupColumn)
->all();
}
@endphp
<tr {{ $attributes->class(['fi-ta-row fi-ta-summary-row']) }}>
@if ($placeholderColumns && $actions && in_array($actionsPosition, [RecordActionsPosition::BeforeCells, RecordActionsPosition::BeforeColumns]))
<td></td>
@endif
@if ($placeholderColumns && $selectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::BeforeCells)
<td></td>
@endif
@if ($extraHeadingColumn || $groupsOnly)
<td class="fi-ta-cell fi-ta-summary-row-heading-cell">
{{ $heading }}
</td>
@else
@php
$headingColumnSpan = 1;
foreach ($columns as $index => $column) {
if ($index === array_key_first($columns)) {
continue;
}
if ($column->hasSummary($query)) {
break;
}
$headingColumnSpan++;
}
@endphp
@endif
@foreach ($columns as $column)
@if (($loop->first || $extraHeadingColumn || $groupsOnly || ($loop->iteration > $headingColumnSpan)) && ($placeholderColumns || $column->hasSummary($query)))
@php
$alignment = $column->getAlignment() ?? Alignment::Start;
if (! $alignment instanceof Alignment) {
$alignment = filled($alignment) ? (Alignment::tryFrom($alignment) ?? $alignment) : null;
}
@endphp
<td
colspan="{{ ($loop->first && (! $extraHeadingColumn) && (! $groupsOnly) && ($headingColumnSpan > 1)) ? $headingColumnSpan : null }}"
@class([
'fi-ta-cell',
($alignment instanceof Alignment) ? "fi-align-{$alignment->value}" : (is_string($alignment) ? $alignment : ''),
'fi-ta-summary-row-heading-cell' => $loop->first && (! $extraHeadingColumn) && (! $groupsOnly),
])
>
@if ($loop->first && (! $extraHeadingColumn) && (! $groupsOnly))
{{ $heading }}
@elseif ((! $placeholderColumns) || $column->hasSummary($query))
@foreach ($column->getSummarizers($query) as $summarizer)
{{ $summarizer->query($query)->selectedState($selectedState) }}
@endforeach
@endif
</td>
@endif
@endforeach
@if ($placeholderColumns && $actions && in_array($actionsPosition, [RecordActionsPosition::AfterColumns, RecordActionsPosition::AfterCells]))
<td></td>
@endif
@if ($placeholderColumns && $selectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::AfterCells)
<td></td>
@endif
</tr>