From 754fcdb2346beb9cec9fd835406eb1793ce5f1ed Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Sat, 10 Jun 2023 08:33:05 +0100 Subject: [PATCH] Use dispatch() instead of dispatchBrowserEvent() --- .../actions/src/Concerns/InteractsWithActions.php | 6 +++--- packages/forms/src/Components/Select.php | 2 +- packages/forms/src/Components/Wizard.php | 2 +- .../forms/src/Concerns/HasFormComponentActions.php | 12 ++++++------ packages/forms/src/Concerns/InteractsWithForms.php | 4 ++-- .../src/Concerns/InteractsWithInfolists.php | 6 +++--- packages/panels/src/Http/Livewire/GlobalSearch.php | 2 +- packages/panels/src/Resources/Pages/EditRecord.php | 2 +- .../tables/docs/03-columns/01-getting-started.md | 4 ++-- packages/tables/src/Concerns/HasActions.php | 6 +++--- packages/tables/src/Concerns/HasBulkActions.php | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/actions/src/Concerns/InteractsWithActions.php b/packages/actions/src/Concerns/InteractsWithActions.php index 533cd0bfe1..1e5379b10c 100644 --- a/packages/actions/src/Concerns/InteractsWithActions.php +++ b/packages/actions/src/Concerns/InteractsWithActions.php @@ -154,7 +154,7 @@ trait InteractsWithActions $this->resetErrorBag(); - $this->dispatchBrowserEvent('open-modal', [ + $this->dispatch('open-modal', [ 'id' => "{$this->id}-action", ]); @@ -350,7 +350,7 @@ trait InteractsWithActions } if (! count($this->mountedActions)) { - $this->dispatchBrowserEvent('close-modal', [ + $this->dispatch('close-modal', [ 'id' => "{$this->id}-action", ]); @@ -368,7 +368,7 @@ trait InteractsWithActions $this->resetErrorBag(); - $this->dispatchBrowserEvent('open-modal', [ + $this->dispatch('open-modal', [ 'id' => "{$this->id}-action", ]); } diff --git a/packages/forms/src/Components/Select.php b/packages/forms/src/Components/Select.php index 795fe83f6d..7f2c29b76c 100644 --- a/packages/forms/src/Components/Select.php +++ b/packages/forms/src/Components/Select.php @@ -389,7 +389,7 @@ class Select extends Field implements Contracts\HasAffixActions, Contracts\HasNe /** @var LivewireComponent $livewire */ $livewire = $component->getLivewire(); - $livewire->dispatchBrowserEvent('filament-forms::select.refreshSelectedOptionLabel', [ + $livewire->dispatch('filament-forms::select.refreshSelectedOptionLabel', [ 'livewireId' => $livewire->id, 'statePath' => $statePath, ]); diff --git a/packages/forms/src/Components/Wizard.php b/packages/forms/src/Components/Wizard.php index 1b063a9b9c..42062c0ee0 100644 --- a/packages/forms/src/Components/Wizard.php +++ b/packages/forms/src/Components/Wizard.php @@ -78,7 +78,7 @@ class Wizard extends Component /** @var LivewireComponent $livewire */ $livewire = $component->getLivewire(); - $livewire->dispatchBrowserEvent('next-wizard-step', [ + $livewire->dispatch('next-wizard-step', [ 'statePath' => $statePath, ]); }, diff --git a/packages/forms/src/Concerns/HasFormComponentActions.php b/packages/forms/src/Concerns/HasFormComponentActions.php index 6089d30632..45b04fec5f 100644 --- a/packages/forms/src/Concerns/HasFormComponentActions.php +++ b/packages/forms/src/Concerns/HasFormComponentActions.php @@ -151,11 +151,11 @@ trait HasFormComponentActions $this->resetErrorBag(); - $this->dispatchBrowserEvent('open-modal', [ + $this->dispatch('open-modal', [ 'id' => "{$this->id}-form-component-action", ]); - $this->dispatchBrowserEvent('opened-form-component-action-modal', [ + $this->dispatch('opened-form-component-action-modal', [ 'id' => $this->id, ]); @@ -271,11 +271,11 @@ trait HasFormComponentActions } if (! count($this->mountedFormComponentActions)) { - $this->dispatchBrowserEvent('close-modal', [ + $this->dispatch('close-modal', [ 'id' => "{$this->id}-form-component-action", ]); - $this->dispatchBrowserEvent('closed-form-component-action-modal', [ + $this->dispatch('closed-form-component-action-modal', [ 'id' => $this->id, ]); @@ -284,11 +284,11 @@ trait HasFormComponentActions $this->resetErrorBag(); - $this->dispatchBrowserEvent('open-modal', [ + $this->dispatch('open-modal', [ 'id' => "{$this->id}-form-component-action", ]); - $this->dispatchBrowserEvent('opened-form-component-action-modal', [ + $this->dispatch('opened-form-component-action-modal', [ 'id' => $this->id, ]); } diff --git a/packages/forms/src/Concerns/InteractsWithForms.php b/packages/forms/src/Concerns/InteractsWithForms.php index 3eba1f2d57..f0fd9df5ab 100644 --- a/packages/forms/src/Concerns/InteractsWithForms.php +++ b/packages/forms/src/Concerns/InteractsWithForms.php @@ -172,7 +172,7 @@ trait InteractsWithForms } catch (ValidationException $exception) { $this->onValidationError($exception); - $this->dispatchBrowserEvent('expand-concealing-component'); + $this->dispatch('expand-concealing-component'); throw $exception; } @@ -197,7 +197,7 @@ trait InteractsWithForms } catch (ValidationException $exception) { $this->onValidationError($exception); - $this->dispatchBrowserEvent('expand-concealing-component'); + $this->dispatch('expand-concealing-component'); throw $exception; } diff --git a/packages/infolists/src/Concerns/InteractsWithInfolists.php b/packages/infolists/src/Concerns/InteractsWithInfolists.php index c7f49f7f78..df525c66d3 100644 --- a/packages/infolists/src/Concerns/InteractsWithInfolists.php +++ b/packages/infolists/src/Concerns/InteractsWithInfolists.php @@ -184,7 +184,7 @@ trait InteractsWithInfolists $this->resetErrorBag(); - $this->dispatchBrowserEvent('open-modal', [ + $this->dispatch('open-modal', [ 'id' => "{$this->id}-infolist-action", ]); @@ -281,7 +281,7 @@ trait InteractsWithInfolists $this->mountedInfolistActionsComponent = null; $this->mountedInfolistActionsInfolist = null; - $this->dispatchBrowserEvent('close-modal', [ + $this->dispatch('close-modal', [ 'id' => "{$this->id}-infolist-action", ]); @@ -295,7 +295,7 @@ trait InteractsWithInfolists $this->resetErrorBag(); - $this->dispatchBrowserEvent('open-modal', [ + $this->dispatch('open-modal', [ 'id' => "{$this->id}-infolist-action", ]); } diff --git a/packages/panels/src/Http/Livewire/GlobalSearch.php b/packages/panels/src/Http/Livewire/GlobalSearch.php index 7f427aaaff..2c01520863 100644 --- a/packages/panels/src/Http/Livewire/GlobalSearch.php +++ b/packages/panels/src/Http/Livewire/GlobalSearch.php @@ -25,7 +25,7 @@ class GlobalSearch extends Component return $results; } - $this->dispatchBrowserEvent('open-global-search-results'); + $this->dispatch('open-global-search-results'); return $results; } diff --git a/packages/panels/src/Resources/Pages/EditRecord.php b/packages/panels/src/Resources/Pages/EditRecord.php index 5d57995223..6a74cb467a 100644 --- a/packages/panels/src/Resources/Pages/EditRecord.php +++ b/packages/panels/src/Resources/Pages/EditRecord.php @@ -182,7 +182,7 @@ class EditRecord extends Page public function openDeleteModal(): void { - $this->dispatchBrowserEvent('open-modal', [ + $this->dispatch('open-modal', [ 'id' => 'delete', ]); } diff --git a/packages/tables/docs/03-columns/01-getting-started.md b/packages/tables/docs/03-columns/01-getting-started.md index 8dc952b208..fbe1b7a771 100644 --- a/packages/tables/docs/03-columns/01-getting-started.md +++ b/packages/tables/docs/03-columns/01-getting-started.md @@ -232,7 +232,7 @@ use Filament\Tables\Columns\TextColumn; TextColumn::make('title') ->action(function (Post $record): void { - $this->dispatchBrowserEvent('open-post-edit-modal', [ + $this->dispatch('open-post-edit-modal', [ 'post' => $record->getKey(), ]); }) @@ -251,7 +251,7 @@ TextColumn::make('title') Action::make('select') ->requiresConfirmation() ->action(function (Post $record): void { - $this->dispatchBrowserEvent('select-post', [ + $this->dispatch('select-post', [ 'post' => $record->getKey(), ]); }), diff --git a/packages/tables/src/Concerns/HasActions.php b/packages/tables/src/Concerns/HasActions.php index 67eba5b6b1..95c6d884b8 100644 --- a/packages/tables/src/Concerns/HasActions.php +++ b/packages/tables/src/Concerns/HasActions.php @@ -159,7 +159,7 @@ trait HasActions $this->resetErrorBag(); - $this->dispatchBrowserEvent('open-modal', [ + $this->dispatch('open-modal', [ 'id' => "{$this->id}-table-action", ]); @@ -260,7 +260,7 @@ trait HasActions } if (! count($this->mountedTableActions)) { - $this->dispatchBrowserEvent('close-modal', [ + $this->dispatch('close-modal', [ 'id' => "{$this->id}-table-action", ]); @@ -277,7 +277,7 @@ trait HasActions $this->resetErrorBag(); - $this->dispatchBrowserEvent('open-modal', [ + $this->dispatch('open-modal', [ 'id' => "{$this->id}-table-action", ]); } diff --git a/packages/tables/src/Concerns/HasBulkActions.php b/packages/tables/src/Concerns/HasBulkActions.php index 16d71c8818..bb06f14a75 100644 --- a/packages/tables/src/Concerns/HasBulkActions.php +++ b/packages/tables/src/Concerns/HasBulkActions.php @@ -88,7 +88,7 @@ trait HasBulkActions $action->resetArguments(); $action->resetFormData(); - $this->dispatchBrowserEvent('close-modal', [ + $this->dispatch('close-modal', [ 'id' => "{$this->id}-table-bulk-action", ]); @@ -147,7 +147,7 @@ trait HasBulkActions $this->resetErrorBag(); - $this->dispatchBrowserEvent('open-modal', [ + $this->dispatch('open-modal', [ 'id' => "{$this->id}-table-bulk-action", ]);