1
- import { css , customElement , html , property , state } from '@umbraco-cms/backoffice/external/lit' ;
1
+ import { css , customElement , html , nothing , property , state } from '@umbraco-cms/backoffice/external/lit' ;
2
2
import { UmbChangeEvent } from '@umbraco-cms/backoffice/event' ;
3
3
import { UmbFormControlMixin } from '@umbraco-cms/backoffice/validation' ;
4
4
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element' ;
@@ -13,6 +13,9 @@ export class UmbInputWithAliasElement extends UmbFormControlMixin<string>(UmbLit
13
13
@property ( { type : String , reflect : false } )
14
14
alias ?: string ;
15
15
16
+ @property ( { type : Boolean , reflect : true , attribute : 'alias-readonly' } )
17
+ aliasReadonly = false ;
18
+
16
19
@property ( { type : Boolean , attribute : 'auto-generate-alias' } )
17
20
autoGenerateAlias ?: boolean ;
18
21
@@ -75,11 +78,14 @@ export class UmbInputWithAliasElement extends UmbFormControlMixin<string>(UmbLit
75
78
@input=${ this . #onAliasChange}
76
79
.value=${ this . alias }
77
80
placeholder=" Enter alias ..."
78
- ?disabled=${ this . _aliasLocked } >
81
+ ?disabled=${ this . _aliasLocked && ! this . aliasReadonly }
82
+ ?readonly=${ this . aliasReadonly } >
79
83
<!-- TODO: validation for bad characters -->
80
- <div @click=${ this . #onToggleAliasLock} @keydown=${ ( ) => '' } id=" alias-lock" slot=" prepend">
81
- <uui-icon name=${ this . _aliasLocked ? 'icon-lock' : 'icon-unlocked' } ></uui-icon>
82
- </div>
84
+ ${ this . aliasReadonly
85
+ ? nothing
86
+ : html `<div @click=${ this . #onToggleAliasLock} @keydown=${ ( ) => '' } id=" alias-lock" slot=" prepend">
87
+ <uui-icon name=${ this . _aliasLocked ? 'icon-lock' : 'icon-unlocked' } ></uui-icon>
88
+ </div>` }
83
89
</uui-input>
84
90
</uui-input>
85
91
` ;
@@ -105,6 +111,7 @@ export class UmbInputWithAliasElement extends UmbFormControlMixin<string>(UmbLit
105
111
justify-content: center;
106
112
cursor: pointer;
107
113
}
114
+
108
115
#alias-lock uui-icon {
109
116
margin-bottom: 2px;
110
117
}
0 commit comments