diff --git a/rsconcept/frontend/src/components/Icons.tsx b/rsconcept/frontend/src/components/Icons.tsx
index d70cd122..43f0817a 100644
--- a/rsconcept/frontend/src/components/Icons.tsx
+++ b/rsconcept/frontend/src/components/Icons.tsx
@@ -100,6 +100,7 @@ export { LuSubscript as IconAlias } from 'react-icons/lu';
export { TbMathFunction as IconFormula } from 'react-icons/tb';
export { BiFontFamily as IconText } from 'react-icons/bi';
export { BiFont as IconTextOff } from 'react-icons/bi';
+export { TbCar4Wd as IconTypeGraph } from 'react-icons/tb';
export { RiTreeLine as IconTree } from 'react-icons/ri';
export { FaRegKeyboard as IconControls } from 'react-icons/fa6';
export { RiLockLine as IconImmutable } from 'react-icons/ri';
diff --git a/rsconcept/frontend/src/dialogs/DlgShowTypification/DlgShowTypification.tsx b/rsconcept/frontend/src/dialogs/DlgShowTypeGraph/DlgShowTypeGraph.tsx
similarity index 64%
rename from rsconcept/frontend/src/dialogs/DlgShowTypification/DlgShowTypification.tsx
rename to rsconcept/frontend/src/dialogs/DlgShowTypeGraph/DlgShowTypeGraph.tsx
index 3cc2b59f..39e9add2 100644
--- a/rsconcept/frontend/src/dialogs/DlgShowTypification/DlgShowTypification.tsx
+++ b/rsconcept/frontend/src/dialogs/DlgShowTypeGraph/DlgShowTypeGraph.tsx
@@ -6,24 +6,22 @@ import { ReactFlowProvider } from 'reactflow';
import Modal, { ModalProps } from '@/components/ui/Modal';
import { HelpTopic } from '@/models/miscellaneous';
-import { IArgumentInfo } from '@/models/rslang';
+import { ITypeInfo } from '@/models/rslang';
import { TMGraph } from '@/models/TMGraph';
import { errors } from '@/utils/labels';
import MGraphFlow from './MGraphFlow';
-interface DlgShowTypificationProps extends Pick {
- alias: string;
- resultTypification: string;
- args: IArgumentInfo[];
+interface DlgShowTypeGraphProps extends Pick {
+ items: ITypeInfo[];
}
-function DlgShowTypification({ hideWindow, alias, resultTypification, args }: DlgShowTypificationProps) {
+function DlgShowTypeGraph({ hideWindow, items }: DlgShowTypeGraphProps) {
const graph = useMemo(() => {
const result = new TMGraph();
- result.addConstituenta(alias, resultTypification, args);
+ items.forEach(item => result.addConstituenta(item.alias, item.result, item.args));
return result;
- }, [alias, resultTypification, args]);
+ }, [items]);
if (graph.nodes.length === 0) {
toast.error(errors.typeStructureFailed);
@@ -33,7 +31,7 @@ function DlgShowTypification({ hideWindow, alias, resultTypification, args }: Dl
return (
+ (node.data.annotations.length === 0 ? '' : `Конституенты: ${node.data.annotations.join(' ')}
`) +
+ node.data.text,
+ [node.data]
+ );
+
return (
<>
- {node.data.rank === 0 ? node.data.text : ''}
+ {node.data.rank === 0 ? node.data.text : node.data.annotations.length > 0 ? node.data.annotations.length : ''}
>
diff --git a/rsconcept/frontend/src/dialogs/DlgShowTypification/graph/MGraphNodeTypes.ts b/rsconcept/frontend/src/dialogs/DlgShowTypeGraph/graph/MGraphNodeTypes.ts
similarity index 100%
rename from rsconcept/frontend/src/dialogs/DlgShowTypification/graph/MGraphNodeTypes.ts
rename to rsconcept/frontend/src/dialogs/DlgShowTypeGraph/graph/MGraphNodeTypes.ts
diff --git a/rsconcept/frontend/src/dialogs/DlgShowTypeGraph/index.tsx b/rsconcept/frontend/src/dialogs/DlgShowTypeGraph/index.tsx
new file mode 100644
index 00000000..a7456561
--- /dev/null
+++ b/rsconcept/frontend/src/dialogs/DlgShowTypeGraph/index.tsx
@@ -0,0 +1 @@
+export { default } from './DlgShowTypeGraph';
diff --git a/rsconcept/frontend/src/dialogs/DlgShowTypification/index.tsx b/rsconcept/frontend/src/dialogs/DlgShowTypification/index.tsx
deleted file mode 100644
index fcbdb0b9..00000000
--- a/rsconcept/frontend/src/dialogs/DlgShowTypification/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from './DlgShowTypification';
diff --git a/rsconcept/frontend/src/models/rslang.ts b/rsconcept/frontend/src/models/rslang.ts
index f9498850..8081fcb4 100644
--- a/rsconcept/frontend/src/models/rslang.ts
+++ b/rsconcept/frontend/src/models/rslang.ts
@@ -72,6 +72,13 @@ export interface IArgumentInfo {
typification: string;
}
+/** Represents global identifier type info. */
+export interface ITypeInfo {
+ alias: string;
+ result: string;
+ args: IArgumentInfo[];
+}
+
/**
* Represents function argument value.
*/
diff --git a/rsconcept/frontend/src/pages/ManualsPage/items/ui/HelpRSGraphTerm.tsx b/rsconcept/frontend/src/pages/ManualsPage/items/ui/HelpRSGraphTerm.tsx
index c3570b1b..01354e5f 100644
--- a/rsconcept/frontend/src/pages/ManualsPage/items/ui/HelpRSGraphTerm.tsx
+++ b/rsconcept/frontend/src/pages/ManualsPage/items/ui/HelpRSGraphTerm.tsx
@@ -15,7 +15,8 @@ import {
IconOSS,
IconReset,
IconRotate3D,
- IconText
+ IconText,
+ IconTypeGraph
} from '@/components/Icons';
import Divider from '@/components/ui/Divider';
import LinkTopic from '@/components/ui/LinkTopic';
@@ -81,6 +82,10 @@ function HelpRSGraphTerm() {
Вписать в экран
+
+ Открыть{' '}
+
+
Сохранить в формат PNG
diff --git a/rsconcept/frontend/src/pages/ManualsPage/items/ui/HelpTypeGraph.tsx b/rsconcept/frontend/src/pages/ManualsPage/items/ui/HelpTypeGraph.tsx
index 461cf4b4..6525d482 100644
--- a/rsconcept/frontend/src/pages/ManualsPage/items/ui/HelpTypeGraph.tsx
+++ b/rsconcept/frontend/src/pages/ManualsPage/items/ui/HelpTypeGraph.tsx
@@ -13,7 +13,8 @@ function HelpTypeGraph() {
Портале кратные ребра представлены перечислением индексов компонент произведения.
ребра без надписей означают взятие булеана
- цифры означают номера компонент декартова произведения
+ цифры на ребрах означают номера компонент декартова произведения
+ цифры на узлах означают количество конституент в данной ступени
основаниями дерева являются ступени базисных, константных множеств
ступень терм-функции - произведение ступеней результата и аргументов
ступень предикат-функции - произведение ступеней аргументов
diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx
index e40058aa..814d5df4 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx
@@ -14,7 +14,7 @@ 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 DlgShowTypeGraph from '@/dialogs/DlgShowTypeGraph';
import { ConstituentaID, CstType, IConstituenta, ICstUpdateData } from '@/models/rsform';
import { isBaseSet, isBasicConcept, isFunctional } from '@/models/rsformAPI';
import { IExpressionParse, ParsingStatus } from '@/models/rslang';
@@ -60,6 +60,17 @@ function FormConstituenta({
const [typification, setTypification] = useState('N/A');
const [showTypification, setShowTypification] = useState(false);
const [localParse, setLocalParse] = useState(undefined);
+ const typeInfo = useMemo(
+ () =>
+ state
+ ? {
+ alias: state.alias,
+ result: localParse ? localParse.typification : state.parse.typification,
+ args: localParse ? localParse.args : state.parse.args
+ }
+ : undefined,
+ [state, localParse]
+ );
const [forceComment, setForceComment] = useState(false);
@@ -147,12 +158,7 @@ function FormConstituenta({
{showTypification && state ? (
- setShowTypification(false)}
- />
+ setShowTypification(false)} />
) : null}
{state ? (
diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ToolbarTermGraph.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ToolbarTermGraph.tsx
index 4fa963d8..1e99ad57 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ToolbarTermGraph.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ToolbarTermGraph.tsx
@@ -10,7 +10,8 @@ import {
IconNewItem,
IconRotate3D,
IconText,
- IconTextOff
+ IconTextOff,
+ IconTypeGraph
} from '@/components/Icons';
import BadgeHelp from '@/components/info/BadgeHelp';
import MiniSelectorOSS from '@/components/select/MiniSelectorOSS';
@@ -116,6 +117,11 @@ function ToolbarTermGraph({
onClick={onDelete}
/>
) : null}
+ }
+ title='Граф ступеней'
+ onClick={() => controller.showTypeGraph()}
+ />
}
title='Сохранить изображение'
diff --git a/rsconcept/frontend/src/pages/RSFormPage/RSEditContext.tsx b/rsconcept/frontend/src/pages/RSFormPage/RSEditContext.tsx
index f0c2850b..4181ac69 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/RSEditContext.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/RSEditContext.tsx
@@ -22,6 +22,7 @@ import DlgEditVersions from '@/dialogs/DlgEditVersions';
import DlgEditWordForms from '@/dialogs/DlgEditWordForms';
import DlgInlineSynthesis from '@/dialogs/DlgInlineSynthesis';
import DlgRenameCst from '@/dialogs/DlgRenameCst';
+import DlgShowTypeGraph from '@/dialogs/DlgShowTypeGraph';
import DlgSubstituteCst from '@/dialogs/DlgSubstituteCst';
import DlgUploadRSForm from '@/dialogs/DlgUploadRSForm';
import {
@@ -106,6 +107,8 @@ export interface IRSEditContext extends ILibraryItemEditor {
produceStructure: () => void;
inlineSynthesis: () => void;
substitute: () => void;
+
+ showTypeGraph: () => void;
}
const RSEditContext = createContext(null);
@@ -169,6 +172,7 @@ export const RSEditState = ({
const [showCreateVersion, setShowCreateVersion] = useState(false);
const [showEditVersions, setShowEditVersions] = useState(false);
const [showInlineSynthesis, setShowInlineSynthesis] = useState(false);
+ const [showTypeGraph, setShowTypeGraph] = useState(false);
const [createInitialData, setCreateInitialData] = useState();
const [showCreateCst, setShowCreateCst] = useState(false);
@@ -179,6 +183,18 @@ export const RSEditState = ({
const [insertCstID, setInsertCstID] = useState(undefined);
const [showTemplates, setShowTemplates] = useState(false);
+ const typeInfo = useMemo(
+ () =>
+ model.schema
+ ? model.schema.items.map(item => ({
+ alias: item.alias,
+ result: item.parse.typification,
+ args: item.parse.args
+ }))
+ : [],
+ [model.schema]
+ );
+
useLayoutEffect(
() =>
setAccessLevel(prev => {
@@ -662,7 +678,9 @@ export const RSEditState = ({
reorder,
inlineSynthesis,
produceStructure,
- substitute
+ substitute,
+
+ showTypeGraph: () => setShowTypeGraph(true)
}}
>
{model.schema ? (
@@ -762,6 +780,8 @@ export const RSEditState = ({
onInlineSynthesis={handleInlineSynthesis}
/>
) : null}
+
+ {showTypeGraph ? setShowTypeGraph(false)} /> : null}
) : null}