-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui5-input): Add highlighting #1943
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
7495f0e
feat(ui5-input): Add highlighting
ilhan007 9a48155
fix comments
ilhan007 48327f6
add test
ilhan007 24fa4ce
dont highlight when previewing an item
ilhan007 9d555e3
fix the value that should be highlighted
ilhan007 57e6b08
improve change safety
ilhan007 126048a
fix build
ilhan007 8ee3aeb
fix build
ilhan007 a75f4ca
introduce slot
vladitasev f9cea4a
fix title and description
vladitasev 1e72529
fix if
vladitasev 089273b
Merge remote-tracking branch 'origin/master' into feat-inp
vladitasev 5fc8f92
fix conflicts
vladitasev d32bfcd
remove li
vladitasev 0d36143
fix boolean
vladitasev dfee371
revert
vladitasev 8dfab97
escape user input, not the text of the item
vladitasev b767d36
minor
vladitasev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also add a comment that it only works with suggestions enabled.