mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
R: Use line-clamp for line limitation
This commit is contained in:
parent
13cf86f7b5
commit
664fdb585c
|
@ -5,7 +5,6 @@ import { IconConsolidation, IconRSForm } from '@/components/Icons';
|
||||||
import { Indicator } from '@/components/View';
|
import { Indicator } from '@/components/View';
|
||||||
import { useTooltipsStore } from '@/stores/tooltips';
|
import { useTooltipsStore } from '@/stores/tooltips';
|
||||||
import { globalIDs, PARAMETER } from '@/utils/constants';
|
import { globalIDs, PARAMETER } from '@/utils/constants';
|
||||||
import { truncateToLastWord } from '@/utils/utils';
|
|
||||||
|
|
||||||
import { OperationType } from '../../../../backend/types';
|
import { OperationType } from '../../../../backend/types';
|
||||||
import { type OssNodeInternal } from '../../../../models/ossLayout';
|
import { type OssNodeInternal } from '../../../../models/ossLayout';
|
||||||
|
@ -19,7 +18,6 @@ export function NodeCore({ node }: NodeCoreProps) {
|
||||||
|
|
||||||
const hasFile = !!node.data.operation.result;
|
const hasFile = !!node.data.operation.result;
|
||||||
const longLabel = node.data.label.length > PARAMETER.ossLongLabel;
|
const longLabel = node.data.label.length > PARAMETER.ossLongLabel;
|
||||||
const labelText = truncateToLastWord(node.data.label, PARAMETER.ossTruncateLabel);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -56,7 +54,7 @@ export function NodeCore({ node }: NodeCoreProps) {
|
||||||
onMouseEnter={() => setHover(node.data.operation)}
|
onMouseEnter={() => setHover(node.data.operation)}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className='text-center'
|
className='text-center line-clamp-2'
|
||||||
style={{
|
style={{
|
||||||
fontSize: longLabel ? '12px' : '14px',
|
fontSize: longLabel ? '12px' : '14px',
|
||||||
lineHeight: longLabel ? '16px' : '20px',
|
lineHeight: longLabel ? '16px' : '20px',
|
||||||
|
@ -64,7 +62,7 @@ export function NodeCore({ node }: NodeCoreProps) {
|
||||||
paddingRight: longLabel ? '10px' : '4px'
|
paddingRight: longLabel ? '10px' : '4px'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{labelText}
|
{node.data.label}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { TextURL } from '@/components/Control';
|
||||||
import { createColumnHelper, DataTable, type RowSelectionState, type VisibilityState } from '@/components/DataTable';
|
import { createColumnHelper, DataTable, type RowSelectionState, type VisibilityState } from '@/components/DataTable';
|
||||||
import { NoData, TextContent } from '@/components/View';
|
import { NoData, TextContent } from '@/components/View';
|
||||||
import { useWindowSize } from '@/hooks/useWindowSize';
|
import { useWindowSize } from '@/hooks/useWindowSize';
|
||||||
import { PARAMETER, prefixes } from '@/utils/constants';
|
import { prefixes } from '@/utils/constants';
|
||||||
import { truncateToSymbol } from '@/utils/utils';
|
import { truncateToSymbol } from '@/utils/utils';
|
||||||
|
|
||||||
import { BadgeConstituenta } from '../../../components/BadgeConstituenta';
|
import { BadgeConstituenta } from '../../../components/BadgeConstituenta';
|
||||||
|
@ -33,6 +33,9 @@ const COLUMN_CONVENTION_HIDE_THRESHOLD = 1800;
|
||||||
const COMMENT_MAX_SYMBOLS = 100;
|
const COMMENT_MAX_SYMBOLS = 100;
|
||||||
const DEFINITION_MAX_SYMBOLS = 120;
|
const DEFINITION_MAX_SYMBOLS = 120;
|
||||||
|
|
||||||
|
// characters - threshold for long typification - truncate
|
||||||
|
const TYPIFICATION_TRUNCATE = 42;
|
||||||
|
|
||||||
const columnHelper = createColumnHelper<IConstituenta>();
|
const columnHelper = createColumnHelper<IConstituenta>();
|
||||||
|
|
||||||
export function TableRSList({
|
export function TableRSList({
|
||||||
|
@ -86,7 +89,7 @@ export function TableRSList({
|
||||||
maxSize: 200,
|
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-xs break-words')}>
|
||||||
{truncateToSymbol(props.getValue(), PARAMETER.typificationTruncate)}
|
{truncateToSymbol(props.getValue(), TYPIFICATION_TRUNCATE)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
import { Handle, Position } from 'reactflow';
|
import { Handle, Position } from 'reactflow';
|
||||||
|
|
||||||
import { APP_COLORS } from '@/styling/colors';
|
import { APP_COLORS } from '@/styling/colors';
|
||||||
import { truncateToLastWord } from '@/utils/utils';
|
|
||||||
|
|
||||||
const MAX_DESCRIPTION_LENGTH = 65;
|
|
||||||
const DESCRIPTION_THRESHOLD = 15;
|
const DESCRIPTION_THRESHOLD = 15;
|
||||||
const LABEL_THRESHOLD = 3;
|
const LABEL_THRESHOLD = 3;
|
||||||
|
|
||||||
|
@ -32,8 +30,6 @@ interface TGNodeInternal {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TGNode(node: TGNodeInternal) {
|
export function TGNode(node: TGNodeInternal) {
|
||||||
const description = truncateToLastWord(node.data.description, MAX_DESCRIPTION_LENGTH);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Handle type='target' position={Position.Top} style={{ opacity: 0 }} />
|
<Handle type='target' position={Position.Top} style={{ opacity: 0 }} />
|
||||||
|
@ -55,22 +51,25 @@ export function TGNode(node: TGNodeInternal) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Handle type='source' position={Position.Bottom} style={{ opacity: 0 }} />
|
<Handle type='source' position={Position.Bottom} style={{ opacity: 0 }} />
|
||||||
{description ? (
|
{node.data.description ? (
|
||||||
<div
|
<div
|
||||||
className='mt-1 w-[150px] px-1 text-center translate-x-[calc(-50%+20px)]'
|
className='mt-1 w-[150px] px-1 text-center translate-x-[calc(-50%+20px)]'
|
||||||
style={{
|
style={{
|
||||||
fontSize: description.length > DESCRIPTION_THRESHOLD ? FONT_SIZE_MIN : FONT_SIZE_MED
|
fontSize: node.data.description.length > DESCRIPTION_THRESHOLD ? FONT_SIZE_MIN : FONT_SIZE_MED
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className='absolute top-0 px-1 left-0 text-center w-full'>{description}</div>
|
<div className='absolute top-0 px-1 left-0 text-center w-full line-clamp-3 hover:line-clamp-none'>
|
||||||
|
{node.data.description}
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
aria-hidden='true'
|
aria-hidden='true'
|
||||||
|
className='line-clamp-3 hover:line-clamp-none'
|
||||||
style={{
|
style={{
|
||||||
WebkitTextStrokeWidth: '3px',
|
WebkitTextStrokeWidth: '3px',
|
||||||
WebkitTextStrokeColor: APP_COLORS.bgDefault
|
WebkitTextStrokeColor: APP_COLORS.bgDefault
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{description}
|
{node.data.description}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
@ -36,9 +36,7 @@ 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
|
ossLongLabel: 14, // characters - threshold for long labels - small font
|
||||||
ossTruncateLabel: 32, // characters - threshold for long labels - truncate
|
|
||||||
statSmallThreshold: 3, // characters - threshold for small labels - small font
|
statSmallThreshold: 3, // characters - threshold for small labels - small font
|
||||||
|
|
||||||
logicLabel: 'LOGIC',
|
logicLabel: 'LOGIC',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user