97075: Edit metadata redesign pt2

This commit is contained in:
Kristof De Langhe
2022-11-30 17:49:19 +01:00
parent 92f94c39b2
commit 105f6cb954
6 changed files with 180 additions and 48 deletions

View File

@@ -1,9 +1,8 @@
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { startWith, switchMap, debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { switchMap, debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { followLink } from '../../../shared/utils/follow-link-config.model';
import {
getAllSucceededRemoteData,
getFirstSucceededRemoteData,
metadataFieldsToString
} from '../../../core/shared/operators';
import { Observable } from 'rxjs/internal/Observable';
@@ -26,7 +25,8 @@ export class MetadataFieldSelectorComponent implements OnInit, OnDestroy {
public input: FormControl = new FormControl();
query$: BehaviorSubject<string> = new BehaviorSubject<string>(null);
debounceTime = 500;
debounceTime = 300;
selectedValueLoading = false;
subs: Subscription[] = [];
@@ -38,7 +38,10 @@ export class MetadataFieldSelectorComponent implements OnInit, OnDestroy {
this.input.valueChanges.pipe(
debounceTime(this.debounceTime),
).subscribe((valueChange) => {
this.query$.next(valueChange);
if (!this.selectedValueLoading) {
this.query$.next(valueChange);
}
this.selectedValueLoading = false;
this.mdField = valueChange;
this.mdFieldChange.emit(this.mdField);
}),
@@ -59,7 +62,8 @@ export class MetadataFieldSelectorComponent implements OnInit, OnDestroy {
}
select(mdFieldOption: string) {
this.mdField = mdFieldOption;
this.selectedValueLoading = true;
this.input.setValue(mdFieldOption);
}
ngOnDestroy(): void {