forked from damiengarbarino/dojo-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalendar.js
81 lines (74 loc) · 2.21 KB
/
Calendar.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
define([
"delite/register",
"./CalendarBase",
"./ColumnView",
"./ColumnViewSecondarySheet",
"./VerticalRenderer",
"./DecorationRenderer",
"./MatrixView",
"./HorizontalRenderer",
"./LabelRenderer",
"./ExpandRenderer",
"./Keyboard",
"./Mouse",
"delite/handlebars!./templates/Calendar.html",
"requirejs-dplugins/css!./css/Calendar.css"
], function (
register,
CalendarBase,
ColumnView,
ColumnViewSecondarySheet,
VerticalRenderer,
DecorationRenderer,
MatrixView,
HorizontalRenderer,
LabelRenderer,
ExpandRenderer,
Keyboard,
Mouse,
template
) {
var SecondarySheetClass = register("d-calendar-column-view-secondary-km",
[ColumnViewSecondarySheet, Keyboard, Mouse], {});
var ColumnViewClass = register("d-calendar-column-view-km", [ColumnView, Keyboard, Mouse], {
secondarySheetClass: SecondarySheetClass,
verticalRenderer: VerticalRenderer,
horizontalRenderer: HorizontalRenderer,
expandRenderer: ExpandRenderer,
horizontalDecorationRenderer: DecorationRenderer,
verticalDecorationRenderer: DecorationRenderer
});
var MatrixViewClass = register("d-calendar-matrix-view-km", [MatrixView, Keyboard, Mouse], {
horizontalRenderer: HorizontalRenderer,
horizontalDecorationRenderer: DecorationRenderer,
labelRenderer: LabelRenderer,
expandRenderer: ExpandRenderer
});
return register("d-calendar", [HTMLElement, CalendarBase], {
// summary:
// This class defines a calendar widget that display events in time.
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;
}
}
});
});