Skip to content

Commit

Permalink
feat(ui5-mcb-item): implement stable-dom-ref property (#2418)
Browse files Browse the repository at this point in the history
  • Loading branch information
fifoosid authored Dec 17, 2020
1 parent 9661ab8 commit 6e4a156
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/main/src/MultiComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,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 @@ -67,7 +67,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

0 comments on commit 6e4a156

Please sign in to comment.