forked from damiengarbarino/dojo-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MobileCalendar.js
64 lines (56 loc) · 1.98 KB
/
MobileCalendar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
define([
"delite/register",
"./CalendarBase",
"./ColumnView",
"./ColumnViewSecondarySheet",
"./MobileVerticalRenderer",
"./MatrixView",
"./MobileHorizontalRenderer",
"./LabelRenderer",
"./ExpandRenderer",
"./Touch",
"delite/handlebars!./templates/MobileCalendar.html"
], function (register, CalendarBase, ColumnView, ColumnViewSecondarySheet, VerticalRenderer,
MatrixView, HorizontalRenderer, LabelRenderer, ExpandRenderer, Touch, template) {
var SecondarySheetClass = register("d-calendar-second-sheet-mobile", [ColumnViewSecondarySheet, Touch], {
});
var ColumnViewClass = register("d-calendar-column-view-mobile", [ColumnView, Touch], {
secondarySheetClass: SecondarySheetClass,
verticalRenderer: VerticalRenderer,
horizontalRenderer: HorizontalRenderer,
expandRenderer: ExpandRenderer
});
var MatrixViewClass = register("d-calendar-matrix-view-mobile", [MatrixView, Touch], {
horizontalRenderer: HorizontalRenderer,
labelRenderer: LabelRenderer,
expandRenderer: ExpandRenderer
});
return register("d-calendar-mobile", [HTMLElement, CalendarBase], {
// summary:
// This class defines a calendar widget that display events in time
// designed to be used in mobile environment.
template: template,
_computeCurrentView: function () {
// summary:
// If the time range is lasting less than seven days
// returns the column view or the matrix view otherwise.
// tags:
// protected
if (this._duration <= 7) {
if (!this.columnView) {
this.columnView = new ColumnViewClass(this.columnViewProps);
this.columnView.on("column-header-click", this.columnViewColumnHeaderClick.bind(this));
this.appendChild(this.columnView);
}
return this.columnView;
} else {
if (!this.matrixView) {
this.matrixView = new MatrixViewClass(this.matrixViewProps);
this.matrixView.on("row-header-click", this.matrixViewRowHeaderClick.bind(this));
this.appendChild(this.matrixView);
}
return this.matrixView;
}
}
});
});