forked from damiengarbarino/dojo-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHorizontalRenderer.js
89 lines (76 loc) · 2.02 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
define([
"dcl/dcl",
"delite/register",
"dojo/dom-style",
"./RendererBase",
"delite/handlebars!./templates/HorizontalRenderer.html"
], function (
dcl,
register,
domStyle,
_RendererMixin,
template
) {
return register("d-calendar-horizontal", [HTMLElement, _RendererMixin], {
// summary:
// The default item horizontal renderer, used by MatrixView.
template: 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: 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);
};
}),
getDisplayValue: function (part) {
var res = this._displayValueMap[part];
if (res) {
return res;
}
return this._displayValue;
}
});
});