Merged PR 315: ErgonomieTreeView

Affichage fonctionnelle sous forme de toolbar vertical, comme dans les IDE

Related work items: #7976
This commit is contained in:
Carl Fuchs 2023-02-07 14:25:53 +00:00 committed by Eric Nguyen
parent acb5ba2d82
commit 8a99ef4cfd
13 changed files with 240 additions and 133 deletions

View file

@ -36,6 +36,30 @@ export function SelectContainer(
return history;
}
/**
* Deselect a container
* @returns New history
*/
export function DeselectContainer(
containerId: string,
fullHistory: IHistoryState[],
historyCurrentStep: number
): IHistoryState[] {
const history = GetCurrentHistory(fullHistory, historyCurrentStep);
const current = history[history.length - 1];
history.push({
lastAction: `Deselect ${containerId}`,
mainContainer: current.mainContainer,
containers: structuredClone(current.containers),
selectedContainerId: 'undefined',
typeCounters: Object.assign({}, current.typeCounters),
symbols: structuredClone(current.symbols),
selectedSymbolId: current.selectedSymbolId
});
return history;
}
/**
* Delete a container
* @param containerId containerId of the container to delete
@ -115,7 +139,7 @@ export function DeleteContainer(
* If the selected container is removed, select the sibling after,
* If there is no sibling, select the parent,
*
* @param mainContainerClone Main container
* @param containers
* @param selectedContainerId Current selected container
* @param parent Parent of the selected/deleted container
* @param index Index of the selected/deleted container
@ -127,11 +151,10 @@ function GetSelectedContainerOnDelete(
parent: IContainerModel,
index: number
): string {
const newSelectedContainerId = FindContainerById(containers, selectedContainerId)?.properties.id ??
parent.children.at(index) ??
parent.children.at(index - 1) ??
parent.properties.id;
return newSelectedContainerId;
return FindContainerById(containers, selectedContainerId)?.properties.id ??
parent.children.at(index) ??
parent.children.at(index - 1) ??
parent.properties.id;
}
/**
@ -157,11 +180,15 @@ function UnlinkContainerFromSymbols(
}
/**
* Handled the property change event in the properties form
* @param key Property name
* @param value New value of the property
* @returns void
*/
* Handled the property change event in the properties form
* @param key Property name
* @param value New value of the property
* @param type
* @param selected
* @param fullHistory
* @param historyCurrentStep
* @returns void
*/
export function OnPropertyChange(
key: string,
value: string | number | boolean | number[],
@ -201,6 +228,7 @@ export function OnPropertyChange(
/**
* Sort the parent children by x
* @param containers
* @param parent The clone used for the sort
* @returns void
*/
@ -265,6 +293,7 @@ export function SortChildren(
/**
* Set the container with properties and behaviors (mutate)
* @param containers
* @param container Container to update
* @param key Key of the property to update
* @param value Value of the property to update
@ -371,9 +400,8 @@ function AssignProperty(container: IContainerModel, key: string, value: string |
/**
* Link a symbol to a container
* @param containerId Container id
* @param oldSymbolId Old Symbol id
* @param newSymbolId New Symbol id
* @param symbols Current list of symbols
* @param oldSymbol
* @param newSymbol
* @returns
*/
export function LinkSymbol(