import cx from 'classnames'; import {SvgFastLeft, SvgFastRight, SvgPlainDown, SvgPlainLeft, SvgPlainRight, SvgPlainUp} from '@befe/brick-icon'; import {Icon} from '@befe/brick-comp-icon'; import {brk} from '@befe/brick-utils'; import {cls} from '../utils/cls'; export interface UIPanelTitleProps { text: string withZoomingIcon?: boolean isZooming: boolean shouldShowInner?: boolean rangeControl: 'left' | 'right' | 'none' /** * both : 双向剪头 * * plain-only & none 仅用于控制 "range 内侧" 的剪头按钮 * plain-only : 只显示 "月份切换剪头" * none : 都不显示 */ rangeShowType: 'both' | 'plain-only' | 'none' onFastLeftClick: () => void onFastRightClick: () => void onPlainLeftClick?: () => void onPlainRightClick?: () => void onZoomingClick?: () => void } /** * * @param props * @constructor */ export const UiPanelTitle = (props: UIPanelTitleProps) => { const plainLeftElem = ( ); const plainRightElem = ( ); const fastLeftElem = ( ); const fastRightElem = ( ); let shouldShowPlainLeft = false; let shouldShowPlainRight = false; if (props.shouldShowInner) { if (props.rangeControl === 'left') { shouldShowPlainRight = true; if (props.rangeShowType !== 'none') { shouldShowPlainLeft = true; } } else if (props.rangeControl === 'right') { shouldShowPlainLeft = true; if (props.rangeShowType !== 'none') { shouldShowPlainRight = true; } } else { shouldShowPlainLeft = true; shouldShowPlainRight = true; } } let shouldShowFastLeft = false; let shouldShowFastRight = false; if (props.rangeControl === 'left') { shouldShowFastRight = true; if (props.rangeShowType === 'both') { shouldShowFastLeft = true; } } else if (props.rangeControl === 'right') { shouldShowFastLeft = true; if (props.rangeShowType === 'both') { shouldShowFastRight = true; } } else { shouldShowFastRight = true; shouldShowFastLeft = true; } const navBackElem = shouldShowFastLeft || shouldShowPlainLeft ? (
{shouldShowFastLeft ? fastLeftElem : null} {shouldShowPlainLeft ? plainLeftElem : null}
) : null; const navForwardElem = shouldShowFastRight || shouldShowPlainRight ? (
{shouldShowPlainRight ? plainRightElem : null} {shouldShowFastRight ? fastRightElem : null}
) : null; // console.log({navBackElem, navForwardElem}, props); const zoomingIconElem = props.withZoomingIcon ? ( ) : null; return (
{navBackElem} {navForwardElem}
{props.text} {zoomingIconElem}
); };