Skip to content

Commit

Permalink
Refactor #1832 - For CascadeSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Mar 1, 2021
1 parent 7371944 commit 000096b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/cascadeselect/CascadeSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import UniqueComponentId from '../utils/UniqueComponentId';
import { CSSTransition } from "react-transition-group";
import ConnectedOverlayScrollHandler from '../utils/ConnectedOverlayScrollHandler';
import { CascadeSelectSub } from "./CascadeSelectSub";
import { PrimeEventBus } from '../utils/PrimeEventBus';

export class CascadeSelect extends Component {

Expand Down Expand Up @@ -85,6 +86,7 @@ export class CascadeSelect extends Component {
this.onOverlayExit = this.onOverlayExit.bind(this);
this.onOptionSelect = this.onOptionSelect.bind(this);
this.onOptionGroupSelect = this.onOptionGroupSelect.bind(this);
this.onPanelClick = this.onPanelClick.bind(this);
}

onOptionSelect(event) {
Expand Down Expand Up @@ -211,6 +213,13 @@ export class CascadeSelect extends Component {
}
}

onPanelClick(event) {
PrimeEventBus.emit('overlay-click', {
originalEvent: event,
target: this.container
});
}

show() {
if (this.props.onBeforeShow) {
this.props.onBeforeShow();
Expand Down Expand Up @@ -371,7 +380,7 @@ export class CascadeSelect extends Component {
const overlay = (
<CSSTransition nodeRef={this.overlayRef} classNames="p-connected-overlay" in={this.state.overlayVisible} timeout={{ enter: 120, exit: 100 }}
unmountOnExit onEnter={this.onOverlayEnter} onEntered={this.onOverlayEntered} onExit={this.onOverlayExit}>
<div ref={this.overlayRef} className="p-cascadeselect-panel p-component">
<div ref={this.overlayRef} className="p-cascadeselect-panel p-component" onClick={this.onPanelClick}>
<div className="p-cascadeselect-items-wrapper">
<CascadeSelectSub options={this.props.options} selectionPath={this.selectionPath} className={"p-cascadeselect-items"} optionLabel={this.props.optionLabel}
optionValue={this.props.optionValue} level={0} optionGroupLabel={this.props.optionGroupLabel} optionGroupChildren={this.props.optionGroupChildren}
Expand Down

0 comments on commit 000096b

Please sign in to comment.