mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Merge branch '3.x' into 3.x-fix-chunk-order-in-exports
This commit is contained in:
@@ -22,7 +22,9 @@ use Filament\Tables\Contracts\HasTable;
|
||||
use Illuminate\Bus\PendingBatch;
|
||||
use Illuminate\Foundation\Bus\PendingChain;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Bus;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Component;
|
||||
|
||||
use function Filament\Support\format_number;
|
||||
@@ -124,6 +126,10 @@ trait CanExportRecords
|
||||
);
|
||||
|
||||
$columnMap = collect($data['columnMap'])
|
||||
->dot()
|
||||
->reduce(fn (Collection $carry, mixed $value, string $key): Collection => $carry->mergeRecursive([
|
||||
Str::beforeLast($key, '.') => [Str::afterLast($key, '.') => $value],
|
||||
]), collect())
|
||||
->filter(fn (array $column): bool => $column['isEnabled'] ?? false)
|
||||
->mapWithKeys(fn (array $column, string $columnName): array => [$columnName => $column['label']])
|
||||
->all();
|
||||
|
||||
@@ -60,7 +60,7 @@ trait HasFilters
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function removeTableFilter(string $filterName, ?string $field = null, bool $shouldTriggerUpdatedFiltersHook = true): void
|
||||
public function removeTableFilter(string $filterName, ?string $field = null, bool $isRemovingAllFilters = false): void
|
||||
{
|
||||
$filter = $this->getTable()->getFilter($filterName);
|
||||
$filterResetState = $filter->getResetState();
|
||||
@@ -82,11 +82,17 @@ trait HasFilters
|
||||
});
|
||||
}
|
||||
|
||||
if (! $shouldTriggerUpdatedFiltersHook) {
|
||||
if ($isRemovingAllFilters) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->updatedTableFilters();
|
||||
if ($this->getTable()->hasDeferredFilters()) {
|
||||
$this->applyTableFilters();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->handleTableFilterUpdates();
|
||||
}
|
||||
|
||||
public function removeTableFilters(): void
|
||||
@@ -96,20 +102,32 @@ trait HasFilters
|
||||
foreach ($filters as $filterName => $filter) {
|
||||
$this->removeTableFilter(
|
||||
$filterName,
|
||||
shouldTriggerUpdatedFiltersHook: false,
|
||||
isRemovingAllFilters: true,
|
||||
);
|
||||
}
|
||||
|
||||
$this->updatedTableFilters();
|
||||
|
||||
$this->resetTableSearch();
|
||||
$this->resetTableColumnSearches();
|
||||
|
||||
if ($this->getTable()->hasDeferredFilters()) {
|
||||
$this->applyTableFilters();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->handleTableFilterUpdates();
|
||||
}
|
||||
|
||||
public function resetTableFiltersForm(): void
|
||||
{
|
||||
$this->getTableFiltersForm()->fill();
|
||||
|
||||
if ($this->getTable()->hasDeferredFilters()) {
|
||||
$this->applyTableFilters();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->handleTableFilterUpdates();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user