11import * as React from 'react' ;
22import type { GenerateConfig } from '../../generate' ;
3+ import useCellClassName from '../../hooks/useCellClassName' ;
4+ import type { Locale } from '../../interface' ;
5+ import RangeContext from '../../RangeContext' ;
36import {
4- WEEK_DAY_COUNT ,
7+ formatValue ,
58 getWeekStartDate ,
69 isSameDate ,
710 isSameMonth ,
8- formatValue ,
11+ WEEK_DAY_COUNT ,
912} from '../../utils/dateUtil' ;
10- import type { Locale } from '../../interface' ;
11- import RangeContext from '../../RangeContext' ;
12- import useCellClassName from '../../hooks/useCellClassName' ;
1313import PanelBody from '../PanelBody' ;
1414
1515export type DateRender < DateType > = ( currentDate : DateType , today : DateType ) => React . ReactNode ;
@@ -21,6 +21,7 @@ export type DateBodyPassProps<DateType> = {
2121 // Used for week panel
2222 prefixColumn ?: ( date : DateType ) => React . ReactNode ;
2323 rowClassName ?: ( date : DateType ) => string ;
24+ isSameCell ?: ( current : DateType , target : DateType ) => boolean ;
2425} ;
2526
2627export type DateBodyProps < DateType > = {
@@ -43,6 +44,7 @@ function DateBody<DateType>(props: DateBodyProps<DateType>) {
4344 viewDate,
4445 value,
4546 dateRender,
47+ isSameCell,
4648 } = props ;
4749
4850 const { rangedValue, hoverRangedValue } = React . useContext ( RangeContext ) ;
@@ -75,8 +77,8 @@ function DateBody<DateType>(props: DateBodyProps<DateType>) {
7577 generateConfig,
7678 rangedValue : prefixColumn ? null : rangedValue ,
7779 hoverRangedValue : prefixColumn ? null : hoverRangedValue ,
78- isSameCell : ( current , target ) => isSameDate ( generateConfig , current , target ) ,
79- isInView : date => isSameMonth ( generateConfig , date , viewDate ) ,
80+ isSameCell : isSameCell || ( ( current , target ) => isSameDate ( generateConfig , current , target ) ) ,
81+ isInView : ( date ) => isSameMonth ( generateConfig , date , viewDate ) ,
8082 offsetCell : ( date , offset ) => generateConfig . addDate ( date , offset ) ,
8183 } ) ;
8284
@@ -92,7 +94,7 @@ function DateBody<DateType>(props: DateBodyProps<DateType>) {
9294 getCellText = { generateConfig . getDate }
9395 getCellClassName = { getCellClassName }
9496 getCellDate = { generateConfig . addDate }
95- titleCell = { date =>
97+ titleCell = { ( date ) =>
9698 formatValue ( date , {
9799 locale,
98100 format : 'YYYY-MM-DD' ,
0 commit comments