From 26a74202a1ec5aa23caa30291567a0f1b75fc5cc Mon Sep 17 00:00:00 2001 From: Ivan <8611739+IRBorisov@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:20:50 +0300 Subject: [PATCH] F: Implementing M-Graph pt1 --- .../DlgShowTypification.tsx | 25 +++++++++++++++++ .../src/dialogs/DlgShowTypification/index.tsx | 1 + rsconcept/frontend/src/models/TMGraph.ts | 7 +++++ .../EditorConstituenta/FormConstituenta.tsx | 28 +++++++++++++++++-- 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 rsconcept/frontend/src/dialogs/DlgShowTypification/DlgShowTypification.tsx create mode 100644 rsconcept/frontend/src/dialogs/DlgShowTypification/index.tsx create mode 100644 rsconcept/frontend/src/models/TMGraph.ts diff --git a/rsconcept/frontend/src/dialogs/DlgShowTypification/DlgShowTypification.tsx b/rsconcept/frontend/src/dialogs/DlgShowTypification/DlgShowTypification.tsx new file mode 100644 index 00000000..b124fd9a --- /dev/null +++ b/rsconcept/frontend/src/dialogs/DlgShowTypification/DlgShowTypification.tsx @@ -0,0 +1,25 @@ +'use client'; + +import Modal, { ModalProps } from '@/components/ui/Modal'; +import { IArgumentInfo } from '@/models/rslang'; + +interface DlgShowTypificationProps extends Pick { + result: string; + args: IArgumentInfo[]; +} + +function DlgShowTypification({ hideWindow, result, args }: DlgShowTypificationProps) { + console.log(result, args); + return ( + +
В разработке...
+
+ ); +} + +export default DlgShowTypification; diff --git a/rsconcept/frontend/src/dialogs/DlgShowTypification/index.tsx b/rsconcept/frontend/src/dialogs/DlgShowTypification/index.tsx new file mode 100644 index 00000000..fcbdb0b9 --- /dev/null +++ b/rsconcept/frontend/src/dialogs/DlgShowTypification/index.tsx @@ -0,0 +1 @@ +export { default } from './DlgShowTypification'; diff --git a/rsconcept/frontend/src/models/TMGraph.ts b/rsconcept/frontend/src/models/TMGraph.ts new file mode 100644 index 00000000..a4347427 --- /dev/null +++ b/rsconcept/frontend/src/models/TMGraph.ts @@ -0,0 +1,7 @@ +/** + * Module: Multi-graph for typifications. + */ + +export class TMGraphNode {} + +export class TMGraph {} diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx index 56b45dc0..bfa0783d 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx @@ -6,6 +6,7 @@ import { useEffect, useLayoutEffect, useMemo, useState } from 'react'; import { toast } from 'react-toastify'; import { IconChild, IconPredecessor, IconSave } from '@/components/Icons'; +import { CProps } from '@/components/props'; import RefsInput from '@/components/RefsInput'; import Indicator from '@/components/ui/Indicator'; import Overlay from '@/components/ui/Overlay'; @@ -13,8 +14,10 @@ import SubmitButton from '@/components/ui/SubmitButton'; import TextArea from '@/components/ui/TextArea'; import AnimateFade from '@/components/wrap/AnimateFade'; import { useRSForm } from '@/context/RSFormContext'; +import DlgShowTypification from '@/dialogs/DlgShowTypification'; import { ConstituentaID, CstType, IConstituenta, ICstUpdateData } from '@/models/rsform'; import { isBaseSet, isBasicConcept, isFunctional } from '@/models/rsformAPI'; +import { ParsingStatus } from '@/models/rslang'; import { information, labelCstTypification } from '@/utils/labels'; import EditorRSExpression from '../EditorRSExpression'; @@ -55,6 +58,7 @@ function FormConstituenta({ const [expression, setExpression] = useState(''); const [convention, setConvention] = useState(''); const [typification, setTypification] = useState('N/A'); + const [showTypification, setShowTypification] = useState(false); const [forceComment, setForceComment] = useState(false); @@ -127,8 +131,26 @@ function FormConstituenta({ cstUpdate(data, () => toast.success(information.changesSaved)); } + function handleTypificationClick(event: CProps.EventMouse) { + if ((!event.ctrlKey && !event.metaKey) || !state || state.parse.status !== ParsingStatus.VERIFIED) { + return; + } + event.stopPropagation(); + event.preventDefault(); + setShowTypification(true); + } + return ( + + {showTypification && state ? ( + setShowTypification(false)} + /> + ) : null} + {state ? ( handleTypificationClick(event)} /> ) : null} {state ? (