-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui5-input): Add highlighting (#1943)
- Loading branch information
Showing
9 changed files
with
216 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{{>include "./StandardListItem.hbs"}} | ||
|
||
{{#*inline "listItemContent"}} | ||
<div class="ui5-li-title-wrapper"> | ||
{{#if hasTitle}} | ||
<span part="title" class="ui5-li-title"><slot></slot></span> | ||
{{/if}} | ||
{{#if hasDescription}} | ||
<span part="description" class="ui5-li-desc"> | ||
{{#if richDescription.length}} | ||
<slot name="richDescription"></slot> | ||
{{else}} | ||
{{description}} | ||
{{/if}} | ||
</span> | ||
{{/if}} | ||
{{#unless typeActive}} | ||
<span class="ui5-hidden-text">{{type}}</span> | ||
{{/unless}} | ||
</div> | ||
{{#if info}} | ||
<span part="info" class="ui5-li-info">{{info}}</span> | ||
{{/if}} | ||
{{/inline}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import StandardListItem from "./StandardListItem.js"; | ||
import SuggestionListItemTemplate from "./generated/templates/SuggestionListItemTemplate.lit.js"; | ||
|
||
/** | ||
* @public | ||
*/ | ||
const metadata = { | ||
tag: "ui5-li-suggestion-item", | ||
managedSlots: true, | ||
slots: { | ||
/** | ||
* Defines a description that can contain HTML. | ||
* <b>Note:</b> If not specified, the <code>description</code> property will be used. | ||
* <br> | ||
* @type {HTMLElement} | ||
* @since 1.0.0-rc.8 | ||
* @slot | ||
* @public | ||
*/ | ||
richDescription: { | ||
type: HTMLElement, | ||
}, | ||
"default": { | ||
propertyName: "title", | ||
}, | ||
}, | ||
}; | ||
|
||
/** | ||
* @class | ||
* The <code>ui5-li-suggestion-item</code> represents the suggestion item in the <code>ui5-input</code> | ||
* suggestion popover. | ||
* | ||
* @constructor | ||
* @author SAP SE | ||
* @alias sap.ui.webcomponents.main.SuggestionListItem | ||
* @extends UI5Element | ||
*/ | ||
class SuggestionListItem extends StandardListItem { | ||
static get metadata() { | ||
return metadata; | ||
} | ||
|
||
static get template() { | ||
return SuggestionListItemTemplate; | ||
} | ||
|
||
onBeforeRendering(...params) { | ||
super.onBeforeRendering(...params); | ||
this.hasTitle = !!this.title.length; | ||
} | ||
|
||
get effectiveTitle() { | ||
return this.title.map(el => el.textContent).join(""); | ||
} | ||
|
||
get hasDescription() { | ||
return this.richDescription.length || this.description; | ||
} | ||
} | ||
|
||
SuggestionListItem.define(); | ||
|
||
export default SuggestionListItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.