M: Improve label visibility
This commit is contained in:
parent
c6e64fddb8
commit
f8f1ba4a62
|
@ -5,13 +5,17 @@ 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 { prefixes } from '@/utils/constants';
|
import { PARAMETER, prefixes } from '@/utils/constants';
|
||||||
|
import { truncateText } 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 = truncateText(node.data.label, PARAMETER.ossTruncateLabel);
|
||||||
|
|
||||||
const handleOpenSchema = () => {
|
const handleOpenSchema = () => {
|
||||||
controller.openOperationSchema(Number(node.id));
|
controller.openOperationSchema(Number(node.id));
|
||||||
|
@ -21,7 +25,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'>
|
<Overlay position='top-0 right-0' className='flex p-[0.1rem]'>
|
||||||
<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
|
||||||
|
@ -41,8 +45,18 @@ function InputNode(node: OssNodeInternal) {
|
||||||
</Overlay>
|
</Overlay>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<div id={`${prefixes.operation_list}${node.id}`} className='flex-grow text-center'>
|
<div id={`${prefixes.operation_list}${node.id}`} className='h-[34px] w-[144px] flex items-center justify-center'>
|
||||||
{node.data.label}
|
<div
|
||||||
|
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,3 +1,5 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
import { Handle, Position } from 'reactflow';
|
import { Handle, Position } from 'reactflow';
|
||||||
|
|
||||||
import { IconConsolidation, IconRSForm } from '@/components/Icons';
|
import { IconConsolidation, IconRSForm } from '@/components/Icons';
|
||||||
|
@ -5,7 +7,8 @@ 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 { prefixes } from '@/utils/constants';
|
import { PARAMETER, prefixes } from '@/utils/constants';
|
||||||
|
import { truncateText } from '@/utils/utils';
|
||||||
|
|
||||||
import { useOssEdit } from '../OssEditContext';
|
import { useOssEdit } from '../OssEditContext';
|
||||||
|
|
||||||
|
@ -13,6 +16,8 @@ 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 = truncateText(node.data.label, PARAMETER.ossTruncateLabel);
|
||||||
|
|
||||||
const handleOpenSchema = () => {
|
const handleOpenSchema = () => {
|
||||||
controller.openOperationSchema(Number(node.id));
|
controller.openOperationSchema(Number(node.id));
|
||||||
|
@ -22,14 +27,9 @@ 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'>
|
<Overlay position='top-0 right-0' className='flex flex-col gap-1 p-[0.1rem]'>
|
||||||
<MiniButton
|
<MiniButton
|
||||||
icon={
|
icon={<IconRSForm className={hasFile ? 'clr-text-green' : 'clr-text-red'} size='0.75rem' />}
|
||||||
<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.6rem' />}
|
icon={<IconConsolidation className='clr-text-primary' size='0.75rem' />}
|
||||||
disabled
|
disabled
|
||||||
noPadding
|
noPadding
|
||||||
noHover
|
noHover
|
||||||
|
@ -55,8 +55,18 @@ function OperationNode(node: OssNodeInternal) {
|
||||||
</Overlay>
|
</Overlay>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<div id={`${prefixes.operation_list}${node.id}`} className='flex-grow text-center'>
|
<div id={`${prefixes.operation_list}${node.id}`} className='h-[34px] w-[144px] flex items-center justify-center'>
|
||||||
{node.data.label}
|
<div
|
||||||
|
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}
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
height: 30px;
|
height: 40px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|
|
@ -25,6 +25,9 @@ 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
|
||||||
|
|
||||||
|
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',
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user