Skip to content

Commit

Permalink
Query Builder: Set alias automatically based on name
Browse files Browse the repository at this point in the history
  • Loading branch information
askask committed Aug 13, 2024
1 parent 6b79115 commit 6d0fbff
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,24 @@ export class AqlBuilderSelectItemComponent implements OnInit, OnDestroy {

ngOnInit(): void {
this.aliasForm = new UntypedFormGroup({
value: new UntypedFormControl(this.item.givenName),
value: new UntypedFormControl(
this.item.givenName ||
this.item.name
.replace('ä', 'ae')
.replace('ö', 'oe')
.replace('ü', 'ue')
.replace('ß', 'ss')
.replace('Ä', 'Ae')
.replace('Ö', 'Oe')
.replace('Ü', 'Ue')
.replace('ẞ', 'SS')
.normalize('NFD')
.replace(/\p{Diacritic}/gu, '')
.replace(/(^[^a-zA-Z]+)|[^0-9a-zA-Z_]+/g, '_')
),
})

this.handleAliasChange(this.aliasForm.get('value').value)
this.subscriptions.add(
this.aliasForm.get('value').valueChanges.subscribe((value) => this.handleAliasChange(value))
)
Expand Down

0 comments on commit 6d0fbff

Please sign in to comment.