From 524df82eff6392a6807b6a6d6900fe9c1b51e03b Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Fri, 20 Nov 2020 14:24:33 +0800 Subject: [PATCH] feat: add year start & end (#176) --- src/panels/PanelBody.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/panels/PanelBody.tsx b/src/panels/PanelBody.tsx index de718677b0cf..bbf834fbd68d 100644 --- a/src/panels/PanelBody.tsx +++ b/src/panels/PanelBody.tsx @@ -3,11 +3,13 @@ import classNames from 'classnames'; import PanelContext from '../PanelContext'; import { GenerateConfig } from '../generate'; import { getLastDay } from '../utils/timeUtil'; +import { PanelMode } from '../interface'; export interface PanelBodyProps { prefixCls: string; disabledDate?: (date: DateType) => boolean; onSelect: (value: DateType) => void; + picker?: PanelMode; // By panel headerCells?: React.ReactNode; @@ -30,6 +32,7 @@ export default function PanelBody({ prefixCls, disabledDate, onSelect, + picker, rowNum, colNum, prefixColumn, @@ -75,8 +78,8 @@ export default function PanelBody({ title={title} className={classNames(cellPrefixCls, { [`${cellPrefixCls}-disabled`]: disabled, - [`${cellPrefixCls}-start`]: getCellText(currentDate) === 1, - [`${cellPrefixCls}-end`]: title === getLastDay(generateConfig, currentDate), + [`${cellPrefixCls}-start`]: getCellText(currentDate) === 1 || picker === 'year' && Number(title) % 10 === 0, + [`${cellPrefixCls}-end`]: title === getLastDay(generateConfig, currentDate) || picker === 'year' && Number(title) % 10 === 9, ...getCellClassName(currentDate), })} onClick={() => {