|
|
@@ -7,12 +7,14 @@ import { formatDayString, createFormatter } from '../datelib/formatting'
|
|
|
import { buildHookClassNameGenerator, MountHook, ContentHook } from './render-hook'
|
|
|
import { ViewApi } from '../ViewApi'
|
|
|
import { BaseComponent } from '../vdom-util'
|
|
|
+import { DateProfile } from '../DateProfileGenerator'
|
|
|
|
|
|
|
|
|
const DAY_NUM_FORMAT = createFormatter({ day: 'numeric' })
|
|
|
|
|
|
interface DayCellHookPropOrigin {
|
|
|
date: DateMarker // generic
|
|
|
+ dateProfile: DateProfile
|
|
|
todayRange: DateRange
|
|
|
showDayNumber?: boolean // defaults to false
|
|
|
}
|
|
|
@@ -28,6 +30,7 @@ export interface DayCellHookProps extends DateMeta {
|
|
|
export interface DayCellRootProps {
|
|
|
elRef?: Ref<any>
|
|
|
date: DateMarker
|
|
|
+ dateProfile: DateProfile
|
|
|
todayRange: DateRange
|
|
|
showDayNumber?: boolean // defaults to false
|
|
|
extraHookProps?: object
|
|
|
@@ -47,6 +50,7 @@ export class DayCellRoot extends BaseComponent<DayCellRootProps> {
|
|
|
render(props: DayCellRootProps, state: {}, context: ComponentContext) {
|
|
|
let hookPropsOrigin: DayCellHookPropOrigin = {
|
|
|
date: props.date,
|
|
|
+ dateProfile: props.dateProfile,
|
|
|
todayRange: props.todayRange,
|
|
|
showDayNumber: props.showDayNumber
|
|
|
}
|
|
|
@@ -77,6 +81,7 @@ export class DayCellRoot extends BaseComponent<DayCellRootProps> {
|
|
|
|
|
|
export interface DayCellContentProps {
|
|
|
date: DateMarker
|
|
|
+ dateProfile: DateProfile
|
|
|
todayRange: DateRange
|
|
|
showDayNumber?: boolean // defaults to false
|
|
|
extraHookProps?: object
|
|
|
@@ -92,6 +97,7 @@ export class DayCellContent extends BaseComponent<DayCellContentProps> {
|
|
|
render(props: DayCellContentProps, state: {}, context: ComponentContext) {
|
|
|
let hookPropsOrigin: DayCellHookPropOrigin = {
|
|
|
date: props.date,
|
|
|
+ dateProfile: props.dateProfile,
|
|
|
todayRange: props.todayRange,
|
|
|
showDayNumber: props.showDayNumber
|
|
|
}
|
|
|
@@ -113,7 +119,7 @@ export class DayCellContent extends BaseComponent<DayCellContentProps> {
|
|
|
function massageHooksProps(input: DayCellHookPropOrigin, context: ComponentContext): DayCellHookProps {
|
|
|
let { dateEnv } = context
|
|
|
let { date } = input
|
|
|
- let dayMeta = getDateMeta(date, input.todayRange, null, context.dateProfile)
|
|
|
+ let dayMeta = getDateMeta(date, input.todayRange, null, input.dateProfile)
|
|
|
|
|
|
return {
|
|
|
date: dateEnv.toDate(date),
|