From b33dceebf84b2b9b1516dca8a74d0232ea5a1a4b Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Wed, 3 Apr 2024 18:48:56 +0300 Subject: [PATCH] Implement graph operations and improve UI --- .../select/ConstituentaMultiPicker.tsx | 4 +- .../frontend/src/components/ui/MiniButton.tsx | 2 +- .../frontend/src/components/ui/TabLabel.tsx | 2 +- .../src/dialogs/DlgDeleteCst/DlgDeleteCst.tsx | 2 +- .../DlgEditVersions/DlgEditVersions.tsx | 26 ++-- rsconcept/frontend/src/models/Graph.test.ts | 51 ++++++- rsconcept/frontend/src/models/Graph.ts | 62 ++++++-- .../frontend/src/models/miscellaneousAPI.ts | 4 +- .../ConstituentaToolbar.tsx | 2 +- .../EditorConstituenta/ControlsOverlay.tsx | 2 +- .../EditorRSExpression/EditorRSExpression.tsx | 5 +- .../RSFormPage/EditorRSForm/FormRSForm.tsx | 4 +- .../RSFormPage/EditorRSForm/RSFormToolbar.tsx | 2 +- .../RSFormPage/EditorRSList/RSListToolbar.tsx | 2 +- .../EditorTermGraph/EditorTermGraph.tsx | 6 +- .../EditorTermGraph/GraphSidebar.tsx | 47 ------ .../EditorTermGraph/GraphToolbar.tsx | 138 ++++++++++++------ .../src/pages/RSFormPage/RSEditContext.tsx | 10 ++ .../src/pages/RSFormPage/RSTabsMenu.tsx | 2 +- rsconcept/frontend/src/styling/color.ts | 22 +-- rsconcept/frontend/src/styling/styles.css | 4 + 21 files changed, 238 insertions(+), 161 deletions(-) delete mode 100644 rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/GraphSidebar.tsx diff --git a/rsconcept/frontend/src/components/select/ConstituentaMultiPicker.tsx b/rsconcept/frontend/src/components/select/ConstituentaMultiPicker.tsx index bf2d6559..68ba4438 100644 --- a/rsconcept/frontend/src/components/select/ConstituentaMultiPicker.tsx +++ b/rsconcept/frontend/src/components/select/ConstituentaMultiPicker.tsx @@ -59,7 +59,7 @@ function ConstituentaMultiPicker({ id, schema, prefixID, rows, selected, setSele if (!schema || selected.length === 0) { return; } - const addition = schema.graph.expandInputs(selected).filter(id => !selected.includes(id)); + const addition = schema.graph.expandAllInputs(selected).filter(id => !selected.includes(id)); if (addition.length > 0) { setSelected([...selected, ...addition]); } @@ -69,7 +69,7 @@ function ConstituentaMultiPicker({ id, schema, prefixID, rows, selected, setSele if (!schema || selected.length === 0) { return; } - const addition = schema.graph.expandOutputs(selected).filter(id => !selected.includes(id)); + const addition = schema.graph.expandAllOutputs(selected).filter(id => !selected.includes(id)); if (addition.length > 0) { setSelected([...selected, ...addition]); } diff --git a/rsconcept/frontend/src/components/ui/MiniButton.tsx b/rsconcept/frontend/src/components/ui/MiniButton.tsx index 91982e5d..cad3c927 100644 --- a/rsconcept/frontend/src/components/ui/MiniButton.tsx +++ b/rsconcept/frontend/src/components/ui/MiniButton.tsx @@ -26,7 +26,7 @@ function MiniButton({ type='button' tabIndex={tabIndex ?? -1} className={clsx( - 'rounded-full', + 'rounded-lg', 'clr-btn-clear', 'cursor-pointer disabled:cursor-not-allowed', { diff --git a/rsconcept/frontend/src/components/ui/TabLabel.tsx b/rsconcept/frontend/src/components/ui/TabLabel.tsx index 52f72c25..8969973c 100644 --- a/rsconcept/frontend/src/components/ui/TabLabel.tsx +++ b/rsconcept/frontend/src/components/ui/TabLabel.tsx @@ -14,7 +14,7 @@ function TabLabel({ label, title, titleHtml, hideTitle, className, ...otherProps return ( { function DlgDeleteCst({ hideWindow, selected, schema, onDelete }: DlgDeleteCstProps) { const [expandOut, setExpandOut] = useState(false); - const expansion: number[] = useMemo(() => schema.graph.expandOutputs(selected), [selected, schema.graph]); + const expansion: number[] = useMemo(() => schema.graph.expandAllOutputs(selected), [selected, schema.graph]); function handleSubmit() { hideWindow(); diff --git a/rsconcept/frontend/src/dialogs/DlgEditVersions/DlgEditVersions.tsx b/rsconcept/frontend/src/dialogs/DlgEditVersions/DlgEditVersions.tsx index 43d34ee6..3b42acfa 100644 --- a/rsconcept/frontend/src/dialogs/DlgEditVersions/DlgEditVersions.tsx +++ b/rsconcept/frontend/src/dialogs/DlgEditVersions/DlgEditVersions.tsx @@ -88,18 +88,20 @@ function DlgEditVersions({ hideWindow, versions, onDelete, onUpdate }: DlgEditVe value={version} onChange={event => setVersion(event.target.value)} /> - } - onClick={handleUpdate} - /> - } - /> +
+ } + onClick={handleUpdate} + /> + } + /> +