Adds clear autocomplete when you select value functionality at External References. (Issue #155)
This commit is contained in:
parent
860801bb89
commit
e853c8c44a
|
@ -8,6 +8,8 @@ export interface SingleAutoCompleteConfiguration {
|
|||
minFilteringChars?: number;
|
||||
// Load and present items from start, without user query. Default: true.
|
||||
loadDataOnStart?: boolean;
|
||||
// Remove item after selection.
|
||||
removeAfterSelection?: boolean;
|
||||
// Static or initial items.
|
||||
initialItems?: (data?: any) => Observable<any[]>;
|
||||
// Data retrieval function
|
||||
|
|
|
@ -153,6 +153,13 @@ export class SingleAutoCompleteComponent implements OnInit, MatFormFieldControl<
|
|||
//this._inputValue = " ";
|
||||
this.stateChanges.next();
|
||||
this.optionSelected.emit(event.option.value);
|
||||
if (this.configuration.removeAfterSelection) {
|
||||
this.clearAutocomplete()
|
||||
}
|
||||
}
|
||||
|
||||
private clearAutocomplete() {
|
||||
this._setValue(null);
|
||||
}
|
||||
|
||||
private _setValue(value: any) {
|
||||
|
|
|
@ -66,6 +66,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|||
|
||||
this.dataRepositoriesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalDataRepositories.bind(this),
|
||||
removeAfterSelection: true,
|
||||
initialItems: (type) => this.searchDatasetExternalDataRepositories('', type),
|
||||
displayFn: (item) => item ? item.name : null,
|
||||
titleFn: (item) => item ? item.name : null,
|
||||
|
@ -74,6 +75,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|||
|
||||
this.externalDatasetAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalDatasets.bind(this),
|
||||
removeAfterSelection: true,
|
||||
initialItems: (type) => this.searchDatasetExternalDatasets('', type),//.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1),
|
||||
displayFn: (item) => item ? item.label : null,
|
||||
titleFn: (item) => item ? item.label : null,
|
||||
|
@ -82,6 +84,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|||
|
||||
this.registriesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalRegistries.bind(this),
|
||||
removeAfterSelection: true,
|
||||
initialItems: (type) => this.searchDatasetExternalRegistries('', type),
|
||||
displayFn: (item) => item ? item.label : null,
|
||||
titleFn: (item) => item ? item.label: null,
|
||||
|
@ -90,6 +93,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|||
|
||||
this.servicesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalServices.bind(this),
|
||||
removeAfterSelection: true,
|
||||
initialItems: (type) => this.searchDatasetExternalServices('', type),
|
||||
displayFn: (item) => item ? item.label : null,
|
||||
titleFn: (item) => item ? item.label : null,
|
||||
|
@ -98,6 +102,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|||
|
||||
this.tagsAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetTags.bind(this),
|
||||
removeAfterSelection: true,
|
||||
initialItems: (type) => this.searchDatasetTags('', type),
|
||||
displayFn: (item) => item ? item.name : null,
|
||||
titleFn: (item) => item ? item.name : null,
|
||||
|
|
Loading…
Reference in New Issue