From 0f44cb1a0b7b36860e9ce81c1eac9e395d87f0b4 Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期一, 05 六月 2023 13:53:18 +0800 Subject: [PATCH] mergecode into lex dtt --- force-app/main/default/lwc/lexLookup/lexLookup.js | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/force-app/main/default/lwc/lexLookup/lexLookup.js b/force-app/main/default/lwc/lexLookup/lexLookup.js index dceec6f..7d2ef23 100644 --- a/force-app/main/default/lwc/lexLookup/lexLookup.js +++ b/force-app/main/default/lwc/lexLookup/lexLookup.js @@ -25,6 +25,8 @@ @api scrollAfterNItems = null; @api newRecordOptions = []; @api minSearchTermLength = 2; + @api isDisabledForDealerText = false; + @api accountValue = ''; // Template properties searchResultsLocalState = []; @@ -42,6 +44,10 @@ _defaultSearchResults = []; _curSelection = []; _focusedResultIndex = null; + + + + // PUBLIC FUNCTIONS AND GETTERS/SETTERS @api @@ -133,6 +139,7 @@ @api getSelection() { + console.log('get selection:' +this._curSelection); return this._curSelection; } @@ -149,8 +156,12 @@ 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; @@ -254,6 +265,7 @@ // 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(); } @@ -325,6 +337,7 @@ handleClearSelection() { this._curSelection = []; this._hasFocus = false; + this.accountValue = ''; // Process selection update this.processSelectionUpdate(true); } @@ -437,6 +450,8 @@ } 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'; } @@ -448,6 +463,9 @@ if (this.isMultiEntry) { return this._searchTerm; } + if(this.accountValue != ''){ + return this.accountValue; + } return this.hasSelection() ? this._curSelection[0].title : this._searchTerm; } -- Gitblit v1.9.1