mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
Add function to select concept kernel
This commit is contained in:
parent
6e8801628d
commit
5c52e2a6f8
|
@ -33,6 +33,7 @@ export { BiExpand as IconGraphExpand } from 'react-icons/bi';
|
||||||
export { LuMaximize as IconGraphMaximize } from 'react-icons/lu';
|
export { LuMaximize as IconGraphMaximize } from 'react-icons/lu';
|
||||||
export { BiGitBranch as IconGraphInputs } from 'react-icons/bi';
|
export { BiGitBranch as IconGraphInputs } from 'react-icons/bi';
|
||||||
export { BiGitMerge as IconGraphOutputs } 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 { BiCheckShield as IconImmutable } from 'react-icons/bi';
|
||||||
export { RiOpenSourceLine as IconPublic } from 'react-icons/ri';
|
export { RiOpenSourceLine as IconPublic } from 'react-icons/ri';
|
||||||
|
|
|
@ -14,10 +14,12 @@ function InfoConstituenta({ data, className, ...restProps }: InfoConstituentaPro
|
||||||
return (
|
return (
|
||||||
<div className={clsx('dense min-w-[15rem]', className)} {...restProps}>
|
<div className={clsx('dense min-w-[15rem]', className)} {...restProps}>
|
||||||
<h2>Конституента {data.alias}</h2>
|
<h2>Конституента {data.alias}</h2>
|
||||||
<p>
|
{data.term_resolved ? (
|
||||||
<b>Термин: </b>
|
<p>
|
||||||
{data.term_resolved || data.term_raw}
|
<b>Термин: </b>
|
||||||
</p>
|
{data.term_resolved || data.term_raw}
|
||||||
|
</p>
|
||||||
|
) : null}
|
||||||
<p>
|
<p>
|
||||||
<b>Типизация: </b>
|
<b>Типизация: </b>
|
||||||
{labelCstTypification(data)}
|
{labelCstTypification(data)}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { useLayoutEffect, useMemo, useState } from 'react';
|
||||||
import DataTable, { createColumnHelper, RowSelectionState } from '@/components/ui/DataTable';
|
import DataTable, { createColumnHelper, RowSelectionState } from '@/components/ui/DataTable';
|
||||||
import { useConceptOptions } from '@/context/OptionsContext';
|
import { useConceptOptions } from '@/context/OptionsContext';
|
||||||
import { ConstituentaID, IConstituenta, IRSForm } from '@/models/rsform';
|
import { ConstituentaID, IConstituenta, IRSForm } from '@/models/rsform';
|
||||||
|
import { isBasicConcept } from '@/models/rsformAPI';
|
||||||
import { describeConstituenta } from '@/utils/labels';
|
import { describeConstituenta } from '@/utils/labels';
|
||||||
|
|
||||||
import ConstituentaBadge from '../info/ConstituentaBadge';
|
import ConstituentaBadge from '../info/ConstituentaBadge';
|
||||||
|
@ -80,7 +81,8 @@ function ConstituentaMultiPicker({ id, schema, prefixID, rows, selected, setSele
|
||||||
</span>
|
</span>
|
||||||
{schema ? (
|
{schema ? (
|
||||||
<SelectGraphToolbar
|
<SelectGraphToolbar
|
||||||
graph={schema.graph} // prettier: split lines
|
graph={schema.graph}
|
||||||
|
core={schema.items.filter(cst => isBasicConcept(cst.cst_type)).map(cst => cst.id)}
|
||||||
setSelected={setSelected}
|
setSelected={setSelected}
|
||||||
className='w-full ml-8'
|
className='w-full ml-8'
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { Graph } from '@/models/Graph';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IconGraphCollapse,
|
IconGraphCollapse,
|
||||||
|
IconGraphCore,
|
||||||
IconGraphExpand,
|
IconGraphExpand,
|
||||||
IconGraphInputs,
|
IconGraphInputs,
|
||||||
IconGraphMaximize,
|
IconGraphMaximize,
|
||||||
|
@ -15,10 +16,11 @@ import MiniButton from '../ui/MiniButton';
|
||||||
|
|
||||||
interface SelectGraphToolbarProps extends CProps.Styling {
|
interface SelectGraphToolbarProps extends CProps.Styling {
|
||||||
graph: Graph;
|
graph: Graph;
|
||||||
|
core: number[];
|
||||||
setSelected: React.Dispatch<React.SetStateAction<number[]>>;
|
setSelected: React.Dispatch<React.SetStateAction<number[]>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectGraphToolbar({ className, graph, setSelected, ...restProps }: SelectGraphToolbarProps) {
|
function SelectGraphToolbar({ className, graph, core, setSelected, ...restProps }: SelectGraphToolbarProps) {
|
||||||
return (
|
return (
|
||||||
<div className={clsx('cc-icons', className)} {...restProps}>
|
<div className={clsx('cc-icons', className)} {...restProps}>
|
||||||
<MiniButton
|
<MiniButton
|
||||||
|
@ -51,6 +53,11 @@ function SelectGraphToolbar({ className, graph, setSelected, ...restProps }: Sel
|
||||||
icon={<IconGraphOutputs size='1.25rem' className='icon-primary' />}
|
icon={<IconGraphOutputs size='1.25rem' className='icon-primary' />}
|
||||||
onClick={() => setSelected(prev => [...prev, ...graph.expandOutputs(prev)])}
|
onClick={() => setSelected(prev => [...prev, ...graph.expandOutputs(prev)])}
|
||||||
/>
|
/>
|
||||||
|
<MiniButton
|
||||||
|
titleHtml='Выделить ядро'
|
||||||
|
icon={<IconGraphCore size='1.25rem' className='icon-primary' />}
|
||||||
|
onClick={() => setSelected([...core, ...graph.expandInputs(core)])}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import SelectGraphToolbar from '@/components/select/SelectGraphToolbar';
|
||||||
import MiniButton from '@/components/ui/MiniButton';
|
import MiniButton from '@/components/ui/MiniButton';
|
||||||
import Overlay from '@/components/ui/Overlay';
|
import Overlay from '@/components/ui/Overlay';
|
||||||
import { HelpTopic } from '@/models/miscellaneous';
|
import { HelpTopic } from '@/models/miscellaneous';
|
||||||
|
import { isBasicConcept } from '@/models/rsformAPI';
|
||||||
|
|
||||||
import { useRSEdit } from '../RSEditContext';
|
import { useRSEdit } from '../RSEditContext';
|
||||||
|
|
||||||
|
@ -62,6 +63,11 @@ function GraphToolbar({
|
||||||
icon={<IconFilter size='1.25rem' className='icon-primary' />}
|
icon={<IconFilter size='1.25rem' className='icon-primary' />}
|
||||||
onClick={showParamsDialog}
|
onClick={showParamsDialog}
|
||||||
/>
|
/>
|
||||||
|
<MiniButton
|
||||||
|
icon={<IconFitImage size='1.25rem' className='icon-primary' />}
|
||||||
|
title='Граф целиком'
|
||||||
|
onClick={onResetViewpoint}
|
||||||
|
/>
|
||||||
<MiniButton
|
<MiniButton
|
||||||
title={!noText ? 'Скрыть текст' : 'Отобразить текст'}
|
title={!noText ? 'Скрыть текст' : 'Отобразить текст'}
|
||||||
icon={
|
icon={
|
||||||
|
@ -84,11 +90,6 @@ function GraphToolbar({
|
||||||
}
|
}
|
||||||
onClick={toggleFoldDerived}
|
onClick={toggleFoldDerived}
|
||||||
/>
|
/>
|
||||||
<MiniButton
|
|
||||||
icon={<IconFitImage size='1.25rem' className='icon-primary' />}
|
|
||||||
title='Граф целиком'
|
|
||||||
onClick={onResetViewpoint}
|
|
||||||
/>
|
|
||||||
<MiniButton
|
<MiniButton
|
||||||
icon={<IconRotate3D size='1.25rem' className={orbit ? 'icon-green' : 'icon-primary'} />}
|
icon={<IconRotate3D size='1.25rem' className={orbit ? 'icon-green' : 'icon-primary'} />}
|
||||||
title='Анимация вращения'
|
title='Анимация вращения'
|
||||||
|
@ -113,7 +114,11 @@ function GraphToolbar({
|
||||||
) : null}
|
) : null}
|
||||||
<BadgeHelp topic={HelpTopic.GRAPH_TERM} className='max-w-[calc(100vw-4rem)]' offset={4} />
|
<BadgeHelp topic={HelpTopic.GRAPH_TERM} className='max-w-[calc(100vw-4rem)]' offset={4} />
|
||||||
</div>
|
</div>
|
||||||
<SelectGraphToolbar graph={controller.schema!.graph} setSelected={controller.setSelected} />
|
<SelectGraphToolbar
|
||||||
|
graph={controller.schema!.graph}
|
||||||
|
core={controller.schema!.items.filter(cst => isBasicConcept(cst.cst_type)).map(cst => cst.id)}
|
||||||
|
setSelected={controller.setSelected}
|
||||||
|
/>
|
||||||
</Overlay>
|
</Overlay>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user