Adam Shaw hace 5 años
padre
commit
f6969a5409

+ 1 - 1
packages-premium

@@ -1 +1 @@
-Subproject commit 3ba4645be050a332eee30945f357d9c1168a4cbe
+Subproject commit a782639486bb12524b0676169f4dcf45ab1f025e

+ 4 - 0
packages/__tests__/src/lib/wrappers/CalendarWrapper.ts

@@ -14,8 +14,12 @@ export default class CalendarWrapper {
   static BG_EVENT_CLASSNAME = 'fc-bgevent'
   static DAY_PAST_CLASSNAME = 'fc-day-past'
   static DAY_FUTURE_CLASSNAME = 'fc-day-future'
+  static SLOT_PAST_CLASSNAME = 'fc-slot-past'
+  static SLOT_FUTURE_CLASSNAME = 'fc-slot-future'
   static TODAY_CLASSNAME = 'fc-day-today'
+  static SLOT_TODAY_CLASSNAME = 'fc-slot-today'
   static DOW_CLASSNAMES = [ 'fc-day-sun', 'fc-day-mon', 'fc-day-tue', 'fc-day-wed', 'fc-day-thu', 'fc-day-fri', 'fc-day-sat' ]
+  static DOW_SLOT_CLASSNAMES = [ 'fc-slot-sun', 'fc-slot-mon', 'fc-slot-tue', 'fc-slot-wed', 'fc-slot-thu', 'fc-slot-fri', 'fc-slot-sat' ]
   static LTR_CLASSNAME = 'fc-dir-ltr'
   static RTL_CLASSNAME = 'fc-dir-rtl'
   static BOOTSTRAP_CLASSNAME = 'fc-theme-bootstrap'

+ 3 - 3
packages/core/src/common/EventRoot.tsx

@@ -48,9 +48,9 @@ export const EventRoot = (props: EventRootProps) => (
         isMirror: Boolean(props.isDragging || props.isResizing || props.isDateSelecting),
         isStart: Boolean(seg.isStart),
         isEnd: Boolean(seg.isEnd),
-        isPast: Boolean(props.isPast),
-        isFuture: Boolean(props.isFuture),
-        isToday: Boolean(props.isToday),
+        isPast: Boolean(props.isPast), // TODO: don't cast. getDateMeta does it
+        isFuture: Boolean(props.isFuture), // TODO: don't cast. getDateMeta does it
+        isToday: Boolean(props.isToday), // TODO: don't cast. getDateMeta does it
         isSelected: Boolean(props.isSelected),
         isDragging: Boolean(props.isDragging),
         isResizing: Boolean(props.isResizing)

+ 2 - 4
packages/core/src/common/TableDateCell.tsx

@@ -19,9 +19,8 @@ export interface TableDateCellProps {
   colCnt: number
   dayLabelFormat: DateFormatter
   colSpan?: number
-  extraHookProps?: object
   extraDataAttrs?: object
-  extraClassNames?: string[]
+  extraHookProps?: object
 }
 
 interface HookProps extends DateMeta {
@@ -43,8 +42,7 @@ export default class TableDateCell extends BaseComponent<TableDateCellProps> { /
     let dayMeta = getDateMeta(date, props.todayRange, null, props.dateProfile)
 
     let classNames = [ CLASS_NAME ].concat(
-      getDayClassNames(dayMeta, context.theme),
-      props.extraClassNames || []
+      getDayClassNames(dayMeta, context.theme)
     )
     let text = dateEnv.format(date, props.dayLabelFormat)
 

+ 11 - 6
packages/core/src/component/date-rendering.tsx

@@ -17,11 +17,11 @@ export interface DateMeta {
 export function getDateMeta(date: DateMarker, todayRange?: DateRange, nowDate?: DateMarker, dateProfile?: DateProfile): DateMeta {
   return {
     dow: date.getUTCDay(),
-    isDisabled: dateProfile && !rangeContainsMarker(dateProfile.activeRange, date),
-    isOther: dateProfile && !rangeContainsMarker(dateProfile.currentRange, date),
-    isToday: todayRange && rangeContainsMarker(todayRange, date),
-    isPast: nowDate ? (date < nowDate) : todayRange ? (date < todayRange.start) : false,
-    isFuture: nowDate ? (date > nowDate) : todayRange ? (date >= todayRange.end) : false
+    isDisabled: Boolean(dateProfile && !rangeContainsMarker(dateProfile.activeRange, date)),
+    isOther: Boolean(dateProfile && !rangeContainsMarker(dateProfile.currentRange, date)),
+    isToday: Boolean(todayRange && rangeContainsMarker(todayRange, date)),
+    isPast: Boolean(nowDate ? (date < nowDate) : todayRange ? (date < todayRange.start) : false),
+    isFuture: Boolean(nowDate ? (date > nowDate) : todayRange ? (date >= todayRange.end) : false)
   }
 }
 
@@ -59,9 +59,14 @@ export function getDayClassNames(meta: DateMeta, theme: Theme) {
 
 export function getSlotClassNames(meta: DateMeta, theme: Theme) {
   let classNames: string[] = [
-    'fc-slot'
+    'fc-slot',
+    'fc-slot-' + DAY_IDS[meta.dow]
   ]
 
+  if (meta.isDisabled) { // TODO: shouldn't we avoid all other classnames if disabled?
+    classNames.push('fc-slot-disabled')
+  }
+
   if (meta.isToday) {
     classNames.push('fc-slot-today')
     classNames.push(theme.getClass('today'))