-
Notifications
You must be signed in to change notification settings - Fork 17
/
HorizontalRenderer.js
92 lines (78 loc) · 2.06 KB
/
HorizontalRenderer.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
82
83
84
85
86
87
88
89
90
91
92
define([
"dojo/_base/declare",
"dojo/dom-style",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"./_RendererMixin",
"dojo/text!./templates/HorizontalRenderer.html"],
function(
declare,
domStyle,
_WidgetBase,
_TemplatedMixin,
_RendererMixin,
template){
return declare("dojox.calendar.HorizontalRenderer", [_WidgetBase, _TemplatedMixin, _RendererMixin], {
// summary:
// The default item horizontal renderer.
templateString: template,
_orientation: "horizontal",
visibilityLimits: {
resizeStartHandle: 50,
resizeEndHandle: -1,
summaryLabel: 15,
startTimeLabel: 32,
endTimeLabel: 30
},
_displayValueMap: {
"beforeIcon": "inline",
"afterIcon": "inline"
},
_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: function(elt, startHidden, endHidden, size){
var d;
var ltr = this.isLeftToRight();
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 this.inherited(arguments);
},
getDisplayValue: function(part){
var res = this._displayValueMap[part];
if(res){
return res;
}
return this._displayValue;
},
postCreate: function() {
this.inherited(arguments);
this._applyAttributes();
}
});
});