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 */
|
/* 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 = {
|
const request: ISetContainerListRequest = {
|
||||||
Container: container,
|
Container: container,
|
||||||
|
PreviousContainer: prev,
|
||||||
|
NextContainer: next,
|
||||||
Action: action.Action,
|
Action: action.Action,
|
||||||
ApplicationState: currentState
|
ApplicationState: currentState
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,12 @@ export interface ISetContainerListRequest {
|
||||||
/** Selected container */
|
/** Selected container */
|
||||||
Container: IContainerModel
|
Container: IContainerModel
|
||||||
|
|
||||||
|
/** The previous sibling container */
|
||||||
|
PreviousContainer: IContainerModel | undefined
|
||||||
|
|
||||||
|
/** The next sibling container */
|
||||||
|
NextContainer: IContainerModel | undefined
|
||||||
|
|
||||||
/** Current application state */
|
/** Current application state */
|
||||||
ApplicationState: IHistoryState
|
ApplicationState: IHistoryState
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue