Add previous and next container to ISetContainerListRequest
This commit is contained in:
parent
8aae29d714
commit
d512f87776
2 changed files with 23 additions and 0 deletions
|
@ -32,8 +32,25 @@ export function GetAction(
|
|||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
let prev;
|
||||
let next;
|
||||
if (container.parent !== undefined &&
|
||||
container.parent !== null &&
|
||||
container.parent.children.length > 1
|
||||
) {
|
||||
const index = container.parent.children.indexOf(container);
|
||||
if (index > 0) {
|
||||
prev = container.parent.children[index - 1];
|
||||
}
|
||||
if (index < container.parent.children.length - 1) {
|
||||
next = container.parent.children[index + 1];
|
||||
}
|
||||
}
|
||||
|
||||
const request: ISetContainerListRequest = {
|
||||
Container: container,
|
||||
PreviousContainer: prev,
|
||||
NextContainer: next,
|
||||
Action: action.Action,
|
||||
ApplicationState: currentState
|
||||
};
|
||||
|
|
|
@ -9,6 +9,12 @@ export interface ISetContainerListRequest {
|
|||
/** Selected container */
|
||||
Container: IContainerModel
|
||||
|
||||
/** The previous sibling container */
|
||||
PreviousContainer: IContainerModel | undefined
|
||||
|
||||
/** The next sibling container */
|
||||
NextContainer: IContainerModel | undefined
|
||||
|
||||
/** Current application state */
|
||||
ApplicationState: IHistoryState
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue