import { Bounds, ComponentType, Group, Polygon, Text } from '../../jsx'; import { Gap, ItemDesc, ItemLabel } from '../components'; import { FlexLayout } from '../layouts'; import { AlignLayout } from '../layouts/Align'; import { getItemProps } from '../utils'; import { registerItem } from './registry'; import type { BaseItemProps } from './types'; export interface SimpleVerticalArrowProps extends BaseItemProps { height?: number; /** 翻转方向 */ flipped?: boolean; } export const SimpleVerticalArrow: ComponentType = ( props, ) => { const [ { indexes, datum, height = 140, themeColors, positionH = 'normal' }, restProps, ] = getItemProps(props, ['height']); const textAlignHorizontal = positionH === 'normal' ? 'right' : 'left'; const label = ( {datum.label} ); const desc = ( {datum.desc} ); const isNormal = positionH !== 'flipped'; const labelGap = 15; const arrowWidth = 30; const textWidth = 120; const totalWidth = textWidth + labelGap + arrowWidth + labelGap + textWidth; return ( {isNormal ? ( <> {label} {desc} ) : ( <> )} {String(indexes[0] + 1) .padStart(2, '0') .slice(-2)} {!isNormal ? ( <> {label} {desc} ) : ( <> )} ); }; const VerticalArrow = ( props: Partial & { fill: string; size?: number }, ) => { const { x = 0, y = 0, width = 30, height = 100, fill = '#FF356A', size = 10, } = props; return ( ); }; registerItem('simple-vertical-arrow', { component: SimpleVerticalArrow, composites: ['label', 'desc'], });