1 | define([ |
---|
2 | "dojo/_base/declare", |
---|
3 | "dojo/dom-style", |
---|
4 | "dijit/_WidgetBase", |
---|
5 | "dijit/_TemplatedMixin", |
---|
6 | "dojox/calendar/_RendererMixin", |
---|
7 | "dojo/text!./templates/HorizontalRenderer.html"], |
---|
8 | |
---|
9 | function( |
---|
10 | declare, |
---|
11 | domStyle, |
---|
12 | _WidgetBase, |
---|
13 | _TemplatedMixin, |
---|
14 | _RendererMixin, |
---|
15 | template){ |
---|
16 | |
---|
17 | return declare("dojox.calendar.HorizontalRenderer", [_WidgetBase, _TemplatedMixin, _RendererMixin], { |
---|
18 | |
---|
19 | // summary: |
---|
20 | // The default item horizontal renderer. |
---|
21 | |
---|
22 | templateString: template, |
---|
23 | |
---|
24 | _orientation: "horizontal", |
---|
25 | |
---|
26 | visibilityLimits: { |
---|
27 | resizeStartHandle: 50, |
---|
28 | resizeEndHandle: -1, |
---|
29 | summaryLabel: 15, |
---|
30 | startTimeLabel: 32, |
---|
31 | endTimeLabel: 30 |
---|
32 | }, |
---|
33 | |
---|
34 | _displayValueMap: { |
---|
35 | "beforeIcon": "inline", |
---|
36 | "afterIcon": "inline" |
---|
37 | }, |
---|
38 | |
---|
39 | _displayValue: "inline", |
---|
40 | |
---|
41 | // arrowPadding: Integer |
---|
42 | // The padding size in pixels to apply to the label container on left and/or right side, to show the arrows correctly. |
---|
43 | arrowPadding: 12, |
---|
44 | |
---|
45 | _isElementVisible: function(elt, startHidden, endHidden, size){ |
---|
46 | var d; |
---|
47 | var ltr = this.isLeftToRight(); |
---|
48 | |
---|
49 | if(elt == "startTimeLabel"){ |
---|
50 | if(this.labelContainer && (ltr && endHidden || !ltr && startHidden)){ |
---|
51 | domStyle.set(this.labelContainer, "marginRight", this.arrowPadding+"px"); |
---|
52 | }else{ |
---|
53 | domStyle.set(this.labelContainer, "marginRight", 0); |
---|
54 | } |
---|
55 | if(this.labelContainer && (!ltr && endHidden || ltr && startHidden)){ |
---|
56 | domStyle.set(this.labelContainer, "marginLeft", this.arrowPadding+"px"); |
---|
57 | }else{ |
---|
58 | domStyle.set(this.labelContainer, "marginLeft", 0); |
---|
59 | } |
---|
60 | } |
---|
61 | |
---|
62 | switch(elt){ |
---|
63 | case "startTimeLabel": |
---|
64 | d = this.item.startTime; |
---|
65 | if(this.item.allDay || this.owner.isStartOfDay(d)){ |
---|
66 | return false; |
---|
67 | } |
---|
68 | break; |
---|
69 | case "endTimeLabel": |
---|
70 | d = this.item.endTime; |
---|
71 | if(this.item.allDay || this.owner.isStartOfDay(d)){ |
---|
72 | return false; |
---|
73 | } |
---|
74 | break; |
---|
75 | } |
---|
76 | return this.inherited(arguments); |
---|
77 | }, |
---|
78 | |
---|
79 | getDisplayValue: function(part){ |
---|
80 | var res = this._displayValueMap[part]; |
---|
81 | if(res){ |
---|
82 | return res; |
---|
83 | } |
---|
84 | return this._displayValue; |
---|
85 | }, |
---|
86 | |
---|
87 | postCreate: function() { |
---|
88 | this.inherited(arguments); |
---|
89 | this._applyAttributes(); |
---|
90 | } |
---|
91 | }); |
---|
92 | }); |
---|