diff --git a/src/components/autocomplete/AutoComplete.d.ts b/src/components/autocomplete/AutoComplete.d.ts index 1133c69ed3..908dac3e18 100755 --- a/src/components/autocomplete/AutoComplete.d.ts +++ b/src/components/autocomplete/AutoComplete.d.ts @@ -92,6 +92,8 @@ interface AutoCompleteProps { onKeyPress?(event: React.KeyboardEvent): void; onContextMenu?(event: React.MouseEvent): void; onClear?(event: React.SyntheticEvent): void; + onShow?(): void; + onHide?(): void; } export class AutoComplete extends React.Component { } diff --git a/src/components/autocomplete/AutoComplete.js b/src/components/autocomplete/AutoComplete.js index dc6b6315da..f36dcdcf89 100644 --- a/src/components/autocomplete/AutoComplete.js +++ b/src/components/autocomplete/AutoComplete.js @@ -67,7 +67,9 @@ export class AutoComplete extends Component { onKeyUp: null, onKeyPress: null, onContextMenu: null, - onClear: null + onClear: null, + onShow: null, + onHide: null } static propTypes = { @@ -123,7 +125,9 @@ export class AutoComplete extends Component { onKeyUp: PropTypes.func, onKeyPress: PropTypes.func, onContextMenu: PropTypes.func, - onClear: PropTypes.func + onClear: PropTypes.func, + onShow: PropTypes.func, + onHide: PropTypes.func }; constructor(props) { @@ -299,6 +303,8 @@ export class AutoComplete extends Component { this.bindDocumentClickListener(); this.bindScrollListener(); this.bindResizeListener(); + + this.props.onShow && this.props.onShow(); } onOverlayExit() { @@ -309,6 +315,8 @@ export class AutoComplete extends Component { onOverlayExited() { ZIndexUtils.clear(this.overlayRef.current); + + this.props.onHide && this.props.onHide(); } alignOverlay() { diff --git a/src/showcase/autocomplete/AutoCompleteDoc.js b/src/showcase/autocomplete/AutoCompleteDoc.js index 1cbf37aaf4..127eb96b60 100644 --- a/src/showcase/autocomplete/AutoCompleteDoc.js +++ b/src/showcase/autocomplete/AutoCompleteDoc.js @@ -861,6 +861,16 @@ itemTemplate(item) { event: Browser event Callback to invoke when input is cleared by the user. + + onShow + - + Callback to invoke when overlay panel becomes visible. + + + onHide + - + Callback to invoke when overlay panel becomes hidden. +