updateSuggestions(value) {
		if (this.props.readOnly || this.props.disabled) {
			return;
		}

		// building multiSection items or single section items
		let groups = this.buildGroupItems();
		if (value) {
			// filtering
			const escapedValue = escapeRegexCharacters(value.trim());
			const regex = new RegExp(escapedValue, 'i');
			if (this.props.multiSection) {
				groups = groups
					.map(group => ({
						...group,
						suggestions: value
							? group.suggestions.filter(item => regex.test(item.name))
							: group.suggestions,
					}))
					.filter(group => group.suggestions.length > 0);
			} else {
				// only one group so items are inline
				groups = value ? groups.filter(itemValue => regex.test(itemValue.name)) : groups;
			}
		}

		this.setState({ suggestions: groups });
	}
/**
	 * Filter suggestions.
	 * This sets at least an empty array, which means the suggestion box will always display
	 * If the array is empty, the suggestion box will display a "No result" message
	 * Checking if the new value is equal to previous one,
	 * in that case we have to show all suggestions, otherwise we need to filter the suggestions
	 * @param value The value to base suggestions on
	 */
Filter suggestions.
This sets at least an empty array, which means the suggestion box will always display
If the array is empty, the suggestion box will display a "No result" message
Checking if the new value is equal to previous one,
in that case we have to show all suggestions, otherwise we need to filter the suggestions
@param value The value to base suggestions on
Filter suggestions . This sets at least an empty array which means the suggestion box will always display If the array is empty the suggestion box will display a " No result " message Checking if the new value is equal to previous one in that case we have to show all suggestions otherwise we need to filter the suggestions @param value The value to base suggestions on
updateSuggestions(value) {
		if (this.props.readOnly || this.props.disabled) {
			return;
		}
		let groups = this.buildGroupItems();
		if (value) {
			const escapedValue = escapeRegexCharacters(value.trim());
			const regex = new RegExp(escapedValue, 'i');
			if (this.props.multiSection) {
				groups = groups
					.map(group => ({
						...group,
						suggestions: value
							? group.suggestions.filter(item => regex.test(item.name))
							: group.suggestions,
					}))
					.filter(group => group.suggestions.length > 0);
			} else {
				groups = value ? groups.filter(itemValue => regex.test(itemValue.name)) : groups;
			}
		}
		this.setState({ suggestions: groups });
	}
updateSuggestions ( value ) { if ( this . props . readOnly || this . props . disabled ) { return ; } let groups = this . buildGroupItems ( ) ; if ( value ) { const escapedValue = escapeRegexCharacters ( value . trim ( ) ) ; const regex = new RegExp ( escapedValue , 'i' ) ; if ( this . props . multiSection ) { groups = groups . map ( group => ( { ... group , suggestions : value ? group . suggestions . filter ( item => regex . test ( item . name ) ) : group . suggestions , } ) ) . filter ( group => group . suggestions . length > 0 ) ; } else { groups = value ? groups . filter ( itemValue => regex . test ( itemValue . name ) ) : groups ; } } this . setState ( { suggestions : groups } ) ; }
Filter suggestions.
Filter suggestions .
// building multiSection items or single section items // filtering // only one group so items are inline