Skip to content

Commit

Permalink
refactor(ui5-li): selected property changed to private (#9246)
Browse files Browse the repository at this point in the history
The selected property of the ui5-li has been redefined within the class where it is actively utilized. Despite this change, it remains accessible to all components that rely on it.

Related to #8461, #7887

---------

Co-authored-by: Peter Skelin <[email protected]>
Co-authored-by: Dobrin Dimchev <[email protected]>
  • Loading branch information
3 people authored Jun 25, 2024
1 parent e84c2e5 commit e53301d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
8 changes: 8 additions & 0 deletions packages/main/src/ListItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ abstract class ListItem extends ListItemBase {
@property()
highlight: `${Highlight}` = "None";

/**
* Defines the selected state of the component.
* @default false
* @public
*/
@property({ type: Boolean })
declare selected: boolean;

/**
* Used to define the role of the list item.
* @private
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/ListItemBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ListItemBase extends UI5Element implements ITabbable {
/**
* Defines the selected state of the component.
* @default false
* @public
* @private
*/
@property({ type: Boolean })
selected = false;
Expand Down
9 changes: 0 additions & 9 deletions packages/main/src/MenuSeparator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
import type { ClassMap } from "@ui5/webcomponents-base/dist/types.js";
import menuSeparatorTemplate from "./generated/templates/MenuSeparatorTemplate.lit.js";
Expand Down Expand Up @@ -27,14 +26,6 @@ import type { IMenuItem } from "./Menu.js";
})

class MenuSeparator extends ListItemBase implements IMenuItem {
/**
* **Note:** This property is inherited and not supported. If set, it won't take any effect.
* @default false
* @public
*/
@property({ type: Boolean })
declare selected: boolean;

get isSeparator() {
return true;
}
Expand Down
8 changes: 8 additions & 0 deletions packages/main/src/Option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ class Option extends ListItemBase implements IOption {
@property()
tooltip?: string;

/**
* Defines the selected state of the component.
* @default false
* @public
*/
@property({ type: Boolean })
declare selected: boolean;

get displayIconBegin(): boolean {
return !!this.icon;
}
Expand Down
8 changes: 8 additions & 0 deletions packages/main/src/OptionCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ class OptionCustom extends ListItemBase implements IOption {
@property()
tooltip?: string;

/**
* Defines the selected state of the component.
* @default false
* @public
*/
@property({ type: Boolean })
declare selected: boolean;

get effectiveDisplayText() {
return this.displayText || this.textContent || "";
}
Expand Down

0 comments on commit e53301d

Please sign in to comment.