Fixed #3733 - OverlayPanel: Backport events to v2.x

pull/4452/head
Tuğçe Küçükoğlu 2023-08-14 14:58:38 +03:00
parent 45caf7d78e
commit ca210e69a9
3 changed files with 30 additions and 1 deletions

View File

@ -1,7 +1,7 @@
import Vue, { VNode } from 'vue'; import Vue, { VNode } from 'vue';
declare class OverlayPanel extends Vue { declare class OverlayPanel extends Vue {
ismissable?: boolean; dismissable?: boolean;
showCloseIcon?: boolean; showCloseIcon?: boolean;
appendTo?: string; appendTo?: string;
baseZIndex?: number; baseZIndex?: number;
@ -10,6 +10,8 @@ declare class OverlayPanel extends Vue {
toggle(event: Event): void; toggle(event: Event): void;
show(event: Event, target?: any): void; show(event: Event, target?: any): void;
hide(): void; hide(): void;
$emit(eventName: 'show'): this;
$emit(eventName: 'hide'): this;
$slots: { $slots: {
'': VNode[]; '': VNode[];
} }

View File

@ -95,11 +95,13 @@ export default {
if (this.autoZIndex) { if (this.autoZIndex) {
this.$refs.container.style.zIndex = String(this.baseZIndex + DomHandler.generateZIndex()); this.$refs.container.style.zIndex = String(this.baseZIndex + DomHandler.generateZIndex());
} }
this.$emit('show');
}, },
onLeave() { onLeave() {
this.unbindOutsideClickListener(); this.unbindOutsideClickListener();
this.unbindScrollListener(); this.unbindScrollListener();
this.unbindResizeListener(); this.unbindResizeListener();
this.$emit('hide');
}, },
alignOverlay() { alignOverlay() {
DomHandler.absolutePosition(this.$refs.container, this.target); DomHandler.absolutePosition(this.$refs.container, this.target);

View File

@ -84,6 +84,31 @@ toggle(event) {
</table> </table>
</div> </div>
<h5>Events</h5>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Name</th>
<th>Parameters</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>show</td>
<td>-</td>
<td>Callback to invoke when overlay panel is shown.</td>
</tr>
<tr>
<td>hide</td>
<td>-</td>
<td>Callback to invoke when overlay panel is hidden.</td>
</tr>
</tbody>
</table>
</div>
<h5>Methods</h5> <h5>Methods</h5>
<div class="doc-tablewrapper"> <div class="doc-tablewrapper">
<table class="doc-table"> <table class="doc-table">