File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed
src/Umbraco.Web.UI.Client/src/packages
core/tree/tree-item/tree-item-base
documents/documents/tree/tree-item
media/media/tree/tree-item Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ export abstract class UmbTreeItemElementBase<
71
71
private _isSelectable = false ;
72
72
73
73
@state ( )
74
- private _isSelected = false ;
74
+ protected _isSelected = false ;
75
75
76
76
@state ( )
77
77
private _hasChildren = false ;
@@ -165,10 +165,9 @@ export abstract class UmbTreeItemElementBase<
165
165
#renderIcon( ) {
166
166
const icon = this . _item ?. icon ;
167
167
const isFolder = this . _item ?. isFolder ;
168
- const iconWithoutColor = icon ?. split ( ' ' ) [ 0 ] ;
169
168
170
- if ( icon && iconWithoutColor ) {
171
- return html `< umb-icon slot ="icon " name ="${ this . _isActive ? iconWithoutColor : icon } "> </ umb-icon > ` ;
169
+ if ( icon ) {
170
+ return html `< umb-icon slot ="icon " name ="${ this . _getIconToRender ( icon ) } "> </ umb-icon > ` ;
172
171
}
173
172
174
173
if ( isFolder ) {
@@ -178,6 +177,11 @@ export abstract class UmbTreeItemElementBase<
178
177
return html `< umb-icon slot ="icon " name ="icon-circle-dotted "> </ umb-icon > ` ;
179
178
}
180
179
180
+ protected _getIconToRender ( icon : string ) {
181
+ const iconWithoutColor = icon . split ( ' ' ) [ 0 ] ;
182
+ return this . _isActive || this . _isSelected ? iconWithoutColor : icon ;
183
+ }
184
+
181
185
renderLabel ( ) {
182
186
return html `< slot name ="label " slot ="label "> </ slot > ` ;
183
187
}
Original file line number Diff line number Diff line change @@ -37,13 +37,12 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<
37
37
38
38
override renderIconContainer ( ) {
39
39
const icon = this . _icon ;
40
- const iconWithoutColor = icon ?. split ( ' ' ) [ 0 ] ;
41
40
42
41
return html `
43
42
<span id= "icon-container" slot = "icon" class = ${ classMap ( { draft : this . _isDraft } ) } >
44
- ${ icon && iconWithoutColor
43
+ ${ icon
45
44
? html `
46
- <umb- icon id= "icon" slot = "icon" name = "${ this . _isActive ? iconWithoutColor : icon } " > </ umb- icon>
45
+ <umb- icon id= "icon" slot = "icon" name = "${ this . _getIconToRender ( icon ) } " > </ umb- icon>
47
46
${ this . #renderStateIcon( ) }
48
47
`
49
48
: nothing }
Original file line number Diff line number Diff line change @@ -8,13 +8,12 @@ const elementName = 'umb-media-tree-item';
8
8
export class UmbMediaTreeItemElement extends UmbTreeItemElementBase < UmbMediaTreeItemModel > {
9
9
override renderIconContainer ( ) {
10
10
const icon = this . item ?. mediaType . icon ;
11
- const iconWithoutColor = icon ?. split ( ' ' ) [ 0 ] ;
12
11
13
12
return html `
14
13
<span id= "icon-container" slot = "icon" >
15
- ${ icon && iconWithoutColor
14
+ ${ icon
16
15
? html `
17
- <umb- icon id= "icon" slot = "icon" name = "${ this . _isActive ? iconWithoutColor : icon } " > </ umb- icon>
16
+ <umb- icon id= "icon" slot = "icon" name = "${ this . _getIconToRender ( icon ) } " > </ umb- icon>
18
17
${ this . #renderStateIcon( ) }
19
18
`
20
19
: nothing }
You can’t perform that action at this time.
0 commit comments