parent
99f9d351f9
commit
082ea246a1
|
@ -88,6 +88,7 @@ export default {
|
|||
}
|
||||
},
|
||||
nodeTouched: false,
|
||||
toggleClicked: false,
|
||||
mounted() {
|
||||
const hasTreeSelectParent = this.$refs.currentNode.closest('.p-treeselect-items-wrapper');
|
||||
|
||||
|
@ -98,6 +99,7 @@ export default {
|
|||
methods: {
|
||||
toggle() {
|
||||
this.$emit('node-toggle', this.node);
|
||||
this.toggleClicked = true;
|
||||
},
|
||||
label(node) {
|
||||
return typeof node.label === 'function' ? node.label() : node.label;
|
||||
|
@ -106,7 +108,9 @@ export default {
|
|||
this.$emit('node-toggle', node);
|
||||
},
|
||||
onClick(event) {
|
||||
if (DomHandler.hasClass(event.target, 'p-tree-toggler') || DomHandler.hasClass(event.target.parentElement, 'p-tree-toggler')) {
|
||||
if (this.toggleClicked || DomHandler.hasClass(event.target, 'p-tree-toggler') || DomHandler.hasClass(event.target.parentElement, 'p-tree-toggler')) {
|
||||
this.toggleClicked = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -197,6 +197,7 @@ export default {
|
|||
scrollHandler: null,
|
||||
overlay: null,
|
||||
selfChange: false,
|
||||
selfClick: false,
|
||||
beforeUnmount() {
|
||||
this.unbindOutsideClickListener();
|
||||
this.unbindResizeListener();
|
||||
|
@ -337,8 +338,10 @@ export default {
|
|||
bindOutsideClickListener() {
|
||||
if (!this.outsideClickListener) {
|
||||
this.outsideClickListener = (event) => {
|
||||
if (this.overlayVisible && this.isOutsideClicked(event)) {
|
||||
if (this.overlayVisible && !this.selfClick && this.isOutsideClicked(event)) {
|
||||
this.hide();
|
||||
|
||||
this.selfClick = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -395,6 +398,8 @@ export default {
|
|||
originalEvent: event,
|
||||
target: this.$el
|
||||
});
|
||||
|
||||
this.selfClick = true;
|
||||
},
|
||||
onOverlayKeydown(event) {
|
||||
if (event.code === 'Escape') this.hide();
|
||||
|
|
Loading…
Reference in New Issue