Merge pull request #16185 from alperenersoy/fix/modal-closed-event-id-check

This commit is contained in:
Dan Harrin
2025-06-02 20:11:13 +01:00
committed by GitHub
2 changed files with 22 additions and 2 deletions
@@ -27,6 +27,10 @@
:wire:key="$action ? $this->getId() . '.actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedActions.length) open()"
x-on:modal-closed.stop="
if (!$event.detail?.id?.startsWith('{{ $this->getId() }}-')) {
return
}
const mountedActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedActionShouldOpenModal(mountedAction: $action)) }}
if (! mountedActionShouldOpenModal) {
@@ -89,6 +93,10 @@
:wire:key="$action ? $this->getId() . '.table.actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedTableActions.length) open()"
x-on:modal-closed.stop="
if (!$event.detail?.id?.startsWith('{{ $this->getId() }}-')) {
return
}
const mountedTableActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedTableActionShouldOpenModal(mountedAction: $action)) }}
if (! mountedTableActionShouldOpenModal) {
@@ -145,6 +153,10 @@
:wire:key="$action ? $this->getId() . '.table.bulk-actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedTableBulkAction) open()"
x-on:modal-closed.stop="
if (!$event.detail?.id?.startsWith('{{ $this->getId() }}-')) {
return
}
const mountedTableBulkActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedTableBulkActionShouldOpenModal(mountedBulkAction: $action)) }}
if (! mountedTableBulkActionShouldOpenModal) {
@@ -207,6 +219,10 @@
:wire:key="$action ? $this->getId() . '.infolist.actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedInfolistActions.length) open()"
x-on:modal-closed.stop="
if (!$event.detail?.id?.startsWith('{{ $this->getId() }}-')) {
return
}
const mountedInfolistActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedInfolistActionShouldOpenModal(mountedAction: $action)) }}
if (! mountedInfolistActionShouldOpenModal) {
@@ -268,6 +284,10 @@
:width="$action?->getModalWidth()"
:wire:key="$action ? $this->getId() . '.' . $action->getComponent()->getStatePath() . '.actions.' . $action->getName() . '.modal' : null"
x-on:modal-closed.stop="
if (!$event.detail?.id?.startsWith('{{ $this->getId() }}-')) {
return
}
const mountedFormComponentActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedFormComponentActionShouldOpenModal()) }}
if (mountedFormComponentActionShouldOpenModal) {
@@ -72,7 +72,7 @@
this.isOpen = false
this.$refs.modalContainer.dispatchEvent(
new CustomEvent('modal-closed', { id: '{{ $id }}' }),
new CustomEvent('modal-closed', { detail: { id: '{{ $id }}' } }),
)
},
@@ -85,7 +85,7 @@
@endif
this.$refs.modalContainer.dispatchEvent(
new CustomEvent('modal-opened', { id: '{{ $id }}' }),
new CustomEvent('modal-opened', { detail: { id: '{{ $id }}' } }),
)
})
},