diff --git a/src/Components/SymbolProperties/SymbolForm.tsx b/src/Components/SymbolProperties/SymbolForm.tsx index 4ad76d8..0c9877d 100644 --- a/src/Components/SymbolProperties/SymbolForm.tsx +++ b/src/Components/SymbolProperties/SymbolForm.tsx @@ -22,6 +22,15 @@ export function SymbolForm(props: ISymbolFormProps): JSX.Element { type='string' value={props.symbol.id.toString()} isDisabled={true} /> + props.onChange('displayedText', value)} /> (null); const height = useSize(divRef)[1]; // Render - const containers = [...props.symbols.values()]; + const symbols = [...props.symbols.values()]; function Row({ index, style }: { index: number, style: React.CSSProperties }): JSX.Element { - const container = containers[index]; - const key = container.id.toString(); - const text = key; + const symbol = symbols[index]; + const key = symbol.id; + const text = symbol.displayedText; const selectedClass: string = props.selectedSymbolId !== '' && - props.selectedSymbolId === container.id + props.selectedSymbolId === symbol.id ? 'border-l-4 bg-slate-400/60 hover:bg-slate-400' : 'bg-slate-300/60 hover:bg-slate-300'; @@ -45,7 +45,7 @@ export function SymbolsSidebar(props: ISymbolsSidebarProps): JSX.Element {
, type: string, symbolConfig: IAvailableSymbol): ISymbolModel { + const id = `${name}-${newCounters[type]}`; return { - id: `${name}-${newCounters[type]}`, + id, + displayedText: symbolConfig.DisplayedText ?? id, type: name, config: structuredClone(symbolConfig), x: 0, diff --git a/test-server/http.js b/test-server/http.js index fd4286f..8fd01cc 100644 --- a/test-server/http.js +++ b/test-server/http.js @@ -30,6 +30,7 @@ const requestListener = async (request, response) => { break; case 'SplitRemplissageParent': json = SplitRemplissage(bodyParsed); + break; default: break; } @@ -274,6 +275,7 @@ const GetSVGLayoutConfiguration = () => { ], AvailableSymbols: [ { + DisplayedText: 'Nom du Symbol', Width: 32, Height: 32, Image: { @@ -359,7 +361,7 @@ const FillHoleWithChassis = (request) => { }; }; -const SplitRemplissage = (request) => { +const SplitRemplissage = () => { const lstModels = [ { Type: 'Remplissage', @@ -380,7 +382,7 @@ const SplitRemplissage = (request) => { }; -const Insert = (request) => { +const Insert = () => { const lstModels = [ { Type: 'Remplissage',