Web:Component Added a click event on the selected item

This commit is contained in:
Akmal Isomadinov 2023-08-16 16:57:01 +05:00
parent ceb2a85979
commit b68fbb1a4e
2 changed files with 4 additions and 2 deletions

View File

@ -134,7 +134,7 @@ class ComboBox extends React.Component {
isNoFixedHeightOptions,
hideMobileView,
} = this.props;
const { tabIndex, ...props } = this.props;
const { tabIndex, onClickSelectedItem, ...props } = this.props;
const { isOpen, selectedOption } = this.state;
const dropDownMaxHeightProp = dropDownMaxHeight
@ -254,6 +254,7 @@ class ComboBox extends React.Component {
disabled={disabled}
backgroundColor={option.backgroundColor}
onClick={this.optionClick.bind(this, option)}
onClickSelectedItem={() => onClickSelectedItem?.(option)}
fillIcon={fillIcon}
isModern={noBorder}
isActive={isActive}

View File

@ -31,10 +31,11 @@ const DropDownItem = (props) => {
isActiveDescendant,
} = props;
const { withToggle, checked, onClick, ...rest } = props;
const { withToggle, checked, onClick, onClickSelectedItem, ...rest } = props;
const onClickAction = (e) => {
onClick && !disabled && onClick(e);
onClickSelectedItem && isSelected && onClickSelectedItem();
};
const stopPropagation = (event) => {