|
|
@@ -1,37 +1,12 @@
|
|
|
import * as moment from 'moment'
|
|
|
import { distributeHeight } from '../util'
|
|
|
-import UnzonedRange from '../models/UnzonedRange'
|
|
|
import BasicView from './BasicView'
|
|
|
-import BasicViewDateProfileGenerator from './BasicViewDateProfileGenerator'
|
|
|
+import MonthViewDateProfileGenerator from './MonthViewDateProfileGenerator'
|
|
|
|
|
|
|
|
|
/* A month view with day cells running in rows (one-per-week) and columns
|
|
|
----------------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
-
|
|
|
-class MonthViewDateProfileGenerator extends BasicViewDateProfileGenerator {
|
|
|
-
|
|
|
- // Computes the date range that will be rendered.
|
|
|
- buildRenderRange(currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
|
|
|
- var renderUnzonedRange = super.buildRenderRange(currentUnzonedRange, currentRangeUnit, isRangeAllDay);
|
|
|
- var start = this.msToUtcMoment(renderUnzonedRange.startMs, isRangeAllDay);
|
|
|
- var end = this.msToUtcMoment(renderUnzonedRange.endMs, isRangeAllDay);
|
|
|
- var rowCnt;
|
|
|
-
|
|
|
- // ensure 6 weeks
|
|
|
- if (this.opt('fixedWeekCount')) {
|
|
|
- rowCnt = Math.ceil( // could be partial weeks due to hiddenDays
|
|
|
- end.diff(start, 'weeks', true) // dontRound=true
|
|
|
- );
|
|
|
- end.add(6 - rowCnt, 'weeks');
|
|
|
- }
|
|
|
-
|
|
|
- return new UnzonedRange(start, end);
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
export default class MonthView extends BasicView {
|
|
|
|
|
|
// Overrides the default BasicView behavior to have special multi-week auto-height logic
|
|
|
@@ -52,5 +27,4 @@ export default class MonthView extends BasicView {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
MonthView.prototype.dateProfileGeneratorClass = MonthViewDateProfileGenerator
|