-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui5-combobox): add suggestions grouping (#3469)
Enable users to set items to groups. Groups are visually identified in the suggestions list by group headers. For group headers a new component is introduced - ComboBoxGroupItem. The grouping is based on the items order as they are declared in the markup - the items between two group headers are considered to belong to the first one. Fixes: #3371
- Loading branch information
Showing
6 changed files
with
281 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js"; | ||
import GroupHeaderListItem from "./GroupHeaderListItem.js"; | ||
|
||
/** | ||
* @public | ||
*/ | ||
const metadata = { | ||
tag: "ui5-cb-group-item", | ||
properties: /** @lends sap.ui.webcomponents.main.ComboBoxGroupItem.prototype */ { | ||
/** | ||
* Defines the text of the component. | ||
* | ||
* @type {string} | ||
* @defaultvalue "" | ||
* @public | ||
*/ | ||
text: { | ||
type: String, | ||
}, | ||
/** | ||
* Indicates whether the input is focssed | ||
* @private | ||
*/ | ||
focused: { | ||
type: Boolean, | ||
}, | ||
}, | ||
slots: /** @lends sap.ui.webcomponents.main.ComboBoxGroupItem.prototype */ { | ||
}, | ||
events: /** @lends sap.ui.webcomponents.main.ComboBoxGroupItem.prototype */ { | ||
}, | ||
}; | ||
|
||
/** | ||
* @class | ||
* The <code>ui5-combobox-group-item</code> is type of suggestion item, | ||
* that can be used to split the <code>ui5-combobox</code> suggestions into groups. | ||
* | ||
* @constructor | ||
* @author SAP SE | ||
* @alias sap.ui.webcomponents.main.ComboBoxGroupItem | ||
* @extends UI5Element | ||
* @tagname ui5-cb-group-item | ||
* @public | ||
* @since 1.0.0-rc.15 | ||
*/ | ||
class ComboBoxGroupItem extends UI5Element { | ||
static get metadata() { | ||
return metadata; | ||
} | ||
|
||
static get dependencies() { | ||
return [ | ||
GroupHeaderListItem, | ||
]; | ||
} | ||
|
||
/** | ||
* Used to avoid tag name checks | ||
* @protected | ||
*/ | ||
get isGroupItem() { | ||
return true; | ||
} | ||
} | ||
|
||
ComboBoxGroupItem.define(); | ||
|
||
export default ComboBoxGroupItem; |
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.