Merge pull request #6149 from avramz/dialog
- fix: #6116 prevent dialog from closing when releasing mouse outside…pull/6171/head
commit
655798b33a
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<Portal :appendTo="appendTo">
|
<Portal :appendTo="appendTo">
|
||||||
<div v-if="containerVisible" :ref="maskRef" :class="cx('mask')" :style="sx('mask', true, { position, modal })" @click="onMaskClick" v-bind="ptm('mask')">
|
<div v-if="containerVisible" :ref="maskRef" :class="cx('mask')" :style="sx('mask', true, { position, modal })" @mousedown="onMaskMouseDown" @mouseup="onMaskMouseUp" v-bind="ptm('mask')">
|
||||||
<transition name="p-dialog" @before-enter="onBeforeEnter" @enter="onEnter" @before-leave="onBeforeLeave" @leave="onLeave" @after-leave="onAfterLeave" appear v-bind="ptm('transition')">
|
<transition name="p-dialog" @before-enter="onBeforeEnter" @enter="onEnter" @before-leave="onBeforeLeave" @leave="onLeave" @after-leave="onAfterLeave" appear v-bind="ptm('transition')">
|
||||||
<div v-if="visible" :ref="containerRef" v-focustrap="{ disabled: !modal }" :class="cx('root')" :style="sx('root')" role="dialog" :aria-labelledby="ariaLabelledById" :aria-modal="modal" v-bind="ptmi('root')">
|
<div v-if="visible" :ref="containerRef" v-focustrap="{ disabled: !modal }" :class="cx('root')" :style="sx('root')" role="dialog" :aria-labelledby="ariaLabelledById" :aria-modal="modal" v-bind="ptmi('root')">
|
||||||
<slot v-if="$slots.container" name="container" :closeCallback="close" :maximizeCallback="(event) => maximize(event)"></slot>
|
<slot v-if="$slots.container" name="container" :closeCallback="close" :maximizeCallback="(event) => maximize(event)"></slot>
|
||||||
|
@ -113,6 +113,7 @@ export default {
|
||||||
documentDragEndListener: null,
|
documentDragEndListener: null,
|
||||||
lastPageX: null,
|
lastPageX: null,
|
||||||
lastPageY: null,
|
lastPageY: null,
|
||||||
|
maskMouseDownTarget: null,
|
||||||
updated() {
|
updated() {
|
||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
this.containerVisible = this.visible;
|
this.containerVisible = this.visible;
|
||||||
|
@ -174,8 +175,11 @@ export default {
|
||||||
this.unbindGlobalListeners();
|
this.unbindGlobalListeners();
|
||||||
this.$emit('after-hide');
|
this.$emit('after-hide');
|
||||||
},
|
},
|
||||||
onMaskClick(event) {
|
onMaskMouseDown(event) {
|
||||||
if (this.dismissableMask && this.modal && this.mask === event.target) {
|
this.maskMouseDownTarget = event.target;
|
||||||
|
},
|
||||||
|
onMaskMouseUp() {
|
||||||
|
if (this.dismissableMask && this.modal && this.mask === this.maskMouseDownTarget) {
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue