Skip to content

Commit 01363ab

Browse files
committed
auto generate alias
1 parent a2cecd5 commit 01363ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/packages/core/components/input-with-alias/input-with-alias.element.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export class UmbInputWithAliasElement extends UmbFormControlMixin<string>(UmbLit
1313
@property({ type: String, reflect: false })
1414
alias?: string;
1515

16+
@property({ type: Boolean, attribute: 'auto-generate-alias' })
17+
autoGenerateAlias?: boolean;
18+
1619
@state()
1720
private _aliasLocked = true;
1821

@@ -32,7 +35,7 @@ export class UmbInputWithAliasElement extends UmbFormControlMixin<string>(UmbLit
3235
const oldName = this.value;
3336
const oldAlias = this.alias ?? '';
3437
this.value = event.target.value.toString();
35-
if (this._aliasLocked) {
38+
if (this.autoGenerateAlias && this._aliasLocked) {
3639
// If locked we will update the alias, but only if it matches the generated alias of the old name [NL]
3740
const expectedOldAlias = generateAlias(oldName ?? '');
3841
// Only update the alias if the alias matches a generated alias of the old name (otherwise the alias is considered one written by the user.) [NL]

0 commit comments

Comments
 (0)