-
Notifications
You must be signed in to change notification settings - Fork 17
/
ExpandRenderer.js
144 lines (114 loc) · 2.87 KB
/
ExpandRenderer.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
define([
"dojo/_base/declare",
"dojo/_base/lang",
"dojo/_base/event",
"dojo/_base/window",
"dojo/on",
"dojo/dom-class",
"dojo/dom-style",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dojo/text!./templates/ExpandRenderer.html"],
function(
declare,
lang,
event,
win,
on,
domClass,
domStyle,
_WidgetBase,
_TemplatedMixin,
template){
return declare("dojox.calendar.ExpandRenderer", [_WidgetBase, _TemplatedMixin], {
// summary:
// The default renderer display in MatrixView cells where some item renderers cannot be displayed because of size constraints.
templateString: template,
baseClass: "dojoxCalendarExpand",
// owner: dojox/calendar/_ViewBase
// The view that contains this renderer.
owner: null,
// focused: Boolean
// Indicates that the renderer is focused.
focused: false,
// up: Boolean
// Indicates that the mouse cursor is over renderer.
up: false,
// down: Boolean
// Indicates that the renderer is pressed.
down: false,
// date: Date
// The date displayed by the cell where this renderer is used.
date: null,
// items: Object[]
// List of items that are not displayed in the cell because of the size constraints.
items: null,
// rowIndex: Integer
// Row index where this renderer is used.
rowIndex: -1,
// columnIndex: Integer
// Column index where this renderer is used.
columnIndex: -1,
_setExpandedAttr: function(value){
domStyle.set(this.expand, "display", value ? "none" : "inline-block");
domStyle.set(this.collapse, "display", value ? "inline-block" : "none");
this._set("expanded", value);
},
_setDownAttr: function(value){
this._setState("down", value, "Down");
},
_setUpAttr: function(value){
this._setState("up", value, "Up");
},
_setFocusedAttr: function(value){
this._setState("focused", value, "Focused");
},
_setState: function(prop, value, cssClass){
if (this[prop] != value){
var tn = this.stateNode || this.domNode;
domClass[value ? "add" : "remove"](tn, cssClass);
this._set(prop, value);
}
},
_onClick: function(e){
// tags:
// private
if(this.owner && this.owner.expandRendererClickHandler){
this.owner.expandRendererClickHandler(e, this);
}
},
_onMouseDown: function(e){
// tags:
// private
event.stop(e);
this.set("down", true);
},
_onMouseUp: function(e){
// tags:
// private
this.set("down", false);
},
_onMouseOver: function(e){
// tags:
// private
if(!this.up){
var buttonDown = e.button == 1;
this.set("up", !buttonDown);
this.set("down", buttonDown);
}
},
_onMouseOut: function(e){
// tags:
// private
var node = e.relatedTarget;
while(node != e.currentTarget && node != win.doc.body && node != null){
node = node.parentNode;
}
if(node == e.currentTarget){
return;
}
this.set("up", false);
this.set("down", false);
}
});
});