forked from damiengarbarino/dojo-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MobileHorizontalRenderer.js
76 lines (66 loc) · 1.81 KB
/
MobileHorizontalRenderer.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
define([
"dcl/dcl",
"delite/register",
"dojo/dom-style",
"./RendererBase",
"delite/handlebars!./templates/MobileHorizontalRenderer.html"
], function (
dcl,
register,
domStyle,
_RendererMixin,
template
) {
return register("d-calendar-mobile-horizontal", [HTMLElement, _RendererMixin], {
// summary:
// The mobile specific item horizontal renderer.
template: template,
_orientation: "horizontal",
mobile: true,
visibilityLimits: {
resizeStartHandle: 50,
resizeEndHandle: -1,
summaryLabel: 15,
startTimeLabel: 32,
endTimeLabel: 30
},
_displayValue: "inline",
// arrowPadding: Integer
// The padding size in pixels to apply to the label container on left and/or right side,
// to show the arrows correctly.
arrowPadding: 12,
_isElementVisible: dcl.superCall(function (sup) {
return function (elt, startHidden, endHidden) {
var d;
var ltr = (this.effectiveDir === "ltr");
if (elt == "startTimeLabel") {
if (this.labelContainer && (ltr && endHidden || !ltr && startHidden)) {
domStyle.set(this.labelContainer, "marginRight", this.arrowPadding + "px");
} else {
domStyle.set(this.labelContainer, "marginRight", 0);
}
if (this.labelContainer && (!ltr && endHidden || ltr && startHidden)) {
domStyle.set(this.labelContainer, "marginLeft", this.arrowPadding + "px");
} else {
domStyle.set(this.labelContainer, "marginLeft", 0);
}
}
switch (elt) {
case "startTimeLabel":
d = this.item.startTime;
if (this.item.allDay || this.owner.isStartOfDay(d)) {
return false;
}
break;
case "endTimeLabel":
d = this.item.endTime;
if (this.item.allDay || this.owner.isStartOfDay(d)) {
return false;
}
break;
}
return sup.apply(this, arguments);
};
})
});
});