2024-04-01 11:13:50 +03:00
|
|
|
|
import clsx from 'clsx';
|
|
|
|
|
|
2025-01-28 23:23:42 +03:00
|
|
|
|
import { IconChild } from '@/components/Icons';
|
2025-02-21 21:15:05 +03:00
|
|
|
|
import { type Div } from '@/components/props';
|
2023-08-15 21:43:15 +03:00
|
|
|
|
|
2025-02-11 20:56:24 +03:00
|
|
|
|
import { labelCstTypification } from '../labels';
|
2025-02-21 21:15:05 +03:00
|
|
|
|
import { type IConstituenta } from '../models/rsform';
|
2025-02-10 01:32:55 +03:00
|
|
|
|
import { isBasicConcept } from '../models/rsformAPI';
|
|
|
|
|
|
2025-02-21 21:15:05 +03:00
|
|
|
|
interface InfoConstituentaProps extends Div {
|
2023-12-28 14:04:44 +03:00
|
|
|
|
data: IConstituenta;
|
2023-08-15 21:43:15 +03:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-19 23:30:35 +03:00
|
|
|
|
export function InfoConstituenta({ data, className, ...restProps }: InfoConstituentaProps) {
|
2023-08-15 21:43:15 +03:00
|
|
|
|
return (
|
2024-08-30 20:18:21 +03:00
|
|
|
|
<div className={clsx('dense min-w-[15rem] break-words', className)} {...restProps}>
|
2024-10-17 15:45:23 +03:00
|
|
|
|
<h2 className='cursor-default' title={data.is_inherited ? ' наследник' : undefined}>
|
2024-08-03 11:31:13 +03:00
|
|
|
|
{data.alias}
|
2024-10-17 15:45:23 +03:00
|
|
|
|
{data.is_inherited ? (
|
|
|
|
|
<IconChild size='1rem' className='inline-icon translate-y-[-0.1rem] translate-x-[0.125rem]' />
|
|
|
|
|
) : null}
|
2024-08-01 00:36:06 +03:00
|
|
|
|
</h2>
|
2024-04-06 23:09:25 +03:00
|
|
|
|
{data.term_resolved ? (
|
|
|
|
|
<p>
|
|
|
|
|
<b>Термин: </b>
|
|
|
|
|
{data.term_resolved || data.term_raw}
|
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
2024-08-19 10:56:24 +03:00
|
|
|
|
<p className='break-all'>
|
2024-04-06 22:36:37 +03:00
|
|
|
|
<b>Типизация: </b>
|
2024-08-19 19:16:29 +03:00
|
|
|
|
<span className='font-math'>{labelCstTypification(data)}</span>
|
2024-04-06 22:36:37 +03:00
|
|
|
|
</p>
|
2023-12-28 14:04:44 +03:00
|
|
|
|
{data.definition_formal ? (
|
2024-08-30 20:18:21 +03:00
|
|
|
|
<p className='break-all'>
|
2023-12-28 14:04:44 +03:00
|
|
|
|
<b>Выражение: </b>
|
2024-08-19 19:16:29 +03:00
|
|
|
|
<span className='font-math'>{data.definition_formal}</span>
|
2023-12-28 14:04:44 +03:00
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
|
|
|
|
{data.definition_resolved ? (
|
|
|
|
|
<p>
|
|
|
|
|
<b>Определение: </b>
|
|
|
|
|
{data.definition_resolved}
|
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
2024-09-14 15:15:36 +03:00
|
|
|
|
{data.spawner_alias ? (
|
2024-04-06 22:36:37 +03:00
|
|
|
|
<p>
|
|
|
|
|
<b>Основание: </b>
|
2024-09-14 15:15:36 +03:00
|
|
|
|
{data.spawner_alias}
|
2024-04-06 22:36:37 +03:00
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
2024-09-14 15:15:36 +03:00
|
|
|
|
{data.spawn_alias.length > 0 ? (
|
2024-04-06 22:36:37 +03:00
|
|
|
|
<p>
|
|
|
|
|
<b>Порождает: </b>
|
2024-09-14 15:15:36 +03:00
|
|
|
|
{data.spawn_alias.join(', ')}
|
2024-04-06 22:36:37 +03:00
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
2023-12-28 14:04:44 +03:00
|
|
|
|
{data.convention ? (
|
|
|
|
|
<p>
|
2024-04-06 22:36:37 +03:00
|
|
|
|
<b>{isBasicConcept(data.cst_type) ? 'Конвенция' : 'Комментарий'}: </b>
|
2023-12-28 14:04:44 +03:00
|
|
|
|
{data.convention}
|
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2023-08-15 21:43:15 +03:00
|
|
|
|
}
|