1
- import type { UmbDocumentTreeItemModel , UmbDocumentTreeItemVariantModel } from '../types.js' ;
2
1
import { css , html , nothing , customElement , state , classMap } from '@umbraco-cms/backoffice/external/lit' ;
3
2
import type { UmbAppLanguageContext } from '@umbraco-cms/backoffice/language' ;
4
3
import { UMB_APP_LANGUAGE_CONTEXT } from '@umbraco-cms/backoffice/language' ;
5
4
import { UmbTextStyles } from '@umbraco-cms/backoffice/style' ;
6
5
import { UmbTreeItemElementBase } from '@umbraco-cms/backoffice/tree' ;
6
+ import type { UmbDocumentTreeItemModel , UmbDocumentTreeItemVariantModel } from '../types.js' ;
7
7
8
8
@customElement ( 'umb-document-tree-item' )
9
9
export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase < UmbDocumentTreeItemModel > {
@@ -74,11 +74,7 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
74
74
${ this . item ?. documentType . icon
75
75
? html `
76
76
<umb- icon id= "icon" slot = "icon" name = "${ this . item . documentType . icon } " > </ umb- icon>
77
- ${ this . item . isProtected ? this . #renderIsProtectedIcon( ) : nothing }
78
- <!- -
79
- / / TODO: implement cor rect status symbol
80
- <span id= "status-symbol" > </ span>
81
- -- >
77
+ ${ this . #renderStateIcon( ) }
82
78
`
83
79
: nothing }
84
80
</ span>
@@ -91,8 +87,24 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
91
87
> ` ;
92
88
}
93
89
90
+ #renderStateIcon( ) {
91
+ if ( this . item ?. isProtected ) {
92
+ return this . #renderIsProtectedIcon( ) ;
93
+ }
94
+
95
+ if ( this . item ?. documentType . collection ) {
96
+ return this . #renderIsCollectionIcon( ) ;
97
+ }
98
+
99
+ return nothing ;
100
+ }
101
+
102
+ #renderIsCollectionIcon( ) {
103
+ return html `<umb- icon id= "state-icon" slot = "icon" name= "icon-grid" title = "Collection" > </ umb- icon> ` ;
104
+ }
105
+
94
106
#renderIsProtectedIcon( ) {
95
- return html `<umb- icon id= "icon-lock " slot = "icon" name = "icon-lock" title = "Protected" > </ umb- icon> ` ;
107
+ return html `<umb- icon id= "state-icon " slot = "icon" name = "icon-lock" title = "Protected" > </ umb- icon> ` ;
96
108
}
97
109
98
110
static override styles = [
@@ -106,19 +118,13 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
106
118
vertical-align : middle;
107
119
}
108
120
109
- # status-symbol {
110
- width : 5px ;
111
- height : 5px ;
112
- border : 1px solid white;
113
- background-color : blue;
114
- display : block;
115
- position : absolute;
116
- bottom : 0 ;
117
- right : 0 ;
118
- border-radius : 100% ;
121
+ # label {
122
+ white-space : nowrap;
123
+ overflow : hidden;
124
+ text-overflow : ellipsis;
119
125
}
120
126
121
- # icon-lock {
127
+ # state-icon {
122
128
position : absolute;
123
129
bottom : -5px ;
124
130
right : -5px ;
@@ -130,36 +136,30 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
130
136
line-height : 14px ;
131
137
}
132
138
133
- # label {
134
- white-space : nowrap;
135
- overflow : hidden;
136
- text-overflow : ellipsis;
137
- }
138
-
139
- : hover # icon-lock {
139
+ : hover # state-icon {
140
140
background : var (--uui-color-surface-emphasis );
141
141
}
142
142
143
143
/** Active */
144
- [active ] # icon-lock {
144
+ [active ] # state-icon {
145
145
background : var (--uui-color-current );
146
146
}
147
147
148
- [active ]: hover # icon-lock {
148
+ [active ]: hover # state-icon {
149
149
background : var (--uui-color-current-emphasis );
150
150
}
151
151
152
152
/** Selected */
153
- [selected ] # icon-lock {
153
+ [selected ] # state-icon {
154
154
background-color : var (--uui-color-selected );
155
155
}
156
156
157
- [selected ]: hover # icon-lock {
157
+ [selected ]: hover # state-icon {
158
158
background-color : var (--uui-color-selected-emphasis );
159
159
}
160
160
161
161
/** Disabled */
162
- [disabled ] # icon-lock {
162
+ [disabled ] # state-icon {
163
163
background-color : var (--uui-color-disabled );
164
164
}
165
165
0 commit comments