Merge pull request #6758 from KumJungMin/fix/issue-4927

fix(TreeSelect): prevent event propagation when clicking overlay
pull/6775/head
Tuğçe Küçükoğlu 2024-11-13 11:07:23 +03:00 committed by GitHub
commit a2652a912e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -88,6 +88,7 @@
@node-collapse="$emit('node-collapse', $event)" @node-collapse="$emit('node-collapse', $event)"
@node-select="onNodeSelect" @node-select="onNodeSelect"
@node-unselect="onNodeUnselect" @node-unselect="onNodeUnselect"
@click.stop
:level="0" :level="0"
:unstyled="unstyled" :unstyled="unstyled"
:pt="ptm('pcTree')" :pt="ptm('pcTree')"
@ -133,13 +134,13 @@ import { isEmpty, isNotEmpty } from '@primeuix/utils/object';
import { ZIndex } from '@primeuix/utils/zindex'; import { ZIndex } from '@primeuix/utils/zindex';
import { ConnectedOverlayScrollHandler, UniqueComponentId } from '@primevue/core/utils'; import { ConnectedOverlayScrollHandler, UniqueComponentId } from '@primevue/core/utils';
import ChevronDownIcon from '@primevue/icons/chevrondown'; import ChevronDownIcon from '@primevue/icons/chevrondown';
import TimesIcon from '@primevue/icons/times';
import Chip from 'primevue/chip'; import Chip from 'primevue/chip';
import OverlayEventBus from 'primevue/overlayeventbus'; import OverlayEventBus from 'primevue/overlayeventbus';
import Portal from 'primevue/portal'; import Portal from 'primevue/portal';
import Ripple from 'primevue/ripple'; import Ripple from 'primevue/ripple';
import Tree from 'primevue/tree'; import Tree from 'primevue/tree';
import BaseTreeSelect from './BaseTreeSelect.vue'; import BaseTreeSelect from './BaseTreeSelect.vue';
import TimesIcon from '@primevue/icons/times';
export default { export default {
name: 'TreeSelect', name: 'TreeSelect',
@ -228,14 +229,14 @@ export default {
if (event.target.tagName === 'INPUT' || event.target.getAttribute('data-pc-section') === 'clearicon' || event.target.closest('[data-pc-section="clearicon"]')) { if (event.target.tagName === 'INPUT' || event.target.getAttribute('data-pc-section') === 'clearicon' || event.target.closest('[data-pc-section="clearicon"]')) {
return; return;
} else if (!this.disabled && (!this.overlay || !this.overlay.contains(event.target))) { } else if (!this.overlay || !this.overlay.contains(event.target)) {
if (this.overlayVisible) this.hide(); if (this.overlayVisible) this.hide();
else this.show(); else this.show();
focus(this.$refs.focusInput); focus(this.$refs.focusInput);
} }
}, },
onClearClick(event) { onClearClick() {
this.onSelectionChange(null); this.onSelectionChange(null);
}, },
onSelectionChange(keys) { onSelectionChange(keys) {