mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
refactor: update modal event dispatching and CSS structure
This commit is contained in:
Vendored
+1
-1
@@ -1 +1 @@
|
||||
(()=>{var n=({livewireId:i})=>({actionNestingIndex:null,init(){window.addEventListener("sync-action-modals",t=>{t.detail.id===i&&this.syncActionModals(t.detail.newActionNestingIndex)})},syncActionModals(t){if(this.actionNestingIndex===t){this.actionNestingIndex!==null&&this.$nextTick(()=>this.openModal());return}if(this.actionNestingIndex!==null&&this.closeModal(),this.actionNestingIndex=t,this.actionNestingIndex!==null){if(!this.$el.querySelector(`#${this.generateModalId(t)}`)){this.$nextTick(()=>this.openModal());return}this.openModal()}},generateModalId(t){return`fi-${i}-action-`+t},openModal(){let t=this.generateModalId(this.actionNestingIndex);this.$dispatch("open-modal",{id:t})},closeModal(){let t=this.generateModalId(this.actionNestingIndex);this.$dispatch("close-modal-quietly",{id:t})}});document.addEventListener("alpine:init",()=>{window.Alpine.data("filamentActionModals",n)});})();
|
||||
(()=>{var n=({livewireId:e})=>({actionNestingIndex:null,init(){window.addEventListener("sync-action-modals",t=>{t.detail.id===e&&this.syncActionModals(t.detail.newActionNestingIndex)})},syncActionModals(t){if(this.actionNestingIndex===t){this.actionNestingIndex!==null&&this.$nextTick(()=>this.openModal());return}if(this.actionNestingIndex!==null&&this.closeModal(),this.actionNestingIndex=t,this.actionNestingIndex!==null){if(!this.$el.querySelector(`#${this.generateModalId(t)}`)){this.$nextTick(()=>this.openModal());return}this.openModal()}},generateModalId(t){return`fi-${e}-action-`+t},openModal(){let t=this.generateModalId(this.actionNestingIndex);document.dispatchEvent(new CustomEvent("open-modal",{bubbles:!0,composed:!0,detail:{id:t}}))},closeModal(){let t=this.generateModalId(this.actionNestingIndex);document.dispatchEvent(new CustomEvent("close-modal-quietly",{bubbles:!0,composed:!0,detail:{id:t}}))}});document.addEventListener("alpine:init",()=>{window.Alpine.data("filamentActionModals",n)});})();
|
||||
|
||||
@@ -52,12 +52,24 @@ export default ({ livewireId }) => ({
|
||||
openModal() {
|
||||
const id = this.generateModalId(this.actionNestingIndex)
|
||||
|
||||
this.$dispatch('open-modal', { id })
|
||||
document.dispatchEvent(
|
||||
new CustomEvent('open-modal', {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
detail: { id },
|
||||
}),
|
||||
)
|
||||
},
|
||||
|
||||
closeModal() {
|
||||
const id = this.generateModalId(this.actionNestingIndex)
|
||||
|
||||
this.$dispatch('close-modal-quietly', { id })
|
||||
document.dispatchEvent(
|
||||
new CustomEvent('close-modal-quietly', {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
detail: { id },
|
||||
}),
|
||||
)
|
||||
},
|
||||
})
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
.fi-modal {
|
||||
&.fi-modal-slide-over,
|
||||
&.fi-width-screen {
|
||||
& .fi-modal-window {
|
||||
> .fi-modal-window-ctn > .fi-modal-window {
|
||||
@apply h-dvh;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user