Merged PR 205: Add new AddingBehavior ReplaceParent + Allow AddingBehavior override by response + fix double key in context menu + Rename node-http.js to http.js
This commit is contained in:
parent
34c00d267c
commit
38a6919192
7 changed files with 151 additions and 379 deletions
|
@ -39,7 +39,7 @@ export function GetAction(
|
|||
Container: container,
|
||||
PreviousContainer: prev,
|
||||
NextContainer: next,
|
||||
Action: action.Action,
|
||||
Action: action,
|
||||
ApplicationState: currentState
|
||||
};
|
||||
/* eslint-enable */
|
||||
|
@ -59,7 +59,7 @@ export function GetAction(
|
|||
};
|
||||
}
|
||||
|
||||
function GetPreviousAndNextSiblings(container: IContainerModel): { prev: IContainerModel | undefined; next: IContainerModel | undefined; } {
|
||||
function GetPreviousAndNextSiblings(container: IContainerModel): { prev: IContainerModel | undefined, next: IContainerModel | undefined } {
|
||||
let prev;
|
||||
let next;
|
||||
if (container.parent !== undefined &&
|
||||
|
@ -85,7 +85,8 @@ function HandleSetContainerList(
|
|||
historyCurrentStep: number,
|
||||
setNewHistory: (newHistory: IHistoryState[]) => void
|
||||
): void {
|
||||
switch (action.AddingBehavior) {
|
||||
const addingBehavior = response.AddingBehavior ?? action.AddingBehavior;
|
||||
switch (addingBehavior) {
|
||||
case AddMethod.Append:
|
||||
setNewHistory(
|
||||
AddContainers(
|
||||
|
@ -98,7 +99,7 @@ function HandleSetContainerList(
|
|||
));
|
||||
break;
|
||||
case AddMethod.Insert:
|
||||
break;
|
||||
throw new Error('Not yet supported');
|
||||
case AddMethod.Replace:
|
||||
setNewHistory(
|
||||
HandleReplace(
|
||||
|
@ -110,6 +111,25 @@ function HandleSetContainerList(
|
|||
)
|
||||
);
|
||||
break;
|
||||
case AddMethod.ReplaceParent:
|
||||
if (selectedContainer.parent === undefined || selectedContainer.parent === null) {
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
text: 'The selected container has not parent to replace',
|
||||
icon: 'error'
|
||||
});
|
||||
return;
|
||||
}
|
||||
setNewHistory(
|
||||
HandleReplace(
|
||||
selectedContainer.parent,
|
||||
response,
|
||||
configuration,
|
||||
history,
|
||||
historyCurrentStep
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue