pull/525/head
mertsincan 2020-09-28 13:58:09 +03:00
parent a80bdc9498
commit b8a5149718
12 changed files with 49 additions and 58 deletions

View File

@ -107,8 +107,11 @@ export default {
beforeUnmount() {
this.restoreAppend();
this.unbindOutsideClickListener();
this.unbindScrollListener();
this.scrollHandler = null;
if (this.scrollHandler) {
this.scrollHandler.destroy();
this.scrollHandler = null;
}
this.overlay = null;
},
methods: {
@ -143,8 +146,7 @@ export default {
},
bindScrollListener() {
if (!this.scrollHandler) {
const { id } = this.$attrs;
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, id, () => {
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, () => {
if (this.overlayVisible) {
this.hideOverlay();
}

View File

@ -342,8 +342,11 @@ export default {
this.restoreAppend();
this.unbindOutsideClickListener();
this.unbindScrollListener();
this.scrollHandler = null;
if (this.scrollHandler) {
this.scrollHandler.destroy();
this.scrollHandler = null;
}
this.overlay = null;
},
data() {
@ -646,8 +649,7 @@ export default {
},
bindScrollListener() {
if (!this.scrollHandler) {
const { id } = this.$attrs;
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, id, () => {
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, () => {
if (this.overlayVisible) {
this.overlayVisible = false;
}

View File

@ -84,8 +84,11 @@ export default {
this.unbindOutsideClickListener();
this.unbindDocumentMouseMoveListener();
this.unbindDocumentMouseUpListener();
this.unbindScrollListener();
this.scrollHandler = null;
if (this.scrollHandler) {
this.scrollHandler.destroy();
this.scrollHandler = null;
}
this.clearRefs();
},
mounted() {
@ -410,8 +413,7 @@ export default {
},
bindScrollListener() {
if (!this.scrollHandler) {
const { id } = this.$attrs;
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, id, () => {
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, () => {
if (this.overlayVisible) {
this.overlayVisible = false;
}

View File

@ -93,8 +93,11 @@ export default {
beforeUnmount() {
this.restoreAppend();
this.unbindOutsideClickListener();
this.unbindScrollListener();
this.scrollHandler = null;
if (this.scrollHandler) {
this.scrollHandler.destroy();
this.scrollHandler = null;
}
this.overlay = null;
},
updated() {
@ -355,8 +358,7 @@ export default {
},
bindScrollListener() {
if (!this.scrollHandler) {
const { id } = this.$attrs;
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, id, () => {
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, () => {
if (this.overlayVisible) {
this.hide();
}

View File

@ -103,8 +103,11 @@ export default {
beforeUnmount() {
this.restoreAppend();
this.unbindOutsideClickListener();
this.unbindScrollListener();
this.scrollHandler = null;
if (this.scrollHandler) {
this.scrollHandler.destroy();
this.scrollHandler = null;
}
this.overlay = null;
},
updated() {
@ -315,8 +318,7 @@ export default {
},
bindScrollListener() {
if (!this.scrollHandler) {
const { id } = this.$attrs;
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, id, () => {
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, () => {
if (this.overlayVisible) {
this.hide();
}

View File

@ -1,7 +1,6 @@
import Vue, { VNode } from 'vue';
export declare class OverlayPanel extends Vue {
id?: string;
ismissable?: boolean;
showCloseIcon?: boolean;
appendTo?: string;

View File

@ -1,6 +1,6 @@
<template>
<transition name="p-overlaypanel" @enter="onEnter" @leave="onLeave">
<div class="p-overlaypanel p-component" v-if="visible" :id="containerId" :ref="containerRef">
<div class="p-overlaypanel p-component" v-if="visible" :ref="containerRef">
<div class="p-overlaypanel-content">
<slot></slot>
</div>
@ -13,13 +13,11 @@
<script>
import ConnectedOverlayScrollHandler from '../utils/ConnectedOverlayScrollHandler';
import UniqueComponentId from '../utils/UniqueComponentId';
import DomHandler from '../utils/DomHandler';
import Ripple from '../ripple/Ripple';
export default {
props: {
id: null,
dismissable: {
type: Boolean,
default: true
@ -61,8 +59,11 @@ export default {
if (this.dismissable) {
this.unbindOutsideClickListener();
}
this.unbindScrollListener();
this.scrollHandler = null;
if (this.scrollHandler) {
this.scrollHandler.destroy();
this.scrollHandler = null;
}
this.target = null;
this.container = null;
},
@ -124,7 +125,7 @@ export default {
},
bindScrollListener() {
if (!this.scrollHandler) {
this.scrollHandler = new ConnectedOverlayScrollHandler(this.target, this.containerId, () => {
this.scrollHandler = new ConnectedOverlayScrollHandler(this.target, () => {
if (this.visible) {
this.visible = false;
}
@ -177,11 +178,6 @@ export default {
this.container = el;
}
},
computed: {
containerId() {
return this.id || UniqueComponentId();
}
},
directives: {
'ripple': Ripple
}

View File

@ -50,8 +50,10 @@ export default {
this.strongCheckRegExp = new RegExp(this.strongRegex);
},
beforeUnmount() {
this.unbindScrollListener();
this.scrollHandler = null;
if (this.scrollHandler) {
this.scrollHandler.destroy();
this.scrollHandler = null;
}
},
methods: {
testStrength(str) {
@ -155,8 +157,7 @@ export default {
},
bindScrollListener() {
if (!this.scrollHandler) {
const { id } = this.$attrs;
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.input, id, () => {
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.input, () => {
if (DomHandler.hasClass(this.panel, 'p-connected-overlay-visible')) {
this.hideOverlay();
}

View File

@ -1,7 +1,6 @@
import Vue from 'vue';
export declare class TieredMenu extends Vue {
id?: string;
popup?: boolean;
model?: any[];
appendTo?: string;

View File

@ -1,6 +1,6 @@
<template>
<transition name="p-connected-overlay" @enter="onEnter" @leave="onLeave">
<div :ref="containerRef" :id="containerId" :class="containerClass" v-if="popup ? visible : true">
<div :ref="containerRef" :class="containerClass" v-if="popup ? visible : true">
<TieredMenuSub :model="model" :root="true" :popup="popup" @leaf-click="onLeafClick"/>
</div>
</transition>
@ -8,13 +8,11 @@
<script>
import ConnectedOverlayScrollHandler from '../utils/ConnectedOverlayScrollHandler';
import UniqueComponentId from '../utils/UniqueComponentId';
import DomHandler from '../utils/DomHandler';
import TieredMenuSub from './TieredMenuSub';
export default {
props: {
id: null,
popup: {
type: Boolean,
default: false
@ -50,8 +48,11 @@ export default {
this.restoreAppend();
this.unbindResizeListener();
this.unbindOutsideClickListener();
this.unbindScrollListener();
this.scrollHandler = null;
if (this.scrollHandler) {
this.scrollHandler.destroy();
this.scrollHandler = null;
}
this.target = null;
this.container = null;
},
@ -114,7 +115,7 @@ export default {
},
bindScrollListener() {
if (!this.scrollHandler) {
this.scrollHandler = new ConnectedOverlayScrollHandler(this.target, this.containerId, () => {
this.scrollHandler = new ConnectedOverlayScrollHandler(this.target, () => {
if (this.visible) {
this.hide();
}
@ -173,9 +174,6 @@ export default {
}
},
computed: {
containerId() {
return this.id || UniqueComponentId();
},
containerClass() {
return ['p-tieredmenu p-component', {
'p-tieredmenu-overlay': this.popup

View File

@ -52,12 +52,6 @@ toggle(event) {
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>string</td>
<td>null</td>
<td>Unique identifier of the element.</td>
</tr>
<tr>
<td>dismissable</td>
<td>boolean</td>

View File

@ -193,12 +193,6 @@ toggle(event) {
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>string</td>
<td>null</td>
<td>Unique identifier of the element.</td>
</tr>
<tr>
<td>model</td>
<td>array</td>