import { Bounds, ComponentType, Ellipse, getElementBounds, Group, Path, Polygon, Text, } from '../../jsx'; import { Gap, ItemDesc, ItemIconCircle, ItemLabel, ShapesGroup, } from '../components'; import { AlignLayout, FlexLayout } from '../layouts'; import { getItemProps } from '../utils'; import { registerItem } from './registry'; import type { BaseItemProps } from './types'; export interface HorizontalIconArrowProps extends BaseItemProps { width?: number; } export const HorizontalIconArrow: ComponentType = ( props, ) => { const [ { indexes, datum, width = 140, themeColors, positionV = 'normal' }, restProps, ] = getItemProps(props, ['width']); const isVNormal = positionV !== 'flipped'; const textAlignVertical = positionV === 'normal' ? 'bottom' : 'top'; const label = ( {datum.label} ); const desc = ( {datum.desc} ); const icon = ( ); const dotLine = ( ); const dotLineGap = 5; const iconGap = 25; const arrowHeight = 30; const labelBounds = getElementBounds(label); const descBounds = getElementBounds(desc); const iconBounds = getElementBounds(icon); const dotLineBounds = getElementBounds(dotLine); const fixedGap = labelBounds.height + descBounds.height + dotLineGap + dotLineBounds.height - iconBounds.height - iconGap; const totalHeight = iconBounds.height + iconGap + arrowHeight + dotLineBounds.height + dotLineGap + labelBounds.height + descBounds.height; return ( {isVNormal ? ( <> {desc} {label} {dotLine} ) : ( <> {icon} )} {datum.time ? datum.time : String(indexes[0] + 1) .padStart(2, '0') .slice(-2)} {!isVNormal ? ( <> {dotLine} {label} {desc} ) : ( <> {icon} )} ); }; const HorizontalArrow = ( props: Partial & { fill: string; size?: number }, ) => { const { x = 0, y = 0, width = 100, height = 40, fill = '#FF356A', size = 10, } = props; return ( ); }; const DotLine = (props: { x?: number; y?: number; width?: number; height?: number; fill: string; positionV?: 'normal' | 'middle' | 'flipped'; }) => { const { x = 0, y = 0, width = 10, height = 50, fill, positionV = 'top', } = props; const r = width / 2; const lineLength = height - r; const strokeWidth = 2; const lineX = r; return ( ); }; registerItem('horizontal-icon-arrow', { component: HorizontalIconArrow, composites: ['icon', 'label', 'desc', 'time'], });