diff --git a/components/lib/autocomplete/AutoComplete.js b/components/lib/autocomplete/AutoComplete.js index 25747cd5ba..4283d1d65d 100644 --- a/components/lib/autocomplete/AutoComplete.js +++ b/components/lib/autocomplete/AutoComplete.js @@ -657,65 +657,65 @@ AutoComplete.displayName = 'AutoComplete'; AutoComplete.defaultProps = { __TYPE: 'AutoComplete', id: null, - inputRef: null, - value: null, - name: null, - type: 'text', - suggestions: null, - field: null, - optionGroupLabel: null, - optionGroupChildren: null, - optionGroupTemplate: null, - forceSelection: false, + 'aria-label': null, + 'aria-labelledby': null, + appendTo: null, + autoFocus: false, autoHighlight: false, - virtualScrollerOptions: null, - scrollHeight: '200px', + className: null, + completeMethod: null, + delay: 300, + disabled: false, dropdown: false, - dropdownMode: 'blank', dropdownAutoFocus: true, - multiple: false, - minLength: 1, - delay: 300, - style: null, - className: null, + dropdownIcon: 'pi pi-chevron-down', + dropdownMode: 'blank', + emptyMessage: null, + field: null, + forceSelection: false, + inputClassName: null, inputId: null, + inputRef: null, inputStyle: null, - inputClassName: null, + itemTemplate: null, + maxLength: null, + minLength: 1, + multiple: false, + name: null, + onBlur: null, + onChange: null, + onClear: null, + onClick: null, + onContextMenu: null, + onDblClick: null, + onDropdownClick: null, + onFocus: null, + onHide: null, + onKeyPress: null, + onKeyUp: null, + onMouseDown: null, + onSelect: null, + onShow: null, + onUnselect: null, + optionGroupChildren: null, + optionGroupLabel: null, + optionGroupTemplate: null, panelClassName: null, panelStyle: null, placeholder: null, readOnly: false, - disabled: false, - maxLength: null, - size: null, - appendTo: null, + removeIcon: 'pi pi-times-circle', + scrollHeight: '200px', + selectedItemTemplate: null, showEmptyMessage: false, - emptyMessage: null, + size: null, + style: null, + suggestions: null, tabIndex: null, - autoFocus: false, tooltip: null, tooltipOptions: null, - completeMethod: null, - itemTemplate: null, - selectedItemTemplate: null, transitionOptions: null, - dropdownIcon: 'pi pi-chevron-down', - removeIcon: 'pi pi-times-circle', - 'aria-label': null, - 'aria-labelledby': null, - onChange: null, - onFocus: null, - onBlur: null, - onSelect: null, - onUnselect: null, - onDropdownClick: null, - onClick: null, - onDblClick: null, - onMouseDown: null, - onKeyUp: null, - onKeyPress: null, - onContextMenu: null, - onClear: null, - onShow: null, - onHide: null + type: 'text', + value: null, + virtualScrollerOptions: null }; diff --git a/components/lib/autocomplete/AutoCompletePanel.js b/components/lib/autocomplete/AutoCompletePanel.js index 7b7bcdf537..5763b5c3dd 100644 --- a/components/lib/autocomplete/AutoCompletePanel.js +++ b/components/lib/autocomplete/AutoCompletePanel.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import { localeOption } from '../api/Api'; +import { localeOption } from '../api/Api'; import { CSSTransition } from '../csstransition/CSSTransition'; import { Portal } from '../portal/Portal'; import { Ripple } from '../ripple/Ripple'; @@ -47,6 +47,7 @@ export const AutoCompletePanel = React.memo( ); } else { const content = props.itemTemplate ? ObjectUtils.getJSXElement(props.itemTemplate, suggestion, index) : props.field ? ObjectUtils.resolveFieldData(suggestion, props.field) : suggestion; + return (
  • props.onItemClick(e, suggestion)}> {content} @@ -62,13 +63,15 @@ export const AutoCompletePanel = React.memo( const createContent = () => { if (props.showEmptyMessage && ObjectUtils.isEmpty(props.suggestions)) { - const emptyMessage = props.emptyMessage || localeOptions('emptyMessage'); + const emptyMessage = props.emptyMessage || localeOption('emptyMessage'); + return ( ); } + if (props.virtualScrollerOptions) { const virtualScrollerProps = { ...props.virtualScrollerOptions, @@ -92,6 +95,7 @@ export const AutoCompletePanel = React.memo( return ; } else { const items = createItems(); + return (