Skip to content
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-mcb-item): implement stable-dom-ref property #2418

Merged
merged 3 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/main/src/MultiComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,12 @@ const metadata = {
* <li> Backspace - deletes the token and focus the next token. </li>
* </ul>
*
* In the context of <code>ui5-multi-combobox</code>, you can provide a custom stable DOM ref for:
* <ul>
* <li>Every <code>ui5-mcb-item</code> that you provide.
* Example: <code><ui5-mcb-item stable-dom-ref="item1"></ui5-mcb-item></code></li>
* </ul>
*
* <h3>ES6 Module Import</h3>
*
* <code>import "@ui5/webcomponents/dist/MultiComboBox";</code>
Expand Down
9 changes: 9 additions & 0 deletions packages/main/src/MultiComboBoxItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ const metadata = {
* @public
*/
selected: { type: Boolean },

/**
* Defines the stable selector that you can use via getStableDomRef method.
* @public
* @since 1.0.0-rc.10
*/
stableDomRef: {
type: String,
},
},
};

Expand Down
9 changes: 8 additions & 1 deletion packages/main/src/MultiComboBoxPopover.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@

<ui5-list separators="None" mode="MultiSelect" class="ui5-multi-combobox-all-items-list">
{{#each _filteredItems}}
<ui5-li type="{{../_listItemsType}}" ?selected={{this.selected}} data-ui5-token-id="{{this._id}}">{{this.text}}</ui5-li>
<ui5-li
type="{{../_listItemsType}}"
?selected={{this.selected}}
data-ui5-token-id="{{this._id}}"
data-ui5-stable="{{this.stableDomRef}}"
>
{{this.text}}
</ui5-li>
{{/each}}
</ui5-list>

Expand Down