Skip to content

Feature/select popup closer callback #1226

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ export type SelectProps = {
*/
onClickOutside?: (event?: React.MouseEvent<any>) => void;

/**
* Обработчик клика по кнопке закрытия попапа со значениями
*/
onCloserClick?: (event?: React.MouseEvent<any>) => void;

/**
* Обработчик изменения значения
*/
Expand Down Expand Up @@ -892,10 +897,14 @@ export class Select extends React.Component<SelectProps, SelectState> {
);
};

private handlePopupCloserClick = () => {
private handlePopupCloserClick = (event: React.MouseEvent<any>) => {
const { onCloserClick } = this.props;
this.setState({
opened: false,
});
if (typeof onCloserClick === 'function') {
onCloserClick(event);
}
};

private setPopupRef = (ref) => {
Expand Down