Merge branch 'main' into fix-bistream-download-cache

This commit is contained in:
Giuseppe Digilio
2023-06-23 09:16:17 +02:00
3 changed files with 26 additions and 1 deletions

View File

@@ -22,6 +22,8 @@ import { MetadataValue } from '../../core/shared/metadata.models';
import { getFirstSucceededRemoteListPayload } from '../../core/shared/operators';
import { collectionFormEntityTypeSelectionConfig, collectionFormModels, } from './collection-form.models';
import { NONE_ENTITY_TYPE } from '../../core/shared/item-relationships/item-type.resource-type';
import { hasNoValue, isNotNull } from 'src/app/shared/empty.util';
/**
* Form used for creating and editing collections
@@ -66,6 +68,12 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> imp
super(formService, translate, notificationsService, authService, requestService, objectCache);
}
ngOnInit(): void {
if (hasNoValue(this.formModel) && isNotNull(this.dso)) {
this.initializeForm();
}
}
/**
* Detect changes to the dso and initialize the form,
* if the dso changes, exists and it is not the first change

View File

@@ -23,7 +23,7 @@
(blur)="onBlur($event)"
(click)="$event.stopPropagation(); openDropdown(sdRef);"
(focus)="onFocus($event)"
(keypress)="$event.preventDefault()">
(keydown)="selectOnKeyDown($event, sdRef)">
</div>
<div ngbDropdownMenu

View File

@@ -98,6 +98,23 @@ export class DsDynamicScrollableDropdownComponent extends DsDynamicVocabularyCom
}
}
/**
* KeyDown handler to allow toggling the dropdown via keyboard
* @param event KeyboardEvent
* @param sdRef The reference of the NgbDropdown.
*/
selectOnKeyDown(event: KeyboardEvent, sdRef: NgbDropdown) {
const keyName = event.key;
if (keyName === ' ' || keyName === 'Enter') {
event.preventDefault();
event.stopPropagation();
sdRef.toggle();
} else if (keyName === 'ArrowDown' || keyName === 'ArrowUp') {
this.openDropdown(sdRef);
}
}
/**
* Loads any new entries
*/