Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
chore(frontend): improve select component
johavena666c92b329c
diff --git a/frontend/src/app/common/components/select/select.component.html b/frontend/src/app/common/components/select/select.component.htmlindex 72762b9c..e6de8519 100644--- a/frontend/src/app/common/components/select/select.component.html+++ b/frontend/src/app/common/components/select/select.component.html@@ -19,7 +19,7 @@<span class="ui-select-placeholder">{{ placeholder }}</span>}@if (allowClear && active) {- <button (click)="removeClick(active, $event)" aria-label="close" type="button" class="btn-close"></button>+ <fa-icon class="cursor-pointer me-2" (click)="removeClick(active, $event)" [icon]="xMarkIcon"></fa-icon>}<i class="dropdown-toggle"></i></span>@@ -48,8 +48,12 @@<span class="ui-icon circle-primary-icon me-2"><fa-icon [icon]="itemIcon" [fixedWidth]="false"></fa-icon></span>- <span>{{ active.name }}</span>- <div class="d-flex ms-auto me-4 fs-xs text-muted">{{ active.description }}</div>+ <div class="d-flex flex-column text-truncate">+ <span>{{ active.name }}</span>+ @if (active.description) {+ <span class="text-truncate fs-xs text-muted">{{ active.description }}</span>+ }+ </div></div></ng-template><ng-template #DefaultOptions let-i="i" let-o="o">@@ -58,8 +62,12 @@<span class="ui-icon circle-primary-icon me-2"><fa-icon [icon]="itemIcon" [fixedWidth]="false"></fa-icon></span>- <span [innerHtml]="sanitize(o.name | highlight:i)"></span>- <span class="d-flex ms-auto fs-xs text-muted" [innerHtml]="sanitize(o.description | highlight:i)"></span>+ <div class="d-flex flex-column text-truncate">+ <span class="text-truncate" [innerHtml]="sanitize(o.name | highlight:i)"></span>+ @if (o.description) {+ <span class="text-truncate fs-xs text-muted" [innerHtml]="sanitize(o.description | highlight:i)"></span>+ }+ </div></div></a></ng-template>diff --git a/frontend/src/app/common/components/select/select.component.scss b/frontend/src/app/common/components/select/select.component.scssindex 23d489b7..4e5f1d3b 100644--- a/frontend/src/app/common/components/select/select.component.scss+++ b/frontend/src/app/common/components/select/select.component.scss@@ -32,11 +32,12 @@}.ui-select-search {- line-height: 26px;+ height: 42px}.ui-select-match {- padding-left: .3rem;+ height: 42px;+ padding: 0.2rem 0.5rem;.btn {text-align: start !important;@@ -56,6 +57,7 @@.ui-select-toggle {display: flex;align-items: center;+ height: 100%;> .caret {position: absolute;@@ -67,9 +69,10 @@}.ui-select-placeholder {- float: left;- line-height: 26px;color: #8c8c8c;+ display: flex;+ flex-direction: column;+ justify-content: center;width: 100%;}@@ -85,14 +88,14 @@.ui-select-choices {width: 100%;height: auto;- max-height: 200px;+ max-height: 275px;overflow-x: hidden;margin-top: 0;.ui-select-choices-row {> a {display: block;- padding: 3px 5px;+ padding: 5px;clear: both;font-weight: 400;line-height: 1.42857143;diff --git a/frontend/src/app/common/components/select/select.component.ts b/frontend/src/app/common/components/select/select.component.tsindex 0ebc7d1a..db55cc0a 100644--- a/frontend/src/app/common/components/select/select.component.ts+++ b/frontend/src/app/common/components/select/select.component.ts@@ -4,7 +4,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'import { DomSanitizer, SafeHtml } from '@angular/platform-browser'import { FaIconComponent } from '@fortawesome/angular-fontawesome'import { IconDefinition } from '@fortawesome/fontawesome-svg-core'-import { faQuestion } from '@fortawesome/free-solid-svg-icons'+import { faQuestion, faXmark } from '@fortawesome/free-solid-svg-icons'import { Subscription } from 'rxjs'import { debounceTime, distinctUntilChanged } from 'rxjs/operators'import { OffClickDirective } from '../../directives/off-click.directive'@@ -40,6 +40,7 @@ export class SelectComponent implements OnInit, OnDestroy, ControlValueAccessor@Output() removed = new EventEmitter<any>()@Output() typed = new EventEmitter<any>()@Output() opened = new EventEmitter<any>()+ protected xMarkIcon = faXmarkpublic options: SelectItem[] = []public itemObjects: SelectItem[] = []public activeOption: SelectItem