| | |
| | | @api scrollAfterNItems = null; |
| | | @api newRecordOptions = []; |
| | | @api minSearchTermLength = 2; |
| | | @api isDisabledForDealerText = false; |
| | | @api accountValue = ''; |
| | | |
| | | // Template properties |
| | | searchResultsLocalState = []; |
| | |
| | | _defaultSearchResults = []; |
| | | _curSelection = []; |
| | | _focusedResultIndex = null; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // PUBLIC FUNCTIONS AND GETTERS/SETTERS |
| | | @api |
| | |
| | | |
| | | @api |
| | | getSelection() { |
| | | console.log('get selection:' +this._curSelection); |
| | | return this._curSelection; |
| | | } |
| | | |
| | |
| | | this.template.querySelector('input')?.blur(); |
| | | } |
| | | |
| | | // INTERNAL FUNCTIONS |
| | | connectedCallback(){ |
| | | console.log('LexLookup accountValue = ' + this.accountValue); |
| | | console.log('isDisabledForDealerText = ' + this.isDisabledForDealerText); |
| | | } |
| | | |
| | | // INTERNAL FUNCTIONS |
| | | updateSearchTerm(newSearchTerm) { |
| | | this._searchTerm = newSearchTerm; |
| | | |
| | |
| | | // If the user presses enter, and the box is open, and we have used arrows, |
| | | // treat this just like a click on the listbox item |
| | | const selectedId = this._searchResults[this._focusedResultIndex].id; |
| | | console.log('selectedid:'+selectedId); |
| | | this.template.querySelector(`[data-recordid="${selectedId}"]`).click(); |
| | | event.preventDefault(); |
| | | } |
| | |
| | | handleClearSelection() { |
| | | this._curSelection = []; |
| | | this._hasFocus = false; |
| | | this.accountValue = ''; |
| | | // Process selection update |
| | | this.processSelectionUpdate(true); |
| | | } |
| | |
| | | } |
| | | |
| | | get getSelectIconName() { |
| | | if(this._curSelection[0]) |
| | | console.log('this._curSelection[0].icon = ' + this._curSelection[0].icon); |
| | | return this.hasSelection() ? this._curSelection[0].icon : 'standard:default'; |
| | | } |
| | | |
| | |
| | | if (this.isMultiEntry) { |
| | | return this._searchTerm; |
| | | } |
| | | if(this.accountValue != ''){ |
| | | return this.accountValue; |
| | | } |
| | | return this.hasSelection() ? this._curSelection[0].title : this._searchTerm; |
| | | } |
| | | |