From 5c52e2a6f845c2c4f7e0795ada3b09ec048201f6 Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Sat, 6 Apr 2024 23:09:25 +0300 Subject: [PATCH] Add function to select concept kernel --- rsconcept/frontend/src/components/Icons.tsx | 1 + .../src/components/info/InfoConstituenta.tsx | 10 ++++++---- .../select/ConstituentaMultiPicker.tsx | 4 +++- .../components/select/SelectGraphToolbar.tsx | 9 ++++++++- .../RSFormPage/EditorTermGraph/GraphToolbar.tsx | 17 +++++++++++------ 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/rsconcept/frontend/src/components/Icons.tsx b/rsconcept/frontend/src/components/Icons.tsx index b11a5271..38ca3b44 100644 --- a/rsconcept/frontend/src/components/Icons.tsx +++ b/rsconcept/frontend/src/components/Icons.tsx @@ -33,6 +33,7 @@ export { BiExpand as IconGraphExpand } from 'react-icons/bi'; export { LuMaximize as IconGraphMaximize } from 'react-icons/lu'; export { BiGitBranch as IconGraphInputs } from 'react-icons/bi'; export { BiGitMerge as IconGraphOutputs } from 'react-icons/bi'; +export { LuAtom as IconGraphCore } from 'react-icons/lu'; export { BiCheckShield as IconImmutable } from 'react-icons/bi'; export { RiOpenSourceLine as IconPublic } from 'react-icons/ri'; diff --git a/rsconcept/frontend/src/components/info/InfoConstituenta.tsx b/rsconcept/frontend/src/components/info/InfoConstituenta.tsx index c2559a56..50996a7e 100644 --- a/rsconcept/frontend/src/components/info/InfoConstituenta.tsx +++ b/rsconcept/frontend/src/components/info/InfoConstituenta.tsx @@ -14,10 +14,12 @@ function InfoConstituenta({ data, className, ...restProps }: InfoConstituentaPro return (

Конституента {data.alias}

-

- Термин: - {data.term_resolved || data.term_raw} -

+ {data.term_resolved ? ( +

+ Термин: + {data.term_resolved || data.term_raw} +

+ ) : null}

Типизация: {labelCstTypification(data)} diff --git a/rsconcept/frontend/src/components/select/ConstituentaMultiPicker.tsx b/rsconcept/frontend/src/components/select/ConstituentaMultiPicker.tsx index ecc1ff3d..e382a56e 100644 --- a/rsconcept/frontend/src/components/select/ConstituentaMultiPicker.tsx +++ b/rsconcept/frontend/src/components/select/ConstituentaMultiPicker.tsx @@ -6,6 +6,7 @@ import { useLayoutEffect, useMemo, useState } from 'react'; import DataTable, { createColumnHelper, RowSelectionState } from '@/components/ui/DataTable'; import { useConceptOptions } from '@/context/OptionsContext'; import { ConstituentaID, IConstituenta, IRSForm } from '@/models/rsform'; +import { isBasicConcept } from '@/models/rsformAPI'; import { describeConstituenta } from '@/utils/labels'; import ConstituentaBadge from '../info/ConstituentaBadge'; @@ -80,7 +81,8 @@ function ConstituentaMultiPicker({ id, schema, prefixID, rows, selected, setSele {schema ? ( isBasicConcept(cst.cst_type)).map(cst => cst.id)} setSelected={setSelected} className='w-full ml-8' /> diff --git a/rsconcept/frontend/src/components/select/SelectGraphToolbar.tsx b/rsconcept/frontend/src/components/select/SelectGraphToolbar.tsx index 54f1b248..f5f8d7e9 100644 --- a/rsconcept/frontend/src/components/select/SelectGraphToolbar.tsx +++ b/rsconcept/frontend/src/components/select/SelectGraphToolbar.tsx @@ -4,6 +4,7 @@ import { Graph } from '@/models/Graph'; import { IconGraphCollapse, + IconGraphCore, IconGraphExpand, IconGraphInputs, IconGraphMaximize, @@ -15,10 +16,11 @@ import MiniButton from '../ui/MiniButton'; interface SelectGraphToolbarProps extends CProps.Styling { graph: Graph; + core: number[]; setSelected: React.Dispatch>; } -function SelectGraphToolbar({ className, graph, setSelected, ...restProps }: SelectGraphToolbarProps) { +function SelectGraphToolbar({ className, graph, core, setSelected, ...restProps }: SelectGraphToolbarProps) { return (

} onClick={() => setSelected(prev => [...prev, ...graph.expandOutputs(prev)])} /> + } + onClick={() => setSelected([...core, ...graph.expandInputs(core)])} + />
); } diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/GraphToolbar.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/GraphToolbar.tsx index 35768021..cae6509c 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/GraphToolbar.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/GraphToolbar.tsx @@ -16,6 +16,7 @@ import SelectGraphToolbar from '@/components/select/SelectGraphToolbar'; import MiniButton from '@/components/ui/MiniButton'; import Overlay from '@/components/ui/Overlay'; import { HelpTopic } from '@/models/miscellaneous'; +import { isBasicConcept } from '@/models/rsformAPI'; import { useRSEdit } from '../RSEditContext'; @@ -62,6 +63,11 @@ function GraphToolbar({ icon={} onClick={showParamsDialog} /> + } + title='Граф целиком' + onClick={onResetViewpoint} + /> - } - title='Граф целиком' - onClick={onResetViewpoint} - /> } title='Анимация вращения' @@ -113,7 +114,11 @@ function GraphToolbar({ ) : null}
- + isBasicConcept(cst.cst_type)).map(cst => cst.id)} + setSelected={controller.setSelected} + /> ); }