-
-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/introduce readonly attribute in tags selector component (#4301)
* feat(ui): introduce readonly attribute * Update changelog
- Loading branch information
1 parent
72d5c71
commit 56f9438
Showing
5 changed files
with
75 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 48 additions & 31 deletions
79
libs/ui/src/lib/tags-selector/tags-selector.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,49 @@ | ||
<mat-form-field appearance="outline" class="w-100 without-hint"> | ||
<mat-label i18n>Tags</mat-label> | ||
<mat-chip-grid #tagsChipList> | ||
@for (tag of tagsSelected(); track tag.id) { | ||
<mat-chip-row | ||
matChipRemove | ||
[removable]="true" | ||
(removed)="onRemoveTag(tag)" | ||
> | ||
{{ tag.name }} | ||
<ion-icon matChipTrailingIcon name="close-outline" /> | ||
</mat-chip-row> | ||
<div class="row"> | ||
<div class="col"> | ||
@if (readonly) { | ||
<div class="h5" i18n>Tags</div> | ||
@if (tags?.length > 0) { | ||
<mat-chip-listbox> | ||
@for (tag of tags; track tag) { | ||
<mat-chip-option disabled>{{ tag.name }}</mat-chip-option> | ||
} | ||
</mat-chip-listbox> | ||
} @else { | ||
<div>-</div> | ||
} | ||
} @else { | ||
<mat-form-field appearance="outline" class="w-100 without-hint"> | ||
<mat-label i18n>Tags</mat-label> | ||
<mat-chip-grid #tagsChipList> | ||
@for (tag of tagsSelected(); track tag.id) { | ||
<mat-chip-row | ||
matChipRemove | ||
[removable]="true" | ||
(removed)="onRemoveTag(tag)" | ||
> | ||
{{ tag.name }} | ||
<ion-icon matChipTrailingIcon name="close-outline" /> | ||
</mat-chip-row> | ||
} | ||
<input | ||
#tagInput | ||
[formControl]="tagInputControl" | ||
[matAutocomplete]="autocompleteTags" | ||
[matChipInputFor]="tagsChipList" | ||
[matChipInputSeparatorKeyCodes]="separatorKeysCodes" | ||
/> | ||
</mat-chip-grid> | ||
<mat-autocomplete | ||
#autocompleteTags="matAutocomplete" | ||
(optionSelected)="onAddTag($event)" | ||
> | ||
@for (tag of filteredOptions | async; track tag.id) { | ||
<mat-option [value]="tag.id"> | ||
{{ tag.name }} | ||
</mat-option> | ||
} | ||
</mat-autocomplete> | ||
</mat-form-field> | ||
} | ||
<input | ||
#tagInput | ||
[formControl]="tagInputControl" | ||
[matAutocomplete]="autocompleteTags" | ||
[matChipInputFor]="tagsChipList" | ||
[matChipInputSeparatorKeyCodes]="separatorKeysCodes" | ||
/> | ||
</mat-chip-grid> | ||
<mat-autocomplete | ||
#autocompleteTags="matAutocomplete" | ||
(optionSelected)="onAddTag($event)" | ||
> | ||
@for (tag of filteredOptions | async; track tag.id) { | ||
<mat-option [value]="tag.id"> | ||
{{ tag.name }} | ||
</mat-option> | ||
} | ||
</mat-autocomplete> | ||
</mat-form-field> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters