mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
solved issues with radiobuttons
This commit is contained in:
@@ -40,12 +40,11 @@ export class SelectableListSelectAction extends SelectableListAction {
|
||||
export class SelectableListSelectSingleAction extends SelectableListAction {
|
||||
payload: {
|
||||
object: ListableObject,
|
||||
multipleSelectionsAllowed: boolean
|
||||
};
|
||||
|
||||
constructor(id: string, object: ListableObject, multipleSelectionsAllowed: boolean = true) {
|
||||
constructor(id: string, object: ListableObject) {
|
||||
super(SelectableListActionTypes.SELECT_SINGLE, id);
|
||||
this.payload = { object, multipleSelectionsAllowed };
|
||||
this.payload = { object };
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -70,13 +70,9 @@ function select(state: SelectableListState, action: SelectableListSelectAction)
|
||||
}
|
||||
|
||||
function selectSingle(state: SelectableListState, action: SelectableListSelectSingleAction) {
|
||||
let newSelection;
|
||||
let newSelection = state.selection;
|
||||
if (!isObjectInSelection(state.selection, action.payload.object)) {
|
||||
if (action.payload.multipleSelectionsAllowed) {
|
||||
newSelection = [...state.selection, action.payload.object];
|
||||
} else {
|
||||
newSelection = [action.payload.object];
|
||||
}
|
||||
newSelection = [...state.selection, action.payload.object];
|
||||
}
|
||||
return Object.assign({}, state, { selection: newSelection });
|
||||
}
|
||||
|
@@ -37,10 +37,9 @@ export class SelectableListService {
|
||||
* Select an object in a specific list in the store
|
||||
* @param {string} id The id of the list on which the object should be selected
|
||||
* @param {ListableObject} object The object to select
|
||||
* @param {boolean} multipleSelectionsAllowed Defines if the multiple selections are allowed for this selectable list
|
||||
*/
|
||||
selectSingle(id: string, object: ListableObject, multipleSelectionsAllowed?: boolean) {
|
||||
this.store.dispatch(new SelectableListSelectSingleAction(id, object, multipleSelectionsAllowed));
|
||||
selectSingle(id: string, object: ListableObject) {
|
||||
this.store.dispatch(new SelectableListSelectSingleAction(id, object));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user