Compare commits
No commits in common. "566c6be91d0fc34ec3450be3bdafe1e37cf14221" and "00934d5716bee22d39448667adad5c82b4f03817" have entirely different histories.
566c6be91d
...
00934d5716
|
@ -557,6 +557,7 @@ class OperationSchema:
|
||||||
if old_data['term_forms'] == cst.term_forms:
|
if old_data['term_forms'] == cst.term_forms:
|
||||||
new_data['term_forms'] = data['term_forms']
|
new_data['term_forms'] = data['term_forms']
|
||||||
if 'convention' in data:
|
if 'convention' in data:
|
||||||
|
if old_data['convention'] == cst.convention:
|
||||||
new_data['convention'] = data['convention']
|
new_data['convention'] = data['convention']
|
||||||
if 'definition_formal' in data:
|
if 'definition_formal' in data:
|
||||||
new_data['definition_formal'] = replace_globals(data['definition_formal'], mapping)
|
new_data['definition_formal'] = replace_globals(data['definition_formal'], mapping)
|
||||||
|
|
|
@ -92,8 +92,7 @@ class TestChangeConstituents(EndpointTester):
|
||||||
'item_data': {
|
'item_data': {
|
||||||
'term_raw': 'Test1',
|
'term_raw': 'Test1',
|
||||||
'definition_formal': r'X4\X4',
|
'definition_formal': r'X4\X4',
|
||||||
'definition_raw': '@{X5|sing,datv}',
|
'definition_raw': '@{X5|sing,datv}'
|
||||||
'convention': 'test'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
response = self.executeOK(data=data, schema=self.ks1.model.pk)
|
response = self.executeOK(data=data, schema=self.ks1.model.pk)
|
||||||
|
@ -103,10 +102,8 @@ class TestChangeConstituents(EndpointTester):
|
||||||
self.assertEqual(self.ks1X1.term_raw, data['item_data']['term_raw'])
|
self.assertEqual(self.ks1X1.term_raw, data['item_data']['term_raw'])
|
||||||
self.assertEqual(self.ks1X1.definition_formal, data['item_data']['definition_formal'])
|
self.assertEqual(self.ks1X1.definition_formal, data['item_data']['definition_formal'])
|
||||||
self.assertEqual(self.ks1X1.definition_raw, data['item_data']['definition_raw'])
|
self.assertEqual(self.ks1X1.definition_raw, data['item_data']['definition_raw'])
|
||||||
self.assertEqual(self.ks1X1.convention, data['item_data']['convention'])
|
|
||||||
self.assertEqual(d2.definition_resolved, data['item_data']['term_raw'])
|
self.assertEqual(d2.definition_resolved, data['item_data']['term_raw'])
|
||||||
self.assertEqual(inherited_cst.term_raw, data['item_data']['term_raw'])
|
self.assertEqual(inherited_cst.term_raw, data['item_data']['term_raw'])
|
||||||
self.assertEqual(inherited_cst.convention, data['item_data']['convention'])
|
|
||||||
self.assertEqual(inherited_cst.definition_formal, r'X1\X1')
|
self.assertEqual(inherited_cst.definition_formal, r'X1\X1')
|
||||||
self.assertEqual(inherited_cst.definition_raw, r'@{X2|sing,datv}')
|
self.assertEqual(inherited_cst.definition_raw, r'@{X2|sing,datv}')
|
||||||
|
|
||||||
|
|
|
@ -241,10 +241,6 @@ class RSForm:
|
||||||
old_data = {}
|
old_data = {}
|
||||||
term_changed = False
|
term_changed = False
|
||||||
if 'convention' in data:
|
if 'convention' in data:
|
||||||
if cst.convention == data['convention']:
|
|
||||||
del data['convention']
|
|
||||||
else:
|
|
||||||
old_data['convention'] = cst.convention
|
|
||||||
cst.convention = data['convention']
|
cst.convention = data['convention']
|
||||||
if 'definition_formal' in data:
|
if 'definition_formal' in data:
|
||||||
if cst.definition_formal == data['definition_formal']:
|
if cst.definition_formal == data['definition_formal']:
|
||||||
|
|
|
@ -23,14 +23,14 @@ function InfoConstituenta({ data, className, ...restProps }: InfoConstituentaPro
|
||||||
{data.term_resolved || data.term_raw}
|
{data.term_resolved || data.term_raw}
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
<p className='break-all'>
|
<p>
|
||||||
<b>Типизация: </b>
|
<b>Типизация: </b>
|
||||||
<span className='font-math'>{labelCstTypification(data)}</span>
|
{labelCstTypification(data)}
|
||||||
</p>
|
</p>
|
||||||
{data.definition_formal ? (
|
{data.definition_formal ? (
|
||||||
<p>
|
<p>
|
||||||
<b>Выражение: </b>
|
<b>Выражение: </b>
|
||||||
<span className='font-math'>{data.definition_formal}</span>
|
{data.definition_formal}
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
{data.definition_resolved ? (
|
{data.definition_resolved ? (
|
||||||
|
|
|
@ -159,7 +159,7 @@ function PickSubstitutions({
|
||||||
id: 'right_alias',
|
id: 'right_alias',
|
||||||
size: 65,
|
size: 65,
|
||||||
cell: props => (
|
cell: props => (
|
||||||
<BadgeConstituenta theme={colors} value={props.row.original.original} prefixID={`${prefixID}_2_`} />
|
<BadgeConstituenta theme={colors} value={props.row.original.original} prefixID={`${prefixID}_1_`} />
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor(item => item.original_source.alias, {
|
columnHelper.accessor(item => item.original_source.alias, {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
|
||||||
import { globals } from '@/utils/constants';
|
import { globals } from '@/utils/constants';
|
||||||
import { truncateToLastWord } from '@/utils/utils';
|
import { truncateText } from '@/utils/utils';
|
||||||
|
|
||||||
import { CProps } from '../props';
|
import { CProps } from '../props';
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ export interface TextContentProps extends CProps.Styling {
|
||||||
}
|
}
|
||||||
|
|
||||||
function TextContent({ className, text, maxLength, ...restProps }: TextContentProps) {
|
function TextContent({ className, text, maxLength, ...restProps }: TextContentProps) {
|
||||||
const truncated = maxLength ? truncateToLastWord(text, maxLength) : text;
|
const truncated = maxLength ? truncateText(text, maxLength) : text;
|
||||||
const isTruncated = maxLength && text.length > maxLength;
|
const isTruncated = maxLength && text.length > maxLength;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -14,6 +14,7 @@ import { useLibrary } from '@/context/LibraryContext';
|
||||||
import { ILibraryItem, LibraryItemID, LibraryItemType } from '@/models/library';
|
import { ILibraryItem, LibraryItemID, LibraryItemType } from '@/models/library';
|
||||||
import { IOperationSchema } from '@/models/oss';
|
import { IOperationSchema } from '@/models/oss';
|
||||||
import { sortItemsForOSS } from '@/models/ossAPI';
|
import { sortItemsForOSS } from '@/models/ossAPI';
|
||||||
|
import { limits, patterns } from '@/utils/constants';
|
||||||
|
|
||||||
interface TabInputOperationProps {
|
interface TabInputOperationProps {
|
||||||
oss: IOperationSchema;
|
oss: IOperationSchema;
|
||||||
|
@ -66,6 +67,8 @@ function TabInputOperation({
|
||||||
id='operation_alias'
|
id='operation_alias'
|
||||||
label='Сокращение'
|
label='Сокращение'
|
||||||
className='w-[14rem]'
|
className='w-[14rem]'
|
||||||
|
pattern={patterns.library_alias}
|
||||||
|
title={`не более ${limits.library_alias_len} символов`}
|
||||||
value={alias}
|
value={alias}
|
||||||
onChange={event => setAlias(event.target.value)}
|
onChange={event => setAlias(event.target.value)}
|
||||||
disabled={attachedID !== undefined}
|
disabled={attachedID !== undefined}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import TextArea from '@/components/ui/TextArea';
|
||||||
import TextInput from '@/components/ui/TextInput';
|
import TextInput from '@/components/ui/TextInput';
|
||||||
import AnimateFade from '@/components/wrap/AnimateFade';
|
import AnimateFade from '@/components/wrap/AnimateFade';
|
||||||
import { IOperationSchema, OperationID } from '@/models/oss';
|
import { IOperationSchema, OperationID } from '@/models/oss';
|
||||||
|
import { limits, patterns } from '@/utils/constants';
|
||||||
|
|
||||||
import PickMultiOperation from '../../components/select/PickMultiOperation';
|
import PickMultiOperation from '../../components/select/PickMultiOperation';
|
||||||
|
|
||||||
|
@ -43,6 +44,8 @@ function TabSynthesisOperation({
|
||||||
id='operation_alias'
|
id='operation_alias'
|
||||||
label='Сокращение'
|
label='Сокращение'
|
||||||
className='w-[14rem]'
|
className='w-[14rem]'
|
||||||
|
pattern={patterns.library_alias}
|
||||||
|
title={`не более ${limits.library_alias_len} символов`}
|
||||||
value={alias}
|
value={alias}
|
||||||
onChange={event => setAlias(event.target.value)}
|
onChange={event => setAlias(event.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -45,7 +45,6 @@ function DlgDeleteOperation({ hideWindow, target, onSubmit }: DlgDeleteOperation
|
||||||
titleHtml='Наследованные конституенты <br/>превратятся в дописанные'
|
titleHtml='Наследованные конституенты <br/>превратятся в дописанные'
|
||||||
value={keepConstituents}
|
value={keepConstituents}
|
||||||
setValue={setKeepConstituents}
|
setValue={setKeepConstituents}
|
||||||
disabled={target.result === null}
|
|
||||||
/>
|
/>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label='Удалить схему'
|
label='Удалить схему'
|
||||||
|
@ -56,7 +55,7 @@ function DlgDeleteOperation({ hideWindow, target, onSubmit }: DlgDeleteOperation
|
||||||
}
|
}
|
||||||
value={deleteSchema}
|
value={deleteSchema}
|
||||||
setValue={setDeleteSchema}
|
setValue={setDeleteSchema}
|
||||||
disabled={!target.is_owned || target.result === null}
|
disabled={!target.is_owned || target.result === undefined}
|
||||||
/>
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|
|
@ -67,8 +67,8 @@ function DlgEditOperation({ hideWindow, oss, target, onSubmit }: DlgEditOperatio
|
||||||
if (cache.loading || schemas.length !== schemasIDs.length) {
|
if (cache.loading || schemas.length !== schemasIDs.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSubstitutions(prev =>
|
setSubstitutions(() =>
|
||||||
prev.filter(sub => {
|
target.substitutions.filter(sub => {
|
||||||
const original = cache.getSchemaByCst(sub.original);
|
const original = cache.getSchemaByCst(sub.original);
|
||||||
if (!original || !schemasIDs.includes(original.id)) {
|
if (!original || !schemasIDs.includes(original.id)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -80,7 +80,7 @@ function DlgEditOperation({ hideWindow, oss, target, onSubmit }: DlgEditOperatio
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}, [schemasIDs, schemas, cache.loading]);
|
}, [schemasIDs, schemas, cache.loading, target.substitutions]);
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
const data: IOperationUpdateData = {
|
const data: IOperationUpdateData = {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import TextArea from '@/components/ui/TextArea';
|
import TextArea from '@/components/ui/TextArea';
|
||||||
import TextInput from '@/components/ui/TextInput';
|
import TextInput from '@/components/ui/TextInput';
|
||||||
import AnimateFade from '@/components/wrap/AnimateFade';
|
import AnimateFade from '@/components/wrap/AnimateFade';
|
||||||
|
import { limits, patterns } from '@/utils/constants';
|
||||||
|
|
||||||
interface TabOperationProps {
|
interface TabOperationProps {
|
||||||
alias: string;
|
alias: string;
|
||||||
|
@ -25,6 +26,8 @@ function TabOperation({ alias, setAlias, title, setTitle, comment, setComment }:
|
||||||
id='operation_alias'
|
id='operation_alias'
|
||||||
label='Сокращение'
|
label='Сокращение'
|
||||||
className='w-[14rem]'
|
className='w-[14rem]'
|
||||||
|
pattern={patterns.library_alias}
|
||||||
|
title={`не более ${limits.library_alias_len} символов`}
|
||||||
value={alias}
|
value={alias}
|
||||||
onChange={event => setAlias(event.target.value)}
|
onChange={event => setAlias(event.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -26,7 +26,7 @@ import useLocalStorage from '@/hooks/useLocalStorage';
|
||||||
import { AccessPolicy, LibraryItemType, LocationHead } from '@/models/library';
|
import { AccessPolicy, LibraryItemType, LocationHead } from '@/models/library';
|
||||||
import { ILibraryCreateData } from '@/models/library';
|
import { ILibraryCreateData } from '@/models/library';
|
||||||
import { combineLocation, validateLocation } from '@/models/libraryAPI';
|
import { combineLocation, validateLocation } from '@/models/libraryAPI';
|
||||||
import { EXTEOR_TRS_FILE, storage } from '@/utils/constants';
|
import { EXTEOR_TRS_FILE, limits, patterns, storage } from '@/utils/constants';
|
||||||
import { information } from '@/utils/labels';
|
import { information } from '@/utils/labels';
|
||||||
|
|
||||||
function FormCreateItem() {
|
function FormCreateItem() {
|
||||||
|
@ -153,6 +153,8 @@ function FormCreateItem() {
|
||||||
label='Сокращение'
|
label='Сокращение'
|
||||||
placeholder={file && 'Загрузить из файла'}
|
placeholder={file && 'Загрузить из файла'}
|
||||||
className='w-[14rem]'
|
className='w-[14rem]'
|
||||||
|
pattern={patterns.library_alias}
|
||||||
|
title={`не более ${limits.library_alias_len} символов`}
|
||||||
value={alias}
|
value={alias}
|
||||||
onChange={event => setAlias(event.target.value)}
|
onChange={event => setAlias(event.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -11,6 +11,7 @@ import TextInput from '@/components/ui/TextInput';
|
||||||
import { useOSS } from '@/context/OssContext';
|
import { useOSS } from '@/context/OssContext';
|
||||||
import { ILibraryUpdateData, LibraryItemType } from '@/models/library';
|
import { ILibraryUpdateData, LibraryItemType } from '@/models/library';
|
||||||
import ToolbarItemAccess from '@/pages/RSFormPage/EditorRSFormCard/ToolbarItemAccess';
|
import ToolbarItemAccess from '@/pages/RSFormPage/EditorRSFormCard/ToolbarItemAccess';
|
||||||
|
import { limits, patterns } from '@/utils/constants';
|
||||||
import { information } from '@/utils/labels';
|
import { information } from '@/utils/labels';
|
||||||
|
|
||||||
import { useOssEdit } from '../OssEditContext';
|
import { useOssEdit } from '../OssEditContext';
|
||||||
|
@ -101,6 +102,8 @@ function FormOSS({ id, isModified, setIsModified }: FormOSSProps) {
|
||||||
required
|
required
|
||||||
label='Сокращение'
|
label='Сокращение'
|
||||||
className='w-[14rem]'
|
className='w-[14rem]'
|
||||||
|
pattern={patterns.library_alias}
|
||||||
|
title={`не более ${limits.library_alias_len} символов`}
|
||||||
disabled={!controller.isMutable}
|
disabled={!controller.isMutable}
|
||||||
value={alias}
|
value={alias}
|
||||||
onChange={event => setAlias(event.target.value)}
|
onChange={event => setAlias(event.target.value)}
|
||||||
|
|
|
@ -5,17 +5,13 @@ import TooltipOperation from '@/components/info/TooltipOperation';
|
||||||
import MiniButton from '@/components/ui/MiniButton.tsx';
|
import MiniButton from '@/components/ui/MiniButton.tsx';
|
||||||
import Overlay from '@/components/ui/Overlay';
|
import Overlay from '@/components/ui/Overlay';
|
||||||
import { OssNodeInternal } from '@/models/miscellaneous';
|
import { OssNodeInternal } from '@/models/miscellaneous';
|
||||||
import { PARAMETER, prefixes } from '@/utils/constants';
|
import { prefixes } from '@/utils/constants';
|
||||||
import { truncateToLastWord } from '@/utils/utils';
|
|
||||||
|
|
||||||
import { useOssEdit } from '../OssEditContext';
|
import { useOssEdit } from '../OssEditContext';
|
||||||
|
|
||||||
function InputNode(node: OssNodeInternal) {
|
function InputNode(node: OssNodeInternal) {
|
||||||
const controller = useOssEdit();
|
const controller = useOssEdit();
|
||||||
|
|
||||||
const hasFile = !!node.data.operation.result;
|
const hasFile = !!node.data.operation.result;
|
||||||
const longLabel = node.data.label.length > PARAMETER.ossLongLabel;
|
|
||||||
const labelText = truncateToLastWord(node.data.label, PARAMETER.ossTruncateLabel);
|
|
||||||
|
|
||||||
const handleOpenSchema = () => {
|
const handleOpenSchema = () => {
|
||||||
controller.openOperationSchema(Number(node.id));
|
controller.openOperationSchema(Number(node.id));
|
||||||
|
@ -25,7 +21,7 @@ function InputNode(node: OssNodeInternal) {
|
||||||
<>
|
<>
|
||||||
<Handle type='source' position={Position.Bottom} />
|
<Handle type='source' position={Position.Bottom} />
|
||||||
|
|
||||||
<Overlay position='top-0 right-0' className='flex p-[0.1rem]'>
|
<Overlay position='top-0 right-0' className='flex'>
|
||||||
<MiniButton
|
<MiniButton
|
||||||
icon={<IconRSForm className={hasFile ? 'clr-text-green' : 'clr-text-red'} size='0.75rem' />}
|
icon={<IconRSForm className={hasFile ? 'clr-text-green' : 'clr-text-red'} size='0.75rem' />}
|
||||||
noHover
|
noHover
|
||||||
|
@ -45,18 +41,8 @@ function InputNode(node: OssNodeInternal) {
|
||||||
</Overlay>
|
</Overlay>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<div id={`${prefixes.operation_list}${node.id}`} className='h-[34px] w-[144px] flex items-center justify-center'>
|
<div id={`${prefixes.operation_list}${node.id}`} className='flex-grow text-center'>
|
||||||
<div
|
{node.data.label}
|
||||||
className='text-center'
|
|
||||||
style={{
|
|
||||||
fontSize: longLabel ? '12px' : '14px',
|
|
||||||
lineHeight: longLabel ? '16px' : '20px',
|
|
||||||
paddingLeft: '4px',
|
|
||||||
paddingRight: longLabel ? '10px' : '4px'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{labelText}
|
|
||||||
</div>
|
|
||||||
{controller.showTooltip && !node.dragging ? (
|
{controller.showTooltip && !node.dragging ? (
|
||||||
<TooltipOperation anchor={`#${prefixes.operation_list}${node.id}`} node={node} />
|
<TooltipOperation anchor={`#${prefixes.operation_list}${node.id}`} node={node} />
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
'use client';
|
|
||||||
|
|
||||||
import { Handle, Position } from 'reactflow';
|
import { Handle, Position } from 'reactflow';
|
||||||
|
|
||||||
import { IconConsolidation, IconRSForm } from '@/components/Icons';
|
import { IconConsolidation, IconRSForm } from '@/components/Icons';
|
||||||
|
@ -7,8 +5,7 @@ import TooltipOperation from '@/components/info/TooltipOperation';
|
||||||
import MiniButton from '@/components/ui/MiniButton.tsx';
|
import MiniButton from '@/components/ui/MiniButton.tsx';
|
||||||
import Overlay from '@/components/ui/Overlay';
|
import Overlay from '@/components/ui/Overlay';
|
||||||
import { OssNodeInternal } from '@/models/miscellaneous';
|
import { OssNodeInternal } from '@/models/miscellaneous';
|
||||||
import { PARAMETER, prefixes } from '@/utils/constants';
|
import { prefixes } from '@/utils/constants';
|
||||||
import { truncateToLastWord } from '@/utils/utils';
|
|
||||||
|
|
||||||
import { useOssEdit } from '../OssEditContext';
|
import { useOssEdit } from '../OssEditContext';
|
||||||
|
|
||||||
|
@ -16,8 +13,6 @@ function OperationNode(node: OssNodeInternal) {
|
||||||
const controller = useOssEdit();
|
const controller = useOssEdit();
|
||||||
|
|
||||||
const hasFile = !!node.data.operation.result;
|
const hasFile = !!node.data.operation.result;
|
||||||
const longLabel = node.data.label.length > PARAMETER.ossLongLabel;
|
|
||||||
const labelText = truncateToLastWord(node.data.label, PARAMETER.ossTruncateLabel);
|
|
||||||
|
|
||||||
const handleOpenSchema = () => {
|
const handleOpenSchema = () => {
|
||||||
controller.openOperationSchema(Number(node.id));
|
controller.openOperationSchema(Number(node.id));
|
||||||
|
@ -27,9 +22,14 @@ function OperationNode(node: OssNodeInternal) {
|
||||||
<>
|
<>
|
||||||
<Handle type='source' position={Position.Bottom} />
|
<Handle type='source' position={Position.Bottom} />
|
||||||
|
|
||||||
<Overlay position='top-0 right-0' className='flex flex-col gap-1 p-[0.1rem]'>
|
<Overlay position='top-0 right-0' className='flex flex-col gap-1'>
|
||||||
<MiniButton
|
<MiniButton
|
||||||
icon={<IconRSForm className={hasFile ? 'clr-text-green' : 'clr-text-red'} size='0.75rem' />}
|
icon={
|
||||||
|
<IconRSForm
|
||||||
|
className={hasFile ? 'clr-text-green' : 'clr-text-red'}
|
||||||
|
size={node.data.operation.is_consolidation ? '0.6rem' : '0.75rem'}
|
||||||
|
/>
|
||||||
|
}
|
||||||
noHover
|
noHover
|
||||||
noPadding
|
noPadding
|
||||||
title={hasFile ? 'Связанная КС' : 'Нет связанной КС'}
|
title={hasFile ? 'Связанная КС' : 'Нет связанной КС'}
|
||||||
|
@ -39,7 +39,7 @@ function OperationNode(node: OssNodeInternal) {
|
||||||
/>
|
/>
|
||||||
{node.data.operation.is_consolidation ? (
|
{node.data.operation.is_consolidation ? (
|
||||||
<MiniButton
|
<MiniButton
|
||||||
icon={<IconConsolidation className='clr-text-primary' size='0.75rem' />}
|
icon={<IconConsolidation className='clr-text-primary' size='0.6rem' />}
|
||||||
disabled
|
disabled
|
||||||
noPadding
|
noPadding
|
||||||
noHover
|
noHover
|
||||||
|
@ -55,18 +55,8 @@ function OperationNode(node: OssNodeInternal) {
|
||||||
</Overlay>
|
</Overlay>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<div id={`${prefixes.operation_list}${node.id}`} className='h-[34px] w-[144px] flex items-center justify-center'>
|
<div id={`${prefixes.operation_list}${node.id}`} className='flex-grow text-center'>
|
||||||
<div
|
{node.data.label}
|
||||||
className='px-1 text-center'
|
|
||||||
style={{
|
|
||||||
fontSize: longLabel ? '12px' : '14px',
|
|
||||||
lineHeight: longLabel ? '16px' : '20px',
|
|
||||||
paddingLeft: '4px',
|
|
||||||
paddingRight: longLabel ? '10px' : '4px'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{labelText}
|
|
||||||
</div>
|
|
||||||
{controller.showTooltip && !node.dragging ? (
|
{controller.showTooltip && !node.dragging ? (
|
||||||
<TooltipOperation anchor={`#${prefixes.operation_list}${node.id}`} node={node} />
|
<TooltipOperation anchor={`#${prefixes.operation_list}${node.id}`} node={node} />
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
@ -335,6 +335,7 @@ function OssFlow({ isModified, setIsModified }: OssFlowProps) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const canvasWidth = useMemo(() => 'calc(100vw - 1rem)', []);
|
||||||
const canvasHeight = useMemo(() => calculateHeight('1.75rem + 4px'), [calculateHeight]);
|
const canvasHeight = useMemo(() => calculateHeight('1.75rem + 4px'), [calculateHeight]);
|
||||||
|
|
||||||
const OssNodeTypes: NodeTypes = useMemo(
|
const OssNodeTypes: NodeTypes = useMemo(
|
||||||
|
@ -357,7 +358,7 @@ function OssFlow({ isModified, setIsModified }: OssFlowProps) {
|
||||||
fitView
|
fitView
|
||||||
nodeTypes={OssNodeTypes}
|
nodeTypes={OssNodeTypes}
|
||||||
maxZoom={2}
|
maxZoom={2}
|
||||||
minZoom={0.5}
|
minZoom={0.75}
|
||||||
nodesConnectable={false}
|
nodesConnectable={false}
|
||||||
snapToGrid={true}
|
snapToGrid={true}
|
||||||
snapGrid={[PARAMETER.ossGridSize, PARAMETER.ossGridSize]}
|
snapGrid={[PARAMETER.ossGridSize, PARAMETER.ossGridSize]}
|
||||||
|
@ -412,7 +413,7 @@ function OssFlow({ isModified, setIsModified }: OssFlowProps) {
|
||||||
{...menuProps}
|
{...menuProps}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<div className='relative w-[100vw]' style={{ height: canvasHeight }}>
|
<div className='relative' style={{ height: canvasHeight, width: canvasWidth }}>
|
||||||
{graph}
|
{graph}
|
||||||
</div>
|
</div>
|
||||||
</AnimateFade>
|
</AnimateFade>
|
||||||
|
|
|
@ -33,8 +33,6 @@ import { UserID, UserLevel } from '@/models/user';
|
||||||
import { PARAMETER } from '@/utils/constants';
|
import { PARAMETER } from '@/utils/constants';
|
||||||
import { errors, information } from '@/utils/labels';
|
import { errors, information } from '@/utils/labels';
|
||||||
|
|
||||||
import { RSTabID } from '../RSFormPage/RSTabs';
|
|
||||||
|
|
||||||
export interface ICreateOperationPrompt {
|
export interface ICreateOperationPrompt {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
|
@ -208,7 +206,7 @@ export const OssEditState = ({ selected, setSelected, children }: OssEditStatePr
|
||||||
if (!node?.result) {
|
if (!node?.result) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
router.push(urls.schema_props({ id: node.result, tab: RSTabID.CST_LIST }));
|
router.push(urls.schema(node.result));
|
||||||
},
|
},
|
||||||
[router, model]
|
[router, model]
|
||||||
);
|
);
|
||||||
|
|
|
@ -220,7 +220,7 @@ function FormConstituenta({
|
||||||
label={isBasic ? 'Конвенция' : 'Комментарий'}
|
label={isBasic ? 'Конвенция' : 'Комментарий'}
|
||||||
placeholder={isBasic ? 'Договоренность об интерпретации' : 'Пояснение разработчика'}
|
placeholder={isBasic ? 'Договоренность об интерпретации' : 'Пояснение разработчика'}
|
||||||
value={convention}
|
value={convention}
|
||||||
disabled={disabled || (isBasic && state?.is_inherited)}
|
disabled={disabled}
|
||||||
rows={convention.length > 2 * ROW_SIZE_IN_CHARACTERS || convention.includes('\n') ? 4 : 2}
|
rows={convention.length > 2 * ROW_SIZE_IN_CHARACTERS || convention.includes('\n') ? 4 : 2}
|
||||||
onChange={event => setConvention(event.target.value)}
|
onChange={event => setConvention(event.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -10,6 +10,7 @@ import SubmitButton from '@/components/ui/SubmitButton';
|
||||||
import TextArea from '@/components/ui/TextArea';
|
import TextArea from '@/components/ui/TextArea';
|
||||||
import TextInput from '@/components/ui/TextInput';
|
import TextInput from '@/components/ui/TextInput';
|
||||||
import { ILibraryUpdateData, LibraryItemType } from '@/models/library';
|
import { ILibraryUpdateData, LibraryItemType } from '@/models/library';
|
||||||
|
import { limits, patterns } from '@/utils/constants';
|
||||||
|
|
||||||
import { useRSEdit } from '../RSEditContext';
|
import { useRSEdit } from '../RSEditContext';
|
||||||
import ToolbarItemAccess from './ToolbarItemAccess';
|
import ToolbarItemAccess from './ToolbarItemAccess';
|
||||||
|
@ -101,6 +102,8 @@ function FormRSForm({ id, isModified, setIsModified }: FormRSFormProps) {
|
||||||
required
|
required
|
||||||
label='Сокращение'
|
label='Сокращение'
|
||||||
className='w-[14rem]'
|
className='w-[14rem]'
|
||||||
|
pattern={patterns.library_alias}
|
||||||
|
title={`не более ${limits.library_alias_len} символов`}
|
||||||
disabled={!controller.isContentEditable}
|
disabled={!controller.isContentEditable}
|
||||||
value={alias}
|
value={alias}
|
||||||
onChange={event => setAlias(event.target.value)}
|
onChange={event => setAlias(event.target.value)}
|
||||||
|
|
|
@ -12,9 +12,8 @@ import TextURL from '@/components/ui/TextURL';
|
||||||
import { useConceptOptions } from '@/context/ConceptOptionsContext';
|
import { useConceptOptions } from '@/context/ConceptOptionsContext';
|
||||||
import useWindowSize from '@/hooks/useWindowSize';
|
import useWindowSize from '@/hooks/useWindowSize';
|
||||||
import { ConstituentaID, IConstituenta } from '@/models/rsform';
|
import { ConstituentaID, IConstituenta } from '@/models/rsform';
|
||||||
import { PARAMETER, prefixes } from '@/utils/constants';
|
import { prefixes } from '@/utils/constants';
|
||||||
import { labelCstTypification } from '@/utils/labels';
|
import { labelCstTypification } from '@/utils/labels';
|
||||||
import { truncateToSymbol } from '@/utils/utils';
|
|
||||||
|
|
||||||
interface TableRSListProps {
|
interface TableRSListProps {
|
||||||
items?: IConstituenta[];
|
items?: IConstituenta[];
|
||||||
|
@ -91,13 +90,8 @@ function TableRSList({
|
||||||
id: 'type',
|
id: 'type',
|
||||||
header: 'Типизация',
|
header: 'Типизация',
|
||||||
enableHiding: true,
|
enableHiding: true,
|
||||||
size: 150,
|
|
||||||
minSize: 150,
|
|
||||||
maxSize: 200,
|
|
||||||
cell: props => (
|
cell: props => (
|
||||||
<div className={clsx('min-w-[9.3rem] max-w-[9.3rem]', 'text-xs break-words')}>
|
<div className={clsx('min-w-[9.3rem] max-w-[9.3rem]', 'text-sm break-words')}>{props.getValue()}</div>
|
||||||
{truncateToSymbol(props.getValue(), PARAMETER.typificationTruncate)}
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor(cst => cst.term_resolved || cst.term_raw || '', {
|
columnHelper.accessor(cst => cst.term_resolved || cst.term_raw || '', {
|
||||||
|
|
|
@ -99,7 +99,8 @@ function TermGraph({
|
||||||
);
|
);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
graphRef.current?.fitNodesInView([], { animated: true });
|
graphRef.current?.resetControls(true);
|
||||||
|
graphRef.current?.centerGraph();
|
||||||
}, [toggleResetView, graphRef]);
|
}, [toggleResetView, graphRef]);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
height: 40px;
|
height: 30px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|
|
@ -25,11 +25,6 @@ export const PARAMETER = {
|
||||||
graphPopupDelay: 500, // milliseconds delay for graph popup selections
|
graphPopupDelay: 500, // milliseconds delay for graph popup selections
|
||||||
graphRefreshDelay: 10, // milliseconds delay for graph viewpoint reset
|
graphRefreshDelay: 10, // milliseconds delay for graph viewpoint reset
|
||||||
|
|
||||||
typificationTruncate: 42, // characters - threshold for long typification - truncate
|
|
||||||
|
|
||||||
ossLongLabel: 14, // characters - threshold for long labels - small font
|
|
||||||
ossTruncateLabel: 28, // characters - threshold for long labels - truncate
|
|
||||||
|
|
||||||
logicLabel: 'LOGIC',
|
logicLabel: 'LOGIC',
|
||||||
exteorVersion: '4.9.3',
|
exteorVersion: '4.9.3',
|
||||||
|
|
||||||
|
@ -40,6 +35,7 @@ export const PARAMETER = {
|
||||||
* Numeric limitations.
|
* Numeric limitations.
|
||||||
*/
|
*/
|
||||||
export const limits = {
|
export const limits = {
|
||||||
|
library_alias_len: 12,
|
||||||
location_len: 500
|
location_len: 500
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,7 +48,8 @@ export const EXTEOR_TRS_FILE = '.trs';
|
||||||
* Regex patterns for data validation.
|
* Regex patterns for data validation.
|
||||||
*/
|
*/
|
||||||
export const patterns = {
|
export const patterns = {
|
||||||
login: '^[a-zA-Z][a-zA-Z0-9_\\-]{1,}[a-zA-Z0-9]$'
|
login: '^[a-zA-Z][a-zA-Z0-9_\\-]{1,}[a-zA-Z0-9]$',
|
||||||
|
library_alias: `.{1,${limits.library_alias_len}}`
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -67,9 +67,9 @@ export function applyPattern(text: string, mapping: Record<string, string>, patt
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Truncate text to last word up to max symbols. Add ellipsis if truncated.
|
* Truncate text to max symbols. Add ellipsis if truncated.
|
||||||
*/
|
*/
|
||||||
export function truncateToLastWord(text: string, maxSymbols: number): string {
|
export function truncateText(text: string, maxSymbols: number): string {
|
||||||
if (text.length <= maxSymbols) {
|
if (text.length <= maxSymbols) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
@ -81,17 +81,6 @@ export function truncateToLastWord(text: string, maxSymbols: number): string {
|
||||||
return trimmedText.slice(0, lastSpaceIndex) + '...';
|
return trimmedText.slice(0, lastSpaceIndex) + '...';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Truncate text to max symbols. Add ellipsis if truncated.
|
|
||||||
*/
|
|
||||||
export function truncateToSymbol(text: string, maxSymbols: number): string {
|
|
||||||
if (text.length <= maxSymbols) {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
const trimmedText = text.slice(0, maxSymbols);
|
|
||||||
return trimmedText + '...';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if Axios response is html.
|
* Check if Axios response is html.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,8 +16,5 @@ export default {
|
||||||
},
|
},
|
||||||
extend: {}
|
extend: {}
|
||||||
},
|
},
|
||||||
plugins: [],
|
plugins: []
|
||||||
experimental: {
|
|
||||||
optimizeUniversalDefaults: true
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,7 +11,7 @@ function BackendCoverage() {
|
||||||
|
|
||||||
$coverageExec = "$backend\venv\Scripts\coverage.exe"
|
$coverageExec = "$backend\venv\Scripts\coverage.exe"
|
||||||
$djangoSrc = "$backend\manage.py"
|
$djangoSrc = "$backend\manage.py"
|
||||||
$exclude = '*/venv/*,*/tests/*,*/migrations/*,*__init__.py,shared/*,manage.py,apps.py,urls.py,settings.py,admin.py'
|
$exclude = '*/venv/*,*/tests/*,*/migrations/*,*__init__.py,manage.py,apps.py,urls.py,settings.py'
|
||||||
|
|
||||||
& $coverageExec run --omit=$exclude $djangoSrc test
|
& $coverageExec run --omit=$exclude $djangoSrc test
|
||||||
& $coverageExec report
|
& $coverageExec report
|
||||||
|
|
Loading…
Reference in New Issue
Block a user