Skip to content

Commit

Permalink
Refactor #1917 - For AutoComplete
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Apr 12, 2021
1 parent 8cd2d24 commit f858ed9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/autocomplete/AutoComplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ interface AutoCompleteProps {
completeMethod?(e: CompleteMethodParams): void;
itemTemplate?: ItemTemplateType;
selectedItemTemplate?: SelectedItemTemplateType;
transitionOptions?: object;
onChange?(e: ChangeParams): void;
onFocus?(event: React.FormEvent<HTMLInputElement>): void;
onBlur?(event: React.FormEvent<HTMLInputElement>): void;
Expand Down
5 changes: 4 additions & 1 deletion src/components/autocomplete/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class AutoComplete extends Component {
completeMethod: null,
itemTemplate: null,
selectedItemTemplate: null,
transitionOptions: null,
onChange: null,
onFocus: null,
onBlur: null,
Expand Down Expand Up @@ -109,6 +110,7 @@ export class AutoComplete extends Component {
completeMethod: PropTypes.func,
itemTemplate: PropTypes.any,
selectedItemTemplate: PropTypes.any,
transitionOptions: PropTypes.object,
onChange: PropTypes.func,
onFocus: PropTypes.func,
onBlur: PropTypes.func,
Expand Down Expand Up @@ -829,7 +831,8 @@ export class AutoComplete extends Component {
panelStyle={this.props.panelStyle} panelClassName={this.props.panelClassName} onClick={this.onPanelClick}
optionGroupLabel={this.props.optionGroupLabel} optionGroupChildren={this.props.optionGroupChildren} optionGroupTemplate={this.props.optionGroupTemplate}
getOptionGroupLabel={this.getOptionGroupLabel} getOptionGroupChildren={this.getOptionGroupChildren}
in={this.state.overlayVisible} onEnter={this.onOverlayEnter} onEntering={this.onOverlayEntering} onEntered={this.onOverlayEntered} onExit={this.onOverlayExit} onExited={this.onOverlayExited}/>
in={this.state.overlayVisible} onEnter={this.onOverlayEnter} onEntering={this.onOverlayEntering} onEntered={this.onOverlayEntered} onExit={this.onOverlayExit} onExited={this.onOverlayExited}
transitionOptions={this.props.transitionOptions} />
</span>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/autocomplete/AutoCompletePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import ObjectUtils from '../utils/ObjectUtils';
import { Ripple } from '../ripple/Ripple';
import { classNames } from '../utils/ClassNames';
import { CSSTransition } from 'react-transition-group';
import { CSSTransition } from '../transition/CSSTransition';
import { Portal } from '../portal/Portal';

class AutoCompletePanelComponent extends Component {
Expand Down Expand Up @@ -109,7 +109,7 @@ class AutoCompletePanelComponent extends Component {
let items = this.renderItems();

return (
<CSSTransition nodeRef={this.props.forwardRef} classNames="p-connected-overlay" in={this.props.in} timeout={{ enter: 120, exit: 100 }}
<CSSTransition nodeRef={this.props.forwardRef} classNames="p-connected-overlay" in={this.props.in} timeout={{ enter: 120, exit: 100 }} options={this.props.transitionOptions}
unmountOnExit onEnter={this.props.onEnter} onEntering={this.props.onEntering} onEntered={this.props.onEntered} onExit={this.props.onExit} onExited={this.props.onExited}>
<div ref={this.props.forwardRef} className={panelClassName} style={panelStyle} onClick={this.props.onClick}>
<ul className="p-autocomplete-items" role="listbox" id={this.props.listId} style={{ maxHeight: this.props.scrollHeight || 'auto' }}>
Expand Down
6 changes: 6 additions & 0 deletions src/showcase/autocomplete/AutoCompleteDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,12 @@ itemTemplate(item) {
<td>null</td>
<td>Template of an option group item.</td>
</tr>
<tr>
<td>transitionOptions</td>
<td>object</td>
<td>null</td>
<td>The properties of <a href="https://reactcommunity.org/react-transition-group/css-transition" rel="noopener noreferrer" target="_blank">CSSTransition</a> can be customized, except for "nodeRef" and "in" properties.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit f858ed9

Please sign in to comment.