import { Bounds, ComponentType, Ellipse, getElementBounds, Group, Path, Polygon, Text, } from '../../jsx'; import { Gap, ItemDesc, ItemIconCircle, 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 VerticalIconArrowProps extends BaseItemProps { height?: number; /** 翻转方向 */ flipped?: boolean; } export const VerticalIconArrow: ComponentType = ( props, ) => { const [ { indexes, datum, height = 140, themeColors, positionH = 'normal' }, restProps, ] = getItemProps(props, ['height']); const isHNormal = positionH !== 'flipped'; const textAlignHorizontal = isHNormal ? 'right' : 'left'; const label = ( {datum.label} ); const desc = ( {datum.desc} ); const icon = ( ); const dotLine = ( ); const isNormal = positionH !== 'flipped'; const dotLineGap = 5; const iconGap = 25; const arrowWidth = 30; const labelBounds = getElementBounds(label); const iconBounds = getElementBounds(icon); const dotLineBounds = getElementBounds(dotLine); const fixedGap = labelBounds.width + dotLineGap + dotLineBounds.width - iconBounds.width - iconGap; const totalWidth = Math.max( labelBounds.width + dotLineGap + dotLineBounds.width, iconGap + iconBounds.width, ) * 2 + arrowWidth; return ( {isNormal ? ( <> {label} {desc} {dotLine} ) : ( <> {icon} )} {String(indexes[0] + 1) .padStart(2, '0') .slice(-2)} {!isNormal ? ( <> {dotLine} {label} {desc} ) : ( <> {icon} )} ); }; const VerticalArrow = ( props: Partial & { fill: string; size?: number }, ) => { const { x = 0, y = 0, width = 30, height = 100, fill = '#FF356A', size = 10, } = props; return ( ); }; const DotLine = (props: { x?: number; y?: number; width?: number; height?: number; fill: string; positionH?: 'normal' | 'center' | 'flipped'; }) => { const { x = 0, y = 0, width = 50, height = 10, fill, positionH = 'normal', } = props; const r = height / 2; const lineLength = width - r; const strokeWidth = 2; const lineY = r; return ( ); }; registerItem('vertical-icon-arrow', { component: VerticalIconArrow, composites: ['icon', 'label', 'desc'], });