From 6ffaee4aaceaaf3d97a0043b6a7c7fe4525b5e10 Mon Sep 17 00:00:00 2001 From: PRASHANT KUMAR Date: Mon, 29 Jan 2024 16:04:37 +1100 Subject: [PATCH 1/6] Update lookup.html --- src/main/default/lwc/lookup/lookup.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/default/lwc/lookup/lookup.html b/src/main/default/lwc/lookup/lookup.html index c0b912b..2fe9bb3 100644 --- a/src/main/default/lwc/lookup/lookup.html +++ b/src/main/default/lwc/lookup/lookup.html @@ -17,6 +17,7 @@
From c3eb5de8dbfd6f544e3ce92c5a9459426d0fd1cb Mon Sep 17 00:00:00 2001 From: PRASHANT KUMAR Date: Mon, 29 Jan 2024 16:10:48 +1100 Subject: [PATCH 2/6] Update lookup.js Handling the use case where the icon is intentionally not provided. --- src/main/default/lwc/lookup/lookup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/default/lwc/lookup/lookup.js b/src/main/default/lwc/lookup/lookup.js index bb151e9..4179391 100644 --- a/src/main/default/lwc/lookup/lookup.js +++ b/src/main/default/lwc/lookup/lookup.js @@ -414,7 +414,7 @@ export default class Lookup extends NavigationMixin(LightningElement) { if (this.isMultiEntry) { css += 'slds-input-has-icon_right'; } else { - css += this.hasSelection() ? 'slds-input-has-icon_left-right' : 'slds-input-has-icon_right'; + css += (this.hasSelection() && this._curSelection[0].icon) ? "slds-input-has-icon_left-right" : "slds-input-has-icon_right"; } return css; } From 860b7608ca84d2fc7347de422b5b149630297602 Mon Sep 17 00:00:00 2001 From: PRASHANT KUMAR Date: Mon, 29 Jan 2024 16:14:41 +1100 Subject: [PATCH 3/6] Update lookup.js --- src/main/default/lwc/lookup/lookup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/default/lwc/lookup/lookup.js b/src/main/default/lwc/lookup/lookup.js index 4179391..7121af2 100644 --- a/src/main/default/lwc/lookup/lookup.js +++ b/src/main/default/lwc/lookup/lookup.js @@ -414,7 +414,7 @@ export default class Lookup extends NavigationMixin(LightningElement) { if (this.isMultiEntry) { css += 'slds-input-has-icon_right'; } else { - css += (this.hasSelection() && this._curSelection[0].icon) ? "slds-input-has-icon_left-right" : "slds-input-has-icon_right"; + css += (this.hasSelection() && this._curSelection[0].icon) ? 'slds-input-has-icon_left-right' : 'slds-input-has-icon_right'; } return css; } From f23c9770d9437cecfc6145953310147331e4d3d2 Mon Sep 17 00:00:00 2001 From: Philippe Ozil Date: Thu, 1 Feb 2024 16:21:38 +0100 Subject: [PATCH 4/6] fix: formatting --- src/main/default/lwc/lookup/lookup.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/default/lwc/lookup/lookup.html b/src/main/default/lwc/lookup/lookup.html index 2fe9bb3..6329870 100644 --- a/src/main/default/lwc/lookup/lookup.html +++ b/src/main/default/lwc/lookup/lookup.html @@ -107,7 +107,10 @@ onclick={handleResultClick} data-recordid={item.result.id} > - + Date: Thu, 1 Feb 2024 16:22:06 +0100 Subject: [PATCH 5/6] fix: removed default icon injection --- src/main/default/lwc/lookup/lookup.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/default/lwc/lookup/lookup.js b/src/main/default/lwc/lookup/lookup.js index 7121af2..7c4b46b 100644 --- a/src/main/default/lwc/lookup/lookup.js +++ b/src/main/default/lwc/lookup/lookup.js @@ -104,10 +104,6 @@ export default class Lookup extends NavigationMixin(LightningElement) { result.titleFormatted = result.title; result.subtitleFormatted = result.subtitle; } - // Add icon if missing - if (typeof result.icon === 'undefined') { - result.icon = 'standard:default'; - } return result; }); // Add local state and dynamic class to search results @@ -414,7 +410,10 @@ export default class Lookup extends NavigationMixin(LightningElement) { if (this.isMultiEntry) { css += 'slds-input-has-icon_right'; } else { - css += (this.hasSelection() && this._curSelection[0].icon) ? 'slds-input-has-icon_left-right' : 'slds-input-has-icon_right'; + css += + this.hasSelection() && this._curSelection[0].icon + ? 'slds-input-has-icon_left-right' + : 'slds-input-has-icon_right'; } return css; } From df6b8a22837dc0b80bdbcbbd9ae5202f5e9e612e Mon Sep 17 00:00:00 2001 From: Philippe Ozil Date: Thu, 1 Feb 2024 16:33:40 +0100 Subject: [PATCH 6/6] doc: updated docs for default icon behavior --- src/main/default/classes/LookupSearchResult.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/default/classes/LookupSearchResult.cls b/src/main/default/classes/LookupSearchResult.cls index 473007a..8b9a17b 100644 --- a/src/main/default/classes/LookupSearchResult.cls +++ b/src/main/default/classes/LookupSearchResult.cls @@ -15,7 +15,7 @@ public virtual class LookupSearchResult implements Comparable { /** * @param id the lookup entry identifier (generally a record ID) * @param sObjectType Optional - The sObject type of the selected record. This value is not used for lookup rendering. It's passed back to the selection handler in case you search on multiple object types. - * @param icon Optional - A qualified SLDS icon name taken from https://www.lightningdesignsystem.com/icons. It defaults to standard:default. + * @param icon Optional - A qualified SLDS icon name taken from https://www.lightningdesignsystem.com/icons. No icon is displayed by default. * @param title Required - The label of the lookup entry * @param subtitle Optional - A subtitle that is displayed under the lookup entry label */