ditched dojo for bootstrap and updated ui
This commit is contained in:
parent
24865eec83
commit
8fc9f8ba4f
4883
css/bootstrap.css
vendored
Normal file
4883
css/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
0
css/style.css
Normal file → Executable file
0
css/style.css
Normal file → Executable file
0
favicon.ico
Normal file → Executable file
0
favicon.ico
Normal file → Executable file
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
0
humans.txt
Normal file → Executable file
0
humans.txt
Normal file → Executable file
BIN
img/glyphicons-halflings-white.png
Normal file
BIN
img/glyphicons-halflings-white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
BIN
img/glyphicons-halflings.png
Normal file
BIN
img/glyphicons-halflings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
35
index.html
Normal file → Executable file
35
index.html
Normal file → Executable file
|
@ -15,23 +15,50 @@
|
|||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link rel="stylesheet" href="css/bootstrap.css">
|
||||
|
||||
<script src="js/libs/modernizr-2.5.3.min.js"></script>
|
||||
<script src="js/libs/dojo/dojo.js"
|
||||
data-dojo-config="async: true"></script>
|
||||
<script src="js/libs/jquery-1.7.2.js"></script>
|
||||
<script src="js/libs/bootstrap.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<header>ARIA2 Webclient</header>
|
||||
<body class="hero-unit">
|
||||
<h1>ARIA2 Webclient</h1>
|
||||
|
||||
<div role="main">
|
||||
<p id="console"></p>
|
||||
<h2>Pending Downloads</h2>
|
||||
<table id="" class="table table-bordered">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Progress</th>
|
||||
<th>Size</th>
|
||||
<th>Download Speed</th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
intital footer!!
|
||||
</footer>
|
||||
|
||||
<!-- Hidden dialogs and out of screen HTML elements -->
|
||||
<div class="modal fade" id="error_connect">
|
||||
<div class="modal-header">
|
||||
<button class="close" data-dismiss="modal">x</button>
|
||||
<h3>Connection to Aria failed :( </h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
Make sure that aria2c is running and rpc is enabled.
|
||||
aria2c --enable-rpc
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn">Retry</a>
|
||||
<a href="#" class="btn btn-primary">Use custom IP and port settings</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="js/plugins.js"></script>
|
||||
|
||||
|
|
1835
js/libs/bootstrap.js
vendored
Normal file
1835
js/libs/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -1,63 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/BackgroundIframe",["require",".","dojo/_base/config","dojo/dom-construct","dojo/dom-style","dojo/_base/lang","dojo/on","dojo/_base/sniff","dojo/_base/window"],function(_1,_2,_3,_4,_5,_6,on,_7,_8){
|
||||
var _9=new function(){
|
||||
var _a=[];
|
||||
this.pop=function(){
|
||||
var _b;
|
||||
if(_a.length){
|
||||
_b=_a.pop();
|
||||
_b.style.display="";
|
||||
}else{
|
||||
if(_7("ie")<9){
|
||||
var _c=_3["dojoBlankHtmlUrl"]||_1.toUrl("dojo/resources/blank.html")||"javascript:\"\"";
|
||||
var _d="<iframe src='"+_c+"' role='presentation'"+" style='position: absolute; left: 0px; top: 0px;"+"z-index: -1; filter:Alpha(Opacity=\"0\");'>";
|
||||
_b=_8.doc.createElement(_d);
|
||||
}else{
|
||||
_b=_4.create("iframe");
|
||||
_b.src="javascript:\"\"";
|
||||
_b.className="dijitBackgroundIframe";
|
||||
_b.setAttribute("role","presentation");
|
||||
_5.set(_b,"opacity",0.1);
|
||||
}
|
||||
_b.tabIndex=-1;
|
||||
}
|
||||
return _b;
|
||||
};
|
||||
this.push=function(_e){
|
||||
_e.style.display="none";
|
||||
_a.push(_e);
|
||||
};
|
||||
}();
|
||||
_2.BackgroundIframe=function(_f){
|
||||
if(!_f.id){
|
||||
throw new Error("no id");
|
||||
}
|
||||
if(_7("ie")||_7("mozilla")){
|
||||
var _10=(this.iframe=_9.pop());
|
||||
_f.appendChild(_10);
|
||||
if(_7("ie")<7||_7("quirks")){
|
||||
this.resize(_f);
|
||||
this._conn=on(_f,"resize",_6.hitch(this,function(){
|
||||
this.resize(_f);
|
||||
}));
|
||||
}else{
|
||||
_5.set(_10,{width:"100%",height:"100%"});
|
||||
}
|
||||
}
|
||||
};
|
||||
_6.extend(_2.BackgroundIframe,{resize:function(_11){
|
||||
if(this.iframe){
|
||||
_5.set(this.iframe,{width:_11.offsetWidth+"px",height:_11.offsetHeight+"px"});
|
||||
}
|
||||
},destroy:function(){
|
||||
if(this._conn){
|
||||
this._conn.remove();
|
||||
this._conn=null;
|
||||
}
|
||||
if(this.iframe){
|
||||
_9.push(this.iframe);
|
||||
delete this.iframe;
|
||||
}
|
||||
}});
|
||||
return _2.BackgroundIframe;
|
||||
});
|
|
@ -1,114 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/BackgroundIframe", [
|
||||
"require", // require.toUrl
|
||||
".", // to export dijit.BackgroundIframe
|
||||
"dojo/_base/config",
|
||||
"dojo/dom-construct", // domConstruct.create
|
||||
"dojo/dom-style", // domStyle.set
|
||||
"dojo/_base/lang", // lang.extend lang.hitch
|
||||
"dojo/on",
|
||||
"dojo/_base/sniff", // has("ie"), has("mozilla"), has("quirks")
|
||||
"dojo/_base/window" // win.doc.createElement
|
||||
], function(require, dijit, config, domConstruct, domStyle, lang, on, has, win){
|
||||
|
||||
// module:
|
||||
// dijit/BackgroundIFrame
|
||||
// summary:
|
||||
// new dijit.BackgroundIframe(node)
|
||||
// Makes a background iframe as a child of node, that fills
|
||||
// area (and position) of node
|
||||
|
||||
// TODO: remove _frames, it isn't being used much, since popups never release their
|
||||
// iframes (see [22236])
|
||||
var _frames = new function(){
|
||||
// summary:
|
||||
// cache of iframes
|
||||
|
||||
var queue = [];
|
||||
|
||||
this.pop = function(){
|
||||
var iframe;
|
||||
if(queue.length){
|
||||
iframe = queue.pop();
|
||||
iframe.style.display="";
|
||||
}else{
|
||||
if(has("ie") < 9){
|
||||
var burl = config["dojoBlankHtmlUrl"] || require.toUrl("dojo/resources/blank.html") || "javascript:\"\"";
|
||||
var html="<iframe src='" + burl + "' role='presentation'"
|
||||
+ " style='position: absolute; left: 0px; top: 0px;"
|
||||
+ "z-index: -1; filter:Alpha(Opacity=\"0\");'>";
|
||||
iframe = win.doc.createElement(html);
|
||||
}else{
|
||||
iframe = domConstruct.create("iframe");
|
||||
iframe.src = 'javascript:""';
|
||||
iframe.className = "dijitBackgroundIframe";
|
||||
iframe.setAttribute("role", "presentation");
|
||||
domStyle.set(iframe, "opacity", 0.1);
|
||||
}
|
||||
iframe.tabIndex = -1; // Magic to prevent iframe from getting focus on tab keypress - as style didn't work.
|
||||
}
|
||||
return iframe;
|
||||
};
|
||||
|
||||
this.push = function(iframe){
|
||||
iframe.style.display="none";
|
||||
queue.push(iframe);
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
dijit.BackgroundIframe = function(/*DomNode*/ node){
|
||||
// summary:
|
||||
// For IE/FF z-index schenanigans. id attribute is required.
|
||||
//
|
||||
// description:
|
||||
// new dijit.BackgroundIframe(node)
|
||||
// Makes a background iframe as a child of node, that fills
|
||||
// area (and position) of node
|
||||
|
||||
if(!node.id){ throw new Error("no id"); }
|
||||
if(has("ie") || has("mozilla")){
|
||||
var iframe = (this.iframe = _frames.pop());
|
||||
node.appendChild(iframe);
|
||||
if(has("ie")<7 || has("quirks")){
|
||||
this.resize(node);
|
||||
this._conn = on(node, 'resize', lang.hitch(this, function(){
|
||||
this.resize(node);
|
||||
}));
|
||||
}else{
|
||||
domStyle.set(iframe, {
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
lang.extend(dijit.BackgroundIframe, {
|
||||
resize: function(node){
|
||||
// summary:
|
||||
// Resize the iframe so it's the same size as node.
|
||||
// Needed on IE6 and IE/quirks because height:100% doesn't work right.
|
||||
if(this.iframe){
|
||||
domStyle.set(this.iframe, {
|
||||
width: node.offsetWidth + 'px',
|
||||
height: node.offsetHeight + 'px'
|
||||
});
|
||||
}
|
||||
},
|
||||
destroy: function(){
|
||||
// summary:
|
||||
// destroy the iframe
|
||||
if(this._conn){
|
||||
this._conn.remove();
|
||||
this._conn = null;
|
||||
}
|
||||
if(this.iframe){
|
||||
_frames.push(this.iframe);
|
||||
delete this.iframe;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return dijit.BackgroundIframe;
|
||||
});
|
|
@ -1,116 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/Calendar",["dojo/_base/array","dojo/date","dojo/date/locale","dojo/_base/declare","dojo/dom-attr","dojo/dom-class","dojo/_base/event","dojo/_base/kernel","dojo/keys","dojo/_base/lang","dojo/_base/sniff","./CalendarLite","./_Widget","./_CssStateMixin","./_TemplatedMixin","./form/DropDownButton","./hccss"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f,_10){
|
||||
var _11=_4("dijit.Calendar",[_c,_d,_e],{cssStateNodes:{"decrementMonth":"dijitCalendarArrow","incrementMonth":"dijitCalendarArrow","previousYearLabelNode":"dijitCalendarPreviousYear","nextYearLabelNode":"dijitCalendarNextYear"},setValue:function(_12){
|
||||
_8.deprecated("dijit.Calendar:setValue() is deprecated. Use set('value', ...) instead.","","2.0");
|
||||
this.set("value",_12);
|
||||
},_createMonthWidget:function(){
|
||||
return new _11._MonthDropDownButton({id:this.id+"_mddb",tabIndex:-1,onMonthSelect:_a.hitch(this,"_onMonthSelect"),lang:this.lang,dateLocaleModule:this.dateLocaleModule},this.monthNode);
|
||||
},buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
this.connect(this.domNode,"onkeypress","_onKeyPress");
|
||||
this.connect(this.dateRowsNode,"onmouseover","_onDayMouseOver");
|
||||
this.connect(this.dateRowsNode,"onmouseout","_onDayMouseOut");
|
||||
this.connect(this.dateRowsNode,"onmousedown","_onDayMouseDown");
|
||||
this.connect(this.dateRowsNode,"onmouseup","_onDayMouseUp");
|
||||
},_onMonthSelect:function(_13){
|
||||
this._setCurrentFocusAttr(this.dateFuncObj.add(this.currentFocus,"month",_13-this.currentFocus.getMonth()));
|
||||
},_onDayMouseOver:function(evt){
|
||||
var _14=_6.contains(evt.target,"dijitCalendarDateLabel")?evt.target.parentNode:evt.target;
|
||||
if(_14&&((_14.dijitDateValue&&!_6.contains(_14,"dijitCalendarDisabledDate"))||_14==this.previousYearLabelNode||_14==this.nextYearLabelNode)){
|
||||
_6.add(_14,"dijitCalendarHoveredDate");
|
||||
this._currentNode=_14;
|
||||
}
|
||||
},_onDayMouseOut:function(evt){
|
||||
if(!this._currentNode){
|
||||
return;
|
||||
}
|
||||
if(evt.relatedTarget&&evt.relatedTarget.parentNode==this._currentNode){
|
||||
return;
|
||||
}
|
||||
var cls="dijitCalendarHoveredDate";
|
||||
if(_6.contains(this._currentNode,"dijitCalendarActiveDate")){
|
||||
cls+=" dijitCalendarActiveDate";
|
||||
}
|
||||
_6.remove(this._currentNode,cls);
|
||||
this._currentNode=null;
|
||||
},_onDayMouseDown:function(evt){
|
||||
var _15=evt.target.parentNode;
|
||||
if(_15&&_15.dijitDateValue&&!_6.contains(_15,"dijitCalendarDisabledDate")){
|
||||
_6.add(_15,"dijitCalendarActiveDate");
|
||||
this._currentNode=_15;
|
||||
}
|
||||
},_onDayMouseUp:function(evt){
|
||||
var _16=evt.target.parentNode;
|
||||
if(_16&&_16.dijitDateValue){
|
||||
_6.remove(_16,"dijitCalendarActiveDate");
|
||||
}
|
||||
},handleKey:function(evt){
|
||||
var _17=-1,_18,_19=this.currentFocus;
|
||||
switch(evt.charOrCode){
|
||||
case _9.RIGHT_ARROW:
|
||||
_17=1;
|
||||
case _9.LEFT_ARROW:
|
||||
_18="day";
|
||||
if(!this.isLeftToRight()){
|
||||
_17*=-1;
|
||||
}
|
||||
break;
|
||||
case _9.DOWN_ARROW:
|
||||
_17=1;
|
||||
case _9.UP_ARROW:
|
||||
_18="week";
|
||||
break;
|
||||
case _9.PAGE_DOWN:
|
||||
_17=1;
|
||||
case _9.PAGE_UP:
|
||||
_18=evt.ctrlKey||evt.altKey?"year":"month";
|
||||
break;
|
||||
case _9.END:
|
||||
_19=this.dateFuncObj.add(_19,"month",1);
|
||||
_18="day";
|
||||
case _9.HOME:
|
||||
_19=new this.dateClassObj(_19);
|
||||
_19.setDate(1);
|
||||
break;
|
||||
case _9.ENTER:
|
||||
case " ":
|
||||
this.set("value",this.currentFocus);
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
if(_18){
|
||||
_19=this.dateFuncObj.add(_19,_18,_17);
|
||||
}
|
||||
this._setCurrentFocusAttr(_19);
|
||||
return false;
|
||||
},_onKeyPress:function(evt){
|
||||
if(!this.handleKey(evt)){
|
||||
_7.stop(evt);
|
||||
}
|
||||
},onValueSelected:function(){
|
||||
},onChange:function(_1a){
|
||||
this.onValueSelected(_1a);
|
||||
},getClassForDate:function(){
|
||||
}});
|
||||
_11._MonthDropDownButton=_4("dijit.Calendar._MonthDropDownButton",_10,{onMonthSelect:function(){
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
this.dropDown=new _11._MonthDropDown({id:this.id+"_mdd",onChange:this.onMonthSelect});
|
||||
},_setMonthAttr:function(_1b){
|
||||
var _1c=this.dateLocaleModule.getNames("months","wide","standAlone",this.lang,_1b);
|
||||
this.dropDown.set("months",_1c);
|
||||
this.containerNode.innerHTML=(_b("ie")==6?"":"<div class='dijitSpacer'>"+this.dropDown.domNode.innerHTML+"</div>")+"<div class='dijitCalendarMonthLabel dijitCalendarCurrentMonthLabel'>"+_1c[_1b.getMonth()]+"</div>";
|
||||
}});
|
||||
_11._MonthDropDown=_4("dijit.Calendar._MonthDropDown",[_d,_f],{months:[],templateString:"<div class='dijitCalendarMonthMenu dijitMenu' "+"data-dojo-attach-event='onclick:_onClick,onmouseover:_onMenuHover,onmouseout:_onMenuHover'></div>",_setMonthsAttr:function(_1d){
|
||||
this.domNode.innerHTML=_1.map(_1d,function(_1e,idx){
|
||||
return _1e?"<div class='dijitCalendarMonthLabel' month='"+idx+"'>"+_1e+"</div>":"";
|
||||
}).join("");
|
||||
},_onClick:function(evt){
|
||||
this.onChange(_5.get(evt.target,"month"));
|
||||
},onChange:function(){
|
||||
},_onMenuHover:function(evt){
|
||||
_6.toggle(evt.target,"dijitCalendarMonthLabelHover",evt.type=="mouseover");
|
||||
}});
|
||||
return _11;
|
||||
});
|
|
@ -1,318 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/Calendar", [
|
||||
"dojo/_base/array", // array.map
|
||||
"dojo/date",
|
||||
"dojo/date/locale",
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-attr", // domAttr.get
|
||||
"dojo/dom-class", // domClass.add domClass.contains domClass.remove domClass.toggle
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/_base/kernel", // kernel.deprecated
|
||||
"dojo/keys", // keys
|
||||
"dojo/_base/lang", // lang.hitch
|
||||
"dojo/_base/sniff", // has("ie")
|
||||
"./CalendarLite",
|
||||
"./_Widget",
|
||||
"./_CssStateMixin",
|
||||
"./_TemplatedMixin",
|
||||
"./form/DropDownButton",
|
||||
"./hccss" // not used directly, but sets CSS class on <body>
|
||||
], function(array, date, local, declare, domAttr, domClass, event, kernel, keys, lang, has,
|
||||
CalendarLite, _Widget, _CssStateMixin, _TemplatedMixin, DropDownButton){
|
||||
|
||||
/*=====
|
||||
var CalendarLite = dijit.CalendarLite;
|
||||
var _CssStateMixin = dijit._CssStateMixin;
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
var DropDownButton = dijit.form.DropDownButton;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/Calendar
|
||||
// summary:
|
||||
// A simple GUI for choosing a date in the context of a monthly calendar.
|
||||
|
||||
var Calendar = declare("dijit.Calendar",
|
||||
[CalendarLite, _Widget, _CssStateMixin], // _Widget for deprecated methods like setAttribute()
|
||||
{
|
||||
// summary:
|
||||
// A simple GUI for choosing a date in the context of a monthly calendar.
|
||||
//
|
||||
// description:
|
||||
// See CalendarLite for general description. Calendar extends CalendarLite, adding:
|
||||
// - month drop down list
|
||||
// - keyboard navigation
|
||||
// - CSS classes for hover/mousepress on date, month, and year nodes
|
||||
// - support of deprecated methods (will be removed in 2.0)
|
||||
|
||||
// Set node classes for various mouse events, see dijit._CssStateMixin for more details
|
||||
cssStateNodes: {
|
||||
"decrementMonth": "dijitCalendarArrow",
|
||||
"incrementMonth": "dijitCalendarArrow",
|
||||
"previousYearLabelNode": "dijitCalendarPreviousYear",
|
||||
"nextYearLabelNode": "dijitCalendarNextYear"
|
||||
},
|
||||
|
||||
setValue: function(/*Date*/ value){
|
||||
// summary:
|
||||
// Deprecated. Use set('value', ...) instead.
|
||||
// tags:
|
||||
// deprecated
|
||||
kernel.deprecated("dijit.Calendar:setValue() is deprecated. Use set('value', ...) instead.", "", "2.0");
|
||||
this.set('value', value);
|
||||
},
|
||||
|
||||
_createMonthWidget: function(){
|
||||
// summary:
|
||||
// Creates the drop down button that displays the current month and lets user pick a new one
|
||||
|
||||
return new Calendar._MonthDropDownButton({
|
||||
id: this.id + "_mddb",
|
||||
tabIndex: -1,
|
||||
onMonthSelect: lang.hitch(this, "_onMonthSelect"),
|
||||
lang: this.lang,
|
||||
dateLocaleModule: this.dateLocaleModule
|
||||
}, this.monthNode);
|
||||
},
|
||||
|
||||
buildRendering: function(){
|
||||
this.inherited(arguments);
|
||||
|
||||
// Events specific to Calendar, not used in CalendarLite
|
||||
this.connect(this.domNode, "onkeypress", "_onKeyPress");
|
||||
this.connect(this.dateRowsNode, "onmouseover", "_onDayMouseOver");
|
||||
this.connect(this.dateRowsNode, "onmouseout", "_onDayMouseOut");
|
||||
this.connect(this.dateRowsNode, "onmousedown", "_onDayMouseDown");
|
||||
this.connect(this.dateRowsNode, "onmouseup", "_onDayMouseUp");
|
||||
},
|
||||
|
||||
_onMonthSelect: function(/*Number*/ newMonth){
|
||||
// summary:
|
||||
// Handler for when user selects a month from the drop down list
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
// move to selected month, bounding by the number of days in the month
|
||||
// (ex: dec 31 --> jan 28, not jan 31)
|
||||
this._setCurrentFocusAttr(this.dateFuncObj.add(this.currentFocus, "month",
|
||||
newMonth - this.currentFocus.getMonth()));
|
||||
},
|
||||
|
||||
_onDayMouseOver: function(/*Event*/ evt){
|
||||
// summary:
|
||||
// Handler for mouse over events on days, sets hovered style
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
// event can occur on <td> or the <span> inside the td,
|
||||
// set node to the <td>.
|
||||
var node =
|
||||
domClass.contains(evt.target, "dijitCalendarDateLabel") ?
|
||||
evt.target.parentNode :
|
||||
evt.target;
|
||||
|
||||
if(node && (
|
||||
(node.dijitDateValue && !domClass.contains(node, "dijitCalendarDisabledDate"))
|
||||
|| node == this.previousYearLabelNode || node == this.nextYearLabelNode
|
||||
)){
|
||||
domClass.add(node, "dijitCalendarHoveredDate");
|
||||
this._currentNode = node;
|
||||
}
|
||||
},
|
||||
|
||||
_onDayMouseOut: function(/*Event*/ evt){
|
||||
// summary:
|
||||
// Handler for mouse out events on days, clears hovered style
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
if(!this._currentNode){ return; }
|
||||
|
||||
// if mouse out occurs moving from <td> to <span> inside <td>, ignore it
|
||||
if(evt.relatedTarget && evt.relatedTarget.parentNode == this._currentNode){ return; }
|
||||
var cls = "dijitCalendarHoveredDate";
|
||||
if(domClass.contains(this._currentNode, "dijitCalendarActiveDate")){
|
||||
cls += " dijitCalendarActiveDate";
|
||||
}
|
||||
domClass.remove(this._currentNode, cls);
|
||||
this._currentNode = null;
|
||||
},
|
||||
|
||||
_onDayMouseDown: function(/*Event*/ evt){
|
||||
var node = evt.target.parentNode;
|
||||
if(node && node.dijitDateValue && !domClass.contains(node, "dijitCalendarDisabledDate")){
|
||||
domClass.add(node, "dijitCalendarActiveDate");
|
||||
this._currentNode = node;
|
||||
}
|
||||
},
|
||||
|
||||
_onDayMouseUp: function(/*Event*/ evt){
|
||||
var node = evt.target.parentNode;
|
||||
if(node && node.dijitDateValue){
|
||||
domClass.remove(node, "dijitCalendarActiveDate");
|
||||
}
|
||||
},
|
||||
|
||||
handleKey: function(/*Event*/ evt){
|
||||
// summary:
|
||||
// Provides keyboard navigation of calendar.
|
||||
// description:
|
||||
// Called from _onKeyPress() to handle keypress on a stand alone Calendar,
|
||||
// and also from `dijit.form._DateTimeTextBox` to pass a keypress event
|
||||
// from the `dijit.form.DateTextBox` to be handled in this widget
|
||||
// returns:
|
||||
// False if the key was recognized as a navigation key,
|
||||
// to indicate that the event was handled by Calendar and shouldn't be propogated
|
||||
// tags:
|
||||
// protected
|
||||
var increment = -1,
|
||||
interval,
|
||||
newValue = this.currentFocus;
|
||||
switch(evt.charOrCode){
|
||||
case keys.RIGHT_ARROW:
|
||||
increment = 1;
|
||||
//fallthrough...
|
||||
case keys.LEFT_ARROW:
|
||||
interval = "day";
|
||||
if(!this.isLeftToRight()){ increment *= -1; }
|
||||
break;
|
||||
case keys.DOWN_ARROW:
|
||||
increment = 1;
|
||||
//fallthrough...
|
||||
case keys.UP_ARROW:
|
||||
interval = "week";
|
||||
break;
|
||||
case keys.PAGE_DOWN:
|
||||
increment = 1;
|
||||
//fallthrough...
|
||||
case keys.PAGE_UP:
|
||||
interval = evt.ctrlKey || evt.altKey ? "year" : "month";
|
||||
break;
|
||||
case keys.END:
|
||||
// go to the next month
|
||||
newValue = this.dateFuncObj.add(newValue, "month", 1);
|
||||
// subtract a day from the result when we're done
|
||||
interval = "day";
|
||||
//fallthrough...
|
||||
case keys.HOME:
|
||||
newValue = new this.dateClassObj(newValue);
|
||||
newValue.setDate(1);
|
||||
break;
|
||||
case keys.ENTER:
|
||||
case " ":
|
||||
this.set("value", this.currentFocus);
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
if(interval){
|
||||
newValue = this.dateFuncObj.add(newValue, interval, increment);
|
||||
}
|
||||
|
||||
this._setCurrentFocusAttr(newValue);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_onKeyPress: function(/*Event*/ evt){
|
||||
// summary:
|
||||
// For handling keypress events on a stand alone calendar
|
||||
if(!this.handleKey(evt)){
|
||||
event.stop(evt);
|
||||
}
|
||||
},
|
||||
|
||||
onValueSelected: function(/*Date*/ /*===== date =====*/){
|
||||
// summary:
|
||||
// Deprecated. Notification that a date cell was selected. It may be the same as the previous value.
|
||||
// description:
|
||||
// Formerly used by `dijit.form._DateTimeTextBox` (and thus `dijit.form.DateTextBox`)
|
||||
// to get notification when the user has clicked a date. Now onExecute() (above) is used.
|
||||
// tags:
|
||||
// protected
|
||||
},
|
||||
|
||||
onChange: function(value){
|
||||
this.onValueSelected(value); // remove in 2.0
|
||||
},
|
||||
|
||||
getClassForDate: function(/*===== dateObject, locale =====*/){
|
||||
// summary:
|
||||
// May be overridden to return CSS classes to associate with the date entry for the given dateObject,
|
||||
// for example to indicate a holiday in specified locale.
|
||||
// dateObject: Date
|
||||
// locale: String?
|
||||
// tags:
|
||||
// extension
|
||||
|
||||
/*=====
|
||||
return ""; // String
|
||||
=====*/
|
||||
}
|
||||
});
|
||||
|
||||
Calendar._MonthDropDownButton = declare("dijit.Calendar._MonthDropDownButton", DropDownButton, {
|
||||
// summary:
|
||||
// DropDownButton for the current month. Displays name of current month
|
||||
// and a list of month names in the drop down
|
||||
|
||||
onMonthSelect: function(){ },
|
||||
|
||||
postCreate: function(){
|
||||
this.inherited(arguments);
|
||||
this.dropDown = new Calendar._MonthDropDown({
|
||||
id: this.id + "_mdd", //do not change this id because it is referenced in the template
|
||||
onChange: this.onMonthSelect
|
||||
});
|
||||
},
|
||||
_setMonthAttr: function(month){
|
||||
// summary:
|
||||
// Set the current month to display as a label
|
||||
var monthNames = this.dateLocaleModule.getNames('months', 'wide', 'standAlone', this.lang, month);
|
||||
this.dropDown.set("months", monthNames);
|
||||
|
||||
// Set name of current month and also fill in spacer element with all the month names
|
||||
// (invisible) so that the maximum width will affect layout. But not on IE6 because then
|
||||
// the center <TH> overlaps the right <TH> (due to a browser bug).
|
||||
this.containerNode.innerHTML =
|
||||
(has("ie") == 6 ? "" : "<div class='dijitSpacer'>" + this.dropDown.domNode.innerHTML + "</div>") +
|
||||
"<div class='dijitCalendarMonthLabel dijitCalendarCurrentMonthLabel'>" + monthNames[month.getMonth()] + "</div>";
|
||||
}
|
||||
});
|
||||
|
||||
Calendar._MonthDropDown = declare("dijit.Calendar._MonthDropDown", [_Widget, _TemplatedMixin], {
|
||||
// summary:
|
||||
// The list-of-months drop down from the MonthDropDownButton
|
||||
|
||||
// months: String[]
|
||||
// List of names of months, possibly w/some undefined entries for Hebrew leap months
|
||||
// (ex: ["January", "February", undefined, "April", ...])
|
||||
months: [],
|
||||
|
||||
templateString: "<div class='dijitCalendarMonthMenu dijitMenu' " +
|
||||
"data-dojo-attach-event='onclick:_onClick,onmouseover:_onMenuHover,onmouseout:_onMenuHover'></div>",
|
||||
|
||||
_setMonthsAttr: function(/*String[]*/ months){
|
||||
this.domNode.innerHTML = array.map(months, function(month, idx){
|
||||
return month ? "<div class='dijitCalendarMonthLabel' month='" + idx +"'>" + month + "</div>" : "";
|
||||
}).join("");
|
||||
},
|
||||
|
||||
_onClick: function(/*Event*/ evt){
|
||||
this.onChange(domAttr.get(evt.target, "month"));
|
||||
},
|
||||
|
||||
onChange: function(/*Number*/ /*===== month =====*/){
|
||||
// summary:
|
||||
// Callback when month is selected from drop down
|
||||
},
|
||||
|
||||
_onMenuHover: function(evt){
|
||||
domClass.toggle(evt.target, "dijitCalendarMonthLabelHover", evt.type == "mouseover");
|
||||
}
|
||||
});
|
||||
|
||||
return Calendar;
|
||||
});
|
|
@ -1,175 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/Calendar.html":"<table cellspacing=\"0\" cellpadding=\"0\" class=\"dijitCalendarContainer\" role=\"grid\" aria-labelledby=\"${id}_mddb ${id}_year\">\n\t<thead>\n\t\t<tr class=\"dijitReset dijitCalendarMonthContainer\" valign=\"top\">\n\t\t\t<th class='dijitReset dijitCalendarArrow' data-dojo-attach-point=\"decrementMonth\">\n\t\t\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitCalendarIncrementControl dijitCalendarDecrease\" role=\"presentation\"/>\n\t\t\t\t<span data-dojo-attach-point=\"decreaseArrowNode\" class=\"dijitA11ySideArrow\">-</span>\n\t\t\t</th>\n\t\t\t<th class='dijitReset' colspan=\"5\">\n\t\t\t\t<div data-dojo-attach-point=\"monthNode\">\n\t\t\t\t</div>\n\t\t\t</th>\n\t\t\t<th class='dijitReset dijitCalendarArrow' data-dojo-attach-point=\"incrementMonth\">\n\t\t\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitCalendarIncrementControl dijitCalendarIncrease\" role=\"presentation\"/>\n\t\t\t\t<span data-dojo-attach-point=\"increaseArrowNode\" class=\"dijitA11ySideArrow\">+</span>\n\t\t\t</th>\n\t\t</tr>\n\t\t<tr>\n\t\t\t${!dayCellsHtml}\n\t\t</tr>\n\t</thead>\n\t<tbody data-dojo-attach-point=\"dateRowsNode\" data-dojo-attach-event=\"onclick: _onDayClick\" class=\"dijitReset dijitCalendarBodyContainer\">\n\t\t\t${!dateRowsHtml}\n\t</tbody>\n\t<tfoot class=\"dijitReset dijitCalendarYearContainer\">\n\t\t<tr>\n\t\t\t<td class='dijitReset' valign=\"top\" colspan=\"7\" role=\"presentation\">\n\t\t\t\t<div class=\"dijitCalendarYearLabel\">\n\t\t\t\t\t<span data-dojo-attach-point=\"previousYearLabelNode\" class=\"dijitInline dijitCalendarPreviousYear\" role=\"button\"></span>\n\t\t\t\t\t<span data-dojo-attach-point=\"currentYearLabelNode\" class=\"dijitInline dijitCalendarSelectedYear\" role=\"button\" id=\"${id}_year\"></span>\n\t\t\t\t\t<span data-dojo-attach-point=\"nextYearLabelNode\" class=\"dijitInline dijitCalendarNextYear\" role=\"button\"></span>\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t</tr>\n\t</tfoot>\n</table>\n"}});
|
||||
define("dijit/CalendarLite",["dojo/_base/array","dojo/_base/declare","dojo/cldr/supplemental","dojo/date","dojo/date/locale","dojo/dom","dojo/dom-class","dojo/_base/event","dojo/_base/lang","dojo/_base/sniff","dojo/string","dojo/_base/window","./_WidgetBase","./_TemplatedMixin","dojo/text!./templates/Calendar.html"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f){
|
||||
var _10=_2("dijit.CalendarLite",[_d,_e],{templateString:_f,dowTemplateString:"<th class=\"dijitReset dijitCalendarDayLabelTemplate\" role=\"columnheader\"><span class=\"dijitCalendarDayLabel\">${d}</span></th>",dateTemplateString:"<td class=\"dijitReset\" role=\"gridcell\" data-dojo-attach-point=\"dateCells\"><span class=\"dijitCalendarDateLabel\" data-dojo-attach-point=\"dateLabels\"></span></td>",weekTemplateString:"<tr class=\"dijitReset dijitCalendarWeekTemplate\" role=\"row\">${d}${d}${d}${d}${d}${d}${d}</tr>",value:new Date(""),datePackage:_4,dayWidth:"narrow",tabIndex:"0",currentFocus:new Date(),baseClass:"dijitCalendar",_isValidDate:function(_11){
|
||||
return _11&&!isNaN(_11)&&typeof _11=="object"&&_11.toString()!=this.constructor.prototype.value.toString();
|
||||
},_getValueAttr:function(){
|
||||
if(this.value&&!isNaN(this.value)){
|
||||
var _12=new this.dateClassObj(this.value);
|
||||
_12.setHours(0,0,0,0);
|
||||
if(_12.getDate()<this.value.getDate()){
|
||||
_12=this.dateFuncObj.add(_12,"hour",1);
|
||||
}
|
||||
return _12;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
},_setValueAttr:function(_13,_14){
|
||||
if(_13){
|
||||
_13=new this.dateClassObj(_13);
|
||||
}
|
||||
if(this._isValidDate(_13)){
|
||||
if(!this._isValidDate(this.value)||this.dateFuncObj.compare(_13,this.value)){
|
||||
_13.setHours(1,0,0,0);
|
||||
if(!this.isDisabledDate(_13,this.lang)){
|
||||
this._set("value",_13);
|
||||
this.set("currentFocus",_13);
|
||||
if(_14||typeof _14=="undefined"){
|
||||
this.onChange(this.get("value"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
this._set("value",null);
|
||||
this.set("currentFocus",this.currentFocus);
|
||||
}
|
||||
},_setText:function(_15,_16){
|
||||
while(_15.firstChild){
|
||||
_15.removeChild(_15.firstChild);
|
||||
}
|
||||
_15.appendChild(_c.doc.createTextNode(_16));
|
||||
},_populateGrid:function(){
|
||||
var _17=new this.dateClassObj(this.currentFocus);
|
||||
_17.setDate(1);
|
||||
var _18=_17.getDay(),_19=this.dateFuncObj.getDaysInMonth(_17),_1a=this.dateFuncObj.getDaysInMonth(this.dateFuncObj.add(_17,"month",-1)),_1b=new this.dateClassObj(),_1c=_3.getFirstDayOfWeek(this.lang);
|
||||
if(_1c>_18){
|
||||
_1c-=7;
|
||||
}
|
||||
this._date2cell={};
|
||||
_1.forEach(this.dateCells,function(_1d,idx){
|
||||
var i=idx+_1c;
|
||||
var _1e=new this.dateClassObj(_17),_1f,_20="dijitCalendar",adj=0;
|
||||
if(i<_18){
|
||||
_1f=_1a-_18+i+1;
|
||||
adj=-1;
|
||||
_20+="Previous";
|
||||
}else{
|
||||
if(i>=(_18+_19)){
|
||||
_1f=i-_18-_19+1;
|
||||
adj=1;
|
||||
_20+="Next";
|
||||
}else{
|
||||
_1f=i-_18+1;
|
||||
_20+="Current";
|
||||
}
|
||||
}
|
||||
if(adj){
|
||||
_1e=this.dateFuncObj.add(_1e,"month",adj);
|
||||
}
|
||||
_1e.setDate(_1f);
|
||||
if(!this.dateFuncObj.compare(_1e,_1b,"date")){
|
||||
_20="dijitCalendarCurrentDate "+_20;
|
||||
}
|
||||
if(this._isSelectedDate(_1e,this.lang)){
|
||||
_20="dijitCalendarSelectedDate "+_20;
|
||||
_1d.setAttribute("aria-selected",true);
|
||||
}else{
|
||||
_1d.setAttribute("aria-selected",false);
|
||||
}
|
||||
if(this.isDisabledDate(_1e,this.lang)){
|
||||
_20="dijitCalendarDisabledDate "+_20;
|
||||
_1d.setAttribute("aria-disabled",true);
|
||||
}else{
|
||||
_20="dijitCalendarEnabledDate "+_20;
|
||||
_1d.removeAttribute("aria-disabled");
|
||||
}
|
||||
var _21=this.getClassForDate(_1e,this.lang);
|
||||
if(_21){
|
||||
_20=_21+" "+_20;
|
||||
}
|
||||
_1d.className=_20+"Month dijitCalendarDateTemplate";
|
||||
var _22=_1e.valueOf();
|
||||
this._date2cell[_22]=_1d;
|
||||
_1d.dijitDateValue=_22;
|
||||
this._setText(this.dateLabels[idx],_1e.getDateLocalized?_1e.getDateLocalized(this.lang):_1e.getDate());
|
||||
},this);
|
||||
this.monthWidget.set("month",_17);
|
||||
var y=_17.getFullYear()-1;
|
||||
var d=new this.dateClassObj();
|
||||
_1.forEach(["previous","current","next"],function(_23){
|
||||
d.setFullYear(y++);
|
||||
this._setText(this[_23+"YearLabelNode"],this.dateLocaleModule.format(d,{selector:"year",locale:this.lang}));
|
||||
},this);
|
||||
},goToToday:function(){
|
||||
this.set("value",new this.dateClassObj());
|
||||
},constructor:function(_24){
|
||||
this.datePackage=_24.datePackage||this.datePackage;
|
||||
this.dateFuncObj=typeof this.datePackage=="string"?_9.getObject(this.datePackage,false):this.datePackage;
|
||||
this.dateClassObj=this.dateFuncObj.Date||Date;
|
||||
this.dateLocaleModule=_9.getObject("locale",false,this.dateFuncObj);
|
||||
},_createMonthWidget:function(){
|
||||
return _10._MonthWidget({id:this.id+"_mw",lang:this.lang,dateLocaleModule:this.dateLocaleModule},this.monthNode);
|
||||
},buildRendering:function(){
|
||||
var d=this.dowTemplateString,_25=this.dateLocaleModule.getNames("days",this.dayWidth,"standAlone",this.lang),_26=_3.getFirstDayOfWeek(this.lang);
|
||||
this.dayCellsHtml=_b.substitute([d,d,d,d,d,d,d].join(""),{d:""},function(){
|
||||
return _25[_26++%7];
|
||||
});
|
||||
var r=_b.substitute(this.weekTemplateString,{d:this.dateTemplateString});
|
||||
this.dateRowsHtml=[r,r,r,r,r,r].join("");
|
||||
this.dateCells=[];
|
||||
this.dateLabels=[];
|
||||
this.inherited(arguments);
|
||||
_6.setSelectable(this.domNode,false);
|
||||
var _27=new this.dateClassObj(this.currentFocus);
|
||||
this._supportingWidgets.push(this.monthWidget=this._createMonthWidget());
|
||||
this.set("currentFocus",_27,false);
|
||||
var _28=_9.hitch(this,function(_29,_2a,_2b){
|
||||
this.connect(this[_29],"onclick",function(){
|
||||
this._setCurrentFocusAttr(this.dateFuncObj.add(this.currentFocus,_2a,_2b));
|
||||
});
|
||||
});
|
||||
_28("incrementMonth","month",1);
|
||||
_28("decrementMonth","month",-1);
|
||||
_28("nextYearLabelNode","year",1);
|
||||
_28("previousYearLabelNode","year",-1);
|
||||
},_setCurrentFocusAttr:function(_2c,_2d){
|
||||
var _2e=this.currentFocus,_2f=_2e&&this._date2cell?this._date2cell[_2e.valueOf()]:null;
|
||||
_2c=new this.dateClassObj(_2c);
|
||||
_2c.setHours(1,0,0,0);
|
||||
this._set("currentFocus",_2c);
|
||||
this._populateGrid();
|
||||
var _30=this._date2cell[_2c.valueOf()];
|
||||
_30.setAttribute("tabIndex",this.tabIndex);
|
||||
if(this.focused||_2d){
|
||||
_30.focus();
|
||||
}
|
||||
if(_2f&&_2f!=_30){
|
||||
if(_a("webkit")){
|
||||
_2f.setAttribute("tabIndex","-1");
|
||||
}else{
|
||||
_2f.removeAttribute("tabIndex");
|
||||
}
|
||||
}
|
||||
},focus:function(){
|
||||
this._setCurrentFocusAttr(this.currentFocus,true);
|
||||
},_onDayClick:function(evt){
|
||||
_8.stop(evt);
|
||||
for(var _31=evt.target;_31&&!_31.dijitDateValue;_31=_31.parentNode){
|
||||
}
|
||||
if(_31&&!_7.contains(_31,"dijitCalendarDisabledDate")){
|
||||
this.set("value",_31.dijitDateValue);
|
||||
}
|
||||
},onChange:function(){
|
||||
},_isSelectedDate:function(_32){
|
||||
return this._isValidDate(this.value)&&!this.dateFuncObj.compare(_32,this.value,"date");
|
||||
},isDisabledDate:function(){
|
||||
},getClassForDate:function(){
|
||||
}});
|
||||
_10._MonthWidget=_2("dijit.CalendarLite._MonthWidget",_d,{_setMonthAttr:function(_33){
|
||||
var _34=this.dateLocaleModule.getNames("months","wide","standAlone",this.lang,_33),_35=(_a("ie")==6?"":"<div class='dijitSpacer'>"+_1.map(_34,function(s){
|
||||
return "<div>"+s+"</div>";
|
||||
}).join("")+"</div>");
|
||||
this.domNode.innerHTML=_35+"<div class='dijitCalendarMonthLabel dijitCalendarCurrentMonthLabel'>"+_34[_33.getMonth()]+"</div>";
|
||||
}});
|
||||
return _10;
|
||||
});
|
|
@ -1,454 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/Calendar.html':"<table cellspacing=\"0\" cellpadding=\"0\" class=\"dijitCalendarContainer\" role=\"grid\" aria-labelledby=\"${id}_mddb ${id}_year\">\n\t<thead>\n\t\t<tr class=\"dijitReset dijitCalendarMonthContainer\" valign=\"top\">\n\t\t\t<th class='dijitReset dijitCalendarArrow' data-dojo-attach-point=\"decrementMonth\">\n\t\t\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitCalendarIncrementControl dijitCalendarDecrease\" role=\"presentation\"/>\n\t\t\t\t<span data-dojo-attach-point=\"decreaseArrowNode\" class=\"dijitA11ySideArrow\">-</span>\n\t\t\t</th>\n\t\t\t<th class='dijitReset' colspan=\"5\">\n\t\t\t\t<div data-dojo-attach-point=\"monthNode\">\n\t\t\t\t</div>\n\t\t\t</th>\n\t\t\t<th class='dijitReset dijitCalendarArrow' data-dojo-attach-point=\"incrementMonth\">\n\t\t\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitCalendarIncrementControl dijitCalendarIncrease\" role=\"presentation\"/>\n\t\t\t\t<span data-dojo-attach-point=\"increaseArrowNode\" class=\"dijitA11ySideArrow\">+</span>\n\t\t\t</th>\n\t\t</tr>\n\t\t<tr>\n\t\t\t${!dayCellsHtml}\n\t\t</tr>\n\t</thead>\n\t<tbody data-dojo-attach-point=\"dateRowsNode\" data-dojo-attach-event=\"onclick: _onDayClick\" class=\"dijitReset dijitCalendarBodyContainer\">\n\t\t\t${!dateRowsHtml}\n\t</tbody>\n\t<tfoot class=\"dijitReset dijitCalendarYearContainer\">\n\t\t<tr>\n\t\t\t<td class='dijitReset' valign=\"top\" colspan=\"7\" role=\"presentation\">\n\t\t\t\t<div class=\"dijitCalendarYearLabel\">\n\t\t\t\t\t<span data-dojo-attach-point=\"previousYearLabelNode\" class=\"dijitInline dijitCalendarPreviousYear\" role=\"button\"></span>\n\t\t\t\t\t<span data-dojo-attach-point=\"currentYearLabelNode\" class=\"dijitInline dijitCalendarSelectedYear\" role=\"button\" id=\"${id}_year\"></span>\n\t\t\t\t\t<span data-dojo-attach-point=\"nextYearLabelNode\" class=\"dijitInline dijitCalendarNextYear\" role=\"button\"></span>\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t</tr>\n\t</tfoot>\n</table>\n"}});
|
||||
define("dijit/CalendarLite", [
|
||||
"dojo/_base/array", // array.forEach array.map
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/cldr/supplemental", // cldrSupplemental.getFirstDayOfWeek
|
||||
"dojo/date", // date
|
||||
"dojo/date/locale",
|
||||
"dojo/dom", // dom.setSelectable
|
||||
"dojo/dom-class", // domClass.contains
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/_base/lang", // lang.getObject, lang.hitch
|
||||
"dojo/_base/sniff", // has("ie") has("webkit")
|
||||
"dojo/string", // string.substitute
|
||||
"dojo/_base/window", // win.doc.createTextNode
|
||||
"./_WidgetBase",
|
||||
"./_TemplatedMixin",
|
||||
"dojo/text!./templates/Calendar.html"
|
||||
], function(array, declare, cldrSupplemental, date, local, dom, domClass, event, lang, has, string, win,
|
||||
_WidgetBase, _TemplatedMixin, template){
|
||||
|
||||
/*=====
|
||||
var _WidgetBase = dijit._WidgetBase;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/CalendarLite
|
||||
// summary:
|
||||
// Lightweight version of Calendar widget aimed towards mobile use
|
||||
|
||||
var CalendarLite = declare("dijit.CalendarLite", [_WidgetBase, _TemplatedMixin], {
|
||||
// summary:
|
||||
// Lightweight version of Calendar widget aimed towards mobile use
|
||||
//
|
||||
// description:
|
||||
// A simple GUI for choosing a date in the context of a monthly calendar.
|
||||
// This widget can't be used in a form because it doesn't serialize the date to an
|
||||
// `<input>` field. For a form element, use dijit.form.DateTextBox instead.
|
||||
//
|
||||
// Note that the parser takes all dates attributes passed in the
|
||||
// [RFC 3339 format](http://www.faqs.org/rfcs/rfc3339.html), e.g. `2005-06-30T08:05:00-07:00`
|
||||
// so that they are serializable and locale-independent.
|
||||
//
|
||||
// Also note that this widget isn't keyboard accessible; use dijit.Calendar for that
|
||||
// example:
|
||||
// | var calendar = new dijit.CalendarLite({}, dojo.byId("calendarNode"));
|
||||
//
|
||||
// example:
|
||||
// | <div data-dojo-type="dijit.CalendarLite"></div>
|
||||
|
||||
// Template for main calendar
|
||||
templateString: template,
|
||||
|
||||
// Template for cell for a day of the week (ex: M)
|
||||
dowTemplateString: '<th class="dijitReset dijitCalendarDayLabelTemplate" role="columnheader"><span class="dijitCalendarDayLabel">${d}</span></th>',
|
||||
|
||||
// Templates for a single date (ex: 13), and for a row for a week (ex: 20 21 22 23 24 25 26)
|
||||
dateTemplateString: '<td class="dijitReset" role="gridcell" data-dojo-attach-point="dateCells"><span class="dijitCalendarDateLabel" data-dojo-attach-point="dateLabels"></span></td>',
|
||||
weekTemplateString: '<tr class="dijitReset dijitCalendarWeekTemplate" role="row">${d}${d}${d}${d}${d}${d}${d}</tr>',
|
||||
|
||||
// value: Date
|
||||
// The currently selected Date, initially set to invalid date to indicate no selection.
|
||||
value: new Date(""),
|
||||
// TODO: for 2.0 make this a string (ISO format) rather than a Date
|
||||
|
||||
// datePackage: String
|
||||
// JavaScript object containing Calendar functions. Uses Gregorian Calendar routines
|
||||
// from dojo.date by default.
|
||||
datePackage: date,
|
||||
|
||||
// dayWidth: String
|
||||
// How to represent the days of the week in the calendar header. See locale
|
||||
dayWidth: "narrow",
|
||||
|
||||
// tabIndex: Integer
|
||||
// Order fields are traversed when user hits the tab key
|
||||
tabIndex: "0",
|
||||
|
||||
// currentFocus: Date
|
||||
// Date object containing the currently focused date, or the date which would be focused
|
||||
// if the calendar itself was focused. Also indicates which year and month to display,
|
||||
// i.e. the current "page" the calendar is on.
|
||||
currentFocus: new Date(),
|
||||
|
||||
baseClass:"dijitCalendar",
|
||||
|
||||
_isValidDate: function(/*Date*/ value){
|
||||
// summary:
|
||||
// Runs various tests on the value, checking that it's a valid date, rather
|
||||
// than blank or NaN.
|
||||
// tags:
|
||||
// private
|
||||
return value && !isNaN(value) && typeof value == "object" &&
|
||||
value.toString() != this.constructor.prototype.value.toString();
|
||||
},
|
||||
|
||||
_getValueAttr: function(){
|
||||
// summary:
|
||||
// Support get('value')
|
||||
|
||||
// this.value is set to 1AM, but return midnight, local time for back-compat
|
||||
if(this.value && !isNaN(this.value)){
|
||||
var value = new this.dateClassObj(this.value);
|
||||
value.setHours(0, 0, 0, 0);
|
||||
|
||||
// If daylight savings pushes midnight to the previous date, fix the Date
|
||||
// object to point at 1am so it will represent the correct day. See #9366
|
||||
if(value.getDate() < this.value.getDate()){
|
||||
value = this.dateFuncObj.add(value, "hour", 1);
|
||||
}
|
||||
return value;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
_setValueAttr: function(/*Date|Number*/ value, /*Boolean*/ priorityChange){
|
||||
// summary:
|
||||
// Support set("value", ...)
|
||||
// description:
|
||||
// Set the current date and update the UI. If the date is disabled, the value will
|
||||
// not change, but the display will change to the corresponding month.
|
||||
// value:
|
||||
// Either a Date or the number of seconds since 1970.
|
||||
// tags:
|
||||
// protected
|
||||
if(value){
|
||||
// convert from Number to Date, or make copy of Date object so that setHours() call below
|
||||
// doesn't affect original value
|
||||
value = new this.dateClassObj(value);
|
||||
}
|
||||
if(this._isValidDate(value)){
|
||||
if(!this._isValidDate(this.value) || this.dateFuncObj.compare(value, this.value)){
|
||||
value.setHours(1, 0, 0, 0); // round to nearest day (1am to avoid issues when DST shift occurs at midnight, see #8521, #9366)
|
||||
|
||||
if(!this.isDisabledDate(value, this.lang)){
|
||||
this._set("value", value);
|
||||
|
||||
// Set focus cell to the new value. Arguably this should only happen when there isn't a current
|
||||
// focus point. This will also repopulate the grid, showing the new selected value (and possibly
|
||||
// new month/year).
|
||||
this.set("currentFocus", value);
|
||||
|
||||
if(priorityChange || typeof priorityChange == "undefined"){
|
||||
this.onChange(this.get('value'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// clear value, and repopulate grid (to deselect the previously selected day) without changing currentFocus
|
||||
this._set("value", null);
|
||||
this.set("currentFocus", this.currentFocus);
|
||||
}
|
||||
},
|
||||
|
||||
_setText: function(node, text){
|
||||
// summary:
|
||||
// This just sets the content of node to the specified text.
|
||||
// Can't do "node.innerHTML=text" because of an IE bug w/tables, see #3434.
|
||||
// tags:
|
||||
// private
|
||||
while(node.firstChild){
|
||||
node.removeChild(node.firstChild);
|
||||
}
|
||||
node.appendChild(win.doc.createTextNode(text));
|
||||
},
|
||||
|
||||
_populateGrid: function(){
|
||||
// summary:
|
||||
// Fills in the calendar grid with each day (1-31)
|
||||
// tags:
|
||||
// private
|
||||
|
||||
var month = new this.dateClassObj(this.currentFocus);
|
||||
month.setDate(1);
|
||||
|
||||
var firstDay = month.getDay(),
|
||||
daysInMonth = this.dateFuncObj.getDaysInMonth(month),
|
||||
daysInPreviousMonth = this.dateFuncObj.getDaysInMonth(this.dateFuncObj.add(month, "month", -1)),
|
||||
today = new this.dateClassObj(),
|
||||
dayOffset = cldrSupplemental.getFirstDayOfWeek(this.lang);
|
||||
if(dayOffset > firstDay){ dayOffset -= 7; }
|
||||
|
||||
// Mapping from date (as specified by number returned from Date.valueOf()) to corresponding <td>
|
||||
this._date2cell = {};
|
||||
|
||||
// Iterate through dates in the calendar and fill in date numbers and style info
|
||||
array.forEach(this.dateCells, function(template, idx){
|
||||
var i = idx + dayOffset;
|
||||
var date = new this.dateClassObj(month),
|
||||
number, clazz = "dijitCalendar", adj = 0;
|
||||
|
||||
if(i < firstDay){
|
||||
number = daysInPreviousMonth - firstDay + i + 1;
|
||||
adj = -1;
|
||||
clazz += "Previous";
|
||||
}else if(i >= (firstDay + daysInMonth)){
|
||||
number = i - firstDay - daysInMonth + 1;
|
||||
adj = 1;
|
||||
clazz += "Next";
|
||||
}else{
|
||||
number = i - firstDay + 1;
|
||||
clazz += "Current";
|
||||
}
|
||||
|
||||
if(adj){
|
||||
date = this.dateFuncObj.add(date, "month", adj);
|
||||
}
|
||||
date.setDate(number);
|
||||
|
||||
if(!this.dateFuncObj.compare(date, today, "date")){
|
||||
clazz = "dijitCalendarCurrentDate " + clazz;
|
||||
}
|
||||
|
||||
if(this._isSelectedDate(date, this.lang)){
|
||||
clazz = "dijitCalendarSelectedDate " + clazz;
|
||||
template.setAttribute("aria-selected", true);
|
||||
}else{
|
||||
template.setAttribute("aria-selected", false);
|
||||
}
|
||||
|
||||
if(this.isDisabledDate(date, this.lang)){
|
||||
clazz = "dijitCalendarDisabledDate " + clazz;
|
||||
template.setAttribute("aria-disabled", true);
|
||||
}else{
|
||||
clazz = "dijitCalendarEnabledDate " + clazz;
|
||||
template.removeAttribute("aria-disabled");
|
||||
}
|
||||
|
||||
var clazz2 = this.getClassForDate(date, this.lang);
|
||||
if(clazz2){
|
||||
clazz = clazz2 + " " + clazz;
|
||||
}
|
||||
|
||||
template.className = clazz + "Month dijitCalendarDateTemplate";
|
||||
|
||||
// Each cell has an associated integer value representing it's date
|
||||
var dateVal = date.valueOf();
|
||||
this._date2cell[dateVal] = template;
|
||||
template.dijitDateValue = dateVal;
|
||||
|
||||
// Set Date string (ex: "13").
|
||||
this._setText(this.dateLabels[idx], date.getDateLocalized ? date.getDateLocalized(this.lang) : date.getDate());
|
||||
}, this);
|
||||
|
||||
// set name of this month
|
||||
this.monthWidget.set("month", month);
|
||||
|
||||
// Fill in localized prev/current/next years
|
||||
var y = month.getFullYear() - 1;
|
||||
var d = new this.dateClassObj();
|
||||
array.forEach(["previous", "current", "next"], function(name){
|
||||
d.setFullYear(y++);
|
||||
this._setText(this[name+"YearLabelNode"],
|
||||
this.dateLocaleModule.format(d, {selector:'year', locale:this.lang}));
|
||||
}, this);
|
||||
},
|
||||
|
||||
goToToday: function(){
|
||||
// summary:
|
||||
// Sets calendar's value to today's date
|
||||
this.set('value', new this.dateClassObj());
|
||||
},
|
||||
|
||||
constructor: function(/*Object*/args){
|
||||
this.datePackage = args.datePackage || this.datePackage;
|
||||
this.dateFuncObj = typeof this.datePackage == "string" ?
|
||||
lang.getObject(this.datePackage, false) :// "string" part for back-compat, remove for 2.0
|
||||
this.datePackage;
|
||||
this.dateClassObj = this.dateFuncObj.Date || Date;
|
||||
this.dateLocaleModule = lang.getObject("locale", false, this.dateFuncObj);
|
||||
},
|
||||
|
||||
_createMonthWidget: function(){
|
||||
// summary:
|
||||
// Creates the drop down button that displays the current month and lets user pick a new one
|
||||
|
||||
return CalendarLite._MonthWidget({
|
||||
id: this.id + "_mw",
|
||||
lang: this.lang,
|
||||
dateLocaleModule: this.dateLocaleModule
|
||||
}, this.monthNode);
|
||||
},
|
||||
|
||||
buildRendering: function(){
|
||||
// Markup for days of the week (referenced from template)
|
||||
var d = this.dowTemplateString,
|
||||
dayNames = this.dateLocaleModule.getNames('days', this.dayWidth, 'standAlone', this.lang),
|
||||
dayOffset = cldrSupplemental.getFirstDayOfWeek(this.lang);
|
||||
this.dayCellsHtml = string.substitute([d,d,d,d,d,d,d].join(""), {d: ""}, function(){
|
||||
return dayNames[dayOffset++ % 7]
|
||||
});
|
||||
|
||||
// Markup for dates of the month (referenced from template), but without numbers filled in
|
||||
var r = string.substitute(this.weekTemplateString, {d: this.dateTemplateString});
|
||||
this.dateRowsHtml = [r,r,r,r,r,r].join("");
|
||||
|
||||
// Instantiate from template.
|
||||
// dateCells and dateLabels arrays filled when _Templated parses my template.
|
||||
this.dateCells = [];
|
||||
this.dateLabels = [];
|
||||
this.inherited(arguments);
|
||||
|
||||
dom.setSelectable(this.domNode, false);
|
||||
|
||||
var dateObj = new this.dateClassObj(this.currentFocus);
|
||||
|
||||
this._supportingWidgets.push(this.monthWidget = this._createMonthWidget());
|
||||
|
||||
this.set('currentFocus', dateObj, false); // draw the grid to the month specified by currentFocus
|
||||
|
||||
// Set up connects for increment/decrement of months/years
|
||||
var connect = lang.hitch(this, function(nodeProp, part, amount){
|
||||
this.connect(this[nodeProp], "onclick", function(){
|
||||
this._setCurrentFocusAttr(this.dateFuncObj.add(this.currentFocus, part, amount));
|
||||
});
|
||||
});
|
||||
connect("incrementMonth", "month", 1);
|
||||
connect("decrementMonth", "month", -1);
|
||||
connect("nextYearLabelNode", "year", 1);
|
||||
connect("previousYearLabelNode", "year", -1);
|
||||
},
|
||||
|
||||
_setCurrentFocusAttr: function(/*Date*/ date, /*Boolean*/ forceFocus){
|
||||
// summary:
|
||||
// If the calendar currently has focus, then focuses specified date,
|
||||
// changing the currently displayed month/year if necessary.
|
||||
// If the calendar doesn't have focus, updates currently
|
||||
// displayed month/year, and sets the cell that will get focus.
|
||||
// forceFocus:
|
||||
// If true, will focus() the cell even if calendar itself doesn't have focus
|
||||
|
||||
var oldFocus = this.currentFocus,
|
||||
oldCell = oldFocus && this._date2cell ? this._date2cell[oldFocus.valueOf()] : null;
|
||||
|
||||
// round specified value to nearest day (1am to avoid issues when DST shift occurs at midnight, see #8521, #9366)
|
||||
date = new this.dateClassObj(date);
|
||||
date.setHours(1, 0, 0, 0);
|
||||
|
||||
this._set("currentFocus", date);
|
||||
|
||||
// TODO: only re-populate grid when month/year has changed
|
||||
this._populateGrid();
|
||||
|
||||
// set tabIndex=0 on new cell, and focus it (but only if Calendar itself is focused)
|
||||
var newCell = this._date2cell[date.valueOf()];
|
||||
newCell.setAttribute("tabIndex", this.tabIndex);
|
||||
if(this.focused || forceFocus){
|
||||
newCell.focus();
|
||||
}
|
||||
|
||||
// set tabIndex=-1 on old focusable cell
|
||||
if(oldCell && oldCell != newCell){
|
||||
if(has("webkit")){ // see #11064 about webkit bug
|
||||
oldCell.setAttribute("tabIndex", "-1");
|
||||
}else{
|
||||
oldCell.removeAttribute("tabIndex");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
focus: function(){
|
||||
// summary:
|
||||
// Focus the calendar by focusing one of the calendar cells
|
||||
this._setCurrentFocusAttr(this.currentFocus, true);
|
||||
},
|
||||
|
||||
_onDayClick: function(/*Event*/ evt){
|
||||
// summary:
|
||||
// Handler for day clicks, selects the date if appropriate
|
||||
// tags:
|
||||
// protected
|
||||
event.stop(evt);
|
||||
for(var node = evt.target; node && !node.dijitDateValue; node = node.parentNode);
|
||||
if(node && !domClass.contains(node, "dijitCalendarDisabledDate")){
|
||||
this.set('value', node.dijitDateValue);
|
||||
}
|
||||
},
|
||||
|
||||
onChange: function(/*Date*/ /*===== date =====*/){
|
||||
// summary:
|
||||
// Called only when the selected date has changed
|
||||
},
|
||||
|
||||
_isSelectedDate: function(dateObject /*===== , locale =====*/){
|
||||
// summary:
|
||||
// Extension point so developers can subclass Calendar to
|
||||
// support multiple (concurrently) selected dates
|
||||
// dateObject: Date
|
||||
// locale: String?
|
||||
// tags:
|
||||
// protected extension
|
||||
return this._isValidDate(this.value) && !this.dateFuncObj.compare(dateObject, this.value, "date")
|
||||
},
|
||||
|
||||
isDisabledDate: function(/*===== dateObject, locale =====*/){
|
||||
// summary:
|
||||
// May be overridden to disable certain dates in the calendar e.g. `isDisabledDate=dojo.date.locale.isWeekend`
|
||||
// dateObject: Date
|
||||
// locale: String?
|
||||
// tags:
|
||||
// extension
|
||||
/*=====
|
||||
return false; // Boolean
|
||||
=====*/
|
||||
},
|
||||
|
||||
getClassForDate: function(/*===== dateObject, locale =====*/){
|
||||
// summary:
|
||||
// May be overridden to return CSS classes to associate with the date entry for the given dateObject,
|
||||
// for example to indicate a holiday in specified locale.
|
||||
// dateObject: Date
|
||||
// locale: String?
|
||||
// tags:
|
||||
// extension
|
||||
|
||||
/*=====
|
||||
return ""; // String
|
||||
=====*/
|
||||
}
|
||||
});
|
||||
|
||||
CalendarLite._MonthWidget = declare("dijit.CalendarLite._MonthWidget", _WidgetBase, {
|
||||
// summary:
|
||||
// Displays name of current month padded to the width of the month
|
||||
// w/the longest name, so that changing months doesn't change width.
|
||||
//
|
||||
// Create as new dijit.Calendar._MonthWidget({
|
||||
// lang: ...,
|
||||
// dateLocaleModule: ...
|
||||
// })
|
||||
|
||||
_setMonthAttr: function(month){
|
||||
// summary:
|
||||
// Set the current month to display as a label
|
||||
var monthNames = this.dateLocaleModule.getNames('months', 'wide', 'standAlone', this.lang, month),
|
||||
spacer =
|
||||
(has("ie") == 6 ? "" : "<div class='dijitSpacer'>" +
|
||||
array.map(monthNames, function(s){ return "<div>" + s + "</div>"; }).join("") + "</div>");
|
||||
|
||||
// Set name of current month and also fill in spacer element with all the month names
|
||||
// (invisible) so that the maximum width will affect layout. But not on IE6 because then
|
||||
// the center <TH> overlaps the right <TH> (due to a browser bug).
|
||||
this.domNode.innerHTML =
|
||||
spacer +
|
||||
"<div class='dijitCalendarMonthLabel dijitCalendarCurrentMonthLabel'>" +
|
||||
monthNames[month.getMonth()] + "</div>";
|
||||
}
|
||||
});
|
||||
|
||||
return CalendarLite;
|
||||
});
|
|
@ -1,16 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/CheckedMenuItem.html":"<tr class=\"dijitReset dijitMenuItem\" data-dojo-attach-point=\"focusNode\" role=\"menuitemcheckbox\" tabIndex=\"-1\"\n\t\tdata-dojo-attach-event=\"onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick\">\n\t<td class=\"dijitReset dijitMenuItemIconCell\" role=\"presentation\">\n\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitMenuItemIcon dijitCheckedMenuItemIcon\" data-dojo-attach-point=\"iconNode\"/>\n\t\t<span class=\"dijitCheckedMenuItemIconChar\">✓</span>\n\t</td>\n\t<td class=\"dijitReset dijitMenuItemLabel\" colspan=\"2\" data-dojo-attach-point=\"containerNode,labelNode\"></td>\n\t<td class=\"dijitReset dijitMenuItemAccelKey\" style=\"display: none\" data-dojo-attach-point=\"accelKeyNode\"></td>\n\t<td class=\"dijitReset dijitMenuArrowCell\" role=\"presentation\"> </td>\n</tr>\n"}});
|
||||
define("dijit/CheckedMenuItem",["dojo/_base/declare","dojo/dom-class","./MenuItem","dojo/text!./templates/CheckedMenuItem.html","./hccss"],function(_1,_2,_3,_4){
|
||||
return _1("dijit.CheckedMenuItem",_3,{templateString:_4,checked:false,_setCheckedAttr:function(_5){
|
||||
_2.toggle(this.domNode,"dijitCheckedMenuItemChecked",_5);
|
||||
this.domNode.setAttribute("aria-checked",_5);
|
||||
this._set("checked",_5);
|
||||
},iconClass:"",onChange:function(){
|
||||
},_onClick:function(e){
|
||||
if(!this.disabled){
|
||||
this.set("checked",!this.checked);
|
||||
this.onChange(this.checked);
|
||||
}
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
});
|
|
@ -1,60 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/CheckedMenuItem.html':"<tr class=\"dijitReset dijitMenuItem\" data-dojo-attach-point=\"focusNode\" role=\"menuitemcheckbox\" tabIndex=\"-1\"\n\t\tdata-dojo-attach-event=\"onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick\">\n\t<td class=\"dijitReset dijitMenuItemIconCell\" role=\"presentation\">\n\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitMenuItemIcon dijitCheckedMenuItemIcon\" data-dojo-attach-point=\"iconNode\"/>\n\t\t<span class=\"dijitCheckedMenuItemIconChar\">✓</span>\n\t</td>\n\t<td class=\"dijitReset dijitMenuItemLabel\" colspan=\"2\" data-dojo-attach-point=\"containerNode,labelNode\"></td>\n\t<td class=\"dijitReset dijitMenuItemAccelKey\" style=\"display: none\" data-dojo-attach-point=\"accelKeyNode\"></td>\n\t<td class=\"dijitReset dijitMenuArrowCell\" role=\"presentation\"> </td>\n</tr>\n"}});
|
||||
define("dijit/CheckedMenuItem", [
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-class", // domClass.toggle
|
||||
"./MenuItem",
|
||||
"dojo/text!./templates/CheckedMenuItem.html",
|
||||
"./hccss"
|
||||
], function(declare, domClass, MenuItem, template){
|
||||
|
||||
/*=====
|
||||
var MenuItem = dijit.MenuItem;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/CheckedMenuItem
|
||||
// summary:
|
||||
// A checkbox-like menu item for toggling on and off
|
||||
|
||||
return declare("dijit.CheckedMenuItem", MenuItem, {
|
||||
// summary:
|
||||
// A checkbox-like menu item for toggling on and off
|
||||
|
||||
templateString: template,
|
||||
|
||||
// checked: Boolean
|
||||
// Our checked state
|
||||
checked: false,
|
||||
_setCheckedAttr: function(/*Boolean*/ checked){
|
||||
// summary:
|
||||
// Hook so attr('checked', bool) works.
|
||||
// Sets the class and state for the check box.
|
||||
domClass.toggle(this.domNode, "dijitCheckedMenuItemChecked", checked);
|
||||
this.domNode.setAttribute("aria-checked", checked);
|
||||
this._set("checked", checked);
|
||||
},
|
||||
|
||||
iconClass: "", // override dijitNoIcon
|
||||
|
||||
onChange: function(/*Boolean*/ /*===== checked =====*/){
|
||||
// summary:
|
||||
// User defined function to handle check/uncheck events
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
|
||||
_onClick: function(/*Event*/ e){
|
||||
// summary:
|
||||
// Clicking this item just toggles its state
|
||||
// tags:
|
||||
// private
|
||||
if(!this.disabled){
|
||||
this.set("checked", !this.checked);
|
||||
this.onChange(this.checked);
|
||||
}
|
||||
this.inherited(arguments);
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,23 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/ColorPalette.html":"<div class=\"dijitInline dijitColorPalette\">\n\t<table dojoAttachPoint=\"paletteTableNode\" class=\"dijitPaletteTable\" cellSpacing=\"0\" cellPadding=\"0\" role=\"grid\">\n\t\t<tbody data-dojo-attach-point=\"gridNode\"></tbody>\n\t</table>\n</div>\n"}});
|
||||
define("dijit/ColorPalette",["require","dojo/text!./templates/ColorPalette.html","./_Widget","./_TemplatedMixin","./_PaletteMixin","dojo/i18n","dojo/_base/Color","dojo/_base/declare","dojo/dom-class","dojo/dom-construct","dojo/_base/window","dojo/string","dojo/i18n!dojo/nls/colors","dojo/colors"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c){
|
||||
var _d=_8("dijit.ColorPalette",[_3,_4,_5],{palette:"7x10",_palettes:{"7x10":[["white","seashell","cornsilk","lemonchiffon","lightyellow","palegreen","paleturquoise","lightcyan","lavender","plum"],["lightgray","pink","bisque","moccasin","khaki","lightgreen","lightseagreen","lightskyblue","cornflowerblue","violet"],["silver","lightcoral","sandybrown","orange","palegoldenrod","chartreuse","mediumturquoise","skyblue","mediumslateblue","orchid"],["gray","red","orangered","darkorange","yellow","limegreen","darkseagreen","royalblue","slateblue","mediumorchid"],["dimgray","crimson","chocolate","coral","gold","forestgreen","seagreen","blue","blueviolet","darkorchid"],["darkslategray","firebrick","saddlebrown","sienna","olive","green","darkcyan","mediumblue","darkslateblue","darkmagenta"],["black","darkred","maroon","brown","darkolivegreen","darkgreen","midnightblue","navy","indigo","purple"]],"3x4":[["white","lime","green","blue"],["silver","yellow","fuchsia","navy"],["gray","red","purple","black"]]},templateString:_2,baseClass:"dijitColorPalette",_dyeFactory:function(_e,_f,col){
|
||||
return new this._dyeClass(_e,_f,col);
|
||||
},buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
this._dyeClass=_8(_d._Color,{hc:_9.contains(_b.body(),"dijit_a11y"),palette:this.palette});
|
||||
this._preparePalette(this._palettes[this.palette],_6.getLocalization("dojo","colors",this.lang));
|
||||
}});
|
||||
_d._Color=_8("dijit._Color",_7,{template:"<span class='dijitInline dijitPaletteImg'>"+"<img src='${blankGif}' alt='${alt}' class='dijitColorPaletteSwatch' style='background-color: ${color}'/>"+"</span>",hcTemplate:"<span class='dijitInline dijitPaletteImg' style='position: relative; overflow: hidden; height: 12px; width: 14px;'>"+"<img src='${image}' alt='${alt}' style='position: absolute; left: ${left}px; top: ${top}px; ${size}'/>"+"</span>",_imagePaths:{"7x10":_1.toUrl("./themes/a11y/colors7x10.png"),"3x4":_1.toUrl("./themes/a11y/colors3x4.png")},constructor:function(_10,row,col){
|
||||
this._alias=_10;
|
||||
this._row=row;
|
||||
this._col=col;
|
||||
this.setColor(_7.named[_10]);
|
||||
},getValue:function(){
|
||||
return this.toHex();
|
||||
},fillCell:function(_11,_12){
|
||||
var _13=_c.substitute(this.hc?this.hcTemplate:this.template,{color:this.toHex(),blankGif:_12,alt:this._alias,image:this._imagePaths[this.palette].toString(),left:this._col*-20-5,top:this._row*-20-5,size:this.palette=="7x10"?"height: 145px; width: 206px":"height: 64px; width: 86px"});
|
||||
_a.place(_13,_11);
|
||||
}});
|
||||
return _d;
|
||||
});
|
|
@ -1,161 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/ColorPalette.html':"<div class=\"dijitInline dijitColorPalette\">\n\t<table dojoAttachPoint=\"paletteTableNode\" class=\"dijitPaletteTable\" cellSpacing=\"0\" cellPadding=\"0\" role=\"grid\">\n\t\t<tbody data-dojo-attach-point=\"gridNode\"></tbody>\n\t</table>\n</div>\n"}});
|
||||
define("dijit/ColorPalette", [
|
||||
"require", // require.toUrl
|
||||
"dojo/text!./templates/ColorPalette.html",
|
||||
"./_Widget",
|
||||
"./_TemplatedMixin",
|
||||
"./_PaletteMixin",
|
||||
"dojo/i18n", // i18n.getLocalization
|
||||
"dojo/_base/Color", // dojo.Color dojo.Color.named
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-class", // domClass.contains
|
||||
"dojo/dom-construct", // domConstruct.place
|
||||
"dojo/_base/window", // win.body
|
||||
"dojo/string", // string.substitute
|
||||
"dojo/i18n!dojo/nls/colors", // translations
|
||||
"dojo/colors" // extend dojo.Color w/names of other colors
|
||||
], function(require, template, _Widget, _TemplatedMixin, _PaletteMixin, i18n, Color,
|
||||
declare, domClass, domConstruct, win, string){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
var _PaletteMixin = dijit._PaletteMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/ColorPalette
|
||||
// summary:
|
||||
// A keyboard accessible color-picking widget
|
||||
|
||||
var ColorPalette = declare("dijit.ColorPalette", [_Widget, _TemplatedMixin, _PaletteMixin], {
|
||||
// summary:
|
||||
// A keyboard accessible color-picking widget
|
||||
// description:
|
||||
// Grid showing various colors, so the user can pick a certain color.
|
||||
// Can be used standalone, or as a popup.
|
||||
//
|
||||
// example:
|
||||
// | <div data-dojo-type="dijit.ColorPalette"></div>
|
||||
//
|
||||
// example:
|
||||
// | var picker = new dijit.ColorPalette({ },srcNode);
|
||||
// | picker.startup();
|
||||
|
||||
|
||||
// palette: [const] String
|
||||
// Size of grid, either "7x10" or "3x4".
|
||||
palette: "7x10",
|
||||
|
||||
// _palettes: [protected] Map
|
||||
// This represents the value of the colors.
|
||||
// The first level is a hashmap of the different palettes available.
|
||||
// The next two dimensions represent the columns and rows of colors.
|
||||
_palettes: {
|
||||
"7x10": [["white", "seashell", "cornsilk", "lemonchiffon","lightyellow", "palegreen", "paleturquoise", "lightcyan", "lavender", "plum"],
|
||||
["lightgray", "pink", "bisque", "moccasin", "khaki", "lightgreen", "lightseagreen", "lightskyblue", "cornflowerblue", "violet"],
|
||||
["silver", "lightcoral", "sandybrown", "orange", "palegoldenrod", "chartreuse", "mediumturquoise", "skyblue", "mediumslateblue","orchid"],
|
||||
["gray", "red", "orangered", "darkorange", "yellow", "limegreen", "darkseagreen", "royalblue", "slateblue", "mediumorchid"],
|
||||
["dimgray", "crimson", "chocolate", "coral", "gold", "forestgreen", "seagreen", "blue", "blueviolet", "darkorchid"],
|
||||
["darkslategray","firebrick","saddlebrown", "sienna", "olive", "green", "darkcyan", "mediumblue","darkslateblue", "darkmagenta" ],
|
||||
["black", "darkred", "maroon", "brown", "darkolivegreen", "darkgreen", "midnightblue", "navy", "indigo", "purple"]],
|
||||
|
||||
"3x4": [["white", "lime", "green", "blue"],
|
||||
["silver", "yellow", "fuchsia", "navy"],
|
||||
["gray", "red", "purple", "black"]]
|
||||
},
|
||||
|
||||
// templateString: String
|
||||
// The template of this widget.
|
||||
templateString: template,
|
||||
|
||||
baseClass: "dijitColorPalette",
|
||||
|
||||
_dyeFactory: function(value, row, col){
|
||||
// Overrides _PaletteMixin._dyeFactory().
|
||||
return new this._dyeClass(value, row, col);
|
||||
},
|
||||
|
||||
buildRendering: function(){
|
||||
// Instantiate the template, which makes a skeleton into which we'll insert a bunch of
|
||||
// <img> nodes
|
||||
this.inherited(arguments);
|
||||
|
||||
// Creates customized constructor for dye class (color of a single cell) for
|
||||
// specified palette and high-contrast vs. normal mode. Used in _getDye().
|
||||
this._dyeClass = declare(ColorPalette._Color, {
|
||||
hc: domClass.contains(win.body(), "dijit_a11y"),
|
||||
palette: this.palette
|
||||
});
|
||||
|
||||
// Creates <img> nodes in each cell of the template.
|
||||
this._preparePalette(
|
||||
this._palettes[this.palette],
|
||||
i18n.getLocalization("dojo", "colors", this.lang));
|
||||
}
|
||||
});
|
||||
|
||||
ColorPalette._Color = declare("dijit._Color", Color, {
|
||||
// summary:
|
||||
// Object associated with each cell in a ColorPalette palette.
|
||||
// Implements dijit.Dye.
|
||||
|
||||
// Template for each cell in normal (non-high-contrast mode). Each cell contains a wrapper
|
||||
// node for showing the border (called dijitPaletteImg for back-compat), and dijitColorPaletteSwatch
|
||||
// for showing the color.
|
||||
template:
|
||||
"<span class='dijitInline dijitPaletteImg'>" +
|
||||
"<img src='${blankGif}' alt='${alt}' class='dijitColorPaletteSwatch' style='background-color: ${color}'/>" +
|
||||
"</span>",
|
||||
|
||||
// Template for each cell in high contrast mode. Each cell contains an image with the whole palette,
|
||||
// but scrolled and clipped to show the correct color only
|
||||
hcTemplate:
|
||||
"<span class='dijitInline dijitPaletteImg' style='position: relative; overflow: hidden; height: 12px; width: 14px;'>" +
|
||||
"<img src='${image}' alt='${alt}' style='position: absolute; left: ${left}px; top: ${top}px; ${size}'/>" +
|
||||
"</span>",
|
||||
|
||||
// _imagePaths: [protected] Map
|
||||
// This is stores the path to the palette images used for high-contrast mode display
|
||||
_imagePaths: {
|
||||
"7x10": require.toUrl("./themes/a11y/colors7x10.png"),
|
||||
"3x4": require.toUrl("./themes/a11y/colors3x4.png")
|
||||
},
|
||||
|
||||
constructor: function(/*String*/alias, /*Number*/ row, /*Number*/ col){
|
||||
this._alias = alias;
|
||||
this._row = row;
|
||||
this._col = col;
|
||||
this.setColor(Color.named[alias]);
|
||||
},
|
||||
|
||||
getValue: function(){
|
||||
// summary:
|
||||
// Note that although dijit._Color is initialized with a value like "white" getValue() always
|
||||
// returns a hex value
|
||||
return this.toHex();
|
||||
},
|
||||
|
||||
fillCell: function(/*DOMNode*/ cell, /*String*/ blankGif){
|
||||
var html = string.substitute(this.hc ? this.hcTemplate : this.template, {
|
||||
// substitution variables for normal mode
|
||||
color: this.toHex(),
|
||||
blankGif: blankGif,
|
||||
alt: this._alias,
|
||||
|
||||
// variables used for high contrast mode
|
||||
image: this._imagePaths[this.palette].toString(),
|
||||
left: this._col * -20 - 5,
|
||||
top: this._row * -20 - 5,
|
||||
size: this.palette == "7x10" ? "height: 145px; width: 206px" : "height: 64px; width: 86px"
|
||||
});
|
||||
|
||||
domConstruct.place(html, cell);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return ColorPalette;
|
||||
});
|
|
@ -1,25 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/Declaration",["dojo/_base/array","dojo/_base/connect","dojo/_base/declare","dojo/_base/lang","dojo/parser","dojo/query","./_Widget","./_TemplatedMixin","./_WidgetsInTemplateMixin","dojo/NodeList-dom"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9){
|
||||
return _3("dijit.Declaration",_7,{_noScript:true,stopParser:true,widgetClass:"",defaults:null,mixins:[],buildRendering:function(){
|
||||
var _a=this.srcNodeRef.parentNode.removeChild(this.srcNodeRef),_b=_6("> script[type^='dojo/method']",_a).orphan(),_c=_6("> script[type^='dojo/connect']",_a).orphan(),_d=_a.nodeName;
|
||||
var _e=this.defaults||{};
|
||||
_1.forEach(_b,function(s){
|
||||
var _f=s.getAttribute("event")||s.getAttribute("data-dojo-event"),_10=_5._functionFromScript(s);
|
||||
if(_f){
|
||||
_e[_f]=_10;
|
||||
}else{
|
||||
_c.push(s);
|
||||
}
|
||||
});
|
||||
this.mixins=this.mixins.length?_1.map(this.mixins,function(_11){
|
||||
return _4.getObject(_11);
|
||||
}):[_7,_8,_9];
|
||||
_e._skipNodeCache=true;
|
||||
_e.templateString="<"+_d+" class='"+_a.className+"'"+" data-dojo-attach-point='"+(_a.getAttribute("data-dojo-attach-point")||_a.getAttribute("dojoAttachPoint")||"")+"' data-dojo-attach-event='"+(_a.getAttribute("data-dojo-attach-event")||_a.getAttribute("dojoAttachEvent")||"")+"' >"+_a.innerHTML.replace(/\%7B/g,"{").replace(/\%7D/g,"}")+"</"+_d+">";
|
||||
var wc=_3(this.widgetClass,this.mixins,_e);
|
||||
_1.forEach(_c,function(s){
|
||||
var evt=s.getAttribute("event")||s.getAttribute("data-dojo-event")||"postscript",_12=_5._functionFromScript(s);
|
||||
_2.connect(wc.prototype,evt,_12);
|
||||
});
|
||||
}});
|
||||
});
|
|
@ -1,113 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/Declaration", [
|
||||
"dojo/_base/array", // array.forEach array.map
|
||||
"dojo/_base/connect", // connect.connect
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/lang", // lang.getObject
|
||||
"dojo/parser", // parser._functionFromScript
|
||||
"dojo/query", // query
|
||||
"./_Widget",
|
||||
"./_TemplatedMixin",
|
||||
"./_WidgetsInTemplateMixin",
|
||||
"dojo/NodeList-dom"
|
||||
], function(array, connect, declare, lang, parser, query, _Widget, _TemplatedMixin, _WidgetsInTemplateMixin){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
var _WidgetsInTemplateMixin = dijit._WidgetsInTemplateMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/Declaration
|
||||
// summary:
|
||||
// The Declaration widget allows a developer to declare new widget
|
||||
// classes directly from a snippet of markup.
|
||||
|
||||
return declare("dijit.Declaration", _Widget, {
|
||||
// summary:
|
||||
// The Declaration widget allows a developer to declare new widget
|
||||
// classes directly from a snippet of markup.
|
||||
|
||||
// _noScript: [private] Boolean
|
||||
// Flag to parser to leave alone the script tags contained inside of me
|
||||
_noScript: true,
|
||||
|
||||
// stopParser: [private] Boolean
|
||||
// Flag to parser to not try and parse widgets declared inside of me
|
||||
stopParser: true,
|
||||
|
||||
// widgetClass: [const] String
|
||||
// Name of class being declared, ex: "acme.myWidget"
|
||||
widgetClass: "",
|
||||
|
||||
// propList: [const] Object
|
||||
// Set of attributes for this widget along with default values, ex:
|
||||
// {delay: 100, title: "hello world"}
|
||||
defaults: null,
|
||||
|
||||
// mixins: [const] String[]
|
||||
// List containing the prototype for this widget, and also any mixins,
|
||||
// ex: ["dijit._Widget", "dijit._Container"]
|
||||
mixins: [],
|
||||
|
||||
buildRendering: function(){
|
||||
var src = this.srcNodeRef.parentNode.removeChild(this.srcNodeRef),
|
||||
methods = query("> script[type^='dojo/method']", src).orphan(),
|
||||
connects = query("> script[type^='dojo/connect']", src).orphan(),
|
||||
srcType = src.nodeName;
|
||||
|
||||
var propList = this.defaults || {};
|
||||
|
||||
// For all methods defined like <script type="dojo/method" data-dojo-event="foo">,
|
||||
// add that method to prototype.
|
||||
// If there's no "event" specified then it's code to run on instantiation,
|
||||
// so it becomes a connection to "postscript" (handled below).
|
||||
array.forEach(methods, function(s){
|
||||
var evt = s.getAttribute("event") || s.getAttribute("data-dojo-event"),
|
||||
func = parser._functionFromScript(s);
|
||||
if(evt){
|
||||
propList[evt] = func;
|
||||
}else{
|
||||
connects.push(s);
|
||||
}
|
||||
});
|
||||
|
||||
// map array of strings like [ "dijit.form.Button" ] to array of mixin objects
|
||||
// (note that array.map(this.mixins, lang.getObject) doesn't work because it passes
|
||||
// a bogus third argument to getObject(), confusing it)
|
||||
this.mixins = this.mixins.length ?
|
||||
array.map(this.mixins, function(name){ return lang.getObject(name); } ) :
|
||||
[ _Widget, _TemplatedMixin, _WidgetsInTemplateMixin ];
|
||||
|
||||
propList._skipNodeCache = true;
|
||||
propList.templateString =
|
||||
"<"+srcType+" class='"+src.className+"'" +
|
||||
" data-dojo-attach-point='"+
|
||||
(src.getAttribute("data-dojo-attach-point") || src.getAttribute("dojoAttachPoint") || '')+
|
||||
"' data-dojo-attach-event='"+
|
||||
(src.getAttribute("data-dojo-attach-event") || src.getAttribute("dojoAttachEvent") || '')+
|
||||
"' >"+src.innerHTML.replace(/\%7B/g,"{").replace(/\%7D/g,"}")+"</"+srcType+">";
|
||||
|
||||
// create the new widget class
|
||||
var wc = declare(
|
||||
this.widgetClass,
|
||||
this.mixins,
|
||||
propList
|
||||
);
|
||||
|
||||
// Handle <script> blocks of form:
|
||||
// <script type="dojo/connect" data-dojo-event="foo">
|
||||
// and
|
||||
// <script type="dojo/method">
|
||||
// (Note that the second one is just shorthand for a dojo/connect to postscript)
|
||||
// Since this is a connect in the declaration, we are actually connection to the method
|
||||
// in the _prototype_.
|
||||
array.forEach(connects, function(s){
|
||||
var evt = s.getAttribute("event") || s.getAttribute("data-dojo-event") || "postscript",
|
||||
func = parser._functionFromScript(s);
|
||||
connect.connect(wc.prototype, evt, func);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,269 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/Dialog.html":"<div class=\"dijitDialog\" role=\"dialog\" aria-labelledby=\"${id}_title\">\n\t<div data-dojo-attach-point=\"titleBar\" class=\"dijitDialogTitleBar\">\n\t<span data-dojo-attach-point=\"titleNode\" class=\"dijitDialogTitle\" id=\"${id}_title\"></span>\n\t<span data-dojo-attach-point=\"closeButtonNode\" class=\"dijitDialogCloseIcon\" data-dojo-attach-event=\"ondijitclick: onCancel\" title=\"${buttonCancel}\" role=\"button\" tabIndex=\"-1\">\n\t\t<span data-dojo-attach-point=\"closeText\" class=\"closeText\" title=\"${buttonCancel}\">x</span>\n\t</span>\n\t</div>\n\t\t<div data-dojo-attach-point=\"containerNode\" class=\"dijitDialogPaneContent\"></div>\n</div>\n"}});
|
||||
define("dijit/Dialog",["require","dojo/_base/array","dojo/_base/connect","dojo/_base/declare","dojo/_base/Deferred","dojo/dom","dojo/dom-class","dojo/dom-geometry","dojo/dom-style","dojo/_base/event","dojo/_base/fx","dojo/i18n","dojo/_base/kernel","dojo/keys","dojo/_base/lang","dojo/on","dojo/ready","dojo/_base/sniff","dojo/_base/window","dojo/window","dojo/dnd/Moveable","dojo/dnd/TimedMoveable","./focus","./_base/manager","./_Widget","./_TemplatedMixin","./_CssStateMixin","./form/_FormMixin","./_DialogMixin","./DialogUnderlay","./layout/ContentPane","dojo/text!./templates/Dialog.html",".","dojo/i18n!./nls/common"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,fx,_b,_c,_d,_e,on,_f,has,win,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_1a,_1b,_1c,_1d){
|
||||
var _1e=_4("dijit._DialogBase",[_16,_18,_19,_17],{templateString:_1c,baseClass:"dijitDialog",cssStateNodes:{closeButtonNode:"dijitDialogCloseIcon"},_setTitleAttr:[{node:"titleNode",type:"innerHTML"},{node:"titleBar",type:"attribute"}],open:false,duration:_14.defaultDuration,refocus:true,autofocus:true,_firstFocusItem:null,_lastFocusItem:null,doLayout:false,draggable:true,"aria-describedby":"",postMixInProperties:function(){
|
||||
var _1f=_b.getLocalization("dijit","common");
|
||||
_e.mixin(this,_1f);
|
||||
this.inherited(arguments);
|
||||
},postCreate:function(){
|
||||
_9.set(this.domNode,{display:"none",position:"absolute"});
|
||||
win.body().appendChild(this.domNode);
|
||||
this.inherited(arguments);
|
||||
this.connect(this,"onExecute","hide");
|
||||
this.connect(this,"onCancel","hide");
|
||||
this._modalconnects=[];
|
||||
},onLoad:function(){
|
||||
this._position();
|
||||
if(this.autofocus&&_20.isTop(this)){
|
||||
this._getFocusItems(this.domNode);
|
||||
_13.focus(this._firstFocusItem);
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},_endDrag:function(){
|
||||
var _21=_8.position(this.domNode),_22=_10.getBox();
|
||||
_21.y=Math.min(Math.max(_21.y,0),(_22.h-_21.h));
|
||||
_21.x=Math.min(Math.max(_21.x,0),(_22.w-_21.w));
|
||||
this._relativePosition=_21;
|
||||
this._position();
|
||||
},_setup:function(){
|
||||
var _23=this.domNode;
|
||||
if(this.titleBar&&this.draggable){
|
||||
this._moveable=new ((has("ie")==6)?_12:_11)(_23,{handle:this.titleBar});
|
||||
this.connect(this._moveable,"onMoveStop","_endDrag");
|
||||
}else{
|
||||
_7.add(_23,"dijitDialogFixed");
|
||||
}
|
||||
this.underlayAttrs={dialogId:this.id,"class":_2.map(this["class"].split(/\s/),function(s){
|
||||
return s+"_underlay";
|
||||
}).join(" ")};
|
||||
},_size:function(){
|
||||
this._checkIfSingleChild();
|
||||
if(this._singleChild){
|
||||
if(this._singleChildOriginalStyle){
|
||||
this._singleChild.domNode.style.cssText=this._singleChildOriginalStyle;
|
||||
}
|
||||
delete this._singleChildOriginalStyle;
|
||||
}else{
|
||||
_9.set(this.containerNode,{width:"auto",height:"auto"});
|
||||
}
|
||||
var bb=_8.position(this.domNode);
|
||||
var _24=_10.getBox();
|
||||
if(bb.w>=_24.w||bb.h>=_24.h){
|
||||
var w=Math.min(bb.w,Math.floor(_24.w*0.75)),h=Math.min(bb.h,Math.floor(_24.h*0.75));
|
||||
if(this._singleChild&&this._singleChild.resize){
|
||||
this._singleChildOriginalStyle=this._singleChild.domNode.style.cssText;
|
||||
this._singleChild.resize({w:w,h:h});
|
||||
}else{
|
||||
_9.set(this.containerNode,{width:w+"px",height:h+"px",overflow:"auto",position:"relative"});
|
||||
}
|
||||
}else{
|
||||
if(this._singleChild&&this._singleChild.resize){
|
||||
this._singleChild.resize();
|
||||
}
|
||||
}
|
||||
},_position:function(){
|
||||
if(!_7.contains(win.body(),"dojoMove")){
|
||||
var _25=this.domNode,_26=_10.getBox(),p=this._relativePosition,bb=p?null:_8.position(_25),l=Math.floor(_26.l+(p?p.x:(_26.w-bb.w)/2)),t=Math.floor(_26.t+(p?p.y:(_26.h-bb.h)/2));
|
||||
_9.set(_25,{left:l+"px",top:t+"px"});
|
||||
}
|
||||
},_onKey:function(evt){
|
||||
if(evt.charOrCode){
|
||||
var _27=evt.target;
|
||||
if(evt.charOrCode===_d.TAB){
|
||||
this._getFocusItems(this.domNode);
|
||||
}
|
||||
var _28=(this._firstFocusItem==this._lastFocusItem);
|
||||
if(_27==this._firstFocusItem&&evt.shiftKey&&evt.charOrCode===_d.TAB){
|
||||
if(!_28){
|
||||
_13.focus(this._lastFocusItem);
|
||||
}
|
||||
_a.stop(evt);
|
||||
}else{
|
||||
if(_27==this._lastFocusItem&&evt.charOrCode===_d.TAB&&!evt.shiftKey){
|
||||
if(!_28){
|
||||
_13.focus(this._firstFocusItem);
|
||||
}
|
||||
_a.stop(evt);
|
||||
}else{
|
||||
while(_27){
|
||||
if(_27==this.domNode||_7.contains(_27,"dijitPopup")){
|
||||
if(evt.charOrCode==_d.ESCAPE){
|
||||
this.onCancel();
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
}
|
||||
_27=_27.parentNode;
|
||||
}
|
||||
if(evt.charOrCode!==_d.TAB){
|
||||
_a.stop(evt);
|
||||
}else{
|
||||
if(!has("opera")){
|
||||
try{
|
||||
this._firstFocusItem.focus();
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},show:function(){
|
||||
if(this.open){
|
||||
return;
|
||||
}
|
||||
if(!this._started){
|
||||
this.startup();
|
||||
}
|
||||
if(!this._alreadyInitialized){
|
||||
this._setup();
|
||||
this._alreadyInitialized=true;
|
||||
}
|
||||
if(this._fadeOutDeferred){
|
||||
this._fadeOutDeferred.cancel();
|
||||
}
|
||||
this._modalconnects.push(on(window,"scroll",_e.hitch(this,"layout")));
|
||||
this._modalconnects.push(on(window,"resize",_e.hitch(this,function(){
|
||||
var _29=_10.getBox();
|
||||
if(!this._oldViewport||_29.h!=this._oldViewport.h||_29.w!=this._oldViewport.w){
|
||||
this.layout();
|
||||
this._oldViewport=_29;
|
||||
}
|
||||
})));
|
||||
this._modalconnects.push(on(this.domNode,_3._keypress,_e.hitch(this,"_onKey")));
|
||||
_9.set(this.domNode,{opacity:0,display:""});
|
||||
this._set("open",true);
|
||||
this._onShow();
|
||||
this._size();
|
||||
this._position();
|
||||
var _2a;
|
||||
this._fadeInDeferred=new _5(_e.hitch(this,function(){
|
||||
_2a.stop();
|
||||
delete this._fadeInDeferred;
|
||||
}));
|
||||
_2a=fx.fadeIn({node:this.domNode,duration:this.duration,beforeBegin:_e.hitch(this,function(){
|
||||
_20.show(this,this.underlayAttrs);
|
||||
}),onEnd:_e.hitch(this,function(){
|
||||
if(this.autofocus&&_20.isTop(this)){
|
||||
this._getFocusItems(this.domNode);
|
||||
_13.focus(this._firstFocusItem);
|
||||
}
|
||||
this._fadeInDeferred.callback(true);
|
||||
delete this._fadeInDeferred;
|
||||
})}).play();
|
||||
return this._fadeInDeferred;
|
||||
},hide:function(){
|
||||
if(!this._alreadyInitialized){
|
||||
return;
|
||||
}
|
||||
if(this._fadeInDeferred){
|
||||
this._fadeInDeferred.cancel();
|
||||
}
|
||||
var _2b;
|
||||
this._fadeOutDeferred=new _5(_e.hitch(this,function(){
|
||||
_2b.stop();
|
||||
delete this._fadeOutDeferred;
|
||||
}));
|
||||
this._fadeOutDeferred.then(_e.hitch(this,"onHide"));
|
||||
_2b=fx.fadeOut({node:this.domNode,duration:this.duration,onEnd:_e.hitch(this,function(){
|
||||
this.domNode.style.display="none";
|
||||
_20.hide(this);
|
||||
this._fadeOutDeferred.callback(true);
|
||||
delete this._fadeOutDeferred;
|
||||
})}).play();
|
||||
if(this._scrollConnected){
|
||||
this._scrollConnected=false;
|
||||
}
|
||||
var h;
|
||||
while(h=this._modalconnects.pop()){
|
||||
h.remove();
|
||||
}
|
||||
if(this._relativePosition){
|
||||
delete this._relativePosition;
|
||||
}
|
||||
this._set("open",false);
|
||||
return this._fadeOutDeferred;
|
||||
},layout:function(){
|
||||
if(this.domNode.style.display!="none"){
|
||||
if(_1d._underlay){
|
||||
_1d._underlay.layout();
|
||||
}
|
||||
this._position();
|
||||
}
|
||||
},destroy:function(){
|
||||
if(this._fadeInDeferred){
|
||||
this._fadeInDeferred.cancel();
|
||||
}
|
||||
if(this._fadeOutDeferred){
|
||||
this._fadeOutDeferred.cancel();
|
||||
}
|
||||
if(this._moveable){
|
||||
this._moveable.destroy();
|
||||
}
|
||||
var h;
|
||||
while(h=this._modalconnects.pop()){
|
||||
h.remove();
|
||||
}
|
||||
_20.hide(this);
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
var _2c=_4("dijit.Dialog",[_1b,_1e],{});
|
||||
_2c._DialogBase=_1e;
|
||||
var _20=_2c._DialogLevelManager={_beginZIndex:950,show:function(_2d,_2e){
|
||||
ds[ds.length-1].focus=_13.curNode;
|
||||
var _2f=_1d._underlay;
|
||||
if(!_2f||_2f._destroyed){
|
||||
_2f=_1d._underlay=new _1a(_2e);
|
||||
}else{
|
||||
_2f.set(_2d.underlayAttrs);
|
||||
}
|
||||
var _30=ds[ds.length-1].dialog?ds[ds.length-1].zIndex+2:_2c._DialogLevelManager._beginZIndex;
|
||||
if(ds.length==1){
|
||||
_2f.show();
|
||||
}
|
||||
_9.set(_1d._underlay.domNode,"zIndex",_30-1);
|
||||
_9.set(_2d.domNode,"zIndex",_30);
|
||||
ds.push({dialog:_2d,underlayAttrs:_2e,zIndex:_30});
|
||||
},hide:function(_31){
|
||||
if(ds[ds.length-1].dialog==_31){
|
||||
ds.pop();
|
||||
var pd=ds[ds.length-1];
|
||||
if(ds.length==1){
|
||||
if(!_1d._underlay._destroyed){
|
||||
_1d._underlay.hide();
|
||||
}
|
||||
}else{
|
||||
_9.set(_1d._underlay.domNode,"zIndex",pd.zIndex-1);
|
||||
_1d._underlay.set(pd.underlayAttrs);
|
||||
}
|
||||
if(_31.refocus){
|
||||
var _32=pd.focus;
|
||||
if(pd.dialog&&(!_32||!_6.isDescendant(_32,pd.dialog.domNode))){
|
||||
pd.dialog._getFocusItems(pd.dialog.domNode);
|
||||
_32=pd.dialog._firstFocusItem;
|
||||
}
|
||||
if(_32){
|
||||
_32.focus();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
var idx=_2.indexOf(_2.map(ds,function(_33){
|
||||
return _33.dialog;
|
||||
}),_31);
|
||||
if(idx!=-1){
|
||||
ds.splice(idx,1);
|
||||
}
|
||||
}
|
||||
},isTop:function(_34){
|
||||
return ds[ds.length-1].dialog==_34;
|
||||
}};
|
||||
var ds=_2c._dialogStack=[{dialog:null,focus:null,underlayAttrs:null}];
|
||||
if(!_c.isAsync){
|
||||
_f(0,function(){
|
||||
var _35=["dijit/TooltipDialog"];
|
||||
_1(_35);
|
||||
});
|
||||
}
|
||||
return _2c;
|
||||
});
|
|
@ -1,639 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/Dialog.html':"<div class=\"dijitDialog\" role=\"dialog\" aria-labelledby=\"${id}_title\">\n\t<div data-dojo-attach-point=\"titleBar\" class=\"dijitDialogTitleBar\">\n\t<span data-dojo-attach-point=\"titleNode\" class=\"dijitDialogTitle\" id=\"${id}_title\"></span>\n\t<span data-dojo-attach-point=\"closeButtonNode\" class=\"dijitDialogCloseIcon\" data-dojo-attach-event=\"ondijitclick: onCancel\" title=\"${buttonCancel}\" role=\"button\" tabIndex=\"-1\">\n\t\t<span data-dojo-attach-point=\"closeText\" class=\"closeText\" title=\"${buttonCancel}\">x</span>\n\t</span>\n\t</div>\n\t\t<div data-dojo-attach-point=\"containerNode\" class=\"dijitDialogPaneContent\"></div>\n</div>\n"}});
|
||||
define("dijit/Dialog", [
|
||||
"require",
|
||||
"dojo/_base/array", // array.forEach array.indexOf array.map
|
||||
"dojo/_base/connect", // connect._keypress
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/Deferred", // Deferred
|
||||
"dojo/dom", // dom.isDescendant
|
||||
"dojo/dom-class", // domClass.add domClass.contains
|
||||
"dojo/dom-geometry", // domGeometry.position
|
||||
"dojo/dom-style", // domStyle.set
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/_base/fx", // fx.fadeIn fx.fadeOut
|
||||
"dojo/i18n", // i18n.getLocalization
|
||||
"dojo/_base/kernel", // kernel.isAsync
|
||||
"dojo/keys",
|
||||
"dojo/_base/lang", // lang.mixin lang.hitch
|
||||
"dojo/on",
|
||||
"dojo/ready",
|
||||
"dojo/_base/sniff", // has("ie") has("opera")
|
||||
"dojo/_base/window", // win.body
|
||||
"dojo/window", // winUtils.getBox
|
||||
"dojo/dnd/Moveable", // Moveable
|
||||
"dojo/dnd/TimedMoveable", // TimedMoveable
|
||||
"./focus",
|
||||
"./_base/manager", // manager.defaultDuration
|
||||
"./_Widget",
|
||||
"./_TemplatedMixin",
|
||||
"./_CssStateMixin",
|
||||
"./form/_FormMixin",
|
||||
"./_DialogMixin",
|
||||
"./DialogUnderlay",
|
||||
"./layout/ContentPane",
|
||||
"dojo/text!./templates/Dialog.html",
|
||||
".", // for back-compat, exporting dijit._underlay (remove in 2.0)
|
||||
"dojo/i18n!./nls/common"
|
||||
], function(require, array, connect, declare, Deferred,
|
||||
dom, domClass, domGeometry, domStyle, event, fx, i18n, kernel, keys, lang, on, ready, has, win, winUtils,
|
||||
Moveable, TimedMoveable, focus, manager, _Widget, _TemplatedMixin, _CssStateMixin, _FormMixin, _DialogMixin,
|
||||
DialogUnderlay, ContentPane, template, dijit){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
var _CssStateMixin = dijit._CssStateMixin;
|
||||
var _FormMixin = dijit.form._FormMixin;
|
||||
var _DialogMixin = dijit._DialogMixin;
|
||||
=====*/
|
||||
|
||||
|
||||
// module:
|
||||
// dijit/Dialog
|
||||
// summary:
|
||||
// A modal dialog Widget
|
||||
|
||||
|
||||
/*=====
|
||||
dijit._underlay = function(kwArgs){
|
||||
// summary:
|
||||
// A shared instance of a `dijit.DialogUnderlay`
|
||||
//
|
||||
// description:
|
||||
// A shared instance of a `dijit.DialogUnderlay` created and
|
||||
// used by `dijit.Dialog`, though never created until some Dialog
|
||||
// or subclass thereof is shown.
|
||||
};
|
||||
=====*/
|
||||
|
||||
var _DialogBase = declare("dijit._DialogBase", [_TemplatedMixin, _FormMixin, _DialogMixin, _CssStateMixin], {
|
||||
// summary:
|
||||
// A modal dialog Widget
|
||||
//
|
||||
// description:
|
||||
// Pops up a modal dialog window, blocking access to the screen
|
||||
// and also graying out the screen Dialog is extended from
|
||||
// ContentPane so it supports all the same parameters (href, etc.)
|
||||
//
|
||||
// example:
|
||||
// | <div data-dojo-type="dijit.Dialog" data-dojo-props="href: 'test.html'"></div>
|
||||
//
|
||||
// example:
|
||||
// | var foo = new dijit.Dialog({ title: "test dialog", content: "test content" };
|
||||
// | dojo.body().appendChild(foo.domNode);
|
||||
// | foo.startup();
|
||||
|
||||
templateString: template,
|
||||
|
||||
baseClass: "dijitDialog",
|
||||
|
||||
cssStateNodes: {
|
||||
closeButtonNode: "dijitDialogCloseIcon"
|
||||
},
|
||||
|
||||
// Map widget attributes to DOMNode attributes.
|
||||
_setTitleAttr: [
|
||||
{ node: "titleNode", type: "innerHTML" },
|
||||
{ node: "titleBar", type: "attribute" }
|
||||
],
|
||||
|
||||
// open: [readonly] Boolean
|
||||
// True if Dialog is currently displayed on screen.
|
||||
open: false,
|
||||
|
||||
// duration: Integer
|
||||
// The time in milliseconds it takes the dialog to fade in and out
|
||||
duration: manager.defaultDuration,
|
||||
|
||||
// refocus: Boolean
|
||||
// A Toggle to modify the default focus behavior of a Dialog, which
|
||||
// is to re-focus the element which had focus before being opened.
|
||||
// False will disable refocusing. Default: true
|
||||
refocus: true,
|
||||
|
||||
// autofocus: Boolean
|
||||
// A Toggle to modify the default focus behavior of a Dialog, which
|
||||
// is to focus on the first dialog element after opening the dialog.
|
||||
// False will disable autofocusing. Default: true
|
||||
autofocus: true,
|
||||
|
||||
// _firstFocusItem: [private readonly] DomNode
|
||||
// The pointer to the first focusable node in the dialog.
|
||||
// Set by `dijit._DialogMixin._getFocusItems`.
|
||||
_firstFocusItem: null,
|
||||
|
||||
// _lastFocusItem: [private readonly] DomNode
|
||||
// The pointer to which node has focus prior to our dialog.
|
||||
// Set by `dijit._DialogMixin._getFocusItems`.
|
||||
_lastFocusItem: null,
|
||||
|
||||
// doLayout: [protected] Boolean
|
||||
// Don't change this parameter from the default value.
|
||||
// This ContentPane parameter doesn't make sense for Dialog, since Dialog
|
||||
// is never a child of a layout container, nor can you specify the size of
|
||||
// Dialog in order to control the size of an inner widget.
|
||||
doLayout: false,
|
||||
|
||||
// draggable: Boolean
|
||||
// Toggles the moveable aspect of the Dialog. If true, Dialog
|
||||
// can be dragged by it's title. If false it will remain centered
|
||||
// in the viewport.
|
||||
draggable: true,
|
||||
|
||||
//aria-describedby: String
|
||||
// Allows the user to add an aria-describedby attribute onto the dialog. The value should
|
||||
// be the id of the container element of text that describes the dialog purpose (usually
|
||||
// the first text in the dialog).
|
||||
// <div data-dojo-type="dijit.Dialog" aria-describedby="intro" .....>
|
||||
// <div id="intro">Introductory text</div>
|
||||
// <div>rest of dialog contents</div>
|
||||
// </div>
|
||||
"aria-describedby":"",
|
||||
|
||||
postMixInProperties: function(){
|
||||
var _nlsResources = i18n.getLocalization("dijit", "common");
|
||||
lang.mixin(this, _nlsResources);
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
domStyle.set(this.domNode, {
|
||||
display: "none",
|
||||
position:"absolute"
|
||||
});
|
||||
win.body().appendChild(this.domNode);
|
||||
|
||||
this.inherited(arguments);
|
||||
|
||||
this.connect(this, "onExecute", "hide");
|
||||
this.connect(this, "onCancel", "hide");
|
||||
this._modalconnects = [];
|
||||
},
|
||||
|
||||
onLoad: function(){
|
||||
// summary:
|
||||
// Called when data has been loaded from an href.
|
||||
// Unlike most other callbacks, this function can be connected to (via `dojo.connect`)
|
||||
// but should *not* be overridden.
|
||||
// tags:
|
||||
// callback
|
||||
|
||||
// when href is specified we need to reposition the dialog after the data is loaded
|
||||
// and find the focusable elements
|
||||
this._position();
|
||||
if(this.autofocus && DialogLevelManager.isTop(this)){
|
||||
this._getFocusItems(this.domNode);
|
||||
focus.focus(this._firstFocusItem);
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
_endDrag: function(){
|
||||
// summary:
|
||||
// Called after dragging the Dialog. Saves the position of the dialog in the viewport,
|
||||
// and also adjust position to be fully within the viewport, so user doesn't lose access to handle
|
||||
var nodePosition = domGeometry.position(this.domNode),
|
||||
viewport = winUtils.getBox();
|
||||
nodePosition.y = Math.min(Math.max(nodePosition.y, 0), (viewport.h - nodePosition.h));
|
||||
nodePosition.x = Math.min(Math.max(nodePosition.x, 0), (viewport.w - nodePosition.w));
|
||||
this._relativePosition = nodePosition;
|
||||
this._position();
|
||||
},
|
||||
|
||||
_setup: function(){
|
||||
// summary:
|
||||
// Stuff we need to do before showing the Dialog for the first
|
||||
// time (but we defer it until right beforehand, for
|
||||
// performance reasons).
|
||||
// tags:
|
||||
// private
|
||||
|
||||
var node = this.domNode;
|
||||
|
||||
if(this.titleBar && this.draggable){
|
||||
this._moveable = new ((has("ie") == 6) ? TimedMoveable // prevent overload, see #5285
|
||||
: Moveable)(node, { handle: this.titleBar });
|
||||
this.connect(this._moveable, "onMoveStop", "_endDrag");
|
||||
}else{
|
||||
domClass.add(node,"dijitDialogFixed");
|
||||
}
|
||||
|
||||
this.underlayAttrs = {
|
||||
dialogId: this.id,
|
||||
"class": array.map(this["class"].split(/\s/), function(s){ return s+"_underlay"; }).join(" ")
|
||||
};
|
||||
},
|
||||
|
||||
_size: function(){
|
||||
// summary:
|
||||
// If necessary, shrink dialog contents so dialog fits in viewport
|
||||
// tags:
|
||||
// private
|
||||
|
||||
this._checkIfSingleChild();
|
||||
|
||||
// If we resized the dialog contents earlier, reset them back to original size, so
|
||||
// that if the user later increases the viewport size, the dialog can display w/out a scrollbar.
|
||||
// Need to do this before the domGeometry.position(this.domNode) call below.
|
||||
if(this._singleChild){
|
||||
if(this._singleChildOriginalStyle){
|
||||
this._singleChild.domNode.style.cssText = this._singleChildOriginalStyle;
|
||||
}
|
||||
delete this._singleChildOriginalStyle;
|
||||
}else{
|
||||
domStyle.set(this.containerNode, {
|
||||
width:"auto",
|
||||
height:"auto"
|
||||
});
|
||||
}
|
||||
|
||||
var bb = domGeometry.position(this.domNode);
|
||||
var viewport = winUtils.getBox();
|
||||
if(bb.w >= viewport.w || bb.h >= viewport.h){
|
||||
// Reduce size of dialog contents so that dialog fits in viewport
|
||||
|
||||
var w = Math.min(bb.w, Math.floor(viewport.w * 0.75)),
|
||||
h = Math.min(bb.h, Math.floor(viewport.h * 0.75));
|
||||
|
||||
if(this._singleChild && this._singleChild.resize){
|
||||
this._singleChildOriginalStyle = this._singleChild.domNode.style.cssText;
|
||||
this._singleChild.resize({w: w, h: h});
|
||||
}else{
|
||||
domStyle.set(this.containerNode, {
|
||||
width: w + "px",
|
||||
height: h + "px",
|
||||
overflow: "auto",
|
||||
position: "relative" // workaround IE bug moving scrollbar or dragging dialog
|
||||
});
|
||||
}
|
||||
}else{
|
||||
if(this._singleChild && this._singleChild.resize){
|
||||
this._singleChild.resize();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_position: function(){
|
||||
// summary:
|
||||
// Position modal dialog in the viewport. If no relative offset
|
||||
// in the viewport has been determined (by dragging, for instance),
|
||||
// center the node. Otherwise, use the Dialog's stored relative offset,
|
||||
// and position the node to top: left: values based on the viewport.
|
||||
if(!domClass.contains(win.body(), "dojoMove")){ // don't do anything if called during auto-scroll
|
||||
var node = this.domNode,
|
||||
viewport = winUtils.getBox(),
|
||||
p = this._relativePosition,
|
||||
bb = p ? null : domGeometry.position(node),
|
||||
l = Math.floor(viewport.l + (p ? p.x : (viewport.w - bb.w) / 2)),
|
||||
t = Math.floor(viewport.t + (p ? p.y : (viewport.h - bb.h) / 2))
|
||||
;
|
||||
domStyle.set(node,{
|
||||
left: l + "px",
|
||||
top: t + "px"
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_onKey: function(/*Event*/ evt){
|
||||
// summary:
|
||||
// Handles the keyboard events for accessibility reasons
|
||||
// tags:
|
||||
// private
|
||||
|
||||
if(evt.charOrCode){
|
||||
var node = evt.target;
|
||||
if(evt.charOrCode === keys.TAB){
|
||||
this._getFocusItems(this.domNode);
|
||||
}
|
||||
var singleFocusItem = (this._firstFocusItem == this._lastFocusItem);
|
||||
// see if we are shift-tabbing from first focusable item on dialog
|
||||
if(node == this._firstFocusItem && evt.shiftKey && evt.charOrCode === keys.TAB){
|
||||
if(!singleFocusItem){
|
||||
focus.focus(this._lastFocusItem); // send focus to last item in dialog
|
||||
}
|
||||
event.stop(evt);
|
||||
}else if(node == this._lastFocusItem && evt.charOrCode === keys.TAB && !evt.shiftKey){
|
||||
if(!singleFocusItem){
|
||||
focus.focus(this._firstFocusItem); // send focus to first item in dialog
|
||||
}
|
||||
event.stop(evt);
|
||||
}else{
|
||||
// see if the key is for the dialog
|
||||
while(node){
|
||||
if(node == this.domNode || domClass.contains(node, "dijitPopup")){
|
||||
if(evt.charOrCode == keys.ESCAPE){
|
||||
this.onCancel();
|
||||
}else{
|
||||
return; // just let it go
|
||||
}
|
||||
}
|
||||
node = node.parentNode;
|
||||
}
|
||||
// this key is for the disabled document window
|
||||
if(evt.charOrCode !== keys.TAB){ // allow tabbing into the dialog for a11y
|
||||
event.stop(evt);
|
||||
// opera won't tab to a div
|
||||
}else if(!has("opera")){
|
||||
try{
|
||||
this._firstFocusItem.focus();
|
||||
}catch(e){ /*squelch*/ }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
show: function(){
|
||||
// summary:
|
||||
// Display the dialog
|
||||
// returns: dojo.Deferred
|
||||
// Deferred object that resolves when the display animation is complete
|
||||
|
||||
if(this.open){ return; }
|
||||
|
||||
if(!this._started){
|
||||
this.startup();
|
||||
}
|
||||
|
||||
// first time we show the dialog, there's some initialization stuff to do
|
||||
if(!this._alreadyInitialized){
|
||||
this._setup();
|
||||
this._alreadyInitialized=true;
|
||||
}
|
||||
|
||||
if(this._fadeOutDeferred){
|
||||
this._fadeOutDeferred.cancel();
|
||||
}
|
||||
|
||||
this._modalconnects.push(on(window, "scroll", lang.hitch(this, "layout")));
|
||||
this._modalconnects.push(on(window, "resize", lang.hitch(this, function(){
|
||||
// IE gives spurious resize events and can actually get stuck
|
||||
// in an infinite loop if we don't ignore them
|
||||
var viewport = winUtils.getBox();
|
||||
if(!this._oldViewport ||
|
||||
viewport.h != this._oldViewport.h ||
|
||||
viewport.w != this._oldViewport.w){
|
||||
this.layout();
|
||||
this._oldViewport = viewport;
|
||||
}
|
||||
})));
|
||||
this._modalconnects.push(on(this.domNode, connect._keypress, lang.hitch(this, "_onKey")));
|
||||
|
||||
domStyle.set(this.domNode, {
|
||||
opacity:0,
|
||||
display:""
|
||||
});
|
||||
|
||||
this._set("open", true);
|
||||
this._onShow(); // lazy load trigger
|
||||
|
||||
this._size();
|
||||
this._position();
|
||||
|
||||
// fade-in Animation object, setup below
|
||||
var fadeIn;
|
||||
|
||||
this._fadeInDeferred = new Deferred(lang.hitch(this, function(){
|
||||
fadeIn.stop();
|
||||
delete this._fadeInDeferred;
|
||||
}));
|
||||
|
||||
fadeIn = fx.fadeIn({
|
||||
node: this.domNode,
|
||||
duration: this.duration,
|
||||
beforeBegin: lang.hitch(this, function(){
|
||||
DialogLevelManager.show(this, this.underlayAttrs);
|
||||
}),
|
||||
onEnd: lang.hitch(this, function(){
|
||||
if(this.autofocus && DialogLevelManager.isTop(this)){
|
||||
// find focusable items each time dialog is shown since if dialog contains a widget the
|
||||
// first focusable items can change
|
||||
this._getFocusItems(this.domNode);
|
||||
focus.focus(this._firstFocusItem);
|
||||
}
|
||||
this._fadeInDeferred.callback(true);
|
||||
delete this._fadeInDeferred;
|
||||
})
|
||||
}).play();
|
||||
|
||||
return this._fadeInDeferred;
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
// summary:
|
||||
// Hide the dialog
|
||||
// returns: dojo.Deferred
|
||||
// Deferred object that resolves when the hide animation is complete
|
||||
|
||||
// if we haven't been initialized yet then we aren't showing and we can just return
|
||||
if(!this._alreadyInitialized){
|
||||
return;
|
||||
}
|
||||
if(this._fadeInDeferred){
|
||||
this._fadeInDeferred.cancel();
|
||||
}
|
||||
|
||||
// fade-in Animation object, setup below
|
||||
var fadeOut;
|
||||
|
||||
this._fadeOutDeferred = new Deferred(lang.hitch(this, function(){
|
||||
fadeOut.stop();
|
||||
delete this._fadeOutDeferred;
|
||||
}));
|
||||
// fire onHide when the promise resolves.
|
||||
this._fadeOutDeferred.then(lang.hitch(this, 'onHide'));
|
||||
|
||||
fadeOut = fx.fadeOut({
|
||||
node: this.domNode,
|
||||
duration: this.duration,
|
||||
onEnd: lang.hitch(this, function(){
|
||||
this.domNode.style.display = "none";
|
||||
DialogLevelManager.hide(this);
|
||||
this._fadeOutDeferred.callback(true);
|
||||
delete this._fadeOutDeferred;
|
||||
})
|
||||
}).play();
|
||||
|
||||
if(this._scrollConnected){
|
||||
this._scrollConnected = false;
|
||||
}
|
||||
var h;
|
||||
while(h = this._modalconnects.pop()){
|
||||
h.remove();
|
||||
}
|
||||
|
||||
if(this._relativePosition){
|
||||
delete this._relativePosition;
|
||||
}
|
||||
this._set("open", false);
|
||||
|
||||
return this._fadeOutDeferred;
|
||||
},
|
||||
|
||||
layout: function(){
|
||||
// summary:
|
||||
// Position the Dialog and the underlay
|
||||
// tags:
|
||||
// private
|
||||
if(this.domNode.style.display != "none"){
|
||||
if(dijit._underlay){ // avoid race condition during show()
|
||||
dijit._underlay.layout();
|
||||
}
|
||||
this._position();
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function(){
|
||||
if(this._fadeInDeferred){
|
||||
this._fadeInDeferred.cancel();
|
||||
}
|
||||
if(this._fadeOutDeferred){
|
||||
this._fadeOutDeferred.cancel();
|
||||
}
|
||||
if(this._moveable){
|
||||
this._moveable.destroy();
|
||||
}
|
||||
var h;
|
||||
while(h = this._modalconnects.pop()){
|
||||
h.remove();
|
||||
}
|
||||
|
||||
DialogLevelManager.hide(this);
|
||||
|
||||
this.inherited(arguments);
|
||||
}
|
||||
});
|
||||
|
||||
var Dialog = declare("dijit.Dialog", [ContentPane, _DialogBase], {});
|
||||
Dialog._DialogBase = _DialogBase; // for monkey patching
|
||||
|
||||
var DialogLevelManager = Dialog._DialogLevelManager = {
|
||||
// summary:
|
||||
// Controls the various active "levels" on the page, starting with the
|
||||
// stuff initially visible on the page (at z-index 0), and then having an entry for
|
||||
// each Dialog shown.
|
||||
|
||||
_beginZIndex: 950,
|
||||
|
||||
show: function(/*dijit._Widget*/ dialog, /*Object*/ underlayAttrs){
|
||||
// summary:
|
||||
// Call right before fade-in animation for new dialog.
|
||||
// Saves current focus, displays/adjusts underlay for new dialog,
|
||||
// and sets the z-index of the dialog itself.
|
||||
//
|
||||
// New dialog will be displayed on top of all currently displayed dialogs.
|
||||
//
|
||||
// Caller is responsible for setting focus in new dialog after the fade-in
|
||||
// animation completes.
|
||||
|
||||
// Save current focus
|
||||
ds[ds.length-1].focus = focus.curNode;
|
||||
|
||||
// Display the underlay, or if already displayed then adjust for this new dialog
|
||||
var underlay = dijit._underlay;
|
||||
if(!underlay || underlay._destroyed){
|
||||
underlay = dijit._underlay = new DialogUnderlay(underlayAttrs);
|
||||
}else{
|
||||
underlay.set(dialog.underlayAttrs);
|
||||
}
|
||||
|
||||
// Set z-index a bit above previous dialog
|
||||
var zIndex = ds[ds.length-1].dialog ? ds[ds.length-1].zIndex + 2 : Dialog._DialogLevelManager._beginZIndex;
|
||||
if(ds.length == 1){ // first dialog
|
||||
underlay.show();
|
||||
}
|
||||
domStyle.set(dijit._underlay.domNode, 'zIndex', zIndex - 1);
|
||||
|
||||
// Dialog
|
||||
domStyle.set(dialog.domNode, 'zIndex', zIndex);
|
||||
|
||||
ds.push({dialog: dialog, underlayAttrs: underlayAttrs, zIndex: zIndex});
|
||||
},
|
||||
|
||||
hide: function(/*dijit._Widget*/ dialog){
|
||||
// summary:
|
||||
// Called when the specified dialog is hidden/destroyed, after the fade-out
|
||||
// animation ends, in order to reset page focus, fix the underlay, etc.
|
||||
// If the specified dialog isn't open then does nothing.
|
||||
//
|
||||
// Caller is responsible for either setting display:none on the dialog domNode,
|
||||
// or calling dijit.popup.hide(), or removing it from the page DOM.
|
||||
|
||||
if(ds[ds.length-1].dialog == dialog){
|
||||
// Removing the top (or only) dialog in the stack, return focus
|
||||
// to previous dialog
|
||||
|
||||
ds.pop();
|
||||
|
||||
var pd = ds[ds.length-1]; // the new active dialog (or the base page itself)
|
||||
|
||||
// Adjust underlay
|
||||
if(ds.length == 1){
|
||||
// Returning to original page.
|
||||
// Hide the underlay, unless the underlay widget has already been destroyed
|
||||
// because we are being called during page unload (when all widgets are destroyed)
|
||||
if(!dijit._underlay._destroyed){
|
||||
dijit._underlay.hide();
|
||||
}
|
||||
}else{
|
||||
// Popping back to previous dialog, adjust underlay
|
||||
domStyle.set(dijit._underlay.domNode, 'zIndex', pd.zIndex - 1);
|
||||
dijit._underlay.set(pd.underlayAttrs);
|
||||
}
|
||||
|
||||
// Adjust focus
|
||||
if(dialog.refocus){
|
||||
// If we are returning control to a previous dialog but for some reason
|
||||
// that dialog didn't have a focused field, set focus to first focusable item.
|
||||
// This situation could happen if two dialogs appeared at nearly the same time,
|
||||
// since a dialog doesn't set it's focus until the fade-in is finished.
|
||||
var focus = pd.focus;
|
||||
if(pd.dialog && (!focus || !dom.isDescendant(focus, pd.dialog.domNode))){
|
||||
pd.dialog._getFocusItems(pd.dialog.domNode);
|
||||
focus = pd.dialog._firstFocusItem;
|
||||
}
|
||||
|
||||
if(focus){
|
||||
focus.focus();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// Removing a dialog out of order (#9944, #10705).
|
||||
// Don't need to mess with underlay or z-index or anything.
|
||||
var idx = array.indexOf(array.map(ds, function(elem){return elem.dialog}), dialog);
|
||||
if(idx != -1){
|
||||
ds.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
isTop: function(/*dijit._Widget*/ dialog){
|
||||
// summary:
|
||||
// Returns true if specified Dialog is the top in the task
|
||||
return ds[ds.length-1].dialog == dialog;
|
||||
}
|
||||
};
|
||||
|
||||
// Stack representing the various active "levels" on the page, starting with the
|
||||
// stuff initially visible on the page (at z-index 0), and then having an entry for
|
||||
// each Dialog shown.
|
||||
// Each element in stack has form {
|
||||
// dialog: dialogWidget,
|
||||
// focus: returnFromGetFocus(),
|
||||
// underlayAttrs: attributes to set on underlay (when this widget is active)
|
||||
// }
|
||||
var ds = Dialog._dialogStack = [
|
||||
{dialog: null, focus: null, underlayAttrs: null} // entry for stuff at z-index: 0
|
||||
];
|
||||
|
||||
// Back compat w/1.6, remove for 2.0
|
||||
if(!kernel.isAsync){
|
||||
ready(0, function(){
|
||||
var requires = ["dijit/TooltipDialog"];
|
||||
require(requires); // use indirection so modules not rolled into a build
|
||||
});
|
||||
}
|
||||
|
||||
return Dialog;
|
||||
});
|
|
@ -1,29 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/DialogUnderlay",["dojo/_base/declare","dojo/dom-attr","dojo/_base/window","dojo/window","./_Widget","./_TemplatedMixin","./BackgroundIframe"],function(_1,_2,_3,_4,_5,_6,_7){
|
||||
return _1("dijit.DialogUnderlay",[_5,_6],{templateString:"<div class='dijitDialogUnderlayWrapper'><div class='dijitDialogUnderlay' data-dojo-attach-point='node'></div></div>",dialogId:"","class":"",_setDialogIdAttr:function(id){
|
||||
_2.set(this.node,"id",id+"_underlay");
|
||||
this._set("dialogId",id);
|
||||
},_setClassAttr:function(_8){
|
||||
this.node.className="dijitDialogUnderlay "+_8;
|
||||
this._set("class",_8);
|
||||
},postCreate:function(){
|
||||
_3.body().appendChild(this.domNode);
|
||||
},layout:function(){
|
||||
var is=this.node.style,os=this.domNode.style;
|
||||
os.display="none";
|
||||
var _9=_4.getBox();
|
||||
os.top=_9.t+"px";
|
||||
os.left=_9.l+"px";
|
||||
is.width=_9.w+"px";
|
||||
is.height=_9.h+"px";
|
||||
os.display="block";
|
||||
},show:function(){
|
||||
this.domNode.style.display="block";
|
||||
this.layout();
|
||||
this.bgIframe=new _7(this.domNode);
|
||||
},hide:function(){
|
||||
this.bgIframe.destroy();
|
||||
delete this.bgIframe;
|
||||
this.domNode.style.display="none";
|
||||
}});
|
||||
});
|
|
@ -1,111 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/DialogUnderlay", [
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-attr", // domAttr.set
|
||||
"dojo/_base/window", // win.body
|
||||
"dojo/window", // winUtils.getBox
|
||||
"./_Widget",
|
||||
"./_TemplatedMixin",
|
||||
"./BackgroundIframe"
|
||||
], function(declare, domAttr, win, winUtils, _Widget, _TemplatedMixin, BackgroundIframe){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/DialogUnderlay
|
||||
// summary:
|
||||
// The component that blocks the screen behind a `dijit.Dialog`
|
||||
|
||||
return declare("dijit.DialogUnderlay", [_Widget, _TemplatedMixin], {
|
||||
// summary:
|
||||
// The component that blocks the screen behind a `dijit.Dialog`
|
||||
//
|
||||
// description:
|
||||
// A component used to block input behind a `dijit.Dialog`. Only a single
|
||||
// instance of this widget is created by `dijit.Dialog`, and saved as
|
||||
// a reference to be shared between all Dialogs as `dijit._underlay`
|
||||
//
|
||||
// The underlay itself can be styled based on and id:
|
||||
// | #myDialog_underlay { background-color:red; }
|
||||
//
|
||||
// In the case of `dijit.Dialog`, this id is based on the id of the Dialog,
|
||||
// suffixed with _underlay.
|
||||
|
||||
// Template has two divs; outer div is used for fade-in/fade-out, and also to hold background iframe.
|
||||
// Inner div has opacity specified in CSS file.
|
||||
templateString: "<div class='dijitDialogUnderlayWrapper'><div class='dijitDialogUnderlay' data-dojo-attach-point='node'></div></div>",
|
||||
|
||||
// Parameters on creation or updatable later
|
||||
|
||||
// dialogId: String
|
||||
// Id of the dialog.... DialogUnderlay's id is based on this id
|
||||
dialogId: "",
|
||||
|
||||
// class: String
|
||||
// This class name is used on the DialogUnderlay node, in addition to dijitDialogUnderlay
|
||||
"class": "",
|
||||
|
||||
_setDialogIdAttr: function(id){
|
||||
domAttr.set(this.node, "id", id + "_underlay");
|
||||
this._set("dialogId", id);
|
||||
},
|
||||
|
||||
_setClassAttr: function(clazz){
|
||||
this.node.className = "dijitDialogUnderlay " + clazz;
|
||||
this._set("class", clazz);
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
// summary:
|
||||
// Append the underlay to the body
|
||||
win.body().appendChild(this.domNode);
|
||||
},
|
||||
|
||||
layout: function(){
|
||||
// summary:
|
||||
// Sets the background to the size of the viewport
|
||||
//
|
||||
// description:
|
||||
// Sets the background to the size of the viewport (rather than the size
|
||||
// of the document) since we need to cover the whole browser window, even
|
||||
// if the document is only a few lines long.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
var is = this.node.style,
|
||||
os = this.domNode.style;
|
||||
|
||||
// hide the background temporarily, so that the background itself isn't
|
||||
// causing scrollbars to appear (might happen when user shrinks browser
|
||||
// window and then we are called to resize)
|
||||
os.display = "none";
|
||||
|
||||
// then resize and show
|
||||
var viewport = winUtils.getBox();
|
||||
os.top = viewport.t + "px";
|
||||
os.left = viewport.l + "px";
|
||||
is.width = viewport.w + "px";
|
||||
is.height = viewport.h + "px";
|
||||
os.display = "block";
|
||||
},
|
||||
|
||||
show: function(){
|
||||
// summary:
|
||||
// Show the dialog underlay
|
||||
this.domNode.style.display = "block";
|
||||
this.layout();
|
||||
this.bgIframe = new BackgroundIframe(this.domNode);
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
// summary:
|
||||
// Hides the dialog underlay
|
||||
this.bgIframe.destroy();
|
||||
delete this.bgIframe;
|
||||
this.domNode.style.display = "none";
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,31 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/Menu.html":"<table class=\"dijit dijitMenu dijitMenuPassive dijitReset dijitMenuTable\" role=\"menu\" tabIndex=\"${tabIndex}\" data-dojo-attach-event=\"onkeypress:_onKeyPress\" cellspacing=\"0\">\n\t<tbody class=\"dijitReset\" data-dojo-attach-point=\"containerNode\"></tbody>\n</table>\n"}});
|
||||
define("dijit/DropDownMenu",["dojo/_base/declare","dojo/_base/event","dojo/keys","dojo/text!./templates/Menu.html","./_OnDijitClickMixin","./_MenuBase"],function(_1,_2,_3,_4,_5,_6){
|
||||
return _1("dijit.DropDownMenu",[_6,_5],{templateString:_4,baseClass:"dijitMenu",postCreate:function(){
|
||||
var l=this.isLeftToRight();
|
||||
this._openSubMenuKey=l?_3.RIGHT_ARROW:_3.LEFT_ARROW;
|
||||
this._closeSubMenuKey=l?_3.LEFT_ARROW:_3.RIGHT_ARROW;
|
||||
this.connectKeyNavHandlers([_3.UP_ARROW],[_3.DOWN_ARROW]);
|
||||
},_onKeyPress:function(_7){
|
||||
if(_7.ctrlKey||_7.altKey){
|
||||
return;
|
||||
}
|
||||
switch(_7.charOrCode){
|
||||
case this._openSubMenuKey:
|
||||
this._moveToPopup(_7);
|
||||
_2.stop(_7);
|
||||
break;
|
||||
case this._closeSubMenuKey:
|
||||
if(this.parentMenu){
|
||||
if(this.parentMenu._isMenuBar){
|
||||
this.parentMenu.focusPrev();
|
||||
}else{
|
||||
this.onCancel(false);
|
||||
}
|
||||
}else{
|
||||
_2.stop(_7);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}});
|
||||
});
|
|
@ -1,65 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/Menu.html':"<table class=\"dijit dijitMenu dijitMenuPassive dijitReset dijitMenuTable\" role=\"menu\" tabIndex=\"${tabIndex}\" data-dojo-attach-event=\"onkeypress:_onKeyPress\" cellspacing=\"0\">\n\t<tbody class=\"dijitReset\" data-dojo-attach-point=\"containerNode\"></tbody>\n</table>\n"}});
|
||||
define("dijit/DropDownMenu", [
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/keys", // keys
|
||||
"dojo/text!./templates/Menu.html",
|
||||
"./_OnDijitClickMixin",
|
||||
"./_MenuBase"
|
||||
], function(declare, event, keys, template, _OnDijitClickMixin, _MenuBase){
|
||||
|
||||
/*=====
|
||||
var _MenuBase = dijit._MenuBase;
|
||||
var _OnDijitClickMixin = dijit._OnDijitClickMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/DropDownMenu
|
||||
// summary:
|
||||
// dijit.DropDownMenu widget
|
||||
|
||||
return declare("dijit.DropDownMenu", [_MenuBase, _OnDijitClickMixin], {
|
||||
// summary:
|
||||
// A menu, without features for context menu (Meaning, drop down menu)
|
||||
|
||||
templateString: template,
|
||||
|
||||
baseClass: "dijitMenu",
|
||||
|
||||
postCreate: function(){
|
||||
var l = this.isLeftToRight();
|
||||
this._openSubMenuKey = l ? keys.RIGHT_ARROW : keys.LEFT_ARROW;
|
||||
this._closeSubMenuKey = l ? keys.LEFT_ARROW : keys.RIGHT_ARROW;
|
||||
this.connectKeyNavHandlers([keys.UP_ARROW], [keys.DOWN_ARROW]);
|
||||
},
|
||||
|
||||
_onKeyPress: function(/*Event*/ evt){
|
||||
// summary:
|
||||
// Handle keyboard based menu navigation.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
if(evt.ctrlKey || evt.altKey){ return; }
|
||||
|
||||
switch(evt.charOrCode){
|
||||
case this._openSubMenuKey:
|
||||
this._moveToPopup(evt);
|
||||
event.stop(evt);
|
||||
break;
|
||||
case this._closeSubMenuKey:
|
||||
if(this.parentMenu){
|
||||
if(this.parentMenu._isMenuBar){
|
||||
this.parentMenu.focusPrev();
|
||||
}else{
|
||||
this.onCancel(false);
|
||||
}
|
||||
}else{
|
||||
event.stop(evt);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,459 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/Editor",["dojo/_base/array","dojo/_base/declare","dojo/_base/Deferred","dojo/i18n","dojo/dom-attr","dojo/dom-class","dojo/dom-geometry","dojo/dom-style","dojo/_base/event","dojo/keys","dojo/_base/lang","dojo/_base/sniff","dojo/string","dojo/topic","dojo/_base/window","./_base/focus","./_Container","./Toolbar","./ToolbarSeparator","./layout/_LayoutWidget","./form/ToggleButton","./_editor/_Plugin","./_editor/plugins/EnterKeyHandling","./_editor/html","./_editor/range","./_editor/RichText",".","dojo/i18n!./_editor/nls/commands"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_1a,_1b){
|
||||
var _1c=_2("dijit.Editor",_1a,{plugins:null,extraPlugins:null,constructor:function(){
|
||||
if(!_b.isArray(this.plugins)){
|
||||
this.plugins=["undo","redo","|","cut","copy","paste","|","bold","italic","underline","strikethrough","|","insertOrderedList","insertUnorderedList","indent","outdent","|","justifyLeft","justifyRight","justifyCenter","justifyFull",_17];
|
||||
}
|
||||
this._plugins=[];
|
||||
this._editInterval=this.editActionInterval*1000;
|
||||
if(_c("ie")){
|
||||
this.events.push("onBeforeDeactivate");
|
||||
this.events.push("onBeforeActivate");
|
||||
}
|
||||
},postMixInProperties:function(){
|
||||
this.setValueDeferred=new _3();
|
||||
this.inherited(arguments);
|
||||
},postCreate:function(){
|
||||
this._steps=this._steps.slice(0);
|
||||
this._undoedSteps=this._undoedSteps.slice(0);
|
||||
if(_b.isArray(this.extraPlugins)){
|
||||
this.plugins=this.plugins.concat(this.extraPlugins);
|
||||
}
|
||||
this.inherited(arguments);
|
||||
this.commands=_4.getLocalization("dijit._editor","commands",this.lang);
|
||||
if(!this.toolbar){
|
||||
this.toolbar=new _12({dir:this.dir,lang:this.lang});
|
||||
this.header.appendChild(this.toolbar.domNode);
|
||||
}
|
||||
_1.forEach(this.plugins,this.addPlugin,this);
|
||||
this.setValueDeferred.callback(true);
|
||||
_6.add(this.iframe.parentNode,"dijitEditorIFrameContainer");
|
||||
_6.add(this.iframe,"dijitEditorIFrame");
|
||||
_5.set(this.iframe,"allowTransparency",true);
|
||||
if(_c("webkit")){
|
||||
_8.set(this.domNode,"KhtmlUserSelect","none");
|
||||
}
|
||||
this.toolbar.startup();
|
||||
this.onNormalizedDisplayChanged();
|
||||
},destroy:function(){
|
||||
_1.forEach(this._plugins,function(p){
|
||||
if(p&&p.destroy){
|
||||
p.destroy();
|
||||
}
|
||||
});
|
||||
this._plugins=[];
|
||||
this.toolbar.destroyRecursive();
|
||||
delete this.toolbar;
|
||||
this.inherited(arguments);
|
||||
},addPlugin:function(_1d,_1e){
|
||||
var _1f=_b.isString(_1d)?{name:_1d}:_b.isFunction(_1d)?{ctor:_1d}:_1d;
|
||||
if(!_1f.setEditor){
|
||||
var o={"args":_1f,"plugin":null,"editor":this};
|
||||
if(_1f.name){
|
||||
if(_16.registry[_1f.name]){
|
||||
o.plugin=_16.registry[_1f.name](_1f);
|
||||
}else{
|
||||
_e.publish(_1b._scopeName+".Editor.getPlugin",o);
|
||||
}
|
||||
}
|
||||
if(!o.plugin){
|
||||
var pc=_1f.ctor||_b.getObject(_1f.name);
|
||||
if(pc){
|
||||
o.plugin=new pc(_1f);
|
||||
}
|
||||
}
|
||||
if(!o.plugin){
|
||||
console.warn("Cannot find plugin",_1d);
|
||||
return;
|
||||
}
|
||||
_1d=o.plugin;
|
||||
}
|
||||
if(arguments.length>1){
|
||||
this._plugins[_1e]=_1d;
|
||||
}else{
|
||||
this._plugins.push(_1d);
|
||||
}
|
||||
_1d.setEditor(this);
|
||||
if(_b.isFunction(_1d.setToolbar)){
|
||||
_1d.setToolbar(this.toolbar);
|
||||
}
|
||||
},resize:function(_20){
|
||||
if(_20){
|
||||
_14.prototype.resize.apply(this,arguments);
|
||||
}
|
||||
},layout:function(){
|
||||
var _21=(this._contentBox.h-(this.getHeaderHeight()+this.getFooterHeight()+_7.getPadBorderExtents(this.iframe.parentNode).h+_7.getMarginExtents(this.iframe.parentNode).h));
|
||||
this.editingArea.style.height=_21+"px";
|
||||
if(this.iframe){
|
||||
this.iframe.style.height="100%";
|
||||
}
|
||||
this._layoutMode=true;
|
||||
},_onIEMouseDown:function(e){
|
||||
var _22;
|
||||
var b=this.document.body;
|
||||
var _23=b.clientWidth;
|
||||
var _24=b.clientHeight;
|
||||
var _25=b.clientLeft;
|
||||
var _26=b.offsetWidth;
|
||||
var _27=b.offsetHeight;
|
||||
var _28=b.offsetLeft;
|
||||
if(/^rtl$/i.test(b.dir||"")){
|
||||
if(_23<_26&&e.x>_23&&e.x<_26){
|
||||
_22=true;
|
||||
}
|
||||
}else{
|
||||
if(e.x<_25&&e.x>_28){
|
||||
_22=true;
|
||||
}
|
||||
}
|
||||
if(!_22){
|
||||
if(_24<_27&&e.y>_24&&e.y<_27){
|
||||
_22=true;
|
||||
}
|
||||
}
|
||||
if(!_22){
|
||||
delete this._cursorToStart;
|
||||
delete this._savedSelection;
|
||||
if(e.target.tagName=="BODY"){
|
||||
setTimeout(_b.hitch(this,"placeCursorAtEnd"),0);
|
||||
}
|
||||
this.inherited(arguments);
|
||||
}
|
||||
},onBeforeActivate:function(){
|
||||
this._restoreSelection();
|
||||
},onBeforeDeactivate:function(e){
|
||||
if(this.customUndo){
|
||||
this.endEditing(true);
|
||||
}
|
||||
if(e.target.tagName!="BODY"){
|
||||
this._saveSelection();
|
||||
}
|
||||
},customUndo:true,editActionInterval:3,beginEditing:function(cmd){
|
||||
if(!this._inEditing){
|
||||
this._inEditing=true;
|
||||
this._beginEditing(cmd);
|
||||
}
|
||||
if(this.editActionInterval>0){
|
||||
if(this._editTimer){
|
||||
clearTimeout(this._editTimer);
|
||||
}
|
||||
this._editTimer=setTimeout(_b.hitch(this,this.endEditing),this._editInterval);
|
||||
}
|
||||
},_steps:[],_undoedSteps:[],execCommand:function(cmd){
|
||||
if(this.customUndo&&(cmd=="undo"||cmd=="redo")){
|
||||
return this[cmd]();
|
||||
}else{
|
||||
if(this.customUndo){
|
||||
this.endEditing();
|
||||
this._beginEditing();
|
||||
}
|
||||
var r=this.inherited(arguments);
|
||||
if(this.customUndo){
|
||||
this._endEditing();
|
||||
}
|
||||
return r;
|
||||
}
|
||||
},_pasteImpl:function(){
|
||||
return this._clipboardCommand("paste");
|
||||
},_cutImpl:function(){
|
||||
return this._clipboardCommand("cut");
|
||||
},_copyImpl:function(){
|
||||
return this._clipboardCommand("copy");
|
||||
},_clipboardCommand:function(cmd){
|
||||
var r;
|
||||
try{
|
||||
r=this.document.execCommand(cmd,false,null);
|
||||
if(_c("webkit")&&!r){
|
||||
throw {code:1011};
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
if(e.code==1011){
|
||||
var sub=_d.substitute,_29={cut:"X",copy:"C",paste:"V"};
|
||||
alert(sub(this.commands.systemShortcut,[this.commands[cmd],sub(this.commands[_c("mac")?"appleKey":"ctrlKey"],[_29[cmd]])]));
|
||||
}
|
||||
r=false;
|
||||
}
|
||||
return r;
|
||||
},queryCommandEnabled:function(cmd){
|
||||
if(this.customUndo&&(cmd=="undo"||cmd=="redo")){
|
||||
return cmd=="undo"?(this._steps.length>1):(this._undoedSteps.length>0);
|
||||
}else{
|
||||
return this.inherited(arguments);
|
||||
}
|
||||
},_moveToBookmark:function(b){
|
||||
var _2a=b.mark;
|
||||
var _2b=b.mark;
|
||||
var col=b.isCollapsed;
|
||||
var r,_2c,_2d,sel;
|
||||
if(_2b){
|
||||
if(_c("ie")<9){
|
||||
if(_b.isArray(_2b)){
|
||||
_2a=[];
|
||||
_1.forEach(_2b,function(n){
|
||||
_2a.push(_19.getNode(n,this.editNode));
|
||||
},this);
|
||||
_f.withGlobal(this.window,"moveToBookmark",_1b,[{mark:_2a,isCollapsed:col}]);
|
||||
}else{
|
||||
if(_2b.startContainer&&_2b.endContainer){
|
||||
sel=_19.getSelection(this.window);
|
||||
if(sel&&sel.removeAllRanges){
|
||||
sel.removeAllRanges();
|
||||
r=_19.create(this.window);
|
||||
_2c=_19.getNode(_2b.startContainer,this.editNode);
|
||||
_2d=_19.getNode(_2b.endContainer,this.editNode);
|
||||
if(_2c&&_2d){
|
||||
r.setStart(_2c,_2b.startOffset);
|
||||
r.setEnd(_2d,_2b.endOffset);
|
||||
sel.addRange(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
sel=_19.getSelection(this.window);
|
||||
if(sel&&sel.removeAllRanges){
|
||||
sel.removeAllRanges();
|
||||
r=_19.create(this.window);
|
||||
_2c=_19.getNode(_2b.startContainer,this.editNode);
|
||||
_2d=_19.getNode(_2b.endContainer,this.editNode);
|
||||
if(_2c&&_2d){
|
||||
r.setStart(_2c,_2b.startOffset);
|
||||
r.setEnd(_2d,_2b.endOffset);
|
||||
sel.addRange(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},_changeToStep:function(_2e,to){
|
||||
this.setValue(to.text);
|
||||
var b=to.bookmark;
|
||||
if(!b){
|
||||
return;
|
||||
}
|
||||
this._moveToBookmark(b);
|
||||
},undo:function(){
|
||||
var ret=false;
|
||||
if(!this._undoRedoActive){
|
||||
this._undoRedoActive=true;
|
||||
this.endEditing(true);
|
||||
var s=this._steps.pop();
|
||||
if(s&&this._steps.length>0){
|
||||
this.focus();
|
||||
this._changeToStep(s,this._steps[this._steps.length-1]);
|
||||
this._undoedSteps.push(s);
|
||||
this.onDisplayChanged();
|
||||
delete this._undoRedoActive;
|
||||
ret=true;
|
||||
}
|
||||
delete this._undoRedoActive;
|
||||
}
|
||||
return ret;
|
||||
},redo:function(){
|
||||
var ret=false;
|
||||
if(!this._undoRedoActive){
|
||||
this._undoRedoActive=true;
|
||||
this.endEditing(true);
|
||||
var s=this._undoedSteps.pop();
|
||||
if(s&&this._steps.length>0){
|
||||
this.focus();
|
||||
this._changeToStep(this._steps[this._steps.length-1],s);
|
||||
this._steps.push(s);
|
||||
this.onDisplayChanged();
|
||||
ret=true;
|
||||
}
|
||||
delete this._undoRedoActive;
|
||||
}
|
||||
return ret;
|
||||
},endEditing:function(_2f){
|
||||
if(this._editTimer){
|
||||
clearTimeout(this._editTimer);
|
||||
}
|
||||
if(this._inEditing){
|
||||
this._endEditing(_2f);
|
||||
this._inEditing=false;
|
||||
}
|
||||
},_getBookmark:function(){
|
||||
var b=_f.withGlobal(this.window,_10.getBookmark);
|
||||
var tmp=[];
|
||||
if(b&&b.mark){
|
||||
var _30=b.mark;
|
||||
if(_c("ie")<9){
|
||||
var sel=_19.getSelection(this.window);
|
||||
if(!_b.isArray(_30)){
|
||||
if(sel){
|
||||
var _31;
|
||||
if(sel.rangeCount){
|
||||
_31=sel.getRangeAt(0);
|
||||
}
|
||||
if(_31){
|
||||
b.mark=_31.cloneRange();
|
||||
}else{
|
||||
b.mark=_f.withGlobal(this.window,_10.getBookmark);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
_1.forEach(b.mark,function(n){
|
||||
tmp.push(_19.getIndex(n,this.editNode).o);
|
||||
},this);
|
||||
b.mark=tmp;
|
||||
}
|
||||
}
|
||||
try{
|
||||
if(b.mark&&b.mark.startContainer){
|
||||
tmp=_19.getIndex(b.mark.startContainer,this.editNode).o;
|
||||
b.mark={startContainer:tmp,startOffset:b.mark.startOffset,endContainer:b.mark.endContainer===b.mark.startContainer?tmp:_19.getIndex(b.mark.endContainer,this.editNode).o,endOffset:b.mark.endOffset};
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
b.mark=null;
|
||||
}
|
||||
}
|
||||
return b;
|
||||
},_beginEditing:function(){
|
||||
if(this._steps.length===0){
|
||||
this._steps.push({"text":_18.getChildrenHtml(this.editNode),"bookmark":this._getBookmark()});
|
||||
}
|
||||
},_endEditing:function(){
|
||||
var v=_18.getChildrenHtml(this.editNode);
|
||||
this._undoedSteps=[];
|
||||
this._steps.push({text:v,bookmark:this._getBookmark()});
|
||||
},onKeyDown:function(e){
|
||||
if(!_c("ie")&&!this.iframe&&e.keyCode==_a.TAB&&!this.tabIndent){
|
||||
this._saveSelection();
|
||||
}
|
||||
if(!this.customUndo){
|
||||
this.inherited(arguments);
|
||||
return;
|
||||
}
|
||||
var k=e.keyCode;
|
||||
if(e.ctrlKey&&!e.altKey){
|
||||
if(k==90||k==122){
|
||||
_9.stop(e);
|
||||
this.undo();
|
||||
return;
|
||||
}else{
|
||||
if(k==89||k==121){
|
||||
_9.stop(e);
|
||||
this.redo();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.inherited(arguments);
|
||||
switch(k){
|
||||
case _a.ENTER:
|
||||
case _a.BACKSPACE:
|
||||
case _a.DELETE:
|
||||
this.beginEditing();
|
||||
break;
|
||||
case 88:
|
||||
case 86:
|
||||
if(e.ctrlKey&&!e.altKey&&!e.metaKey){
|
||||
this.endEditing();
|
||||
if(e.keyCode==88){
|
||||
this.beginEditing("cut");
|
||||
setTimeout(_b.hitch(this,this.endEditing),1);
|
||||
}else{
|
||||
this.beginEditing("paste");
|
||||
setTimeout(_b.hitch(this,this.endEditing),1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if(!e.ctrlKey&&!e.altKey&&!e.metaKey&&(e.keyCode<_a.F1||e.keyCode>_a.F15)){
|
||||
this.beginEditing();
|
||||
break;
|
||||
}
|
||||
case _a.ALT:
|
||||
this.endEditing();
|
||||
break;
|
||||
case _a.UP_ARROW:
|
||||
case _a.DOWN_ARROW:
|
||||
case _a.LEFT_ARROW:
|
||||
case _a.RIGHT_ARROW:
|
||||
case _a.HOME:
|
||||
case _a.END:
|
||||
case _a.PAGE_UP:
|
||||
case _a.PAGE_DOWN:
|
||||
this.endEditing(true);
|
||||
break;
|
||||
case _a.CTRL:
|
||||
case _a.SHIFT:
|
||||
case _a.TAB:
|
||||
break;
|
||||
}
|
||||
},_onBlur:function(){
|
||||
this.inherited(arguments);
|
||||
this.endEditing(true);
|
||||
},_saveSelection:function(){
|
||||
try{
|
||||
this._savedSelection=this._getBookmark();
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
},_restoreSelection:function(){
|
||||
if(this._savedSelection){
|
||||
delete this._cursorToStart;
|
||||
if(_f.withGlobal(this.window,"isCollapsed",_1b)){
|
||||
this._moveToBookmark(this._savedSelection);
|
||||
}
|
||||
delete this._savedSelection;
|
||||
}
|
||||
},onClick:function(){
|
||||
this.endEditing(true);
|
||||
this.inherited(arguments);
|
||||
},replaceValue:function(_32){
|
||||
if(!this.customUndo){
|
||||
this.inherited(arguments);
|
||||
}else{
|
||||
if(this.isClosed){
|
||||
this.setValue(_32);
|
||||
}else{
|
||||
this.beginEditing();
|
||||
if(!_32){
|
||||
_32=" ";
|
||||
}
|
||||
this.setValue(_32);
|
||||
this.endEditing();
|
||||
}
|
||||
}
|
||||
},_setDisabledAttr:function(_33){
|
||||
var _34=_b.hitch(this,function(){
|
||||
if((!this.disabled&&_33)||(!this._buttonEnabledPlugins&&_33)){
|
||||
_1.forEach(this._plugins,function(p){
|
||||
p.set("disabled",true);
|
||||
});
|
||||
}else{
|
||||
if(this.disabled&&!_33){
|
||||
_1.forEach(this._plugins,function(p){
|
||||
p.set("disabled",false);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
this.setValueDeferred.addCallback(_34);
|
||||
this.inherited(arguments);
|
||||
},_setStateClass:function(){
|
||||
try{
|
||||
this.inherited(arguments);
|
||||
if(this.document&&this.document.body){
|
||||
_8.set(this.document.body,"color",_8.get(this.iframe,"color"));
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
}});
|
||||
function _35(_36){
|
||||
return new _16({command:_36.name});
|
||||
};
|
||||
function _37(_38){
|
||||
return new _16({buttonClass:_15,command:_38.name});
|
||||
};
|
||||
_b.mixin(_16.registry,{"undo":_35,"redo":_35,"cut":_35,"copy":_35,"paste":_35,"insertOrderedList":_35,"insertUnorderedList":_35,"indent":_35,"outdent":_35,"justifyCenter":_35,"justifyFull":_35,"justifyLeft":_35,"justifyRight":_35,"delete":_35,"selectAll":_35,"removeFormat":_35,"unlink":_35,"insertHorizontalRule":_35,"bold":_37,"italic":_37,"underline":_37,"strikethrough":_37,"subscript":_37,"superscript":_37,"|":function(){
|
||||
return new _16({button:new _13(),setEditor:function(_39){
|
||||
this.editor=_39;
|
||||
}});
|
||||
}});
|
||||
return _1c;
|
||||
});
|
|
@ -1,860 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/Editor", [
|
||||
"dojo/_base/array", // array.forEach
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/Deferred", // Deferred
|
||||
"dojo/i18n", // i18n.getLocalization
|
||||
"dojo/dom-attr", // domAttr.set
|
||||
"dojo/dom-class", // domClass.add
|
||||
"dojo/dom-geometry",
|
||||
"dojo/dom-style", // domStyle.set, get
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/keys", // keys.F1 keys.F15 keys.TAB
|
||||
"dojo/_base/lang", // lang.getObject lang.hitch
|
||||
"dojo/_base/sniff", // has("ie") has("mac") has("webkit")
|
||||
"dojo/string", // string.substitute
|
||||
"dojo/topic", // topic.publish()
|
||||
"dojo/_base/window", // win.withGlobal
|
||||
"./_base/focus", // dijit.getBookmark()
|
||||
"./_Container",
|
||||
"./Toolbar",
|
||||
"./ToolbarSeparator",
|
||||
"./layout/_LayoutWidget",
|
||||
"./form/ToggleButton",
|
||||
"./_editor/_Plugin",
|
||||
"./_editor/plugins/EnterKeyHandling",
|
||||
"./_editor/html",
|
||||
"./_editor/range",
|
||||
"./_editor/RichText",
|
||||
".", // dijit._scopeName
|
||||
"dojo/i18n!./_editor/nls/commands"
|
||||
], function(array, declare, Deferred, i18n, domAttr, domClass, domGeometry, domStyle,
|
||||
event, keys, lang, has, string, topic, win,
|
||||
focusBase, _Container, Toolbar, ToolbarSeparator, _LayoutWidget, ToggleButton,
|
||||
_Plugin, EnterKeyHandling, html, rangeapi, RichText, dijit){
|
||||
|
||||
// module:
|
||||
// dijit/Editor
|
||||
// summary:
|
||||
// A rich text Editing widget
|
||||
|
||||
var Editor = declare("dijit.Editor", RichText, {
|
||||
// summary:
|
||||
// A rich text Editing widget
|
||||
//
|
||||
// description:
|
||||
// This widget provides basic WYSIWYG editing features, based on the browser's
|
||||
// underlying rich text editing capability, accompanied by a toolbar (`dijit.Toolbar`).
|
||||
// A plugin model is available to extend the editor's capabilities as well as the
|
||||
// the options available in the toolbar. Content generation may vary across
|
||||
// browsers, and clipboard operations may have different results, to name
|
||||
// a few limitations. Note: this widget should not be used with the HTML
|
||||
// <TEXTAREA> tag -- see dijit._editor.RichText for details.
|
||||
|
||||
// plugins: [const] Object[]
|
||||
// A list of plugin names (as strings) or instances (as objects)
|
||||
// for this widget.
|
||||
//
|
||||
// When declared in markup, it might look like:
|
||||
// | plugins="['bold',{name:'dijit._editor.plugins.FontChoice', command:'fontName', generic:true}]"
|
||||
plugins: null,
|
||||
|
||||
// extraPlugins: [const] Object[]
|
||||
// A list of extra plugin names which will be appended to plugins array
|
||||
extraPlugins: null,
|
||||
|
||||
constructor: function(){
|
||||
// summary:
|
||||
// Runs on widget initialization to setup arrays etc.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
if(!lang.isArray(this.plugins)){
|
||||
this.plugins=["undo","redo","|","cut","copy","paste","|","bold","italic","underline","strikethrough","|",
|
||||
"insertOrderedList","insertUnorderedList","indent","outdent","|","justifyLeft","justifyRight","justifyCenter","justifyFull",
|
||||
EnterKeyHandling /*, "createLink"*/];
|
||||
}
|
||||
|
||||
this._plugins=[];
|
||||
this._editInterval = this.editActionInterval * 1000;
|
||||
|
||||
//IE will always lose focus when other element gets focus, while for FF and safari,
|
||||
//when no iframe is used, focus will be lost whenever another element gets focus.
|
||||
//For IE, we can connect to onBeforeDeactivate, which will be called right before
|
||||
//the focus is lost, so we can obtain the selected range. For other browsers,
|
||||
//no equivalent of onBeforeDeactivate, so we need to do two things to make sure
|
||||
//selection is properly saved before focus is lost: 1) when user clicks another
|
||||
//element in the page, in which case we listen to mousedown on the entire page and
|
||||
//see whether user clicks out of a focus editor, if so, save selection (focus will
|
||||
//only lost after onmousedown event is fired, so we can obtain correct caret pos.)
|
||||
//2) when user tabs away from the editor, which is handled in onKeyDown below.
|
||||
if(has("ie")){
|
||||
this.events.push("onBeforeDeactivate");
|
||||
this.events.push("onBeforeActivate");
|
||||
}
|
||||
},
|
||||
|
||||
postMixInProperties: function(){
|
||||
// summary:
|
||||
// Extension to make sure a deferred is in place before certain functions
|
||||
// execute, like making sure all the plugins are properly inserted.
|
||||
|
||||
// Set up a deferred so that the value isn't applied to the editor
|
||||
// until all the plugins load, needed to avoid timing condition
|
||||
// reported in #10537.
|
||||
this.setValueDeferred = new Deferred();
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
//for custom undo/redo, if enabled.
|
||||
this._steps=this._steps.slice(0);
|
||||
this._undoedSteps=this._undoedSteps.slice(0);
|
||||
|
||||
if(lang.isArray(this.extraPlugins)){
|
||||
this.plugins=this.plugins.concat(this.extraPlugins);
|
||||
}
|
||||
|
||||
this.inherited(arguments);
|
||||
|
||||
this.commands = i18n.getLocalization("dijit._editor", "commands", this.lang);
|
||||
|
||||
if(!this.toolbar){
|
||||
// if we haven't been assigned a toolbar, create one
|
||||
this.toolbar = new Toolbar({
|
||||
dir: this.dir,
|
||||
lang: this.lang
|
||||
});
|
||||
this.header.appendChild(this.toolbar.domNode);
|
||||
}
|
||||
|
||||
array.forEach(this.plugins, this.addPlugin, this);
|
||||
|
||||
// Okay, denote the value can now be set.
|
||||
this.setValueDeferred.callback(true);
|
||||
|
||||
domClass.add(this.iframe.parentNode, "dijitEditorIFrameContainer");
|
||||
domClass.add(this.iframe, "dijitEditorIFrame");
|
||||
domAttr.set(this.iframe, "allowTransparency", true);
|
||||
|
||||
if(has("webkit")){
|
||||
// Disable selecting the entire editor by inadvertent double-clicks.
|
||||
// on buttons, title bar, etc. Otherwise clicking too fast on
|
||||
// a button such as undo/redo selects the entire editor.
|
||||
domStyle.set(this.domNode, "KhtmlUserSelect", "none");
|
||||
}
|
||||
this.toolbar.startup();
|
||||
this.onNormalizedDisplayChanged(); //update toolbar button status
|
||||
},
|
||||
destroy: function(){
|
||||
array.forEach(this._plugins, function(p){
|
||||
if(p && p.destroy){
|
||||
p.destroy();
|
||||
}
|
||||
});
|
||||
this._plugins=[];
|
||||
this.toolbar.destroyRecursive();
|
||||
delete this.toolbar;
|
||||
this.inherited(arguments);
|
||||
},
|
||||
addPlugin: function(/*String||Object||Function*/plugin, /*Integer?*/index){
|
||||
// summary:
|
||||
// takes a plugin name as a string or a plugin instance and
|
||||
// adds it to the toolbar and associates it with this editor
|
||||
// instance. The resulting plugin is added to the Editor's
|
||||
// plugins array. If index is passed, it's placed in the plugins
|
||||
// array at that index. No big magic, but a nice helper for
|
||||
// passing in plugin names via markup.
|
||||
//
|
||||
// plugin: String, args object, plugin instance, or plugin constructor
|
||||
//
|
||||
// args:
|
||||
// This object will be passed to the plugin constructor
|
||||
//
|
||||
// index: Integer
|
||||
// Used when creating an instance from
|
||||
// something already in this.plugins. Ensures that the new
|
||||
// instance is assigned to this.plugins at that index.
|
||||
var args=lang.isString(plugin)?{name:plugin}:lang.isFunction(plugin)?{ctor:plugin}:plugin;
|
||||
if(!args.setEditor){
|
||||
var o={"args":args,"plugin":null,"editor":this};
|
||||
if(args.name){
|
||||
// search registry for a plugin factory matching args.name, if it's not there then
|
||||
// fallback to 1.0 API:
|
||||
// ask all loaded plugin modules to fill in o.plugin if they can (ie, if they implement args.name)
|
||||
// remove fallback for 2.0.
|
||||
if(_Plugin.registry[args.name]){
|
||||
o.plugin = _Plugin.registry[args.name](args);
|
||||
}else{
|
||||
topic.publish(dijit._scopeName + ".Editor.getPlugin", o); // publish
|
||||
}
|
||||
}
|
||||
if(!o.plugin){
|
||||
var pc = args.ctor || lang.getObject(args.name);
|
||||
if(pc){
|
||||
o.plugin=new pc(args);
|
||||
}
|
||||
}
|
||||
if(!o.plugin){
|
||||
console.warn('Cannot find plugin',plugin);
|
||||
return;
|
||||
}
|
||||
plugin=o.plugin;
|
||||
}
|
||||
if(arguments.length > 1){
|
||||
this._plugins[index] = plugin;
|
||||
}else{
|
||||
this._plugins.push(plugin);
|
||||
}
|
||||
plugin.setEditor(this);
|
||||
if(lang.isFunction(plugin.setToolbar)){
|
||||
plugin.setToolbar(this.toolbar);
|
||||
}
|
||||
},
|
||||
|
||||
//the following 2 functions are required to make the editor play nice under a layout widget, see #4070
|
||||
|
||||
resize: function(size){
|
||||
// summary:
|
||||
// Resize the editor to the specified size, see `dijit.layout._LayoutWidget.resize`
|
||||
if(size){
|
||||
// we've been given a height/width for the entire editor (toolbar + contents), calls layout()
|
||||
// to split the allocated size between the toolbar and the contents
|
||||
_LayoutWidget.prototype.resize.apply(this, arguments);
|
||||
}
|
||||
/*
|
||||
else{
|
||||
// do nothing, the editor is already laid out correctly. The user has probably specified
|
||||
// the height parameter, which was used to set a size on the iframe
|
||||
}
|
||||
*/
|
||||
},
|
||||
layout: function(){
|
||||
// summary:
|
||||
// Called from `dijit.layout._LayoutWidget.resize`. This shouldn't be called directly
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
// Converts the iframe (or rather the <div> surrounding it) to take all the available space
|
||||
// except what's needed for the header (toolbars) and footer (breadcrumbs, etc).
|
||||
// A class was added to the iframe container and some themes style it, so we have to
|
||||
// calc off the added margins and padding too. See tracker: #10662
|
||||
var areaHeight = (this._contentBox.h -
|
||||
(this.getHeaderHeight() + this.getFooterHeight() +
|
||||
domGeometry.getPadBorderExtents(this.iframe.parentNode).h +
|
||||
domGeometry.getMarginExtents(this.iframe.parentNode).h));
|
||||
this.editingArea.style.height = areaHeight + "px";
|
||||
if(this.iframe){
|
||||
this.iframe.style.height="100%";
|
||||
}
|
||||
this._layoutMode = true;
|
||||
},
|
||||
|
||||
_onIEMouseDown: function(/*Event*/ e){
|
||||
// summary:
|
||||
// IE only to prevent 2 clicks to focus
|
||||
// tags:
|
||||
// private
|
||||
var outsideClientArea;
|
||||
// IE 8's componentFromPoint is broken, which is a shame since it
|
||||
// was smaller code, but oh well. We have to do this brute force
|
||||
// to detect if the click was scroller or not.
|
||||
var b = this.document.body;
|
||||
var clientWidth = b.clientWidth;
|
||||
var clientHeight = b.clientHeight;
|
||||
var clientLeft = b.clientLeft;
|
||||
var offsetWidth = b.offsetWidth;
|
||||
var offsetHeight = b.offsetHeight;
|
||||
var offsetLeft = b.offsetLeft;
|
||||
|
||||
//Check for vertical scroller click.
|
||||
if(/^rtl$/i.test(b.dir || "")){
|
||||
if(clientWidth < offsetWidth && e.x > clientWidth && e.x < offsetWidth){
|
||||
// Check the click was between width and offset width, if so, scroller
|
||||
outsideClientArea = true;
|
||||
}
|
||||
}else{
|
||||
// RTL mode, we have to go by the left offsets.
|
||||
if(e.x < clientLeft && e.x > offsetLeft){
|
||||
// Check the click was between width and offset width, if so, scroller
|
||||
outsideClientArea = true;
|
||||
}
|
||||
}
|
||||
if(!outsideClientArea){
|
||||
// Okay, might be horiz scroller, check that.
|
||||
if(clientHeight < offsetHeight && e.y > clientHeight && e.y < offsetHeight){
|
||||
// Horizontal scroller.
|
||||
outsideClientArea = true;
|
||||
}
|
||||
}
|
||||
if(!outsideClientArea){
|
||||
delete this._cursorToStart; // Remove the force to cursor to start position.
|
||||
delete this._savedSelection; // new mouse position overrides old selection
|
||||
if(e.target.tagName == "BODY"){
|
||||
setTimeout(lang.hitch(this, "placeCursorAtEnd"), 0);
|
||||
}
|
||||
this.inherited(arguments);
|
||||
}
|
||||
},
|
||||
onBeforeActivate: function(){
|
||||
this._restoreSelection();
|
||||
},
|
||||
onBeforeDeactivate: function(e){
|
||||
// summary:
|
||||
// Called on IE right before focus is lost. Saves the selected range.
|
||||
// tags:
|
||||
// private
|
||||
if(this.customUndo){
|
||||
this.endEditing(true);
|
||||
}
|
||||
//in IE, the selection will be lost when other elements get focus,
|
||||
//let's save focus before the editor is deactivated
|
||||
if(e.target.tagName != "BODY"){
|
||||
this._saveSelection();
|
||||
}
|
||||
//console.log('onBeforeDeactivate',this);
|
||||
},
|
||||
|
||||
/* beginning of custom undo/redo support */
|
||||
|
||||
// customUndo: Boolean
|
||||
// Whether we shall use custom undo/redo support instead of the native
|
||||
// browser support. By default, we now use custom undo. It works better
|
||||
// than native browser support and provides a consistent behavior across
|
||||
// browsers with a minimal performance hit. We already had the hit on
|
||||
// the slowest browser, IE, anyway.
|
||||
customUndo: true,
|
||||
|
||||
// editActionInterval: Integer
|
||||
// When using customUndo, not every keystroke will be saved as a step.
|
||||
// Instead typing (including delete) will be grouped together: after
|
||||
// a user stops typing for editActionInterval seconds, a step will be
|
||||
// saved; if a user resume typing within editActionInterval seconds,
|
||||
// the timeout will be restarted. By default, editActionInterval is 3
|
||||
// seconds.
|
||||
editActionInterval: 3,
|
||||
|
||||
beginEditing: function(cmd){
|
||||
// summary:
|
||||
// Called to note that the user has started typing alphanumeric characters, if it's not already noted.
|
||||
// Deals with saving undo; see editActionInterval parameter.
|
||||
// tags:
|
||||
// private
|
||||
if(!this._inEditing){
|
||||
this._inEditing=true;
|
||||
this._beginEditing(cmd);
|
||||
}
|
||||
if(this.editActionInterval>0){
|
||||
if(this._editTimer){
|
||||
clearTimeout(this._editTimer);
|
||||
}
|
||||
this._editTimer = setTimeout(lang.hitch(this, this.endEditing), this._editInterval);
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: declaring these in the prototype is meaningless, just create in the constructor/postCreate
|
||||
_steps:[],
|
||||
_undoedSteps:[],
|
||||
|
||||
execCommand: function(cmd){
|
||||
// summary:
|
||||
// Main handler for executing any commands to the editor, like paste, bold, etc.
|
||||
// Called by plugins, but not meant to be called by end users.
|
||||
// tags:
|
||||
// protected
|
||||
if(this.customUndo && (cmd == 'undo' || cmd == 'redo')){
|
||||
return this[cmd]();
|
||||
}else{
|
||||
if(this.customUndo){
|
||||
this.endEditing();
|
||||
this._beginEditing();
|
||||
}
|
||||
var r = this.inherited(arguments);
|
||||
if(this.customUndo){
|
||||
this._endEditing();
|
||||
}
|
||||
return r;
|
||||
}
|
||||
},
|
||||
|
||||
_pasteImpl: function(){
|
||||
// summary:
|
||||
// Over-ride of paste command control to make execCommand cleaner
|
||||
// tags:
|
||||
// Protected
|
||||
return this._clipboardCommand("paste");
|
||||
},
|
||||
|
||||
_cutImpl: function(){
|
||||
// summary:
|
||||
// Over-ride of cut command control to make execCommand cleaner
|
||||
// tags:
|
||||
// Protected
|
||||
return this._clipboardCommand("cut");
|
||||
},
|
||||
|
||||
_copyImpl: function(){
|
||||
// summary:
|
||||
// Over-ride of copy command control to make execCommand cleaner
|
||||
// tags:
|
||||
// Protected
|
||||
return this._clipboardCommand("copy");
|
||||
},
|
||||
|
||||
_clipboardCommand: function(cmd){
|
||||
// summary:
|
||||
// Function to handle processing clipboard commands (or at least try to).
|
||||
// tags:
|
||||
// Private
|
||||
var r;
|
||||
try{
|
||||
// Try to exec the superclass exec-command and see if it works.
|
||||
r = this.document.execCommand(cmd, false, null);
|
||||
if(has("webkit") && !r){ //see #4598: webkit does not guarantee clipboard support from js
|
||||
throw { code: 1011 }; // throw an object like Mozilla's error
|
||||
}
|
||||
}catch(e){
|
||||
//TODO: when else might we get an exception? Do we need the Mozilla test below?
|
||||
if(e.code == 1011 /* Mozilla: service denied */){
|
||||
// Warn user of platform limitation. Cannot programmatically access clipboard. See ticket #4136
|
||||
var sub = string.substitute,
|
||||
accel = {cut:'X', copy:'C', paste:'V'};
|
||||
alert(sub(this.commands.systemShortcut,
|
||||
[this.commands[cmd], sub(this.commands[has("mac") ? 'appleKey' : 'ctrlKey'], [accel[cmd]])]));
|
||||
}
|
||||
r = false;
|
||||
}
|
||||
return r;
|
||||
},
|
||||
|
||||
queryCommandEnabled: function(cmd){
|
||||
// summary:
|
||||
// Returns true if specified editor command is enabled.
|
||||
// Used by the plugins to know when to highlight/not highlight buttons.
|
||||
// tags:
|
||||
// protected
|
||||
if(this.customUndo && (cmd == 'undo' || cmd == 'redo')){
|
||||
return cmd == 'undo' ? (this._steps.length > 1) : (this._undoedSteps.length > 0);
|
||||
}else{
|
||||
return this.inherited(arguments);
|
||||
}
|
||||
},
|
||||
_moveToBookmark: function(b){
|
||||
// summary:
|
||||
// Selects the text specified in bookmark b
|
||||
// tags:
|
||||
// private
|
||||
var bookmark = b.mark;
|
||||
var mark = b.mark;
|
||||
var col = b.isCollapsed;
|
||||
var r, sNode, eNode, sel;
|
||||
if(mark){
|
||||
if(has("ie") < 9){
|
||||
if(lang.isArray(mark)){
|
||||
//IE CONTROL, have to use the native bookmark.
|
||||
bookmark = [];
|
||||
array.forEach(mark,function(n){
|
||||
bookmark.push(rangeapi.getNode(n,this.editNode));
|
||||
},this);
|
||||
win.withGlobal(this.window,'moveToBookmark',dijit,[{mark: bookmark, isCollapsed: col}]);
|
||||
}else{
|
||||
if(mark.startContainer && mark.endContainer){
|
||||
// Use the pseudo WC3 range API. This works better for positions
|
||||
// than the IE native bookmark code.
|
||||
sel = rangeapi.getSelection(this.window);
|
||||
if(sel && sel.removeAllRanges){
|
||||
sel.removeAllRanges();
|
||||
r = rangeapi.create(this.window);
|
||||
sNode = rangeapi.getNode(mark.startContainer,this.editNode);
|
||||
eNode = rangeapi.getNode(mark.endContainer,this.editNode);
|
||||
if(sNode && eNode){
|
||||
// Okay, we believe we found the position, so add it into the selection
|
||||
// There are cases where it may not be found, particularly in undo/redo, when
|
||||
// IE changes the underlying DOM on us (wraps text in a <p> tag or similar.
|
||||
// So, in those cases, don't bother restoring selection.
|
||||
r.setStart(sNode,mark.startOffset);
|
||||
r.setEnd(eNode,mark.endOffset);
|
||||
sel.addRange(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{//w3c range
|
||||
sel = rangeapi.getSelection(this.window);
|
||||
if(sel && sel.removeAllRanges){
|
||||
sel.removeAllRanges();
|
||||
r = rangeapi.create(this.window);
|
||||
sNode = rangeapi.getNode(mark.startContainer,this.editNode);
|
||||
eNode = rangeapi.getNode(mark.endContainer,this.editNode);
|
||||
if(sNode && eNode){
|
||||
// Okay, we believe we found the position, so add it into the selection
|
||||
// There are cases where it may not be found, particularly in undo/redo, when
|
||||
// formatting as been done and so on, so don't restore selection then.
|
||||
r.setStart(sNode,mark.startOffset);
|
||||
r.setEnd(eNode,mark.endOffset);
|
||||
sel.addRange(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
_changeToStep: function(from, to){
|
||||
// summary:
|
||||
// Reverts editor to "to" setting, from the undo stack.
|
||||
// tags:
|
||||
// private
|
||||
this.setValue(to.text);
|
||||
var b=to.bookmark;
|
||||
if(!b){ return; }
|
||||
this._moveToBookmark(b);
|
||||
},
|
||||
undo: function(){
|
||||
// summary:
|
||||
// Handler for editor undo (ex: ctrl-z) operation
|
||||
// tags:
|
||||
// private
|
||||
//console.log('undo');
|
||||
var ret = false;
|
||||
if(!this._undoRedoActive){
|
||||
this._undoRedoActive = true;
|
||||
this.endEditing(true);
|
||||
var s=this._steps.pop();
|
||||
if(s && this._steps.length>0){
|
||||
this.focus();
|
||||
this._changeToStep(s,this._steps[this._steps.length-1]);
|
||||
this._undoedSteps.push(s);
|
||||
this.onDisplayChanged();
|
||||
delete this._undoRedoActive;
|
||||
ret = true;
|
||||
}
|
||||
delete this._undoRedoActive;
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
redo: function(){
|
||||
// summary:
|
||||
// Handler for editor redo (ex: ctrl-y) operation
|
||||
// tags:
|
||||
// private
|
||||
//console.log('redo');
|
||||
var ret = false;
|
||||
if(!this._undoRedoActive){
|
||||
this._undoRedoActive = true;
|
||||
this.endEditing(true);
|
||||
var s=this._undoedSteps.pop();
|
||||
if(s && this._steps.length>0){
|
||||
this.focus();
|
||||
this._changeToStep(this._steps[this._steps.length-1],s);
|
||||
this._steps.push(s);
|
||||
this.onDisplayChanged();
|
||||
ret = true;
|
||||
}
|
||||
delete this._undoRedoActive;
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
endEditing: function(ignore_caret){
|
||||
// summary:
|
||||
// Called to note that the user has stopped typing alphanumeric characters, if it's not already noted.
|
||||
// Deals with saving undo; see editActionInterval parameter.
|
||||
// tags:
|
||||
// private
|
||||
if(this._editTimer){
|
||||
clearTimeout(this._editTimer);
|
||||
}
|
||||
if(this._inEditing){
|
||||
this._endEditing(ignore_caret);
|
||||
this._inEditing=false;
|
||||
}
|
||||
},
|
||||
|
||||
_getBookmark: function(){
|
||||
// summary:
|
||||
// Get the currently selected text
|
||||
// tags:
|
||||
// protected
|
||||
var b=win.withGlobal(this.window,focusBase.getBookmark);
|
||||
var tmp=[];
|
||||
if(b && b.mark){
|
||||
var mark = b.mark;
|
||||
if(has("ie") < 9){
|
||||
// Try to use the pseudo range API on IE for better accuracy.
|
||||
var sel = rangeapi.getSelection(this.window);
|
||||
if(!lang.isArray(mark)){
|
||||
if(sel){
|
||||
var range;
|
||||
if(sel.rangeCount){
|
||||
range = sel.getRangeAt(0);
|
||||
}
|
||||
if(range){
|
||||
b.mark = range.cloneRange();
|
||||
}else{
|
||||
b.mark = win.withGlobal(this.window,focusBase.getBookmark);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// Control ranges (img, table, etc), handle differently.
|
||||
array.forEach(b.mark,function(n){
|
||||
tmp.push(rangeapi.getIndex(n,this.editNode).o);
|
||||
},this);
|
||||
b.mark = tmp;
|
||||
}
|
||||
}
|
||||
try{
|
||||
if(b.mark && b.mark.startContainer){
|
||||
tmp=rangeapi.getIndex(b.mark.startContainer,this.editNode).o;
|
||||
b.mark={startContainer:tmp,
|
||||
startOffset:b.mark.startOffset,
|
||||
endContainer:b.mark.endContainer===b.mark.startContainer?tmp:rangeapi.getIndex(b.mark.endContainer,this.editNode).o,
|
||||
endOffset:b.mark.endOffset};
|
||||
}
|
||||
}catch(e){
|
||||
b.mark = null;
|
||||
}
|
||||
}
|
||||
return b;
|
||||
},
|
||||
_beginEditing: function(){
|
||||
// summary:
|
||||
// Called when the user starts typing alphanumeric characters.
|
||||
// Deals with saving undo; see editActionInterval parameter.
|
||||
// tags:
|
||||
// private
|
||||
if(this._steps.length === 0){
|
||||
// You want to use the editor content without post filtering
|
||||
// to make sure selection restores right for the 'initial' state.
|
||||
// and undo is called. So not using this.value, as it was 'processed'
|
||||
// and the line-up for selections may have been altered.
|
||||
this._steps.push({'text':html.getChildrenHtml(this.editNode),'bookmark':this._getBookmark()});
|
||||
}
|
||||
},
|
||||
_endEditing: function(){
|
||||
// summary:
|
||||
// Called when the user stops typing alphanumeric characters.
|
||||
// Deals with saving undo; see editActionInterval parameter.
|
||||
// tags:
|
||||
// private
|
||||
// Avoid filtering to make sure selections restore.
|
||||
var v = html.getChildrenHtml(this.editNode);
|
||||
|
||||
this._undoedSteps=[];//clear undoed steps
|
||||
this._steps.push({text: v, bookmark: this._getBookmark()});
|
||||
},
|
||||
onKeyDown: function(e){
|
||||
// summary:
|
||||
// Handler for onkeydown event.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
//We need to save selection if the user TAB away from this editor
|
||||
//no need to call _saveSelection for IE, as that will be taken care of in onBeforeDeactivate
|
||||
if(!has("ie") && !this.iframe && e.keyCode == keys.TAB && !this.tabIndent){
|
||||
this._saveSelection();
|
||||
}
|
||||
if(!this.customUndo){
|
||||
this.inherited(arguments);
|
||||
return;
|
||||
}
|
||||
var k = e.keyCode;
|
||||
if(e.ctrlKey && !e.altKey){//undo and redo only if the special right Alt + z/y are not pressed #5892
|
||||
if(k == 90 || k == 122){ //z
|
||||
event.stop(e);
|
||||
this.undo();
|
||||
return;
|
||||
}else if(k == 89 || k == 121){ //y
|
||||
event.stop(e);
|
||||
this.redo();
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.inherited(arguments);
|
||||
|
||||
switch(k){
|
||||
case keys.ENTER:
|
||||
case keys.BACKSPACE:
|
||||
case keys.DELETE:
|
||||
this.beginEditing();
|
||||
break;
|
||||
case 88: //x
|
||||
case 86: //v
|
||||
if(e.ctrlKey && !e.altKey && !e.metaKey){
|
||||
this.endEditing();//end current typing step if any
|
||||
if(e.keyCode == 88){
|
||||
this.beginEditing('cut');
|
||||
//use timeout to trigger after the cut is complete
|
||||
setTimeout(lang.hitch(this, this.endEditing), 1);
|
||||
}else{
|
||||
this.beginEditing('paste');
|
||||
//use timeout to trigger after the paste is complete
|
||||
setTimeout(lang.hitch(this, this.endEditing), 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
//pass through
|
||||
default:
|
||||
if(!e.ctrlKey && !e.altKey && !e.metaKey && (e.keyCode<keys.F1 || e.keyCode>keys.F15)){
|
||||
this.beginEditing();
|
||||
break;
|
||||
}
|
||||
//pass through
|
||||
case keys.ALT:
|
||||
this.endEditing();
|
||||
break;
|
||||
case keys.UP_ARROW:
|
||||
case keys.DOWN_ARROW:
|
||||
case keys.LEFT_ARROW:
|
||||
case keys.RIGHT_ARROW:
|
||||
case keys.HOME:
|
||||
case keys.END:
|
||||
case keys.PAGE_UP:
|
||||
case keys.PAGE_DOWN:
|
||||
this.endEditing(true);
|
||||
break;
|
||||
//maybe ctrl+backspace/delete, so don't endEditing when ctrl is pressed
|
||||
case keys.CTRL:
|
||||
case keys.SHIFT:
|
||||
case keys.TAB:
|
||||
break;
|
||||
}
|
||||
},
|
||||
_onBlur: function(){
|
||||
// summary:
|
||||
// Called from focus manager when focus has moved away from this editor
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
//this._saveSelection();
|
||||
this.inherited(arguments);
|
||||
this.endEditing(true);
|
||||
},
|
||||
_saveSelection: function(){
|
||||
// summary:
|
||||
// Save the currently selected text in _savedSelection attribute
|
||||
// tags:
|
||||
// private
|
||||
try{
|
||||
this._savedSelection=this._getBookmark();
|
||||
}catch(e){ /* Squelch any errors that occur if selection save occurs due to being hidden simultaneously. */}
|
||||
},
|
||||
_restoreSelection: function(){
|
||||
// summary:
|
||||
// Re-select the text specified in _savedSelection attribute;
|
||||
// see _saveSelection().
|
||||
// tags:
|
||||
// private
|
||||
if(this._savedSelection){
|
||||
// Clear off cursor to start, we're deliberately going to a selection.
|
||||
delete this._cursorToStart;
|
||||
// only restore the selection if the current range is collapsed
|
||||
// if not collapsed, then it means the editor does not lose
|
||||
// selection and there is no need to restore it
|
||||
if(win.withGlobal(this.window,'isCollapsed',dijit)){
|
||||
this._moveToBookmark(this._savedSelection);
|
||||
}
|
||||
delete this._savedSelection;
|
||||
}
|
||||
},
|
||||
|
||||
onClick: function(){
|
||||
// summary:
|
||||
// Handler for when editor is clicked
|
||||
// tags:
|
||||
// protected
|
||||
this.endEditing(true);
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
replaceValue: function(/*String*/ html){
|
||||
// summary:
|
||||
// over-ride of replaceValue to support custom undo and stack maintenance.
|
||||
// tags:
|
||||
// protected
|
||||
if(!this.customUndo){
|
||||
this.inherited(arguments);
|
||||
}else{
|
||||
if(this.isClosed){
|
||||
this.setValue(html);
|
||||
}else{
|
||||
this.beginEditing();
|
||||
if(!html){
|
||||
html = " "; //
|
||||
}
|
||||
this.setValue(html);
|
||||
this.endEditing();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_setDisabledAttr: function(/*Boolean*/ value){
|
||||
var disableFunc = lang.hitch(this, function(){
|
||||
if((!this.disabled && value) || (!this._buttonEnabledPlugins && value)){
|
||||
// Disable editor: disable all enabled buttons and remember that list
|
||||
array.forEach(this._plugins, function(p){
|
||||
p.set("disabled", true);
|
||||
});
|
||||
}else if(this.disabled && !value){
|
||||
// Restore plugins to being active.
|
||||
array.forEach(this._plugins, function(p){
|
||||
p.set("disabled", false);
|
||||
});
|
||||
}
|
||||
});
|
||||
this.setValueDeferred.addCallback(disableFunc);
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
_setStateClass: function(){
|
||||
try{
|
||||
this.inherited(arguments);
|
||||
|
||||
// Let theme set the editor's text color based on editor enabled/disabled state.
|
||||
// We need to jump through hoops because the main document (where the theme CSS is)
|
||||
// is separate from the iframe's document.
|
||||
if(this.document && this.document.body){
|
||||
domStyle.set(this.document.body, "color", domStyle.get(this.iframe, "color"));
|
||||
}
|
||||
}catch(e){ /* Squelch any errors caused by focus change if hidden during a state change */}
|
||||
}
|
||||
});
|
||||
|
||||
// Register the "default plugins", ie, the built-in editor commands
|
||||
function simplePluginFactory(args){
|
||||
return new _Plugin({ command: args.name });
|
||||
}
|
||||
function togglePluginFactory(args){
|
||||
return new _Plugin({ buttonClass: ToggleButton, command: args.name });
|
||||
}
|
||||
lang.mixin(_Plugin.registry, {
|
||||
"undo": simplePluginFactory,
|
||||
"redo": simplePluginFactory,
|
||||
"cut": simplePluginFactory,
|
||||
"copy": simplePluginFactory,
|
||||
"paste": simplePluginFactory,
|
||||
"insertOrderedList": simplePluginFactory,
|
||||
"insertUnorderedList": simplePluginFactory,
|
||||
"indent": simplePluginFactory,
|
||||
"outdent": simplePluginFactory,
|
||||
"justifyCenter": simplePluginFactory,
|
||||
"justifyFull": simplePluginFactory,
|
||||
"justifyLeft": simplePluginFactory,
|
||||
"justifyRight": simplePluginFactory,
|
||||
"delete": simplePluginFactory,
|
||||
"selectAll": simplePluginFactory,
|
||||
"removeFormat": simplePluginFactory,
|
||||
"unlink": simplePluginFactory,
|
||||
"insertHorizontalRule": simplePluginFactory,
|
||||
|
||||
"bold": togglePluginFactory,
|
||||
"italic": togglePluginFactory,
|
||||
"underline": togglePluginFactory,
|
||||
"strikethrough": togglePluginFactory,
|
||||
"subscript": togglePluginFactory,
|
||||
"superscript": togglePluginFactory,
|
||||
|
||||
"|": function(){
|
||||
return new _Plugin({ button: new ToolbarSeparator(), setEditor: function(editor){this.editor = editor;}});
|
||||
}
|
||||
});
|
||||
|
||||
return Editor;
|
||||
});
|
|
@ -1,235 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/InlineEditBox.html":"<span data-dojo-attach-point=\"editNode\" role=\"presentation\" style=\"position: absolute; visibility:hidden\" class=\"dijitReset dijitInline\"\n\tdata-dojo-attach-event=\"onkeypress: _onKeyPress\"\n\t><span data-dojo-attach-point=\"editorPlaceholder\"></span\n\t><span data-dojo-attach-point=\"buttonContainer\"\n\t\t><button data-dojo-type=\"dijit.form.Button\" data-dojo-props=\"label: '${buttonSave}', 'class': 'saveButton'\"\n\t\t\tdata-dojo-attach-point=\"saveButton\" data-dojo-attach-event=\"onClick:save\"></button\n\t\t><button data-dojo-type=\"dijit.form.Button\" data-dojo-props=\"label: '${buttonCancel}', 'class': 'cancelButton'\"\n\t\t\tdata-dojo-attach-point=\"cancelButton\" data-dojo-attach-event=\"onClick:cancel\"></button\n\t></span\n></span>\n"}});
|
||||
define("dijit/InlineEditBox",["dojo/_base/array","dojo/_base/declare","dojo/dom-attr","dojo/dom-class","dojo/dom-construct","dojo/dom-style","dojo/_base/event","dojo/i18n","dojo/_base/kernel","dojo/keys","dojo/_base/lang","dojo/_base/sniff","./focus","./_Widget","./_TemplatedMixin","./_WidgetsInTemplateMixin","./_Container","./form/Button","./form/_TextBoxMixin","./form/TextBox","dojo/text!./templates/InlineEditBox.html","dojo/i18n!./nls/common"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,fm,_d,_e,_f,_10,_11,_12,_13,_14){
|
||||
var _15=_2("dijit._InlineEditor",[_d,_e,_f],{templateString:_14,postMixInProperties:function(){
|
||||
this.inherited(arguments);
|
||||
this.messages=_8.getLocalization("dijit","common",this.lang);
|
||||
_1.forEach(["buttonSave","buttonCancel"],function(_16){
|
||||
if(!this[_16]){
|
||||
this[_16]=this.messages[_16];
|
||||
}
|
||||
},this);
|
||||
},buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
var cls=typeof this.editor=="string"?_b.getObject(this.editor):this.editor;
|
||||
var _17=this.sourceStyle,_18="line-height:"+_17.lineHeight+";",_19=_6.getComputedStyle(this.domNode);
|
||||
_1.forEach(["Weight","Family","Size","Style"],function(_1a){
|
||||
var _1b=_17["font"+_1a],_1c=_19["font"+_1a];
|
||||
if(_1c!=_1b){
|
||||
_18+="font-"+_1a+":"+_17["font"+_1a]+";";
|
||||
}
|
||||
},this);
|
||||
_1.forEach(["marginTop","marginBottom","marginLeft","marginRight"],function(_1d){
|
||||
this.domNode.style[_1d]=_17[_1d];
|
||||
},this);
|
||||
var _1e=this.inlineEditBox.width;
|
||||
if(_1e=="100%"){
|
||||
_18+="width:100%;";
|
||||
this.domNode.style.display="block";
|
||||
}else{
|
||||
_18+="width:"+(_1e+(Number(_1e)==_1e?"px":""))+";";
|
||||
}
|
||||
var _1f=_b.delegate(this.inlineEditBox.editorParams,{style:_18,dir:this.dir,lang:this.lang,textDir:this.textDir});
|
||||
_1f["displayedValue" in cls.prototype?"displayedValue":"value"]=this.value;
|
||||
this.editWidget=new cls(_1f,this.editorPlaceholder);
|
||||
if(this.inlineEditBox.autoSave){
|
||||
_5.destroy(this.buttonContainer);
|
||||
}
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
var ew=this.editWidget;
|
||||
if(this.inlineEditBox.autoSave){
|
||||
this.connect(ew,"onChange","_onChange");
|
||||
this.connect(ew,"onKeyPress","_onKeyPress");
|
||||
}else{
|
||||
if("intermediateChanges" in ew){
|
||||
ew.set("intermediateChanges",true);
|
||||
this.connect(ew,"onChange","_onIntermediateChange");
|
||||
this.saveButton.set("disabled",true);
|
||||
}
|
||||
}
|
||||
},_onIntermediateChange:function(){
|
||||
this.saveButton.set("disabled",(this.getValue()==this._resetValue)||!this.enableSave());
|
||||
},destroy:function(){
|
||||
this.editWidget.destroy(true);
|
||||
this.inherited(arguments);
|
||||
},getValue:function(){
|
||||
var ew=this.editWidget;
|
||||
return String(ew.get("displayedValue" in ew?"displayedValue":"value"));
|
||||
},_onKeyPress:function(e){
|
||||
if(this.inlineEditBox.autoSave&&this.inlineEditBox.editing){
|
||||
if(e.altKey||e.ctrlKey){
|
||||
return;
|
||||
}
|
||||
if(e.charOrCode==_a.ESCAPE){
|
||||
_7.stop(e);
|
||||
this.cancel(true);
|
||||
}else{
|
||||
if(e.charOrCode==_a.ENTER&&e.target.tagName=="INPUT"){
|
||||
_7.stop(e);
|
||||
this._onChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
},_onBlur:function(){
|
||||
this.inherited(arguments);
|
||||
if(this.inlineEditBox.autoSave&&this.inlineEditBox.editing){
|
||||
if(this.getValue()==this._resetValue){
|
||||
this.cancel(false);
|
||||
}else{
|
||||
if(this.enableSave()){
|
||||
this.save(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
},_onChange:function(){
|
||||
if(this.inlineEditBox.autoSave&&this.inlineEditBox.editing&&this.enableSave()){
|
||||
fm.focus(this.inlineEditBox.displayNode);
|
||||
}
|
||||
},enableSave:function(){
|
||||
return (this.editWidget.isValid?this.editWidget.isValid():true);
|
||||
},focus:function(){
|
||||
this.editWidget.focus();
|
||||
setTimeout(_b.hitch(this,function(){
|
||||
if(this.editWidget.focusNode&&this.editWidget.focusNode.tagName=="INPUT"){
|
||||
_12.selectInputText(this.editWidget.focusNode);
|
||||
}
|
||||
}),0);
|
||||
}});
|
||||
var _20=_2("dijit.InlineEditBox",_d,{editing:false,autoSave:true,buttonSave:"",buttonCancel:"",renderAsHtml:false,editor:_13,editorWrapper:_15,editorParams:{},disabled:false,onChange:function(){
|
||||
},onCancel:function(){
|
||||
},width:"100%",value:"",noValueIndicator:_c("ie")<=6?"<span style='font-family: wingdings; text-decoration: underline;'>    ✍    </span>":"<span style='text-decoration: underline;'>    ✍    </span>",constructor:function(){
|
||||
this.editorParams={};
|
||||
},postMixInProperties:function(){
|
||||
this.inherited(arguments);
|
||||
this.displayNode=this.srcNodeRef;
|
||||
var _21={ondijitclick:"_onClick",onmouseover:"_onMouseOver",onmouseout:"_onMouseOut",onfocus:"_onMouseOver",onblur:"_onMouseOut"};
|
||||
for(var _22 in _21){
|
||||
this.connect(this.displayNode,_22,_21[_22]);
|
||||
}
|
||||
this.displayNode.setAttribute("role","button");
|
||||
if(!this.displayNode.getAttribute("tabIndex")){
|
||||
this.displayNode.setAttribute("tabIndex",0);
|
||||
}
|
||||
if(!this.value&&!("value" in this.params)){
|
||||
this.value=_b.trim(this.renderAsHtml?this.displayNode.innerHTML:(this.displayNode.innerText||this.displayNode.textContent||""));
|
||||
}
|
||||
if(!this.value){
|
||||
this.displayNode.innerHTML=this.noValueIndicator;
|
||||
}
|
||||
_4.add(this.displayNode,"dijitInlineEditBoxDisplayMode");
|
||||
},setDisabled:function(_23){
|
||||
_9.deprecated("dijit.InlineEditBox.setDisabled() is deprecated. Use set('disabled', bool) instead.","","2.0");
|
||||
this.set("disabled",_23);
|
||||
},_setDisabledAttr:function(_24){
|
||||
this.domNode.setAttribute("aria-disabled",_24);
|
||||
if(_24){
|
||||
this.displayNode.removeAttribute("tabIndex");
|
||||
}else{
|
||||
this.displayNode.setAttribute("tabIndex",0);
|
||||
}
|
||||
_4.toggle(this.displayNode,"dijitInlineEditBoxDisplayModeDisabled",_24);
|
||||
this._set("disabled",_24);
|
||||
},_onMouseOver:function(){
|
||||
if(!this.disabled){
|
||||
_4.add(this.displayNode,"dijitInlineEditBoxDisplayModeHover");
|
||||
}
|
||||
},_onMouseOut:function(){
|
||||
_4.remove(this.displayNode,"dijitInlineEditBoxDisplayModeHover");
|
||||
},_onClick:function(e){
|
||||
if(this.disabled){
|
||||
return;
|
||||
}
|
||||
if(e){
|
||||
_7.stop(e);
|
||||
}
|
||||
this._onMouseOut();
|
||||
setTimeout(_b.hitch(this,"edit"),0);
|
||||
},edit:function(){
|
||||
if(this.disabled||this.editing){
|
||||
return;
|
||||
}
|
||||
this._set("editing",true);
|
||||
this._savedPosition=_6.get(this.displayNode,"position")||"static";
|
||||
this._savedOpacity=_6.get(this.displayNode,"opacity")||"1";
|
||||
this._savedTabIndex=_3.get(this.displayNode,"tabIndex")||"0";
|
||||
if(this.wrapperWidget){
|
||||
var ew=this.wrapperWidget.editWidget;
|
||||
ew.set("displayedValue" in ew?"displayedValue":"value",this.value);
|
||||
}else{
|
||||
var _25=_5.create("span",null,this.domNode,"before");
|
||||
var ewc=typeof this.editorWrapper=="string"?_b.getObject(this.editorWrapper):this.editorWrapper;
|
||||
this.wrapperWidget=new ewc({value:this.value,buttonSave:this.buttonSave,buttonCancel:this.buttonCancel,dir:this.dir,lang:this.lang,tabIndex:this._savedTabIndex,editor:this.editor,inlineEditBox:this,sourceStyle:_6.getComputedStyle(this.displayNode),save:_b.hitch(this,"save"),cancel:_b.hitch(this,"cancel"),textDir:this.textDir},_25);
|
||||
if(!this._started){
|
||||
this.startup();
|
||||
}
|
||||
}
|
||||
var ww=this.wrapperWidget;
|
||||
_6.set(this.displayNode,{position:"absolute",opacity:"0"});
|
||||
_6.set(ww.domNode,{position:this._savedPosition,visibility:"visible",opacity:"1"});
|
||||
_3.set(this.displayNode,"tabIndex","-1");
|
||||
setTimeout(_b.hitch(ww,function(){
|
||||
this.focus();
|
||||
this._resetValue=this.getValue();
|
||||
}),0);
|
||||
},_onBlur:function(){
|
||||
this.inherited(arguments);
|
||||
if(!this.editing){
|
||||
}
|
||||
},destroy:function(){
|
||||
if(this.wrapperWidget&&!this.wrapperWidget._destroyed){
|
||||
this.wrapperWidget.destroy();
|
||||
delete this.wrapperWidget;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},_showText:function(_26){
|
||||
var ww=this.wrapperWidget;
|
||||
_6.set(ww.domNode,{position:"absolute",visibility:"hidden",opacity:"0"});
|
||||
_6.set(this.displayNode,{position:this._savedPosition,opacity:this._savedOpacity});
|
||||
_3.set(this.displayNode,"tabIndex",this._savedTabIndex);
|
||||
if(_26){
|
||||
fm.focus(this.displayNode);
|
||||
}
|
||||
},save:function(_27){
|
||||
if(this.disabled||!this.editing){
|
||||
return;
|
||||
}
|
||||
this._set("editing",false);
|
||||
var ww=this.wrapperWidget;
|
||||
var _28=ww.getValue();
|
||||
this.set("value",_28);
|
||||
this._showText(_27);
|
||||
},setValue:function(val){
|
||||
_9.deprecated("dijit.InlineEditBox.setValue() is deprecated. Use set('value', ...) instead.","","2.0");
|
||||
return this.set("value",val);
|
||||
},_setValueAttr:function(val){
|
||||
val=_b.trim(val);
|
||||
var _29=this.renderAsHtml?val:val.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">").replace(/"/gm,""").replace(/\n/g,"<br>");
|
||||
this.displayNode.innerHTML=_29||this.noValueIndicator;
|
||||
this._set("value",val);
|
||||
if(this._started){
|
||||
setTimeout(_b.hitch(this,"onChange",val),0);
|
||||
}
|
||||
if(this.textDir=="auto"){
|
||||
this.applyTextDir(this.displayNode,this.displayNode.innerText);
|
||||
}
|
||||
},getValue:function(){
|
||||
_9.deprecated("dijit.InlineEditBox.getValue() is deprecated. Use get('value') instead.","","2.0");
|
||||
return this.get("value");
|
||||
},cancel:function(_2a){
|
||||
if(this.disabled||!this.editing){
|
||||
return;
|
||||
}
|
||||
this._set("editing",false);
|
||||
setTimeout(_b.hitch(this,"onCancel"),0);
|
||||
this._showText(_2a);
|
||||
},_setTextDirAttr:function(_2b){
|
||||
if(!this._created||this.textDir!=_2b){
|
||||
this._set("textDir",_2b);
|
||||
this.applyTextDir(this.displayNode,this.displayNode.innerText);
|
||||
this.displayNode.align=this.dir=="rtl"?"right":"left";
|
||||
}
|
||||
}});
|
||||
_20._InlineEditor=_15;
|
||||
return _20;
|
||||
});
|
|
@ -1,628 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/InlineEditBox.html':"<span data-dojo-attach-point=\"editNode\" role=\"presentation\" style=\"position: absolute; visibility:hidden\" class=\"dijitReset dijitInline\"\n\tdata-dojo-attach-event=\"onkeypress: _onKeyPress\"\n\t><span data-dojo-attach-point=\"editorPlaceholder\"></span\n\t><span data-dojo-attach-point=\"buttonContainer\"\n\t\t><button data-dojo-type=\"dijit.form.Button\" data-dojo-props=\"label: '${buttonSave}', 'class': 'saveButton'\"\n\t\t\tdata-dojo-attach-point=\"saveButton\" data-dojo-attach-event=\"onClick:save\"></button\n\t\t><button data-dojo-type=\"dijit.form.Button\" data-dojo-props=\"label: '${buttonCancel}', 'class': 'cancelButton'\"\n\t\t\tdata-dojo-attach-point=\"cancelButton\" data-dojo-attach-event=\"onClick:cancel\"></button\n\t></span\n></span>\n"}});
|
||||
define("dijit/InlineEditBox", [
|
||||
"dojo/_base/array", // array.forEach
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-attr", // domAttr.set domAttr.get
|
||||
"dojo/dom-class", // domClass.add domClass.remove domClass.toggle
|
||||
"dojo/dom-construct", // domConstruct.create domConstruct.destroy
|
||||
"dojo/dom-style", // domStyle.getComputedStyle domStyle.set domStyle.get
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/i18n", // i18n.getLocalization
|
||||
"dojo/_base/kernel", // kernel.deprecated
|
||||
"dojo/keys", // keys.ENTER keys.ESCAPE
|
||||
"dojo/_base/lang", // lang.getObject
|
||||
"dojo/_base/sniff", // has("ie")
|
||||
"./focus",
|
||||
"./_Widget",
|
||||
"./_TemplatedMixin",
|
||||
"./_WidgetsInTemplateMixin",
|
||||
"./_Container",
|
||||
"./form/Button",
|
||||
"./form/_TextBoxMixin",
|
||||
"./form/TextBox",
|
||||
"dojo/text!./templates/InlineEditBox.html",
|
||||
"dojo/i18n!./nls/common"
|
||||
], function(array, declare, domAttr, domClass, domConstruct, domStyle, event, i18n, kernel, keys, lang, has,
|
||||
fm, _Widget, _TemplatedMixin, _WidgetsInTemplateMixin, _Container, Button, _TextBoxMixin, TextBox, template){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
var _WidgetsInTemplateMixin = dijit._WidgetsInTemplateMixin;
|
||||
var _Container = dijit._Container;
|
||||
var Button = dijit.form.Button;
|
||||
var TextBox = dijit.form.TextBox;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/InlineEditBox
|
||||
// summary:
|
||||
// An element with in-line edit capabilities
|
||||
|
||||
var InlineEditor = declare("dijit._InlineEditor", [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin], {
|
||||
// summary:
|
||||
// Internal widget used by InlineEditBox, displayed when in editing mode
|
||||
// to display the editor and maybe save/cancel buttons. Calling code should
|
||||
// connect to save/cancel methods to detect when editing is finished
|
||||
//
|
||||
// Has mainly the same parameters as InlineEditBox, plus these values:
|
||||
//
|
||||
// style: Object
|
||||
// Set of CSS attributes of display node, to replicate in editor
|
||||
//
|
||||
// value: String
|
||||
// Value as an HTML string or plain text string, depending on renderAsHTML flag
|
||||
|
||||
templateString: template,
|
||||
|
||||
postMixInProperties: function(){
|
||||
this.inherited(arguments);
|
||||
this.messages = i18n.getLocalization("dijit", "common", this.lang);
|
||||
array.forEach(["buttonSave", "buttonCancel"], function(prop){
|
||||
if(!this[prop]){ this[prop] = this.messages[prop]; }
|
||||
}, this);
|
||||
},
|
||||
|
||||
buildRendering: function(){
|
||||
this.inherited(arguments);
|
||||
|
||||
// Create edit widget in place in the template
|
||||
var cls = typeof this.editor == "string" ? lang.getObject(this.editor) : this.editor;
|
||||
|
||||
// Copy the style from the source
|
||||
// Don't copy ALL properties though, just the necessary/applicable ones.
|
||||
// wrapperStyle/destStyle code is to workaround IE bug where getComputedStyle().fontSize
|
||||
// is a relative value like 200%, rather than an absolute value like 24px, and
|
||||
// the 200% can refer *either* to a setting on the node or it's ancestor (see #11175)
|
||||
var srcStyle = this.sourceStyle,
|
||||
editStyle = "line-height:" + srcStyle.lineHeight + ";",
|
||||
destStyle = domStyle.getComputedStyle(this.domNode);
|
||||
array.forEach(["Weight","Family","Size","Style"], function(prop){
|
||||
var textStyle = srcStyle["font"+prop],
|
||||
wrapperStyle = destStyle["font"+prop];
|
||||
if(wrapperStyle != textStyle){
|
||||
editStyle += "font-"+prop+":"+srcStyle["font"+prop]+";";
|
||||
}
|
||||
}, this);
|
||||
array.forEach(["marginTop","marginBottom","marginLeft", "marginRight"], function(prop){
|
||||
this.domNode.style[prop] = srcStyle[prop];
|
||||
}, this);
|
||||
var width = this.inlineEditBox.width;
|
||||
if(width == "100%"){
|
||||
// block mode
|
||||
editStyle += "width:100%;";
|
||||
this.domNode.style.display = "block";
|
||||
}else{
|
||||
// inline-block mode
|
||||
editStyle += "width:" + (width + (Number(width) == width ? "px" : "")) + ";";
|
||||
}
|
||||
var editorParams = lang.delegate(this.inlineEditBox.editorParams, {
|
||||
style: editStyle,
|
||||
dir: this.dir,
|
||||
lang: this.lang,
|
||||
textDir: this.textDir
|
||||
});
|
||||
editorParams[ "displayedValue" in cls.prototype ? "displayedValue" : "value"] = this.value;
|
||||
this.editWidget = new cls(editorParams, this.editorPlaceholder);
|
||||
|
||||
if(this.inlineEditBox.autoSave){
|
||||
// Remove the save/cancel buttons since saving is done by simply tabbing away or
|
||||
// selecting a value from the drop down list
|
||||
domConstruct.destroy(this.buttonContainer);
|
||||
}
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
this.inherited(arguments);
|
||||
|
||||
var ew = this.editWidget;
|
||||
|
||||
if(this.inlineEditBox.autoSave){
|
||||
// Selecting a value from a drop down list causes an onChange event and then we save
|
||||
this.connect(ew, "onChange", "_onChange");
|
||||
|
||||
// ESC and TAB should cancel and save. Note that edit widgets do a stopEvent() on ESC key (to
|
||||
// prevent Dialog from closing when the user just wants to revert the value in the edit widget),
|
||||
// so this is the only way we can see the key press event.
|
||||
this.connect(ew, "onKeyPress", "_onKeyPress");
|
||||
}else{
|
||||
// If possible, enable/disable save button based on whether the user has changed the value
|
||||
if("intermediateChanges" in ew){
|
||||
ew.set("intermediateChanges", true);
|
||||
this.connect(ew, "onChange", "_onIntermediateChange");
|
||||
this.saveButton.set("disabled", true);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_onIntermediateChange: function(/*===== val =====*/){
|
||||
// summary:
|
||||
// Called for editor widgets that support the intermediateChanges=true flag as a way
|
||||
// to detect when to enable/disabled the save button
|
||||
this.saveButton.set("disabled", (this.getValue() == this._resetValue) || !this.enableSave());
|
||||
},
|
||||
|
||||
destroy: function(){
|
||||
this.editWidget.destroy(true); // let the parent wrapper widget clean up the DOM
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
getValue: function(){
|
||||
// summary:
|
||||
// Return the [display] value of the edit widget
|
||||
var ew = this.editWidget;
|
||||
return String(ew.get("displayedValue" in ew ? "displayedValue" : "value"));
|
||||
},
|
||||
|
||||
_onKeyPress: function(e){
|
||||
// summary:
|
||||
// Handler for keypress in the edit box in autoSave mode.
|
||||
// description:
|
||||
// For autoSave widgets, if Esc/Enter, call cancel/save.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
if(this.inlineEditBox.autoSave && this.inlineEditBox.editing){
|
||||
if(e.altKey || e.ctrlKey){ return; }
|
||||
// If Enter/Esc pressed, treat as save/cancel.
|
||||
if(e.charOrCode == keys.ESCAPE){
|
||||
event.stop(e);
|
||||
this.cancel(true); // sets editing=false which short-circuits _onBlur processing
|
||||
}else if(e.charOrCode == keys.ENTER && e.target.tagName == "INPUT"){
|
||||
event.stop(e);
|
||||
this._onChange(); // fire _onBlur and then save
|
||||
}
|
||||
|
||||
// _onBlur will handle TAB automatically by allowing
|
||||
// the TAB to change focus before we mess with the DOM: #6227
|
||||
// Expounding by request:
|
||||
// The current focus is on the edit widget input field.
|
||||
// save() will hide and destroy this widget.
|
||||
// We want the focus to jump from the currently hidden
|
||||
// displayNode, but since it's hidden, it's impossible to
|
||||
// unhide it, focus it, and then have the browser focus
|
||||
// away from it to the next focusable element since each
|
||||
// of these events is asynchronous and the focus-to-next-element
|
||||
// is already queued.
|
||||
// So we allow the browser time to unqueue the move-focus event
|
||||
// before we do all the hide/show stuff.
|
||||
}
|
||||
},
|
||||
|
||||
_onBlur: function(){
|
||||
// summary:
|
||||
// Called when focus moves outside the editor
|
||||
// tags:
|
||||
// private
|
||||
|
||||
this.inherited(arguments);
|
||||
if(this.inlineEditBox.autoSave && this.inlineEditBox.editing){
|
||||
if(this.getValue() == this._resetValue){
|
||||
this.cancel(false);
|
||||
}else if(this.enableSave()){
|
||||
this.save(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_onChange: function(){
|
||||
// summary:
|
||||
// Called when the underlying widget fires an onChange event,
|
||||
// such as when the user selects a value from the drop down list of a ComboBox,
|
||||
// which means that the user has finished entering the value and we should save.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
if(this.inlineEditBox.autoSave && this.inlineEditBox.editing && this.enableSave()){
|
||||
fm.focus(this.inlineEditBox.displayNode); // fires _onBlur which will save the formatted value
|
||||
}
|
||||
},
|
||||
|
||||
enableSave: function(){
|
||||
// summary:
|
||||
// User overridable function returning a Boolean to indicate
|
||||
// if the Save button should be enabled or not - usually due to invalid conditions
|
||||
// tags:
|
||||
// extension
|
||||
return (
|
||||
this.editWidget.isValid
|
||||
? this.editWidget.isValid()
|
||||
: true
|
||||
);
|
||||
},
|
||||
|
||||
focus: function(){
|
||||
// summary:
|
||||
// Focus the edit widget.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
this.editWidget.focus();
|
||||
setTimeout(lang.hitch(this, function(){
|
||||
if(this.editWidget.focusNode && this.editWidget.focusNode.tagName == "INPUT"){
|
||||
_TextBoxMixin.selectInputText(this.editWidget.focusNode);
|
||||
}
|
||||
}), 0);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var InlineEditBox = declare("dijit.InlineEditBox", _Widget, {
|
||||
// summary:
|
||||
// An element with in-line edit capabilities
|
||||
//
|
||||
// description:
|
||||
// Behavior for an existing node (`<p>`, `<div>`, `<span>`, etc.) so that
|
||||
// when you click it, an editor shows up in place of the original
|
||||
// text. Optionally, Save and Cancel button are displayed below the edit widget.
|
||||
// When Save is clicked, the text is pulled from the edit
|
||||
// widget and redisplayed and the edit widget is again hidden.
|
||||
// By default a plain Textarea widget is used as the editor (or for
|
||||
// inline values a TextBox), but you can specify an editor such as
|
||||
// dijit.Editor (for editing HTML) or a Slider (for adjusting a number).
|
||||
// An edit widget must support the following API to be used:
|
||||
// - displayedValue or value as initialization parameter,
|
||||
// and available through set('displayedValue') / set('value')
|
||||
// - void focus()
|
||||
// - DOM-node focusNode = node containing editable text
|
||||
|
||||
// editing: [readonly] Boolean
|
||||
// Is the node currently in edit mode?
|
||||
editing: false,
|
||||
|
||||
// autoSave: Boolean
|
||||
// Changing the value automatically saves it; don't have to push save button
|
||||
// (and save button isn't even displayed)
|
||||
autoSave: true,
|
||||
|
||||
// buttonSave: String
|
||||
// Save button label
|
||||
buttonSave: "",
|
||||
|
||||
// buttonCancel: String
|
||||
// Cancel button label
|
||||
buttonCancel: "",
|
||||
|
||||
// renderAsHtml: Boolean
|
||||
// Set this to true if the specified Editor's value should be interpreted as HTML
|
||||
// rather than plain text (ex: `dijit.Editor`)
|
||||
renderAsHtml: false,
|
||||
|
||||
// editor: String|Function
|
||||
// Class name (or reference to the Class) for Editor widget
|
||||
editor: TextBox,
|
||||
|
||||
// editorWrapper: String|Function
|
||||
// Class name (or reference to the Class) for widget that wraps the editor widget, displaying save/cancel
|
||||
// buttons.
|
||||
editorWrapper: InlineEditor,
|
||||
|
||||
// editorParams: Object
|
||||
// Set of parameters for editor, like {required: true}
|
||||
editorParams: {},
|
||||
|
||||
// disabled: Boolean
|
||||
// If true, clicking the InlineEditBox to edit it will have no effect.
|
||||
disabled: false,
|
||||
|
||||
onChange: function(/*===== value =====*/){
|
||||
// summary:
|
||||
// Set this handler to be notified of changes to value.
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
|
||||
onCancel: function(){
|
||||
// summary:
|
||||
// Set this handler to be notified when editing is cancelled.
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
|
||||
// width: String
|
||||
// Width of editor. By default it's width=100% (ie, block mode).
|
||||
width: "100%",
|
||||
|
||||
// value: String
|
||||
// The display value of the widget in read-only mode
|
||||
value: "",
|
||||
|
||||
// noValueIndicator: [const] String
|
||||
// The text that gets displayed when there is no value (so that the user has a place to click to edit)
|
||||
noValueIndicator: has("ie") <= 6 ? // font-family needed on IE6 but it messes up IE8
|
||||
"<span style='font-family: wingdings; text-decoration: underline;'>    ✍    </span>" :
|
||||
"<span style='text-decoration: underline;'>    ✍    </span>", // //   ==
|
||||
|
||||
constructor: function(){
|
||||
// summary:
|
||||
// Sets up private arrays etc.
|
||||
// tags:
|
||||
// private
|
||||
this.editorParams = {};
|
||||
},
|
||||
|
||||
postMixInProperties: function(){
|
||||
this.inherited(arguments);
|
||||
|
||||
// save pointer to original source node, since Widget nulls-out srcNodeRef
|
||||
this.displayNode = this.srcNodeRef;
|
||||
|
||||
// connect handlers to the display node
|
||||
var events = {
|
||||
ondijitclick: "_onClick",
|
||||
onmouseover: "_onMouseOver",
|
||||
onmouseout: "_onMouseOut",
|
||||
onfocus: "_onMouseOver",
|
||||
onblur: "_onMouseOut"
|
||||
};
|
||||
for(var name in events){
|
||||
this.connect(this.displayNode, name, events[name]);
|
||||
}
|
||||
this.displayNode.setAttribute("role", "button");
|
||||
if(!this.displayNode.getAttribute("tabIndex")){
|
||||
this.displayNode.setAttribute("tabIndex", 0);
|
||||
}
|
||||
|
||||
if(!this.value && !("value" in this.params)){ // "" is a good value if specified directly so check params){
|
||||
this.value = lang.trim(this.renderAsHtml ? this.displayNode.innerHTML :
|
||||
(this.displayNode.innerText||this.displayNode.textContent||""));
|
||||
}
|
||||
if(!this.value){
|
||||
this.displayNode.innerHTML = this.noValueIndicator;
|
||||
}
|
||||
|
||||
domClass.add(this.displayNode, 'dijitInlineEditBoxDisplayMode');
|
||||
},
|
||||
|
||||
setDisabled: function(/*Boolean*/ disabled){
|
||||
// summary:
|
||||
// Deprecated. Use set('disabled', ...) instead.
|
||||
// tags:
|
||||
// deprecated
|
||||
kernel.deprecated("dijit.InlineEditBox.setDisabled() is deprecated. Use set('disabled', bool) instead.", "", "2.0");
|
||||
this.set('disabled', disabled);
|
||||
},
|
||||
|
||||
_setDisabledAttr: function(/*Boolean*/ disabled){
|
||||
// summary:
|
||||
// Hook to make set("disabled", ...) work.
|
||||
// Set disabled state of widget.
|
||||
this.domNode.setAttribute("aria-disabled", disabled);
|
||||
if(disabled){
|
||||
this.displayNode.removeAttribute("tabIndex");
|
||||
}else{
|
||||
this.displayNode.setAttribute("tabIndex", 0);
|
||||
}
|
||||
domClass.toggle(this.displayNode, "dijitInlineEditBoxDisplayModeDisabled", disabled);
|
||||
this._set("disabled", disabled);
|
||||
},
|
||||
|
||||
_onMouseOver: function(){
|
||||
// summary:
|
||||
// Handler for onmouseover and onfocus event.
|
||||
// tags:
|
||||
// private
|
||||
if(!this.disabled){
|
||||
domClass.add(this.displayNode, "dijitInlineEditBoxDisplayModeHover");
|
||||
}
|
||||
},
|
||||
|
||||
_onMouseOut: function(){
|
||||
// summary:
|
||||
// Handler for onmouseout and onblur event.
|
||||
// tags:
|
||||
// private
|
||||
domClass.remove(this.displayNode, "dijitInlineEditBoxDisplayModeHover");
|
||||
},
|
||||
|
||||
_onClick: function(/*Event*/ e){
|
||||
// summary:
|
||||
// Handler for onclick event.
|
||||
// tags:
|
||||
// private
|
||||
if(this.disabled){ return; }
|
||||
if(e){ event.stop(e); }
|
||||
this._onMouseOut();
|
||||
|
||||
// Since FF gets upset if you move a node while in an event handler for that node...
|
||||
setTimeout(lang.hitch(this, "edit"), 0);
|
||||
},
|
||||
|
||||
edit: function(){
|
||||
// summary:
|
||||
// Display the editor widget in place of the original (read only) markup.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
if(this.disabled || this.editing){ return; }
|
||||
this._set('editing', true);
|
||||
|
||||
// save some display node values that can be restored later
|
||||
this._savedPosition = domStyle.get(this.displayNode, "position") || "static";
|
||||
this._savedOpacity = domStyle.get(this.displayNode, "opacity") || "1";
|
||||
this._savedTabIndex = domAttr.get(this.displayNode, "tabIndex") || "0";
|
||||
|
||||
if(this.wrapperWidget){
|
||||
var ew = this.wrapperWidget.editWidget;
|
||||
ew.set("displayedValue" in ew ? "displayedValue" : "value", this.value);
|
||||
}else{
|
||||
// Placeholder for edit widget
|
||||
// Put place holder (and eventually editWidget) before the display node so that it's positioned correctly
|
||||
// when Calendar dropdown appears, which happens automatically on focus.
|
||||
var placeholder = domConstruct.create("span", null, this.domNode, "before");
|
||||
|
||||
// Create the editor wrapper (the thing that holds the editor widget and the save/cancel buttons)
|
||||
var ewc = typeof this.editorWrapper == "string" ? lang.getObject(this.editorWrapper) : this.editorWrapper;
|
||||
this.wrapperWidget = new ewc({
|
||||
value: this.value,
|
||||
buttonSave: this.buttonSave,
|
||||
buttonCancel: this.buttonCancel,
|
||||
dir: this.dir,
|
||||
lang: this.lang,
|
||||
tabIndex: this._savedTabIndex,
|
||||
editor: this.editor,
|
||||
inlineEditBox: this,
|
||||
sourceStyle: domStyle.getComputedStyle(this.displayNode),
|
||||
save: lang.hitch(this, "save"),
|
||||
cancel: lang.hitch(this, "cancel"),
|
||||
textDir: this.textDir
|
||||
}, placeholder);
|
||||
if(!this._started){
|
||||
this.startup();
|
||||
}
|
||||
}
|
||||
var ww = this.wrapperWidget;
|
||||
|
||||
// to avoid screen jitter, we first create the editor with position:absolute, visibility:hidden,
|
||||
// and then when it's finished rendering, we switch from display mode to editor
|
||||
// position:absolute releases screen space allocated to the display node
|
||||
// opacity:0 is the same as visibility:hidden but is still focusable
|
||||
// visiblity:hidden removes focus outline
|
||||
|
||||
domStyle.set(this.displayNode, { position: "absolute", opacity: "0" }); // makes display node invisible, display style used for focus-ability
|
||||
domStyle.set(ww.domNode, { position: this._savedPosition, visibility: "visible", opacity: "1" });
|
||||
domAttr.set(this.displayNode, "tabIndex", "-1"); // needed by WebKit for TAB from editor to skip displayNode
|
||||
|
||||
// Replace the display widget with edit widget, leaving them both displayed for a brief time so that
|
||||
// focus can be shifted without incident. (browser may needs some time to render the editor.)
|
||||
setTimeout(lang.hitch(ww, function(){
|
||||
this.focus(); // both nodes are showing, so we can switch focus safely
|
||||
this._resetValue = this.getValue();
|
||||
}), 0);
|
||||
},
|
||||
|
||||
_onBlur: function(){
|
||||
// summary:
|
||||
// Called when focus moves outside the InlineEditBox.
|
||||
// Performs garbage collection.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
this.inherited(arguments);
|
||||
if(!this.editing){
|
||||
/* causes IE focus problems, see TooltipDialog_a11y.html...
|
||||
setTimeout(lang.hitch(this, function(){
|
||||
if(this.wrapperWidget){
|
||||
this.wrapperWidget.destroy();
|
||||
delete this.wrapperWidget;
|
||||
}
|
||||
}), 0);
|
||||
*/
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function(){
|
||||
if(this.wrapperWidget && !this.wrapperWidget._destroyed){
|
||||
this.wrapperWidget.destroy();
|
||||
delete this.wrapperWidget;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
_showText: function(/*Boolean*/ focus){
|
||||
// summary:
|
||||
// Revert to display mode, and optionally focus on display node
|
||||
// tags:
|
||||
// private
|
||||
|
||||
var ww = this.wrapperWidget;
|
||||
domStyle.set(ww.domNode, { position: "absolute", visibility: "hidden", opacity: "0" }); // hide the editor from mouse/keyboard events
|
||||
domStyle.set(this.displayNode, { position: this._savedPosition, opacity: this._savedOpacity }); // make the original text visible
|
||||
domAttr.set(this.displayNode, "tabIndex", this._savedTabIndex);
|
||||
if(focus){
|
||||
fm.focus(this.displayNode);
|
||||
}
|
||||
},
|
||||
|
||||
save: function(/*Boolean*/ focus){
|
||||
// summary:
|
||||
// Save the contents of the editor and revert to display mode.
|
||||
// focus: Boolean
|
||||
// Focus on the display mode text
|
||||
// tags:
|
||||
// private
|
||||
|
||||
if(this.disabled || !this.editing){ return; }
|
||||
this._set('editing', false);
|
||||
|
||||
var ww = this.wrapperWidget;
|
||||
var value = ww.getValue();
|
||||
this.set('value', value); // display changed, formatted value
|
||||
|
||||
this._showText(focus); // set focus as needed
|
||||
},
|
||||
|
||||
setValue: function(/*String*/ val){
|
||||
// summary:
|
||||
// Deprecated. Use set('value', ...) instead.
|
||||
// tags:
|
||||
// deprecated
|
||||
kernel.deprecated("dijit.InlineEditBox.setValue() is deprecated. Use set('value', ...) instead.", "", "2.0");
|
||||
return this.set("value", val);
|
||||
},
|
||||
|
||||
_setValueAttr: function(/*String*/ val){
|
||||
// summary:
|
||||
// Hook to make set("value", ...) work.
|
||||
// Inserts specified HTML value into this node, or an "input needed" character if node is blank.
|
||||
|
||||
val = lang.trim(val);
|
||||
var renderVal = this.renderAsHtml ? val : val.replace(/&/gm, "&").replace(/</gm, "<").replace(/>/gm, ">").replace(/"/gm, """).replace(/\n/g, "<br>");
|
||||
this.displayNode.innerHTML = renderVal || this.noValueIndicator;
|
||||
this._set("value", val);
|
||||
|
||||
if(this._started){
|
||||
// tell the world that we have changed
|
||||
setTimeout(lang.hitch(this, "onChange", val), 0); // setTimeout prevents browser freeze for long-running event handlers
|
||||
}
|
||||
// contextual (auto) text direction depends on the text value
|
||||
if(this.textDir == "auto"){
|
||||
this.applyTextDir(this.displayNode, this.displayNode.innerText);
|
||||
}
|
||||
},
|
||||
|
||||
getValue: function(){
|
||||
// summary:
|
||||
// Deprecated. Use get('value') instead.
|
||||
// tags:
|
||||
// deprecated
|
||||
kernel.deprecated("dijit.InlineEditBox.getValue() is deprecated. Use get('value') instead.", "", "2.0");
|
||||
return this.get("value");
|
||||
},
|
||||
|
||||
cancel: function(/*Boolean*/ focus){
|
||||
// summary:
|
||||
// Revert to display mode, discarding any changes made in the editor
|
||||
// tags:
|
||||
// private
|
||||
|
||||
if(this.disabled || !this.editing){ return; }
|
||||
this._set('editing', false);
|
||||
|
||||
// tell the world that we have no changes
|
||||
setTimeout(lang.hitch(this, "onCancel"), 0); // setTimeout prevents browser freeze for long-running event handlers
|
||||
|
||||
this._showText(focus);
|
||||
},
|
||||
_setTextDirAttr: function(/*String*/ textDir){
|
||||
// summary:
|
||||
// Setter for textDir.
|
||||
// description:
|
||||
// Users shouldn't call this function; they should be calling
|
||||
// set('textDir', value)
|
||||
// tags:
|
||||
// private
|
||||
if(!this._created || this.textDir != textDir){
|
||||
this._set("textDir", textDir);
|
||||
this.applyTextDir(this.displayNode, this.displayNode.innerText);
|
||||
this.displayNode.align = this.dir == "rtl" ? "right" : "left"; //fix the text alignment
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
InlineEditBox._InlineEditor = InlineEditor; // for monkey patching
|
||||
|
||||
return InlineEditBox;
|
||||
});
|
|
@ -1,195 +0,0 @@
|
|||
Dojo is available under *either* the terms of the modified BSD license *or* the
|
||||
Academic Free License version 2.1. As a recipient of Dojo, you may choose which
|
||||
license to receive this code under (except as noted in per-module LICENSE
|
||||
files). Some modules may not be the copyright of the Dojo Foundation. These
|
||||
modules contain explicit declarations of copyright in both the LICENSE files in
|
||||
the directories in which they reside and in the code itself. No external
|
||||
contributions are allowed under licenses which are fundamentally incompatible
|
||||
with the AFL or BSD licenses that Dojo is distributed under.
|
||||
|
||||
The text of the AFL and BSD licenses is reproduced below.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The "New" BSD License:
|
||||
**********************
|
||||
|
||||
Copyright (c) 2005-2011, The Dojo Foundation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Dojo Foundation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The Academic Free License, v. 2.1:
|
||||
**********************************
|
||||
|
||||
This Academic Free License (the "License") applies to any original work of
|
||||
authorship (the "Original Work") whose owner (the "Licensor") has placed the
|
||||
following notice immediately following the copyright notice for the Original
|
||||
Work:
|
||||
|
||||
Licensed under the Academic Free License version 2.1
|
||||
|
||||
1) Grant of Copyright License. Licensor hereby grants You a world-wide,
|
||||
royalty-free, non-exclusive, perpetual, sublicenseable license to do the
|
||||
following:
|
||||
|
||||
a) to reproduce the Original Work in copies;
|
||||
|
||||
b) to prepare derivative works ("Derivative Works") based upon the Original
|
||||
Work;
|
||||
|
||||
c) to distribute copies of the Original Work and Derivative Works to the
|
||||
public;
|
||||
|
||||
d) to perform the Original Work publicly; and
|
||||
|
||||
e) to display the Original Work publicly.
|
||||
|
||||
2) Grant of Patent License. Licensor hereby grants You a world-wide,
|
||||
royalty-free, non-exclusive, perpetual, sublicenseable license, under patent
|
||||
claims owned or controlled by the Licensor that are embodied in the Original
|
||||
Work as furnished by the Licensor, to make, use, sell and offer for sale the
|
||||
Original Work and Derivative Works.
|
||||
|
||||
3) Grant of Source Code License. The term "Source Code" means the preferred
|
||||
form of the Original Work for making modifications to it and all available
|
||||
documentation describing how to modify the Original Work. Licensor hereby
|
||||
agrees to provide a machine-readable copy of the Source Code of the Original
|
||||
Work along with each copy of the Original Work that Licensor distributes.
|
||||
Licensor reserves the right to satisfy this obligation by placing a
|
||||
machine-readable copy of the Source Code in an information repository
|
||||
reasonably calculated to permit inexpensive and convenient access by You for as
|
||||
long as Licensor continues to distribute the Original Work, and by publishing
|
||||
the address of that information repository in a notice immediately following
|
||||
the copyright notice that applies to the Original Work.
|
||||
|
||||
4) Exclusions From License Grant. Neither the names of Licensor, nor the names
|
||||
of any contributors to the Original Work, nor any of their trademarks or
|
||||
service marks, may be used to endorse or promote products derived from this
|
||||
Original Work without express prior written permission of the Licensor. Nothing
|
||||
in this License shall be deemed to grant any rights to trademarks, copyrights,
|
||||
patents, trade secrets or any other intellectual property of Licensor except as
|
||||
expressly stated herein. No patent license is granted to make, use, sell or
|
||||
offer to sell embodiments of any patent claims other than the licensed claims
|
||||
defined in Section 2. No right is granted to the trademarks of Licensor even if
|
||||
such marks are included in the Original Work. Nothing in this License shall be
|
||||
interpreted to prohibit Licensor from licensing under different terms from this
|
||||
License any Original Work that Licensor otherwise would have a right to
|
||||
license.
|
||||
|
||||
5) This section intentionally omitted.
|
||||
|
||||
6) Attribution Rights. You must retain, in the Source Code of any Derivative
|
||||
Works that You create, all copyright, patent or trademark notices from the
|
||||
Source Code of the Original Work, as well as any notices of licensing and any
|
||||
descriptive text identified therein as an "Attribution Notice." You must cause
|
||||
the Source Code for any Derivative Works that You create to carry a prominent
|
||||
Attribution Notice reasonably calculated to inform recipients that You have
|
||||
modified the Original Work.
|
||||
|
||||
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
|
||||
the copyright in and to the Original Work and the patent rights granted herein
|
||||
by Licensor are owned by the Licensor or are sublicensed to You under the terms
|
||||
of this License with the permission of the contributor(s) of those copyrights
|
||||
and patent rights. Except as expressly stated in the immediately proceeding
|
||||
sentence, the Original Work is provided under this License on an "AS IS" BASIS
|
||||
and WITHOUT WARRANTY, either express or implied, including, without limitation,
|
||||
the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.
|
||||
This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No
|
||||
license to Original Work is granted hereunder except under this disclaimer.
|
||||
|
||||
8) Limitation of Liability. Under no circumstances and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise, shall the
|
||||
Licensor be liable to any person for any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License
|
||||
or the use of the Original Work including, without limitation, damages for loss
|
||||
of goodwill, work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses. This limitation of liability shall not
|
||||
apply to liability for death or personal injury resulting from Licensor's
|
||||
negligence to the extent applicable law prohibits such limitation. Some
|
||||
jurisdictions do not allow the exclusion or limitation of incidental or
|
||||
consequential damages, so this exclusion and limitation may not apply to You.
|
||||
|
||||
9) Acceptance and Termination. If You distribute copies of the Original Work or
|
||||
a Derivative Work, You must make a reasonable effort under the circumstances to
|
||||
obtain the express assent of recipients to the terms of this License. Nothing
|
||||
else but this License (or another written agreement between Licensor and You)
|
||||
grants You permission to create Derivative Works based upon the Original Work
|
||||
or to exercise any of the rights granted in Section 1 herein, and any attempt
|
||||
to do so except under the terms of this License (or another written agreement
|
||||
between Licensor and You) is expressly prohibited by U.S. copyright law, the
|
||||
equivalent laws of other countries, and by international treaty. Therefore, by
|
||||
exercising any of the rights granted to You in Section 1 herein, You indicate
|
||||
Your acceptance of this License and all of its terms and conditions.
|
||||
|
||||
10) Termination for Patent Action. This License shall terminate automatically
|
||||
and You may no longer exercise any of the rights granted to You by this License
|
||||
as of the date You commence an action, including a cross-claim or counterclaim,
|
||||
against Licensor or any licensee alleging that the Original Work infringes a
|
||||
patent. This termination provision shall not apply for an action alleging
|
||||
patent infringement by combinations of the Original Work with other software or
|
||||
hardware.
|
||||
|
||||
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
|
||||
License may be brought only in the courts of a jurisdiction wherein the
|
||||
Licensor resides or in which Licensor conducts its primary business, and under
|
||||
the laws of that jurisdiction excluding its conflict-of-law provisions. The
|
||||
application of the United Nations Convention on Contracts for the International
|
||||
Sale of Goods is expressly excluded. Any use of the Original Work outside the
|
||||
scope of this License or after its termination shall be subject to the
|
||||
requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et
|
||||
seq., the equivalent laws of other countries, and international treaty. This
|
||||
section shall survive the termination of this License.
|
||||
|
||||
12) Attorneys Fees. In any action to enforce the terms of this License or
|
||||
seeking damages relating thereto, the prevailing party shall be entitled to
|
||||
recover its costs and expenses, including, without limitation, reasonable
|
||||
attorneys' fees and costs incurred in connection with such action, including
|
||||
any appeal of such action. This section shall survive the termination of this
|
||||
License.
|
||||
|
||||
13) Miscellaneous. This License represents the complete agreement concerning
|
||||
the subject matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent necessary to
|
||||
make it enforceable.
|
||||
|
||||
14) Definition of "You" in This License. "You" throughout this License, whether
|
||||
in upper or lower case, means an individual or a legal entity exercising rights
|
||||
under, and complying with all of the terms of, this License. For legal
|
||||
entities, "You" includes any entity that controls, is controlled by, or is
|
||||
under common control with you. For purposes of this definition, "control" means
|
||||
(i) the power, direct or indirect, to cause the direction or management of such
|
||||
entity, whether by contract or otherwise, or (ii) ownership of fifty percent
|
||||
(50%) or more of the outstanding shares, or (iii) beneficial ownership of such
|
||||
entity.
|
||||
|
||||
15) Right to Use. You may use the Original Work in all ways not otherwise
|
||||
restricted or conditioned by this License or by law, and Licensor promises not
|
||||
to interfere with or be responsible for such uses by You.
|
||||
|
||||
This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved.
|
||||
Permission is hereby granted to copy and distribute this license without
|
||||
modification. This license may not be modified without the express written
|
||||
permission of its copyright owner.
|
|
@ -1,127 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/Menu",["require","dojo/_base/array","dojo/_base/declare","dojo/_base/event","dojo/dom","dojo/dom-attr","dojo/dom-geometry","dojo/dom-style","dojo/_base/kernel","dojo/keys","dojo/_base/lang","dojo/on","dojo/_base/sniff","dojo/_base/window","dojo/window","./popup","./DropDownMenu","dojo/ready"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,on,_c,_d,_e,pm,_f,_10){
|
||||
if(!_9.isAsync){
|
||||
_10(0,function(){
|
||||
var _11=["dijit/MenuItem","dijit/PopupMenuItem","dijit/CheckedMenuItem","dijit/MenuSeparator"];
|
||||
_1(_11);
|
||||
});
|
||||
}
|
||||
return _3("dijit.Menu",_f,{constructor:function(){
|
||||
this._bindings=[];
|
||||
},targetNodeIds:[],contextMenuForWindow:false,leftClickToOpen:false,refocus:true,postCreate:function(){
|
||||
if(this.contextMenuForWindow){
|
||||
this.bindDomNode(_d.body());
|
||||
}else{
|
||||
_2.forEach(this.targetNodeIds,this.bindDomNode,this);
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},_iframeContentWindow:function(_12){
|
||||
return _e.get(this._iframeContentDocument(_12))||this._iframeContentDocument(_12)["__parent__"]||(_12.name&&_d.doc.frames[_12.name])||null;
|
||||
},_iframeContentDocument:function(_13){
|
||||
return _13.contentDocument||(_13.contentWindow&&_13.contentWindow.document)||(_13.name&&_d.doc.frames[_13.name]&&_d.doc.frames[_13.name].document)||null;
|
||||
},bindDomNode:function(_14){
|
||||
_14=_5.byId(_14);
|
||||
var cn;
|
||||
if(_14.tagName.toLowerCase()=="iframe"){
|
||||
var _15=_14,_16=this._iframeContentWindow(_15);
|
||||
cn=_d.withGlobal(_16,_d.body);
|
||||
}else{
|
||||
cn=(_14==_d.body()?_d.doc.documentElement:_14);
|
||||
}
|
||||
var _17={node:_14,iframe:_15};
|
||||
_6.set(_14,"_dijitMenu"+this.id,this._bindings.push(_17));
|
||||
var _18=_b.hitch(this,function(cn){
|
||||
return [on(cn,this.leftClickToOpen?"click":"contextmenu",_b.hitch(this,function(evt){
|
||||
_4.stop(evt);
|
||||
this._scheduleOpen(evt.target,_15,{x:evt.pageX,y:evt.pageY});
|
||||
})),on(cn,"keydown",_b.hitch(this,function(evt){
|
||||
if(evt.shiftKey&&evt.keyCode==_a.F10){
|
||||
_4.stop(evt);
|
||||
this._scheduleOpen(evt.target,_15);
|
||||
}
|
||||
}))];
|
||||
});
|
||||
_17.connects=cn?_18(cn):[];
|
||||
if(_15){
|
||||
_17.onloadHandler=_b.hitch(this,function(){
|
||||
var _19=this._iframeContentWindow(_15);
|
||||
cn=_d.withGlobal(_19,_d.body);
|
||||
_17.connects=_18(cn);
|
||||
});
|
||||
if(_15.addEventListener){
|
||||
_15.addEventListener("load",_17.onloadHandler,false);
|
||||
}else{
|
||||
_15.attachEvent("onload",_17.onloadHandler);
|
||||
}
|
||||
}
|
||||
},unBindDomNode:function(_1a){
|
||||
var _1b;
|
||||
try{
|
||||
_1b=_5.byId(_1a);
|
||||
}
|
||||
catch(e){
|
||||
return;
|
||||
}
|
||||
var _1c="_dijitMenu"+this.id;
|
||||
if(_1b&&_6.has(_1b,_1c)){
|
||||
var bid=_6.get(_1b,_1c)-1,b=this._bindings[bid],h;
|
||||
while(h=b.connects.pop()){
|
||||
h.remove();
|
||||
}
|
||||
var _1d=b.iframe;
|
||||
if(_1d){
|
||||
if(_1d.removeEventListener){
|
||||
_1d.removeEventListener("load",b.onloadHandler,false);
|
||||
}else{
|
||||
_1d.detachEvent("onload",b.onloadHandler);
|
||||
}
|
||||
}
|
||||
_6.remove(_1b,_1c);
|
||||
delete this._bindings[bid];
|
||||
}
|
||||
},_scheduleOpen:function(_1e,_1f,_20){
|
||||
if(!this._openTimer){
|
||||
this._openTimer=setTimeout(_b.hitch(this,function(){
|
||||
delete this._openTimer;
|
||||
this._openMyself({target:_1e,iframe:_1f,coords:_20});
|
||||
}),1);
|
||||
}
|
||||
},_openMyself:function(_21){
|
||||
var _22=_21.target,_23=_21.iframe,_24=_21.coords;
|
||||
if(_24){
|
||||
if(_23){
|
||||
var ifc=_7.position(_23,true),_25=this._iframeContentWindow(_23),_26=_d.withGlobal(_25,"_docScroll",dojo);
|
||||
var cs=_8.getComputedStyle(_23),tp=_8.toPixelValue,_27=(_c("ie")&&_c("quirks")?0:tp(_23,cs.paddingLeft))+(_c("ie")&&_c("quirks")?tp(_23,cs.borderLeftWidth):0),top=(_c("ie")&&_c("quirks")?0:tp(_23,cs.paddingTop))+(_c("ie")&&_c("quirks")?tp(_23,cs.borderTopWidth):0);
|
||||
_24.x+=ifc.x+_27-_26.x;
|
||||
_24.y+=ifc.y+top-_26.y;
|
||||
}
|
||||
}else{
|
||||
_24=_7.position(_22,true);
|
||||
_24.x+=10;
|
||||
_24.y+=10;
|
||||
}
|
||||
var _28=this;
|
||||
var _29=this._focusManager.get("prevNode");
|
||||
var _2a=this._focusManager.get("curNode");
|
||||
var _2b=!_2a||(_5.isDescendant(_2a,this.domNode))?_29:_2a;
|
||||
function _2c(){
|
||||
if(_28.refocus&&_2b){
|
||||
_2b.focus();
|
||||
}
|
||||
pm.close(_28);
|
||||
};
|
||||
pm.open({popup:this,x:_24.x,y:_24.y,onExecute:_2c,onCancel:_2c,orient:this.isLeftToRight()?"L":"R"});
|
||||
this.focus();
|
||||
this._onBlur=function(){
|
||||
this.inherited("_onBlur",arguments);
|
||||
pm.close(this);
|
||||
};
|
||||
},uninitialize:function(){
|
||||
_2.forEach(this._bindings,function(b){
|
||||
if(b){
|
||||
this.unBindDomNode(b.node);
|
||||
}
|
||||
},this);
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
});
|
|
@ -1,322 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/Menu", [
|
||||
"require",
|
||||
"dojo/_base/array", // array.forEach
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/dom", // dom.byId dom.isDescendant
|
||||
"dojo/dom-attr", // domAttr.get domAttr.set domAttr.has domAttr.remove
|
||||
"dojo/dom-geometry", // domStyle.getComputedStyle domGeometry.position
|
||||
"dojo/dom-style", // domStyle.getComputedStyle
|
||||
"dojo/_base/kernel",
|
||||
"dojo/keys", // keys.F10
|
||||
"dojo/_base/lang", // lang.hitch
|
||||
"dojo/on",
|
||||
"dojo/_base/sniff", // has("ie"), has("quirks")
|
||||
"dojo/_base/window", // win.body win.doc.documentElement win.doc.frames win.withGlobal
|
||||
"dojo/window", // winUtils.get
|
||||
"./popup",
|
||||
"./DropDownMenu",
|
||||
"dojo/ready"
|
||||
], function(require, array, declare, event, dom, domAttr, domGeometry, domStyle, kernel, keys, lang, on,
|
||||
has, win, winUtils, pm, DropDownMenu, ready){
|
||||
|
||||
/*=====
|
||||
var DropDownMenu = dijit.DropDownMenu;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/Menu
|
||||
// summary:
|
||||
// Includes dijit.Menu widget and base class dijit._MenuBase
|
||||
|
||||
// Back compat w/1.6, remove for 2.0
|
||||
if(!kernel.isAsync){
|
||||
ready(0, function(){
|
||||
var requires = ["dijit/MenuItem", "dijit/PopupMenuItem", "dijit/CheckedMenuItem", "dijit/MenuSeparator"];
|
||||
require(requires); // use indirection so modules not rolled into a build
|
||||
});
|
||||
}
|
||||
|
||||
return declare("dijit.Menu", DropDownMenu, {
|
||||
// summary:
|
||||
// A context menu you can assign to multiple elements
|
||||
|
||||
constructor: function(){
|
||||
this._bindings = [];
|
||||
},
|
||||
|
||||
// targetNodeIds: [const] String[]
|
||||
// Array of dom node ids of nodes to attach to.
|
||||
// Fill this with nodeIds upon widget creation and it becomes context menu for those nodes.
|
||||
targetNodeIds: [],
|
||||
|
||||
// contextMenuForWindow: [const] Boolean
|
||||
// If true, right clicking anywhere on the window will cause this context menu to open.
|
||||
// If false, must specify targetNodeIds.
|
||||
contextMenuForWindow: false,
|
||||
|
||||
// leftClickToOpen: [const] Boolean
|
||||
// If true, menu will open on left click instead of right click, similar to a file menu.
|
||||
leftClickToOpen: false,
|
||||
|
||||
// refocus: Boolean
|
||||
// When this menu closes, re-focus the element which had focus before it was opened.
|
||||
refocus: true,
|
||||
|
||||
postCreate: function(){
|
||||
if(this.contextMenuForWindow){
|
||||
this.bindDomNode(win.body());
|
||||
}else{
|
||||
// TODO: should have _setTargetNodeIds() method to handle initialization and a possible
|
||||
// later set('targetNodeIds', ...) call. There's also a problem that targetNodeIds[]
|
||||
// gets stale after calls to bindDomNode()/unBindDomNode() as it still is just the original list (see #9610)
|
||||
array.forEach(this.targetNodeIds, this.bindDomNode, this);
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
// thanks burstlib!
|
||||
_iframeContentWindow: function(/* HTMLIFrameElement */iframe_el){
|
||||
// summary:
|
||||
// Returns the window reference of the passed iframe
|
||||
// tags:
|
||||
// private
|
||||
return winUtils.get(this._iframeContentDocument(iframe_el)) ||
|
||||
// Moz. TODO: is this available when defaultView isn't?
|
||||
this._iframeContentDocument(iframe_el)['__parent__'] ||
|
||||
(iframe_el.name && win.doc.frames[iframe_el.name]) || null; // Window
|
||||
},
|
||||
|
||||
_iframeContentDocument: function(/* HTMLIFrameElement */iframe_el){
|
||||
// summary:
|
||||
// Returns a reference to the document object inside iframe_el
|
||||
// tags:
|
||||
// protected
|
||||
return iframe_el.contentDocument // W3
|
||||
|| (iframe_el.contentWindow && iframe_el.contentWindow.document) // IE
|
||||
|| (iframe_el.name && win.doc.frames[iframe_el.name] && win.doc.frames[iframe_el.name].document)
|
||||
|| null; // HTMLDocument
|
||||
},
|
||||
|
||||
bindDomNode: function(/*String|DomNode*/ node){
|
||||
// summary:
|
||||
// Attach menu to given node
|
||||
node = dom.byId(node);
|
||||
|
||||
var cn; // Connect node
|
||||
|
||||
// Support context menus on iframes. Rather than binding to the iframe itself we need
|
||||
// to bind to the <body> node inside the iframe.
|
||||
if(node.tagName.toLowerCase() == "iframe"){
|
||||
var iframe = node,
|
||||
window = this._iframeContentWindow(iframe);
|
||||
cn = win.withGlobal(window, win.body);
|
||||
}else{
|
||||
|
||||
// To capture these events at the top level, attach to <html>, not <body>.
|
||||
// Otherwise right-click context menu just doesn't work.
|
||||
cn = (node == win.body() ? win.doc.documentElement : node);
|
||||
}
|
||||
|
||||
|
||||
// "binding" is the object to track our connection to the node (ie, the parameter to bindDomNode())
|
||||
var binding = {
|
||||
node: node,
|
||||
iframe: iframe
|
||||
};
|
||||
|
||||
// Save info about binding in _bindings[], and make node itself record index(+1) into
|
||||
// _bindings[] array. Prefix w/_dijitMenu to avoid setting an attribute that may
|
||||
// start with a number, which fails on FF/safari.
|
||||
domAttr.set(node, "_dijitMenu" + this.id, this._bindings.push(binding));
|
||||
|
||||
// Setup the connections to monitor click etc., unless we are connecting to an iframe which hasn't finished
|
||||
// loading yet, in which case we need to wait for the onload event first, and then connect
|
||||
// On linux Shift-F10 produces the oncontextmenu event, but on Windows it doesn't, so
|
||||
// we need to monitor keyboard events in addition to the oncontextmenu event.
|
||||
var doConnects = lang.hitch(this, function(cn){
|
||||
return [
|
||||
// TODO: when leftClickToOpen is true then shouldn't space/enter key trigger the menu,
|
||||
// rather than shift-F10?
|
||||
on(cn, this.leftClickToOpen ? "click" : "contextmenu", lang.hitch(this, function(evt){
|
||||
// Schedule context menu to be opened unless it's already been scheduled from onkeydown handler
|
||||
event.stop(evt);
|
||||
this._scheduleOpen(evt.target, iframe, {x: evt.pageX, y: evt.pageY});
|
||||
})),
|
||||
on(cn, "keydown", lang.hitch(this, function(evt){
|
||||
if(evt.shiftKey && evt.keyCode == keys.F10){
|
||||
event.stop(evt);
|
||||
this._scheduleOpen(evt.target, iframe); // no coords - open near target node
|
||||
}
|
||||
}))
|
||||
];
|
||||
});
|
||||
binding.connects = cn ? doConnects(cn) : [];
|
||||
|
||||
if(iframe){
|
||||
// Setup handler to [re]bind to the iframe when the contents are initially loaded,
|
||||
// and every time the contents change.
|
||||
// Need to do this b/c we are actually binding to the iframe's <body> node.
|
||||
// Note: can't use connect.connect(), see #9609.
|
||||
|
||||
binding.onloadHandler = lang.hitch(this, function(){
|
||||
// want to remove old connections, but IE throws exceptions when trying to
|
||||
// access the <body> node because it's already gone, or at least in a state of limbo
|
||||
|
||||
var window = this._iframeContentWindow(iframe);
|
||||
cn = win.withGlobal(window, win.body);
|
||||
binding.connects = doConnects(cn);
|
||||
});
|
||||
if(iframe.addEventListener){
|
||||
iframe.addEventListener("load", binding.onloadHandler, false);
|
||||
}else{
|
||||
iframe.attachEvent("onload", binding.onloadHandler);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
unBindDomNode: function(/*String|DomNode*/ nodeName){
|
||||
// summary:
|
||||
// Detach menu from given node
|
||||
|
||||
var node;
|
||||
try{
|
||||
node = dom.byId(nodeName);
|
||||
}catch(e){
|
||||
// On IE the dom.byId() call will get an exception if the attach point was
|
||||
// the <body> node of an <iframe> that has since been reloaded (and thus the
|
||||
// <body> node is in a limbo state of destruction.
|
||||
return;
|
||||
}
|
||||
|
||||
// node["_dijitMenu" + this.id] contains index(+1) into my _bindings[] array
|
||||
var attrName = "_dijitMenu" + this.id;
|
||||
if(node && domAttr.has(node, attrName)){
|
||||
var bid = domAttr.get(node, attrName)-1, b = this._bindings[bid], h;
|
||||
while(h = b.connects.pop()){
|
||||
h.remove();
|
||||
}
|
||||
|
||||
// Remove listener for iframe onload events
|
||||
var iframe = b.iframe;
|
||||
if(iframe){
|
||||
if(iframe.removeEventListener){
|
||||
iframe.removeEventListener("load", b.onloadHandler, false);
|
||||
}else{
|
||||
iframe.detachEvent("onload", b.onloadHandler);
|
||||
}
|
||||
}
|
||||
|
||||
domAttr.remove(node, attrName);
|
||||
delete this._bindings[bid];
|
||||
}
|
||||
},
|
||||
|
||||
_scheduleOpen: function(/*DomNode?*/ target, /*DomNode?*/ iframe, /*Object?*/ coords){
|
||||
// summary:
|
||||
// Set timer to display myself. Using a timer rather than displaying immediately solves
|
||||
// two problems:
|
||||
//
|
||||
// 1. IE: without the delay, focus work in "open" causes the system
|
||||
// context menu to appear in spite of stopEvent.
|
||||
//
|
||||
// 2. Avoid double-shows on linux, where shift-F10 generates an oncontextmenu event
|
||||
// even after a event.stop(e). (Shift-F10 on windows doesn't generate the
|
||||
// oncontextmenu event.)
|
||||
|
||||
if(!this._openTimer){
|
||||
this._openTimer = setTimeout(lang.hitch(this, function(){
|
||||
delete this._openTimer;
|
||||
this._openMyself({
|
||||
target: target,
|
||||
iframe: iframe,
|
||||
coords: coords
|
||||
});
|
||||
}), 1);
|
||||
}
|
||||
},
|
||||
|
||||
_openMyself: function(args){
|
||||
// summary:
|
||||
// Internal function for opening myself when the user does a right-click or something similar.
|
||||
// args:
|
||||
// This is an Object containing:
|
||||
// * target:
|
||||
// The node that is being clicked
|
||||
// * iframe:
|
||||
// If an <iframe> is being clicked, iframe points to that iframe
|
||||
// * coords:
|
||||
// Put menu at specified x/y position in viewport, or if iframe is
|
||||
// specified, then relative to iframe.
|
||||
//
|
||||
// _openMyself() formerly took the event object, and since various code references
|
||||
// evt.target (after connecting to _openMyself()), using an Object for parameters
|
||||
// (so that old code still works).
|
||||
|
||||
var target = args.target,
|
||||
iframe = args.iframe,
|
||||
coords = args.coords;
|
||||
|
||||
// Get coordinates to open menu, either at specified (mouse) position or (if triggered via keyboard)
|
||||
// then near the node the menu is assigned to.
|
||||
if(coords){
|
||||
if(iframe){
|
||||
// Specified coordinates are on <body> node of an <iframe>, convert to match main document
|
||||
var ifc = domGeometry.position(iframe, true),
|
||||
window = this._iframeContentWindow(iframe),
|
||||
scroll = win.withGlobal(window, "_docScroll", dojo);
|
||||
|
||||
var cs = domStyle.getComputedStyle(iframe),
|
||||
tp = domStyle.toPixelValue,
|
||||
left = (has("ie") && has("quirks") ? 0 : tp(iframe, cs.paddingLeft)) + (has("ie") && has("quirks") ? tp(iframe, cs.borderLeftWidth) : 0),
|
||||
top = (has("ie") && has("quirks") ? 0 : tp(iframe, cs.paddingTop)) + (has("ie") && has("quirks") ? tp(iframe, cs.borderTopWidth) : 0);
|
||||
|
||||
coords.x += ifc.x + left - scroll.x;
|
||||
coords.y += ifc.y + top - scroll.y;
|
||||
}
|
||||
}else{
|
||||
coords = domGeometry.position(target, true);
|
||||
coords.x += 10;
|
||||
coords.y += 10;
|
||||
}
|
||||
|
||||
var self=this;
|
||||
var prevFocusNode = this._focusManager.get("prevNode");
|
||||
var curFocusNode = this._focusManager.get("curNode");
|
||||
var savedFocusNode = !curFocusNode || (dom.isDescendant(curFocusNode, this.domNode)) ? prevFocusNode : curFocusNode;
|
||||
|
||||
function closeAndRestoreFocus(){
|
||||
// user has clicked on a menu or popup
|
||||
if(self.refocus && savedFocusNode){
|
||||
savedFocusNode.focus();
|
||||
}
|
||||
pm.close(self);
|
||||
}
|
||||
pm.open({
|
||||
popup: this,
|
||||
x: coords.x,
|
||||
y: coords.y,
|
||||
onExecute: closeAndRestoreFocus,
|
||||
onCancel: closeAndRestoreFocus,
|
||||
orient: this.isLeftToRight() ? 'L' : 'R'
|
||||
});
|
||||
this.focus();
|
||||
|
||||
this._onBlur = function(){
|
||||
this.inherited('_onBlur', arguments);
|
||||
// Usually the parent closes the child widget but if this is a context
|
||||
// menu then there is no parent
|
||||
pm.close(this);
|
||||
// don't try to restore focus; user has clicked another part of the screen
|
||||
// and set focus there
|
||||
};
|
||||
},
|
||||
|
||||
uninitialize: function(){
|
||||
array.forEach(this._bindings, function(b){ if(b){ this.unBindDomNode(b.node); } }, this);
|
||||
this.inherited(arguments);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -1,30 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/MenuBar.html":"<div class=\"dijitMenuBar dijitMenuPassive\" data-dojo-attach-point=\"containerNode\" role=\"menubar\" tabIndex=\"${tabIndex}\" data-dojo-attach-event=\"onkeypress: _onKeyPress\"></div>\n"}});
|
||||
define("dijit/MenuBar",["dojo/_base/declare","dojo/_base/event","dojo/keys","./_MenuBase","dojo/text!./templates/MenuBar.html"],function(_1,_2,_3,_4,_5){
|
||||
return _1("dijit.MenuBar",_4,{templateString:_5,baseClass:"dijitMenuBar",_isMenuBar:true,postCreate:function(){
|
||||
var l=this.isLeftToRight();
|
||||
this.connectKeyNavHandlers(l?[_3.LEFT_ARROW]:[_3.RIGHT_ARROW],l?[_3.RIGHT_ARROW]:[_3.LEFT_ARROW]);
|
||||
this._orient=["below"];
|
||||
},focusChild:function(_6){
|
||||
var _7=this.focusedChild,_8=_7&&_7.popup&&_7.popup.isShowingNow;
|
||||
this.inherited(arguments);
|
||||
if(_8&&_6.popup&&!_6.disabled){
|
||||
this._openPopup();
|
||||
}
|
||||
},_onKeyPress:function(_9){
|
||||
if(_9.ctrlKey||_9.altKey){
|
||||
return;
|
||||
}
|
||||
switch(_9.charOrCode){
|
||||
case _3.DOWN_ARROW:
|
||||
this._moveToPopup(_9);
|
||||
_2.stop(_9);
|
||||
}
|
||||
},onItemClick:function(_a,_b){
|
||||
if(_a.popup&&_a.popup.isShowingNow){
|
||||
_a.popup.onCancel();
|
||||
}else{
|
||||
this.inherited(arguments);
|
||||
}
|
||||
}});
|
||||
});
|
|
@ -1,84 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/MenuBar.html':"<div class=\"dijitMenuBar dijitMenuPassive\" data-dojo-attach-point=\"containerNode\" role=\"menubar\" tabIndex=\"${tabIndex}\" data-dojo-attach-event=\"onkeypress: _onKeyPress\"></div>\n"}});
|
||||
define("dijit/MenuBar", [
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/keys", // keys.DOWN_ARROW
|
||||
"./_MenuBase",
|
||||
"dojo/text!./templates/MenuBar.html"
|
||||
], function(declare, event, keys, _MenuBase, template){
|
||||
|
||||
/*=====
|
||||
var _MenuBase = dijit._MenuBase;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/MenuBar
|
||||
// summary:
|
||||
// A menu bar, listing menu choices horizontally, like the "File" menu in most desktop applications
|
||||
|
||||
return declare("dijit.MenuBar", _MenuBase, {
|
||||
// summary:
|
||||
// A menu bar, listing menu choices horizontally, like the "File" menu in most desktop applications
|
||||
|
||||
templateString: template,
|
||||
|
||||
baseClass: "dijitMenuBar",
|
||||
|
||||
// _isMenuBar: [protected] Boolean
|
||||
// This is a MenuBar widget, not a (vertical) Menu widget.
|
||||
_isMenuBar: true,
|
||||
|
||||
postCreate: function(){
|
||||
var l = this.isLeftToRight();
|
||||
this.connectKeyNavHandlers(
|
||||
l ? [keys.LEFT_ARROW] : [keys.RIGHT_ARROW],
|
||||
l ? [keys.RIGHT_ARROW] : [keys.LEFT_ARROW]
|
||||
);
|
||||
|
||||
// parameter to dijit.popup.open() about where to put popup (relative to this.domNode)
|
||||
this._orient = ["below"];
|
||||
},
|
||||
|
||||
focusChild: function(item){
|
||||
// overload focusChild so that whenever the focus is moved to a new item,
|
||||
// check the previous focused whether it has its popup open, if so, after
|
||||
// focusing the new item, open its submenu immediately
|
||||
var prev_item = this.focusedChild,
|
||||
showpopup = prev_item && prev_item.popup && prev_item.popup.isShowingNow;
|
||||
this.inherited(arguments);
|
||||
if(showpopup && item.popup && !item.disabled){
|
||||
this._openPopup(); // TODO: on down arrow, _openPopup() is called here and in onItemClick()
|
||||
}
|
||||
},
|
||||
|
||||
_onKeyPress: function(/*Event*/ evt){
|
||||
// summary:
|
||||
// Handle keyboard based menu navigation.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
if(evt.ctrlKey || evt.altKey){ return; }
|
||||
|
||||
switch(evt.charOrCode){
|
||||
case keys.DOWN_ARROW:
|
||||
this._moveToPopup(evt);
|
||||
event.stop(evt);
|
||||
}
|
||||
},
|
||||
|
||||
onItemClick: function(/*dijit._Widget*/ item, /*Event*/ evt){
|
||||
// summary:
|
||||
// Handle clicks on an item. Cancels a dropdown if already open.
|
||||
// tags:
|
||||
// private
|
||||
if(item.popup && item.popup.isShowingNow){
|
||||
item.popup.onCancel();
|
||||
}else{
|
||||
this.inherited(arguments);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -1,8 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/MenuBarItem.html":"<div class=\"dijitReset dijitInline dijitMenuItem dijitMenuItemLabel\" data-dojo-attach-point=\"focusNode\" role=\"menuitem\" tabIndex=\"-1\"\n\t\tdata-dojo-attach-event=\"onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick\">\n\t<span data-dojo-attach-point=\"containerNode\"></span>\n</div>\n"}});
|
||||
define("dijit/MenuBarItem",["dojo/_base/declare","./MenuItem","dojo/text!./templates/MenuBarItem.html"],function(_1,_2,_3){
|
||||
var _4=_1("dijit._MenuBarItemMixin",null,{templateString:_3,_setIconClassAttr:null});
|
||||
var _5=_1("dijit.MenuBarItem",[_2,_4],{});
|
||||
_5._MenuBarItemMixin=_4;
|
||||
return _5;
|
||||
});
|
|
@ -1,36 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/MenuBarItem.html':"<div class=\"dijitReset dijitInline dijitMenuItem dijitMenuItemLabel\" data-dojo-attach-point=\"focusNode\" role=\"menuitem\" tabIndex=\"-1\"\n\t\tdata-dojo-attach-event=\"onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick\">\n\t<span data-dojo-attach-point=\"containerNode\"></span>\n</div>\n"}});
|
||||
define("dijit/MenuBarItem", [
|
||||
"dojo/_base/declare", // declare
|
||||
"./MenuItem",
|
||||
"dojo/text!./templates/MenuBarItem.html"
|
||||
], function(declare, MenuItem, template){
|
||||
|
||||
/*=====
|
||||
var MenuItem = dijit.MenuItem;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/MenuBarItem
|
||||
// summary:
|
||||
// Item in a MenuBar that's clickable, and doesn't spawn a submenu when pressed (or hovered)
|
||||
|
||||
|
||||
var _MenuBarItemMixin = declare("dijit._MenuBarItemMixin", null, {
|
||||
templateString: template,
|
||||
|
||||
// Map widget attributes to DOMNode attributes.
|
||||
_setIconClassAttr: null // cancel MenuItem setter because we don't have a place for an icon
|
||||
});
|
||||
|
||||
var MenuBarItem = declare("dijit.MenuBarItem", [MenuItem, _MenuBarItemMixin], {
|
||||
// summary:
|
||||
// Item in a MenuBar that's clickable, and doesn't spawn a submenu when pressed (or hovered)
|
||||
|
||||
});
|
||||
MenuBarItem._MenuBarItemMixin = _MenuBarItemMixin; // dojox.mobile is accessing this
|
||||
|
||||
|
||||
return MenuBarItem;
|
||||
});
|
|
@ -1,57 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/MenuItem.html":"<tr class=\"dijitReset dijitMenuItem\" data-dojo-attach-point=\"focusNode\" role=\"menuitem\" tabIndex=\"-1\"\n\t\tdata-dojo-attach-event=\"onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick\">\n\t<td class=\"dijitReset dijitMenuItemIconCell\" role=\"presentation\">\n\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitIcon dijitMenuItemIcon\" data-dojo-attach-point=\"iconNode\"/>\n\t</td>\n\t<td class=\"dijitReset dijitMenuItemLabel\" colspan=\"2\" data-dojo-attach-point=\"containerNode\"></td>\n\t<td class=\"dijitReset dijitMenuItemAccelKey\" style=\"display: none\" data-dojo-attach-point=\"accelKeyNode\"></td>\n\t<td class=\"dijitReset dijitMenuArrowCell\" role=\"presentation\">\n\t\t<div data-dojo-attach-point=\"arrowWrapper\" style=\"visibility: hidden\">\n\t\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitMenuExpand\"/>\n\t\t\t<span class=\"dijitMenuExpandA11y\">+</span>\n\t\t</div>\n\t</td>\n</tr>\n"}});
|
||||
define("dijit/MenuItem",["dojo/_base/declare","dojo/dom","dojo/dom-attr","dojo/dom-class","dojo/_base/event","dojo/_base/kernel","dojo/_base/sniff","./_Widget","./_TemplatedMixin","./_Contained","./_CssStateMixin","dojo/text!./templates/MenuItem.html"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c){
|
||||
return _1("dijit.MenuItem",[_8,_9,_a,_b],{templateString:_c,baseClass:"dijitMenuItem",label:"",_setLabelAttr:{node:"containerNode",type:"innerHTML"},iconClass:"dijitNoIcon",_setIconClassAttr:{node:"iconNode",type:"class"},accelKey:"",disabled:false,_fillContent:function(_d){
|
||||
if(_d&&!("label" in this.params)){
|
||||
this.set("label",_d.innerHTML);
|
||||
}
|
||||
},buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
var _e=this.id+"_text";
|
||||
_3.set(this.containerNode,"id",_e);
|
||||
if(this.accelKeyNode){
|
||||
_3.set(this.accelKeyNode,"id",this.id+"_accel");
|
||||
_e+=" "+this.id+"_accel";
|
||||
}
|
||||
this.domNode.setAttribute("aria-labelledby",_e);
|
||||
_2.setSelectable(this.domNode,false);
|
||||
},_onHover:function(){
|
||||
this.getParent().onItemHover(this);
|
||||
},_onUnhover:function(){
|
||||
this.getParent().onItemUnhover(this);
|
||||
this._set("hovering",false);
|
||||
},_onClick:function(_f){
|
||||
this.getParent().onItemClick(this,_f);
|
||||
_5.stop(_f);
|
||||
},onClick:function(){
|
||||
},focus:function(){
|
||||
try{
|
||||
if(_7("ie")==8){
|
||||
this.containerNode.focus();
|
||||
}
|
||||
this.focusNode.focus();
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
},_onFocus:function(){
|
||||
this._setSelected(true);
|
||||
this.getParent()._onItemFocus(this);
|
||||
this.inherited(arguments);
|
||||
},_setSelected:function(_10){
|
||||
_4.toggle(this.domNode,"dijitMenuItemSelected",_10);
|
||||
},setLabel:function(_11){
|
||||
_6.deprecated("dijit.MenuItem.setLabel() is deprecated. Use set('label', ...) instead.","","2.0");
|
||||
this.set("label",_11);
|
||||
},setDisabled:function(_12){
|
||||
_6.deprecated("dijit.Menu.setDisabled() is deprecated. Use set('disabled', bool) instead.","","2.0");
|
||||
this.set("disabled",_12);
|
||||
},_setDisabledAttr:function(_13){
|
||||
this.focusNode.setAttribute("aria-disabled",_13?"true":"false");
|
||||
this._set("disabled",_13);
|
||||
},_setAccelKeyAttr:function(_14){
|
||||
this.accelKeyNode.style.display=_14?"":"none";
|
||||
this.accelKeyNode.innerHTML=_14;
|
||||
_3.set(this.containerNode,"colSpan",_14?"1":"2");
|
||||
this._set("accelKey",_14);
|
||||
}});
|
||||
});
|
|
@ -1,212 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/MenuItem.html':"<tr class=\"dijitReset dijitMenuItem\" data-dojo-attach-point=\"focusNode\" role=\"menuitem\" tabIndex=\"-1\"\n\t\tdata-dojo-attach-event=\"onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick\">\n\t<td class=\"dijitReset dijitMenuItemIconCell\" role=\"presentation\">\n\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitIcon dijitMenuItemIcon\" data-dojo-attach-point=\"iconNode\"/>\n\t</td>\n\t<td class=\"dijitReset dijitMenuItemLabel\" colspan=\"2\" data-dojo-attach-point=\"containerNode\"></td>\n\t<td class=\"dijitReset dijitMenuItemAccelKey\" style=\"display: none\" data-dojo-attach-point=\"accelKeyNode\"></td>\n\t<td class=\"dijitReset dijitMenuArrowCell\" role=\"presentation\">\n\t\t<div data-dojo-attach-point=\"arrowWrapper\" style=\"visibility: hidden\">\n\t\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitMenuExpand\"/>\n\t\t\t<span class=\"dijitMenuExpandA11y\">+</span>\n\t\t</div>\n\t</td>\n</tr>\n"}});
|
||||
define("dijit/MenuItem", [
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom", // dom.setSelectable
|
||||
"dojo/dom-attr", // domAttr.set
|
||||
"dojo/dom-class", // domClass.toggle
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/_base/kernel", // kernel.deprecated
|
||||
"dojo/_base/sniff", // has("ie")
|
||||
"./_Widget",
|
||||
"./_TemplatedMixin",
|
||||
"./_Contained",
|
||||
"./_CssStateMixin",
|
||||
"dojo/text!./templates/MenuItem.html"
|
||||
], function(declare, dom, domAttr, domClass, event, kernel, has,
|
||||
_Widget, _TemplatedMixin, _Contained, _CssStateMixin, template){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
var _Contained = dijit._Contained;
|
||||
var _CssStateMixin = dijit._CssStateMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/MenuItem
|
||||
// summary:
|
||||
// A line item in a Menu Widget
|
||||
|
||||
|
||||
return declare("dijit.MenuItem",
|
||||
[_Widget, _TemplatedMixin, _Contained, _CssStateMixin],
|
||||
{
|
||||
// summary:
|
||||
// A line item in a Menu Widget
|
||||
|
||||
// Make 3 columns
|
||||
// icon, label, and expand arrow (BiDi-dependent) indicating sub-menu
|
||||
templateString: template,
|
||||
|
||||
baseClass: "dijitMenuItem",
|
||||
|
||||
// label: String
|
||||
// Menu text
|
||||
label: '',
|
||||
_setLabelAttr: { node: "containerNode", type: "innerHTML" },
|
||||
|
||||
// iconClass: String
|
||||
// Class to apply to DOMNode to make it display an icon.
|
||||
iconClass: "dijitNoIcon",
|
||||
_setIconClassAttr: { node: "iconNode", type: "class" },
|
||||
|
||||
// accelKey: String
|
||||
// Text for the accelerator (shortcut) key combination.
|
||||
// Note that although Menu can display accelerator keys there
|
||||
// is no infrastructure to actually catch and execute these
|
||||
// accelerators.
|
||||
accelKey: "",
|
||||
|
||||
// disabled: Boolean
|
||||
// If true, the menu item is disabled.
|
||||
// If false, the menu item is enabled.
|
||||
disabled: false,
|
||||
|
||||
_fillContent: function(/*DomNode*/ source){
|
||||
// If button label is specified as srcNodeRef.innerHTML rather than
|
||||
// this.params.label, handle it here.
|
||||
if(source && !("label" in this.params)){
|
||||
this.set('label', source.innerHTML);
|
||||
}
|
||||
},
|
||||
|
||||
buildRendering: function(){
|
||||
this.inherited(arguments);
|
||||
var label = this.id+"_text";
|
||||
domAttr.set(this.containerNode, "id", label);
|
||||
if(this.accelKeyNode){
|
||||
domAttr.set(this.accelKeyNode, "id", this.id + "_accel");
|
||||
label += " " + this.id + "_accel";
|
||||
}
|
||||
this.domNode.setAttribute("aria-labelledby", label);
|
||||
dom.setSelectable(this.domNode, false);
|
||||
},
|
||||
|
||||
_onHover: function(){
|
||||
// summary:
|
||||
// Handler when mouse is moved onto menu item
|
||||
// tags:
|
||||
// protected
|
||||
this.getParent().onItemHover(this);
|
||||
},
|
||||
|
||||
_onUnhover: function(){
|
||||
// summary:
|
||||
// Handler when mouse is moved off of menu item,
|
||||
// possibly to a child menu, or maybe to a sibling
|
||||
// menuitem or somewhere else entirely.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
// if we are unhovering the currently selected item
|
||||
// then unselect it
|
||||
this.getParent().onItemUnhover(this);
|
||||
|
||||
// When menu is hidden (collapsed) due to clicking a MenuItem and having it execute,
|
||||
// FF and IE don't generate an onmouseout event for the MenuItem.
|
||||
// So, help out _CssStateMixin in this case.
|
||||
this._set("hovering", false);
|
||||
},
|
||||
|
||||
_onClick: function(evt){
|
||||
// summary:
|
||||
// Internal handler for click events on MenuItem.
|
||||
// tags:
|
||||
// private
|
||||
this.getParent().onItemClick(this, evt);
|
||||
event.stop(evt);
|
||||
},
|
||||
|
||||
onClick: function(/*Event*/){
|
||||
// summary:
|
||||
// User defined function to handle clicks
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
|
||||
focus: function(){
|
||||
// summary:
|
||||
// Focus on this MenuItem
|
||||
try{
|
||||
if(has("ie") == 8){
|
||||
// needed for IE8 which won't scroll TR tags into view on focus yet calling scrollIntoView creates flicker (#10275)
|
||||
this.containerNode.focus();
|
||||
}
|
||||
this.focusNode.focus();
|
||||
}catch(e){
|
||||
// this throws on IE (at least) in some scenarios
|
||||
}
|
||||
},
|
||||
|
||||
_onFocus: function(){
|
||||
// summary:
|
||||
// This is called by the focus manager when focus
|
||||
// goes to this MenuItem or a child menu.
|
||||
// tags:
|
||||
// protected
|
||||
this._setSelected(true);
|
||||
this.getParent()._onItemFocus(this);
|
||||
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
_setSelected: function(selected){
|
||||
// summary:
|
||||
// Indicate that this node is the currently selected one
|
||||
// tags:
|
||||
// private
|
||||
|
||||
/***
|
||||
* TODO: remove this method and calls to it, when _onBlur() is working for MenuItem.
|
||||
* Currently _onBlur() gets called when focus is moved from the MenuItem to a child menu.
|
||||
* That's not supposed to happen, but the problem is:
|
||||
* In order to allow dijit.popup's getTopPopup() to work,a sub menu's popupParent
|
||||
* points to the parent Menu, bypassing the parent MenuItem... thus the
|
||||
* MenuItem is not in the chain of active widgets and gets a premature call to
|
||||
* _onBlur()
|
||||
*/
|
||||
|
||||
domClass.toggle(this.domNode, "dijitMenuItemSelected", selected);
|
||||
},
|
||||
|
||||
setLabel: function(/*String*/ content){
|
||||
// summary:
|
||||
// Deprecated. Use set('label', ...) instead.
|
||||
// tags:
|
||||
// deprecated
|
||||
kernel.deprecated("dijit.MenuItem.setLabel() is deprecated. Use set('label', ...) instead.", "", "2.0");
|
||||
this.set("label", content);
|
||||
},
|
||||
|
||||
setDisabled: function(/*Boolean*/ disabled){
|
||||
// summary:
|
||||
// Deprecated. Use set('disabled', bool) instead.
|
||||
// tags:
|
||||
// deprecated
|
||||
kernel.deprecated("dijit.Menu.setDisabled() is deprecated. Use set('disabled', bool) instead.", "", "2.0");
|
||||
this.set('disabled', disabled);
|
||||
},
|
||||
_setDisabledAttr: function(/*Boolean*/ value){
|
||||
// summary:
|
||||
// Hook for attr('disabled', ...) to work.
|
||||
// Enable or disable this menu item.
|
||||
|
||||
this.focusNode.setAttribute('aria-disabled', value ? 'true' : 'false');
|
||||
this._set("disabled", value);
|
||||
},
|
||||
_setAccelKeyAttr: function(/*String*/ value){
|
||||
// summary:
|
||||
// Hook for attr('accelKey', ...) to work.
|
||||
// Set accelKey on this menu item.
|
||||
|
||||
this.accelKeyNode.style.display=value?"":"none";
|
||||
this.accelKeyNode.innerHTML=value;
|
||||
//have to use colSpan to make it work in IE
|
||||
domAttr.set(this.containerNode,'colSpan',value?"1":"2");
|
||||
|
||||
this._set("accelKey", value);
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,10 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/MenuSeparator.html":"<tr class=\"dijitMenuSeparator\">\n\t<td class=\"dijitMenuSeparatorIconCell\">\n\t\t<div class=\"dijitMenuSeparatorTop\"></div>\n\t\t<div class=\"dijitMenuSeparatorBottom\"></div>\n\t</td>\n\t<td colspan=\"3\" class=\"dijitMenuSeparatorLabelCell\">\n\t\t<div class=\"dijitMenuSeparatorTop dijitMenuSeparatorLabel\"></div>\n\t\t<div class=\"dijitMenuSeparatorBottom\"></div>\n\t</td>\n</tr>"}});
|
||||
define("dijit/MenuSeparator",["dojo/_base/declare","dojo/dom","./_WidgetBase","./_TemplatedMixin","./_Contained","dojo/text!./templates/MenuSeparator.html"],function(_1,_2,_3,_4,_5,_6){
|
||||
return _1("dijit.MenuSeparator",[_3,_4,_5],{templateString:_6,buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
_2.setSelectable(this.domNode,false);
|
||||
},isFocusable:function(){
|
||||
return false;
|
||||
}});
|
||||
});
|
|
@ -1,44 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/MenuSeparator.html':"<tr class=\"dijitMenuSeparator\">\n\t<td class=\"dijitMenuSeparatorIconCell\">\n\t\t<div class=\"dijitMenuSeparatorTop\"></div>\n\t\t<div class=\"dijitMenuSeparatorBottom\"></div>\n\t</td>\n\t<td colspan=\"3\" class=\"dijitMenuSeparatorLabelCell\">\n\t\t<div class=\"dijitMenuSeparatorTop dijitMenuSeparatorLabel\"></div>\n\t\t<div class=\"dijitMenuSeparatorBottom\"></div>\n\t</td>\n</tr>"}});
|
||||
define("dijit/MenuSeparator", [
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom", // dom.setSelectable
|
||||
"./_WidgetBase",
|
||||
"./_TemplatedMixin",
|
||||
"./_Contained",
|
||||
"dojo/text!./templates/MenuSeparator.html"
|
||||
], function(declare, dom, _WidgetBase, _TemplatedMixin, _Contained, template){
|
||||
|
||||
/*=====
|
||||
var _WidgetBase = dijit._WidgetBase;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
var _Contained = dijit._Contained;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/MenuSeparator
|
||||
// summary:
|
||||
// A line between two menu items
|
||||
|
||||
return declare("dijit.MenuSeparator", [_WidgetBase, _TemplatedMixin, _Contained], {
|
||||
// summary:
|
||||
// A line between two menu items
|
||||
|
||||
templateString: template,
|
||||
|
||||
buildRendering: function(){
|
||||
this.inherited(arguments);
|
||||
dom.setSelectable(this.domNode, false);
|
||||
},
|
||||
|
||||
isFocusable: function(){
|
||||
// summary:
|
||||
// Override to always return false
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
return false; // Boolean
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,5 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/PopupMenuBarItem",["dojo/_base/declare","./PopupMenuItem","./MenuBarItem"],function(_1,_2,_3){
|
||||
var _4=_3._MenuBarItemMixin;
|
||||
return _1("dijit.PopupMenuBarItem",[_2,_4],{});
|
||||
});
|
|
@ -1,24 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/PopupMenuBarItem", [
|
||||
"dojo/_base/declare", // declare
|
||||
"./PopupMenuItem",
|
||||
"./MenuBarItem"
|
||||
], function(declare, PopupMenuItem, MenuBarItem){
|
||||
|
||||
// module:
|
||||
// dijit/PopupMenuBarItem
|
||||
// summary:
|
||||
// Item in a MenuBar like "File" or "Edit", that spawns a submenu when pressed (or hovered)
|
||||
|
||||
var _MenuBarItemMixin = MenuBarItem._MenuBarItemMixin;
|
||||
|
||||
/*=====
|
||||
var PopupMenuItem = dijit.PopupMenuItem;
|
||||
var _MenuBarItemMixin = dijit._MenuBarItemMixin;
|
||||
=====*/
|
||||
|
||||
return declare("dijit.PopupMenuBarItem", [PopupMenuItem, _MenuBarItemMixin], {
|
||||
// summary:
|
||||
// Item in a MenuBar like "File" or "Edit", that spawns a submenu when pressed (or hovered)
|
||||
});
|
||||
});
|
|
@ -1,34 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/PopupMenuItem",["dojo/_base/declare","dojo/dom-style","dojo/query","dojo/_base/window","./registry","./MenuItem","./hccss"],function(_1,_2,_3,_4,_5,_6){
|
||||
return _1("dijit.PopupMenuItem",_6,{_fillContent:function(){
|
||||
if(this.srcNodeRef){
|
||||
var _7=_3("*",this.srcNodeRef);
|
||||
this.inherited(arguments,[_7[0]]);
|
||||
this.dropDownContainer=this.srcNodeRef;
|
||||
}
|
||||
},startup:function(){
|
||||
if(this._started){
|
||||
return;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
if(!this.popup){
|
||||
var _8=_3("[widgetId]",this.dropDownContainer)[0];
|
||||
this.popup=_5.byNode(_8);
|
||||
}
|
||||
_4.body().appendChild(this.popup.domNode);
|
||||
this.popup.startup();
|
||||
this.popup.domNode.style.display="none";
|
||||
if(this.arrowWrapper){
|
||||
_2.set(this.arrowWrapper,"visibility","");
|
||||
}
|
||||
this.focusNode.setAttribute("aria-haspopup","true");
|
||||
},destroyDescendants:function(_9){
|
||||
if(this.popup){
|
||||
if(!this.popup._destroyed){
|
||||
this.popup.destroyRecursive(_9);
|
||||
}
|
||||
delete this.popup;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
});
|
|
@ -1,81 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/PopupMenuItem", [
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-style", // domStyle.set
|
||||
"dojo/query", // query
|
||||
"dojo/_base/window", // win.body
|
||||
"./registry", // registry.byNode
|
||||
"./MenuItem",
|
||||
"./hccss"
|
||||
], function(declare, domStyle, query, win, registry, MenuItem){
|
||||
|
||||
/*=====
|
||||
var MenuItem = dijit.MenuItem;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/PopupMenuItem
|
||||
// summary:
|
||||
// An item in a Menu that spawn a drop down (usually a drop down menu)
|
||||
|
||||
return declare("dijit.PopupMenuItem", MenuItem, {
|
||||
// summary:
|
||||
// An item in a Menu that spawn a drop down (usually a drop down menu)
|
||||
|
||||
_fillContent: function(){
|
||||
// summary:
|
||||
// When Menu is declared in markup, this code gets the menu label and
|
||||
// the popup widget from the srcNodeRef.
|
||||
// description:
|
||||
// srcNodeRefinnerHTML contains both the menu item text and a popup widget
|
||||
// The first part holds the menu item text and the second part is the popup
|
||||
// example:
|
||||
// | <div data-dojo-type="dijit.PopupMenuItem">
|
||||
// | <span>pick me</span>
|
||||
// | <popup> ... </popup>
|
||||
// | </div>
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
if(this.srcNodeRef){
|
||||
var nodes = query("*", this.srcNodeRef);
|
||||
this.inherited(arguments, [nodes[0]]);
|
||||
|
||||
// save pointer to srcNode so we can grab the drop down widget after it's instantiated
|
||||
this.dropDownContainer = this.srcNodeRef;
|
||||
}
|
||||
},
|
||||
|
||||
startup: function(){
|
||||
if(this._started){ return; }
|
||||
this.inherited(arguments);
|
||||
|
||||
// we didn't copy the dropdown widget from the this.srcNodeRef, so it's in no-man's
|
||||
// land now. move it to win.doc.body.
|
||||
if(!this.popup){
|
||||
var node = query("[widgetId]", this.dropDownContainer)[0];
|
||||
this.popup = registry.byNode(node);
|
||||
}
|
||||
win.body().appendChild(this.popup.domNode);
|
||||
this.popup.startup();
|
||||
|
||||
this.popup.domNode.style.display="none";
|
||||
if(this.arrowWrapper){
|
||||
domStyle.set(this.arrowWrapper, "visibility", "");
|
||||
}
|
||||
this.focusNode.setAttribute("aria-haspopup", "true");
|
||||
},
|
||||
|
||||
destroyDescendants: function(/*Boolean*/ preserveDom){
|
||||
if(this.popup){
|
||||
// Destroy the popup, unless it's already been destroyed. This can happen because
|
||||
// the popup is a direct child of <body> even though it's logically my child.
|
||||
if(!this.popup._destroyed){
|
||||
this.popup.destroyRecursive(preserveDom);
|
||||
}
|
||||
delete this.popup;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,55 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/ProgressBar.html":"<div class=\"dijitProgressBar dijitProgressBarEmpty\" role=\"progressbar\"\n\t><div data-dojo-attach-point=\"internalProgress\" class=\"dijitProgressBarFull\"\n\t\t><div class=\"dijitProgressBarTile\" role=\"presentation\"></div\n\t\t><span style=\"visibility:hidden\"> </span\n\t></div\n\t><div data-dojo-attach-point=\"labelNode\" class=\"dijitProgressBarLabel\" id=\"${id}_label\"></div\n\t><img data-dojo-attach-point=\"indeterminateHighContrastImage\" class=\"dijitProgressBarIndeterminateHighContrastImage\" alt=\"\"\n/></div>\n"}});
|
||||
define("dijit/ProgressBar",["require","dojo/_base/declare","dojo/dom-class","dojo/_base/lang","dojo/number","./_Widget","./_TemplatedMixin","dojo/text!./templates/ProgressBar.html"],function(_1,_2,_3,_4,_5,_6,_7,_8){
|
||||
return _2("dijit.ProgressBar",[_6,_7],{progress:"0",value:"",maximum:100,places:0,indeterminate:false,label:"",name:"",templateString:_8,_indeterminateHighContrastImagePath:_1.toUrl("./themes/a11y/indeterminate_progress.gif"),postMixInProperties:function(){
|
||||
this.inherited(arguments);
|
||||
if(!("value" in this.params)){
|
||||
this.value=this.indeterminate?Infinity:this.progress;
|
||||
}
|
||||
},buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
this.indeterminateHighContrastImage.setAttribute("src",this._indeterminateHighContrastImagePath.toString());
|
||||
this.update();
|
||||
},update:function(_9){
|
||||
_4.mixin(this,_9||{});
|
||||
var _a=this.internalProgress,ap=this.domNode;
|
||||
var _b=1;
|
||||
if(this.indeterminate){
|
||||
ap.removeAttribute("aria-valuenow");
|
||||
ap.removeAttribute("aria-valuemin");
|
||||
ap.removeAttribute("aria-valuemax");
|
||||
}else{
|
||||
if(String(this.progress).indexOf("%")!=-1){
|
||||
_b=Math.min(parseFloat(this.progress)/100,1);
|
||||
this.progress=_b*this.maximum;
|
||||
}else{
|
||||
this.progress=Math.min(this.progress,this.maximum);
|
||||
_b=this.maximum?this.progress/this.maximum:0;
|
||||
}
|
||||
ap.setAttribute("aria-describedby",this.labelNode.id);
|
||||
ap.setAttribute("aria-valuenow",this.progress);
|
||||
ap.setAttribute("aria-valuemin",0);
|
||||
ap.setAttribute("aria-valuemax",this.maximum);
|
||||
}
|
||||
this.labelNode.innerHTML=this.report(_b);
|
||||
_3.toggle(this.domNode,"dijitProgressBarIndeterminate",this.indeterminate);
|
||||
_a.style.width=(_b*100)+"%";
|
||||
this.onChange();
|
||||
},_setValueAttr:function(v){
|
||||
this._set("value",v);
|
||||
if(v==Infinity){
|
||||
this.update({indeterminate:true});
|
||||
}else{
|
||||
this.update({indeterminate:false,progress:v});
|
||||
}
|
||||
},_setLabelAttr:function(_c){
|
||||
this._set("label",_c);
|
||||
this.update();
|
||||
},_setIndeterminateAttr:function(_d){
|
||||
this.indeterminate=_d;
|
||||
this.update();
|
||||
},report:function(_e){
|
||||
return this.label?this.label:(this.indeterminate?" ":_5.format(_e,{type:"percent",places:this.places,locale:this.lang}));
|
||||
},onChange:function(){
|
||||
}});
|
||||
});
|
|
@ -1,178 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/ProgressBar.html':"<div class=\"dijitProgressBar dijitProgressBarEmpty\" role=\"progressbar\"\n\t><div data-dojo-attach-point=\"internalProgress\" class=\"dijitProgressBarFull\"\n\t\t><div class=\"dijitProgressBarTile\" role=\"presentation\"></div\n\t\t><span style=\"visibility:hidden\"> </span\n\t></div\n\t><div data-dojo-attach-point=\"labelNode\" class=\"dijitProgressBarLabel\" id=\"${id}_label\"></div\n\t><img data-dojo-attach-point=\"indeterminateHighContrastImage\" class=\"dijitProgressBarIndeterminateHighContrastImage\" alt=\"\"\n/></div>\n"}});
|
||||
define("dijit/ProgressBar", [
|
||||
"require", // require.toUrl
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-class", // domClass.toggle
|
||||
"dojo/_base/lang", // lang.mixin
|
||||
"dojo/number", // number.format
|
||||
"./_Widget",
|
||||
"./_TemplatedMixin",
|
||||
"dojo/text!./templates/ProgressBar.html"
|
||||
], function(require, declare, domClass, lang, number, _Widget, _TemplatedMixin, template){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/ProgressBar
|
||||
// summary:
|
||||
// A progress indication widget, showing the amount completed
|
||||
// (often the percentage completed) of a task.
|
||||
|
||||
|
||||
return declare("dijit.ProgressBar", [_Widget, _TemplatedMixin], {
|
||||
// summary:
|
||||
// A progress indication widget, showing the amount completed
|
||||
// (often the percentage completed) of a task.
|
||||
//
|
||||
// example:
|
||||
// | <div data-dojo-type="ProgressBar"
|
||||
// | places="0"
|
||||
// | value="..." maximum="...">
|
||||
// | </div>
|
||||
|
||||
// progress: [const] String (Percentage or Number)
|
||||
// Number or percentage indicating amount of task completed.
|
||||
// Deprecated. Use "value" instead.
|
||||
progress: "0",
|
||||
|
||||
// value: String (Percentage or Number)
|
||||
// Number or percentage indicating amount of task completed.
|
||||
// With "%": percentage value, 0% <= progress <= 100%, or
|
||||
// without "%": absolute value, 0 <= progress <= maximum.
|
||||
// Infinity means that the progress bar is indeterminate.
|
||||
value: "",
|
||||
|
||||
// maximum: [const] Float
|
||||
// Max sample number
|
||||
maximum: 100,
|
||||
|
||||
// places: [const] Number
|
||||
// Number of places to show in values; 0 by default
|
||||
places: 0,
|
||||
|
||||
// indeterminate: [const] Boolean
|
||||
// If false: show progress value (number or percentage).
|
||||
// If true: show that a process is underway but that the amount completed is unknown.
|
||||
// Deprecated. Use "value" instead.
|
||||
indeterminate: false,
|
||||
|
||||
// label: String?
|
||||
// Label on progress bar. Defaults to percentage for determinate progress bar and
|
||||
// blank for indeterminate progress bar.
|
||||
label:"",
|
||||
|
||||
// name: String
|
||||
// this is the field name (for a form) if set. This needs to be set if you want to use
|
||||
// this widget in a dijit.form.Form widget (such as dijit.Dialog)
|
||||
name: '',
|
||||
|
||||
templateString: template,
|
||||
|
||||
// _indeterminateHighContrastImagePath: [private] URL
|
||||
// URL to image to use for indeterminate progress bar when display is in high contrast mode
|
||||
_indeterminateHighContrastImagePath:
|
||||
require.toUrl("./themes/a11y/indeterminate_progress.gif"),
|
||||
|
||||
postMixInProperties: function(){
|
||||
this.inherited(arguments);
|
||||
if(!("value" in this.params)){
|
||||
this.value = this.indeterminate ? Infinity : this.progress;
|
||||
}
|
||||
},
|
||||
|
||||
buildRendering: function(){
|
||||
this.inherited(arguments);
|
||||
this.indeterminateHighContrastImage.setAttribute("src",
|
||||
this._indeterminateHighContrastImagePath.toString());
|
||||
this.update();
|
||||
},
|
||||
|
||||
update: function(/*Object?*/attributes){
|
||||
// summary:
|
||||
// Internal method to change attributes of ProgressBar, similar to set(hash). Users should call
|
||||
// set("value", ...) rather than calling this method directly.
|
||||
// attributes:
|
||||
// May provide progress and/or maximum properties on this parameter;
|
||||
// see attribute specs for details.
|
||||
// example:
|
||||
// | myProgressBar.update({'indeterminate': true});
|
||||
// | myProgressBar.update({'progress': 80});
|
||||
// | myProgressBar.update({'indeterminate': true, label:"Loading ..." })
|
||||
// tags:
|
||||
// private
|
||||
|
||||
// TODO: deprecate this method and use set() instead
|
||||
|
||||
lang.mixin(this, attributes || {});
|
||||
var tip = this.internalProgress, ap = this.domNode;
|
||||
var percent = 1;
|
||||
if(this.indeterminate){
|
||||
ap.removeAttribute("aria-valuenow");
|
||||
ap.removeAttribute("aria-valuemin");
|
||||
ap.removeAttribute("aria-valuemax");
|
||||
}else{
|
||||
if(String(this.progress).indexOf("%") != -1){
|
||||
percent = Math.min(parseFloat(this.progress)/100, 1);
|
||||
this.progress = percent * this.maximum;
|
||||
}else{
|
||||
this.progress = Math.min(this.progress, this.maximum);
|
||||
percent = this.maximum ? this.progress / this.maximum : 0;
|
||||
}
|
||||
|
||||
ap.setAttribute("aria-describedby", this.labelNode.id);
|
||||
ap.setAttribute("aria-valuenow", this.progress);
|
||||
ap.setAttribute("aria-valuemin", 0);
|
||||
ap.setAttribute("aria-valuemax", this.maximum);
|
||||
}
|
||||
this.labelNode.innerHTML = this.report(percent);
|
||||
|
||||
domClass.toggle(this.domNode, "dijitProgressBarIndeterminate", this.indeterminate);
|
||||
tip.style.width = (percent * 100) + "%";
|
||||
this.onChange();
|
||||
},
|
||||
|
||||
_setValueAttr: function(v){
|
||||
this._set("value", v);
|
||||
if(v == Infinity){
|
||||
this.update({indeterminate:true});
|
||||
}else{
|
||||
this.update({indeterminate:false, progress:v});
|
||||
}
|
||||
},
|
||||
|
||||
_setLabelAttr: function(label){
|
||||
this._set("label", label);
|
||||
this.update();
|
||||
},
|
||||
|
||||
_setIndeterminateAttr: function(indeterminate){
|
||||
// Deprecated, use set("value", ...) instead
|
||||
this.indeterminate = indeterminate;
|
||||
this.update();
|
||||
},
|
||||
|
||||
report: function(/*float*/percent){
|
||||
// summary:
|
||||
// Generates message to show inside progress bar (normally indicating amount of task completed).
|
||||
// May be overridden.
|
||||
// tags:
|
||||
// extension
|
||||
|
||||
return this.label ? this.label :
|
||||
(this.indeterminate ? " " : number.format(percent, { type: "percent", places: this.places, locale: this.lang }));
|
||||
},
|
||||
|
||||
onChange: function(){
|
||||
// summary:
|
||||
// Callback fired when progress updates.
|
||||
// tags:
|
||||
// extension
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -1,96 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/TitlePane.html":"<div>\n\t<div data-dojo-attach-event=\"onclick:_onTitleClick, onkeypress:_onTitleKey\"\n\t\t\tclass=\"dijitTitlePaneTitle\" data-dojo-attach-point=\"titleBarNode\">\n\t\t<div class=\"dijitTitlePaneTitleFocus\" data-dojo-attach-point=\"focusNode\">\n\t\t\t<img src=\"${_blankGif}\" alt=\"\" data-dojo-attach-point=\"arrowNode\" class=\"dijitArrowNode\" role=\"presentation\"\n\t\t\t/><span data-dojo-attach-point=\"arrowNodeInner\" class=\"dijitArrowNodeInner\"></span\n\t\t\t><span data-dojo-attach-point=\"titleNode\" class=\"dijitTitlePaneTextNode\"></span>\n\t\t</div>\n\t</div>\n\t<div class=\"dijitTitlePaneContentOuter\" data-dojo-attach-point=\"hideNode\" role=\"presentation\">\n\t\t<div class=\"dijitReset\" data-dojo-attach-point=\"wipeNode\" role=\"presentation\">\n\t\t\t<div class=\"dijitTitlePaneContentInner\" data-dojo-attach-point=\"containerNode\" role=\"region\" id=\"${id}_pane\">\n\t\t\t\t<!-- nested divs because wipeIn()/wipeOut() doesn't work right on node w/padding etc. Put padding on inner div. -->\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n"}});
|
||||
define("dijit/TitlePane",["dojo/_base/array","dojo/_base/declare","dojo/dom","dojo/dom-attr","dojo/dom-class","dojo/dom-geometry","dojo/_base/event","dojo/fx","dojo/_base/kernel","dojo/keys","./_CssStateMixin","./_TemplatedMixin","./layout/ContentPane","dojo/text!./templates/TitlePane.html","./_base/manager"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f){
|
||||
return _2("dijit.TitlePane",[_d,_c,_b],{title:"",_setTitleAttr:{node:"titleNode",type:"innerHTML"},open:true,toggleable:true,tabIndex:"0",duration:_f.defaultDuration,baseClass:"dijitTitlePane",templateString:_e,doLayout:false,_setTooltipAttr:{node:"focusNode",type:"attribute",attribute:"title"},buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
_3.setSelectable(this.titleNode,false);
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
if(this.toggleable){
|
||||
this._trackMouseState(this.titleBarNode,"dijitTitlePaneTitle");
|
||||
}
|
||||
var _10=this.hideNode,_11=this.wipeNode;
|
||||
this._wipeIn=_8.wipeIn({node:_11,duration:this.duration,beforeBegin:function(){
|
||||
_10.style.display="";
|
||||
}});
|
||||
this._wipeOut=_8.wipeOut({node:_11,duration:this.duration,onEnd:function(){
|
||||
_10.style.display="none";
|
||||
}});
|
||||
},_setOpenAttr:function(_12,_13){
|
||||
_1.forEach([this._wipeIn,this._wipeOut],function(_14){
|
||||
if(_14&&_14.status()=="playing"){
|
||||
_14.stop();
|
||||
}
|
||||
});
|
||||
if(_13){
|
||||
var _15=this[_12?"_wipeIn":"_wipeOut"];
|
||||
_15.play();
|
||||
}else{
|
||||
this.hideNode.style.display=this.wipeNode.style.display=_12?"":"none";
|
||||
}
|
||||
if(this._started){
|
||||
if(_12){
|
||||
this._onShow();
|
||||
}else{
|
||||
this.onHide();
|
||||
}
|
||||
}
|
||||
this.arrowNodeInner.innerHTML=_12?"-":"+";
|
||||
this.containerNode.setAttribute("aria-hidden",_12?"false":"true");
|
||||
this.focusNode.setAttribute("aria-pressed",_12?"true":"false");
|
||||
this._set("open",_12);
|
||||
this._setCss();
|
||||
},_setToggleableAttr:function(_16){
|
||||
this.focusNode.setAttribute("role",_16?"button":"heading");
|
||||
if(_16){
|
||||
this.focusNode.setAttribute("aria-controls",this.id+"_pane");
|
||||
_4.set(this.focusNode,"tabIndex",this.tabIndex);
|
||||
}else{
|
||||
_4.remove(this.focusNode,"tabIndex");
|
||||
}
|
||||
this._set("toggleable",_16);
|
||||
this._setCss();
|
||||
},_setContentAttr:function(_17){
|
||||
if(!this.open||!this._wipeOut||this._wipeOut.status()=="playing"){
|
||||
this.inherited(arguments);
|
||||
}else{
|
||||
if(this._wipeIn&&this._wipeIn.status()=="playing"){
|
||||
this._wipeIn.stop();
|
||||
}
|
||||
_6.setMarginBox(this.wipeNode,{h:_6.getMarginBox(this.wipeNode).h});
|
||||
this.inherited(arguments);
|
||||
if(this._wipeIn){
|
||||
this._wipeIn.play();
|
||||
}else{
|
||||
this.hideNode.style.display="";
|
||||
}
|
||||
}
|
||||
},toggle:function(){
|
||||
this._setOpenAttr(!this.open,true);
|
||||
},_setCss:function(){
|
||||
var _18=this.titleBarNode||this.focusNode;
|
||||
var _19=this._titleBarClass;
|
||||
this._titleBarClass="dijit"+(this.toggleable?"":"Fixed")+(this.open?"Open":"Closed");
|
||||
_5.replace(_18,this._titleBarClass,_19||"");
|
||||
this.arrowNodeInner.innerHTML=this.open?"-":"+";
|
||||
},_onTitleKey:function(e){
|
||||
if(e.charOrCode==_a.ENTER||e.charOrCode==" "){
|
||||
if(this.toggleable){
|
||||
this.toggle();
|
||||
}
|
||||
_7.stop(e);
|
||||
}else{
|
||||
if(e.charOrCode==_a.DOWN_ARROW&&this.open){
|
||||
this.containerNode.focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
},_onTitleClick:function(){
|
||||
if(this.toggleable){
|
||||
this.toggle();
|
||||
}
|
||||
},setTitle:function(_1a){
|
||||
_9.deprecated("dijit.TitlePane.setTitle() is deprecated. Use set('title', ...) instead.","","2.0");
|
||||
this.set("title",_1a);
|
||||
}});
|
||||
});
|
|
@ -1,278 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/TitlePane.html':"<div>\n\t<div data-dojo-attach-event=\"onclick:_onTitleClick, onkeypress:_onTitleKey\"\n\t\t\tclass=\"dijitTitlePaneTitle\" data-dojo-attach-point=\"titleBarNode\">\n\t\t<div class=\"dijitTitlePaneTitleFocus\" data-dojo-attach-point=\"focusNode\">\n\t\t\t<img src=\"${_blankGif}\" alt=\"\" data-dojo-attach-point=\"arrowNode\" class=\"dijitArrowNode\" role=\"presentation\"\n\t\t\t/><span data-dojo-attach-point=\"arrowNodeInner\" class=\"dijitArrowNodeInner\"></span\n\t\t\t><span data-dojo-attach-point=\"titleNode\" class=\"dijitTitlePaneTextNode\"></span>\n\t\t</div>\n\t</div>\n\t<div class=\"dijitTitlePaneContentOuter\" data-dojo-attach-point=\"hideNode\" role=\"presentation\">\n\t\t<div class=\"dijitReset\" data-dojo-attach-point=\"wipeNode\" role=\"presentation\">\n\t\t\t<div class=\"dijitTitlePaneContentInner\" data-dojo-attach-point=\"containerNode\" role=\"region\" id=\"${id}_pane\">\n\t\t\t\t<!-- nested divs because wipeIn()/wipeOut() doesn't work right on node w/padding etc. Put padding on inner div. -->\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n"}});
|
||||
define("dijit/TitlePane", [
|
||||
"dojo/_base/array", // array.forEach
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom", // dom.setSelectable
|
||||
"dojo/dom-attr", // domAttr.set or get domAttr.remove
|
||||
"dojo/dom-class", // domClass.replace
|
||||
"dojo/dom-geometry", // domGeometry.setMarginBox domGeometry.getMarginBox
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/fx", // fxUtils.wipeIn fxUtils.wipeOut
|
||||
"dojo/_base/kernel", // kernel.deprecated
|
||||
"dojo/keys", // keys.DOWN_ARROW keys.ENTER
|
||||
"./_CssStateMixin",
|
||||
"./_TemplatedMixin",
|
||||
"./layout/ContentPane",
|
||||
"dojo/text!./templates/TitlePane.html",
|
||||
"./_base/manager" // defaultDuration
|
||||
], function(array, declare, dom, domAttr, domClass, domGeometry, event, fxUtils, kernel, keys,
|
||||
_CssStateMixin, _TemplatedMixin, ContentPane, template, manager){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
var _CssStateMixin = dijit._CssStateMixin;
|
||||
var ContentPane = dijit.layout.ContentPane;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/TitlePane
|
||||
// summary:
|
||||
// A pane with a title on top, that can be expanded or collapsed.
|
||||
|
||||
|
||||
return declare("dijit.TitlePane", [ContentPane, _TemplatedMixin, _CssStateMixin], {
|
||||
// summary:
|
||||
// A pane with a title on top, that can be expanded or collapsed.
|
||||
//
|
||||
// description:
|
||||
// An accessible container with a title Heading, and a content
|
||||
// section that slides open and closed. TitlePane is an extension to
|
||||
// `dijit.layout.ContentPane`, providing all the useful content-control aspects from it.
|
||||
//
|
||||
// example:
|
||||
// | // load a TitlePane from remote file:
|
||||
// | var foo = new dijit.TitlePane({ href: "foobar.html", title:"Title" });
|
||||
// | foo.startup();
|
||||
//
|
||||
// example:
|
||||
// | <!-- markup href example: -->
|
||||
// | <div data-dojo-type="dijit.TitlePane" data-dojo-props="href: 'foobar.html', title: 'Title'"></div>
|
||||
//
|
||||
// example:
|
||||
// | <!-- markup with inline data -->
|
||||
// | <div data-dojo-type="dijit.TitlePane" title="Title">
|
||||
// | <p>I am content</p>
|
||||
// | </div>
|
||||
|
||||
// title: String
|
||||
// Title of the pane
|
||||
title: "",
|
||||
_setTitleAttr: { node: "titleNode", type: "innerHTML" }, // override default where title becomes a hover tooltip
|
||||
|
||||
// open: Boolean
|
||||
// Whether pane is opened or closed.
|
||||
open: true,
|
||||
|
||||
// toggleable: Boolean
|
||||
// Whether pane can be opened or closed by clicking the title bar.
|
||||
toggleable: true,
|
||||
|
||||
// tabIndex: String
|
||||
// Tabindex setting for the title (so users can tab to the title then
|
||||
// use space/enter to open/close the title pane)
|
||||
tabIndex: "0",
|
||||
|
||||
// duration: Integer
|
||||
// Time in milliseconds to fade in/fade out
|
||||
duration: manager.defaultDuration,
|
||||
|
||||
// baseClass: [protected] String
|
||||
// The root className to be placed on this widget's domNode.
|
||||
baseClass: "dijitTitlePane",
|
||||
|
||||
templateString: template,
|
||||
|
||||
// doLayout: [protected] Boolean
|
||||
// Don't change this parameter from the default value.
|
||||
// This ContentPane parameter doesn't make sense for TitlePane, since TitlePane
|
||||
// is never a child of a layout container, nor should TitlePane try to control
|
||||
// the size of an inner widget.
|
||||
doLayout: false,
|
||||
|
||||
// Tooltip is defined in _WidgetBase but we need to handle the mapping to DOM here
|
||||
_setTooltipAttr: {node: "focusNode", type: "attribute", attribute: "title"}, // focusNode spans the entire width, titleNode doesn't
|
||||
|
||||
buildRendering: function(){
|
||||
this.inherited(arguments);
|
||||
dom.setSelectable(this.titleNode, false);
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
this.inherited(arguments);
|
||||
|
||||
// Hover and focus effect on title bar, except for non-toggleable TitlePanes
|
||||
// This should really be controlled from _setToggleableAttr() but _CssStateMixin
|
||||
// doesn't provide a way to disconnect a previous _trackMouseState() call
|
||||
if(this.toggleable){
|
||||
this._trackMouseState(this.titleBarNode, "dijitTitlePaneTitle");
|
||||
}
|
||||
|
||||
// setup open/close animations
|
||||
var hideNode = this.hideNode, wipeNode = this.wipeNode;
|
||||
this._wipeIn = fxUtils.wipeIn({
|
||||
node: wipeNode,
|
||||
duration: this.duration,
|
||||
beforeBegin: function(){
|
||||
hideNode.style.display="";
|
||||
}
|
||||
});
|
||||
this._wipeOut = fxUtils.wipeOut({
|
||||
node: wipeNode,
|
||||
duration: this.duration,
|
||||
onEnd: function(){
|
||||
hideNode.style.display="none";
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_setOpenAttr: function(/*Boolean*/ open, /*Boolean*/ animate){
|
||||
// summary:
|
||||
// Hook to make set("open", boolean) control the open/closed state of the pane.
|
||||
// open: Boolean
|
||||
// True if you want to open the pane, false if you want to close it.
|
||||
|
||||
array.forEach([this._wipeIn, this._wipeOut], function(animation){
|
||||
if(animation && animation.status() == "playing"){
|
||||
animation.stop();
|
||||
}
|
||||
});
|
||||
|
||||
if(animate){
|
||||
var anim = this[open ? "_wipeIn" : "_wipeOut"];
|
||||
anim.play();
|
||||
}else{
|
||||
this.hideNode.style.display = this.wipeNode.style.display = open ? "" : "none";
|
||||
}
|
||||
|
||||
// load content (if this is the first time we are opening the TitlePane
|
||||
// and content is specified as an href, or href was set when hidden)
|
||||
if(this._started){
|
||||
if(open){
|
||||
this._onShow();
|
||||
}else{
|
||||
this.onHide();
|
||||
}
|
||||
}
|
||||
|
||||
this.arrowNodeInner.innerHTML = open ? "-" : "+";
|
||||
|
||||
this.containerNode.setAttribute("aria-hidden", open ? "false" : "true");
|
||||
this.focusNode.setAttribute("aria-pressed", open ? "true" : "false");
|
||||
|
||||
this._set("open", open);
|
||||
|
||||
this._setCss();
|
||||
},
|
||||
|
||||
_setToggleableAttr: function(/*Boolean*/ canToggle){
|
||||
// summary:
|
||||
// Hook to make set("toggleable", boolean) work.
|
||||
// canToggle: Boolean
|
||||
// True to allow user to open/close pane by clicking title bar.
|
||||
|
||||
this.focusNode.setAttribute("role", canToggle ? "button" : "heading");
|
||||
if(canToggle){
|
||||
// TODO: if canToggle is switched from true to false shouldn't we remove this setting?
|
||||
this.focusNode.setAttribute("aria-controls", this.id+"_pane");
|
||||
domAttr.set(this.focusNode, "tabIndex", this.tabIndex);
|
||||
}else{
|
||||
domAttr.remove(this.focusNode, "tabIndex");
|
||||
}
|
||||
|
||||
this._set("toggleable", canToggle);
|
||||
|
||||
this._setCss();
|
||||
},
|
||||
|
||||
_setContentAttr: function(/*String|DomNode|Nodelist*/ content){
|
||||
// summary:
|
||||
// Hook to make set("content", ...) work.
|
||||
// Typically called when an href is loaded. Our job is to make the animation smooth.
|
||||
|
||||
if(!this.open || !this._wipeOut || this._wipeOut.status() == "playing"){
|
||||
// we are currently *closing* the pane (or the pane is closed), so just let that continue
|
||||
this.inherited(arguments);
|
||||
}else{
|
||||
if(this._wipeIn && this._wipeIn.status() == "playing"){
|
||||
this._wipeIn.stop();
|
||||
}
|
||||
|
||||
// freeze container at current height so that adding new content doesn't make it jump
|
||||
domGeometry.setMarginBox(this.wipeNode, { h: domGeometry.getMarginBox(this.wipeNode).h });
|
||||
|
||||
// add the new content (erasing the old content, if any)
|
||||
this.inherited(arguments);
|
||||
|
||||
// call _wipeIn.play() to animate from current height to new height
|
||||
if(this._wipeIn){
|
||||
this._wipeIn.play();
|
||||
}else{
|
||||
this.hideNode.style.display = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
toggle: function(){
|
||||
// summary:
|
||||
// Switches between opened and closed state
|
||||
// tags:
|
||||
// private
|
||||
|
||||
this._setOpenAttr(!this.open, true);
|
||||
},
|
||||
|
||||
_setCss: function(){
|
||||
// summary:
|
||||
// Set the open/close css state for the TitlePane
|
||||
// tags:
|
||||
// private
|
||||
|
||||
var node = this.titleBarNode || this.focusNode;
|
||||
var oldCls = this._titleBarClass;
|
||||
this._titleBarClass = "dijit" + (this.toggleable ? "" : "Fixed") + (this.open ? "Open" : "Closed");
|
||||
domClass.replace(node, this._titleBarClass, oldCls || "");
|
||||
|
||||
this.arrowNodeInner.innerHTML = this.open ? "-" : "+";
|
||||
},
|
||||
|
||||
_onTitleKey: function(/*Event*/ e){
|
||||
// summary:
|
||||
// Handler for when user hits a key
|
||||
// tags:
|
||||
// private
|
||||
|
||||
if(e.charOrCode == keys.ENTER || e.charOrCode == ' '){
|
||||
if(this.toggleable){
|
||||
this.toggle();
|
||||
}
|
||||
event.stop(e);
|
||||
}else if(e.charOrCode == keys.DOWN_ARROW && this.open){
|
||||
this.containerNode.focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
_onTitleClick: function(){
|
||||
// summary:
|
||||
// Handler when user clicks the title bar
|
||||
// tags:
|
||||
// private
|
||||
if(this.toggleable){
|
||||
this.toggle();
|
||||
}
|
||||
},
|
||||
|
||||
setTitle: function(/*String*/ title){
|
||||
// summary:
|
||||
// Deprecated. Use set('title', ...) instead.
|
||||
// tags:
|
||||
// deprecated
|
||||
kernel.deprecated("dijit.TitlePane.setTitle() is deprecated. Use set('title', ...) instead.", "", "2.0");
|
||||
this.set("title", title);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -1,13 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/Toolbar",["require","dojo/_base/declare","dojo/_base/kernel","dojo/keys","dojo/ready","./_Widget","./_KeyNavContainer","./_TemplatedMixin"],function(_1,_2,_3,_4,_5,_6,_7,_8){
|
||||
if(!_3.isAsync){
|
||||
_5(0,function(){
|
||||
var _9=["dijit/ToolbarSeparator"];
|
||||
_1(_9);
|
||||
});
|
||||
}
|
||||
return _2("dijit.Toolbar",[_6,_8,_7],{templateString:"<div class=\"dijit\" role=\"toolbar\" tabIndex=\"${tabIndex}\" data-dojo-attach-point=\"containerNode\">"+"</div>",baseClass:"dijitToolbar",postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
this.connectKeyNavHandlers(this.isLeftToRight()?[_4.LEFT_ARROW]:[_4.RIGHT_ARROW],this.isLeftToRight()?[_4.RIGHT_ARROW]:[_4.LEFT_ARROW]);
|
||||
}});
|
||||
});
|
|
@ -1,52 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/Toolbar", [
|
||||
"require",
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/kernel",
|
||||
"dojo/keys", // keys.LEFT_ARROW keys.RIGHT_ARROW
|
||||
"dojo/ready",
|
||||
"./_Widget",
|
||||
"./_KeyNavContainer",
|
||||
"./_TemplatedMixin"
|
||||
], function(require, declare, kernel, keys, ready, _Widget, _KeyNavContainer, _TemplatedMixin){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _KeyNavContainer = dijit._KeyNavContainer;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/Toolbar
|
||||
// summary:
|
||||
// A Toolbar widget, used to hold things like `dijit.Editor` buttons
|
||||
|
||||
|
||||
// Back compat w/1.6, remove for 2.0
|
||||
if(!kernel.isAsync){
|
||||
ready(0, function(){
|
||||
var requires = ["dijit/ToolbarSeparator"];
|
||||
require(requires); // use indirection so modules not rolled into a build
|
||||
});
|
||||
}
|
||||
|
||||
return declare("dijit.Toolbar", [_Widget, _TemplatedMixin, _KeyNavContainer], {
|
||||
// summary:
|
||||
// A Toolbar widget, used to hold things like `dijit.Editor` buttons
|
||||
|
||||
templateString:
|
||||
'<div class="dijit" role="toolbar" tabIndex="${tabIndex}" data-dojo-attach-point="containerNode">' +
|
||||
'</div>',
|
||||
|
||||
baseClass: "dijitToolbar",
|
||||
|
||||
postCreate: function(){
|
||||
this.inherited(arguments);
|
||||
|
||||
this.connectKeyNavHandlers(
|
||||
this.isLeftToRight() ? [keys.LEFT_ARROW] : [keys.RIGHT_ARROW],
|
||||
this.isLeftToRight() ? [keys.RIGHT_ARROW] : [keys.LEFT_ARROW]
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,9 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/ToolbarSeparator",["dojo/_base/declare","dojo/dom","./_Widget","./_TemplatedMixin"],function(_1,_2,_3,_4){
|
||||
return _1("dijit.ToolbarSeparator",[_3,_4],{templateString:"<div class=\"dijitToolbarSeparator dijitInline\" role=\"presentation\"></div>",buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
_2.setSelectable(this.domNode,false);
|
||||
},isFocusable:function(){
|
||||
return false;
|
||||
}});
|
||||
});
|
|
@ -1,39 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/ToolbarSeparator", [
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom", // dom.setSelectable
|
||||
"./_Widget",
|
||||
"./_TemplatedMixin"
|
||||
], function(declare, dom, _Widget, _TemplatedMixin){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/ToolbarSeparator
|
||||
// summary:
|
||||
// A spacer between two `dijit.Toolbar` items
|
||||
|
||||
|
||||
return declare("dijit.ToolbarSeparator", [_Widget, _TemplatedMixin], {
|
||||
// summary:
|
||||
// A spacer between two `dijit.Toolbar` items
|
||||
|
||||
templateString: '<div class="dijitToolbarSeparator dijitInline" role="presentation"></div>',
|
||||
|
||||
buildRendering: function(){
|
||||
this.inherited(arguments);
|
||||
dom.setSelectable(this.domNode, false);
|
||||
},
|
||||
|
||||
isFocusable: function(){
|
||||
// summary:
|
||||
// This widget isn't focusable, so pass along that fact.
|
||||
// tags:
|
||||
// protected
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,189 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/Tooltip.html":"<div class=\"dijitTooltip dijitTooltipLeft\" id=\"dojoTooltip\"\n\t><div class=\"dijitTooltipContainer dijitTooltipContents\" data-dojo-attach-point=\"containerNode\" role='alert'></div\n\t><div class=\"dijitTooltipConnector\" data-dojo-attach-point=\"connectorNode\"></div\n></div>\n"}});
|
||||
define("dijit/Tooltip",["dojo/_base/array","dojo/_base/declare","dojo/_base/fx","dojo/dom","dojo/dom-class","dojo/dom-geometry","dojo/dom-style","dojo/_base/lang","dojo/_base/sniff","dojo/_base/window","./_base/manager","./place","./_Widget","./_TemplatedMixin","./BackgroundIframe","dojo/text!./templates/Tooltip.html","."],function(_1,_2,fx,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f,_10){
|
||||
var _11=_2("dijit._MasterTooltip",[_c,_d],{duration:_a.defaultDuration,templateString:_f,postCreate:function(){
|
||||
_9.body().appendChild(this.domNode);
|
||||
this.bgIframe=new _e(this.domNode);
|
||||
this.fadeIn=fx.fadeIn({node:this.domNode,duration:this.duration,onEnd:_7.hitch(this,"_onShow")});
|
||||
this.fadeOut=fx.fadeOut({node:this.domNode,duration:this.duration,onEnd:_7.hitch(this,"_onHide")});
|
||||
},show:function(_12,_13,_14,rtl,_15){
|
||||
if(this.aroundNode&&this.aroundNode===_13&&this.containerNode.innerHTML==_12){
|
||||
return;
|
||||
}
|
||||
this.domNode.width="auto";
|
||||
if(this.fadeOut.status()=="playing"){
|
||||
this._onDeck=arguments;
|
||||
return;
|
||||
}
|
||||
this.containerNode.innerHTML=_12;
|
||||
this.set("textDir",_15);
|
||||
this.containerNode.align=rtl?"right":"left";
|
||||
var pos=_b.around(this.domNode,_13,_14&&_14.length?_14:_16.defaultPosition,!rtl,_7.hitch(this,"orient"));
|
||||
var _17=pos.aroundNodePos;
|
||||
if(pos.corner.charAt(0)=="M"&&pos.aroundCorner.charAt(0)=="M"){
|
||||
this.connectorNode.style.top=_17.y+((_17.h-this.connectorNode.offsetHeight)>>1)-pos.y+"px";
|
||||
this.connectorNode.style.left="";
|
||||
}else{
|
||||
if(pos.corner.charAt(1)=="M"&&pos.aroundCorner.charAt(1)=="M"){
|
||||
this.connectorNode.style.left=_17.x+((_17.w-this.connectorNode.offsetWidth)>>1)-pos.x+"px";
|
||||
}
|
||||
}
|
||||
_6.set(this.domNode,"opacity",0);
|
||||
this.fadeIn.play();
|
||||
this.isShowingNow=true;
|
||||
this.aroundNode=_13;
|
||||
},orient:function(_18,_19,_1a,_1b,_1c){
|
||||
this.connectorNode.style.top="";
|
||||
var _1d=_1b.w-this.connectorNode.offsetWidth;
|
||||
_18.className="dijitTooltip "+{"MR-ML":"dijitTooltipRight","ML-MR":"dijitTooltipLeft","TM-BM":"dijitTooltipAbove","BM-TM":"dijitTooltipBelow","BL-TL":"dijitTooltipBelow dijitTooltipABLeft","TL-BL":"dijitTooltipAbove dijitTooltipABLeft","BR-TR":"dijitTooltipBelow dijitTooltipABRight","TR-BR":"dijitTooltipAbove dijitTooltipABRight","BR-BL":"dijitTooltipRight","BL-BR":"dijitTooltipLeft"}[_19+"-"+_1a];
|
||||
this.domNode.style.width="auto";
|
||||
var _1e=_5.getContentBox(this.domNode);
|
||||
var _1f=Math.min((Math.max(_1d,1)),_1e.w);
|
||||
var _20=_1f<_1e.w;
|
||||
this.domNode.style.width=_1f+"px";
|
||||
if(_20){
|
||||
this.containerNode.style.overflow="auto";
|
||||
var _21=this.containerNode.scrollWidth;
|
||||
this.containerNode.style.overflow="visible";
|
||||
if(_21>_1f){
|
||||
_21=_21+_6.get(this.domNode,"paddingLeft")+_6.get(this.domNode,"paddingRight");
|
||||
this.domNode.style.width=_21+"px";
|
||||
}
|
||||
}
|
||||
if(_1a.charAt(0)=="B"&&_19.charAt(0)=="B"){
|
||||
var mb=_5.getMarginBox(_18);
|
||||
var _22=this.connectorNode.offsetHeight;
|
||||
if(mb.h>_1b.h){
|
||||
var _23=_1b.h-((_1c.h+_22)>>1);
|
||||
this.connectorNode.style.top=_23+"px";
|
||||
this.connectorNode.style.bottom="";
|
||||
}else{
|
||||
this.connectorNode.style.bottom=Math.min(Math.max(_1c.h/2-_22/2,0),mb.h-_22)+"px";
|
||||
this.connectorNode.style.top="";
|
||||
}
|
||||
}else{
|
||||
this.connectorNode.style.top="";
|
||||
this.connectorNode.style.bottom="";
|
||||
}
|
||||
return Math.max(0,_1e.w-_1d);
|
||||
},_onShow:function(){
|
||||
if(_8("ie")){
|
||||
this.domNode.style.filter="";
|
||||
}
|
||||
},hide:function(_24){
|
||||
if(this._onDeck&&this._onDeck[1]==_24){
|
||||
this._onDeck=null;
|
||||
}else{
|
||||
if(this.aroundNode===_24){
|
||||
this.fadeIn.stop();
|
||||
this.isShowingNow=false;
|
||||
this.aroundNode=null;
|
||||
this.fadeOut.play();
|
||||
}else{
|
||||
}
|
||||
}
|
||||
},_onHide:function(){
|
||||
this.domNode.style.cssText="";
|
||||
this.containerNode.innerHTML="";
|
||||
if(this._onDeck){
|
||||
this.show.apply(this,this._onDeck);
|
||||
this._onDeck=null;
|
||||
}
|
||||
},_setAutoTextDir:function(_25){
|
||||
this.applyTextDir(_25,_8("ie")?_25.outerText:_25.textContent);
|
||||
_1.forEach(_25.children,function(_26){
|
||||
this._setAutoTextDir(_26);
|
||||
},this);
|
||||
},_setTextDirAttr:function(_27){
|
||||
this._set("textDir",typeof _27!="undefined"?_27:"");
|
||||
if(_27=="auto"){
|
||||
this._setAutoTextDir(this.containerNode);
|
||||
}else{
|
||||
this.containerNode.dir=this.textDir;
|
||||
}
|
||||
}});
|
||||
_10.showTooltip=function(_28,_29,_2a,rtl,_2b){
|
||||
if(!_16._masterTT){
|
||||
_10._masterTT=_16._masterTT=new _11();
|
||||
}
|
||||
return _16._masterTT.show(_28,_29,_2a,rtl,_2b);
|
||||
};
|
||||
_10.hideTooltip=function(_2c){
|
||||
return _16._masterTT&&_16._masterTT.hide(_2c);
|
||||
};
|
||||
var _16=_2("dijit.Tooltip",_c,{label:"",showDelay:400,connectId:[],position:[],_setConnectIdAttr:function(_2d){
|
||||
_1.forEach(this._connections||[],function(_2e){
|
||||
_1.forEach(_2e,_7.hitch(this,"disconnect"));
|
||||
},this);
|
||||
this._connectIds=_1.filter(_7.isArrayLike(_2d)?_2d:(_2d?[_2d]:[]),function(id){
|
||||
return _3.byId(id);
|
||||
});
|
||||
this._connections=_1.map(this._connectIds,function(id){
|
||||
var _2f=_3.byId(id);
|
||||
return [this.connect(_2f,"onmouseenter","_onHover"),this.connect(_2f,"onmouseleave","_onUnHover"),this.connect(_2f,"onfocus","_onHover"),this.connect(_2f,"onblur","_onUnHover")];
|
||||
},this);
|
||||
this._set("connectId",_2d);
|
||||
},addTarget:function(_30){
|
||||
var id=_30.id||_30;
|
||||
if(_1.indexOf(this._connectIds,id)==-1){
|
||||
this.set("connectId",this._connectIds.concat(id));
|
||||
}
|
||||
},removeTarget:function(_31){
|
||||
var id=_31.id||_31,idx=_1.indexOf(this._connectIds,id);
|
||||
if(idx>=0){
|
||||
this._connectIds.splice(idx,1);
|
||||
this.set("connectId",this._connectIds);
|
||||
}
|
||||
},buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
_4.add(this.domNode,"dijitTooltipData");
|
||||
},startup:function(){
|
||||
this.inherited(arguments);
|
||||
var ids=this.connectId;
|
||||
_1.forEach(_7.isArrayLike(ids)?ids:[ids],this.addTarget,this);
|
||||
},_onHover:function(e){
|
||||
if(!this._showTimer){
|
||||
var _32=e.target;
|
||||
this._showTimer=setTimeout(_7.hitch(this,function(){
|
||||
this.open(_32);
|
||||
}),this.showDelay);
|
||||
}
|
||||
},_onUnHover:function(){
|
||||
if(this._focus){
|
||||
return;
|
||||
}
|
||||
if(this._showTimer){
|
||||
clearTimeout(this._showTimer);
|
||||
delete this._showTimer;
|
||||
}
|
||||
this.close();
|
||||
},open:function(_33){
|
||||
if(this._showTimer){
|
||||
clearTimeout(this._showTimer);
|
||||
delete this._showTimer;
|
||||
}
|
||||
_16.show(this.label||this.domNode.innerHTML,_33,this.position,!this.isLeftToRight(),this.textDir);
|
||||
this._connectNode=_33;
|
||||
this.onShow(_33,this.position);
|
||||
},close:function(){
|
||||
if(this._connectNode){
|
||||
_16.hide(this._connectNode);
|
||||
delete this._connectNode;
|
||||
this.onHide();
|
||||
}
|
||||
if(this._showTimer){
|
||||
clearTimeout(this._showTimer);
|
||||
delete this._showTimer;
|
||||
}
|
||||
},onShow:function(){
|
||||
},onHide:function(){
|
||||
},uninitialize:function(){
|
||||
this.close();
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
_16._MasterTooltip=_11;
|
||||
_16.show=_10.showTooltip;
|
||||
_16.hide=_10.hideTooltip;
|
||||
_16.defaultPosition=["after-centered","before-centered"];
|
||||
return _16;
|
||||
});
|
|
@ -1,492 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/Tooltip.html':"<div class=\"dijitTooltip dijitTooltipLeft\" id=\"dojoTooltip\"\n\t><div class=\"dijitTooltipContainer dijitTooltipContents\" data-dojo-attach-point=\"containerNode\" role='alert'></div\n\t><div class=\"dijitTooltipConnector\" data-dojo-attach-point=\"connectorNode\"></div\n></div>\n"}});
|
||||
define("dijit/Tooltip", [
|
||||
"dojo/_base/array", // array.forEach array.indexOf array.map
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/fx", // fx.fadeIn fx.fadeOut
|
||||
"dojo/dom", // dom.byId
|
||||
"dojo/dom-class", // domClass.add
|
||||
"dojo/dom-geometry", // domGeometry.getMarginBox domGeometry.position
|
||||
"dojo/dom-style", // domStyle.set, domStyle.get
|
||||
"dojo/_base/lang", // lang.hitch lang.isArrayLike
|
||||
"dojo/_base/sniff", // has("ie")
|
||||
"dojo/_base/window", // win.body
|
||||
"./_base/manager", // manager.defaultDuration
|
||||
"./place",
|
||||
"./_Widget",
|
||||
"./_TemplatedMixin",
|
||||
"./BackgroundIframe",
|
||||
"dojo/text!./templates/Tooltip.html",
|
||||
"." // sets dijit.showTooltip etc. for back-compat
|
||||
], function(array, declare, fx, dom, domClass, domGeometry, domStyle, lang, has, win,
|
||||
manager, place, _Widget, _TemplatedMixin, BackgroundIframe, template, dijit){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var BackgroundIframe = dijit.BackgroundIframe;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/Tooltip
|
||||
// summary:
|
||||
// Defines dijit.Tooltip widget (to display a tooltip), showTooltip()/hideTooltip(), and _MasterTooltip
|
||||
|
||||
|
||||
var MasterTooltip = declare("dijit._MasterTooltip", [_Widget, _TemplatedMixin], {
|
||||
// summary:
|
||||
// Internal widget that holds the actual tooltip markup,
|
||||
// which occurs once per page.
|
||||
// Called by Tooltip widgets which are just containers to hold
|
||||
// the markup
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
// duration: Integer
|
||||
// Milliseconds to fade in/fade out
|
||||
duration: manager.defaultDuration,
|
||||
|
||||
templateString: template,
|
||||
|
||||
postCreate: function(){
|
||||
win.body().appendChild(this.domNode);
|
||||
|
||||
this.bgIframe = new BackgroundIframe(this.domNode);
|
||||
|
||||
// Setup fade-in and fade-out functions.
|
||||
this.fadeIn = fx.fadeIn({ node: this.domNode, duration: this.duration, onEnd: lang.hitch(this, "_onShow") });
|
||||
this.fadeOut = fx.fadeOut({ node: this.domNode, duration: this.duration, onEnd: lang.hitch(this, "_onHide") });
|
||||
},
|
||||
|
||||
show: function(innerHTML, aroundNode, position, rtl, textDir){
|
||||
// summary:
|
||||
// Display tooltip w/specified contents to right of specified node
|
||||
// (To left if there's no space on the right, or if rtl == true)
|
||||
// innerHTML: String
|
||||
// Contents of the tooltip
|
||||
// aroundNode: DomNode || dijit.__Rectangle
|
||||
// Specifies that tooltip should be next to this node / area
|
||||
// position: String[]?
|
||||
// List of positions to try to position tooltip (ex: ["right", "above"])
|
||||
// rtl: Boolean?
|
||||
// Corresponds to `WidgetBase.dir` attribute, where false means "ltr" and true
|
||||
// means "rtl"; specifies GUI direction, not text direction.
|
||||
// textDir: String?
|
||||
// Corresponds to `WidgetBase.textdir` attribute; specifies direction of text.
|
||||
|
||||
|
||||
if(this.aroundNode && this.aroundNode === aroundNode && this.containerNode.innerHTML == innerHTML){
|
||||
return;
|
||||
}
|
||||
|
||||
// reset width; it may have been set by orient() on a previous tooltip show()
|
||||
this.domNode.width = "auto";
|
||||
|
||||
if(this.fadeOut.status() == "playing"){
|
||||
// previous tooltip is being hidden; wait until the hide completes then show new one
|
||||
this._onDeck=arguments;
|
||||
return;
|
||||
}
|
||||
this.containerNode.innerHTML=innerHTML;
|
||||
|
||||
this.set("textDir", textDir);
|
||||
this.containerNode.align = rtl? "right" : "left"; //fix the text alignment
|
||||
|
||||
var pos = place.around(this.domNode, aroundNode,
|
||||
position && position.length ? position : Tooltip.defaultPosition, !rtl, lang.hitch(this, "orient"));
|
||||
|
||||
// Position the tooltip connector for middle alignment.
|
||||
// This could not have been done in orient() since the tooltip wasn't positioned at that time.
|
||||
var aroundNodeCoords = pos.aroundNodePos;
|
||||
if(pos.corner.charAt(0) == 'M' && pos.aroundCorner.charAt(0) == 'M'){
|
||||
this.connectorNode.style.top = aroundNodeCoords.y + ((aroundNodeCoords.h - this.connectorNode.offsetHeight) >> 1) - pos.y + "px";
|
||||
this.connectorNode.style.left = "";
|
||||
}else if(pos.corner.charAt(1) == 'M' && pos.aroundCorner.charAt(1) == 'M'){
|
||||
this.connectorNode.style.left = aroundNodeCoords.x + ((aroundNodeCoords.w - this.connectorNode.offsetWidth) >> 1) - pos.x + "px";
|
||||
}
|
||||
|
||||
// show it
|
||||
domStyle.set(this.domNode, "opacity", 0);
|
||||
this.fadeIn.play();
|
||||
this.isShowingNow = true;
|
||||
this.aroundNode = aroundNode;
|
||||
},
|
||||
|
||||
orient: function(/*DomNode*/ node, /*String*/ aroundCorner, /*String*/ tooltipCorner, /*Object*/ spaceAvailable, /*Object*/ aroundNodeCoords){
|
||||
// summary:
|
||||
// Private function to set CSS for tooltip node based on which position it's in.
|
||||
// This is called by the dijit popup code. It will also reduce the tooltip's
|
||||
// width to whatever width is available
|
||||
// tags:
|
||||
// protected
|
||||
this.connectorNode.style.top = ""; //reset to default
|
||||
|
||||
//Adjust the spaceAvailable width, without changing the spaceAvailable object
|
||||
var tooltipSpaceAvaliableWidth = spaceAvailable.w - this.connectorNode.offsetWidth;
|
||||
|
||||
node.className = "dijitTooltip " +
|
||||
{
|
||||
"MR-ML": "dijitTooltipRight",
|
||||
"ML-MR": "dijitTooltipLeft",
|
||||
"TM-BM": "dijitTooltipAbove",
|
||||
"BM-TM": "dijitTooltipBelow",
|
||||
"BL-TL": "dijitTooltipBelow dijitTooltipABLeft",
|
||||
"TL-BL": "dijitTooltipAbove dijitTooltipABLeft",
|
||||
"BR-TR": "dijitTooltipBelow dijitTooltipABRight",
|
||||
"TR-BR": "dijitTooltipAbove dijitTooltipABRight",
|
||||
"BR-BL": "dijitTooltipRight",
|
||||
"BL-BR": "dijitTooltipLeft"
|
||||
}[aroundCorner + "-" + tooltipCorner];
|
||||
|
||||
// reduce tooltip's width to the amount of width available, so that it doesn't overflow screen
|
||||
this.domNode.style.width = "auto";
|
||||
var size = domGeometry.getContentBox(this.domNode);
|
||||
|
||||
var width = Math.min((Math.max(tooltipSpaceAvaliableWidth,1)), size.w);
|
||||
var widthWasReduced = width < size.w;
|
||||
|
||||
this.domNode.style.width = width+"px";
|
||||
|
||||
//Adjust width for tooltips that have a really long word or a nowrap setting
|
||||
if(widthWasReduced){
|
||||
this.containerNode.style.overflow = "auto"; //temp change to overflow to detect if our tooltip needs to be wider to support the content
|
||||
var scrollWidth = this.containerNode.scrollWidth;
|
||||
this.containerNode.style.overflow = "visible"; //change it back
|
||||
if(scrollWidth > width){
|
||||
scrollWidth = scrollWidth + domStyle.get(this.domNode,"paddingLeft") + domStyle.get(this.domNode,"paddingRight");
|
||||
this.domNode.style.width = scrollWidth + "px";
|
||||
}
|
||||
}
|
||||
|
||||
// Reposition the tooltip connector.
|
||||
if(tooltipCorner.charAt(0) == 'B' && aroundCorner.charAt(0) == 'B'){
|
||||
var mb = domGeometry.getMarginBox(node);
|
||||
var tooltipConnectorHeight = this.connectorNode.offsetHeight;
|
||||
if(mb.h > spaceAvailable.h){
|
||||
// The tooltip starts at the top of the page and will extend past the aroundNode
|
||||
var aroundNodePlacement = spaceAvailable.h - ((aroundNodeCoords.h + tooltipConnectorHeight) >> 1);
|
||||
this.connectorNode.style.top = aroundNodePlacement + "px";
|
||||
this.connectorNode.style.bottom = "";
|
||||
}else{
|
||||
// Align center of connector with center of aroundNode, except don't let bottom
|
||||
// of connector extend below bottom of tooltip content, or top of connector
|
||||
// extend past top of tooltip content
|
||||
this.connectorNode.style.bottom = Math.min(
|
||||
Math.max(aroundNodeCoords.h/2 - tooltipConnectorHeight/2, 0),
|
||||
mb.h - tooltipConnectorHeight) + "px";
|
||||
this.connectorNode.style.top = "";
|
||||
}
|
||||
}else{
|
||||
// reset the tooltip back to the defaults
|
||||
this.connectorNode.style.top = "";
|
||||
this.connectorNode.style.bottom = "";
|
||||
}
|
||||
|
||||
return Math.max(0, size.w - tooltipSpaceAvaliableWidth);
|
||||
},
|
||||
|
||||
_onShow: function(){
|
||||
// summary:
|
||||
// Called at end of fade-in operation
|
||||
// tags:
|
||||
// protected
|
||||
if(has("ie")){
|
||||
// the arrow won't show up on a node w/an opacity filter
|
||||
this.domNode.style.filter="";
|
||||
}
|
||||
},
|
||||
|
||||
hide: function(aroundNode){
|
||||
// summary:
|
||||
// Hide the tooltip
|
||||
|
||||
if(this._onDeck && this._onDeck[1] == aroundNode){
|
||||
// this hide request is for a show() that hasn't even started yet;
|
||||
// just cancel the pending show()
|
||||
this._onDeck=null;
|
||||
}else if(this.aroundNode === aroundNode){
|
||||
// this hide request is for the currently displayed tooltip
|
||||
this.fadeIn.stop();
|
||||
this.isShowingNow = false;
|
||||
this.aroundNode = null;
|
||||
this.fadeOut.play();
|
||||
}else{
|
||||
// just ignore the call, it's for a tooltip that has already been erased
|
||||
}
|
||||
},
|
||||
|
||||
_onHide: function(){
|
||||
// summary:
|
||||
// Called at end of fade-out operation
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
this.domNode.style.cssText=""; // to position offscreen again
|
||||
this.containerNode.innerHTML="";
|
||||
if(this._onDeck){
|
||||
// a show request has been queued up; do it now
|
||||
this.show.apply(this, this._onDeck);
|
||||
this._onDeck=null;
|
||||
}
|
||||
},
|
||||
|
||||
_setAutoTextDir: function(/*Object*/node){
|
||||
// summary:
|
||||
// Resolve "auto" text direction for children nodes
|
||||
// tags:
|
||||
// private
|
||||
|
||||
this.applyTextDir(node, has("ie") ? node.outerText : node.textContent);
|
||||
array.forEach(node.children, function(child){this._setAutoTextDir(child); }, this);
|
||||
},
|
||||
|
||||
_setTextDirAttr: function(/*String*/ textDir){
|
||||
// summary:
|
||||
// Setter for textDir.
|
||||
// description:
|
||||
// Users shouldn't call this function; they should be calling
|
||||
// set('textDir', value)
|
||||
// tags:
|
||||
// private
|
||||
|
||||
this._set("textDir", typeof textDir != 'undefined'? textDir : "");
|
||||
if (textDir == "auto"){
|
||||
this._setAutoTextDir(this.containerNode);
|
||||
}else{
|
||||
this.containerNode.dir = this.textDir;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dijit.showTooltip = function(innerHTML, aroundNode, position, rtl, textDir){
|
||||
// summary:
|
||||
// Static method to display tooltip w/specified contents in specified position.
|
||||
// See description of dijit.Tooltip.defaultPosition for details on position parameter.
|
||||
// If position is not specified then dijit.Tooltip.defaultPosition is used.
|
||||
// innerHTML: String
|
||||
// Contents of the tooltip
|
||||
// aroundNode: dijit.__Rectangle
|
||||
// Specifies that tooltip should be next to this node / area
|
||||
// position: String[]?
|
||||
// List of positions to try to position tooltip (ex: ["right", "above"])
|
||||
// rtl: Boolean?
|
||||
// Corresponds to `WidgetBase.dir` attribute, where false means "ltr" and true
|
||||
// means "rtl"; specifies GUI direction, not text direction.
|
||||
// textDir: String?
|
||||
// Corresponds to `WidgetBase.textdir` attribute; specifies direction of text.
|
||||
if(!Tooltip._masterTT){ dijit._masterTT = Tooltip._masterTT = new MasterTooltip(); }
|
||||
return Tooltip._masterTT.show(innerHTML, aroundNode, position, rtl, textDir);
|
||||
};
|
||||
|
||||
dijit.hideTooltip = function(aroundNode){
|
||||
// summary:
|
||||
// Static method to hide the tooltip displayed via showTooltip()
|
||||
return Tooltip._masterTT && Tooltip._masterTT.hide(aroundNode);
|
||||
};
|
||||
|
||||
var Tooltip = declare("dijit.Tooltip", _Widget, {
|
||||
// summary:
|
||||
// Pops up a tooltip (a help message) when you hover over a node.
|
||||
|
||||
// label: String
|
||||
// Text to display in the tooltip.
|
||||
// Specified as innerHTML when creating the widget from markup.
|
||||
label: "",
|
||||
|
||||
// showDelay: Integer
|
||||
// Number of milliseconds to wait after hovering over/focusing on the object, before
|
||||
// the tooltip is displayed.
|
||||
showDelay: 400,
|
||||
|
||||
// connectId: String|String[]
|
||||
// Id of domNode(s) to attach the tooltip to.
|
||||
// When user hovers over specified dom node, the tooltip will appear.
|
||||
connectId: [],
|
||||
|
||||
// position: String[]
|
||||
// See description of `dijit.Tooltip.defaultPosition` for details on position parameter.
|
||||
position: [],
|
||||
|
||||
_setConnectIdAttr: function(/*String|String[]*/ newId){
|
||||
// summary:
|
||||
// Connect to specified node(s)
|
||||
|
||||
// Remove connections to old nodes (if there are any)
|
||||
array.forEach(this._connections || [], function(nested){
|
||||
array.forEach(nested, lang.hitch(this, "disconnect"));
|
||||
}, this);
|
||||
|
||||
// Make array of id's to connect to, excluding entries for nodes that don't exist yet, see startup()
|
||||
this._connectIds = array.filter(lang.isArrayLike(newId) ? newId : (newId ? [newId] : []),
|
||||
function(id){ return dom.byId(id); });
|
||||
|
||||
// Make connections
|
||||
this._connections = array.map(this._connectIds, function(id){
|
||||
var node = dom.byId(id);
|
||||
return [
|
||||
this.connect(node, "onmouseenter", "_onHover"),
|
||||
this.connect(node, "onmouseleave", "_onUnHover"),
|
||||
this.connect(node, "onfocus", "_onHover"),
|
||||
this.connect(node, "onblur", "_onUnHover")
|
||||
];
|
||||
}, this);
|
||||
|
||||
this._set("connectId", newId);
|
||||
},
|
||||
|
||||
addTarget: function(/*DOMNODE || String*/ node){
|
||||
// summary:
|
||||
// Attach tooltip to specified node if it's not already connected
|
||||
|
||||
// TODO: remove in 2.0 and just use set("connectId", ...) interface
|
||||
|
||||
var id = node.id || node;
|
||||
if(array.indexOf(this._connectIds, id) == -1){
|
||||
this.set("connectId", this._connectIds.concat(id));
|
||||
}
|
||||
},
|
||||
|
||||
removeTarget: function(/*DomNode || String*/ node){
|
||||
// summary:
|
||||
// Detach tooltip from specified node
|
||||
|
||||
// TODO: remove in 2.0 and just use set("connectId", ...) interface
|
||||
|
||||
var id = node.id || node, // map from DOMNode back to plain id string
|
||||
idx = array.indexOf(this._connectIds, id);
|
||||
if(idx >= 0){
|
||||
// remove id (modifies original this._connectIds but that's OK in this case)
|
||||
this._connectIds.splice(idx, 1);
|
||||
this.set("connectId", this._connectIds);
|
||||
}
|
||||
},
|
||||
|
||||
buildRendering: function(){
|
||||
this.inherited(arguments);
|
||||
domClass.add(this.domNode,"dijitTooltipData");
|
||||
},
|
||||
|
||||
startup: function(){
|
||||
this.inherited(arguments);
|
||||
|
||||
// If this tooltip was created in a template, or for some other reason the specified connectId[s]
|
||||
// didn't exist during the widget's initialization, then connect now.
|
||||
var ids = this.connectId;
|
||||
array.forEach(lang.isArrayLike(ids) ? ids : [ids], this.addTarget, this);
|
||||
},
|
||||
|
||||
_onHover: function(/*Event*/ e){
|
||||
// summary:
|
||||
// Despite the name of this method, it actually handles both hover and focus
|
||||
// events on the target node, setting a timer to show the tooltip.
|
||||
// tags:
|
||||
// private
|
||||
if(!this._showTimer){
|
||||
var target = e.target;
|
||||
this._showTimer = setTimeout(lang.hitch(this, function(){this.open(target)}), this.showDelay);
|
||||
}
|
||||
},
|
||||
|
||||
_onUnHover: function(/*Event*/ /*===== e =====*/){
|
||||
// summary:
|
||||
// Despite the name of this method, it actually handles both mouseleave and blur
|
||||
// events on the target node, hiding the tooltip.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
// keep a tooltip open if the associated element still has focus (even though the
|
||||
// mouse moved away)
|
||||
if(this._focus){ return; }
|
||||
|
||||
if(this._showTimer){
|
||||
clearTimeout(this._showTimer);
|
||||
delete this._showTimer;
|
||||
}
|
||||
this.close();
|
||||
},
|
||||
|
||||
open: function(/*DomNode*/ target){
|
||||
// summary:
|
||||
// Display the tooltip; usually not called directly.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
if(this._showTimer){
|
||||
clearTimeout(this._showTimer);
|
||||
delete this._showTimer;
|
||||
}
|
||||
Tooltip.show(this.label || this.domNode.innerHTML, target, this.position, !this.isLeftToRight(), this.textDir);
|
||||
|
||||
this._connectNode = target;
|
||||
this.onShow(target, this.position);
|
||||
},
|
||||
|
||||
close: function(){
|
||||
// summary:
|
||||
// Hide the tooltip or cancel timer for show of tooltip
|
||||
// tags:
|
||||
// private
|
||||
|
||||
if(this._connectNode){
|
||||
// if tooltip is currently shown
|
||||
Tooltip.hide(this._connectNode);
|
||||
delete this._connectNode;
|
||||
this.onHide();
|
||||
}
|
||||
if(this._showTimer){
|
||||
// if tooltip is scheduled to be shown (after a brief delay)
|
||||
clearTimeout(this._showTimer);
|
||||
delete this._showTimer;
|
||||
}
|
||||
},
|
||||
|
||||
onShow: function(/*===== target, position =====*/){
|
||||
// summary:
|
||||
// Called when the tooltip is shown
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
|
||||
onHide: function(){
|
||||
// summary:
|
||||
// Called when the tooltip is hidden
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
|
||||
uninitialize: function(){
|
||||
this.close();
|
||||
this.inherited(arguments);
|
||||
}
|
||||
});
|
||||
|
||||
Tooltip._MasterTooltip = MasterTooltip; // for monkey patching
|
||||
Tooltip.show = dijit.showTooltip; // export function through module return value
|
||||
Tooltip.hide = dijit.hideTooltip; // export function through module return value
|
||||
|
||||
// dijit.Tooltip.defaultPosition: String[]
|
||||
// This variable controls the position of tooltips, if the position is not specified to
|
||||
// the Tooltip widget or *TextBox widget itself. It's an array of strings with the values
|
||||
// possible for `dijit/place::around()`. The recommended values are:
|
||||
//
|
||||
// * before-centered: centers tooltip to the left of the anchor node/widget, or to the right
|
||||
// in the case of RTL scripts like Hebrew and Arabic
|
||||
// * after-centered: centers tooltip to the right of the anchor node/widget, or to the left
|
||||
// in the case of RTL scripts like Hebrew and Arabic
|
||||
// * above-centered: tooltip is centered above anchor node
|
||||
// * below-centered: tooltip is centered above anchor node
|
||||
//
|
||||
// The list is positions is tried, in order, until a position is found where the tooltip fits
|
||||
// within the viewport.
|
||||
//
|
||||
// Be careful setting this parameter. A value of "above-centered" may work fine until the user scrolls
|
||||
// the screen so that there's no room above the target node. Nodes with drop downs, like
|
||||
// DropDownButton or FilteringSelect, are especially problematic, in that you need to be sure
|
||||
// that the drop down and tooltip don't overlap, even when the viewport is scrolled so that there
|
||||
// is only room below (or above) the target node, but not both.
|
||||
Tooltip.defaultPosition = ["after-centered", "before-centered"];
|
||||
|
||||
|
||||
return Tooltip;
|
||||
});
|
|
@ -1,51 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/TooltipDialog.html":"<div role=\"presentation\" tabIndex=\"-1\">\n\t<div class=\"dijitTooltipContainer\" role=\"presentation\">\n\t\t<div class =\"dijitTooltipContents dijitTooltipFocusNode\" data-dojo-attach-point=\"containerNode\" role=\"dialog\"></div>\n\t</div>\n\t<div class=\"dijitTooltipConnector\" role=\"presentation\"></div>\n</div>\n"}});
|
||||
define("dijit/TooltipDialog",["dojo/_base/declare","dojo/dom-class","dojo/_base/event","dojo/keys","dojo/_base/lang","./focus","./layout/ContentPane","./_DialogMixin","./form/_FormMixin","./_TemplatedMixin","dojo/text!./templates/TooltipDialog.html","."],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c){
|
||||
return _1("dijit.TooltipDialog",[_7,_a,_9,_8],{title:"",doLayout:false,autofocus:true,baseClass:"dijitTooltipDialog",_firstFocusItem:null,_lastFocusItem:null,templateString:_b,_setTitleAttr:function(_d){
|
||||
this.containerNode.title=_d;
|
||||
this._set("title",_d);
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
this.connect(this.containerNode,"onkeypress","_onKey");
|
||||
},orient:function(_e,_f,_10){
|
||||
var _11="dijitTooltipAB"+(_10.charAt(1)=="L"?"Left":"Right")+" dijitTooltip"+(_10.charAt(0)=="T"?"Below":"Above");
|
||||
_2.replace(this.domNode,_11,this._currentOrientClass||"");
|
||||
this._currentOrientClass=_11;
|
||||
},focus:function(){
|
||||
this._getFocusItems(this.containerNode);
|
||||
_6.focus(this._firstFocusItem);
|
||||
},onOpen:function(pos){
|
||||
this.orient(this.domNode,pos.aroundCorner,pos.corner);
|
||||
this._onShow();
|
||||
},onClose:function(){
|
||||
this.onHide();
|
||||
},_onKey:function(evt){
|
||||
var _12=evt.target;
|
||||
if(evt.charOrCode===_4.TAB){
|
||||
this._getFocusItems(this.containerNode);
|
||||
}
|
||||
var _13=(this._firstFocusItem==this._lastFocusItem);
|
||||
if(evt.charOrCode==_4.ESCAPE){
|
||||
setTimeout(_5.hitch(this,"onCancel"),0);
|
||||
_3.stop(evt);
|
||||
}else{
|
||||
if(_12==this._firstFocusItem&&evt.shiftKey&&evt.charOrCode===_4.TAB){
|
||||
if(!_13){
|
||||
_6.focus(this._lastFocusItem);
|
||||
}
|
||||
_3.stop(evt);
|
||||
}else{
|
||||
if(_12==this._lastFocusItem&&evt.charOrCode===_4.TAB&&!evt.shiftKey){
|
||||
if(!_13){
|
||||
_6.focus(this._firstFocusItem);
|
||||
}
|
||||
_3.stop(evt);
|
||||
}else{
|
||||
if(evt.charOrCode===_4.TAB){
|
||||
evt.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}});
|
||||
});
|
|
@ -1,157 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/TooltipDialog.html':"<div role=\"presentation\" tabIndex=\"-1\">\n\t<div class=\"dijitTooltipContainer\" role=\"presentation\">\n\t\t<div class =\"dijitTooltipContents dijitTooltipFocusNode\" data-dojo-attach-point=\"containerNode\" role=\"dialog\"></div>\n\t</div>\n\t<div class=\"dijitTooltipConnector\" role=\"presentation\"></div>\n</div>\n"}});
|
||||
define("dijit/TooltipDialog", [
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-class", // domClass.replace
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/keys", // keys
|
||||
"dojo/_base/lang", // lang.hitch
|
||||
"./focus",
|
||||
"./layout/ContentPane",
|
||||
"./_DialogMixin",
|
||||
"./form/_FormMixin",
|
||||
"./_TemplatedMixin",
|
||||
"dojo/text!./templates/TooltipDialog.html",
|
||||
"." // exports methods to dijit global
|
||||
], function(declare, domClass, event, keys, lang,
|
||||
focus, ContentPane, _DialogMixin, _FormMixin, _TemplatedMixin, template, dijit){
|
||||
|
||||
/*=====
|
||||
var ContentPane = dijit.layout.ContentPane;
|
||||
var _DialogMixin = dijit._DialogMixin;
|
||||
var _FormMixin = dijit.form._FormMixin;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/TooltipDialog
|
||||
// summary:
|
||||
// Pops up a dialog that appears like a Tooltip
|
||||
|
||||
|
||||
return declare("dijit.TooltipDialog",
|
||||
[ContentPane, _TemplatedMixin, _FormMixin, _DialogMixin], {
|
||||
// summary:
|
||||
// Pops up a dialog that appears like a Tooltip
|
||||
|
||||
// title: String
|
||||
// Description of tooltip dialog (required for a11y)
|
||||
title: "",
|
||||
|
||||
// doLayout: [protected] Boolean
|
||||
// Don't change this parameter from the default value.
|
||||
// This ContentPane parameter doesn't make sense for TooltipDialog, since TooltipDialog
|
||||
// is never a child of a layout container, nor can you specify the size of
|
||||
// TooltipDialog in order to control the size of an inner widget.
|
||||
doLayout: false,
|
||||
|
||||
// autofocus: Boolean
|
||||
// A Toggle to modify the default focus behavior of a Dialog, which
|
||||
// is to focus on the first dialog element after opening the dialog.
|
||||
// False will disable autofocusing. Default: true
|
||||
autofocus: true,
|
||||
|
||||
// baseClass: [protected] String
|
||||
// The root className to use for the various states of this widget
|
||||
baseClass: "dijitTooltipDialog",
|
||||
|
||||
// _firstFocusItem: [private] [readonly] DomNode
|
||||
// The pointer to the first focusable node in the dialog.
|
||||
// Set by `dijit._DialogMixin._getFocusItems`.
|
||||
_firstFocusItem: null,
|
||||
|
||||
// _lastFocusItem: [private] [readonly] DomNode
|
||||
// The pointer to which node has focus prior to our dialog.
|
||||
// Set by `dijit._DialogMixin._getFocusItems`.
|
||||
_lastFocusItem: null,
|
||||
|
||||
templateString: template,
|
||||
|
||||
_setTitleAttr: function(/*String*/ title){
|
||||
this.containerNode.title = title;
|
||||
this._set("title", title)
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
this.inherited(arguments);
|
||||
this.connect(this.containerNode, "onkeypress", "_onKey");
|
||||
},
|
||||
|
||||
orient: function(/*DomNode*/ node, /*String*/ aroundCorner, /*String*/ corner){
|
||||
// summary:
|
||||
// Configure widget to be displayed in given position relative to the button.
|
||||
// This is called from the dijit.popup code, and should not be called
|
||||
// directly.
|
||||
// tags:
|
||||
// protected
|
||||
var newC = "dijitTooltipAB" + (corner.charAt(1) == 'L' ? "Left" : "Right")
|
||||
+ " dijitTooltip"
|
||||
+ (corner.charAt(0) == 'T' ? "Below" : "Above");
|
||||
|
||||
domClass.replace(this.domNode, newC, this._currentOrientClass || "");
|
||||
this._currentOrientClass = newC;
|
||||
},
|
||||
|
||||
focus: function(){
|
||||
// summary:
|
||||
// Focus on first field
|
||||
this._getFocusItems(this.containerNode);
|
||||
focus.focus(this._firstFocusItem);
|
||||
},
|
||||
|
||||
onOpen: function(/*Object*/ pos){
|
||||
// summary:
|
||||
// Called when dialog is displayed.
|
||||
// This is called from the dijit.popup code, and should not be called directly.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
this.orient(this.domNode,pos.aroundCorner, pos.corner);
|
||||
this._onShow(); // lazy load trigger
|
||||
},
|
||||
|
||||
onClose: function(){
|
||||
// summary:
|
||||
// Called when dialog is hidden.
|
||||
// This is called from the dijit.popup code, and should not be called directly.
|
||||
// tags:
|
||||
// protected
|
||||
this.onHide();
|
||||
},
|
||||
|
||||
_onKey: function(/*Event*/ evt){
|
||||
// summary:
|
||||
// Handler for keyboard events
|
||||
// description:
|
||||
// Keep keyboard focus in dialog; close dialog on escape key
|
||||
// tags:
|
||||
// private
|
||||
|
||||
var node = evt.target;
|
||||
if(evt.charOrCode === keys.TAB){
|
||||
this._getFocusItems(this.containerNode);
|
||||
}
|
||||
var singleFocusItem = (this._firstFocusItem == this._lastFocusItem);
|
||||
if(evt.charOrCode == keys.ESCAPE){
|
||||
// Use setTimeout to avoid crash on IE, see #10396.
|
||||
setTimeout(lang.hitch(this, "onCancel"), 0);
|
||||
event.stop(evt);
|
||||
}else if(node == this._firstFocusItem && evt.shiftKey && evt.charOrCode === keys.TAB){
|
||||
if(!singleFocusItem){
|
||||
focus.focus(this._lastFocusItem); // send focus to last item in dialog
|
||||
}
|
||||
event.stop(evt);
|
||||
}else if(node == this._lastFocusItem && evt.charOrCode === keys.TAB && !evt.shiftKey){
|
||||
if(!singleFocusItem){
|
||||
focus.focus(this._firstFocusItem); // send focus to first item in dialog
|
||||
}
|
||||
event.stop(evt);
|
||||
}else if(evt.charOrCode === keys.TAB){
|
||||
// we want the browser's default tab handling to move focus
|
||||
// but we don't want the tab to propagate upwards
|
||||
evt.stopPropagation();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,676 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/TreeNode.html":"<div class=\"dijitTreeNode\" role=\"presentation\"\n\t><div data-dojo-attach-point=\"rowNode\" class=\"dijitTreeRow\" role=\"presentation\" data-dojo-attach-event=\"onmouseenter:_onMouseEnter, onmouseleave:_onMouseLeave, onclick:_onClick, ondblclick:_onDblClick\"\n\t\t><img src=\"${_blankGif}\" alt=\"\" data-dojo-attach-point=\"expandoNode\" class=\"dijitTreeExpando\" role=\"presentation\"\n\t\t/><span data-dojo-attach-point=\"expandoNodeText\" class=\"dijitExpandoText\" role=\"presentation\"\n\t\t></span\n\t\t><span data-dojo-attach-point=\"contentNode\"\n\t\t\tclass=\"dijitTreeContent\" role=\"presentation\">\n\t\t\t<img src=\"${_blankGif}\" alt=\"\" data-dojo-attach-point=\"iconNode\" class=\"dijitIcon dijitTreeIcon\" role=\"presentation\"\n\t\t\t/><span data-dojo-attach-point=\"labelNode\" class=\"dijitTreeLabel\" role=\"treeitem\" tabindex=\"-1\" aria-selected=\"false\" data-dojo-attach-event=\"onfocus:_onLabelFocus\"></span>\n\t\t</span\n\t></div>\n\t<div data-dojo-attach-point=\"containerNode\" class=\"dijitTreeContainer\" role=\"presentation\" style=\"display: none;\"></div>\n</div>\n","url:dijit/templates/Tree.html":"<div class=\"dijitTree dijitTreeContainer\" role=\"tree\"\n\tdata-dojo-attach-event=\"onkeypress:_onKeyPress\">\n\t<div class=\"dijitInline dijitTreeIndent\" style=\"position: absolute; top: -9999px\" data-dojo-attach-point=\"indentDetector\"></div>\n</div>\n"}});
|
||||
define("dijit/Tree",["dojo/_base/array","dojo/_base/connect","dojo/cookie","dojo/_base/declare","dojo/_base/Deferred","dojo/DeferredList","dojo/dom","dojo/dom-class","dojo/dom-geometry","dojo/dom-style","dojo/_base/event","dojo/fx","dojo/_base/kernel","dojo/keys","dojo/_base/lang","dojo/topic","./focus","./registry","./_base/manager","./_Widget","./_TemplatedMixin","./_Container","./_Contained","./_CssStateMixin","dojo/text!./templates/TreeNode.html","dojo/text!./templates/Tree.html","./tree/TreeStoreModel","./tree/ForestStoreModel","./tree/_dndSelector"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_1a,_1b,_1c,_1d){
|
||||
var _1e=_4("dijit._TreeNode",[_14,_15,_16,_17,_18],{item:null,isTreeNode:true,label:"",_setLabelAttr:{node:"labelNode",type:"innerText"},isExpandable:null,isExpanded:false,state:"UNCHECKED",templateString:_19,baseClass:"dijitTreeNode",cssStateNodes:{rowNode:"dijitTreeRow",labelNode:"dijitTreeLabel"},_setTooltipAttr:{node:"rowNode",type:"attribute",attribute:"title"},buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
this._setExpando();
|
||||
this._updateItemClasses(this.item);
|
||||
if(this.isExpandable){
|
||||
this.labelNode.setAttribute("aria-expanded",this.isExpanded);
|
||||
}
|
||||
this.setSelected(false);
|
||||
},_setIndentAttr:function(_1f){
|
||||
var _20=(Math.max(_1f,0)*this.tree._nodePixelIndent)+"px";
|
||||
_a.set(this.domNode,"backgroundPosition",_20+" 0px");
|
||||
_a.set(this.rowNode,this.isLeftToRight()?"paddingLeft":"paddingRight",_20);
|
||||
_1.forEach(this.getChildren(),function(_21){
|
||||
_21.set("indent",_1f+1);
|
||||
});
|
||||
this._set("indent",_1f);
|
||||
},markProcessing:function(){
|
||||
this.state="LOADING";
|
||||
this._setExpando(true);
|
||||
},unmarkProcessing:function(){
|
||||
this._setExpando(false);
|
||||
},_updateItemClasses:function(_22){
|
||||
var _23=this.tree,_24=_23.model;
|
||||
if(_23._v10Compat&&_22===_24.root){
|
||||
_22=null;
|
||||
}
|
||||
this._applyClassAndStyle(_22,"icon","Icon");
|
||||
this._applyClassAndStyle(_22,"label","Label");
|
||||
this._applyClassAndStyle(_22,"row","Row");
|
||||
},_applyClassAndStyle:function(_25,_26,_27){
|
||||
var _28="_"+_26+"Class";
|
||||
var _29=_26+"Node";
|
||||
var _2a=this[_28];
|
||||
this[_28]=this.tree["get"+_27+"Class"](_25,this.isExpanded);
|
||||
_8.replace(this[_29],this[_28]||"",_2a||"");
|
||||
_a.set(this[_29],this.tree["get"+_27+"Style"](_25,this.isExpanded)||{});
|
||||
},_updateLayout:function(){
|
||||
var _2b=this.getParent();
|
||||
if(!_2b||!_2b.rowNode||_2b.rowNode.style.display=="none"){
|
||||
_8.add(this.domNode,"dijitTreeIsRoot");
|
||||
}else{
|
||||
_8.toggle(this.domNode,"dijitTreeIsLast",!this.getNextSibling());
|
||||
}
|
||||
},_setExpando:function(_2c){
|
||||
var _2d=["dijitTreeExpandoLoading","dijitTreeExpandoOpened","dijitTreeExpandoClosed","dijitTreeExpandoLeaf"],_2e=["*","-","+","*"],idx=_2c?0:(this.isExpandable?(this.isExpanded?1:2):3);
|
||||
_8.replace(this.expandoNode,_2d[idx],_2d);
|
||||
this.expandoNodeText.innerHTML=_2e[idx];
|
||||
},expand:function(){
|
||||
if(this._expandDeferred){
|
||||
return this._expandDeferred;
|
||||
}
|
||||
this._wipeOut&&this._wipeOut.stop();
|
||||
this.isExpanded=true;
|
||||
this.labelNode.setAttribute("aria-expanded","true");
|
||||
if(this.tree.showRoot||this!==this.tree.rootNode){
|
||||
this.containerNode.setAttribute("role","group");
|
||||
}
|
||||
_8.add(this.contentNode,"dijitTreeContentExpanded");
|
||||
this._setExpando();
|
||||
this._updateItemClasses(this.item);
|
||||
if(this==this.tree.rootNode){
|
||||
this.tree.domNode.setAttribute("aria-expanded","true");
|
||||
}
|
||||
var def,_2f=_c.wipeIn({node:this.containerNode,duration:_13.defaultDuration,onEnd:function(){
|
||||
def.callback(true);
|
||||
}});
|
||||
def=(this._expandDeferred=new _5(function(){
|
||||
_2f.stop();
|
||||
}));
|
||||
_2f.play();
|
||||
return def;
|
||||
},collapse:function(){
|
||||
if(!this.isExpanded){
|
||||
return;
|
||||
}
|
||||
if(this._expandDeferred){
|
||||
this._expandDeferred.cancel();
|
||||
delete this._expandDeferred;
|
||||
}
|
||||
this.isExpanded=false;
|
||||
this.labelNode.setAttribute("aria-expanded","false");
|
||||
if(this==this.tree.rootNode){
|
||||
this.tree.domNode.setAttribute("aria-expanded","false");
|
||||
}
|
||||
_8.remove(this.contentNode,"dijitTreeContentExpanded");
|
||||
this._setExpando();
|
||||
this._updateItemClasses(this.item);
|
||||
if(!this._wipeOut){
|
||||
this._wipeOut=_c.wipeOut({node:this.containerNode,duration:_13.defaultDuration});
|
||||
}
|
||||
this._wipeOut.play();
|
||||
},indent:0,setChildItems:function(_30){
|
||||
var _31=this.tree,_32=_31.model,_33=[];
|
||||
_1.forEach(this.getChildren(),function(_34){
|
||||
_16.prototype.removeChild.call(this,_34);
|
||||
},this);
|
||||
this.state="LOADED";
|
||||
if(_30&&_30.length>0){
|
||||
this.isExpandable=true;
|
||||
_1.forEach(_30,function(_35){
|
||||
var id=_32.getIdentity(_35),_36=_31._itemNodesMap[id],_37;
|
||||
if(_36){
|
||||
for(var i=0;i<_36.length;i++){
|
||||
if(_36[i]&&!_36[i].getParent()){
|
||||
_37=_36[i];
|
||||
_37.set("indent",this.indent+1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!_37){
|
||||
_37=this.tree._createTreeNode({item:_35,tree:_31,isExpandable:_32.mayHaveChildren(_35),label:_31.getLabel(_35),tooltip:_31.getTooltip(_35),dir:_31.dir,lang:_31.lang,textDir:_31.textDir,indent:this.indent+1});
|
||||
if(_36){
|
||||
_36.push(_37);
|
||||
}else{
|
||||
_31._itemNodesMap[id]=[_37];
|
||||
}
|
||||
}
|
||||
this.addChild(_37);
|
||||
if(this.tree.autoExpand||this.tree._state(_37)){
|
||||
_33.push(_31._expandNode(_37));
|
||||
}
|
||||
},this);
|
||||
_1.forEach(this.getChildren(),function(_38){
|
||||
_38._updateLayout();
|
||||
});
|
||||
}else{
|
||||
this.isExpandable=false;
|
||||
}
|
||||
if(this._setExpando){
|
||||
this._setExpando(false);
|
||||
}
|
||||
this._updateItemClasses(this.item);
|
||||
if(this==_31.rootNode){
|
||||
var fc=this.tree.showRoot?this:this.getChildren()[0];
|
||||
if(fc){
|
||||
fc.setFocusable(true);
|
||||
_31.lastFocused=fc;
|
||||
}else{
|
||||
_31.domNode.setAttribute("tabIndex","0");
|
||||
}
|
||||
}
|
||||
return new _6(_33);
|
||||
},getTreePath:function(){
|
||||
var _39=this;
|
||||
var _3a=[];
|
||||
while(_39&&_39!==this.tree.rootNode){
|
||||
_3a.unshift(_39.item);
|
||||
_39=_39.getParent();
|
||||
}
|
||||
_3a.unshift(this.tree.rootNode.item);
|
||||
return _3a;
|
||||
},getIdentity:function(){
|
||||
return this.tree.model.getIdentity(this.item);
|
||||
},removeChild:function(_3b){
|
||||
this.inherited(arguments);
|
||||
var _3c=this.getChildren();
|
||||
if(_3c.length==0){
|
||||
this.isExpandable=false;
|
||||
this.collapse();
|
||||
}
|
||||
_1.forEach(_3c,function(_3d){
|
||||
_3d._updateLayout();
|
||||
});
|
||||
},makeExpandable:function(){
|
||||
this.isExpandable=true;
|
||||
this._setExpando(false);
|
||||
},_onLabelFocus:function(){
|
||||
this.tree._onNodeFocus(this);
|
||||
},setSelected:function(_3e){
|
||||
this.labelNode.setAttribute("aria-selected",_3e);
|
||||
_8.toggle(this.rowNode,"dijitTreeRowSelected",_3e);
|
||||
},setFocusable:function(_3f){
|
||||
this.labelNode.setAttribute("tabIndex",_3f?"0":"-1");
|
||||
},_onClick:function(evt){
|
||||
this.tree._onClick(this,evt);
|
||||
},_onDblClick:function(evt){
|
||||
this.tree._onDblClick(this,evt);
|
||||
},_onMouseEnter:function(evt){
|
||||
this.tree._onNodeMouseEnter(this,evt);
|
||||
},_onMouseLeave:function(evt){
|
||||
this.tree._onNodeMouseLeave(this,evt);
|
||||
},_setTextDirAttr:function(_40){
|
||||
if(_40&&((this.textDir!=_40)||!this._created)){
|
||||
this._set("textDir",_40);
|
||||
this.applyTextDir(this.labelNode,this.labelNode.innerText||this.labelNode.textContent||"");
|
||||
_1.forEach(this.getChildren(),function(_41){
|
||||
_41.set("textDir",_40);
|
||||
},this);
|
||||
}
|
||||
}});
|
||||
var _42=_4("dijit.Tree",[_14,_15],{store:null,model:null,query:null,label:"",showRoot:true,childrenAttr:["children"],paths:[],path:[],selectedItems:null,selectedItem:null,openOnClick:false,openOnDblClick:false,templateString:_1a,persist:true,autoExpand:false,dndController:_1d,dndParams:["onDndDrop","itemCreator","onDndCancel","checkAcceptance","checkItemAcceptance","dragThreshold","betweenThreshold"],onDndDrop:null,itemCreator:null,onDndCancel:null,checkAcceptance:null,checkItemAcceptance:null,dragThreshold:5,betweenThreshold:0,_nodePixelIndent:19,_publish:function(_43,_44){
|
||||
_10.publish(this.id,_f.mixin({tree:this,event:_43},_44||{}));
|
||||
},postMixInProperties:function(){
|
||||
this.tree=this;
|
||||
if(this.autoExpand){
|
||||
this.persist=false;
|
||||
}
|
||||
this._itemNodesMap={};
|
||||
if(!this.cookieName&&this.id){
|
||||
this.cookieName=this.id+"SaveStateCookie";
|
||||
}
|
||||
this._loadDeferred=new _5();
|
||||
this.inherited(arguments);
|
||||
},postCreate:function(){
|
||||
this._initState();
|
||||
if(!this.model){
|
||||
this._store2model();
|
||||
}
|
||||
this.connect(this.model,"onChange","_onItemChange");
|
||||
this.connect(this.model,"onChildrenChange","_onItemChildrenChange");
|
||||
this.connect(this.model,"onDelete","_onItemDelete");
|
||||
this._load();
|
||||
this.inherited(arguments);
|
||||
if(this.dndController){
|
||||
if(_f.isString(this.dndController)){
|
||||
this.dndController=_f.getObject(this.dndController);
|
||||
}
|
||||
var _45={};
|
||||
for(var i=0;i<this.dndParams.length;i++){
|
||||
if(this[this.dndParams[i]]){
|
||||
_45[this.dndParams[i]]=this[this.dndParams[i]];
|
||||
}
|
||||
}
|
||||
this.dndController=new this.dndController(this,_45);
|
||||
}
|
||||
},_store2model:function(){
|
||||
this._v10Compat=true;
|
||||
_d.deprecated("Tree: from version 2.0, should specify a model object rather than a store/query");
|
||||
var _46={id:this.id+"_ForestStoreModel",store:this.store,query:this.query,childrenAttrs:this.childrenAttr};
|
||||
if(this.params.mayHaveChildren){
|
||||
_46.mayHaveChildren=_f.hitch(this,"mayHaveChildren");
|
||||
}
|
||||
if(this.params.getItemChildren){
|
||||
_46.getChildren=_f.hitch(this,function(_47,_48,_49){
|
||||
this.getItemChildren((this._v10Compat&&_47===this.model.root)?null:_47,_48,_49);
|
||||
});
|
||||
}
|
||||
this.model=new _1c(_46);
|
||||
this.showRoot=Boolean(this.label);
|
||||
},onLoad:function(){
|
||||
},_load:function(){
|
||||
this.model.getRoot(_f.hitch(this,function(_4a){
|
||||
var rn=(this.rootNode=this.tree._createTreeNode({item:_4a,tree:this,isExpandable:true,label:this.label||this.getLabel(_4a),textDir:this.textDir,indent:this.showRoot?0:-1}));
|
||||
if(!this.showRoot){
|
||||
rn.rowNode.style.display="none";
|
||||
this.domNode.setAttribute("role","presentation");
|
||||
rn.labelNode.setAttribute("role","presentation");
|
||||
rn.containerNode.setAttribute("role","tree");
|
||||
}
|
||||
this.domNode.appendChild(rn.domNode);
|
||||
var _4b=this.model.getIdentity(_4a);
|
||||
if(this._itemNodesMap[_4b]){
|
||||
this._itemNodesMap[_4b].push(rn);
|
||||
}else{
|
||||
this._itemNodesMap[_4b]=[rn];
|
||||
}
|
||||
rn._updateLayout();
|
||||
this._expandNode(rn).addCallback(_f.hitch(this,function(){
|
||||
this._loadDeferred.callback(true);
|
||||
this.onLoad();
|
||||
}));
|
||||
}),function(err){
|
||||
console.error(this,": error loading root: ",err);
|
||||
});
|
||||
},getNodesByItem:function(_4c){
|
||||
if(!_4c){
|
||||
return [];
|
||||
}
|
||||
var _4d=_f.isString(_4c)?_4c:this.model.getIdentity(_4c);
|
||||
return [].concat(this._itemNodesMap[_4d]);
|
||||
},_setSelectedItemAttr:function(_4e){
|
||||
this.set("selectedItems",[_4e]);
|
||||
},_setSelectedItemsAttr:function(_4f){
|
||||
var _50=this;
|
||||
this._loadDeferred.addCallback(_f.hitch(this,function(){
|
||||
var _51=_1.map(_4f,function(_52){
|
||||
return (!_52||_f.isString(_52))?_52:_50.model.getIdentity(_52);
|
||||
});
|
||||
var _53=[];
|
||||
_1.forEach(_51,function(id){
|
||||
_53=_53.concat(_50._itemNodesMap[id]||[]);
|
||||
});
|
||||
this.set("selectedNodes",_53);
|
||||
}));
|
||||
},_setPathAttr:function(_54){
|
||||
if(_54.length){
|
||||
return this.set("paths",[_54]);
|
||||
}else{
|
||||
return this.set("paths",[]);
|
||||
}
|
||||
},_setPathsAttr:function(_55){
|
||||
var _56=this;
|
||||
return new _6(_1.map(_55,function(_57){
|
||||
var d=new _5();
|
||||
_57=_1.map(_57,function(_58){
|
||||
return _f.isString(_58)?_58:_56.model.getIdentity(_58);
|
||||
});
|
||||
if(_57.length){
|
||||
_56._loadDeferred.addCallback(function(){
|
||||
_59(_57,[_56.rootNode],d);
|
||||
});
|
||||
}else{
|
||||
d.errback("Empty path");
|
||||
}
|
||||
return d;
|
||||
})).addCallback(_5a);
|
||||
function _59(_5b,_5c,def){
|
||||
var _5d=_5b.shift();
|
||||
var _5e=_1.filter(_5c,function(_5f){
|
||||
return _5f.getIdentity()==_5d;
|
||||
})[0];
|
||||
if(!!_5e){
|
||||
if(_5b.length){
|
||||
_56._expandNode(_5e).addCallback(function(){
|
||||
_59(_5b,_5e.getChildren(),def);
|
||||
});
|
||||
}else{
|
||||
def.callback(_5e);
|
||||
}
|
||||
}else{
|
||||
def.errback("Could not expand path at "+_5d);
|
||||
}
|
||||
};
|
||||
function _5a(_60){
|
||||
_56.set("selectedNodes",_1.map(_1.filter(_60,function(x){
|
||||
return x[0];
|
||||
}),function(x){
|
||||
return x[1];
|
||||
}));
|
||||
};
|
||||
},_setSelectedNodeAttr:function(_61){
|
||||
this.set("selectedNodes",[_61]);
|
||||
},_setSelectedNodesAttr:function(_62){
|
||||
this._loadDeferred.addCallback(_f.hitch(this,function(){
|
||||
this.dndController.setSelection(_62);
|
||||
}));
|
||||
},mayHaveChildren:function(){
|
||||
},getItemChildren:function(){
|
||||
},getLabel:function(_63){
|
||||
return this.model.getLabel(_63);
|
||||
},getIconClass:function(_64,_65){
|
||||
return (!_64||this.model.mayHaveChildren(_64))?(_65?"dijitFolderOpened":"dijitFolderClosed"):"dijitLeaf";
|
||||
},getLabelClass:function(){
|
||||
},getRowClass:function(){
|
||||
},getIconStyle:function(){
|
||||
},getLabelStyle:function(){
|
||||
},getRowStyle:function(){
|
||||
},getTooltip:function(){
|
||||
return "";
|
||||
},_onKeyPress:function(e){
|
||||
if(e.altKey){
|
||||
return;
|
||||
}
|
||||
var _66=_12.getEnclosingWidget(e.target);
|
||||
if(!_66){
|
||||
return;
|
||||
}
|
||||
var key=e.charOrCode;
|
||||
if(typeof key=="string"&&key!=" "){
|
||||
if(!e.altKey&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey){
|
||||
this._onLetterKeyNav({node:_66,key:key.toLowerCase()});
|
||||
_b.stop(e);
|
||||
}
|
||||
}else{
|
||||
if(this._curSearch){
|
||||
clearTimeout(this._curSearch.timer);
|
||||
delete this._curSearch;
|
||||
}
|
||||
var map=this._keyHandlerMap;
|
||||
if(!map){
|
||||
map={};
|
||||
map[_e.ENTER]="_onEnterKey";
|
||||
map[_e.SPACE]=map[" "]="_onEnterKey";
|
||||
map[this.isLeftToRight()?_e.LEFT_ARROW:_e.RIGHT_ARROW]="_onLeftArrow";
|
||||
map[this.isLeftToRight()?_e.RIGHT_ARROW:_e.LEFT_ARROW]="_onRightArrow";
|
||||
map[_e.UP_ARROW]="_onUpArrow";
|
||||
map[_e.DOWN_ARROW]="_onDownArrow";
|
||||
map[_e.HOME]="_onHomeKey";
|
||||
map[_e.END]="_onEndKey";
|
||||
this._keyHandlerMap=map;
|
||||
}
|
||||
if(this._keyHandlerMap[key]){
|
||||
this[this._keyHandlerMap[key]]({node:_66,item:_66.item,evt:e});
|
||||
_b.stop(e);
|
||||
}
|
||||
}
|
||||
},_onEnterKey:function(_67){
|
||||
this._publish("execute",{item:_67.item,node:_67.node});
|
||||
this.dndController.userSelect(_67.node,_2.isCopyKey(_67.evt),_67.evt.shiftKey);
|
||||
this.onClick(_67.item,_67.node,_67.evt);
|
||||
},_onDownArrow:function(_68){
|
||||
var _69=this._getNextNode(_68.node);
|
||||
if(_69&&_69.isTreeNode){
|
||||
this.focusNode(_69);
|
||||
}
|
||||
},_onUpArrow:function(_6a){
|
||||
var _6b=_6a.node;
|
||||
var _6c=_6b.getPreviousSibling();
|
||||
if(_6c){
|
||||
_6b=_6c;
|
||||
while(_6b.isExpandable&&_6b.isExpanded&&_6b.hasChildren()){
|
||||
var _6d=_6b.getChildren();
|
||||
_6b=_6d[_6d.length-1];
|
||||
}
|
||||
}else{
|
||||
var _6e=_6b.getParent();
|
||||
if(!(!this.showRoot&&_6e===this.rootNode)){
|
||||
_6b=_6e;
|
||||
}
|
||||
}
|
||||
if(_6b&&_6b.isTreeNode){
|
||||
this.focusNode(_6b);
|
||||
}
|
||||
},_onRightArrow:function(_6f){
|
||||
var _70=_6f.node;
|
||||
if(_70.isExpandable&&!_70.isExpanded){
|
||||
this._expandNode(_70);
|
||||
}else{
|
||||
if(_70.hasChildren()){
|
||||
_70=_70.getChildren()[0];
|
||||
if(_70&&_70.isTreeNode){
|
||||
this.focusNode(_70);
|
||||
}
|
||||
}
|
||||
}
|
||||
},_onLeftArrow:function(_71){
|
||||
var _72=_71.node;
|
||||
if(_72.isExpandable&&_72.isExpanded){
|
||||
this._collapseNode(_72);
|
||||
}else{
|
||||
var _73=_72.getParent();
|
||||
if(_73&&_73.isTreeNode&&!(!this.showRoot&&_73===this.rootNode)){
|
||||
this.focusNode(_73);
|
||||
}
|
||||
}
|
||||
},_onHomeKey:function(){
|
||||
var _74=this._getRootOrFirstNode();
|
||||
if(_74){
|
||||
this.focusNode(_74);
|
||||
}
|
||||
},_onEndKey:function(){
|
||||
var _75=this.rootNode;
|
||||
while(_75.isExpanded){
|
||||
var c=_75.getChildren();
|
||||
_75=c[c.length-1];
|
||||
}
|
||||
if(_75&&_75.isTreeNode){
|
||||
this.focusNode(_75);
|
||||
}
|
||||
},multiCharSearchDuration:250,_onLetterKeyNav:function(_76){
|
||||
var cs=this._curSearch;
|
||||
if(cs){
|
||||
cs.pattern=cs.pattern+_76.key;
|
||||
clearTimeout(cs.timer);
|
||||
}else{
|
||||
cs=this._curSearch={pattern:_76.key,startNode:_76.node};
|
||||
}
|
||||
var _77=this;
|
||||
cs.timer=setTimeout(function(){
|
||||
delete _77._curSearch;
|
||||
},this.multiCharSearchDuration);
|
||||
var _78=cs.startNode;
|
||||
do{
|
||||
_78=this._getNextNode(_78);
|
||||
if(!_78){
|
||||
_78=this._getRootOrFirstNode();
|
||||
}
|
||||
}while(_78!==cs.startNode&&(_78.label.toLowerCase().substr(0,cs.pattern.length)!=cs.pattern));
|
||||
if(_78&&_78.isTreeNode){
|
||||
if(_78!==cs.startNode){
|
||||
this.focusNode(_78);
|
||||
}
|
||||
}
|
||||
},isExpandoNode:function(_79,_7a){
|
||||
return _7.isDescendant(_79,_7a.expandoNode);
|
||||
},_onClick:function(_7b,e){
|
||||
var _7c=e.target,_7d=this.isExpandoNode(_7c,_7b);
|
||||
if((this.openOnClick&&_7b.isExpandable)||_7d){
|
||||
if(_7b.isExpandable){
|
||||
this._onExpandoClick({node:_7b});
|
||||
}
|
||||
}else{
|
||||
this._publish("execute",{item:_7b.item,node:_7b,evt:e});
|
||||
this.onClick(_7b.item,_7b,e);
|
||||
this.focusNode(_7b);
|
||||
}
|
||||
_b.stop(e);
|
||||
},_onDblClick:function(_7e,e){
|
||||
var _7f=e.target,_80=(_7f==_7e.expandoNode||_7f==_7e.expandoNodeText);
|
||||
if((this.openOnDblClick&&_7e.isExpandable)||_80){
|
||||
if(_7e.isExpandable){
|
||||
this._onExpandoClick({node:_7e});
|
||||
}
|
||||
}else{
|
||||
this._publish("execute",{item:_7e.item,node:_7e,evt:e});
|
||||
this.onDblClick(_7e.item,_7e,e);
|
||||
this.focusNode(_7e);
|
||||
}
|
||||
_b.stop(e);
|
||||
},_onExpandoClick:function(_81){
|
||||
var _82=_81.node;
|
||||
this.focusNode(_82);
|
||||
if(_82.isExpanded){
|
||||
this._collapseNode(_82);
|
||||
}else{
|
||||
this._expandNode(_82);
|
||||
}
|
||||
},onClick:function(){
|
||||
},onDblClick:function(){
|
||||
},onOpen:function(){
|
||||
},onClose:function(){
|
||||
},_getNextNode:function(_83){
|
||||
if(_83.isExpandable&&_83.isExpanded&&_83.hasChildren()){
|
||||
return _83.getChildren()[0];
|
||||
}else{
|
||||
while(_83&&_83.isTreeNode){
|
||||
var _84=_83.getNextSibling();
|
||||
if(_84){
|
||||
return _84;
|
||||
}
|
||||
_83=_83.getParent();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},_getRootOrFirstNode:function(){
|
||||
return this.showRoot?this.rootNode:this.rootNode.getChildren()[0];
|
||||
},_collapseNode:function(_85){
|
||||
if(_85._expandNodeDeferred){
|
||||
delete _85._expandNodeDeferred;
|
||||
}
|
||||
if(_85.isExpandable){
|
||||
if(_85.state=="LOADING"){
|
||||
return;
|
||||
}
|
||||
_85.collapse();
|
||||
this.onClose(_85.item,_85);
|
||||
this._state(_85,false);
|
||||
}
|
||||
},_expandNode:function(_86,_87){
|
||||
if(_86._expandNodeDeferred&&!_87){
|
||||
return _86._expandNodeDeferred;
|
||||
}
|
||||
var _88=this.model,_89=_86.item,_8a=this;
|
||||
switch(_86.state){
|
||||
case "UNCHECKED":
|
||||
_86.markProcessing();
|
||||
var def=(_86._expandNodeDeferred=new _5());
|
||||
_88.getChildren(_89,function(_8b){
|
||||
_86.unmarkProcessing();
|
||||
var _8c=_86.setChildItems(_8b);
|
||||
var ed=_8a._expandNode(_86,true);
|
||||
_8c.addCallback(function(){
|
||||
ed.addCallback(function(){
|
||||
def.callback();
|
||||
});
|
||||
});
|
||||
},function(err){
|
||||
console.error(_8a,": error loading root children: ",err);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
def=(_86._expandNodeDeferred=_86.expand());
|
||||
this.onOpen(_86.item,_86);
|
||||
this._state(_86,true);
|
||||
}
|
||||
return def;
|
||||
},focusNode:function(_8d){
|
||||
_11.focus(_8d.labelNode);
|
||||
},_onNodeFocus:function(_8e){
|
||||
if(_8e&&_8e!=this.lastFocused){
|
||||
if(this.lastFocused&&!this.lastFocused._destroyed){
|
||||
this.lastFocused.setFocusable(false);
|
||||
}
|
||||
_8e.setFocusable(true);
|
||||
this.lastFocused=_8e;
|
||||
}
|
||||
},_onNodeMouseEnter:function(){
|
||||
},_onNodeMouseLeave:function(){
|
||||
},_onItemChange:function(_8f){
|
||||
var _90=this.model,_91=_90.getIdentity(_8f),_92=this._itemNodesMap[_91];
|
||||
if(_92){
|
||||
var _93=this.getLabel(_8f),_94=this.getTooltip(_8f);
|
||||
_1.forEach(_92,function(_95){
|
||||
_95.set({item:_8f,label:_93,tooltip:_94});
|
||||
_95._updateItemClasses(_8f);
|
||||
});
|
||||
}
|
||||
},_onItemChildrenChange:function(_96,_97){
|
||||
var _98=this.model,_99=_98.getIdentity(_96),_9a=this._itemNodesMap[_99];
|
||||
if(_9a){
|
||||
_1.forEach(_9a,function(_9b){
|
||||
_9b.setChildItems(_97);
|
||||
});
|
||||
}
|
||||
},_onItemDelete:function(_9c){
|
||||
var _9d=this.model,_9e=_9d.getIdentity(_9c),_9f=this._itemNodesMap[_9e];
|
||||
if(_9f){
|
||||
_1.forEach(_9f,function(_a0){
|
||||
this.dndController.removeTreeNode(_a0);
|
||||
var _a1=_a0.getParent();
|
||||
if(_a1){
|
||||
_a1.removeChild(_a0);
|
||||
}
|
||||
_a0.destroyRecursive();
|
||||
},this);
|
||||
delete this._itemNodesMap[_9e];
|
||||
}
|
||||
},_initState:function(){
|
||||
this._openedNodes={};
|
||||
if(this.persist&&this.cookieName){
|
||||
var _a2=_3(this.cookieName);
|
||||
if(_a2){
|
||||
_1.forEach(_a2.split(","),function(_a3){
|
||||
this._openedNodes[_a3]=true;
|
||||
},this);
|
||||
}
|
||||
}
|
||||
},_state:function(_a4,_a5){
|
||||
if(!this.persist){
|
||||
return false;
|
||||
}
|
||||
var _a6=_1.map(_a4.getTreePath(),function(_a7){
|
||||
return this.model.getIdentity(_a7);
|
||||
},this).join("/");
|
||||
if(arguments.length===1){
|
||||
return this._openedNodes[_a6];
|
||||
}else{
|
||||
if(_a5){
|
||||
this._openedNodes[_a6]=true;
|
||||
}else{
|
||||
delete this._openedNodes[_a6];
|
||||
}
|
||||
var ary=[];
|
||||
for(var id in this._openedNodes){
|
||||
ary.push(id);
|
||||
}
|
||||
_3(this.cookieName,ary.join(","),{expires:365});
|
||||
}
|
||||
},destroy:function(){
|
||||
if(this._curSearch){
|
||||
clearTimeout(this._curSearch.timer);
|
||||
delete this._curSearch;
|
||||
}
|
||||
if(this.rootNode){
|
||||
this.rootNode.destroyRecursive();
|
||||
}
|
||||
if(this.dndController&&!_f.isString(this.dndController)){
|
||||
this.dndController.destroy();
|
||||
}
|
||||
this.rootNode=null;
|
||||
this.inherited(arguments);
|
||||
},destroyRecursive:function(){
|
||||
this.destroy();
|
||||
},resize:function(_a8){
|
||||
if(_a8){
|
||||
_9.setMarginBox(this.domNode,_a8);
|
||||
}
|
||||
this._nodePixelIndent=_9.position(this.tree.indentDetector).w;
|
||||
if(this.tree.rootNode){
|
||||
this.tree.rootNode.set("indent",this.showRoot?0:-1);
|
||||
}
|
||||
},_createTreeNode:function(_a9){
|
||||
return new _1e(_a9);
|
||||
},_setTextDirAttr:function(_aa){
|
||||
if(_aa&&this.textDir!=_aa){
|
||||
this._set("textDir",_aa);
|
||||
this.rootNode.set("textDir",_aa);
|
||||
}
|
||||
}});
|
||||
_42._TreeNode=_1e;
|
||||
return _42;
|
||||
});
|
File diff suppressed because it is too large
Load Diff
|
@ -1,76 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/WidgetSet",["dojo/_base/array","dojo/_base/declare","dojo/_base/window","./registry"],function(_1,_2,_3,_4){
|
||||
var _5=_2("dijit.WidgetSet",null,{constructor:function(){
|
||||
this._hash={};
|
||||
this.length=0;
|
||||
},add:function(_6){
|
||||
if(this._hash[_6.id]){
|
||||
throw new Error("Tried to register widget with id=="+_6.id+" but that id is already registered");
|
||||
}
|
||||
this._hash[_6.id]=_6;
|
||||
this.length++;
|
||||
},remove:function(id){
|
||||
if(this._hash[id]){
|
||||
delete this._hash[id];
|
||||
this.length--;
|
||||
}
|
||||
},forEach:function(_7,_8){
|
||||
_8=_8||_3.global;
|
||||
var i=0,id;
|
||||
for(id in this._hash){
|
||||
_7.call(_8,this._hash[id],i++,this._hash);
|
||||
}
|
||||
return this;
|
||||
},filter:function(_9,_a){
|
||||
_a=_a||_3.global;
|
||||
var _b=new _5(),i=0,id;
|
||||
for(id in this._hash){
|
||||
var w=this._hash[id];
|
||||
if(_9.call(_a,w,i++,this._hash)){
|
||||
_b.add(w);
|
||||
}
|
||||
}
|
||||
return _b;
|
||||
},byId:function(id){
|
||||
return this._hash[id];
|
||||
},byClass:function(_c){
|
||||
var _d=new _5(),id,_e;
|
||||
for(id in this._hash){
|
||||
_e=this._hash[id];
|
||||
if(_e.declaredClass==_c){
|
||||
_d.add(_e);
|
||||
}
|
||||
}
|
||||
return _d;
|
||||
},toArray:function(){
|
||||
var ar=[];
|
||||
for(var id in this._hash){
|
||||
ar.push(this._hash[id]);
|
||||
}
|
||||
return ar;
|
||||
},map:function(_f,_10){
|
||||
return _1.map(this.toArray(),_f,_10);
|
||||
},every:function(_11,_12){
|
||||
_12=_12||_3.global;
|
||||
var x=0,i;
|
||||
for(i in this._hash){
|
||||
if(!_11.call(_12,this._hash[i],x++,this._hash)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},some:function(_13,_14){
|
||||
_14=_14||_3.global;
|
||||
var x=0,i;
|
||||
for(i in this._hash){
|
||||
if(_13.call(_14,this._hash[i],x++,this._hash)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}});
|
||||
_1.forEach(["forEach","filter","byClass","map","every","some"],function(_15){
|
||||
_4[_15]=_5.prototype[_15];
|
||||
});
|
||||
return _5;
|
||||
});
|
|
@ -1,230 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/WidgetSet", [
|
||||
"dojo/_base/array", // array.forEach array.map
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/window", // win.global
|
||||
"./registry" // to add functions to dijit.registry
|
||||
], function(array, declare, win, registry){
|
||||
|
||||
// module:
|
||||
// dijit/WidgetSet
|
||||
// summary:
|
||||
// Legacy registry code. New modules should just use registry.
|
||||
// Will be removed in 2.0.
|
||||
|
||||
var WidgetSet = declare("dijit.WidgetSet", null, {
|
||||
// summary:
|
||||
// A set of widgets indexed by id. A default instance of this class is
|
||||
// available as `dijit.registry`
|
||||
//
|
||||
// example:
|
||||
// Create a small list of widgets:
|
||||
// | var ws = new dijit.WidgetSet();
|
||||
// | ws.add(dijit.byId("one"));
|
||||
// | ws.add(dijit.byId("two"));
|
||||
// | // destroy both:
|
||||
// | ws.forEach(function(w){ w.destroy(); });
|
||||
//
|
||||
// example:
|
||||
// Using dijit.registry:
|
||||
// | dijit.registry.forEach(function(w){ /* do something */ });
|
||||
|
||||
constructor: function(){
|
||||
this._hash = {};
|
||||
this.length = 0;
|
||||
},
|
||||
|
||||
add: function(/*dijit._Widget*/ widget){
|
||||
// summary:
|
||||
// Add a widget to this list. If a duplicate ID is detected, a error is thrown.
|
||||
//
|
||||
// widget: dijit._Widget
|
||||
// Any dijit._Widget subclass.
|
||||
if(this._hash[widget.id]){
|
||||
throw new Error("Tried to register widget with id==" + widget.id + " but that id is already registered");
|
||||
}
|
||||
this._hash[widget.id] = widget;
|
||||
this.length++;
|
||||
},
|
||||
|
||||
remove: function(/*String*/ id){
|
||||
// summary:
|
||||
// Remove a widget from this WidgetSet. Does not destroy the widget; simply
|
||||
// removes the reference.
|
||||
if(this._hash[id]){
|
||||
delete this._hash[id];
|
||||
this.length--;
|
||||
}
|
||||
},
|
||||
|
||||
forEach: function(/*Function*/ func, /* Object? */thisObj){
|
||||
// summary:
|
||||
// Call specified function for each widget in this set.
|
||||
//
|
||||
// func:
|
||||
// A callback function to run for each item. Is passed the widget, the index
|
||||
// in the iteration, and the full hash, similar to `array.forEach`.
|
||||
//
|
||||
// thisObj:
|
||||
// An optional scope parameter
|
||||
//
|
||||
// example:
|
||||
// Using the default `dijit.registry` instance:
|
||||
// | dijit.registry.forEach(function(widget){
|
||||
// | console.log(widget.declaredClass);
|
||||
// | });
|
||||
//
|
||||
// returns:
|
||||
// Returns self, in order to allow for further chaining.
|
||||
|
||||
thisObj = thisObj || win.global;
|
||||
var i = 0, id;
|
||||
for(id in this._hash){
|
||||
func.call(thisObj, this._hash[id], i++, this._hash);
|
||||
}
|
||||
return this; // dijit.WidgetSet
|
||||
},
|
||||
|
||||
filter: function(/*Function*/ filter, /* Object? */thisObj){
|
||||
// summary:
|
||||
// Filter down this WidgetSet to a smaller new WidgetSet
|
||||
// Works the same as `array.filter` and `NodeList.filter`
|
||||
//
|
||||
// filter:
|
||||
// Callback function to test truthiness. Is passed the widget
|
||||
// reference and the pseudo-index in the object.
|
||||
//
|
||||
// thisObj: Object?
|
||||
// Option scope to use for the filter function.
|
||||
//
|
||||
// example:
|
||||
// Arbitrary: select the odd widgets in this list
|
||||
// | dijit.registry.filter(function(w, i){
|
||||
// | return i % 2 == 0;
|
||||
// | }).forEach(function(w){ /* odd ones */ });
|
||||
|
||||
thisObj = thisObj || win.global;
|
||||
var res = new WidgetSet(), i = 0, id;
|
||||
for(id in this._hash){
|
||||
var w = this._hash[id];
|
||||
if(filter.call(thisObj, w, i++, this._hash)){
|
||||
res.add(w);
|
||||
}
|
||||
}
|
||||
return res; // dijit.WidgetSet
|
||||
},
|
||||
|
||||
byId: function(/*String*/ id){
|
||||
// summary:
|
||||
// Find a widget in this list by it's id.
|
||||
// example:
|
||||
// Test if an id is in a particular WidgetSet
|
||||
// | var ws = new dijit.WidgetSet();
|
||||
// | ws.add(dijit.byId("bar"));
|
||||
// | var t = ws.byId("bar") // returns a widget
|
||||
// | var x = ws.byId("foo"); // returns undefined
|
||||
|
||||
return this._hash[id]; // dijit._Widget
|
||||
},
|
||||
|
||||
byClass: function(/*String*/ cls){
|
||||
// summary:
|
||||
// Reduce this widgetset to a new WidgetSet of a particular `declaredClass`
|
||||
//
|
||||
// cls: String
|
||||
// The Class to scan for. Full dot-notated string.
|
||||
//
|
||||
// example:
|
||||
// Find all `dijit.TitlePane`s in a page:
|
||||
// | dijit.registry.byClass("dijit.TitlePane").forEach(function(tp){ tp.close(); });
|
||||
|
||||
var res = new WidgetSet(), id, widget;
|
||||
for(id in this._hash){
|
||||
widget = this._hash[id];
|
||||
if(widget.declaredClass == cls){
|
||||
res.add(widget);
|
||||
}
|
||||
}
|
||||
return res; // dijit.WidgetSet
|
||||
},
|
||||
|
||||
toArray: function(){
|
||||
// summary:
|
||||
// Convert this WidgetSet into a true Array
|
||||
//
|
||||
// example:
|
||||
// Work with the widget .domNodes in a real Array
|
||||
// | array.map(dijit.registry.toArray(), function(w){ return w.domNode; });
|
||||
|
||||
var ar = [];
|
||||
for(var id in this._hash){
|
||||
ar.push(this._hash[id]);
|
||||
}
|
||||
return ar; // dijit._Widget[]
|
||||
},
|
||||
|
||||
map: function(/* Function */func, /* Object? */thisObj){
|
||||
// summary:
|
||||
// Create a new Array from this WidgetSet, following the same rules as `array.map`
|
||||
// example:
|
||||
// | var nodes = dijit.registry.map(function(w){ return w.domNode; });
|
||||
//
|
||||
// returns:
|
||||
// A new array of the returned values.
|
||||
return array.map(this.toArray(), func, thisObj); // Array
|
||||
},
|
||||
|
||||
every: function(func, thisObj){
|
||||
// summary:
|
||||
// A synthetic clone of `array.every` acting explicitly on this WidgetSet
|
||||
//
|
||||
// func: Function
|
||||
// A callback function run for every widget in this list. Exits loop
|
||||
// when the first false return is encountered.
|
||||
//
|
||||
// thisObj: Object?
|
||||
// Optional scope parameter to use for the callback
|
||||
|
||||
thisObj = thisObj || win.global;
|
||||
var x = 0, i;
|
||||
for(i in this._hash){
|
||||
if(!func.call(thisObj, this._hash[i], x++, this._hash)){
|
||||
return false; // Boolean
|
||||
}
|
||||
}
|
||||
return true; // Boolean
|
||||
},
|
||||
|
||||
some: function(func, thisObj){
|
||||
// summary:
|
||||
// A synthetic clone of `array.some` acting explicitly on this WidgetSet
|
||||
//
|
||||
// func: Function
|
||||
// A callback function run for every widget in this list. Exits loop
|
||||
// when the first true return is encountered.
|
||||
//
|
||||
// thisObj: Object?
|
||||
// Optional scope parameter to use for the callback
|
||||
|
||||
thisObj = thisObj || win.global;
|
||||
var x = 0, i;
|
||||
for(i in this._hash){
|
||||
if(func.call(thisObj, this._hash[i], x++, this._hash)){
|
||||
return true; // Boolean
|
||||
}
|
||||
}
|
||||
return false; // Boolean
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Add in 1.x compatibility methods to dijit.registry.
|
||||
// These functions won't show up in the API doc but since they are deprecated anyway,
|
||||
// that's probably for the best.
|
||||
array.forEach(["forEach", "filter", "byClass", "map", "every", "some"], function(func){
|
||||
registry[func] = WidgetSet.prototype[func];
|
||||
});
|
||||
|
||||
|
||||
return WidgetSet;
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_BidiSupport",["./_WidgetBase"],function(_1){
|
||||
_1.extend({getTextDir:function(_2){
|
||||
return this.textDir=="auto"?this._checkContextual(_2):this.textDir;
|
||||
},_checkContextual:function(_3){
|
||||
var _4=/[A-Za-z\u05d0-\u065f\u066a-\u06ef\u06fa-\u07ff\ufb1d-\ufdff\ufe70-\ufefc]/.exec(_3);
|
||||
return _4?(_4[0]<="z"?"ltr":"rtl"):this.dir?this.dir:this.isLeftToRight()?"ltr":"rtl";
|
||||
},applyTextDir:function(_5,_6){
|
||||
var _7=this.textDir=="auto"?this._checkContextual(_6):this.textDir;
|
||||
if(_5.dir!=_7){
|
||||
_5.dir=_7;
|
||||
}
|
||||
}});
|
||||
return _1;
|
||||
});
|
|
@ -1,70 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_BidiSupport", ["./_WidgetBase"], function(_WidgetBase){
|
||||
|
||||
/*=====
|
||||
var _WidgetBase = dijit._WidgetBase;
|
||||
====*/
|
||||
|
||||
// module:
|
||||
// dijit/_BidiSupport
|
||||
// summary:
|
||||
// Module that deals with BIDI, special with the auto
|
||||
// direction if needed without changing the GUI direction.
|
||||
// Including this module will extend _WidgetBase with BIDI related methods.
|
||||
// description:
|
||||
// There's a special need for displaying BIDI text in rtl direction
|
||||
// in ltr GUI, sometimes needed auto support.
|
||||
// In creation of widget, if it's want to activate this class,
|
||||
// the widget should define the "textDir".
|
||||
|
||||
_WidgetBase.extend({
|
||||
|
||||
getTextDir: function(/*String*/ text){
|
||||
// summary:
|
||||
// Gets the right direction of text.
|
||||
// description:
|
||||
// If textDir is ltr or rtl returns the value.
|
||||
// If it's auto, calls to another function that responsible
|
||||
// for checking the value, and defining the direction.
|
||||
// tags:
|
||||
// protected.
|
||||
return this.textDir == "auto" ? this._checkContextual(text) : this.textDir;
|
||||
},
|
||||
|
||||
_checkContextual: function(text){
|
||||
// summary:
|
||||
// Finds the first strong (directional) character, return ltr if isLatin
|
||||
// or rtl if isBidiChar.
|
||||
// tags:
|
||||
// private.
|
||||
|
||||
// look for strong (directional) characters
|
||||
var fdc = /[A-Za-z\u05d0-\u065f\u066a-\u06ef\u06fa-\u07ff\ufb1d-\ufdff\ufe70-\ufefc]/.exec(text);
|
||||
// if found return the direction that defined by the character, else return widgets dir as defult.
|
||||
return fdc ? ( fdc[0] <= 'z' ? "ltr" : "rtl" ) : this.dir ? this.dir : this.isLeftToRight() ? "ltr" : "rtl";
|
||||
},
|
||||
|
||||
applyTextDir: function(/*Object*/ element, /*String*/ text){
|
||||
// summary:
|
||||
// Set element.dir according to this.textDir
|
||||
// element:
|
||||
// The text element to be set. Should have dir property.
|
||||
// text:
|
||||
// Used in case this.textDir is "auto", for calculating the right transformation
|
||||
// description:
|
||||
// If textDir is ltr or rtl returns the value.
|
||||
// If it's auto, calls to another function that responsible
|
||||
// for checking the value, and defining the direction.
|
||||
// tags:
|
||||
// protected.
|
||||
|
||||
var textDir = this.textDir == "auto" ? this._checkContextual(text) : this.textDir;
|
||||
// update only when there's a difference
|
||||
if(element.dir != textDir){
|
||||
element.dir = textDir;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return _WidgetBase;
|
||||
});
|
|
@ -1,5 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_Calendar",["dojo/_base/kernel","./Calendar","."],function(_1,_2,_3){
|
||||
_1.deprecated("dijit._Calendar is deprecated","dijit._Calendar moved to dijit.Calendar",2);
|
||||
_3._Calendar=_2;
|
||||
});
|
|
@ -1,18 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_Calendar", [
|
||||
"dojo/_base/kernel", // kernel.deprecated
|
||||
"./Calendar",
|
||||
"." // for exporting dijit.Calendar
|
||||
], function(kernel, Calendar, dijit){
|
||||
|
||||
// module:
|
||||
// dijit/_Calendar
|
||||
// summary:
|
||||
// Deprecated widget, used dijit/Calendar instead. Will be removed in 2.0.
|
||||
|
||||
kernel.deprecated("dijit._Calendar is deprecated", "dijit._Calendar moved to dijit.Calendar", 2.0);
|
||||
|
||||
// dijit._Calendar had an underscore all this time merely because it did
|
||||
// not satisfy dijit's a11y policy.
|
||||
dijit._Calendar = Calendar;
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_Contained",["dojo/_base/declare","./registry"],function(_1,_2){
|
||||
return _1("dijit._Contained",null,{_getSibling:function(_3){
|
||||
var _4=this.domNode;
|
||||
do{
|
||||
_4=_4[_3+"Sibling"];
|
||||
}while(_4&&_4.nodeType!=1);
|
||||
return _4&&_2.byNode(_4);
|
||||
},getPreviousSibling:function(){
|
||||
return this._getSibling("previous");
|
||||
},getNextSibling:function(){
|
||||
return this._getSibling("next");
|
||||
},getIndexInParent:function(){
|
||||
var p=this.getParent();
|
||||
if(!p||!p.getIndexOfChild){
|
||||
return -1;
|
||||
}
|
||||
return p.getIndexOfChild(this);
|
||||
}});
|
||||
});
|
|
@ -1,63 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_Contained", [
|
||||
"dojo/_base/declare", // declare
|
||||
"./registry" // registry.getEnclosingWidget(), registry.byNode()
|
||||
], function(declare, registry){
|
||||
|
||||
// module:
|
||||
// dijit/_Contained
|
||||
// summary:
|
||||
// Mixin for widgets that are children of a container widget
|
||||
|
||||
return declare("dijit._Contained", null, {
|
||||
// summary:
|
||||
// Mixin for widgets that are children of a container widget
|
||||
//
|
||||
// example:
|
||||
// | // make a basic custom widget that knows about it's parents
|
||||
// | declare("my.customClass",[dijit._Widget,dijit._Contained],{});
|
||||
|
||||
_getSibling: function(/*String*/ which){
|
||||
// summary:
|
||||
// Returns next or previous sibling
|
||||
// which:
|
||||
// Either "next" or "previous"
|
||||
// tags:
|
||||
// private
|
||||
var node = this.domNode;
|
||||
do{
|
||||
node = node[which+"Sibling"];
|
||||
}while(node && node.nodeType != 1);
|
||||
return node && registry.byNode(node); // dijit._Widget
|
||||
},
|
||||
|
||||
getPreviousSibling: function(){
|
||||
// summary:
|
||||
// Returns null if this is the first child of the parent,
|
||||
// otherwise returns the next element sibling to the "left".
|
||||
|
||||
return this._getSibling("previous"); // dijit._Widget
|
||||
},
|
||||
|
||||
getNextSibling: function(){
|
||||
// summary:
|
||||
// Returns null if this is the last child of the parent,
|
||||
// otherwise returns the next element sibling to the "right".
|
||||
|
||||
return this._getSibling("next"); // dijit._Widget
|
||||
},
|
||||
|
||||
getIndexInParent: function(){
|
||||
// summary:
|
||||
// Returns the index of this widget within its container parent.
|
||||
// It returns -1 if the parent does not exist, or if the parent
|
||||
// is not a dijit._Container
|
||||
|
||||
var p = this.getParent();
|
||||
if(!p || !p.getIndexOfChild){
|
||||
return -1; // int
|
||||
}
|
||||
return p.getIndexOfChild(this); // int
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,42 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_Container",["dojo/_base/array","dojo/_base/declare","dojo/dom-construct","./registry"],function(_1,_2,_3,_4){
|
||||
return _2("dijit._Container",null,{buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
if(!this.containerNode){
|
||||
this.containerNode=this.domNode;
|
||||
}
|
||||
},addChild:function(_5,_6){
|
||||
var _7=this.containerNode;
|
||||
if(_6&&typeof _6=="number"){
|
||||
var _8=this.getChildren();
|
||||
if(_8&&_8.length>=_6){
|
||||
_7=_8[_6-1].domNode;
|
||||
_6="after";
|
||||
}
|
||||
}
|
||||
_3.place(_5.domNode,_7,_6);
|
||||
if(this._started&&!_5._started){
|
||||
_5.startup();
|
||||
}
|
||||
},removeChild:function(_9){
|
||||
if(typeof _9=="number"){
|
||||
_9=this.getChildren()[_9];
|
||||
}
|
||||
if(_9){
|
||||
var _a=_9.domNode;
|
||||
if(_a&&_a.parentNode){
|
||||
_a.parentNode.removeChild(_a);
|
||||
}
|
||||
}
|
||||
},hasChildren:function(){
|
||||
return this.getChildren().length>0;
|
||||
},_getSiblingOfChild:function(_b,_c){
|
||||
var _d=_b.domNode,_e=(_c>0?"nextSibling":"previousSibling");
|
||||
do{
|
||||
_d=_d[_e];
|
||||
}while(_d&&(_d.nodeType!=1||!_4.byNode(_d)));
|
||||
return _d&&_4.byNode(_d);
|
||||
},getIndexOfChild:function(_f){
|
||||
return _1.indexOf(this.getChildren(),_f);
|
||||
}});
|
||||
});
|
|
@ -1,108 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_Container", [
|
||||
"dojo/_base/array", // array.forEach array.indexOf
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-construct", // domConstruct.place
|
||||
"./registry" // registry.byNode()
|
||||
], function(array, declare, domConstruct, registry){
|
||||
|
||||
// module:
|
||||
// dijit/_Container
|
||||
// summary:
|
||||
// Mixin for widgets that contain a set of widget children.
|
||||
|
||||
return declare("dijit._Container", null, {
|
||||
// summary:
|
||||
// Mixin for widgets that contain a set of widget children.
|
||||
// description:
|
||||
// Use this mixin for widgets that needs to know about and
|
||||
// keep track of their widget children. Suitable for widgets like BorderContainer
|
||||
// and TabContainer which contain (only) a set of child widgets.
|
||||
//
|
||||
// It's not suitable for widgets like ContentPane
|
||||
// which contains mixed HTML (plain DOM nodes in addition to widgets),
|
||||
// and where contained widgets are not necessarily directly below
|
||||
// this.containerNode. In that case calls like addChild(node, position)
|
||||
// wouldn't make sense.
|
||||
|
||||
buildRendering: function(){
|
||||
this.inherited(arguments);
|
||||
if(!this.containerNode){
|
||||
// all widgets with descendants must set containerNode
|
||||
this.containerNode = this.domNode;
|
||||
}
|
||||
},
|
||||
|
||||
addChild: function(/*dijit._Widget*/ widget, /*int?*/ insertIndex){
|
||||
// summary:
|
||||
// Makes the given widget a child of this widget.
|
||||
// description:
|
||||
// Inserts specified child widget's dom node as a child of this widget's
|
||||
// container node, and possibly does other processing (such as layout).
|
||||
|
||||
var refNode = this.containerNode;
|
||||
if(insertIndex && typeof insertIndex == "number"){
|
||||
var children = this.getChildren();
|
||||
if(children && children.length >= insertIndex){
|
||||
refNode = children[insertIndex-1].domNode;
|
||||
insertIndex = "after";
|
||||
}
|
||||
}
|
||||
domConstruct.place(widget.domNode, refNode, insertIndex);
|
||||
|
||||
// If I've been started but the child widget hasn't been started,
|
||||
// start it now. Make sure to do this after widget has been
|
||||
// inserted into the DOM tree, so it can see that it's being controlled by me,
|
||||
// so it doesn't try to size itself.
|
||||
if(this._started && !widget._started){
|
||||
widget.startup();
|
||||
}
|
||||
},
|
||||
|
||||
removeChild: function(/*Widget|int*/ widget){
|
||||
// summary:
|
||||
// Removes the passed widget instance from this widget but does
|
||||
// not destroy it. You can also pass in an integer indicating
|
||||
// the index within the container to remove
|
||||
|
||||
if(typeof widget == "number"){
|
||||
widget = this.getChildren()[widget];
|
||||
}
|
||||
|
||||
if(widget){
|
||||
var node = widget.domNode;
|
||||
if(node && node.parentNode){
|
||||
node.parentNode.removeChild(node); // detach but don't destroy
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hasChildren: function(){
|
||||
// summary:
|
||||
// Returns true if widget has children, i.e. if this.containerNode contains something.
|
||||
return this.getChildren().length > 0; // Boolean
|
||||
},
|
||||
|
||||
_getSiblingOfChild: function(/*dijit._Widget*/ child, /*int*/ dir){
|
||||
// summary:
|
||||
// Get the next or previous widget sibling of child
|
||||
// dir:
|
||||
// if 1, get the next sibling
|
||||
// if -1, get the previous sibling
|
||||
// tags:
|
||||
// private
|
||||
var node = child.domNode,
|
||||
which = (dir>0 ? "nextSibling" : "previousSibling");
|
||||
do{
|
||||
node = node[which];
|
||||
}while(node && (node.nodeType != 1 || !registry.byNode(node)));
|
||||
return node && registry.byNode(node); // dijit._Widget
|
||||
},
|
||||
|
||||
getIndexOfChild: function(/*dijit._Widget*/ child){
|
||||
// summary:
|
||||
// Gets the index of the child in this container or -1 if not found
|
||||
return array.indexOf(this.getChildren(), child); // int
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,133 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_CssStateMixin",["dojo/touch","dojo/_base/array","dojo/_base/declare","dojo/dom-class","dojo/_base/lang","dojo/_base/window"],function(_1,_2,_3,_4,_5,_6){
|
||||
return _3("dijit._CssStateMixin",[],{cssStateNodes:{},hovering:false,active:false,_applyAttributes:function(){
|
||||
this.inherited(arguments);
|
||||
_2.forEach(["onmouseenter","onmouseleave",_1.press],function(e){
|
||||
this.connect(this.domNode,e,"_cssMouseEvent");
|
||||
},this);
|
||||
_2.forEach(["disabled","readOnly","checked","selected","focused","state","hovering","active"],function(_7){
|
||||
this.watch(_7,_5.hitch(this,"_setStateClass"));
|
||||
},this);
|
||||
for(var ap in this.cssStateNodes){
|
||||
this._trackMouseState(this[ap],this.cssStateNodes[ap]);
|
||||
}
|
||||
this._setStateClass();
|
||||
},_cssMouseEvent:function(_8){
|
||||
if(!this.disabled){
|
||||
switch(_8.type){
|
||||
case "mouseenter":
|
||||
case "mouseover":
|
||||
this._set("hovering",true);
|
||||
this._set("active",this._mouseDown);
|
||||
break;
|
||||
case "mouseleave":
|
||||
case "mouseout":
|
||||
this._set("hovering",false);
|
||||
this._set("active",false);
|
||||
break;
|
||||
case "mousedown":
|
||||
case "touchpress":
|
||||
this._set("active",true);
|
||||
this._mouseDown=true;
|
||||
var _9=this.connect(_6.body(),_1.release,function(){
|
||||
this._mouseDown=false;
|
||||
this._set("active",false);
|
||||
this.disconnect(_9);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
},_setStateClass:function(){
|
||||
var _a=this.baseClass.split(" ");
|
||||
function _b(_c){
|
||||
_a=_a.concat(_2.map(_a,function(c){
|
||||
return c+_c;
|
||||
}),"dijit"+_c);
|
||||
};
|
||||
if(!this.isLeftToRight()){
|
||||
_b("Rtl");
|
||||
}
|
||||
var _d=this.checked=="mixed"?"Mixed":(this.checked?"Checked":"");
|
||||
if(this.checked){
|
||||
_b(_d);
|
||||
}
|
||||
if(this.state){
|
||||
_b(this.state);
|
||||
}
|
||||
if(this.selected){
|
||||
_b("Selected");
|
||||
}
|
||||
if(this.disabled){
|
||||
_b("Disabled");
|
||||
}else{
|
||||
if(this.readOnly){
|
||||
_b("ReadOnly");
|
||||
}else{
|
||||
if(this.active){
|
||||
_b("Active");
|
||||
}else{
|
||||
if(this.hovering){
|
||||
_b("Hover");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.focused){
|
||||
_b("Focused");
|
||||
}
|
||||
var tn=this.stateNode||this.domNode,_e={};
|
||||
_2.forEach(tn.className.split(" "),function(c){
|
||||
_e[c]=true;
|
||||
});
|
||||
if("_stateClasses" in this){
|
||||
_2.forEach(this._stateClasses,function(c){
|
||||
delete _e[c];
|
||||
});
|
||||
}
|
||||
_2.forEach(_a,function(c){
|
||||
_e[c]=true;
|
||||
});
|
||||
var _f=[];
|
||||
for(var c in _e){
|
||||
_f.push(c);
|
||||
}
|
||||
tn.className=_f.join(" ");
|
||||
this._stateClasses=_a;
|
||||
},_trackMouseState:function(_10,_11){
|
||||
var _12=false,_13=false,_14=false;
|
||||
var _15=this,cn=_5.hitch(this,"connect",_10);
|
||||
function _16(){
|
||||
var _17=("disabled" in _15&&_15.disabled)||("readonly" in _15&&_15.readonly);
|
||||
_4.toggle(_10,_11+"Hover",_12&&!_13&&!_17);
|
||||
_4.toggle(_10,_11+"Active",_13&&!_17);
|
||||
_4.toggle(_10,_11+"Focused",_14&&!_17);
|
||||
};
|
||||
cn("onmouseenter",function(){
|
||||
_12=true;
|
||||
_16();
|
||||
});
|
||||
cn("onmouseleave",function(){
|
||||
_12=false;
|
||||
_13=false;
|
||||
_16();
|
||||
});
|
||||
cn(_1.press,function(){
|
||||
_13=true;
|
||||
_16();
|
||||
});
|
||||
cn(_1.release,function(){
|
||||
_13=false;
|
||||
_16();
|
||||
});
|
||||
cn("onfocus",function(){
|
||||
_14=true;
|
||||
_16();
|
||||
});
|
||||
cn("onblur",function(){
|
||||
_14=false;
|
||||
_16();
|
||||
});
|
||||
this.watch("disabled",_16);
|
||||
this.watch("readOnly",_16);
|
||||
}});
|
||||
});
|
|
@ -1,269 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_CssStateMixin", [
|
||||
"dojo/touch",
|
||||
"dojo/_base/array", // array.forEach array.map
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-class", // domClass.toggle
|
||||
"dojo/_base/lang", // lang.hitch
|
||||
"dojo/_base/window" // win.body
|
||||
], function(touch, array, declare, domClass, lang, win){
|
||||
|
||||
// module:
|
||||
// dijit/_CssStateMixin
|
||||
// summary:
|
||||
// Mixin for widgets to set CSS classes on the widget DOM nodes depending on hover/mouse press/focus
|
||||
// state changes, and also higher-level state changes such becoming disabled or selected.
|
||||
|
||||
return declare("dijit._CssStateMixin", [], {
|
||||
// summary:
|
||||
// Mixin for widgets to set CSS classes on the widget DOM nodes depending on hover/mouse press/focus
|
||||
// state changes, and also higher-level state changes such becoming disabled or selected.
|
||||
//
|
||||
// description:
|
||||
// By mixing this class into your widget, and setting the this.baseClass attribute, it will automatically
|
||||
// maintain CSS classes on the widget root node (this.domNode) depending on hover,
|
||||
// active, focus, etc. state. Ex: with a baseClass of dijitButton, it will apply the classes
|
||||
// dijitButtonHovered and dijitButtonActive, as the user moves the mouse over the widget and clicks it.
|
||||
//
|
||||
// It also sets CSS like dijitButtonDisabled based on widget semantic state.
|
||||
//
|
||||
// By setting the cssStateNodes attribute, a widget can also track events on subnodes (like buttons
|
||||
// within the widget).
|
||||
|
||||
// cssStateNodes: [protected] Object
|
||||
// List of sub-nodes within the widget that need CSS classes applied on mouse hover/press and focus
|
||||
//.
|
||||
// Each entry in the hash is a an attachpoint names (like "upArrowButton") mapped to a CSS class names
|
||||
// (like "dijitUpArrowButton"). Example:
|
||||
// | {
|
||||
// | "upArrowButton": "dijitUpArrowButton",
|
||||
// | "downArrowButton": "dijitDownArrowButton"
|
||||
// | }
|
||||
// The above will set the CSS class dijitUpArrowButton to the this.upArrowButton DOMNode when it
|
||||
// is hovered, etc.
|
||||
cssStateNodes: {},
|
||||
|
||||
// hovering: [readonly] Boolean
|
||||
// True if cursor is over this widget
|
||||
hovering: false,
|
||||
|
||||
// active: [readonly] Boolean
|
||||
// True if mouse was pressed while over this widget, and hasn't been released yet
|
||||
active: false,
|
||||
|
||||
_applyAttributes: function(){
|
||||
// This code would typically be in postCreate(), but putting in _applyAttributes() for
|
||||
// performance: so the class changes happen before DOM is inserted into the document.
|
||||
// Change back to postCreate() in 2.0. See #11635.
|
||||
|
||||
this.inherited(arguments);
|
||||
|
||||
// Automatically monitor mouse events (essentially :hover and :active) on this.domNode
|
||||
array.forEach(["onmouseenter", "onmouseleave", touch.press], function(e){
|
||||
this.connect(this.domNode, e, "_cssMouseEvent");
|
||||
}, this);
|
||||
|
||||
// Monitoring changes to disabled, readonly, etc. state, and update CSS class of root node
|
||||
array.forEach(["disabled", "readOnly", "checked", "selected", "focused", "state", "hovering", "active"], function(attr){
|
||||
this.watch(attr, lang.hitch(this, "_setStateClass"));
|
||||
}, this);
|
||||
|
||||
// Events on sub nodes within the widget
|
||||
for(var ap in this.cssStateNodes){
|
||||
this._trackMouseState(this[ap], this.cssStateNodes[ap]);
|
||||
}
|
||||
// Set state initially; there's probably no hover/active/focus state but widget might be
|
||||
// disabled/readonly/checked/selected so we want to set CSS classes for those conditions.
|
||||
this._setStateClass();
|
||||
},
|
||||
|
||||
_cssMouseEvent: function(/*Event*/ event){
|
||||
// summary:
|
||||
// Sets hovering and active properties depending on mouse state,
|
||||
// which triggers _setStateClass() to set appropriate CSS classes for this.domNode.
|
||||
|
||||
if(!this.disabled){
|
||||
switch(event.type){
|
||||
case "mouseenter":
|
||||
case "mouseover": // generated on non-IE browsers even though we connected to mouseenter
|
||||
this._set("hovering", true);
|
||||
this._set("active", this._mouseDown);
|
||||
break;
|
||||
|
||||
case "mouseleave":
|
||||
case "mouseout": // generated on non-IE browsers even though we connected to mouseleave
|
||||
this._set("hovering", false);
|
||||
this._set("active", false);
|
||||
break;
|
||||
|
||||
case "mousedown":
|
||||
case "touchpress":
|
||||
this._set("active", true);
|
||||
this._mouseDown = true;
|
||||
// Set a global event to handle mouseup, so it fires properly
|
||||
// even if the cursor leaves this.domNode before the mouse up event.
|
||||
// Alternately could set active=false on mouseout.
|
||||
var mouseUpConnector = this.connect(win.body(), touch.release, function(){
|
||||
this._mouseDown = false;
|
||||
this._set("active", false);
|
||||
this.disconnect(mouseUpConnector);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_setStateClass: function(){
|
||||
// summary:
|
||||
// Update the visual state of the widget by setting the css classes on this.domNode
|
||||
// (or this.stateNode if defined) by combining this.baseClass with
|
||||
// various suffixes that represent the current widget state(s).
|
||||
//
|
||||
// description:
|
||||
// In the case where a widget has multiple
|
||||
// states, it sets the class based on all possible
|
||||
// combinations. For example, an invalid form widget that is being hovered
|
||||
// will be "dijitInput dijitInputInvalid dijitInputHover dijitInputInvalidHover".
|
||||
//
|
||||
// The widget may have one or more of the following states, determined
|
||||
// by this.state, this.checked, this.valid, and this.selected:
|
||||
// - Error - ValidationTextBox sets this.state to "Error" if the current input value is invalid
|
||||
// - Incomplete - ValidationTextBox sets this.state to "Incomplete" if the current input value is not finished yet
|
||||
// - Checked - ex: a checkmark or a ToggleButton in a checked state, will have this.checked==true
|
||||
// - Selected - ex: currently selected tab will have this.selected==true
|
||||
//
|
||||
// In addition, it may have one or more of the following states,
|
||||
// based on this.disabled and flags set in _onMouse (this.active, this.hovering) and from focus manager (this.focused):
|
||||
// - Disabled - if the widget is disabled
|
||||
// - Active - if the mouse (or space/enter key?) is being pressed down
|
||||
// - Focused - if the widget has focus
|
||||
// - Hover - if the mouse is over the widget
|
||||
|
||||
// Compute new set of classes
|
||||
var newStateClasses = this.baseClass.split(" ");
|
||||
|
||||
function multiply(modifier){
|
||||
newStateClasses = newStateClasses.concat(array.map(newStateClasses, function(c){ return c+modifier; }), "dijit"+modifier);
|
||||
}
|
||||
|
||||
if(!this.isLeftToRight()){
|
||||
// For RTL mode we need to set an addition class like dijitTextBoxRtl.
|
||||
multiply("Rtl");
|
||||
}
|
||||
|
||||
var checkedState = this.checked == "mixed" ? "Mixed" : (this.checked ? "Checked" : "");
|
||||
if(this.checked){
|
||||
multiply(checkedState);
|
||||
}
|
||||
if(this.state){
|
||||
multiply(this.state);
|
||||
}
|
||||
if(this.selected){
|
||||
multiply("Selected");
|
||||
}
|
||||
|
||||
if(this.disabled){
|
||||
multiply("Disabled");
|
||||
}else if(this.readOnly){
|
||||
multiply("ReadOnly");
|
||||
}else{
|
||||
if(this.active){
|
||||
multiply("Active");
|
||||
}else if(this.hovering){
|
||||
multiply("Hover");
|
||||
}
|
||||
}
|
||||
|
||||
if(this.focused){
|
||||
multiply("Focused");
|
||||
}
|
||||
|
||||
// Remove old state classes and add new ones.
|
||||
// For performance concerns we only write into domNode.className once.
|
||||
var tn = this.stateNode || this.domNode,
|
||||
classHash = {}; // set of all classes (state and otherwise) for node
|
||||
|
||||
array.forEach(tn.className.split(" "), function(c){ classHash[c] = true; });
|
||||
|
||||
if("_stateClasses" in this){
|
||||
array.forEach(this._stateClasses, function(c){ delete classHash[c]; });
|
||||
}
|
||||
|
||||
array.forEach(newStateClasses, function(c){ classHash[c] = true; });
|
||||
|
||||
var newClasses = [];
|
||||
for(var c in classHash){
|
||||
newClasses.push(c);
|
||||
}
|
||||
tn.className = newClasses.join(" ");
|
||||
|
||||
this._stateClasses = newStateClasses;
|
||||
},
|
||||
|
||||
_trackMouseState: function(/*DomNode*/ node, /*String*/ clazz){
|
||||
// summary:
|
||||
// Track mouse/focus events on specified node and set CSS class on that node to indicate
|
||||
// current state. Usually not called directly, but via cssStateNodes attribute.
|
||||
// description:
|
||||
// Given class=foo, will set the following CSS class on the node
|
||||
// - fooActive: if the user is currently pressing down the mouse button while over the node
|
||||
// - fooHover: if the user is hovering the mouse over the node, but not pressing down a button
|
||||
// - fooFocus: if the node is focused
|
||||
//
|
||||
// Note that it won't set any classes if the widget is disabled.
|
||||
// node: DomNode
|
||||
// Should be a sub-node of the widget, not the top node (this.domNode), since the top node
|
||||
// is handled specially and automatically just by mixing in this class.
|
||||
// clazz: String
|
||||
// CSS class name (ex: dijitSliderUpArrow).
|
||||
|
||||
// Current state of node (initially false)
|
||||
// NB: setting specifically to false because domClass.toggle() needs true boolean as third arg
|
||||
var hovering=false, active=false, focused=false;
|
||||
|
||||
var self = this,
|
||||
cn = lang.hitch(this, "connect", node);
|
||||
|
||||
function setClass(){
|
||||
var disabled = ("disabled" in self && self.disabled) || ("readonly" in self && self.readonly);
|
||||
domClass.toggle(node, clazz+"Hover", hovering && !active && !disabled);
|
||||
domClass.toggle(node, clazz+"Active", active && !disabled);
|
||||
domClass.toggle(node, clazz+"Focused", focused && !disabled);
|
||||
}
|
||||
|
||||
// Mouse
|
||||
cn("onmouseenter", function(){
|
||||
hovering = true;
|
||||
setClass();
|
||||
});
|
||||
cn("onmouseleave", function(){
|
||||
hovering = false;
|
||||
active = false;
|
||||
setClass();
|
||||
});
|
||||
cn(touch.press, function(){
|
||||
active = true;
|
||||
setClass();
|
||||
});
|
||||
cn(touch.release, function(){
|
||||
active = false;
|
||||
setClass();
|
||||
});
|
||||
|
||||
// Focus
|
||||
cn("onfocus", function(){
|
||||
focused = true;
|
||||
setClass();
|
||||
});
|
||||
cn("onblur", function(){
|
||||
focused = false;
|
||||
setClass();
|
||||
});
|
||||
|
||||
// Just in case widget is enabled/disabled while it has focus/hover/active state.
|
||||
// Maybe this is overkill.
|
||||
this.watch("disabled", setClass);
|
||||
this.watch("readOnly", setClass);
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,14 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_DialogMixin",["dojo/_base/declare","./a11y"],function(_1,_2){
|
||||
return _1("dijit._DialogMixin",null,{execute:function(){
|
||||
},onCancel:function(){
|
||||
},onExecute:function(){
|
||||
},_onSubmit:function(){
|
||||
this.onExecute();
|
||||
this.execute(this.get("value"));
|
||||
},_getFocusItems:function(){
|
||||
var _3=_2._getTabNavigable(this.containerNode);
|
||||
this._firstFocusItem=_3.lowest||_3.first||this.closeButtonNode||this.domNode;
|
||||
this._lastFocusItem=_3.last||_3.highest||this._firstFocusItem;
|
||||
}});
|
||||
});
|
|
@ -1,73 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_DialogMixin", [
|
||||
"dojo/_base/declare", // declare
|
||||
"./a11y" // _getTabNavigable
|
||||
], function(declare, a11y){
|
||||
|
||||
// module:
|
||||
// dijit/_DialogMixin
|
||||
// summary:
|
||||
// _DialogMixin provides functions useful to Dialog and TooltipDialog
|
||||
|
||||
return declare("dijit._DialogMixin", null, {
|
||||
// summary:
|
||||
// This provides functions useful to Dialog and TooltipDialog
|
||||
|
||||
execute: function(/*Object*/ /*===== formContents =====*/){
|
||||
// summary:
|
||||
// Callback when the user hits the submit button.
|
||||
// Override this method to handle Dialog execution.
|
||||
// description:
|
||||
// After the user has pressed the submit button, the Dialog
|
||||
// first calls onExecute() to notify the container to hide the
|
||||
// dialog and restore focus to wherever it used to be.
|
||||
//
|
||||
// *Then* this method is called.
|
||||
// type:
|
||||
// callback
|
||||
},
|
||||
|
||||
onCancel: function(){
|
||||
// summary:
|
||||
// Called when user has pressed the Dialog's cancel button, to notify container.
|
||||
// description:
|
||||
// Developer shouldn't override or connect to this method;
|
||||
// it's a private communication device between the TooltipDialog
|
||||
// and the thing that opened it (ex: `dijit.form.DropDownButton`)
|
||||
// type:
|
||||
// protected
|
||||
},
|
||||
|
||||
onExecute: function(){
|
||||
// summary:
|
||||
// Called when user has pressed the dialog's OK button, to notify container.
|
||||
// description:
|
||||
// Developer shouldn't override or connect to this method;
|
||||
// it's a private communication device between the TooltipDialog
|
||||
// and the thing that opened it (ex: `dijit.form.DropDownButton`)
|
||||
// type:
|
||||
// protected
|
||||
},
|
||||
|
||||
_onSubmit: function(){
|
||||
// summary:
|
||||
// Callback when user hits submit button
|
||||
// type:
|
||||
// protected
|
||||
this.onExecute(); // notify container that we are about to execute
|
||||
this.execute(this.get('value'));
|
||||
},
|
||||
|
||||
_getFocusItems: function(){
|
||||
// summary:
|
||||
// Finds focusable items in dialog,
|
||||
// and sets this._firstFocusItem and this._lastFocusItem
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
var elems = a11y._getTabNavigable(this.containerNode);
|
||||
this._firstFocusItem = elems.lowest || elems.first || this.closeButtonNode || this.domNode;
|
||||
this._lastFocusItem = elems.last || elems.highest || this._firstFocusItem;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_FocusMixin",["./focus","./_WidgetBase","dojo/_base/declare","dojo/_base/lang"],function(_1,_2,_3,_4){
|
||||
_4.extend(_2,{focused:false,onFocus:function(){
|
||||
},onBlur:function(){
|
||||
},_onFocus:function(){
|
||||
this.onFocus();
|
||||
},_onBlur:function(){
|
||||
this.onBlur();
|
||||
}});
|
||||
return _3("dijit._FocusMixin",null,{_focusManager:_1});
|
||||
});
|
|
@ -1,74 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_FocusMixin", [
|
||||
"./focus",
|
||||
"./_WidgetBase",
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/lang" // lang.extend
|
||||
], function(focus, _WidgetBase, declare, lang){
|
||||
|
||||
/*=====
|
||||
var _WidgetBase = dijit._WidgetBase;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/_FocusMixin
|
||||
// summary:
|
||||
// Mixin to widget to provide _onFocus() and _onBlur() methods that
|
||||
// fire when a widget or it's descendants get/lose focus
|
||||
|
||||
// We don't know where _FocusMixin will occur in the inheritance chain, but we need the _onFocus()/_onBlur() below
|
||||
// to be last in the inheritance chain, so mixin to _WidgetBase.
|
||||
lang.extend(_WidgetBase, {
|
||||
// focused: [readonly] Boolean
|
||||
// This widget or a widget it contains has focus, or is "active" because
|
||||
// it was recently clicked.
|
||||
focused: false,
|
||||
|
||||
onFocus: function(){
|
||||
// summary:
|
||||
// Called when the widget becomes "active" because
|
||||
// it or a widget inside of it either has focus, or has recently
|
||||
// been clicked.
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
|
||||
onBlur: function(){
|
||||
// summary:
|
||||
// Called when the widget stops being "active" because
|
||||
// focus moved to something outside of it, or the user
|
||||
// clicked somewhere outside of it, or the widget was
|
||||
// hidden.
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
|
||||
_onFocus: function(){
|
||||
// summary:
|
||||
// This is where widgets do processing for when they are active,
|
||||
// such as changing CSS classes. See onFocus() for more details.
|
||||
// tags:
|
||||
// protected
|
||||
this.onFocus();
|
||||
},
|
||||
|
||||
_onBlur: function(){
|
||||
// summary:
|
||||
// This is where widgets do processing for when they stop being active,
|
||||
// such as changing CSS classes. See onBlur() for more details.
|
||||
// tags:
|
||||
// protected
|
||||
this.onBlur();
|
||||
}
|
||||
});
|
||||
|
||||
return declare("dijit._FocusMixin", null, {
|
||||
// summary:
|
||||
// Mixin to widget to provide _onFocus() and _onBlur() methods that
|
||||
// fire when a widget or it's descendants get/lose focus
|
||||
|
||||
// flag that I want _onFocus()/_onBlur() notifications from focus manager
|
||||
_focusManager: focus
|
||||
});
|
||||
|
||||
});
|
|
@ -1,216 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_HasDropDown",["dojo/_base/declare","dojo/_base/Deferred","dojo/_base/event","dojo/dom","dojo/dom-attr","dojo/dom-class","dojo/dom-geometry","dojo/dom-style","dojo/has","dojo/keys","dojo/_base/lang","dojo/touch","dojo/_base/window","dojo/window","./registry","./focus","./popup","./_FocusMixin"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f,_10,_11,_12){
|
||||
return _1("dijit._HasDropDown",_12,{_buttonNode:null,_arrowWrapperNode:null,_popupStateNode:null,_aroundNode:null,dropDown:null,autoWidth:true,forceWidth:false,maxHeight:0,dropDownPosition:["below","above"],_stopClickEvents:true,_onDropDownMouseDown:function(e){
|
||||
if(this.disabled||this.readOnly){
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
this._docHandler=this.connect(_d.doc,_c.release,"_onDropDownMouseUp");
|
||||
this.toggleDropDown();
|
||||
},_onDropDownMouseUp:function(e){
|
||||
if(e&&this._docHandler){
|
||||
this.disconnect(this._docHandler);
|
||||
}
|
||||
var _13=this.dropDown,_14=false;
|
||||
if(e&&this._opened){
|
||||
var c=_7.position(this._buttonNode,true);
|
||||
if(!(e.pageX>=c.x&&e.pageX<=c.x+c.w)||!(e.pageY>=c.y&&e.pageY<=c.y+c.h)){
|
||||
var t=e.target;
|
||||
while(t&&!_14){
|
||||
if(_6.contains(t,"dijitPopup")){
|
||||
_14=true;
|
||||
}else{
|
||||
t=t.parentNode;
|
||||
}
|
||||
}
|
||||
if(_14){
|
||||
t=e.target;
|
||||
if(_13.onItemClick){
|
||||
var _15;
|
||||
while(t&&!(_15=_f.byNode(t))){
|
||||
t=t.parentNode;
|
||||
}
|
||||
if(_15&&_15.onClick&&_15.getParent){
|
||||
_15.getParent().onItemClick(_15,e);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this._opened){
|
||||
if(_13.focus&&_13.autoFocus!==false){
|
||||
window.setTimeout(_b.hitch(_13,"focus"),1);
|
||||
}
|
||||
}else{
|
||||
setTimeout(_b.hitch(this,"focus"),0);
|
||||
}
|
||||
if(_9("ios")){
|
||||
this._justGotMouseUp=true;
|
||||
setTimeout(_b.hitch(this,function(){
|
||||
this._justGotMouseUp=false;
|
||||
}),0);
|
||||
}
|
||||
},_onDropDownClick:function(e){
|
||||
if(_9("ios")&&!this._justGotMouseUp){
|
||||
this._onDropDownMouseDown(e);
|
||||
this._onDropDownMouseUp(e);
|
||||
}
|
||||
if(this._stopClickEvents){
|
||||
_3.stop(e);
|
||||
}
|
||||
},buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
this._buttonNode=this._buttonNode||this.focusNode||this.domNode;
|
||||
this._popupStateNode=this._popupStateNode||this.focusNode||this._buttonNode;
|
||||
var _16={"after":this.isLeftToRight()?"Right":"Left","before":this.isLeftToRight()?"Left":"Right","above":"Up","below":"Down","left":"Left","right":"Right"}[this.dropDownPosition[0]]||this.dropDownPosition[0]||"Down";
|
||||
_6.add(this._arrowWrapperNode||this._buttonNode,"dijit"+_16+"ArrowButton");
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
this.connect(this._buttonNode,_c.press,"_onDropDownMouseDown");
|
||||
this.connect(this._buttonNode,"onclick","_onDropDownClick");
|
||||
this.connect(this.focusNode,"onkeypress","_onKey");
|
||||
this.connect(this.focusNode,"onkeyup","_onKeyUp");
|
||||
},destroy:function(){
|
||||
if(this.dropDown){
|
||||
if(!this.dropDown._destroyed){
|
||||
this.dropDown.destroyRecursive();
|
||||
}
|
||||
delete this.dropDown;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},_onKey:function(e){
|
||||
if(this.disabled||this.readOnly){
|
||||
return;
|
||||
}
|
||||
var d=this.dropDown,_17=e.target;
|
||||
if(d&&this._opened&&d.handleKey){
|
||||
if(d.handleKey(e)===false){
|
||||
_3.stop(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(d&&this._opened&&e.charOrCode==_a.ESCAPE){
|
||||
this.closeDropDown();
|
||||
_3.stop(e);
|
||||
}else{
|
||||
if(!this._opened&&(e.charOrCode==_a.DOWN_ARROW||((e.charOrCode==_a.ENTER||e.charOrCode==" ")&&((_17.tagName||"").toLowerCase()!=="input"||(_17.type&&_17.type.toLowerCase()!=="text"))))){
|
||||
this._toggleOnKeyUp=true;
|
||||
_3.stop(e);
|
||||
}
|
||||
}
|
||||
},_onKeyUp:function(){
|
||||
if(this._toggleOnKeyUp){
|
||||
delete this._toggleOnKeyUp;
|
||||
this.toggleDropDown();
|
||||
var d=this.dropDown;
|
||||
if(d&&d.focus){
|
||||
setTimeout(_b.hitch(d,"focus"),1);
|
||||
}
|
||||
}
|
||||
},_onBlur:function(){
|
||||
var _18=_10.curNode&&this.dropDown&&_4.isDescendant(_10.curNode,this.dropDown.domNode);
|
||||
this.closeDropDown(_18);
|
||||
this.inherited(arguments);
|
||||
},isLoaded:function(){
|
||||
return true;
|
||||
},loadDropDown:function(_19){
|
||||
_19();
|
||||
},loadAndOpenDropDown:function(){
|
||||
var d=new _2(),_1a=_b.hitch(this,function(){
|
||||
this.openDropDown();
|
||||
d.resolve(this.dropDown);
|
||||
});
|
||||
if(!this.isLoaded()){
|
||||
this.loadDropDown(_1a);
|
||||
}else{
|
||||
_1a();
|
||||
}
|
||||
return d;
|
||||
},toggleDropDown:function(){
|
||||
if(this.disabled||this.readOnly){
|
||||
return;
|
||||
}
|
||||
if(!this._opened){
|
||||
this.loadAndOpenDropDown();
|
||||
}else{
|
||||
this.closeDropDown();
|
||||
}
|
||||
},openDropDown:function(){
|
||||
var _1b=this.dropDown,_1c=_1b.domNode,_1d=this._aroundNode||this.domNode,_1e=this;
|
||||
if(!this._preparedNode){
|
||||
this._preparedNode=true;
|
||||
if(_1c.style.width){
|
||||
this._explicitDDWidth=true;
|
||||
}
|
||||
if(_1c.style.height){
|
||||
this._explicitDDHeight=true;
|
||||
}
|
||||
}
|
||||
if(this.maxHeight||this.forceWidth||this.autoWidth){
|
||||
var _1f={display:"",visibility:"hidden"};
|
||||
if(!this._explicitDDWidth){
|
||||
_1f.width="";
|
||||
}
|
||||
if(!this._explicitDDHeight){
|
||||
_1f.height="";
|
||||
}
|
||||
_8.set(_1c,_1f);
|
||||
var _20=this.maxHeight;
|
||||
if(_20==-1){
|
||||
var _21=_e.getBox(),_22=_7.position(_1d,false);
|
||||
_20=Math.floor(Math.max(_22.y,_21.h-(_22.y+_22.h)));
|
||||
}
|
||||
_11.moveOffScreen(_1b);
|
||||
if(_1b.startup&&!_1b._started){
|
||||
_1b.startup();
|
||||
}
|
||||
var mb=_7.getMarginSize(_1c);
|
||||
var _23=(_20&&mb.h>_20);
|
||||
_8.set(_1c,{overflowX:"hidden",overflowY:_23?"auto":"hidden"});
|
||||
if(_23){
|
||||
mb.h=_20;
|
||||
if("w" in mb){
|
||||
mb.w+=16;
|
||||
}
|
||||
}else{
|
||||
delete mb.h;
|
||||
}
|
||||
if(this.forceWidth){
|
||||
mb.w=_1d.offsetWidth;
|
||||
}else{
|
||||
if(this.autoWidth){
|
||||
mb.w=Math.max(mb.w,_1d.offsetWidth);
|
||||
}else{
|
||||
delete mb.w;
|
||||
}
|
||||
}
|
||||
if(_b.isFunction(_1b.resize)){
|
||||
_1b.resize(mb);
|
||||
}else{
|
||||
_7.setMarginBox(_1c,mb);
|
||||
}
|
||||
}
|
||||
var _24=_11.open({parent:this,popup:_1b,around:_1d,orient:this.dropDownPosition,onExecute:function(){
|
||||
_1e.closeDropDown(true);
|
||||
},onCancel:function(){
|
||||
_1e.closeDropDown(true);
|
||||
},onClose:function(){
|
||||
_5.set(_1e._popupStateNode,"popupActive",false);
|
||||
_6.remove(_1e._popupStateNode,"dijitHasDropDownOpen");
|
||||
_1e._opened=false;
|
||||
}});
|
||||
_5.set(this._popupStateNode,"popupActive","true");
|
||||
_6.add(_1e._popupStateNode,"dijitHasDropDownOpen");
|
||||
this._opened=true;
|
||||
return _24;
|
||||
},closeDropDown:function(_25){
|
||||
if(this._opened){
|
||||
if(_25){
|
||||
this.focus();
|
||||
}
|
||||
_11.close(this.dropDown);
|
||||
this._opened=false;
|
||||
}
|
||||
}});
|
||||
});
|
|
@ -1,503 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_HasDropDown", [
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/Deferred",
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/dom", // dom.isDescendant
|
||||
"dojo/dom-attr", // domAttr.set
|
||||
"dojo/dom-class", // domClass.add domClass.contains domClass.remove
|
||||
"dojo/dom-geometry", // domGeometry.marginBox domGeometry.position
|
||||
"dojo/dom-style", // domStyle.set
|
||||
"dojo/has",
|
||||
"dojo/keys", // keys.DOWN_ARROW keys.ENTER keys.ESCAPE
|
||||
"dojo/_base/lang", // lang.hitch lang.isFunction
|
||||
"dojo/touch",
|
||||
"dojo/_base/window", // win.doc
|
||||
"dojo/window", // winUtils.getBox
|
||||
"./registry", // registry.byNode()
|
||||
"./focus",
|
||||
"./popup",
|
||||
"./_FocusMixin"
|
||||
], function(declare, Deferred, event,dom, domAttr, domClass, domGeometry, domStyle, has, keys, lang, touch,
|
||||
win, winUtils, registry, focus, popup, _FocusMixin){
|
||||
|
||||
/*=====
|
||||
var _FocusMixin = dijit._FocusMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/_HasDropDown
|
||||
// summary:
|
||||
// Mixin for widgets that need drop down ability.
|
||||
|
||||
return declare("dijit._HasDropDown", _FocusMixin, {
|
||||
// summary:
|
||||
// Mixin for widgets that need drop down ability.
|
||||
|
||||
// _buttonNode: [protected] DomNode
|
||||
// The button/icon/node to click to display the drop down.
|
||||
// Can be set via a data-dojo-attach-point assignment.
|
||||
// If missing, then either focusNode or domNode (if focusNode is also missing) will be used.
|
||||
_buttonNode: null,
|
||||
|
||||
// _arrowWrapperNode: [protected] DomNode
|
||||
// Will set CSS class dijitUpArrow, dijitDownArrow, dijitRightArrow etc. on this node depending
|
||||
// on where the drop down is set to be positioned.
|
||||
// Can be set via a data-dojo-attach-point assignment.
|
||||
// If missing, then _buttonNode will be used.
|
||||
_arrowWrapperNode: null,
|
||||
|
||||
// _popupStateNode: [protected] DomNode
|
||||
// The node to set the popupActive class on.
|
||||
// Can be set via a data-dojo-attach-point assignment.
|
||||
// If missing, then focusNode or _buttonNode (if focusNode is missing) will be used.
|
||||
_popupStateNode: null,
|
||||
|
||||
// _aroundNode: [protected] DomNode
|
||||
// The node to display the popup around.
|
||||
// Can be set via a data-dojo-attach-point assignment.
|
||||
// If missing, then domNode will be used.
|
||||
_aroundNode: null,
|
||||
|
||||
// dropDown: [protected] Widget
|
||||
// The widget to display as a popup. This widget *must* be
|
||||
// defined before the startup function is called.
|
||||
dropDown: null,
|
||||
|
||||
// autoWidth: [protected] Boolean
|
||||
// Set to true to make the drop down at least as wide as this
|
||||
// widget. Set to false if the drop down should just be its
|
||||
// default width
|
||||
autoWidth: true,
|
||||
|
||||
// forceWidth: [protected] Boolean
|
||||
// Set to true to make the drop down exactly as wide as this
|
||||
// widget. Overrides autoWidth.
|
||||
forceWidth: false,
|
||||
|
||||
// maxHeight: [protected] Integer
|
||||
// The max height for our dropdown.
|
||||
// Any dropdown taller than this will have scrollbars.
|
||||
// Set to 0 for no max height, or -1 to limit height to available space in viewport
|
||||
maxHeight: 0,
|
||||
|
||||
// dropDownPosition: [const] String[]
|
||||
// This variable controls the position of the drop down.
|
||||
// It's an array of strings with the following values:
|
||||
//
|
||||
// * before: places drop down to the left of the target node/widget, or to the right in
|
||||
// the case of RTL scripts like Hebrew and Arabic
|
||||
// * after: places drop down to the right of the target node/widget, or to the left in
|
||||
// the case of RTL scripts like Hebrew and Arabic
|
||||
// * above: drop down goes above target node
|
||||
// * below: drop down goes below target node
|
||||
//
|
||||
// The list is positions is tried, in order, until a position is found where the drop down fits
|
||||
// within the viewport.
|
||||
//
|
||||
dropDownPosition: ["below","above"],
|
||||
|
||||
// _stopClickEvents: Boolean
|
||||
// When set to false, the click events will not be stopped, in
|
||||
// case you want to use them in your subwidget
|
||||
_stopClickEvents: true,
|
||||
|
||||
_onDropDownMouseDown: function(/*Event*/ e){
|
||||
// summary:
|
||||
// Callback when the user mousedown's on the arrow icon
|
||||
if(this.disabled || this.readOnly){ return; }
|
||||
|
||||
// Prevent default to stop things like text selection, but don't stop propogation, so that:
|
||||
// 1. TimeTextBox etc. can focusthe <input> on mousedown
|
||||
// 2. dropDownButtonActive class applied by _CssStateMixin (on button depress)
|
||||
// 3. user defined onMouseDown handler fires
|
||||
e.preventDefault();
|
||||
|
||||
this._docHandler = this.connect(win.doc, touch.release, "_onDropDownMouseUp");
|
||||
|
||||
this.toggleDropDown();
|
||||
},
|
||||
|
||||
_onDropDownMouseUp: function(/*Event?*/ e){
|
||||
// summary:
|
||||
// Callback when the user lifts their mouse after mouse down on the arrow icon.
|
||||
// If the drop down is a simple menu and the mouse is over the menu, we execute it, otherwise, we focus our
|
||||
// drop down widget. If the event is missing, then we are not
|
||||
// a mouseup event.
|
||||
//
|
||||
// This is useful for the common mouse movement pattern
|
||||
// with native browser <select> nodes:
|
||||
// 1. mouse down on the select node (probably on the arrow)
|
||||
// 2. move mouse to a menu item while holding down the mouse button
|
||||
// 3. mouse up. this selects the menu item as though the user had clicked it.
|
||||
if(e && this._docHandler){
|
||||
this.disconnect(this._docHandler);
|
||||
}
|
||||
var dropDown = this.dropDown, overMenu = false;
|
||||
|
||||
if(e && this._opened){
|
||||
// This code deals with the corner-case when the drop down covers the original widget,
|
||||
// because it's so large. In that case mouse-up shouldn't select a value from the menu.
|
||||
// Find out if our target is somewhere in our dropdown widget,
|
||||
// but not over our _buttonNode (the clickable node)
|
||||
var c = domGeometry.position(this._buttonNode, true);
|
||||
if(!(e.pageX >= c.x && e.pageX <= c.x + c.w) ||
|
||||
!(e.pageY >= c.y && e.pageY <= c.y + c.h)){
|
||||
var t = e.target;
|
||||
while(t && !overMenu){
|
||||
if(domClass.contains(t, "dijitPopup")){
|
||||
overMenu = true;
|
||||
}else{
|
||||
t = t.parentNode;
|
||||
}
|
||||
}
|
||||
if(overMenu){
|
||||
t = e.target;
|
||||
if(dropDown.onItemClick){
|
||||
var menuItem;
|
||||
while(t && !(menuItem = registry.byNode(t))){
|
||||
t = t.parentNode;
|
||||
}
|
||||
if(menuItem && menuItem.onClick && menuItem.getParent){
|
||||
menuItem.getParent().onItemClick(menuItem, e);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this._opened){
|
||||
if(dropDown.focus && dropDown.autoFocus !== false){
|
||||
// Focus the dropdown widget - do it on a delay so that we
|
||||
// don't steal our own focus.
|
||||
window.setTimeout(lang.hitch(dropDown, "focus"), 1);
|
||||
}
|
||||
}else{
|
||||
// The drop down arrow icon probably can't receive focus, but widget itself should get focus.
|
||||
// setTimeout() needed to make it work on IE (test DateTextBox)
|
||||
setTimeout(lang.hitch(this, "focus"), 0);
|
||||
}
|
||||
|
||||
if(has("ios")){
|
||||
this._justGotMouseUp = true;
|
||||
setTimeout(lang.hitch(this, function(){
|
||||
this._justGotMouseUp = false;
|
||||
}), 0);
|
||||
}
|
||||
},
|
||||
|
||||
_onDropDownClick: function(/*Event*/ e){
|
||||
if(has("ios") && !this._justGotMouseUp){
|
||||
// This branch fires on iPhone for ComboBox, because the button node is an <input> and doesn't
|
||||
// generate touchstart/touchend events. Pretend we just got a mouse down / mouse up.
|
||||
// The if(has("ios") is necessary since IE and desktop safari get spurious onclick events
|
||||
// when there are nested tables (specifically, clicking on a table that holds a dijit.form.Select,
|
||||
// but not on the Select itself, causes an onclick event on the Select)
|
||||
this._onDropDownMouseDown(e);
|
||||
this._onDropDownMouseUp(e);
|
||||
}
|
||||
|
||||
// The drop down was already opened on mousedown/keydown; just need to call stopEvent().
|
||||
if(this._stopClickEvents){
|
||||
event.stop(e);
|
||||
}
|
||||
},
|
||||
|
||||
buildRendering: function(){
|
||||
this.inherited(arguments);
|
||||
|
||||
this._buttonNode = this._buttonNode || this.focusNode || this.domNode;
|
||||
this._popupStateNode = this._popupStateNode || this.focusNode || this._buttonNode;
|
||||
|
||||
// Add a class to the "dijitDownArrowButton" type class to _buttonNode so theme can set direction of arrow
|
||||
// based on where drop down will normally appear
|
||||
var defaultPos = {
|
||||
"after" : this.isLeftToRight() ? "Right" : "Left",
|
||||
"before" : this.isLeftToRight() ? "Left" : "Right",
|
||||
"above" : "Up",
|
||||
"below" : "Down",
|
||||
"left" : "Left",
|
||||
"right" : "Right"
|
||||
}[this.dropDownPosition[0]] || this.dropDownPosition[0] || "Down";
|
||||
domClass.add(this._arrowWrapperNode || this._buttonNode, "dijit" + defaultPos + "ArrowButton");
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
// summary:
|
||||
// set up nodes and connect our mouse and keypress events
|
||||
|
||||
this.inherited(arguments);
|
||||
|
||||
this.connect(this._buttonNode, touch.press, "_onDropDownMouseDown");
|
||||
this.connect(this._buttonNode, "onclick", "_onDropDownClick");
|
||||
this.connect(this.focusNode, "onkeypress", "_onKey");
|
||||
this.connect(this.focusNode, "onkeyup", "_onKeyUp");
|
||||
},
|
||||
|
||||
destroy: function(){
|
||||
if(this.dropDown){
|
||||
// Destroy the drop down, unless it's already been destroyed. This can happen because
|
||||
// the drop down is a direct child of <body> even though it's logically my child.
|
||||
if(!this.dropDown._destroyed){
|
||||
this.dropDown.destroyRecursive();
|
||||
}
|
||||
delete this.dropDown;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
_onKey: function(/*Event*/ e){
|
||||
// summary:
|
||||
// Callback when the user presses a key while focused on the button node
|
||||
|
||||
if(this.disabled || this.readOnly){ return; }
|
||||
|
||||
var d = this.dropDown, target = e.target;
|
||||
if(d && this._opened && d.handleKey){
|
||||
if(d.handleKey(e) === false){
|
||||
/* false return code means that the drop down handled the key */
|
||||
event.stop(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(d && this._opened && e.charOrCode == keys.ESCAPE){
|
||||
this.closeDropDown();
|
||||
event.stop(e);
|
||||
}else if(!this._opened &&
|
||||
(e.charOrCode == keys.DOWN_ARROW ||
|
||||
( (e.charOrCode == keys.ENTER || e.charOrCode == " ") &&
|
||||
//ignore enter and space if the event is for a text input
|
||||
((target.tagName || "").toLowerCase() !== 'input' ||
|
||||
(target.type && target.type.toLowerCase() !== 'text'))))){
|
||||
// Toggle the drop down, but wait until keyup so that the drop down doesn't
|
||||
// get a stray keyup event, or in the case of key-repeat (because user held
|
||||
// down key for too long), stray keydown events
|
||||
this._toggleOnKeyUp = true;
|
||||
event.stop(e);
|
||||
}
|
||||
},
|
||||
|
||||
_onKeyUp: function(){
|
||||
if(this._toggleOnKeyUp){
|
||||
delete this._toggleOnKeyUp;
|
||||
this.toggleDropDown();
|
||||
var d = this.dropDown; // drop down may not exist until toggleDropDown() call
|
||||
if(d && d.focus){
|
||||
setTimeout(lang.hitch(d, "focus"), 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_onBlur: function(){
|
||||
// summary:
|
||||
// Called magically when focus has shifted away from this widget and it's dropdown
|
||||
|
||||
// Don't focus on button if the user has explicitly focused on something else (happens
|
||||
// when user clicks another control causing the current popup to close)..
|
||||
// But if focus is inside of the drop down then reset focus to me, because IE doesn't like
|
||||
// it when you display:none a node with focus.
|
||||
var focusMe = focus.curNode && this.dropDown && dom.isDescendant(focus.curNode, this.dropDown.domNode);
|
||||
|
||||
this.closeDropDown(focusMe);
|
||||
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
isLoaded: function(){
|
||||
// summary:
|
||||
// Returns true if the dropdown exists and it's data is loaded. This can
|
||||
// be overridden in order to force a call to loadDropDown().
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
loadDropDown: function(/*Function*/ loadCallback){
|
||||
// summary:
|
||||
// Creates the drop down if it doesn't exist, loads the data
|
||||
// if there's an href and it hasn't been loaded yet, and then calls
|
||||
// the given callback.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
// TODO: for 2.0, change API to return a Deferred, instead of calling loadCallback?
|
||||
loadCallback();
|
||||
},
|
||||
|
||||
loadAndOpenDropDown: function(){
|
||||
// summary:
|
||||
// Creates the drop down if it doesn't exist, loads the data
|
||||
// if there's an href and it hasn't been loaded yet, and
|
||||
// then opens the drop down. This is basically a callback when the
|
||||
// user presses the down arrow button to open the drop down.
|
||||
// returns: Deferred
|
||||
// Deferred for the drop down widget that
|
||||
// fires when drop down is created and loaded
|
||||
// tags:
|
||||
// protected
|
||||
var d = new Deferred(),
|
||||
afterLoad = lang.hitch(this, function(){
|
||||
this.openDropDown();
|
||||
d.resolve(this.dropDown);
|
||||
});
|
||||
if(!this.isLoaded()){
|
||||
this.loadDropDown(afterLoad);
|
||||
}else{
|
||||
afterLoad();
|
||||
}
|
||||
return d;
|
||||
},
|
||||
|
||||
toggleDropDown: function(){
|
||||
// summary:
|
||||
// Callback when the user presses the down arrow button or presses
|
||||
// the down arrow key to open/close the drop down.
|
||||
// Toggle the drop-down widget; if it is up, close it, if not, open it
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
if(this.disabled || this.readOnly){ return; }
|
||||
if(!this._opened){
|
||||
this.loadAndOpenDropDown();
|
||||
}else{
|
||||
this.closeDropDown();
|
||||
}
|
||||
},
|
||||
|
||||
openDropDown: function(){
|
||||
// summary:
|
||||
// Opens the dropdown for this widget. To be called only when this.dropDown
|
||||
// has been created and is ready to display (ie, it's data is loaded).
|
||||
// returns:
|
||||
// return value of dijit.popup.open()
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
var dropDown = this.dropDown,
|
||||
ddNode = dropDown.domNode,
|
||||
aroundNode = this._aroundNode || this.domNode,
|
||||
self = this;
|
||||
|
||||
// Prepare our popup's height and honor maxHeight if it exists.
|
||||
|
||||
// TODO: isn't maxHeight dependent on the return value from dijit.popup.open(),
|
||||
// ie, dependent on how much space is available (BK)
|
||||
|
||||
if(!this._preparedNode){
|
||||
this._preparedNode = true;
|
||||
// Check if we have explicitly set width and height on the dropdown widget dom node
|
||||
if(ddNode.style.width){
|
||||
this._explicitDDWidth = true;
|
||||
}
|
||||
if(ddNode.style.height){
|
||||
this._explicitDDHeight = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Code for resizing dropdown (height limitation, or increasing width to match my width)
|
||||
if(this.maxHeight || this.forceWidth || this.autoWidth){
|
||||
var myStyle = {
|
||||
display: "",
|
||||
visibility: "hidden"
|
||||
};
|
||||
if(!this._explicitDDWidth){
|
||||
myStyle.width = "";
|
||||
}
|
||||
if(!this._explicitDDHeight){
|
||||
myStyle.height = "";
|
||||
}
|
||||
domStyle.set(ddNode, myStyle);
|
||||
|
||||
// Figure out maximum height allowed (if there is a height restriction)
|
||||
var maxHeight = this.maxHeight;
|
||||
if(maxHeight == -1){
|
||||
// limit height to space available in viewport either above or below my domNode
|
||||
// (whichever side has more room)
|
||||
var viewport = winUtils.getBox(),
|
||||
position = domGeometry.position(aroundNode, false);
|
||||
maxHeight = Math.floor(Math.max(position.y, viewport.h - (position.y + position.h)));
|
||||
}
|
||||
|
||||
// Attach dropDown to DOM and make make visibility:hidden rather than display:none
|
||||
// so we call startup() and also get the size
|
||||
popup.moveOffScreen(dropDown);
|
||||
|
||||
if(dropDown.startup && !dropDown._started){
|
||||
dropDown.startup(); // this has to be done after being added to the DOM
|
||||
}
|
||||
// Get size of drop down, and determine if vertical scroll bar needed
|
||||
var mb = domGeometry.getMarginSize(ddNode);
|
||||
var overHeight = (maxHeight && mb.h > maxHeight);
|
||||
domStyle.set(ddNode, {
|
||||
overflowX: "hidden",
|
||||
overflowY: overHeight ? "auto" : "hidden"
|
||||
});
|
||||
if(overHeight){
|
||||
mb.h = maxHeight;
|
||||
if("w" in mb){
|
||||
mb.w += 16; // room for vertical scrollbar
|
||||
}
|
||||
}else{
|
||||
delete mb.h;
|
||||
}
|
||||
|
||||
// Adjust dropdown width to match or be larger than my width
|
||||
if(this.forceWidth){
|
||||
mb.w = aroundNode.offsetWidth;
|
||||
}else if(this.autoWidth){
|
||||
mb.w = Math.max(mb.w, aroundNode.offsetWidth);
|
||||
}else{
|
||||
delete mb.w;
|
||||
}
|
||||
|
||||
// And finally, resize the dropdown to calculated height and width
|
||||
if(lang.isFunction(dropDown.resize)){
|
||||
dropDown.resize(mb);
|
||||
}else{
|
||||
domGeometry.setMarginBox(ddNode, mb);
|
||||
}
|
||||
}
|
||||
|
||||
var retVal = popup.open({
|
||||
parent: this,
|
||||
popup: dropDown,
|
||||
around: aroundNode,
|
||||
orient: this.dropDownPosition,
|
||||
onExecute: function(){
|
||||
self.closeDropDown(true);
|
||||
},
|
||||
onCancel: function(){
|
||||
self.closeDropDown(true);
|
||||
},
|
||||
onClose: function(){
|
||||
domAttr.set(self._popupStateNode, "popupActive", false);
|
||||
domClass.remove(self._popupStateNode, "dijitHasDropDownOpen");
|
||||
self._opened = false;
|
||||
}
|
||||
});
|
||||
domAttr.set(this._popupStateNode, "popupActive", "true");
|
||||
domClass.add(self._popupStateNode, "dijitHasDropDownOpen");
|
||||
this._opened=true;
|
||||
|
||||
// TODO: set this.checked and call setStateClass(), to affect button look while drop down is shown
|
||||
return retVal;
|
||||
},
|
||||
|
||||
closeDropDown: function(/*Boolean*/ focus){
|
||||
// summary:
|
||||
// Closes the drop down on this widget
|
||||
// focus:
|
||||
// If true, refocuses the button widget
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
if(this._opened){
|
||||
if(focus){ this.focus(); }
|
||||
popup.close(this.dropDown);
|
||||
this._opened = false;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
|
@ -1,95 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_KeyNavContainer",["dojo/_base/kernel","./_Container","./_FocusMixin","dojo/_base/array","dojo/keys","dojo/_base/declare","dojo/_base/event","dojo/dom-attr","dojo/_base/lang"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9){
|
||||
return _6("dijit._KeyNavContainer",[_3,_2],{tabIndex:"0",connectKeyNavHandlers:function(_a,_b){
|
||||
var _c=(this._keyNavCodes={});
|
||||
var _d=_9.hitch(this,"focusPrev");
|
||||
var _e=_9.hitch(this,"focusNext");
|
||||
_4.forEach(_a,function(_f){
|
||||
_c[_f]=_d;
|
||||
});
|
||||
_4.forEach(_b,function(_10){
|
||||
_c[_10]=_e;
|
||||
});
|
||||
_c[_5.HOME]=_9.hitch(this,"focusFirstChild");
|
||||
_c[_5.END]=_9.hitch(this,"focusLastChild");
|
||||
this.connect(this.domNode,"onkeypress","_onContainerKeypress");
|
||||
this.connect(this.domNode,"onfocus","_onContainerFocus");
|
||||
},startupKeyNavChildren:function(){
|
||||
_1.deprecated("startupKeyNavChildren() call no longer needed","","2.0");
|
||||
},startup:function(){
|
||||
this.inherited(arguments);
|
||||
_4.forEach(this.getChildren(),_9.hitch(this,"_startupChild"));
|
||||
},addChild:function(_11,_12){
|
||||
this.inherited(arguments);
|
||||
this._startupChild(_11);
|
||||
},focus:function(){
|
||||
this.focusFirstChild();
|
||||
},focusFirstChild:function(){
|
||||
this.focusChild(this._getFirstFocusableChild());
|
||||
},focusLastChild:function(){
|
||||
this.focusChild(this._getLastFocusableChild());
|
||||
},focusNext:function(){
|
||||
this.focusChild(this._getNextFocusableChild(this.focusedChild,1));
|
||||
},focusPrev:function(){
|
||||
this.focusChild(this._getNextFocusableChild(this.focusedChild,-1),true);
|
||||
},focusChild:function(_13,_14){
|
||||
if(!_13){
|
||||
return;
|
||||
}
|
||||
if(this.focusedChild&&_13!==this.focusedChild){
|
||||
this._onChildBlur(this.focusedChild);
|
||||
}
|
||||
_13.set("tabIndex",this.tabIndex);
|
||||
_13.focus(_14?"end":"start");
|
||||
this._set("focusedChild",_13);
|
||||
},_startupChild:function(_15){
|
||||
_15.set("tabIndex","-1");
|
||||
this.connect(_15,"_onFocus",function(){
|
||||
_15.set("tabIndex",this.tabIndex);
|
||||
});
|
||||
this.connect(_15,"_onBlur",function(){
|
||||
_15.set("tabIndex","-1");
|
||||
});
|
||||
},_onContainerFocus:function(evt){
|
||||
if(evt.target!==this.domNode||this.focusedChild){
|
||||
return;
|
||||
}
|
||||
this.focusFirstChild();
|
||||
_8.set(this.domNode,"tabIndex","-1");
|
||||
},_onBlur:function(evt){
|
||||
if(this.tabIndex){
|
||||
_8.set(this.domNode,"tabIndex",this.tabIndex);
|
||||
}
|
||||
this.focusedChild=null;
|
||||
this.inherited(arguments);
|
||||
},_onContainerKeypress:function(evt){
|
||||
if(evt.ctrlKey||evt.altKey){
|
||||
return;
|
||||
}
|
||||
var _16=this._keyNavCodes[evt.charOrCode];
|
||||
if(_16){
|
||||
_16();
|
||||
_7.stop(evt);
|
||||
}
|
||||
},_onChildBlur:function(){
|
||||
},_getFirstFocusableChild:function(){
|
||||
return this._getNextFocusableChild(null,1);
|
||||
},_getLastFocusableChild:function(){
|
||||
return this._getNextFocusableChild(null,-1);
|
||||
},_getNextFocusableChild:function(_17,dir){
|
||||
if(_17){
|
||||
_17=this._getSiblingOfChild(_17,dir);
|
||||
}
|
||||
var _18=this.getChildren();
|
||||
for(var i=0;i<_18.length;i++){
|
||||
if(!_17){
|
||||
_17=_18[(dir>0)?0:(_18.length-1)];
|
||||
}
|
||||
if(_17.isFocusable()){
|
||||
return _17;
|
||||
}
|
||||
_17=this._getSiblingOfChild(_17,dir);
|
||||
}
|
||||
return null;
|
||||
}});
|
||||
});
|
|
@ -1,265 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_KeyNavContainer", [
|
||||
"dojo/_base/kernel", // kernel.deprecated
|
||||
"./_Container",
|
||||
"./_FocusMixin",
|
||||
"dojo/_base/array", // array.forEach
|
||||
"dojo/keys", // keys.END keys.HOME
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/dom-attr", // domAttr.set
|
||||
"dojo/_base/lang" // lang.hitch
|
||||
], function(kernel, _Container, _FocusMixin, array, keys, declare, event, domAttr, lang){
|
||||
|
||||
/*=====
|
||||
var _FocusMixin = dijit._FocusMixin;
|
||||
var _Container = dijit._Container;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/_KeyNavContainer
|
||||
// summary:
|
||||
// A _Container with keyboard navigation of its children.
|
||||
|
||||
return declare("dijit._KeyNavContainer", [_FocusMixin, _Container], {
|
||||
|
||||
// summary:
|
||||
// A _Container with keyboard navigation of its children.
|
||||
// description:
|
||||
// To use this mixin, call connectKeyNavHandlers() in
|
||||
// postCreate().
|
||||
// It provides normalized keyboard and focusing code for Container
|
||||
// widgets.
|
||||
|
||||
/*=====
|
||||
// focusedChild: [protected] Widget
|
||||
// The currently focused child widget, or null if there isn't one
|
||||
focusedChild: null,
|
||||
=====*/
|
||||
|
||||
// tabIndex: Integer
|
||||
// Tab index of the container; same as HTML tabIndex attribute.
|
||||
// Note then when user tabs into the container, focus is immediately
|
||||
// moved to the first item in the container.
|
||||
tabIndex: "0",
|
||||
|
||||
connectKeyNavHandlers: function(/*keys[]*/ prevKeyCodes, /*keys[]*/ nextKeyCodes){
|
||||
// summary:
|
||||
// Call in postCreate() to attach the keyboard handlers
|
||||
// to the container.
|
||||
// preKeyCodes: keys[]
|
||||
// Key codes for navigating to the previous child.
|
||||
// nextKeyCodes: keys[]
|
||||
// Key codes for navigating to the next child.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
// TODO: call this automatically from my own postCreate()
|
||||
|
||||
var keyCodes = (this._keyNavCodes = {});
|
||||
var prev = lang.hitch(this, "focusPrev");
|
||||
var next = lang.hitch(this, "focusNext");
|
||||
array.forEach(prevKeyCodes, function(code){ keyCodes[code] = prev; });
|
||||
array.forEach(nextKeyCodes, function(code){ keyCodes[code] = next; });
|
||||
keyCodes[keys.HOME] = lang.hitch(this, "focusFirstChild");
|
||||
keyCodes[keys.END] = lang.hitch(this, "focusLastChild");
|
||||
this.connect(this.domNode, "onkeypress", "_onContainerKeypress");
|
||||
this.connect(this.domNode, "onfocus", "_onContainerFocus");
|
||||
},
|
||||
|
||||
startupKeyNavChildren: function(){
|
||||
kernel.deprecated("startupKeyNavChildren() call no longer needed", "", "2.0");
|
||||
},
|
||||
|
||||
startup: function(){
|
||||
this.inherited(arguments);
|
||||
array.forEach(this.getChildren(), lang.hitch(this, "_startupChild"));
|
||||
},
|
||||
|
||||
addChild: function(/*dijit._Widget*/ widget, /*int?*/ insertIndex){
|
||||
this.inherited(arguments);
|
||||
this._startupChild(widget);
|
||||
},
|
||||
|
||||
focus: function(){
|
||||
// summary:
|
||||
// Default focus() implementation: focus the first child.
|
||||
this.focusFirstChild();
|
||||
},
|
||||
|
||||
focusFirstChild: function(){
|
||||
// summary:
|
||||
// Focus the first focusable child in the container.
|
||||
// tags:
|
||||
// protected
|
||||
this.focusChild(this._getFirstFocusableChild());
|
||||
},
|
||||
|
||||
focusLastChild: function(){
|
||||
// summary:
|
||||
// Focus the last focusable child in the container.
|
||||
// tags:
|
||||
// protected
|
||||
this.focusChild(this._getLastFocusableChild());
|
||||
},
|
||||
|
||||
focusNext: function(){
|
||||
// summary:
|
||||
// Focus the next widget
|
||||
// tags:
|
||||
// protected
|
||||
this.focusChild(this._getNextFocusableChild(this.focusedChild, 1));
|
||||
},
|
||||
|
||||
focusPrev: function(){
|
||||
// summary:
|
||||
// Focus the last focusable node in the previous widget
|
||||
// (ex: go to the ComboButton icon section rather than button section)
|
||||
// tags:
|
||||
// protected
|
||||
this.focusChild(this._getNextFocusableChild(this.focusedChild, -1), true);
|
||||
},
|
||||
|
||||
focusChild: function(/*dijit._Widget*/ widget, /*Boolean*/ last){
|
||||
// summary:
|
||||
// Focus specified child widget.
|
||||
// widget:
|
||||
// Reference to container's child widget
|
||||
// last:
|
||||
// If true and if widget has multiple focusable nodes, focus the
|
||||
// last one instead of the first one
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
if(!widget){ return; }
|
||||
|
||||
if(this.focusedChild && widget !== this.focusedChild){
|
||||
this._onChildBlur(this.focusedChild); // used by _MenuBase
|
||||
}
|
||||
widget.set("tabIndex", this.tabIndex); // for IE focus outline to appear, must set tabIndex before focs
|
||||
widget.focus(last ? "end" : "start");
|
||||
this._set("focusedChild", widget);
|
||||
},
|
||||
|
||||
_startupChild: function(/*dijit._Widget*/ widget){
|
||||
// summary:
|
||||
// Setup for each child widget
|
||||
// description:
|
||||
// Sets tabIndex=-1 on each child, so that the tab key will
|
||||
// leave the container rather than visiting each child.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
widget.set("tabIndex", "-1");
|
||||
|
||||
this.connect(widget, "_onFocus", function(){
|
||||
// Set valid tabIndex so tabbing away from widget goes to right place, see #10272
|
||||
widget.set("tabIndex", this.tabIndex);
|
||||
});
|
||||
this.connect(widget, "_onBlur", function(){
|
||||
widget.set("tabIndex", "-1");
|
||||
});
|
||||
},
|
||||
|
||||
_onContainerFocus: function(evt){
|
||||
// summary:
|
||||
// Handler for when the container gets focus
|
||||
// description:
|
||||
// Initially the container itself has a tabIndex, but when it gets
|
||||
// focus, switch focus to first child...
|
||||
// tags:
|
||||
// private
|
||||
|
||||
// Note that we can't use _onFocus() because switching focus from the
|
||||
// _onFocus() handler confuses the focus.js code
|
||||
// (because it causes _onFocusNode() to be called recursively)
|
||||
// Also, _onFocus() would fire when focus went directly to a child widget due to mouse click.
|
||||
|
||||
// Ignore spurious focus events:
|
||||
// 1. focus on a child widget bubbles on FF
|
||||
// 2. on IE, clicking the scrollbar of a select dropdown moves focus from the focused child item to me
|
||||
if(evt.target !== this.domNode || this.focusedChild){ return; }
|
||||
|
||||
this.focusFirstChild();
|
||||
|
||||
// and then set the container's tabIndex to -1,
|
||||
// (don't remove as that breaks Safari 4)
|
||||
// so that tab or shift-tab will go to the fields after/before
|
||||
// the container, rather than the container itself
|
||||
domAttr.set(this.domNode, "tabIndex", "-1");
|
||||
},
|
||||
|
||||
_onBlur: function(evt){
|
||||
// When focus is moved away the container, and its descendant (popup) widgets,
|
||||
// then restore the container's tabIndex so that user can tab to it again.
|
||||
// Note that using _onBlur() so that this doesn't happen when focus is shifted
|
||||
// to one of my child widgets (typically a popup)
|
||||
if(this.tabIndex){
|
||||
domAttr.set(this.domNode, "tabIndex", this.tabIndex);
|
||||
}
|
||||
this.focusedChild = null;
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
_onContainerKeypress: function(evt){
|
||||
// summary:
|
||||
// When a key is pressed, if it's an arrow key etc. then
|
||||
// it's handled here.
|
||||
// tags:
|
||||
// private
|
||||
if(evt.ctrlKey || evt.altKey){ return; }
|
||||
var func = this._keyNavCodes[evt.charOrCode];
|
||||
if(func){
|
||||
func();
|
||||
event.stop(evt);
|
||||
}
|
||||
},
|
||||
|
||||
_onChildBlur: function(/*dijit._Widget*/ /*===== widget =====*/){
|
||||
// summary:
|
||||
// Called when focus leaves a child widget to go
|
||||
// to a sibling widget.
|
||||
// Used by MenuBase.js (TODO: move code there)
|
||||
// tags:
|
||||
// protected
|
||||
},
|
||||
|
||||
_getFirstFocusableChild: function(){
|
||||
// summary:
|
||||
// Returns first child that can be focused
|
||||
return this._getNextFocusableChild(null, 1); // dijit._Widget
|
||||
},
|
||||
|
||||
_getLastFocusableChild: function(){
|
||||
// summary:
|
||||
// Returns last child that can be focused
|
||||
return this._getNextFocusableChild(null, -1); // dijit._Widget
|
||||
},
|
||||
|
||||
_getNextFocusableChild: function(child, dir){
|
||||
// summary:
|
||||
// Returns the next or previous focusable child, compared
|
||||
// to "child"
|
||||
// child: Widget
|
||||
// The current widget
|
||||
// dir: Integer
|
||||
// * 1 = after
|
||||
// * -1 = before
|
||||
if(child){
|
||||
child = this._getSiblingOfChild(child, dir);
|
||||
}
|
||||
var children = this.getChildren();
|
||||
for(var i=0; i < children.length; i++){
|
||||
if(!child){
|
||||
child = children[(dir>0) ? 0 : (children.length-1)];
|
||||
}
|
||||
if(child.isFocusable()){
|
||||
return child; // dijit._Widget
|
||||
}
|
||||
child = this._getSiblingOfChild(child, dir);
|
||||
}
|
||||
// no focusable child found
|
||||
return null; // dijit._Widget
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,162 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_MenuBase",["./popup","dojo/window","./_Widget","./_KeyNavContainer","./_TemplatedMixin","dojo/_base/declare","dojo/dom","dojo/dom-attr","dojo/dom-class","dojo/_base/lang","dojo/_base/array"],function(pm,_1,_2,_3,_4,_5,_6,_7,_8,_9,_a){
|
||||
return _5("dijit._MenuBase",[_2,_4,_3],{parentMenu:null,popupDelay:500,onExecute:function(){
|
||||
},onCancel:function(){
|
||||
},_moveToPopup:function(_b){
|
||||
if(this.focusedChild&&this.focusedChild.popup&&!this.focusedChild.disabled){
|
||||
this.focusedChild._onClick(_b);
|
||||
}else{
|
||||
var _c=this._getTopMenu();
|
||||
if(_c&&_c._isMenuBar){
|
||||
_c.focusNext();
|
||||
}
|
||||
}
|
||||
},_onPopupHover:function(){
|
||||
if(this.currentPopup&&this.currentPopup._pendingClose_timer){
|
||||
var _d=this.currentPopup.parentMenu;
|
||||
if(_d.focusedChild){
|
||||
_d.focusedChild._setSelected(false);
|
||||
}
|
||||
_d.focusedChild=this.currentPopup.from_item;
|
||||
_d.focusedChild._setSelected(true);
|
||||
this._stopPendingCloseTimer(this.currentPopup);
|
||||
}
|
||||
},onItemHover:function(_e){
|
||||
if(this.isActive){
|
||||
this.focusChild(_e);
|
||||
if(this.focusedChild.popup&&!this.focusedChild.disabled&&!this.hover_timer){
|
||||
this.hover_timer=setTimeout(_9.hitch(this,"_openPopup"),this.popupDelay);
|
||||
}
|
||||
}
|
||||
if(this.focusedChild){
|
||||
this.focusChild(_e);
|
||||
}
|
||||
this._hoveredChild=_e;
|
||||
},_onChildBlur:function(_f){
|
||||
this._stopPopupTimer();
|
||||
_f._setSelected(false);
|
||||
var _10=_f.popup;
|
||||
if(_10){
|
||||
this._stopPendingCloseTimer(_10);
|
||||
_10._pendingClose_timer=setTimeout(function(){
|
||||
_10._pendingClose_timer=null;
|
||||
if(_10.parentMenu){
|
||||
_10.parentMenu.currentPopup=null;
|
||||
}
|
||||
pm.close(_10);
|
||||
},this.popupDelay);
|
||||
}
|
||||
},onItemUnhover:function(_11){
|
||||
if(this.isActive){
|
||||
this._stopPopupTimer();
|
||||
}
|
||||
if(this._hoveredChild==_11){
|
||||
this._hoveredChild=null;
|
||||
}
|
||||
},_stopPopupTimer:function(){
|
||||
if(this.hover_timer){
|
||||
clearTimeout(this.hover_timer);
|
||||
this.hover_timer=null;
|
||||
}
|
||||
},_stopPendingCloseTimer:function(_12){
|
||||
if(_12._pendingClose_timer){
|
||||
clearTimeout(_12._pendingClose_timer);
|
||||
_12._pendingClose_timer=null;
|
||||
}
|
||||
},_stopFocusTimer:function(){
|
||||
if(this._focus_timer){
|
||||
clearTimeout(this._focus_timer);
|
||||
this._focus_timer=null;
|
||||
}
|
||||
},_getTopMenu:function(){
|
||||
for(var top=this;top.parentMenu;top=top.parentMenu){
|
||||
}
|
||||
return top;
|
||||
},onItemClick:function(_13,evt){
|
||||
if(typeof this.isShowingNow=="undefined"){
|
||||
this._markActive();
|
||||
}
|
||||
this.focusChild(_13);
|
||||
if(_13.disabled){
|
||||
return false;
|
||||
}
|
||||
if(_13.popup){
|
||||
this._openPopup();
|
||||
}else{
|
||||
this.onExecute();
|
||||
_13.onClick(evt);
|
||||
}
|
||||
},_openPopup:function(){
|
||||
this._stopPopupTimer();
|
||||
var _14=this.focusedChild;
|
||||
if(!_14){
|
||||
return;
|
||||
}
|
||||
var _15=_14.popup;
|
||||
if(_15.isShowingNow){
|
||||
return;
|
||||
}
|
||||
if(this.currentPopup){
|
||||
this._stopPendingCloseTimer(this.currentPopup);
|
||||
pm.close(this.currentPopup);
|
||||
}
|
||||
_15.parentMenu=this;
|
||||
_15.from_item=_14;
|
||||
var _16=this;
|
||||
pm.open({parent:this,popup:_15,around:_14.domNode,orient:this._orient||["after","before"],onCancel:function(){
|
||||
_16.focusChild(_14);
|
||||
_16._cleanUp();
|
||||
_14._setSelected(true);
|
||||
_16.focusedChild=_14;
|
||||
},onExecute:_9.hitch(this,"_cleanUp")});
|
||||
this.currentPopup=_15;
|
||||
_15.connect(_15.domNode,"onmouseenter",_9.hitch(_16,"_onPopupHover"));
|
||||
if(_15.focus){
|
||||
_15._focus_timer=setTimeout(_9.hitch(_15,function(){
|
||||
this._focus_timer=null;
|
||||
this.focus();
|
||||
}),0);
|
||||
}
|
||||
},_markActive:function(){
|
||||
this.isActive=true;
|
||||
_8.replace(this.domNode,"dijitMenuActive","dijitMenuPassive");
|
||||
},onOpen:function(){
|
||||
this.isShowingNow=true;
|
||||
this._markActive();
|
||||
},_markInactive:function(){
|
||||
this.isActive=false;
|
||||
_8.replace(this.domNode,"dijitMenuPassive","dijitMenuActive");
|
||||
},onClose:function(){
|
||||
this._stopFocusTimer();
|
||||
this._markInactive();
|
||||
this.isShowingNow=false;
|
||||
this.parentMenu=null;
|
||||
},_closeChild:function(){
|
||||
this._stopPopupTimer();
|
||||
if(this.currentPopup){
|
||||
if(_a.indexOf(this._focusManager.activeStack,this.id)>=0){
|
||||
_7.set(this.focusedChild.focusNode,"tabIndex",this.tabIndex);
|
||||
this.focusedChild.focusNode.focus();
|
||||
}
|
||||
pm.close(this.currentPopup);
|
||||
this.currentPopup=null;
|
||||
}
|
||||
if(this.focusedChild){
|
||||
this.focusedChild._setSelected(false);
|
||||
this.focusedChild._onUnhover();
|
||||
this.focusedChild=null;
|
||||
}
|
||||
},_onItemFocus:function(_17){
|
||||
if(this._hoveredChild&&this._hoveredChild!=_17){
|
||||
this._hoveredChild._onUnhover();
|
||||
}
|
||||
},_onBlur:function(){
|
||||
this._cleanUp();
|
||||
this.inherited(arguments);
|
||||
},_cleanUp:function(){
|
||||
this._closeChild();
|
||||
if(typeof this.isShowingNow=="undefined"){
|
||||
this._markInactive();
|
||||
}
|
||||
}});
|
||||
});
|
|
@ -1,392 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_MenuBase", [
|
||||
"./popup",
|
||||
"dojo/window",
|
||||
"./_Widget",
|
||||
"./_KeyNavContainer",
|
||||
"./_TemplatedMixin",
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom", // dom.isDescendant domClass.replace
|
||||
"dojo/dom-attr",
|
||||
"dojo/dom-class", // domClass.replace
|
||||
"dojo/_base/lang", // lang.hitch
|
||||
"dojo/_base/array" // array.indexOf
|
||||
], function(pm, winUtils, _Widget, _KeyNavContainer, _TemplatedMixin,
|
||||
declare, dom, domAttr, domClass, lang, array){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
var _KeyNavContainer = dijit._KeyNavContainer;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/_MenuBase
|
||||
// summary:
|
||||
// Base class for Menu and MenuBar
|
||||
|
||||
return declare("dijit._MenuBase",
|
||||
[_Widget, _TemplatedMixin, _KeyNavContainer],
|
||||
{
|
||||
// summary:
|
||||
// Base class for Menu and MenuBar
|
||||
|
||||
// parentMenu: [readonly] Widget
|
||||
// pointer to menu that displayed me
|
||||
parentMenu: null,
|
||||
|
||||
// popupDelay: Integer
|
||||
// number of milliseconds before hovering (without clicking) causes the popup to automatically open.
|
||||
popupDelay: 500,
|
||||
|
||||
onExecute: function(){
|
||||
// summary:
|
||||
// Attach point for notification about when a menu item has been executed.
|
||||
// This is an internal mechanism used for Menus to signal to their parent to
|
||||
// close them, because they are about to execute the onClick handler. In
|
||||
// general developers should not attach to or override this method.
|
||||
// tags:
|
||||
// protected
|
||||
},
|
||||
|
||||
onCancel: function(/*Boolean*/ /*===== closeAll =====*/){
|
||||
// summary:
|
||||
// Attach point for notification about when the user cancels the current menu
|
||||
// This is an internal mechanism used for Menus to signal to their parent to
|
||||
// close them. In general developers should not attach to or override this method.
|
||||
// tags:
|
||||
// protected
|
||||
},
|
||||
|
||||
_moveToPopup: function(/*Event*/ evt){
|
||||
// summary:
|
||||
// This handles the right arrow key (left arrow key on RTL systems),
|
||||
// which will either open a submenu, or move to the next item in the
|
||||
// ancestor MenuBar
|
||||
// tags:
|
||||
// private
|
||||
|
||||
if(this.focusedChild && this.focusedChild.popup && !this.focusedChild.disabled){
|
||||
this.focusedChild._onClick(evt);
|
||||
}else{
|
||||
var topMenu = this._getTopMenu();
|
||||
if(topMenu && topMenu._isMenuBar){
|
||||
topMenu.focusNext();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_onPopupHover: function(/*Event*/ /*===== evt =====*/){
|
||||
// summary:
|
||||
// This handler is called when the mouse moves over the popup.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
// if the mouse hovers over a menu popup that is in pending-close state,
|
||||
// then stop the close operation.
|
||||
// This can't be done in onItemHover since some popup targets don't have MenuItems (e.g. ColorPicker)
|
||||
if(this.currentPopup && this.currentPopup._pendingClose_timer){
|
||||
var parentMenu = this.currentPopup.parentMenu;
|
||||
// highlight the parent menu item pointing to this popup
|
||||
if(parentMenu.focusedChild){
|
||||
parentMenu.focusedChild._setSelected(false);
|
||||
}
|
||||
parentMenu.focusedChild = this.currentPopup.from_item;
|
||||
parentMenu.focusedChild._setSelected(true);
|
||||
// cancel the pending close
|
||||
this._stopPendingCloseTimer(this.currentPopup);
|
||||
}
|
||||
},
|
||||
|
||||
onItemHover: function(/*MenuItem*/ item){
|
||||
// summary:
|
||||
// Called when cursor is over a MenuItem.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
// Don't do anything unless user has "activated" the menu by:
|
||||
// 1) clicking it
|
||||
// 2) opening it from a parent menu (which automatically focuses it)
|
||||
if(this.isActive){
|
||||
this.focusChild(item);
|
||||
if(this.focusedChild.popup && !this.focusedChild.disabled && !this.hover_timer){
|
||||
this.hover_timer = setTimeout(lang.hitch(this, "_openPopup"), this.popupDelay);
|
||||
}
|
||||
}
|
||||
// if the user is mixing mouse and keyboard navigation,
|
||||
// then the menu may not be active but a menu item has focus,
|
||||
// but it's not the item that the mouse just hovered over.
|
||||
// To avoid both keyboard and mouse selections, use the latest.
|
||||
if(this.focusedChild){
|
||||
this.focusChild(item);
|
||||
}
|
||||
this._hoveredChild = item;
|
||||
},
|
||||
|
||||
_onChildBlur: function(item){
|
||||
// summary:
|
||||
// Called when a child MenuItem becomes inactive because focus
|
||||
// has been removed from the MenuItem *and* it's descendant menus.
|
||||
// tags:
|
||||
// private
|
||||
this._stopPopupTimer();
|
||||
item._setSelected(false);
|
||||
// Close all popups that are open and descendants of this menu
|
||||
var itemPopup = item.popup;
|
||||
if(itemPopup){
|
||||
this._stopPendingCloseTimer(itemPopup);
|
||||
itemPopup._pendingClose_timer = setTimeout(function(){
|
||||
itemPopup._pendingClose_timer = null;
|
||||
if(itemPopup.parentMenu){
|
||||
itemPopup.parentMenu.currentPopup = null;
|
||||
}
|
||||
pm.close(itemPopup); // this calls onClose
|
||||
}, this.popupDelay);
|
||||
}
|
||||
},
|
||||
|
||||
onItemUnhover: function(/*MenuItem*/ item){
|
||||
// summary:
|
||||
// Callback fires when mouse exits a MenuItem
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
if(this.isActive){
|
||||
this._stopPopupTimer();
|
||||
}
|
||||
if(this._hoveredChild == item){ this._hoveredChild = null; }
|
||||
},
|
||||
|
||||
_stopPopupTimer: function(){
|
||||
// summary:
|
||||
// Cancels the popup timer because the user has stop hovering
|
||||
// on the MenuItem, etc.
|
||||
// tags:
|
||||
// private
|
||||
if(this.hover_timer){
|
||||
clearTimeout(this.hover_timer);
|
||||
this.hover_timer = null;
|
||||
}
|
||||
},
|
||||
|
||||
_stopPendingCloseTimer: function(/*dijit._Widget*/ popup){
|
||||
// summary:
|
||||
// Cancels the pending-close timer because the close has been preempted
|
||||
// tags:
|
||||
// private
|
||||
if(popup._pendingClose_timer){
|
||||
clearTimeout(popup._pendingClose_timer);
|
||||
popup._pendingClose_timer = null;
|
||||
}
|
||||
},
|
||||
|
||||
_stopFocusTimer: function(){
|
||||
// summary:
|
||||
// Cancels the pending-focus timer because the menu was closed before focus occured
|
||||
// tags:
|
||||
// private
|
||||
if(this._focus_timer){
|
||||
clearTimeout(this._focus_timer);
|
||||
this._focus_timer = null;
|
||||
}
|
||||
},
|
||||
|
||||
_getTopMenu: function(){
|
||||
// summary:
|
||||
// Returns the top menu in this chain of Menus
|
||||
// tags:
|
||||
// private
|
||||
for(var top=this; top.parentMenu; top=top.parentMenu);
|
||||
return top;
|
||||
},
|
||||
|
||||
onItemClick: function(/*dijit._Widget*/ item, /*Event*/ evt){
|
||||
// summary:
|
||||
// Handle clicks on an item.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
// this can't be done in _onFocus since the _onFocus events occurs asynchronously
|
||||
if(typeof this.isShowingNow == 'undefined'){ // non-popup menu
|
||||
this._markActive();
|
||||
}
|
||||
|
||||
this.focusChild(item);
|
||||
|
||||
if(item.disabled){ return false; }
|
||||
|
||||
if(item.popup){
|
||||
this._openPopup();
|
||||
}else{
|
||||
// before calling user defined handler, close hierarchy of menus
|
||||
// and restore focus to place it was when menu was opened
|
||||
this.onExecute();
|
||||
|
||||
// user defined handler for click
|
||||
item.onClick(evt);
|
||||
}
|
||||
},
|
||||
|
||||
_openPopup: function(){
|
||||
// summary:
|
||||
// Open the popup to the side of/underneath the current menu item
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
this._stopPopupTimer();
|
||||
var from_item = this.focusedChild;
|
||||
if(!from_item){ return; } // the focused child lost focus since the timer was started
|
||||
var popup = from_item.popup;
|
||||
if(popup.isShowingNow){ return; }
|
||||
if(this.currentPopup){
|
||||
this._stopPendingCloseTimer(this.currentPopup);
|
||||
pm.close(this.currentPopup);
|
||||
}
|
||||
popup.parentMenu = this;
|
||||
popup.from_item = from_item; // helps finding the parent item that should be focused for this popup
|
||||
var self = this;
|
||||
pm.open({
|
||||
parent: this,
|
||||
popup: popup,
|
||||
around: from_item.domNode,
|
||||
orient: this._orient || ["after", "before"],
|
||||
onCancel: function(){ // called when the child menu is canceled
|
||||
// set isActive=false (_closeChild vs _cleanUp) so that subsequent hovering will NOT open child menus
|
||||
// which seems aligned with the UX of most applications (e.g. notepad, wordpad, paint shop pro)
|
||||
self.focusChild(from_item); // put focus back on my node
|
||||
self._cleanUp(); // close the submenu (be sure this is done _after_ focus is moved)
|
||||
from_item._setSelected(true); // oops, _cleanUp() deselected the item
|
||||
self.focusedChild = from_item; // and unset focusedChild
|
||||
},
|
||||
onExecute: lang.hitch(this, "_cleanUp")
|
||||
});
|
||||
|
||||
this.currentPopup = popup;
|
||||
// detect mouseovers to handle lazy mouse movements that temporarily focus other menu items
|
||||
popup.connect(popup.domNode, "onmouseenter", lang.hitch(self, "_onPopupHover")); // cleaned up when the popped-up widget is destroyed on close
|
||||
|
||||
if(popup.focus){
|
||||
// If user is opening the popup via keyboard (right arrow, or down arrow for MenuBar),
|
||||
// if the cursor happens to collide with the popup, it will generate an onmouseover event
|
||||
// even though the mouse wasn't moved. Use a setTimeout() to call popup.focus so that
|
||||
// our focus() call overrides the onmouseover event, rather than vice-versa. (#8742)
|
||||
popup._focus_timer = setTimeout(lang.hitch(popup, function(){
|
||||
this._focus_timer = null;
|
||||
this.focus();
|
||||
}), 0);
|
||||
}
|
||||
},
|
||||
|
||||
_markActive: function(){
|
||||
// summary:
|
||||
// Mark this menu's state as active.
|
||||
// Called when this Menu gets focus from:
|
||||
// 1) clicking it (mouse or via space/arrow key)
|
||||
// 2) being opened by a parent menu.
|
||||
// This is not called just from mouse hover.
|
||||
// Focusing a menu via TAB does NOT automatically set isActive
|
||||
// since TAB is a navigation operation and not a selection one.
|
||||
// For Windows apps, pressing the ALT key focuses the menubar
|
||||
// menus (similar to TAB navigation) but the menu is not active
|
||||
// (ie no dropdown) until an item is clicked.
|
||||
this.isActive = true;
|
||||
domClass.replace(this.domNode, "dijitMenuActive", "dijitMenuPassive");
|
||||
},
|
||||
|
||||
onOpen: function(/*Event*/ /*===== e =====*/){
|
||||
// summary:
|
||||
// Callback when this menu is opened.
|
||||
// This is called by the popup manager as notification that the menu
|
||||
// was opened.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
this.isShowingNow = true;
|
||||
this._markActive();
|
||||
},
|
||||
|
||||
_markInactive: function(){
|
||||
// summary:
|
||||
// Mark this menu's state as inactive.
|
||||
this.isActive = false; // don't do this in _onBlur since the state is pending-close until we get here
|
||||
domClass.replace(this.domNode, "dijitMenuPassive", "dijitMenuActive");
|
||||
},
|
||||
|
||||
onClose: function(){
|
||||
// summary:
|
||||
// Callback when this menu is closed.
|
||||
// This is called by the popup manager as notification that the menu
|
||||
// was closed.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
this._stopFocusTimer();
|
||||
this._markInactive();
|
||||
this.isShowingNow = false;
|
||||
this.parentMenu = null;
|
||||
},
|
||||
|
||||
_closeChild: function(){
|
||||
// summary:
|
||||
// Called when submenu is clicked or focus is lost. Close hierarchy of menus.
|
||||
// tags:
|
||||
// private
|
||||
this._stopPopupTimer();
|
||||
|
||||
if(this.currentPopup){
|
||||
// If focus is on a descendant MenuItem then move focus to me,
|
||||
// because IE doesn't like it when you display:none a node with focus,
|
||||
// and also so keyboard users don't lose control.
|
||||
// Likely, immediately after a user defined onClick handler will move focus somewhere
|
||||
// else, like a Dialog.
|
||||
if(array.indexOf(this._focusManager.activeStack, this.id) >= 0){
|
||||
domAttr.set(this.focusedChild.focusNode, "tabIndex", this.tabIndex);
|
||||
this.focusedChild.focusNode.focus();
|
||||
}
|
||||
// Close all popups that are open and descendants of this menu
|
||||
pm.close(this.currentPopup);
|
||||
this.currentPopup = null;
|
||||
}
|
||||
|
||||
if(this.focusedChild){ // unhighlight the focused item
|
||||
this.focusedChild._setSelected(false);
|
||||
this.focusedChild._onUnhover();
|
||||
this.focusedChild = null;
|
||||
}
|
||||
},
|
||||
|
||||
_onItemFocus: function(/*MenuItem*/ item){
|
||||
// summary:
|
||||
// Called when child of this Menu gets focus from:
|
||||
// 1) clicking it
|
||||
// 2) tabbing into it
|
||||
// 3) being opened by a parent menu.
|
||||
// This is not called just from mouse hover.
|
||||
if(this._hoveredChild && this._hoveredChild != item){
|
||||
this._hoveredChild._onUnhover(); // any previous mouse movement is trumped by focus selection
|
||||
}
|
||||
},
|
||||
|
||||
_onBlur: function(){
|
||||
// summary:
|
||||
// Called when focus is moved away from this Menu and it's submenus.
|
||||
// tags:
|
||||
// protected
|
||||
this._cleanUp();
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
_cleanUp: function(){
|
||||
// summary:
|
||||
// Called when the user is done with this menu. Closes hierarchy of menus.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
this._closeChild(); // don't call this.onClose since that's incorrect for MenuBar's that never close
|
||||
if(typeof this.isShowingNow == 'undefined'){ // non-popup menu doesn't call onClose
|
||||
this._markInactive();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -1,49 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_OnDijitClickMixin",["dojo/on","dojo/_base/array","dojo/keys","dojo/_base/declare","dojo/_base/sniff","dojo/_base/unload","dojo/_base/window"],function(on,_1,_2,_3,_4,_5,_6){
|
||||
var _7=null;
|
||||
if(_4("ie")){
|
||||
(function(){
|
||||
var _8=function(_9){
|
||||
_7=_9.srcElement;
|
||||
};
|
||||
_6.doc.attachEvent("onkeydown",_8);
|
||||
_5.addOnWindowUnload(function(){
|
||||
_6.doc.detachEvent("onkeydown",_8);
|
||||
});
|
||||
})();
|
||||
}else{
|
||||
_6.doc.addEventListener("keydown",function(_a){
|
||||
_7=_a.target;
|
||||
},true);
|
||||
}
|
||||
var _b=function(_c,_d){
|
||||
if(/input|button/i.test(_c.nodeName)){
|
||||
return on(_c,"click",_d);
|
||||
}else{
|
||||
function _e(e){
|
||||
return (e.keyCode==_2.ENTER||e.keyCode==_2.SPACE)&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey;
|
||||
};
|
||||
var _f=[on(_c,"keypress",function(e){
|
||||
if(_e(e)){
|
||||
_7=e.target;
|
||||
e.preventDefault();
|
||||
}
|
||||
}),on(_c,"keyup",function(e){
|
||||
if(_e(e)&&e.target==_7){
|
||||
_7=null;
|
||||
_d.call(this,e);
|
||||
}
|
||||
}),on(_c,"click",function(e){
|
||||
_d.call(this,e);
|
||||
})];
|
||||
return {remove:function(){
|
||||
_1.forEach(_f,function(h){
|
||||
h.remove();
|
||||
});
|
||||
}};
|
||||
}
|
||||
};
|
||||
return _3("dijit._OnDijitClickMixin",null,{connect:function(obj,_10,_11){
|
||||
return this.inherited(arguments,[obj,_10=="ondijitclick"?_b:_10,_11]);
|
||||
}});
|
||||
});
|
|
@ -1,126 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_OnDijitClickMixin", [
|
||||
"dojo/on",
|
||||
"dojo/_base/array", // array.forEach
|
||||
"dojo/keys", // keys.ENTER keys.SPACE
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/sniff", // has("ie")
|
||||
"dojo/_base/unload", // unload.addOnWindowUnload
|
||||
"dojo/_base/window" // win.doc.addEventListener win.doc.attachEvent win.doc.detachEvent
|
||||
], function(on, array, keys, declare, has, unload, win){
|
||||
|
||||
// module:
|
||||
// dijit/_OnDijitClickMixin
|
||||
// summary:
|
||||
// Mixin so you can pass "ondijitclick" to this.connect() method,
|
||||
// as a way to handle clicks by mouse, or by keyboard (SPACE/ENTER key)
|
||||
|
||||
|
||||
// Keep track of where the last keydown event was, to help avoid generating
|
||||
// spurious ondijitclick events when:
|
||||
// 1. focus is on a <button> or <a>
|
||||
// 2. user presses then releases the ENTER key
|
||||
// 3. onclick handler fires and shifts focus to another node, with an ondijitclick handler
|
||||
// 4. onkeyup event fires, causing the ondijitclick handler to fire
|
||||
var lastKeyDownNode = null;
|
||||
if(has("ie")){
|
||||
(function(){
|
||||
var keydownCallback = function(evt){
|
||||
lastKeyDownNode = evt.srcElement;
|
||||
};
|
||||
win.doc.attachEvent('onkeydown', keydownCallback);
|
||||
unload.addOnWindowUnload(function(){
|
||||
win.doc.detachEvent('onkeydown', keydownCallback);
|
||||
});
|
||||
})();
|
||||
}else{
|
||||
win.doc.addEventListener('keydown', function(evt){
|
||||
lastKeyDownNode = evt.target;
|
||||
}, true);
|
||||
}
|
||||
|
||||
// Custom a11yclick (a.k.a. ondijitclick) event
|
||||
var a11yclick = function(node, listener){
|
||||
if(/input|button/i.test(node.nodeName)){
|
||||
// pass through, the browser already generates click event on SPACE/ENTER key
|
||||
return on(node, "click", listener);
|
||||
}else{
|
||||
// Don't fire the click event unless both the keydown and keyup occur on this node.
|
||||
// Avoids problems where focus shifted to this node or away from the node on keydown,
|
||||
// either causing this node to process a stray keyup event, or causing another node
|
||||
// to get a stray keyup event.
|
||||
|
||||
function clickKey(/*Event*/ e){
|
||||
return (e.keyCode == keys.ENTER || e.keyCode == keys.SPACE) &&
|
||||
!e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey;
|
||||
}
|
||||
var handles = [
|
||||
on(node, "keypress", function(e){
|
||||
//console.log(this.id + ": onkeydown, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
|
||||
if(clickKey(e)){
|
||||
// needed on IE for when focus changes between keydown and keyup - otherwise dropdown menus do not work
|
||||
lastKeyDownNode = e.target;
|
||||
|
||||
// Prevent viewport scrolling on space key in IE<9.
|
||||
// (Reproducible on test_Button.html on any of the first dijit.form.Button examples)
|
||||
// Do this onkeypress rather than onkeydown because onkeydown.preventDefault() will
|
||||
// suppress the onkeypress event, breaking _HasDropDown
|
||||
e.preventDefault();
|
||||
}
|
||||
}),
|
||||
|
||||
on(node, "keyup", function(e){
|
||||
//console.log(this.id + ": onkeyup, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
|
||||
if(clickKey(e) && e.target == lastKeyDownNode){ // === breaks greasemonkey
|
||||
//need reset here or have problems in FF when focus returns to trigger element after closing popup/alert
|
||||
lastKeyDownNode = null;
|
||||
listener.call(this, e);
|
||||
}
|
||||
}),
|
||||
|
||||
on(node, "click", function(e){
|
||||
// and connect for mouse clicks too (or touch-clicks on mobile)
|
||||
listener.call(this, e);
|
||||
})
|
||||
];
|
||||
|
||||
return {
|
||||
remove: function(){
|
||||
array.forEach(handles, function(h){ h.remove(); });
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
return declare("dijit._OnDijitClickMixin", null, {
|
||||
connect: function(
|
||||
/*Object|null*/ obj,
|
||||
/*String|Function*/ event,
|
||||
/*String|Function*/ method){
|
||||
// summary:
|
||||
// Connects specified obj/event to specified method of this object
|
||||
// and registers for disconnect() on widget destroy.
|
||||
// description:
|
||||
// Provide widget-specific analog to connect.connect, except with the
|
||||
// implicit use of this widget as the target object.
|
||||
// This version of connect also provides a special "ondijitclick"
|
||||
// event which triggers on a click or space or enter keyup.
|
||||
// Events connected with `this.connect` are disconnected upon
|
||||
// destruction.
|
||||
// returns:
|
||||
// A handle that can be passed to `disconnect` in order to disconnect before
|
||||
// the widget is destroyed.
|
||||
// example:
|
||||
// | var btn = new dijit.form.Button();
|
||||
// | // when foo.bar() is called, call the listener we're going to
|
||||
// | // provide in the scope of btn
|
||||
// | btn.connect(foo, "bar", function(){
|
||||
// | console.debug(this.toString());
|
||||
// | });
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
return this.inherited(arguments, [obj, event == "ondijitclick" ? a11yclick : event, method]);
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,93 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_PaletteMixin",["dojo/_base/declare","dojo/dom-attr","dojo/dom-class","dojo/dom-construct","dojo/_base/event","dojo/keys","dojo/_base/lang","./_CssStateMixin","./focus","./typematic"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a){
|
||||
return _1("dijit._PaletteMixin",[_8],{defaultTimeout:500,timeoutChangeRate:0.9,value:"",_selectedCell:-1,tabIndex:"0",cellClass:"dijitPaletteCell",dyeClass:"",summary:"",_setSummaryAttr:"paletteTableNode",_dyeFactory:function(_b){
|
||||
var _c=_7.getObject(this.dyeClass);
|
||||
return new _c(_b);
|
||||
},_preparePalette:function(_d,_e){
|
||||
this._cells=[];
|
||||
var _f=this._blankGif;
|
||||
this.connect(this.gridNode,"ondijitclick","_onCellClick");
|
||||
for(var row=0;row<_d.length;row++){
|
||||
var _10=_4.create("tr",{tabIndex:"-1"},this.gridNode);
|
||||
for(var col=0;col<_d[row].length;col++){
|
||||
var _11=_d[row][col];
|
||||
if(_11){
|
||||
var _12=this._dyeFactory(_11,row,col);
|
||||
var _13=_4.create("td",{"class":this.cellClass,tabIndex:"-1",title:_e[_11],role:"gridcell"});
|
||||
_12.fillCell(_13,_f);
|
||||
_4.place(_13,_10);
|
||||
_13.index=this._cells.length;
|
||||
this._cells.push({node:_13,dye:_12});
|
||||
}
|
||||
}
|
||||
}
|
||||
this._xDim=_d[0].length;
|
||||
this._yDim=_d.length;
|
||||
var _14={UP_ARROW:-this._xDim,DOWN_ARROW:this._xDim,RIGHT_ARROW:this.isLeftToRight()?1:-1,LEFT_ARROW:this.isLeftToRight()?-1:1};
|
||||
for(var key in _14){
|
||||
this._connects.push(_a.addKeyListener(this.domNode,{charOrCode:_6[key],ctrlKey:false,altKey:false,shiftKey:false},this,function(){
|
||||
var _15=_14[key];
|
||||
return function(_16){
|
||||
this._navigateByKey(_15,_16);
|
||||
};
|
||||
}(),this.timeoutChangeRate,this.defaultTimeout));
|
||||
}
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
this._setCurrent(this._cells[0].node);
|
||||
},focus:function(){
|
||||
_9.focus(this._currentFocus);
|
||||
},_onCellClick:function(evt){
|
||||
var _17=evt.target;
|
||||
while(_17.tagName!="TD"){
|
||||
if(!_17.parentNode||_17==this.gridNode){
|
||||
return;
|
||||
}
|
||||
_17=_17.parentNode;
|
||||
}
|
||||
var _18=this._getDye(_17).getValue();
|
||||
this._setCurrent(_17);
|
||||
_9.focus(_17);
|
||||
this._setValueAttr(_18,true);
|
||||
_5.stop(evt);
|
||||
},_setCurrent:function(_19){
|
||||
if("_currentFocus" in this){
|
||||
_2.set(this._currentFocus,"tabIndex","-1");
|
||||
}
|
||||
this._currentFocus=_19;
|
||||
if(_19){
|
||||
_2.set(_19,"tabIndex",this.tabIndex);
|
||||
}
|
||||
},_setValueAttr:function(_1a,_1b){
|
||||
if(this._selectedCell>=0){
|
||||
_3.remove(this._cells[this._selectedCell].node,this.cellClass+"Selected");
|
||||
}
|
||||
this._selectedCell=-1;
|
||||
if(_1a){
|
||||
for(var i=0;i<this._cells.length;i++){
|
||||
if(_1a==this._cells[i].dye.getValue()){
|
||||
this._selectedCell=i;
|
||||
_3.add(this._cells[i].node,this.cellClass+"Selected");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._set("value",this._selectedCell>=0?_1a:null);
|
||||
if(_1b||_1b===undefined){
|
||||
this.onChange(_1a);
|
||||
}
|
||||
},onChange:function(){
|
||||
},_navigateByKey:function(_1c,_1d){
|
||||
if(_1d==-1){
|
||||
return;
|
||||
}
|
||||
var _1e=this._currentFocus.index+_1c;
|
||||
if(_1e<this._cells.length&&_1e>-1){
|
||||
var _1f=this._cells[_1e].node;
|
||||
this._setCurrent(_1f);
|
||||
setTimeout(_7.hitch(dijit,"focus",_1f),0);
|
||||
}
|
||||
},_getDye:function(_20){
|
||||
return this._cells[_20.index].dye;
|
||||
}});
|
||||
});
|
|
@ -1,346 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_PaletteMixin", [
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-attr", // domAttr.set
|
||||
"dojo/dom-class", // domClass.add domClass.remove
|
||||
"dojo/dom-construct", // domConstruct.create domConstruct.place
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/keys", // keys
|
||||
"dojo/_base/lang", // lang.getObject
|
||||
"./_CssStateMixin",
|
||||
"./focus",
|
||||
"./typematic"
|
||||
], function(declare, domAttr, domClass, domConstruct, event, keys, lang, _CssStateMixin, focus, typematic){
|
||||
|
||||
/*=====
|
||||
var _CssStateMixin = dijit._CssStateMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/_PaletteMixin
|
||||
// summary:
|
||||
// A keyboard accessible palette, for picking a color/emoticon/etc.
|
||||
|
||||
return declare("dijit._PaletteMixin", [_CssStateMixin], {
|
||||
// summary:
|
||||
// A keyboard accessible palette, for picking a color/emoticon/etc.
|
||||
// description:
|
||||
// A mixin for a grid showing various entities, so the user can pick a certain entity.
|
||||
|
||||
// defaultTimeout: Number
|
||||
// Number of milliseconds before a held key or button becomes typematic
|
||||
defaultTimeout: 500,
|
||||
|
||||
// timeoutChangeRate: Number
|
||||
// Fraction of time used to change the typematic timer between events
|
||||
// 1.0 means that each typematic event fires at defaultTimeout intervals
|
||||
// < 1.0 means that each typematic event fires at an increasing faster rate
|
||||
timeoutChangeRate: 0.90,
|
||||
|
||||
// value: String
|
||||
// Currently selected color/emoticon/etc.
|
||||
value: "",
|
||||
|
||||
// _selectedCell: [private] Integer
|
||||
// Index of the currently selected cell. Initially, none selected
|
||||
_selectedCell: -1,
|
||||
|
||||
/*=====
|
||||
// _currentFocus: [private] DomNode
|
||||
// The currently focused cell (if the palette itself has focus), or otherwise
|
||||
// the cell to be focused when the palette itself gets focus.
|
||||
// Different from value, which represents the selected (i.e. clicked) cell.
|
||||
_currentFocus: null,
|
||||
=====*/
|
||||
|
||||
/*=====
|
||||
// _xDim: [protected] Integer
|
||||
// This is the number of cells horizontally across.
|
||||
_xDim: null,
|
||||
=====*/
|
||||
|
||||
/*=====
|
||||
// _yDim: [protected] Integer
|
||||
// This is the number of cells vertically down.
|
||||
_yDim: null,
|
||||
=====*/
|
||||
|
||||
// tabIndex: String
|
||||
// Widget tab index.
|
||||
tabIndex: "0",
|
||||
|
||||
// cellClass: [protected] String
|
||||
// CSS class applied to each cell in the palette
|
||||
cellClass: "dijitPaletteCell",
|
||||
|
||||
// dyeClass: [protected] String
|
||||
// Name of javascript class for Object created for each cell of the palette.
|
||||
// dyeClass should implements dijit.Dye interface
|
||||
dyeClass: '',
|
||||
|
||||
// summary: String
|
||||
// Localized summary for the palette table
|
||||
summary: '',
|
||||
_setSummaryAttr: "paletteTableNode",
|
||||
|
||||
_dyeFactory: function(value /*===== , row, col =====*/){
|
||||
// summary:
|
||||
// Return instance of dijit.Dye for specified cell of palette
|
||||
// tags:
|
||||
// extension
|
||||
var dyeClassObj = lang.getObject(this.dyeClass);
|
||||
return new dyeClassObj(value);
|
||||
},
|
||||
|
||||
_preparePalette: function(choices, titles) {
|
||||
// summary:
|
||||
// Subclass must call _preparePalette() from postCreate(), passing in the tooltip
|
||||
// for each cell
|
||||
// choices: String[][]
|
||||
// id's for each cell of the palette, used to create Dye JS object for each cell
|
||||
// titles: String[]
|
||||
// Localized tooltip for each cell
|
||||
|
||||
this._cells = [];
|
||||
var url = this._blankGif;
|
||||
|
||||
this.connect(this.gridNode, "ondijitclick", "_onCellClick");
|
||||
|
||||
for(var row=0; row < choices.length; row++){
|
||||
var rowNode = domConstruct.create("tr", {tabIndex: "-1"}, this.gridNode);
|
||||
for(var col=0; col < choices[row].length; col++){
|
||||
var value = choices[row][col];
|
||||
if(value){
|
||||
var cellObject = this._dyeFactory(value, row, col);
|
||||
|
||||
var cellNode = domConstruct.create("td", {
|
||||
"class": this.cellClass,
|
||||
tabIndex: "-1",
|
||||
title: titles[value],
|
||||
role: "gridcell"
|
||||
});
|
||||
|
||||
// prepare cell inner structure
|
||||
cellObject.fillCell(cellNode, url);
|
||||
|
||||
domConstruct.place(cellNode, rowNode);
|
||||
|
||||
cellNode.index = this._cells.length;
|
||||
|
||||
// save cell info into _cells
|
||||
this._cells.push({node:cellNode, dye:cellObject});
|
||||
}
|
||||
}
|
||||
}
|
||||
this._xDim = choices[0].length;
|
||||
this._yDim = choices.length;
|
||||
|
||||
// Now set all events
|
||||
// The palette itself is navigated to with the tab key on the keyboard
|
||||
// Keyboard navigation within the Palette is with the arrow keys
|
||||
// Spacebar selects the cell.
|
||||
// For the up key the index is changed by negative the x dimension.
|
||||
|
||||
var keyIncrementMap = {
|
||||
UP_ARROW: -this._xDim,
|
||||
// The down key the index is increase by the x dimension.
|
||||
DOWN_ARROW: this._xDim,
|
||||
// Right and left move the index by 1.
|
||||
RIGHT_ARROW: this.isLeftToRight() ? 1 : -1,
|
||||
LEFT_ARROW: this.isLeftToRight() ? -1 : 1
|
||||
};
|
||||
for(var key in keyIncrementMap){
|
||||
this._connects.push(
|
||||
typematic.addKeyListener(
|
||||
this.domNode,
|
||||
{charOrCode:keys[key], ctrlKey:false, altKey:false, shiftKey:false},
|
||||
this,
|
||||
function(){
|
||||
var increment = keyIncrementMap[key];
|
||||
return function(count){ this._navigateByKey(increment, count); };
|
||||
}(),
|
||||
this.timeoutChangeRate,
|
||||
this.defaultTimeout
|
||||
)
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
this.inherited(arguments);
|
||||
|
||||
// Set initial navigable node.
|
||||
this._setCurrent(this._cells[0].node);
|
||||
},
|
||||
|
||||
focus: function(){
|
||||
// summary:
|
||||
// Focus this widget. Puts focus on the most recently focused cell.
|
||||
|
||||
// The cell already has tabIndex set, just need to set CSS and focus it
|
||||
focus.focus(this._currentFocus);
|
||||
},
|
||||
|
||||
_onCellClick: function(/*Event*/ evt){
|
||||
// summary:
|
||||
// Handler for click, enter key & space key. Selects the cell.
|
||||
// evt:
|
||||
// The event.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
var target = evt.target;
|
||||
|
||||
// Find TD associated with click event. For ColorPalette user likely clicked IMG inside of TD
|
||||
while(target.tagName != "TD"){
|
||||
if(!target.parentNode || target == this.gridNode){ // probably can never happen, but just in case
|
||||
return;
|
||||
}
|
||||
target = target.parentNode;
|
||||
}
|
||||
|
||||
var value = this._getDye(target).getValue();
|
||||
|
||||
// First focus the clicked cell, and then send onChange() notification.
|
||||
// onChange() (via _setValueAttr) must be after the focus call, because
|
||||
// it may trigger a refocus to somewhere else (like the Editor content area), and that
|
||||
// second focus should win.
|
||||
this._setCurrent(target);
|
||||
focus.focus(target);
|
||||
this._setValueAttr(value, true);
|
||||
|
||||
event.stop(evt);
|
||||
},
|
||||
|
||||
_setCurrent: function(/*DomNode*/ node){
|
||||
// summary:
|
||||
// Sets which node is the focused cell.
|
||||
// description:
|
||||
// At any point in time there's exactly one
|
||||
// cell with tabIndex != -1. If focus is inside the palette then
|
||||
// focus is on that cell.
|
||||
//
|
||||
// After calling this method, arrow key handlers and mouse click handlers
|
||||
// should focus the cell in a setTimeout().
|
||||
// tags:
|
||||
// protected
|
||||
if("_currentFocus" in this){
|
||||
// Remove tabIndex on old cell
|
||||
domAttr.set(this._currentFocus, "tabIndex", "-1");
|
||||
}
|
||||
|
||||
// Set tabIndex of new cell
|
||||
this._currentFocus = node;
|
||||
if(node){
|
||||
domAttr.set(node, "tabIndex", this.tabIndex);
|
||||
}
|
||||
},
|
||||
|
||||
_setValueAttr: function(value, priorityChange){
|
||||
// summary:
|
||||
// This selects a cell. It triggers the onChange event.
|
||||
// value: String value of the cell to select
|
||||
// tags:
|
||||
// protected
|
||||
// priorityChange:
|
||||
// Optional parameter used to tell the select whether or not to fire
|
||||
// onChange event.
|
||||
|
||||
// clear old selected cell
|
||||
if(this._selectedCell >= 0){
|
||||
domClass.remove(this._cells[this._selectedCell].node, this.cellClass + "Selected");
|
||||
}
|
||||
this._selectedCell = -1;
|
||||
|
||||
// search for cell matching specified value
|
||||
if(value){
|
||||
for(var i = 0; i < this._cells.length; i++){
|
||||
if(value == this._cells[i].dye.getValue()){
|
||||
this._selectedCell = i;
|
||||
domClass.add(this._cells[i].node, this.cellClass + "Selected");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// record new value, or null if no matching cell
|
||||
this._set("value", this._selectedCell >= 0 ? value : null);
|
||||
|
||||
if(priorityChange || priorityChange === undefined){
|
||||
this.onChange(value);
|
||||
}
|
||||
},
|
||||
|
||||
onChange: function(/*===== value =====*/){
|
||||
// summary:
|
||||
// Callback when a cell is selected.
|
||||
// value: String
|
||||
// Value corresponding to cell.
|
||||
},
|
||||
|
||||
_navigateByKey: function(increment, typeCount){
|
||||
// summary:
|
||||
// This is the callback for typematic.
|
||||
// It changes the focus and the highlighed cell.
|
||||
// increment:
|
||||
// How much the key is navigated.
|
||||
// typeCount:
|
||||
// How many times typematic has fired.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
// typecount == -1 means the key is released.
|
||||
if(typeCount == -1){ return; }
|
||||
|
||||
var newFocusIndex = this._currentFocus.index + increment;
|
||||
if(newFocusIndex < this._cells.length && newFocusIndex > -1){
|
||||
var focusNode = this._cells[newFocusIndex].node;
|
||||
this._setCurrent(focusNode);
|
||||
|
||||
// Actually focus the node, for the benefit of screen readers.
|
||||
// Use setTimeout because IE doesn't like changing focus inside of an event handler
|
||||
setTimeout(lang.hitch(dijit, "focus", focusNode), 0);
|
||||
}
|
||||
},
|
||||
|
||||
_getDye: function(/*DomNode*/ cell){
|
||||
// summary:
|
||||
// Get JS object for given cell DOMNode
|
||||
|
||||
return this._cells[cell.index].dye;
|
||||
}
|
||||
});
|
||||
|
||||
/*=====
|
||||
declare("dijit.Dye",
|
||||
null,
|
||||
{
|
||||
// summary:
|
||||
// Interface for the JS Object associated with a palette cell (i.e. DOMNode)
|
||||
|
||||
constructor: function(alias, row, col){
|
||||
// summary:
|
||||
// Initialize according to value or alias like "white"
|
||||
// alias: String
|
||||
},
|
||||
|
||||
getValue: function(){
|
||||
// summary:
|
||||
// Return "value" of cell; meaning of "value" varies by subclass.
|
||||
// description:
|
||||
// For example color hex value, emoticon ascii value etc, entity hex value.
|
||||
},
|
||||
|
||||
fillCell: function(cell, blankGif){
|
||||
// summary:
|
||||
// Add cell DOMNode inner structure
|
||||
// cell: DomNode
|
||||
// The surrounding cell
|
||||
// blankGif: String
|
||||
// URL for blank cell image
|
||||
}
|
||||
}
|
||||
);
|
||||
=====*/
|
||||
|
||||
});
|
|
@ -1,27 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_Templated",["./_WidgetBase","./_TemplatedMixin","./_WidgetsInTemplateMixin","dojo/_base/array","dojo/_base/declare","dojo/_base/lang","dojo/_base/kernel"],function(_1,_2,_3,_4,_5,_6,_7){
|
||||
_6.extend(_1,{waiRole:"",waiState:""});
|
||||
return _5("dijit._Templated",[_2,_3],{widgetsInTemplate:false,constructor:function(){
|
||||
_7.deprecated(this.declaredClass+": dijit._Templated deprecated, use dijit._TemplatedMixin and if necessary dijit._WidgetsInTemplateMixin","","2.0");
|
||||
},_attachTemplateNodes:function(_8,_9){
|
||||
this.inherited(arguments);
|
||||
var _a=_6.isArray(_8)?_8:(_8.all||_8.getElementsByTagName("*"));
|
||||
var x=_6.isArray(_8)?0:-1;
|
||||
for(;x<_a.length;x++){
|
||||
var _b=(x==-1)?_8:_a[x];
|
||||
var _c=_9(_b,"waiRole");
|
||||
if(_c){
|
||||
_b.setAttribute("role",_c);
|
||||
}
|
||||
var _d=_9(_b,"waiState");
|
||||
if(_d){
|
||||
_4.forEach(_d.split(/\s*,\s*/),function(_e){
|
||||
if(_e.indexOf("-")!=-1){
|
||||
var _f=_e.split("-");
|
||||
_b.setAttribute("aria-"+_f[0],_f[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}});
|
||||
});
|
|
@ -1,72 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_Templated", [
|
||||
"./_WidgetBase",
|
||||
"./_TemplatedMixin",
|
||||
"./_WidgetsInTemplateMixin",
|
||||
"dojo/_base/array", // array.forEach
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/lang", // lang.extend lang.isArray
|
||||
"dojo/_base/kernel" // kernel.deprecated
|
||||
], function(_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, array, declare, lang, kernel){
|
||||
|
||||
/*=====
|
||||
var _WidgetBase = dijit._WidgetBase;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
var _WidgetsInTemplateMixin = dijit._WidgetsInTemplateMixin;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/_Templated
|
||||
// summary:
|
||||
// Deprecated mixin for widgets that are instantiated from a template.
|
||||
|
||||
// These arguments can be specified for widgets which are used in templates.
|
||||
// Since any widget can be specified as sub widgets in template, mix it
|
||||
// into the base widget class. (This is a hack, but it's effective.)
|
||||
lang.extend(_WidgetBase, {
|
||||
waiRole: "",
|
||||
waiState:""
|
||||
});
|
||||
|
||||
return declare("dijit._Templated", [_TemplatedMixin, _WidgetsInTemplateMixin], {
|
||||
// summary:
|
||||
// Deprecated mixin for widgets that are instantiated from a template.
|
||||
// Widgets should use _TemplatedMixin plus if necessary _WidgetsInTemplateMixin instead.
|
||||
|
||||
// widgetsInTemplate: [protected] Boolean
|
||||
// Should we parse the template to find widgets that might be
|
||||
// declared in markup inside it? False by default.
|
||||
widgetsInTemplate: false,
|
||||
|
||||
constructor: function(){
|
||||
kernel.deprecated(this.declaredClass + ": dijit._Templated deprecated, use dijit._TemplatedMixin and if necessary dijit._WidgetsInTemplateMixin", "", "2.0");
|
||||
},
|
||||
|
||||
_attachTemplateNodes: function(rootNode, getAttrFunc){
|
||||
|
||||
this.inherited(arguments);
|
||||
|
||||
// Do deprecated waiRole and waiState
|
||||
var nodes = lang.isArray(rootNode) ? rootNode : (rootNode.all || rootNode.getElementsByTagName("*"));
|
||||
var x = lang.isArray(rootNode) ? 0 : -1;
|
||||
for(; x<nodes.length; x++){
|
||||
var baseNode = (x == -1) ? rootNode : nodes[x];
|
||||
|
||||
// waiRole, waiState
|
||||
var role = getAttrFunc(baseNode, "waiRole");
|
||||
if(role){
|
||||
baseNode.setAttribute("role", role);
|
||||
}
|
||||
var values = getAttrFunc(baseNode, "waiState");
|
||||
if(values){
|
||||
array.forEach(values.split(/\s*,\s*/), function(stateValue){
|
||||
if(stateValue.indexOf('-') != -1){
|
||||
var pair = stateValue.split('-');
|
||||
baseNode.setAttribute("aria-"+pair[0], pair[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,140 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_TemplatedMixin",["dojo/_base/lang","dojo/touch","./_WidgetBase","dojo/string","dojo/cache","dojo/_base/array","dojo/_base/declare","dojo/dom-construct","dojo/_base/sniff","dojo/_base/unload","dojo/_base/window"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b){
|
||||
var _c=_7("dijit._TemplatedMixin",null,{templateString:null,templatePath:null,_skipNodeCache:false,_earlyTemplatedStartup:false,constructor:function(){
|
||||
this._attachPoints=[];
|
||||
this._attachEvents=[];
|
||||
},_stringRepl:function(_d){
|
||||
var _e=this.declaredClass,_f=this;
|
||||
return _4.substitute(_d,this,function(_10,key){
|
||||
if(key.charAt(0)=="!"){
|
||||
_10=_1.getObject(key.substr(1),false,_f);
|
||||
}
|
||||
if(typeof _10=="undefined"){
|
||||
throw new Error(_e+" template:"+key);
|
||||
}
|
||||
if(_10==null){
|
||||
return "";
|
||||
}
|
||||
return key.charAt(0)=="!"?_10:_10.toString().replace(/"/g,""");
|
||||
},this);
|
||||
},buildRendering:function(){
|
||||
if(!this.templateString){
|
||||
this.templateString=_5(this.templatePath,{sanitize:true});
|
||||
}
|
||||
var _11=_c.getCachedTemplate(this.templateString,this._skipNodeCache);
|
||||
var _12;
|
||||
if(_1.isString(_11)){
|
||||
_12=_8.toDom(this._stringRepl(_11));
|
||||
if(_12.nodeType!=1){
|
||||
throw new Error("Invalid template: "+_11);
|
||||
}
|
||||
}else{
|
||||
_12=_11.cloneNode(true);
|
||||
}
|
||||
this.domNode=_12;
|
||||
this.inherited(arguments);
|
||||
this._attachTemplateNodes(_12,function(n,p){
|
||||
return n.getAttribute(p);
|
||||
});
|
||||
this._beforeFillContent();
|
||||
this._fillContent(this.srcNodeRef);
|
||||
},_beforeFillContent:function(){
|
||||
},_fillContent:function(_13){
|
||||
var _14=this.containerNode;
|
||||
if(_13&&_14){
|
||||
while(_13.hasChildNodes()){
|
||||
_14.appendChild(_13.firstChild);
|
||||
}
|
||||
}
|
||||
},_attachTemplateNodes:function(_15,_16){
|
||||
var _17=_1.isArray(_15)?_15:(_15.all||_15.getElementsByTagName("*"));
|
||||
var x=_1.isArray(_15)?0:-1;
|
||||
for(;x<_17.length;x++){
|
||||
var _18=(x==-1)?_15:_17[x];
|
||||
if(this.widgetsInTemplate&&(_16(_18,"dojoType")||_16(_18,"data-dojo-type"))){
|
||||
continue;
|
||||
}
|
||||
var _19=_16(_18,"dojoAttachPoint")||_16(_18,"data-dojo-attach-point");
|
||||
if(_19){
|
||||
var _1a,_1b=_19.split(/\s*,\s*/);
|
||||
while((_1a=_1b.shift())){
|
||||
if(_1.isArray(this[_1a])){
|
||||
this[_1a].push(_18);
|
||||
}else{
|
||||
this[_1a]=_18;
|
||||
}
|
||||
this._attachPoints.push(_1a);
|
||||
}
|
||||
}
|
||||
var _1c=_16(_18,"dojoAttachEvent")||_16(_18,"data-dojo-attach-event");
|
||||
if(_1c){
|
||||
var _1d,_1e=_1c.split(/\s*,\s*/);
|
||||
var _1f=_1.trim;
|
||||
while((_1d=_1e.shift())){
|
||||
if(_1d){
|
||||
var _20=null;
|
||||
if(_1d.indexOf(":")!=-1){
|
||||
var _21=_1d.split(":");
|
||||
_1d=_1f(_21[0]);
|
||||
_20=_1f(_21[1]);
|
||||
}else{
|
||||
_1d=_1f(_1d);
|
||||
}
|
||||
if(!_20){
|
||||
_20=_1d;
|
||||
}
|
||||
this._attachEvents.push(this.connect(_18,_2[_1d]||_1d,_20));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},destroyRendering:function(){
|
||||
_6.forEach(this._attachPoints,function(_22){
|
||||
delete this[_22];
|
||||
},this);
|
||||
this._attachPoints=[];
|
||||
_6.forEach(this._attachEvents,this.disconnect,this);
|
||||
this._attachEvents=[];
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
_c._templateCache={};
|
||||
_c.getCachedTemplate=function(_23,_24){
|
||||
var _25=_c._templateCache;
|
||||
var key=_23;
|
||||
var _26=_25[key];
|
||||
if(_26){
|
||||
try{
|
||||
if(!_26.ownerDocument||_26.ownerDocument==_b.doc){
|
||||
return _26;
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
_8.destroy(_26);
|
||||
}
|
||||
_23=_4.trim(_23);
|
||||
if(_24||_23.match(/\$\{([^\}]+)\}/g)){
|
||||
return (_25[key]=_23);
|
||||
}else{
|
||||
var _27=_8.toDom(_23);
|
||||
if(_27.nodeType!=1){
|
||||
throw new Error("Invalid template: "+_23);
|
||||
}
|
||||
return (_25[key]=_27);
|
||||
}
|
||||
};
|
||||
if(_9("ie")){
|
||||
_a.addOnWindowUnload(function(){
|
||||
var _28=_c._templateCache;
|
||||
for(var key in _28){
|
||||
var _29=_28[key];
|
||||
if(typeof _29=="object"){
|
||||
_8.destroy(_29);
|
||||
}
|
||||
delete _28[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
_1.extend(_3,{dojoAttachEvent:"",dojoAttachPoint:""});
|
||||
return _c;
|
||||
});
|
|
@ -1,305 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_TemplatedMixin", [
|
||||
"dojo/_base/lang", // lang.getObject
|
||||
"dojo/touch",
|
||||
"./_WidgetBase",
|
||||
"dojo/string", // string.substitute string.trim
|
||||
"dojo/cache", // dojo.cache
|
||||
"dojo/_base/array", // array.forEach
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-construct", // domConstruct.destroy, domConstruct.toDom
|
||||
"dojo/_base/sniff", // has("ie")
|
||||
"dojo/_base/unload", // unload.addOnWindowUnload
|
||||
"dojo/_base/window" // win.doc
|
||||
], function(lang, touch, _WidgetBase, string, cache, array, declare, domConstruct, has, unload, win) {
|
||||
|
||||
/*=====
|
||||
var _WidgetBase = dijit._WidgetBase;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/_TemplatedMixin
|
||||
// summary:
|
||||
// Mixin for widgets that are instantiated from a template
|
||||
|
||||
var _TemplatedMixin = declare("dijit._TemplatedMixin", null, {
|
||||
// summary:
|
||||
// Mixin for widgets that are instantiated from a template
|
||||
|
||||
// templateString: [protected] String
|
||||
// A string that represents the widget template.
|
||||
// Use in conjunction with dojo.cache() to load from a file.
|
||||
templateString: null,
|
||||
|
||||
// templatePath: [protected deprecated] String
|
||||
// Path to template (HTML file) for this widget relative to dojo.baseUrl.
|
||||
// Deprecated: use templateString with require([... "dojo/text!..."], ...) instead
|
||||
templatePath: null,
|
||||
|
||||
// skipNodeCache: [protected] Boolean
|
||||
// If using a cached widget template nodes poses issues for a
|
||||
// particular widget class, it can set this property to ensure
|
||||
// that its template is always re-built from a string
|
||||
_skipNodeCache: false,
|
||||
|
||||
// _earlyTemplatedStartup: Boolean
|
||||
// A fallback to preserve the 1.0 - 1.3 behavior of children in
|
||||
// templates having their startup called before the parent widget
|
||||
// fires postCreate. Defaults to 'false', causing child widgets to
|
||||
// have their .startup() called immediately before a parent widget
|
||||
// .startup(), but always after the parent .postCreate(). Set to
|
||||
// 'true' to re-enable to previous, arguably broken, behavior.
|
||||
_earlyTemplatedStartup: false,
|
||||
|
||||
/*=====
|
||||
// _attachPoints: [private] String[]
|
||||
// List of widget attribute names associated with data-dojo-attach-point=... in the
|
||||
// template, ex: ["containerNode", "labelNode"]
|
||||
_attachPoints: [],
|
||||
=====*/
|
||||
|
||||
/*=====
|
||||
// _attachEvents: [private] Handle[]
|
||||
// List of connections associated with data-dojo-attach-event=... in the
|
||||
// template
|
||||
_attachEvents: [],
|
||||
=====*/
|
||||
|
||||
constructor: function(){
|
||||
this._attachPoints = [];
|
||||
this._attachEvents = [];
|
||||
},
|
||||
|
||||
_stringRepl: function(tmpl){
|
||||
// summary:
|
||||
// Does substitution of ${foo} type properties in template string
|
||||
// tags:
|
||||
// private
|
||||
var className = this.declaredClass, _this = this;
|
||||
// Cache contains a string because we need to do property replacement
|
||||
// do the property replacement
|
||||
return string.substitute(tmpl, this, function(value, key){
|
||||
if(key.charAt(0) == '!'){ value = lang.getObject(key.substr(1), false, _this); }
|
||||
if(typeof value == "undefined"){ throw new Error(className+" template:"+key); } // a debugging aide
|
||||
if(value == null){ return ""; }
|
||||
|
||||
// Substitution keys beginning with ! will skip the transform step,
|
||||
// in case a user wishes to insert unescaped markup, e.g. ${!foo}
|
||||
return key.charAt(0) == "!" ? value :
|
||||
// Safer substitution, see heading "Attribute values" in
|
||||
// http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2
|
||||
value.toString().replace(/"/g,"""); //TODO: add &? use encodeXML method?
|
||||
}, this);
|
||||
},
|
||||
|
||||
buildRendering: function(){
|
||||
// summary:
|
||||
// Construct the UI for this widget from a template, setting this.domNode.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
if(!this.templateString){
|
||||
this.templateString = cache(this.templatePath, {sanitize: true});
|
||||
}
|
||||
|
||||
// Lookup cached version of template, and download to cache if it
|
||||
// isn't there already. Returns either a DomNode or a string, depending on
|
||||
// whether or not the template contains ${foo} replacement parameters.
|
||||
var cached = _TemplatedMixin.getCachedTemplate(this.templateString, this._skipNodeCache);
|
||||
|
||||
var node;
|
||||
if(lang.isString(cached)){
|
||||
node = domConstruct.toDom(this._stringRepl(cached));
|
||||
if(node.nodeType != 1){
|
||||
// Flag common problems such as templates with multiple top level nodes (nodeType == 11)
|
||||
throw new Error("Invalid template: " + cached);
|
||||
}
|
||||
}else{
|
||||
// if it's a node, all we have to do is clone it
|
||||
node = cached.cloneNode(true);
|
||||
}
|
||||
|
||||
this.domNode = node;
|
||||
|
||||
// Call down to _Widget.buildRendering() to get base classes assigned
|
||||
// TODO: change the baseClass assignment to _setBaseClassAttr
|
||||
this.inherited(arguments);
|
||||
|
||||
// recurse through the node, looking for, and attaching to, our
|
||||
// attachment points and events, which should be defined on the template node.
|
||||
this._attachTemplateNodes(node, function(n,p){ return n.getAttribute(p); });
|
||||
|
||||
this._beforeFillContent(); // hook for _WidgetsInTemplateMixin
|
||||
|
||||
this._fillContent(this.srcNodeRef);
|
||||
},
|
||||
|
||||
_beforeFillContent: function(){
|
||||
},
|
||||
|
||||
_fillContent: function(/*DomNode*/ source){
|
||||
// summary:
|
||||
// Relocate source contents to templated container node.
|
||||
// this.containerNode must be able to receive children, or exceptions will be thrown.
|
||||
// tags:
|
||||
// protected
|
||||
var dest = this.containerNode;
|
||||
if(source && dest){
|
||||
while(source.hasChildNodes()){
|
||||
dest.appendChild(source.firstChild);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_attachTemplateNodes: function(rootNode, getAttrFunc){
|
||||
// summary:
|
||||
// Iterate through the template and attach functions and nodes accordingly.
|
||||
// Alternately, if rootNode is an array of widgets, then will process data-dojo-attach-point
|
||||
// etc. for those widgets.
|
||||
// description:
|
||||
// Map widget properties and functions to the handlers specified in
|
||||
// the dom node and it's descendants. This function iterates over all
|
||||
// nodes and looks for these properties:
|
||||
// * dojoAttachPoint/data-dojo-attach-point
|
||||
// * dojoAttachEvent/data-dojo-attach-event
|
||||
// rootNode: DomNode|Widget[]
|
||||
// the node to search for properties. All children will be searched.
|
||||
// getAttrFunc: Function
|
||||
// a function which will be used to obtain property for a given
|
||||
// DomNode/Widget
|
||||
// tags:
|
||||
// private
|
||||
|
||||
var nodes = lang.isArray(rootNode) ? rootNode : (rootNode.all || rootNode.getElementsByTagName("*"));
|
||||
var x = lang.isArray(rootNode) ? 0 : -1;
|
||||
for(; x<nodes.length; x++){
|
||||
var baseNode = (x == -1) ? rootNode : nodes[x];
|
||||
if(this.widgetsInTemplate && (getAttrFunc(baseNode, "dojoType") || getAttrFunc(baseNode, "data-dojo-type"))){
|
||||
continue;
|
||||
}
|
||||
// Process data-dojo-attach-point
|
||||
var attachPoint = getAttrFunc(baseNode, "dojoAttachPoint") || getAttrFunc(baseNode, "data-dojo-attach-point");
|
||||
if(attachPoint){
|
||||
var point, points = attachPoint.split(/\s*,\s*/);
|
||||
while((point = points.shift())){
|
||||
if(lang.isArray(this[point])){
|
||||
this[point].push(baseNode);
|
||||
}else{
|
||||
this[point]=baseNode;
|
||||
}
|
||||
this._attachPoints.push(point);
|
||||
}
|
||||
}
|
||||
|
||||
// Process data-dojo-attach-event
|
||||
var attachEvent = getAttrFunc(baseNode, "dojoAttachEvent") || getAttrFunc(baseNode, "data-dojo-attach-event");
|
||||
if(attachEvent){
|
||||
// NOTE: we want to support attributes that have the form
|
||||
// "domEvent: nativeEvent; ..."
|
||||
var event, events = attachEvent.split(/\s*,\s*/);
|
||||
var trim = lang.trim;
|
||||
while((event = events.shift())){
|
||||
if(event){
|
||||
var thisFunc = null;
|
||||
if(event.indexOf(":") != -1){
|
||||
// oh, if only JS had tuple assignment
|
||||
var funcNameArr = event.split(":");
|
||||
event = trim(funcNameArr[0]);
|
||||
thisFunc = trim(funcNameArr[1]);
|
||||
}else{
|
||||
event = trim(event);
|
||||
}
|
||||
if(!thisFunc){
|
||||
thisFunc = event;
|
||||
}
|
||||
// Map "press", "move" and "release" to keys.touch, keys.move, keys.release
|
||||
this._attachEvents.push(this.connect(baseNode, touch[event] || event, thisFunc));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
destroyRendering: function(){
|
||||
// Delete all attach points to prevent IE6 memory leaks.
|
||||
array.forEach(this._attachPoints, function(point){
|
||||
delete this[point];
|
||||
}, this);
|
||||
this._attachPoints = [];
|
||||
|
||||
// And same for event handlers
|
||||
array.forEach(this._attachEvents, this.disconnect, this);
|
||||
this._attachEvents = [];
|
||||
|
||||
this.inherited(arguments);
|
||||
}
|
||||
});
|
||||
|
||||
// key is templateString; object is either string or DOM tree
|
||||
_TemplatedMixin._templateCache = {};
|
||||
|
||||
_TemplatedMixin.getCachedTemplate = function(templateString, alwaysUseString){
|
||||
// summary:
|
||||
// Static method to get a template based on the templatePath or
|
||||
// templateString key
|
||||
// templateString: String
|
||||
// The template
|
||||
// alwaysUseString: Boolean
|
||||
// Don't cache the DOM tree for this template, even if it doesn't have any variables
|
||||
// returns: Mixed
|
||||
// Either string (if there are ${} variables that need to be replaced) or just
|
||||
// a DOM tree (if the node can be cloned directly)
|
||||
|
||||
// is it already cached?
|
||||
var tmplts = _TemplatedMixin._templateCache;
|
||||
var key = templateString;
|
||||
var cached = tmplts[key];
|
||||
if(cached){
|
||||
try{
|
||||
// if the cached value is an innerHTML string (no ownerDocument) or a DOM tree created within the current document, then use the current cached value
|
||||
if(!cached.ownerDocument || cached.ownerDocument == win.doc){
|
||||
// string or node of the same document
|
||||
return cached;
|
||||
}
|
||||
}catch(e){ /* squelch */ } // IE can throw an exception if cached.ownerDocument was reloaded
|
||||
domConstruct.destroy(cached);
|
||||
}
|
||||
|
||||
templateString = string.trim(templateString);
|
||||
|
||||
if(alwaysUseString || templateString.match(/\$\{([^\}]+)\}/g)){
|
||||
// there are variables in the template so all we can do is cache the string
|
||||
return (tmplts[key] = templateString); //String
|
||||
}else{
|
||||
// there are no variables in the template so we can cache the DOM tree
|
||||
var node = domConstruct.toDom(templateString);
|
||||
if(node.nodeType != 1){
|
||||
throw new Error("Invalid template: " + templateString);
|
||||
}
|
||||
return (tmplts[key] = node); //Node
|
||||
}
|
||||
};
|
||||
|
||||
if(has("ie")){
|
||||
unload.addOnWindowUnload(function(){
|
||||
var cache = _TemplatedMixin._templateCache;
|
||||
for(var key in cache){
|
||||
var value = cache[key];
|
||||
if(typeof value == "object"){ // value is either a string or a DOM node template
|
||||
domConstruct.destroy(value);
|
||||
}
|
||||
delete cache[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// These arguments can be specified for widgets which are used in templates.
|
||||
// Since any widget can be specified as sub widgets in template, mix it
|
||||
// into the base widget class. (This is a hack, but it's effective.)
|
||||
lang.extend(_WidgetBase,{
|
||||
dojoAttachEvent: "",
|
||||
dojoAttachPoint: ""
|
||||
});
|
||||
|
||||
return _TemplatedMixin;
|
||||
});
|
|
@ -1,219 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{"url:dijit/templates/TimePicker.html":"<div id=\"widget_${id}\" class=\"dijitMenu\"\n ><div data-dojo-attach-point=\"upArrow\" class=\"dijitButtonNode dijitUpArrowButton\" data-dojo-attach-event=\"onmouseenter:_buttonMouse,onmouseleave:_buttonMouse\"\n\t\t><div class=\"dijitReset dijitInline dijitArrowButtonInner\" role=\"presentation\"> </div\n\t\t><div class=\"dijitArrowButtonChar\">▲</div></div\n ><div data-dojo-attach-point=\"timeMenu,focusNode\" data-dojo-attach-event=\"onclick:_onOptionSelected,onmouseover,onmouseout\"></div\n ><div data-dojo-attach-point=\"downArrow\" class=\"dijitButtonNode dijitDownArrowButton\" data-dojo-attach-event=\"onmouseenter:_buttonMouse,onmouseleave:_buttonMouse\"\n\t\t><div class=\"dijitReset dijitInline dijitArrowButtonInner\" role=\"presentation\"> </div\n\t\t><div class=\"dijitArrowButtonChar\">▼</div></div\n></div>\n"}});
|
||||
define("dijit/_TimePicker",["dojo/_base/array","dojo/date","dojo/date/locale","dojo/date/stamp","dojo/_base/declare","dojo/dom-class","dojo/dom-construct","dojo/_base/event","dojo/_base/kernel","dojo/keys","dojo/_base/lang","dojo/_base/sniff","dojo/query","dijit/typematic","./_Widget","./_TemplatedMixin","./form/_FormValueWidget","dojo/text!./templates/TimePicker.html"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f,_10,_11,_12){
|
||||
return _5("dijit._TimePicker",[_f,_10],{templateString:_12,baseClass:"dijitTimePicker",clickableIncrement:"T00:15:00",visibleIncrement:"T01:00:00",visibleRange:"T05:00:00",value:new Date(),_visibleIncrement:2,_clickableIncrement:1,_totalIncrements:10,constraints:{},serialize:_4.toISOString,setValue:function(_13){
|
||||
_9.deprecated("dijit._TimePicker:setValue() is deprecated. Use set('value', ...) instead.","","2.0");
|
||||
this.set("value",_13);
|
||||
},_setValueAttr:function(_14){
|
||||
this._set("value",_14);
|
||||
this._showText();
|
||||
},_setFilterStringAttr:function(val){
|
||||
this._set("filterString",val);
|
||||
this._showText();
|
||||
},isDisabledDate:function(){
|
||||
return false;
|
||||
},_getFilteredNodes:function(_15,_16,_17,_18){
|
||||
var _19=[],_1a=_18?_18.date:this._refDate,n,i=_15,max=this._maxIncrement+Math.abs(i),chk=_17?-1:1,dec=_17?1:0,inc=1-dec;
|
||||
do{
|
||||
i-=dec;
|
||||
n=this._createOption(i);
|
||||
if(n){
|
||||
if((_17&&n.date>_1a)||(!_17&&n.date<_1a)){
|
||||
break;
|
||||
}
|
||||
_19[_17?"unshift":"push"](n);
|
||||
_1a=n.date;
|
||||
}
|
||||
i+=inc;
|
||||
}while(_19.length<_16&&(i*chk)<max);
|
||||
return _19;
|
||||
},_showText:function(){
|
||||
var _1b=_4.fromISOString;
|
||||
this.timeMenu.innerHTML="";
|
||||
this._clickableIncrementDate=_1b(this.clickableIncrement);
|
||||
this._visibleIncrementDate=_1b(this.visibleIncrement);
|
||||
this._visibleRangeDate=_1b(this.visibleRange);
|
||||
var _1c=function(_1d){
|
||||
return _1d.getHours()*60*60+_1d.getMinutes()*60+_1d.getSeconds();
|
||||
},_1e=_1c(this._clickableIncrementDate),_1f=_1c(this._visibleIncrementDate),_20=_1c(this._visibleRangeDate),_21=(this.value||this.currentFocus).getTime();
|
||||
this._refDate=new Date(_21-_21%(_1e*1000));
|
||||
this._refDate.setFullYear(1970,0,1);
|
||||
this._clickableIncrement=1;
|
||||
this._totalIncrements=_20/_1e;
|
||||
this._visibleIncrement=_1f/_1e;
|
||||
this._maxIncrement=(60*60*24)/_1e;
|
||||
var _22=Math.min(this._totalIncrements,10),_23=this._getFilteredNodes(0,(_22>>1)+1,false),_24=[],_25=_22-_23.length,_26=this._getFilteredNodes(0,_25,true,_23[0]);
|
||||
if(_26.length<_25&&_23.length>0){
|
||||
_24=this._getFilteredNodes(_23.length,_25-_26.length,false,_23[_23.length-1]);
|
||||
}
|
||||
_1.forEach(_26.concat(_23,_24),function(n){
|
||||
this.timeMenu.appendChild(n);
|
||||
},this);
|
||||
},constructor:function(){
|
||||
this.constraints={};
|
||||
},postMixInProperties:function(){
|
||||
this.inherited(arguments);
|
||||
this._setConstraintsAttr(this.constraints);
|
||||
},_setConstraintsAttr:function(_27){
|
||||
_b.mixin(this,_27);
|
||||
if(!_27.locale){
|
||||
_27.locale=this.lang;
|
||||
}
|
||||
},postCreate:function(){
|
||||
this.connect(this.timeMenu,_c("ie")?"onmousewheel":"DOMMouseScroll","_mouseWheeled");
|
||||
this._connects.push(_e.addMouseListener(this.upArrow,this,"_onArrowUp",33,250));
|
||||
this._connects.push(_e.addMouseListener(this.downArrow,this,"_onArrowDown",33,250));
|
||||
this.inherited(arguments);
|
||||
},_buttonMouse:function(e){
|
||||
_6.toggle(e.currentTarget,e.currentTarget==this.upArrow?"dijitUpArrowHover":"dijitDownArrowHover",e.type=="mouseenter"||e.type=="mouseover");
|
||||
},_createOption:function(_28){
|
||||
var _29=new Date(this._refDate);
|
||||
var _2a=this._clickableIncrementDate;
|
||||
_29.setHours(_29.getHours()+_2a.getHours()*_28,_29.getMinutes()+_2a.getMinutes()*_28,_29.getSeconds()+_2a.getSeconds()*_28);
|
||||
if(this.constraints.selector=="time"){
|
||||
_29.setFullYear(1970,0,1);
|
||||
}
|
||||
var _2b=_3.format(_29,this.constraints);
|
||||
if(this.filterString&&_2b.toLowerCase().indexOf(this.filterString)!==0){
|
||||
return null;
|
||||
}
|
||||
var div=_7.create("div",{"class":this.baseClass+"Item"});
|
||||
div.date=_29;
|
||||
div.index=_28;
|
||||
_7.create("div",{"class":this.baseClass+"ItemInner",innerHTML:_2b},div);
|
||||
if(_28%this._visibleIncrement<1&&_28%this._visibleIncrement>-1){
|
||||
_6.add(div,this.baseClass+"Marker");
|
||||
}else{
|
||||
if(!(_28%this._clickableIncrement)){
|
||||
_6.add(div,this.baseClass+"Tick");
|
||||
}
|
||||
}
|
||||
if(this.isDisabledDate(_29)){
|
||||
_6.add(div,this.baseClass+"ItemDisabled");
|
||||
}
|
||||
if(this.value&&!_2.compare(this.value,_29,this.constraints.selector)){
|
||||
div.selected=true;
|
||||
_6.add(div,this.baseClass+"ItemSelected");
|
||||
if(_6.contains(div,this.baseClass+"Marker")){
|
||||
_6.add(div,this.baseClass+"MarkerSelected");
|
||||
}else{
|
||||
_6.add(div,this.baseClass+"TickSelected");
|
||||
}
|
||||
this._highlightOption(div,true);
|
||||
}
|
||||
return div;
|
||||
},_onOptionSelected:function(tgt){
|
||||
var _2c=tgt.target.date||tgt.target.parentNode.date;
|
||||
if(!_2c||this.isDisabledDate(_2c)){
|
||||
return;
|
||||
}
|
||||
this._highlighted_option=null;
|
||||
this.set("value",_2c);
|
||||
this.onChange(_2c);
|
||||
},onChange:function(){
|
||||
},_highlightOption:function(_2d,_2e){
|
||||
if(!_2d){
|
||||
return;
|
||||
}
|
||||
if(_2e){
|
||||
if(this._highlighted_option){
|
||||
this._highlightOption(this._highlighted_option,false);
|
||||
}
|
||||
this._highlighted_option=_2d;
|
||||
}else{
|
||||
if(this._highlighted_option!==_2d){
|
||||
return;
|
||||
}else{
|
||||
this._highlighted_option=null;
|
||||
}
|
||||
}
|
||||
_6.toggle(_2d,this.baseClass+"ItemHover",_2e);
|
||||
if(_6.contains(_2d,this.baseClass+"Marker")){
|
||||
_6.toggle(_2d,this.baseClass+"MarkerHover",_2e);
|
||||
}else{
|
||||
_6.toggle(_2d,this.baseClass+"TickHover",_2e);
|
||||
}
|
||||
},onmouseover:function(e){
|
||||
this._keyboardSelected=null;
|
||||
var tgr=(e.target.parentNode===this.timeMenu)?e.target:e.target.parentNode;
|
||||
if(!_6.contains(tgr,this.baseClass+"Item")){
|
||||
return;
|
||||
}
|
||||
this._highlightOption(tgr,true);
|
||||
},onmouseout:function(e){
|
||||
this._keyboardSelected=null;
|
||||
var tgr=(e.target.parentNode===this.timeMenu)?e.target:e.target.parentNode;
|
||||
this._highlightOption(tgr,false);
|
||||
},_mouseWheeled:function(e){
|
||||
this._keyboardSelected=null;
|
||||
_8.stop(e);
|
||||
var _2f=(_c("ie")?e.wheelDelta:-e.detail);
|
||||
this[(_2f>0?"_onArrowUp":"_onArrowDown")]();
|
||||
},_onArrowUp:function(_30){
|
||||
if(typeof _30=="number"&&_30==-1){
|
||||
return;
|
||||
}
|
||||
if(!this.timeMenu.childNodes.length){
|
||||
return;
|
||||
}
|
||||
var _31=this.timeMenu.childNodes[0].index;
|
||||
var _32=this._getFilteredNodes(_31,1,true,this.timeMenu.childNodes[0]);
|
||||
if(_32.length){
|
||||
this.timeMenu.removeChild(this.timeMenu.childNodes[this.timeMenu.childNodes.length-1]);
|
||||
this.timeMenu.insertBefore(_32[0],this.timeMenu.childNodes[0]);
|
||||
}
|
||||
},_onArrowDown:function(_33){
|
||||
if(typeof _33=="number"&&_33==-1){
|
||||
return;
|
||||
}
|
||||
if(!this.timeMenu.childNodes.length){
|
||||
return;
|
||||
}
|
||||
var _34=this.timeMenu.childNodes[this.timeMenu.childNodes.length-1].index+1;
|
||||
var _35=this._getFilteredNodes(_34,1,false,this.timeMenu.childNodes[this.timeMenu.childNodes.length-1]);
|
||||
if(_35.length){
|
||||
this.timeMenu.removeChild(this.timeMenu.childNodes[0]);
|
||||
this.timeMenu.appendChild(_35[0]);
|
||||
}
|
||||
},handleKey:function(e){
|
||||
if(e.charOrCode==_a.DOWN_ARROW||e.charOrCode==_a.UP_ARROW){
|
||||
_8.stop(e);
|
||||
if(this._highlighted_option&&!this._highlighted_option.parentNode){
|
||||
this._highlighted_option=null;
|
||||
}
|
||||
var _36=this.timeMenu,tgt=this._highlighted_option||_d("."+this.baseClass+"ItemSelected",_36)[0];
|
||||
if(!tgt){
|
||||
tgt=_36.childNodes[0];
|
||||
}else{
|
||||
if(_36.childNodes.length){
|
||||
if(e.charOrCode==_a.DOWN_ARROW&&!tgt.nextSibling){
|
||||
this._onArrowDown();
|
||||
}else{
|
||||
if(e.charOrCode==_a.UP_ARROW&&!tgt.previousSibling){
|
||||
this._onArrowUp();
|
||||
}
|
||||
}
|
||||
if(e.charOrCode==_a.DOWN_ARROW){
|
||||
tgt=tgt.nextSibling;
|
||||
}else{
|
||||
tgt=tgt.previousSibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._highlightOption(tgt,true);
|
||||
this._keyboardSelected=tgt;
|
||||
return false;
|
||||
}else{
|
||||
if(e.charOrCode==_a.ENTER||e.charOrCode===_a.TAB){
|
||||
if(!this._keyboardSelected&&e.charOrCode===_a.TAB){
|
||||
return true;
|
||||
}
|
||||
if(this._highlighted_option){
|
||||
this._onOptionSelected({target:this._highlighted_option});
|
||||
}
|
||||
return e.charOrCode===_a.TAB;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}});
|
||||
});
|
|
@ -1,507 +0,0 @@
|
|||
//>>built
|
||||
require({cache:{
|
||||
'url:dijit/templates/TimePicker.html':"<div id=\"widget_${id}\" class=\"dijitMenu\"\n ><div data-dojo-attach-point=\"upArrow\" class=\"dijitButtonNode dijitUpArrowButton\" data-dojo-attach-event=\"onmouseenter:_buttonMouse,onmouseleave:_buttonMouse\"\n\t\t><div class=\"dijitReset dijitInline dijitArrowButtonInner\" role=\"presentation\"> </div\n\t\t><div class=\"dijitArrowButtonChar\">▲</div></div\n ><div data-dojo-attach-point=\"timeMenu,focusNode\" data-dojo-attach-event=\"onclick:_onOptionSelected,onmouseover,onmouseout\"></div\n ><div data-dojo-attach-point=\"downArrow\" class=\"dijitButtonNode dijitDownArrowButton\" data-dojo-attach-event=\"onmouseenter:_buttonMouse,onmouseleave:_buttonMouse\"\n\t\t><div class=\"dijitReset dijitInline dijitArrowButtonInner\" role=\"presentation\"> </div\n\t\t><div class=\"dijitArrowButtonChar\">▼</div></div\n></div>\n"}});
|
||||
define("dijit/_TimePicker", [
|
||||
"dojo/_base/array", // array.forEach
|
||||
"dojo/date", // date.compare
|
||||
"dojo/date/locale", // locale.format
|
||||
"dojo/date/stamp", // stamp.fromISOString stamp.toISOString
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom-class", // domClass.add domClass.contains domClass.toggle
|
||||
"dojo/dom-construct", // domConstruct.create
|
||||
"dojo/_base/event", // event.stop
|
||||
"dojo/_base/kernel", // deprecated
|
||||
"dojo/keys", // keys
|
||||
"dojo/_base/lang", // lang.mixin
|
||||
"dojo/_base/sniff", // has("ie")
|
||||
"dojo/query", // query
|
||||
"dijit/typematic",
|
||||
"./_Widget",
|
||||
"./_TemplatedMixin",
|
||||
"./form/_FormValueWidget",
|
||||
"dojo/text!./templates/TimePicker.html"
|
||||
], function(array, ddate, locale, stamp, declare, domClass, domConstruct, event, kernel, keys, lang, has, query,
|
||||
typematic, _Widget, _TemplatedMixin, _FormValueWidget, template){
|
||||
|
||||
/*=====
|
||||
var _Widget = dijit._Widget;
|
||||
var _TemplatedMixin = dijit._TemplatedMixin;
|
||||
var _FormValueWidget = dijit.form._FormValueWidget;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/_TimePicker
|
||||
// summary:
|
||||
// A graphical time picker.
|
||||
|
||||
|
||||
/*=====
|
||||
declare(
|
||||
"dijit._TimePicker.__Constraints",
|
||||
locale.__FormatOptions,
|
||||
{
|
||||
// clickableIncrement: String
|
||||
// See `dijit._TimePicker.clickableIncrement`
|
||||
clickableIncrement: "T00:15:00",
|
||||
|
||||
// visibleIncrement: String
|
||||
// See `dijit._TimePicker.visibleIncrement`
|
||||
visibleIncrement: "T01:00:00",
|
||||
|
||||
// visibleRange: String
|
||||
// See `dijit._TimePicker.visibleRange`
|
||||
visibleRange: "T05:00:00"
|
||||
}
|
||||
);
|
||||
=====*/
|
||||
|
||||
return declare("dijit._TimePicker", [_Widget, _TemplatedMixin], {
|
||||
// summary:
|
||||
// A graphical time picker.
|
||||
// This widget is used internally by other widgets and is not available
|
||||
// as a standalone widget due to lack of accessibility support.
|
||||
|
||||
templateString: template,
|
||||
|
||||
// baseClass: [protected] String
|
||||
// The root className to use for the various states of this widget
|
||||
baseClass: "dijitTimePicker",
|
||||
|
||||
// clickableIncrement: String
|
||||
// ISO-8601 string representing the amount by which
|
||||
// every clickable element in the time picker increases.
|
||||
// Set in local time, without a time zone.
|
||||
// Example: `T00:15:00` creates 15 minute increments
|
||||
// Must divide dijit._TimePicker.visibleIncrement evenly
|
||||
clickableIncrement: "T00:15:00",
|
||||
|
||||
// visibleIncrement: String
|
||||
// ISO-8601 string representing the amount by which
|
||||
// every element with a visible time in the time picker increases.
|
||||
// Set in local time, without a time zone.
|
||||
// Example: `T01:00:00` creates text in every 1 hour increment
|
||||
visibleIncrement: "T01:00:00",
|
||||
|
||||
// visibleRange: String
|
||||
// ISO-8601 string representing the range of this TimePicker.
|
||||
// The TimePicker will only display times in this range.
|
||||
// Example: `T05:00:00` displays 5 hours of options
|
||||
visibleRange: "T05:00:00",
|
||||
|
||||
// value: String
|
||||
// Date to display.
|
||||
// Defaults to current time and date.
|
||||
// Can be a Date object or an ISO-8601 string.
|
||||
// If you specify the GMT time zone (`-01:00`),
|
||||
// the time will be converted to the local time in the local time zone.
|
||||
// Otherwise, the time is considered to be in the local time zone.
|
||||
// If you specify the date and isDate is true, the date is used.
|
||||
// Example: if your local time zone is `GMT -05:00`,
|
||||
// `T10:00:00` becomes `T10:00:00-05:00` (considered to be local time),
|
||||
// `T10:00:00-01:00` becomes `T06:00:00-05:00` (4 hour difference),
|
||||
// `T10:00:00Z` becomes `T05:00:00-05:00` (5 hour difference between Zulu and local time)
|
||||
// `yyyy-mm-ddThh:mm:ss` is the format to set the date and time
|
||||
// Example: `2007-06-01T09:00:00`
|
||||
value: new Date(),
|
||||
|
||||
_visibleIncrement:2,
|
||||
_clickableIncrement:1,
|
||||
_totalIncrements:10,
|
||||
|
||||
// constraints: dijit._TimePicker.__Constraints
|
||||
// Specifies valid range of times (start time, end time)
|
||||
constraints:{},
|
||||
|
||||
/*=====
|
||||
serialize: function(val, options){
|
||||
// summary:
|
||||
// User overridable function used to convert the attr('value') result to a String
|
||||
// val: Date
|
||||
// The current value
|
||||
// options: Object?
|
||||
// tags:
|
||||
// protected
|
||||
},
|
||||
=====*/
|
||||
serialize: stamp.toISOString,
|
||||
|
||||
/*=====
|
||||
// filterString: string
|
||||
// The string to filter by
|
||||
filterString: "",
|
||||
=====*/
|
||||
|
||||
setValue: function(/*Date*/ value){
|
||||
// summary:
|
||||
// Deprecated. Used set('value') instead.
|
||||
// tags:
|
||||
// deprecated
|
||||
kernel.deprecated("dijit._TimePicker:setValue() is deprecated. Use set('value', ...) instead.", "", "2.0");
|
||||
this.set('value', value);
|
||||
},
|
||||
|
||||
_setValueAttr: function(/*Date*/ date){
|
||||
// summary:
|
||||
// Hook so set('value', ...) works.
|
||||
// description:
|
||||
// Set the value of the TimePicker.
|
||||
// Redraws the TimePicker around the new date.
|
||||
// tags:
|
||||
// protected
|
||||
this._set("value", date);
|
||||
this._showText();
|
||||
},
|
||||
|
||||
_setFilterStringAttr: function(val){
|
||||
// summary:
|
||||
// Called by TimeTextBox to filter the values shown in my list
|
||||
this._set("filterString", val);
|
||||
this._showText();
|
||||
},
|
||||
|
||||
isDisabledDate: function(/*===== dateObject, locale =====*/){
|
||||
// summary:
|
||||
// May be overridden to disable certain dates in the TimePicker e.g. `isDisabledDate=locale.isWeekend`
|
||||
// dateObject: Date
|
||||
// locale: String?
|
||||
// type:
|
||||
// extension
|
||||
return false; // Boolean
|
||||
},
|
||||
|
||||
_getFilteredNodes: function(/*number*/ start, /*number*/ maxNum, /*Boolean*/ before, /*DOMnode*/ lastNode){
|
||||
// summary:
|
||||
// Returns an array of nodes with the filter applied. At most maxNum nodes
|
||||
// will be returned - but fewer may be returned as well. If the
|
||||
// before parameter is set to true, then it will return the elements
|
||||
// before the given index
|
||||
// tags:
|
||||
// private
|
||||
var
|
||||
nodes = [],
|
||||
lastValue = lastNode ? lastNode.date : this._refDate,
|
||||
n,
|
||||
i = start,
|
||||
max = this._maxIncrement + Math.abs(i),
|
||||
chk = before ? -1 : 1,
|
||||
dec = before ? 1 : 0,
|
||||
inc = 1 - dec;
|
||||
do{
|
||||
i -= dec;
|
||||
n = this._createOption(i);
|
||||
if(n){
|
||||
if((before && n.date > lastValue) || (!before && n.date < lastValue)){
|
||||
break; // don't wrap
|
||||
}
|
||||
nodes[before ? "unshift" : "push"](n);
|
||||
lastValue = n.date;
|
||||
}
|
||||
i += inc;
|
||||
}while(nodes.length < maxNum && (i*chk) < max);
|
||||
return nodes;
|
||||
},
|
||||
|
||||
_showText: function(){
|
||||
// summary:
|
||||
// Displays the relevant choices in the drop down list
|
||||
// tags:
|
||||
// private
|
||||
var fromIso = stamp.fromISOString;
|
||||
this.timeMenu.innerHTML = "";
|
||||
this._clickableIncrementDate=fromIso(this.clickableIncrement);
|
||||
this._visibleIncrementDate=fromIso(this.visibleIncrement);
|
||||
this._visibleRangeDate=fromIso(this.visibleRange);
|
||||
// get the value of the increments and the range in seconds (since 00:00:00) to find out how many divs to create
|
||||
var
|
||||
sinceMidnight = function(/*Date*/ date){
|
||||
return date.getHours() * 60 * 60 + date.getMinutes() * 60 + date.getSeconds();
|
||||
},
|
||||
clickableIncrementSeconds = sinceMidnight(this._clickableIncrementDate),
|
||||
visibleIncrementSeconds = sinceMidnight(this._visibleIncrementDate),
|
||||
visibleRangeSeconds = sinceMidnight(this._visibleRangeDate),
|
||||
// round reference date to previous visible increment
|
||||
time = (this.value || this.currentFocus).getTime();
|
||||
|
||||
this._refDate = new Date(time - time % (clickableIncrementSeconds*1000));
|
||||
this._refDate.setFullYear(1970,0,1); // match parse defaults
|
||||
|
||||
// assume clickable increment is the smallest unit
|
||||
this._clickableIncrement = 1;
|
||||
// divide the visible range by the clickable increment to get the number of divs to create
|
||||
// example: 10:00:00/00:15:00 -> display 40 divs
|
||||
this._totalIncrements = visibleRangeSeconds / clickableIncrementSeconds;
|
||||
// divide the visible increments by the clickable increments to get how often to display the time inline
|
||||
// example: 01:00:00/00:15:00 -> display the time every 4 divs
|
||||
this._visibleIncrement = visibleIncrementSeconds / clickableIncrementSeconds;
|
||||
// divide the number of seconds in a day by the clickable increment in seconds to get the
|
||||
// absolute max number of increments.
|
||||
this._maxIncrement = (60 * 60 * 24) / clickableIncrementSeconds;
|
||||
|
||||
var
|
||||
// Find the nodes we should display based on our filter.
|
||||
// Limit to 10 nodes displayed as a half-hearted attempt to stop drop down from overlapping <input>.
|
||||
count = Math.min(this._totalIncrements, 10),
|
||||
after = this._getFilteredNodes(0, (count >> 1) + 1, false),
|
||||
moreAfter = [],
|
||||
estBeforeLength = count - after.length,
|
||||
before = this._getFilteredNodes(0, estBeforeLength, true, after[0]);
|
||||
if(before.length < estBeforeLength && after.length > 0){
|
||||
moreAfter = this._getFilteredNodes(after.length, estBeforeLength - before.length, false, after[after.length-1]);
|
||||
}
|
||||
array.forEach(before.concat(after, moreAfter), function(n){ this.timeMenu.appendChild(n); }, this);
|
||||
},
|
||||
|
||||
constructor: function(){
|
||||
this.constraints = {}; // create instance object
|
||||
},
|
||||
|
||||
postMixInProperties: function(){
|
||||
this.inherited(arguments);
|
||||
this._setConstraintsAttr(this.constraints); // this needs to happen now (and later) due to codependency on _set*Attr calls
|
||||
},
|
||||
|
||||
_setConstraintsAttr: function(/* Object */ constraints){
|
||||
// brings in visibleRange, increments, etc.
|
||||
lang.mixin(this, constraints);
|
||||
|
||||
// locale needs the lang in the constraints as locale
|
||||
if(!constraints.locale){
|
||||
constraints.locale = this.lang;
|
||||
}
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
// assign typematic mouse listeners to the arrow buttons
|
||||
this.connect(this.timeMenu, has("ie") ? "onmousewheel" : 'DOMMouseScroll', "_mouseWheeled");
|
||||
this._connects.push(typematic.addMouseListener(this.upArrow, this, "_onArrowUp", 33, 250));
|
||||
this._connects.push(typematic.addMouseListener(this.downArrow, this, "_onArrowDown", 33, 250));
|
||||
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
_buttonMouse: function(/*Event*/ e){
|
||||
// summary:
|
||||
// Handler for hover (and unhover) on up/down arrows
|
||||
// tags:
|
||||
// private
|
||||
|
||||
// in non-IE browser the "mouseenter" event will become "mouseover",
|
||||
// but in IE it's still "mouseenter"
|
||||
domClass.toggle(e.currentTarget, e.currentTarget == this.upArrow ? "dijitUpArrowHover" : "dijitDownArrowHover",
|
||||
e.type == "mouseenter" || e.type == "mouseover");
|
||||
},
|
||||
|
||||
_createOption: function(/*Number*/ index){
|
||||
// summary:
|
||||
// Creates a clickable time option
|
||||
// tags:
|
||||
// private
|
||||
var date = new Date(this._refDate);
|
||||
var incrementDate = this._clickableIncrementDate;
|
||||
date.setHours(date.getHours() + incrementDate.getHours() * index,
|
||||
date.getMinutes() + incrementDate.getMinutes() * index,
|
||||
date.getSeconds() + incrementDate.getSeconds() * index);
|
||||
if(this.constraints.selector == "time"){
|
||||
date.setFullYear(1970,0,1); // make sure each time is for the same date
|
||||
}
|
||||
var dateString = locale.format(date, this.constraints);
|
||||
if(this.filterString && dateString.toLowerCase().indexOf(this.filterString) !== 0){
|
||||
// Doesn't match the filter - return null
|
||||
return null;
|
||||
}
|
||||
|
||||
var div = domConstruct.create("div", {"class": this.baseClass+"Item"});
|
||||
div.date = date;
|
||||
div.index = index;
|
||||
domConstruct.create('div',{
|
||||
"class": this.baseClass + "ItemInner",
|
||||
innerHTML: dateString
|
||||
}, div);
|
||||
|
||||
if(index%this._visibleIncrement<1 && index%this._visibleIncrement>-1){
|
||||
domClass.add(div, this.baseClass+"Marker");
|
||||
}else if(!(index%this._clickableIncrement)){
|
||||
domClass.add(div, this.baseClass+"Tick");
|
||||
}
|
||||
|
||||
if(this.isDisabledDate(date)){
|
||||
// set disabled
|
||||
domClass.add(div, this.baseClass+"ItemDisabled");
|
||||
}
|
||||
if(this.value && !ddate.compare(this.value, date, this.constraints.selector)){
|
||||
div.selected = true;
|
||||
domClass.add(div, this.baseClass+"ItemSelected");
|
||||
if(domClass.contains(div, this.baseClass+"Marker")){
|
||||
domClass.add(div, this.baseClass+"MarkerSelected");
|
||||
}else{
|
||||
domClass.add(div, this.baseClass+"TickSelected");
|
||||
}
|
||||
|
||||
// Initially highlight the current value. User can change highlight by up/down arrow keys
|
||||
// or mouse movement.
|
||||
this._highlightOption(div, true);
|
||||
}
|
||||
return div;
|
||||
},
|
||||
|
||||
_onOptionSelected: function(/*Object*/ tgt){
|
||||
// summary:
|
||||
// Called when user clicks an option in the drop down list
|
||||
// tags:
|
||||
// private
|
||||
var tdate = tgt.target.date || tgt.target.parentNode.date;
|
||||
if(!tdate || this.isDisabledDate(tdate)){ return; }
|
||||
this._highlighted_option = null;
|
||||
this.set('value', tdate);
|
||||
this.onChange(tdate);
|
||||
},
|
||||
|
||||
onChange: function(/*Date*/ /*===== time =====*/){
|
||||
// summary:
|
||||
// Notification that a time was selected. It may be the same as the previous value.
|
||||
// tags:
|
||||
// public
|
||||
},
|
||||
|
||||
_highlightOption: function(/*node*/ node, /*Boolean*/ highlight){
|
||||
// summary:
|
||||
// Turns on/off highlight effect on a node based on mouse out/over event
|
||||
// tags:
|
||||
// private
|
||||
if(!node){return;}
|
||||
if(highlight){
|
||||
if(this._highlighted_option){
|
||||
this._highlightOption(this._highlighted_option, false);
|
||||
}
|
||||
this._highlighted_option = node;
|
||||
}else if(this._highlighted_option !== node){
|
||||
return;
|
||||
}else{
|
||||
this._highlighted_option = null;
|
||||
}
|
||||
domClass.toggle(node, this.baseClass+"ItemHover", highlight);
|
||||
if(domClass.contains(node, this.baseClass+"Marker")){
|
||||
domClass.toggle(node, this.baseClass+"MarkerHover", highlight);
|
||||
}else{
|
||||
domClass.toggle(node, this.baseClass+"TickHover", highlight);
|
||||
}
|
||||
},
|
||||
|
||||
onmouseover: function(/*Event*/ e){
|
||||
// summary:
|
||||
// Handler for onmouseover event
|
||||
// tags:
|
||||
// private
|
||||
this._keyboardSelected = null;
|
||||
var tgr = (e.target.parentNode === this.timeMenu) ? e.target : e.target.parentNode;
|
||||
// if we aren't targeting an item, then we return
|
||||
if(!domClass.contains(tgr, this.baseClass+"Item")){return;}
|
||||
this._highlightOption(tgr, true);
|
||||
},
|
||||
|
||||
onmouseout: function(/*Event*/ e){
|
||||
// summary:
|
||||
// Handler for onmouseout event
|
||||
// tags:
|
||||
// private
|
||||
this._keyboardSelected = null;
|
||||
var tgr = (e.target.parentNode === this.timeMenu) ? e.target : e.target.parentNode;
|
||||
this._highlightOption(tgr, false);
|
||||
},
|
||||
|
||||
_mouseWheeled: function(/*Event*/ e){
|
||||
// summary:
|
||||
// Handle the mouse wheel events
|
||||
// tags:
|
||||
// private
|
||||
this._keyboardSelected = null;
|
||||
event.stop(e);
|
||||
// we're not _measuring_ the scroll amount, just direction
|
||||
var scrollAmount = (has("ie") ? e.wheelDelta : -e.detail);
|
||||
this[(scrollAmount>0 ? "_onArrowUp" : "_onArrowDown")](); // yes, we're making a new dom node every time you mousewheel, or click
|
||||
},
|
||||
|
||||
_onArrowUp: function(count){
|
||||
// summary:
|
||||
// Handler for up arrow key.
|
||||
// description:
|
||||
// Removes the bottom time and add one to the top
|
||||
// tags:
|
||||
// private
|
||||
if(typeof count == "number" && count == -1){ return; } // typematic end
|
||||
if(!this.timeMenu.childNodes.length){ return; }
|
||||
var index = this.timeMenu.childNodes[0].index;
|
||||
var divs = this._getFilteredNodes(index, 1, true, this.timeMenu.childNodes[0]);
|
||||
if(divs.length){
|
||||
this.timeMenu.removeChild(this.timeMenu.childNodes[this.timeMenu.childNodes.length - 1]);
|
||||
this.timeMenu.insertBefore(divs[0], this.timeMenu.childNodes[0]);
|
||||
}
|
||||
},
|
||||
|
||||
_onArrowDown: function(count){
|
||||
// summary:
|
||||
// Handler for up arrow key.
|
||||
// description:
|
||||
// Remove the top time and add one to the bottom
|
||||
// tags:
|
||||
// private
|
||||
if(typeof count == "number" && count == -1){ return; } // typematic end
|
||||
if(!this.timeMenu.childNodes.length){ return; }
|
||||
var index = this.timeMenu.childNodes[this.timeMenu.childNodes.length - 1].index + 1;
|
||||
var divs = this._getFilteredNodes(index, 1, false, this.timeMenu.childNodes[this.timeMenu.childNodes.length - 1]);
|
||||
if(divs.length){
|
||||
this.timeMenu.removeChild(this.timeMenu.childNodes[0]);
|
||||
this.timeMenu.appendChild(divs[0]);
|
||||
}
|
||||
},
|
||||
|
||||
handleKey: function(/*Event*/ e){
|
||||
// summary:
|
||||
// Called from `dijit.form._DateTimeTextBox` to pass a keypress event
|
||||
// from the `dijit.form.TimeTextBox` to be handled in this widget
|
||||
// tags:
|
||||
// protected
|
||||
if(e.charOrCode == keys.DOWN_ARROW || e.charOrCode == keys.UP_ARROW){
|
||||
event.stop(e);
|
||||
// Figure out which option to highlight now and then highlight it
|
||||
if(this._highlighted_option && !this._highlighted_option.parentNode){
|
||||
this._highlighted_option = null;
|
||||
}
|
||||
var timeMenu = this.timeMenu,
|
||||
tgt = this._highlighted_option || query("." + this.baseClass + "ItemSelected", timeMenu)[0];
|
||||
if(!tgt){
|
||||
tgt = timeMenu.childNodes[0];
|
||||
}else if(timeMenu.childNodes.length){
|
||||
if(e.charOrCode == keys.DOWN_ARROW && !tgt.nextSibling){
|
||||
this._onArrowDown();
|
||||
}else if(e.charOrCode == keys.UP_ARROW && !tgt.previousSibling){
|
||||
this._onArrowUp();
|
||||
}
|
||||
if(e.charOrCode == keys.DOWN_ARROW){
|
||||
tgt = tgt.nextSibling;
|
||||
}else{
|
||||
tgt = tgt.previousSibling;
|
||||
}
|
||||
}
|
||||
this._highlightOption(tgt, true);
|
||||
this._keyboardSelected = tgt;
|
||||
return false;
|
||||
}else if(e.charOrCode == keys.ENTER || e.charOrCode === keys.TAB){
|
||||
// mouse hover followed by TAB is NO selection
|
||||
if(!this._keyboardSelected && e.charOrCode === keys.TAB){
|
||||
return true; // true means don't call stopEvent()
|
||||
}
|
||||
|
||||
// Accept the currently-highlighted option as the value
|
||||
if(this._highlighted_option){
|
||||
this._onOptionSelected({target: this._highlighted_option});
|
||||
}
|
||||
|
||||
// Call stopEvent() for ENTER key so that form doesn't submit,
|
||||
// but not for TAB, so that TAB does switch focus
|
||||
return e.charOrCode === keys.TAB;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,73 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_Widget",["dojo/aspect","dojo/_base/config","dojo/_base/connect","dojo/_base/declare","dojo/_base/kernel","dojo/_base/lang","dojo/query","dojo/ready","./registry","./_WidgetBase","./_OnDijitClickMixin","./_FocusMixin","dojo/uacss","./hccss"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c){
|
||||
function _d(){
|
||||
};
|
||||
function _e(_f){
|
||||
return function(obj,_10,_11,_12){
|
||||
if(obj&&typeof _10=="string"&&obj[_10]==_d){
|
||||
return obj.on(_10.substring(2).toLowerCase(),_6.hitch(_11,_12));
|
||||
}
|
||||
return _f.apply(_3,arguments);
|
||||
};
|
||||
};
|
||||
_1.around(_3,"connect",_e);
|
||||
if(_5.connect){
|
||||
_1.around(_5,"connect",_e);
|
||||
}
|
||||
var _13=_4("dijit._Widget",[_a,_b,_c],{onClick:_d,onDblClick:_d,onKeyDown:_d,onKeyPress:_d,onKeyUp:_d,onMouseDown:_d,onMouseMove:_d,onMouseOut:_d,onMouseOver:_d,onMouseLeave:_d,onMouseEnter:_d,onMouseUp:_d,constructor:function(_14){
|
||||
this._toConnect={};
|
||||
for(var _15 in _14){
|
||||
if(this[_15]===_d){
|
||||
this._toConnect[_15.replace(/^on/,"").toLowerCase()]=_14[_15];
|
||||
delete _14[_15];
|
||||
}
|
||||
}
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
for(var _16 in this._toConnect){
|
||||
this.on(_16,this._toConnect[_16]);
|
||||
}
|
||||
delete this._toConnect;
|
||||
},on:function(_17,_18){
|
||||
if(this[this._onMap(_17)]===_d){
|
||||
return _3.connect(this.domNode,_17.toLowerCase(),this,_18);
|
||||
}
|
||||
return this.inherited(arguments);
|
||||
},_setFocusedAttr:function(val){
|
||||
this._focused=val;
|
||||
this._set("focused",val);
|
||||
},setAttribute:function(_19,_1a){
|
||||
_5.deprecated(this.declaredClass+"::setAttribute(attr, value) is deprecated. Use set() instead.","","2.0");
|
||||
this.set(_19,_1a);
|
||||
},attr:function(_1b,_1c){
|
||||
if(_2.isDebug){
|
||||
var _1d=arguments.callee._ach||(arguments.callee._ach={}),_1e=(arguments.callee.caller||"unknown caller").toString();
|
||||
if(!_1d[_1e]){
|
||||
_5.deprecated(this.declaredClass+"::attr() is deprecated. Use get() or set() instead, called from "+_1e,"","2.0");
|
||||
_1d[_1e]=true;
|
||||
}
|
||||
}
|
||||
var _1f=arguments.length;
|
||||
if(_1f>=2||typeof _1b==="object"){
|
||||
return this.set.apply(this,arguments);
|
||||
}else{
|
||||
return this.get(_1b);
|
||||
}
|
||||
},getDescendants:function(){
|
||||
_5.deprecated(this.declaredClass+"::getDescendants() is deprecated. Use getChildren() instead.","","2.0");
|
||||
return this.containerNode?_7("[widgetId]",this.containerNode).map(_9.byNode):[];
|
||||
},_onShow:function(){
|
||||
this.onShow();
|
||||
},onShow:function(){
|
||||
},onHide:function(){
|
||||
},onClose:function(){
|
||||
return true;
|
||||
}});
|
||||
if(!_5.isAsync){
|
||||
_8(0,function(){
|
||||
var _20=["dijit/_base"];
|
||||
require(_20);
|
||||
});
|
||||
}
|
||||
return _13;
|
||||
});
|
|
@ -1,352 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_Widget", [
|
||||
"dojo/aspect", // aspect.around
|
||||
"dojo/_base/config", // config.isDebug
|
||||
"dojo/_base/connect", // connect.connect
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/_base/kernel", // kernel.deprecated
|
||||
"dojo/_base/lang", // lang.hitch
|
||||
"dojo/query",
|
||||
"dojo/ready",
|
||||
"./registry", // registry.byNode
|
||||
"./_WidgetBase",
|
||||
"./_OnDijitClickMixin",
|
||||
"./_FocusMixin",
|
||||
"dojo/uacss", // browser sniffing (included for back-compat; subclasses may be using)
|
||||
"./hccss" // high contrast mode sniffing (included to set CSS classes on <body>, module ret value unused)
|
||||
], function(aspect, config, connect, declare, kernel, lang, query, ready,
|
||||
registry, _WidgetBase, _OnDijitClickMixin, _FocusMixin){
|
||||
|
||||
/*=====
|
||||
var _WidgetBase = dijit._WidgetBase;
|
||||
var _OnDijitClickMixin = dijit._OnDijitClickMixin;
|
||||
var _FocusMixin = dijit._FocusMixin;
|
||||
=====*/
|
||||
|
||||
|
||||
// module:
|
||||
// dijit/_Widget
|
||||
// summary:
|
||||
// Old base for widgets. New widgets should extend _WidgetBase instead
|
||||
|
||||
|
||||
function connectToDomNode(){
|
||||
// summary:
|
||||
// If user connects to a widget method === this function, then they will
|
||||
// instead actually be connecting the equivalent event on this.domNode
|
||||
}
|
||||
|
||||
// Trap dojo.connect() calls to connectToDomNode methods, and redirect to _Widget.on()
|
||||
function aroundAdvice(originalConnect){
|
||||
return function(obj, event, scope, method){
|
||||
if(obj && typeof event == "string" && obj[event] == connectToDomNode){
|
||||
return obj.on(event.substring(2).toLowerCase(), lang.hitch(scope, method));
|
||||
}
|
||||
return originalConnect.apply(connect, arguments);
|
||||
};
|
||||
}
|
||||
aspect.around(connect, "connect", aroundAdvice);
|
||||
if(kernel.connect){
|
||||
aspect.around(kernel, "connect", aroundAdvice);
|
||||
}
|
||||
|
||||
var _Widget = declare("dijit._Widget", [_WidgetBase, _OnDijitClickMixin, _FocusMixin], {
|
||||
// summary:
|
||||
// Base class for all Dijit widgets.
|
||||
//
|
||||
// Extends _WidgetBase, adding support for:
|
||||
// - declaratively/programatically specifying widget initialization parameters like
|
||||
// onMouseMove="foo" that call foo when this.domNode gets a mousemove event
|
||||
// - ondijitclick
|
||||
// Support new data-dojo-attach-event="ondijitclick: ..." that is triggered by a mouse click or a SPACE/ENTER keypress
|
||||
// - focus related functions
|
||||
// In particular, the onFocus()/onBlur() callbacks. Driven internally by
|
||||
// dijit/_base/focus.js.
|
||||
// - deprecated methods
|
||||
// - onShow(), onHide(), onClose()
|
||||
//
|
||||
// Also, by loading code in dijit/_base, turns on:
|
||||
// - browser sniffing (putting browser id like .dj_ie on <html> node)
|
||||
// - high contrast mode sniffing (add .dijit_a11y class to <body> if machine is in high contrast mode)
|
||||
|
||||
|
||||
////////////////// DEFERRED CONNECTS ///////////////////
|
||||
|
||||
onClick: connectToDomNode,
|
||||
/*=====
|
||||
onClick: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of mouse click events.
|
||||
// event:
|
||||
// mouse Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
onDblClick: connectToDomNode,
|
||||
/*=====
|
||||
onDblClick: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of mouse double click events.
|
||||
// event:
|
||||
// mouse Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
onKeyDown: connectToDomNode,
|
||||
/*=====
|
||||
onKeyDown: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of keys being pressed down.
|
||||
// event:
|
||||
// key Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
onKeyPress: connectToDomNode,
|
||||
/*=====
|
||||
onKeyPress: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of printable keys being typed.
|
||||
// event:
|
||||
// key Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
onKeyUp: connectToDomNode,
|
||||
/*=====
|
||||
onKeyUp: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of keys being released.
|
||||
// event:
|
||||
// key Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
onMouseDown: connectToDomNode,
|
||||
/*=====
|
||||
onMouseDown: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of when the mouse button is pressed down.
|
||||
// event:
|
||||
// mouse Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
onMouseMove: connectToDomNode,
|
||||
/*=====
|
||||
onMouseMove: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.
|
||||
// event:
|
||||
// mouse Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
onMouseOut: connectToDomNode,
|
||||
/*=====
|
||||
onMouseOut: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.
|
||||
// event:
|
||||
// mouse Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
onMouseOver: connectToDomNode,
|
||||
/*=====
|
||||
onMouseOver: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.
|
||||
// event:
|
||||
// mouse Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
onMouseLeave: connectToDomNode,
|
||||
/*=====
|
||||
onMouseLeave: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of when the mouse moves off of this widget.
|
||||
// event:
|
||||
// mouse Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
onMouseEnter: connectToDomNode,
|
||||
/*=====
|
||||
onMouseEnter: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of when the mouse moves onto this widget.
|
||||
// event:
|
||||
// mouse Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
onMouseUp: connectToDomNode,
|
||||
/*=====
|
||||
onMouseUp: function(event){
|
||||
// summary:
|
||||
// Connect to this function to receive notifications of when the mouse button is released.
|
||||
// event:
|
||||
// mouse Event
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
=====*/
|
||||
|
||||
constructor: function(params){
|
||||
// extract parameters like onMouseMove that should connect directly to this.domNode
|
||||
this._toConnect = {};
|
||||
for(var name in params){
|
||||
if(this[name] === connectToDomNode){
|
||||
this._toConnect[name.replace(/^on/, "").toLowerCase()] = params[name];
|
||||
delete params[name];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
this.inherited(arguments);
|
||||
|
||||
// perform connection from this.domNode to user specified handlers (ex: onMouseMove)
|
||||
for(var name in this._toConnect){
|
||||
this.on(name, this._toConnect[name]);
|
||||
}
|
||||
delete this._toConnect;
|
||||
},
|
||||
|
||||
on: function(/*String*/ type, /*Function*/ func){
|
||||
if(this[this._onMap(type)] === connectToDomNode){
|
||||
// Use connect.connect() rather than on() to get handling for "onmouseenter" on non-IE, etc.
|
||||
// Also, need to specify context as "this" rather than the default context of the DOMNode
|
||||
return connect.connect(this.domNode, type.toLowerCase(), this, func);
|
||||
}
|
||||
return this.inherited(arguments);
|
||||
},
|
||||
|
||||
_setFocusedAttr: function(val){
|
||||
// Remove this method in 2.0 (or sooner), just here to set _focused == focused, for back compat
|
||||
// (but since it's a private variable we aren't required to keep supporting it).
|
||||
this._focused = val;
|
||||
this._set("focused", val);
|
||||
},
|
||||
|
||||
////////////////// DEPRECATED METHODS ///////////////////
|
||||
|
||||
setAttribute: function(/*String*/ attr, /*anything*/ value){
|
||||
// summary:
|
||||
// Deprecated. Use set() instead.
|
||||
// tags:
|
||||
// deprecated
|
||||
kernel.deprecated(this.declaredClass+"::setAttribute(attr, value) is deprecated. Use set() instead.", "", "2.0");
|
||||
this.set(attr, value);
|
||||
},
|
||||
|
||||
attr: function(/*String|Object*/name, /*Object?*/value){
|
||||
// summary:
|
||||
// Set or get properties on a widget instance.
|
||||
// name:
|
||||
// The property to get or set. If an object is passed here and not
|
||||
// a string, its keys are used as names of attributes to be set
|
||||
// and the value of the object as values to set in the widget.
|
||||
// value:
|
||||
// Optional. If provided, attr() operates as a setter. If omitted,
|
||||
// the current value of the named property is returned.
|
||||
// description:
|
||||
// This method is deprecated, use get() or set() directly.
|
||||
|
||||
// Print deprecation warning but only once per calling function
|
||||
if(config.isDebug){
|
||||
var alreadyCalledHash = arguments.callee._ach || (arguments.callee._ach = {}),
|
||||
caller = (arguments.callee.caller || "unknown caller").toString();
|
||||
if(!alreadyCalledHash[caller]){
|
||||
kernel.deprecated(this.declaredClass + "::attr() is deprecated. Use get() or set() instead, called from " +
|
||||
caller, "", "2.0");
|
||||
alreadyCalledHash[caller] = true;
|
||||
}
|
||||
}
|
||||
|
||||
var args = arguments.length;
|
||||
if(args >= 2 || typeof name === "object"){ // setter
|
||||
return this.set.apply(this, arguments);
|
||||
}else{ // getter
|
||||
return this.get(name);
|
||||
}
|
||||
},
|
||||
|
||||
getDescendants: function(){
|
||||
// summary:
|
||||
// Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode.
|
||||
// This method should generally be avoided as it returns widgets declared in templates, which are
|
||||
// supposed to be internal/hidden, but it's left here for back-compat reasons.
|
||||
|
||||
kernel.deprecated(this.declaredClass+"::getDescendants() is deprecated. Use getChildren() instead.", "", "2.0");
|
||||
return this.containerNode ? query('[widgetId]', this.containerNode).map(registry.byNode) : []; // dijit._Widget[]
|
||||
},
|
||||
|
||||
////////////////// MISCELLANEOUS METHODS ///////////////////
|
||||
|
||||
_onShow: function(){
|
||||
// summary:
|
||||
// Internal method called when this widget is made visible.
|
||||
// See `onShow` for details.
|
||||
this.onShow();
|
||||
},
|
||||
|
||||
onShow: function(){
|
||||
// summary:
|
||||
// Called when this widget becomes the selected pane in a
|
||||
// `dijit.layout.TabContainer`, `dijit.layout.StackContainer`,
|
||||
// `dijit.layout.AccordionContainer`, etc.
|
||||
//
|
||||
// Also called to indicate display of a `dijit.Dialog`, `dijit.TooltipDialog`, or `dijit.TitlePane`.
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
|
||||
onHide: function(){
|
||||
// summary:
|
||||
// Called when another widget becomes the selected pane in a
|
||||
// `dijit.layout.TabContainer`, `dijit.layout.StackContainer`,
|
||||
// `dijit.layout.AccordionContainer`, etc.
|
||||
//
|
||||
// Also called to indicate hide of a `dijit.Dialog`, `dijit.TooltipDialog`, or `dijit.TitlePane`.
|
||||
// tags:
|
||||
// callback
|
||||
},
|
||||
|
||||
onClose: function(){
|
||||
// summary:
|
||||
// Called when this widget is being displayed as a popup (ex: a Calendar popped
|
||||
// up from a DateTextBox), and it is hidden.
|
||||
// This is called from the dijit.popup code, and should not be called directly.
|
||||
//
|
||||
// Also used as a parameter for children of `dijit.layout.StackContainer` or subclasses.
|
||||
// Callback if a user tries to close the child. Child will be closed if this function returns true.
|
||||
// tags:
|
||||
// extension
|
||||
|
||||
return true; // Boolean
|
||||
}
|
||||
});
|
||||
|
||||
// For back-compat, remove in 2.0.
|
||||
if(!kernel.isAsync){
|
||||
ready(0, function(){
|
||||
var requires = ["dijit/_base"];
|
||||
require(requires); // use indirection so modules not rolled into a build
|
||||
});
|
||||
}
|
||||
return _Widget;
|
||||
});
|
|
@ -1,288 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_WidgetBase",["require","dojo/_base/array","dojo/aspect","dojo/_base/config","dojo/_base/connect","dojo/_base/declare","dojo/dom","dojo/dom-attr","dojo/dom-class","dojo/dom-construct","dojo/dom-geometry","dojo/dom-style","dojo/_base/kernel","dojo/_base/lang","dojo/on","dojo/ready","dojo/Stateful","dojo/topic","dojo/_base/window","./registry"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,on,_f,_10,_11,win,_12){
|
||||
if(!_d.isAsync){
|
||||
_f(0,function(){
|
||||
var _13=["dijit/_base/manager"];
|
||||
_1(_13);
|
||||
});
|
||||
}
|
||||
var _14={};
|
||||
function _15(obj){
|
||||
var ret={};
|
||||
for(var _16 in obj){
|
||||
ret[_16.toLowerCase()]=true;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
function _17(_18){
|
||||
return function(val){
|
||||
_8[val?"set":"remove"](this.domNode,_18,val);
|
||||
this._set(_18,val);
|
||||
};
|
||||
};
|
||||
return _6("dijit._WidgetBase",_10,{id:"",_setIdAttr:"domNode",lang:"",_setLangAttr:_17("lang"),dir:"",_setDirAttr:_17("dir"),textDir:"","class":"",_setClassAttr:{node:"domNode",type:"class"},style:"",title:"",tooltip:"",baseClass:"",srcNodeRef:null,domNode:null,containerNode:null,attributeMap:{},_blankGif:_4.blankGif||_1.toUrl("dojo/resources/blank.gif"),postscript:function(_19,_1a){
|
||||
this.create(_19,_1a);
|
||||
},create:function(_1b,_1c){
|
||||
this.srcNodeRef=_7.byId(_1c);
|
||||
this._connects=[];
|
||||
this._supportingWidgets=[];
|
||||
if(this.srcNodeRef&&(typeof this.srcNodeRef.id=="string")){
|
||||
this.id=this.srcNodeRef.id;
|
||||
}
|
||||
if(_1b){
|
||||
this.params=_1b;
|
||||
_e.mixin(this,_1b);
|
||||
}
|
||||
this.postMixInProperties();
|
||||
if(!this.id){
|
||||
this.id=_12.getUniqueId(this.declaredClass.replace(/\./g,"_"));
|
||||
}
|
||||
_12.add(this);
|
||||
this.buildRendering();
|
||||
if(this.domNode){
|
||||
this._applyAttributes();
|
||||
var _1d=this.srcNodeRef;
|
||||
if(_1d&&_1d.parentNode&&this.domNode!==_1d){
|
||||
_1d.parentNode.replaceChild(this.domNode,_1d);
|
||||
}
|
||||
}
|
||||
if(this.domNode){
|
||||
this.domNode.setAttribute("widgetId",this.id);
|
||||
}
|
||||
this.postCreate();
|
||||
if(this.srcNodeRef&&!this.srcNodeRef.parentNode){
|
||||
delete this.srcNodeRef;
|
||||
}
|
||||
this._created=true;
|
||||
},_applyAttributes:function(){
|
||||
var _1e=this.constructor,_1f=_1e._setterAttrs;
|
||||
if(!_1f){
|
||||
_1f=(_1e._setterAttrs=[]);
|
||||
for(var _20 in this.attributeMap){
|
||||
_1f.push(_20);
|
||||
}
|
||||
var _21=_1e.prototype;
|
||||
for(var _22 in _21){
|
||||
if(_22 in this.attributeMap){
|
||||
continue;
|
||||
}
|
||||
var _23="_set"+_22.replace(/^[a-z]|-[a-zA-Z]/g,function(c){
|
||||
return c.charAt(c.length-1).toUpperCase();
|
||||
})+"Attr";
|
||||
if(_23 in _21){
|
||||
_1f.push(_22);
|
||||
}
|
||||
}
|
||||
}
|
||||
_2.forEach(_1f,function(_24){
|
||||
if(this.params&&_24 in this.params){
|
||||
}else{
|
||||
if(this[_24]){
|
||||
this.set(_24,this[_24]);
|
||||
}
|
||||
}
|
||||
},this);
|
||||
for(var _25 in this.params){
|
||||
this.set(_25,this[_25]);
|
||||
}
|
||||
},postMixInProperties:function(){
|
||||
},buildRendering:function(){
|
||||
if(!this.domNode){
|
||||
this.domNode=this.srcNodeRef||_a.create("div");
|
||||
}
|
||||
if(this.baseClass){
|
||||
var _26=this.baseClass.split(" ");
|
||||
if(!this.isLeftToRight()){
|
||||
_26=_26.concat(_2.map(_26,function(_27){
|
||||
return _27+"Rtl";
|
||||
}));
|
||||
}
|
||||
_9.add(this.domNode,_26);
|
||||
}
|
||||
},postCreate:function(){
|
||||
},startup:function(){
|
||||
if(this._started){
|
||||
return;
|
||||
}
|
||||
this._started=true;
|
||||
_2.forEach(this.getChildren(),function(obj){
|
||||
if(!obj._started&&!obj._destroyed&&_e.isFunction(obj.startup)){
|
||||
obj.startup();
|
||||
obj._started=true;
|
||||
}
|
||||
});
|
||||
},destroyRecursive:function(_28){
|
||||
this._beingDestroyed=true;
|
||||
this.destroyDescendants(_28);
|
||||
this.destroy(_28);
|
||||
},destroy:function(_29){
|
||||
this._beingDestroyed=true;
|
||||
this.uninitialize();
|
||||
var c;
|
||||
while(c=this._connects.pop()){
|
||||
c.remove();
|
||||
}
|
||||
var w;
|
||||
while(w=this._supportingWidgets.pop()){
|
||||
if(w.destroyRecursive){
|
||||
w.destroyRecursive();
|
||||
}else{
|
||||
if(w.destroy){
|
||||
w.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.destroyRendering(_29);
|
||||
_12.remove(this.id);
|
||||
this._destroyed=true;
|
||||
},destroyRendering:function(_2a){
|
||||
if(this.bgIframe){
|
||||
this.bgIframe.destroy(_2a);
|
||||
delete this.bgIframe;
|
||||
}
|
||||
if(this.domNode){
|
||||
if(_2a){
|
||||
_8.remove(this.domNode,"widgetId");
|
||||
}else{
|
||||
_a.destroy(this.domNode);
|
||||
}
|
||||
delete this.domNode;
|
||||
}
|
||||
if(this.srcNodeRef){
|
||||
if(!_2a){
|
||||
_a.destroy(this.srcNodeRef);
|
||||
}
|
||||
delete this.srcNodeRef;
|
||||
}
|
||||
},destroyDescendants:function(_2b){
|
||||
_2.forEach(this.getChildren(),function(_2c){
|
||||
if(_2c.destroyRecursive){
|
||||
_2c.destroyRecursive(_2b);
|
||||
}
|
||||
});
|
||||
},uninitialize:function(){
|
||||
return false;
|
||||
},_setStyleAttr:function(_2d){
|
||||
var _2e=this.domNode;
|
||||
if(_e.isObject(_2d)){
|
||||
_c.set(_2e,_2d);
|
||||
}else{
|
||||
if(_2e.style.cssText){
|
||||
_2e.style.cssText+="; "+_2d;
|
||||
}else{
|
||||
_2e.style.cssText=_2d;
|
||||
}
|
||||
}
|
||||
this._set("style",_2d);
|
||||
},_attrToDom:function(_2f,_30,_31){
|
||||
_31=arguments.length>=3?_31:this.attributeMap[_2f];
|
||||
_2.forEach(_e.isArray(_31)?_31:[_31],function(_32){
|
||||
var _33=this[_32.node||_32||"domNode"];
|
||||
var _34=_32.type||"attribute";
|
||||
switch(_34){
|
||||
case "attribute":
|
||||
if(_e.isFunction(_30)){
|
||||
_30=_e.hitch(this,_30);
|
||||
}
|
||||
var _35=_32.attribute?_32.attribute:(/^on[A-Z][a-zA-Z]*$/.test(_2f)?_2f.toLowerCase():_2f);
|
||||
_8.set(_33,_35,_30);
|
||||
break;
|
||||
case "innerText":
|
||||
_33.innerHTML="";
|
||||
_33.appendChild(win.doc.createTextNode(_30));
|
||||
break;
|
||||
case "innerHTML":
|
||||
_33.innerHTML=_30;
|
||||
break;
|
||||
case "class":
|
||||
_9.replace(_33,_30,this[_2f]);
|
||||
break;
|
||||
}
|
||||
},this);
|
||||
},get:function(_36){
|
||||
var _37=this._getAttrNames(_36);
|
||||
return this[_37.g]?this[_37.g]():this[_36];
|
||||
},set:function(_38,_39){
|
||||
if(typeof _38==="object"){
|
||||
for(var x in _38){
|
||||
this.set(x,_38[x]);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
var _3a=this._getAttrNames(_38),_3b=this[_3a.s];
|
||||
if(_e.isFunction(_3b)){
|
||||
var _3c=_3b.apply(this,Array.prototype.slice.call(arguments,1));
|
||||
}else{
|
||||
var _3d=this.focusNode&&!_e.isFunction(this.focusNode)?"focusNode":"domNode",tag=this[_3d].tagName,_3e=_14[tag]||(_14[tag]=_15(this[_3d])),map=_38 in this.attributeMap?this.attributeMap[_38]:_3a.s in this?this[_3a.s]:((_3a.l in _3e&&typeof _39!="function")||/^aria-|^data-|^role$/.test(_38))?_3d:null;
|
||||
if(map!=null){
|
||||
this._attrToDom(_38,_39,map);
|
||||
}
|
||||
this._set(_38,_39);
|
||||
}
|
||||
return _3c||this;
|
||||
},_attrPairNames:{},_getAttrNames:function(_3f){
|
||||
var apn=this._attrPairNames;
|
||||
if(apn[_3f]){
|
||||
return apn[_3f];
|
||||
}
|
||||
var uc=_3f.replace(/^[a-z]|-[a-zA-Z]/g,function(c){
|
||||
return c.charAt(c.length-1).toUpperCase();
|
||||
});
|
||||
return (apn[_3f]={n:_3f+"Node",s:"_set"+uc+"Attr",g:"_get"+uc+"Attr",l:uc.toLowerCase()});
|
||||
},_set:function(_40,_41){
|
||||
var _42=this[_40];
|
||||
this[_40]=_41;
|
||||
if(this._watchCallbacks&&this._created&&_41!==_42){
|
||||
this._watchCallbacks(_40,_42,_41);
|
||||
}
|
||||
},on:function(_43,_44){
|
||||
return _3.after(this,this._onMap(_43),_44,true);
|
||||
},_onMap:function(_45){
|
||||
var _46=this.constructor,map=_46._onMap;
|
||||
if(!map){
|
||||
map=(_46._onMap={});
|
||||
for(var _47 in _46.prototype){
|
||||
if(/^on/.test(_47)){
|
||||
map[_47.replace(/^on/,"").toLowerCase()]=_47;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map[_45.toLowerCase()];
|
||||
},toString:function(){
|
||||
return "[Widget "+this.declaredClass+", "+(this.id||"NO ID")+"]";
|
||||
},getChildren:function(){
|
||||
return this.containerNode?_12.findWidgets(this.containerNode):[];
|
||||
},getParent:function(){
|
||||
return _12.getEnclosingWidget(this.domNode.parentNode);
|
||||
},connect:function(obj,_48,_49){
|
||||
var _4a=_5.connect(obj,_48,this,_49);
|
||||
this._connects.push(_4a);
|
||||
return _4a;
|
||||
},disconnect:function(_4b){
|
||||
var i=_2.indexOf(this._connects,_4b);
|
||||
if(i!=-1){
|
||||
_4b.remove();
|
||||
this._connects.splice(i,1);
|
||||
}
|
||||
},subscribe:function(t,_4c){
|
||||
var _4d=_11.subscribe(t,_e.hitch(this,_4c));
|
||||
this._connects.push(_4d);
|
||||
return _4d;
|
||||
},unsubscribe:function(_4e){
|
||||
this.disconnect(_4e);
|
||||
},isLeftToRight:function(){
|
||||
return this.dir?(this.dir=="ltr"):_b.isBodyLtr();
|
||||
},isFocusable:function(){
|
||||
return this.focus&&(_c.get(this.domNode,"display")!="none");
|
||||
},placeAt:function(_4f,_50){
|
||||
if(_4f.declaredClass&&_4f.addChild){
|
||||
_4f.addChild(this,_50);
|
||||
}else{
|
||||
_a.place(this.domNode,_4f,_50);
|
||||
}
|
||||
return this;
|
||||
},getTextDir:function(_51,_52){
|
||||
return _52;
|
||||
},applyTextDir:function(){
|
||||
}});
|
||||
});
|
|
@ -1,992 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_WidgetBase", [
|
||||
"require", // require.toUrl
|
||||
"dojo/_base/array", // array.forEach array.map
|
||||
"dojo/aspect",
|
||||
"dojo/_base/config", // config.blankGif
|
||||
"dojo/_base/connect", // connect.connect
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/dom", // dom.byId
|
||||
"dojo/dom-attr", // domAttr.set domAttr.remove
|
||||
"dojo/dom-class", // domClass.add domClass.replace
|
||||
"dojo/dom-construct", // domConstruct.create domConstruct.destroy domConstruct.place
|
||||
"dojo/dom-geometry", // isBodyLtr
|
||||
"dojo/dom-style", // domStyle.set, domStyle.get
|
||||
"dojo/_base/kernel",
|
||||
"dojo/_base/lang", // mixin(), isArray(), etc.
|
||||
"dojo/on",
|
||||
"dojo/ready",
|
||||
"dojo/Stateful", // Stateful
|
||||
"dojo/topic",
|
||||
"dojo/_base/window", // win.doc.createTextNode
|
||||
"./registry" // registry.getUniqueId(), registry.findWidgets()
|
||||
], function(require, array, aspect, config, connect, declare,
|
||||
dom, domAttr, domClass, domConstruct, domGeometry, domStyle, kernel,
|
||||
lang, on, ready, Stateful, topic, win, registry){
|
||||
|
||||
/*=====
|
||||
var Stateful = dojo.Stateful;
|
||||
=====*/
|
||||
|
||||
// module:
|
||||
// dijit/_WidgetBase
|
||||
// summary:
|
||||
// Future base class for all Dijit widgets.
|
||||
|
||||
// For back-compat, remove in 2.0.
|
||||
if(!kernel.isAsync){
|
||||
ready(0, function(){
|
||||
var requires = ["dijit/_base/manager"];
|
||||
require(requires); // use indirection so modules not rolled into a build
|
||||
});
|
||||
}
|
||||
|
||||
// Nested hash listing attributes for each tag, all strings in lowercase.
|
||||
// ex: {"div": {"style": true, "tabindex" true}, "form": { ...
|
||||
var tagAttrs = {};
|
||||
function getAttrs(obj){
|
||||
var ret = {};
|
||||
for(var attr in obj){
|
||||
ret[attr.toLowerCase()] = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function nonEmptyAttrToDom(attr){
|
||||
// summary:
|
||||
// Returns a setter function that copies the attribute to this.domNode,
|
||||
// or removes the attribute from this.domNode, depending on whether the
|
||||
// value is defined or not.
|
||||
return function(val){
|
||||
domAttr[val ? "set" : "remove"](this.domNode, attr, val);
|
||||
this._set(attr, val);
|
||||
};
|
||||
}
|
||||
|
||||
return declare("dijit._WidgetBase", Stateful, {
|
||||
// summary:
|
||||
// Future base class for all Dijit widgets.
|
||||
// description:
|
||||
// Future base class for all Dijit widgets.
|
||||
// _Widget extends this class adding support for various features needed by desktop.
|
||||
//
|
||||
// Provides stubs for widget lifecycle methods for subclasses to extend, like postMixInProperties(), buildRendering(),
|
||||
// postCreate(), startup(), and destroy(), and also public API methods like set(), get(), and watch().
|
||||
//
|
||||
// Widgets can provide custom setters/getters for widget attributes, which are called automatically by set(name, value).
|
||||
// For an attribute XXX, define methods _setXXXAttr() and/or _getXXXAttr().
|
||||
//
|
||||
// _setXXXAttr can also be a string/hash/array mapping from a widget attribute XXX to the widget's DOMNodes:
|
||||
//
|
||||
// - DOM node attribute
|
||||
// | _setFocusAttr: {node: "focusNode", type: "attribute"}
|
||||
// | _setFocusAttr: "focusNode" (shorthand)
|
||||
// | _setFocusAttr: "" (shorthand, maps to this.domNode)
|
||||
// Maps this.focus to this.focusNode.focus, or (last example) this.domNode.focus
|
||||
//
|
||||
// - DOM node innerHTML
|
||||
// | _setTitleAttr: { node: "titleNode", type: "innerHTML" }
|
||||
// Maps this.title to this.titleNode.innerHTML
|
||||
//
|
||||
// - DOM node innerText
|
||||
// | _setTitleAttr: { node: "titleNode", type: "innerText" }
|
||||
// Maps this.title to this.titleNode.innerText
|
||||
//
|
||||
// - DOM node CSS class
|
||||
// | _setMyClassAttr: { node: "domNode", type: "class" }
|
||||
// Maps this.myClass to this.domNode.className
|
||||
//
|
||||
// If the value of _setXXXAttr is an array, then each element in the array matches one of the
|
||||
// formats of the above list.
|
||||
//
|
||||
// If the custom setter is null, no action is performed other than saving the new value
|
||||
// in the widget (in this).
|
||||
//
|
||||
// If no custom setter is defined for an attribute, then it will be copied
|
||||
// to this.focusNode (if the widget defines a focusNode), or this.domNode otherwise.
|
||||
// That's only done though for attributes that match DOMNode attributes (title,
|
||||
// alt, aria-labelledby, etc.)
|
||||
|
||||
// id: [const] String
|
||||
// A unique, opaque ID string that can be assigned by users or by the
|
||||
// system. If the developer passes an ID which is known not to be
|
||||
// unique, the specified ID is ignored and the system-generated ID is
|
||||
// used instead.
|
||||
id: "",
|
||||
_setIdAttr: "domNode", // to copy to this.domNode even for auto-generated id's
|
||||
|
||||
// lang: [const] String
|
||||
// Rarely used. Overrides the default Dojo locale used to render this widget,
|
||||
// as defined by the [HTML LANG](http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang) attribute.
|
||||
// Value must be among the list of locales specified during by the Dojo bootstrap,
|
||||
// formatted according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt) (like en-us).
|
||||
lang: "",
|
||||
// set on domNode even when there's a focus node. but don't set lang="", since that's invalid.
|
||||
_setLangAttr: nonEmptyAttrToDom("lang"),
|
||||
|
||||
// dir: [const] String
|
||||
// Bi-directional support, as defined by the [HTML DIR](http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir)
|
||||
// attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's
|
||||
// default direction.
|
||||
dir: "",
|
||||
// set on domNode even when there's a focus node. but don't set dir="", since that's invalid.
|
||||
_setDirAttr: nonEmptyAttrToDom("dir"), // to set on domNode even when there's a focus node
|
||||
|
||||
// textDir: String
|
||||
// Bi-directional support, the main variable which is responsible for the direction of the text.
|
||||
// The text direction can be different than the GUI direction by using this parameter in creation
|
||||
// of a widget.
|
||||
// Allowed values:
|
||||
// 1. "ltr"
|
||||
// 2. "rtl"
|
||||
// 3. "auto" - contextual the direction of a text defined by first strong letter.
|
||||
// By default is as the page direction.
|
||||
textDir: "",
|
||||
|
||||
// class: String
|
||||
// HTML class attribute
|
||||
"class": "",
|
||||
_setClassAttr: { node: "domNode", type: "class" },
|
||||
|
||||
// style: String||Object
|
||||
// HTML style attributes as cssText string or name/value hash
|
||||
style: "",
|
||||
|
||||
// title: String
|
||||
// HTML title attribute.
|
||||
//
|
||||
// For form widgets this specifies a tooltip to display when hovering over
|
||||
// the widget (just like the native HTML title attribute).
|
||||
//
|
||||
// For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer,
|
||||
// etc., it's used to specify the tab label, accordion pane title, etc.
|
||||
title: "",
|
||||
|
||||
// tooltip: String
|
||||
// When this widget's title attribute is used to for a tab label, accordion pane title, etc.,
|
||||
// this specifies the tooltip to appear when the mouse is hovered over that text.
|
||||
tooltip: "",
|
||||
|
||||
// baseClass: [protected] String
|
||||
// Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate
|
||||
// widget state.
|
||||
baseClass: "",
|
||||
|
||||
// srcNodeRef: [readonly] DomNode
|
||||
// pointer to original DOM node
|
||||
srcNodeRef: null,
|
||||
|
||||
// domNode: [readonly] DomNode
|
||||
// This is our visible representation of the widget! Other DOM
|
||||
// Nodes may by assigned to other properties, usually through the
|
||||
// template system's data-dojo-attach-point syntax, but the domNode
|
||||
// property is the canonical "top level" node in widget UI.
|
||||
domNode: null,
|
||||
|
||||
// containerNode: [readonly] DomNode
|
||||
// Designates where children of the source DOM node will be placed.
|
||||
// "Children" in this case refers to both DOM nodes and widgets.
|
||||
// For example, for myWidget:
|
||||
//
|
||||
// | <div data-dojo-type=myWidget>
|
||||
// | <b> here's a plain DOM node
|
||||
// | <span data-dojo-type=subWidget>and a widget</span>
|
||||
// | <i> and another plain DOM node </i>
|
||||
// | </div>
|
||||
//
|
||||
// containerNode would point to:
|
||||
//
|
||||
// | <b> here's a plain DOM node
|
||||
// | <span data-dojo-type=subWidget>and a widget</span>
|
||||
// | <i> and another plain DOM node </i>
|
||||
//
|
||||
// In templated widgets, "containerNode" is set via a
|
||||
// data-dojo-attach-point assignment.
|
||||
//
|
||||
// containerNode must be defined for any widget that accepts innerHTML
|
||||
// (like ContentPane or BorderContainer or even Button), and conversely
|
||||
// is null for widgets that don't, like TextBox.
|
||||
containerNode: null,
|
||||
|
||||
/*=====
|
||||
// _started: Boolean
|
||||
// startup() has completed.
|
||||
_started: false,
|
||||
=====*/
|
||||
|
||||
// attributeMap: [protected] Object
|
||||
// Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute
|
||||
// for each XXX attribute to be mapped to the DOM.
|
||||
//
|
||||
// attributeMap sets up a "binding" between attributes (aka properties)
|
||||
// of the widget and the widget's DOM.
|
||||
// Changes to widget attributes listed in attributeMap will be
|
||||
// reflected into the DOM.
|
||||
//
|
||||
// For example, calling set('title', 'hello')
|
||||
// on a TitlePane will automatically cause the TitlePane's DOM to update
|
||||
// with the new title.
|
||||
//
|
||||
// attributeMap is a hash where the key is an attribute of the widget,
|
||||
// and the value reflects a binding to a:
|
||||
//
|
||||
// - DOM node attribute
|
||||
// | focus: {node: "focusNode", type: "attribute"}
|
||||
// Maps this.focus to this.focusNode.focus
|
||||
//
|
||||
// - DOM node innerHTML
|
||||
// | title: { node: "titleNode", type: "innerHTML" }
|
||||
// Maps this.title to this.titleNode.innerHTML
|
||||
//
|
||||
// - DOM node innerText
|
||||
// | title: { node: "titleNode", type: "innerText" }
|
||||
// Maps this.title to this.titleNode.innerText
|
||||
//
|
||||
// - DOM node CSS class
|
||||
// | myClass: { node: "domNode", type: "class" }
|
||||
// Maps this.myClass to this.domNode.className
|
||||
//
|
||||
// If the value is an array, then each element in the array matches one of the
|
||||
// formats of the above list.
|
||||
//
|
||||
// There are also some shorthands for backwards compatibility:
|
||||
// - string --> { node: string, type: "attribute" }, for example:
|
||||
// | "focusNode" ---> { node: "focusNode", type: "attribute" }
|
||||
// - "" --> { node: "domNode", type: "attribute" }
|
||||
attributeMap: {},
|
||||
|
||||
// _blankGif: [protected] String
|
||||
// Path to a blank 1x1 image.
|
||||
// Used by <img> nodes in templates that really get their image via CSS background-image.
|
||||
_blankGif: config.blankGif || require.toUrl("dojo/resources/blank.gif"),
|
||||
|
||||
//////////// INITIALIZATION METHODS ///////////////////////////////////////
|
||||
|
||||
postscript: function(/*Object?*/params, /*DomNode|String*/srcNodeRef){
|
||||
// summary:
|
||||
// Kicks off widget instantiation. See create() for details.
|
||||
// tags:
|
||||
// private
|
||||
this.create(params, srcNodeRef);
|
||||
},
|
||||
|
||||
create: function(/*Object?*/params, /*DomNode|String?*/srcNodeRef){
|
||||
// summary:
|
||||
// Kick off the life-cycle of a widget
|
||||
// params:
|
||||
// Hash of initialization parameters for widget, including
|
||||
// scalar values (like title, duration etc.) and functions,
|
||||
// typically callbacks like onClick.
|
||||
// srcNodeRef:
|
||||
// If a srcNodeRef (DOM node) is specified:
|
||||
// - use srcNodeRef.innerHTML as my contents
|
||||
// - if this is a behavioral widget then apply behavior
|
||||
// to that srcNodeRef
|
||||
// - otherwise, replace srcNodeRef with my generated DOM
|
||||
// tree
|
||||
// description:
|
||||
// Create calls a number of widget methods (postMixInProperties, buildRendering, postCreate,
|
||||
// etc.), some of which of you'll want to override. See http://dojotoolkit.org/reference-guide/dijit/_WidgetBase.html
|
||||
// for a discussion of the widget creation lifecycle.
|
||||
//
|
||||
// Of course, adventurous developers could override create entirely, but this should
|
||||
// only be done as a last resort.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
// store pointer to original DOM tree
|
||||
this.srcNodeRef = dom.byId(srcNodeRef);
|
||||
|
||||
// For garbage collection. An array of listener handles returned by this.connect() / this.subscribe()
|
||||
this._connects = [];
|
||||
|
||||
// For widgets internal to this widget, invisible to calling code
|
||||
this._supportingWidgets = [];
|
||||
|
||||
// this is here for back-compat, remove in 2.0 (but check NodeList-instantiate.html test)
|
||||
if(this.srcNodeRef && (typeof this.srcNodeRef.id == "string")){ this.id = this.srcNodeRef.id; }
|
||||
|
||||
// mix in our passed parameters
|
||||
if(params){
|
||||
this.params = params;
|
||||
lang.mixin(this, params);
|
||||
}
|
||||
this.postMixInProperties();
|
||||
|
||||
// generate an id for the widget if one wasn't specified
|
||||
// (be sure to do this before buildRendering() because that function might
|
||||
// expect the id to be there.)
|
||||
if(!this.id){
|
||||
this.id = registry.getUniqueId(this.declaredClass.replace(/\./g,"_"));
|
||||
}
|
||||
registry.add(this);
|
||||
|
||||
this.buildRendering();
|
||||
|
||||
if(this.domNode){
|
||||
// Copy attributes listed in attributeMap into the [newly created] DOM for the widget.
|
||||
// Also calls custom setters for all attributes with custom setters.
|
||||
this._applyAttributes();
|
||||
|
||||
// If srcNodeRef was specified, then swap out original srcNode for this widget's DOM tree.
|
||||
// For 2.0, move this after postCreate(). postCreate() shouldn't depend on the
|
||||
// widget being attached to the DOM since it isn't when a widget is created programmatically like
|
||||
// new MyWidget({}). See #11635.
|
||||
var source = this.srcNodeRef;
|
||||
if(source && source.parentNode && this.domNode !== source){
|
||||
source.parentNode.replaceChild(this.domNode, source);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.domNode){
|
||||
// Note: for 2.0 may want to rename widgetId to dojo._scopeName + "_widgetId",
|
||||
// assuming that dojo._scopeName even exists in 2.0
|
||||
this.domNode.setAttribute("widgetId", this.id);
|
||||
}
|
||||
this.postCreate();
|
||||
|
||||
// If srcNodeRef has been processed and removed from the DOM (e.g. TemplatedWidget) then delete it to allow GC.
|
||||
if(this.srcNodeRef && !this.srcNodeRef.parentNode){
|
||||
delete this.srcNodeRef;
|
||||
}
|
||||
|
||||
this._created = true;
|
||||
},
|
||||
|
||||
_applyAttributes: function(){
|
||||
// summary:
|
||||
// Step during widget creation to copy widget attributes to the
|
||||
// DOM according to attributeMap and _setXXXAttr objects, and also to call
|
||||
// custom _setXXXAttr() methods.
|
||||
//
|
||||
// Skips over blank/false attribute values, unless they were explicitly specified
|
||||
// as parameters to the widget, since those are the default anyway,
|
||||
// and setting tabIndex="" is different than not setting tabIndex at all.
|
||||
//
|
||||
// For backwards-compatibility reasons attributeMap overrides _setXXXAttr when
|
||||
// _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
// Get list of attributes where this.set(name, value) will do something beyond
|
||||
// setting this[name] = value. Specifically, attributes that have:
|
||||
// - associated _setXXXAttr() method/hash/string/array
|
||||
// - entries in attributeMap.
|
||||
var ctor = this.constructor,
|
||||
list = ctor._setterAttrs;
|
||||
if(!list){
|
||||
list = (ctor._setterAttrs = []);
|
||||
for(var attr in this.attributeMap){
|
||||
list.push(attr);
|
||||
}
|
||||
|
||||
var proto = ctor.prototype;
|
||||
for(var fxName in proto){
|
||||
if(fxName in this.attributeMap){ continue; }
|
||||
var setterName = "_set" + fxName.replace(/^[a-z]|-[a-zA-Z]/g, function(c){ return c.charAt(c.length-1).toUpperCase(); }) + "Attr";
|
||||
if(setterName in proto){
|
||||
list.push(fxName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Call this.set() for each attribute that was either specified as parameter to constructor,
|
||||
// or was found above and has a default non-null value. For correlated attributes like value and displayedValue, the one
|
||||
// specified as a parameter should take precedence, so apply attributes in this.params last.
|
||||
// Particularly important for new DateTextBox({displayedValue: ...}) since DateTextBox's default value is
|
||||
// NaN and thus is not ignored like a default value of "".
|
||||
array.forEach(list, function(attr){
|
||||
if(this.params && attr in this.params){
|
||||
// skip this one, do it below
|
||||
}else if(this[attr]){
|
||||
this.set(attr, this[attr]);
|
||||
}
|
||||
}, this);
|
||||
for(var param in this.params){
|
||||
this.set(param, this[param]);
|
||||
}
|
||||
},
|
||||
|
||||
postMixInProperties: function(){
|
||||
// summary:
|
||||
// Called after the parameters to the widget have been read-in,
|
||||
// but before the widget template is instantiated. Especially
|
||||
// useful to set properties that are referenced in the widget
|
||||
// template.
|
||||
// tags:
|
||||
// protected
|
||||
},
|
||||
|
||||
buildRendering: function(){
|
||||
// summary:
|
||||
// Construct the UI for this widget, setting this.domNode.
|
||||
// Most widgets will mixin `dijit._TemplatedMixin`, which implements this method.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
if(!this.domNode){
|
||||
// Create root node if it wasn't created by _Templated
|
||||
this.domNode = this.srcNodeRef || domConstruct.create('div');
|
||||
}
|
||||
|
||||
// baseClass is a single class name or occasionally a space-separated list of names.
|
||||
// Add those classes to the DOMNode. If RTL mode then also add with Rtl suffix.
|
||||
// TODO: make baseClass custom setter
|
||||
if(this.baseClass){
|
||||
var classes = this.baseClass.split(" ");
|
||||
if(!this.isLeftToRight()){
|
||||
classes = classes.concat( array.map(classes, function(name){ return name+"Rtl"; }));
|
||||
}
|
||||
domClass.add(this.domNode, classes);
|
||||
}
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
// summary:
|
||||
// Processing after the DOM fragment is created
|
||||
// description:
|
||||
// Called after the DOM fragment has been created, but not necessarily
|
||||
// added to the document. Do not include any operations which rely on
|
||||
// node dimensions or placement.
|
||||
// tags:
|
||||
// protected
|
||||
},
|
||||
|
||||
startup: function(){
|
||||
// summary:
|
||||
// Processing after the DOM fragment is added to the document
|
||||
// description:
|
||||
// Called after a widget and its children have been created and added to the page,
|
||||
// and all related widgets have finished their create() cycle, up through postCreate().
|
||||
// This is useful for composite widgets that need to control or layout sub-widgets.
|
||||
// Many layout widgets can use this as a wiring phase.
|
||||
if(this._started){ return; }
|
||||
this._started = true;
|
||||
array.forEach(this.getChildren(), function(obj){
|
||||
if(!obj._started && !obj._destroyed && lang.isFunction(obj.startup)){
|
||||
obj.startup();
|
||||
obj._started = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//////////// DESTROY FUNCTIONS ////////////////////////////////
|
||||
|
||||
destroyRecursive: function(/*Boolean?*/ preserveDom){
|
||||
// summary:
|
||||
// Destroy this widget and its descendants
|
||||
// description:
|
||||
// This is the generic "destructor" function that all widget users
|
||||
// should call to cleanly discard with a widget. Once a widget is
|
||||
// destroyed, it is removed from the manager object.
|
||||
// preserveDom:
|
||||
// If true, this method will leave the original DOM structure
|
||||
// alone of descendant Widgets. Note: This will NOT work with
|
||||
// dijit._Templated widgets.
|
||||
|
||||
this._beingDestroyed = true;
|
||||
this.destroyDescendants(preserveDom);
|
||||
this.destroy(preserveDom);
|
||||
},
|
||||
|
||||
destroy: function(/*Boolean*/ preserveDom){
|
||||
// summary:
|
||||
// Destroy this widget, but not its descendants.
|
||||
// This method will, however, destroy internal widgets such as those used within a template.
|
||||
// preserveDom: Boolean
|
||||
// If true, this method will leave the original DOM structure alone.
|
||||
// Note: This will not yet work with _Templated widgets
|
||||
|
||||
this._beingDestroyed = true;
|
||||
this.uninitialize();
|
||||
|
||||
// remove this.connect() and this.subscribe() listeners
|
||||
var c;
|
||||
while(c = this._connects.pop()){
|
||||
c.remove();
|
||||
}
|
||||
|
||||
// destroy widgets created as part of template, etc.
|
||||
var w;
|
||||
while(w = this._supportingWidgets.pop()){
|
||||
if(w.destroyRecursive){
|
||||
w.destroyRecursive();
|
||||
}else if(w.destroy){
|
||||
w.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
this.destroyRendering(preserveDom);
|
||||
registry.remove(this.id);
|
||||
this._destroyed = true;
|
||||
},
|
||||
|
||||
destroyRendering: function(/*Boolean?*/ preserveDom){
|
||||
// summary:
|
||||
// Destroys the DOM nodes associated with this widget
|
||||
// preserveDom:
|
||||
// If true, this method will leave the original DOM structure alone
|
||||
// during tear-down. Note: this will not work with _Templated
|
||||
// widgets yet.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
if(this.bgIframe){
|
||||
this.bgIframe.destroy(preserveDom);
|
||||
delete this.bgIframe;
|
||||
}
|
||||
|
||||
if(this.domNode){
|
||||
if(preserveDom){
|
||||
domAttr.remove(this.domNode, "widgetId");
|
||||
}else{
|
||||
domConstruct.destroy(this.domNode);
|
||||
}
|
||||
delete this.domNode;
|
||||
}
|
||||
|
||||
if(this.srcNodeRef){
|
||||
if(!preserveDom){
|
||||
domConstruct.destroy(this.srcNodeRef);
|
||||
}
|
||||
delete this.srcNodeRef;
|
||||
}
|
||||
},
|
||||
|
||||
destroyDescendants: function(/*Boolean?*/ preserveDom){
|
||||
// summary:
|
||||
// Recursively destroy the children of this widget and their
|
||||
// descendants.
|
||||
// preserveDom:
|
||||
// If true, the preserveDom attribute is passed to all descendant
|
||||
// widget's .destroy() method. Not for use with _Templated
|
||||
// widgets.
|
||||
|
||||
// get all direct descendants and destroy them recursively
|
||||
array.forEach(this.getChildren(), function(widget){
|
||||
if(widget.destroyRecursive){
|
||||
widget.destroyRecursive(preserveDom);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
uninitialize: function(){
|
||||
// summary:
|
||||
// Stub function. Override to implement custom widget tear-down
|
||||
// behavior.
|
||||
// tags:
|
||||
// protected
|
||||
return false;
|
||||
},
|
||||
|
||||
////////////////// GET/SET, CUSTOM SETTERS, ETC. ///////////////////
|
||||
|
||||
_setStyleAttr: function(/*String||Object*/ value){
|
||||
// summary:
|
||||
// Sets the style attribute of the widget according to value,
|
||||
// which is either a hash like {height: "5px", width: "3px"}
|
||||
// or a plain string
|
||||
// description:
|
||||
// Determines which node to set the style on based on style setting
|
||||
// in attributeMap.
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
var mapNode = this.domNode;
|
||||
|
||||
// Note: technically we should revert any style setting made in a previous call
|
||||
// to his method, but that's difficult to keep track of.
|
||||
|
||||
if(lang.isObject(value)){
|
||||
domStyle.set(mapNode, value);
|
||||
}else{
|
||||
if(mapNode.style.cssText){
|
||||
mapNode.style.cssText += "; " + value;
|
||||
}else{
|
||||
mapNode.style.cssText = value;
|
||||
}
|
||||
}
|
||||
|
||||
this._set("style", value);
|
||||
},
|
||||
|
||||
_attrToDom: function(/*String*/ attr, /*String*/ value, /*Object?*/ commands){
|
||||
// summary:
|
||||
// Reflect a widget attribute (title, tabIndex, duration etc.) to
|
||||
// the widget DOM, as specified by commands parameter.
|
||||
// If commands isn't specified then it's looked up from attributeMap.
|
||||
// Note some attributes like "type"
|
||||
// cannot be processed this way as they are not mutable.
|
||||
//
|
||||
// tags:
|
||||
// private
|
||||
|
||||
commands = arguments.length >= 3 ? commands : this.attributeMap[attr];
|
||||
|
||||
array.forEach(lang.isArray(commands) ? commands : [commands], function(command){
|
||||
|
||||
// Get target node and what we are doing to that node
|
||||
var mapNode = this[command.node || command || "domNode"]; // DOM node
|
||||
var type = command.type || "attribute"; // class, innerHTML, innerText, or attribute
|
||||
|
||||
switch(type){
|
||||
case "attribute":
|
||||
if(lang.isFunction(value)){ // functions execute in the context of the widget
|
||||
value = lang.hitch(this, value);
|
||||
}
|
||||
|
||||
// Get the name of the DOM node attribute; usually it's the same
|
||||
// as the name of the attribute in the widget (attr), but can be overridden.
|
||||
// Also maps handler names to lowercase, like onSubmit --> onsubmit
|
||||
var attrName = command.attribute ? command.attribute :
|
||||
(/^on[A-Z][a-zA-Z]*$/.test(attr) ? attr.toLowerCase() : attr);
|
||||
|
||||
domAttr.set(mapNode, attrName, value);
|
||||
break;
|
||||
case "innerText":
|
||||
mapNode.innerHTML = "";
|
||||
mapNode.appendChild(win.doc.createTextNode(value));
|
||||
break;
|
||||
case "innerHTML":
|
||||
mapNode.innerHTML = value;
|
||||
break;
|
||||
case "class":
|
||||
domClass.replace(mapNode, value, this[attr]);
|
||||
break;
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
get: function(name){
|
||||
// summary:
|
||||
// Get a property from a widget.
|
||||
// name:
|
||||
// The property to get.
|
||||
// description:
|
||||
// Get a named property from a widget. The property may
|
||||
// potentially be retrieved via a getter method. If no getter is defined, this
|
||||
// just retrieves the object's property.
|
||||
//
|
||||
// For example, if the widget has properties `foo` and `bar`
|
||||
// and a method named `_getFooAttr()`, calling:
|
||||
// `myWidget.get("foo")` would be equivalent to calling
|
||||
// `widget._getFooAttr()` and `myWidget.get("bar")`
|
||||
// would be equivalent to the expression
|
||||
// `widget.bar2`
|
||||
var names = this._getAttrNames(name);
|
||||
return this[names.g] ? this[names.g]() : this[name];
|
||||
},
|
||||
|
||||
set: function(name, value){
|
||||
// summary:
|
||||
// Set a property on a widget
|
||||
// name:
|
||||
// The property to set.
|
||||
// value:
|
||||
// The value to set in the property.
|
||||
// description:
|
||||
// Sets named properties on a widget which may potentially be handled by a
|
||||
// setter in the widget.
|
||||
//
|
||||
// For example, if the widget has properties `foo` and `bar`
|
||||
// and a method named `_setFooAttr()`, calling
|
||||
// `myWidget.set("foo", "Howdy!")` would be equivalent to calling
|
||||
// `widget._setFooAttr("Howdy!")` and `myWidget.set("bar", 3)`
|
||||
// would be equivalent to the statement `widget.bar = 3;`
|
||||
//
|
||||
// set() may also be called with a hash of name/value pairs, ex:
|
||||
//
|
||||
// | myWidget.set({
|
||||
// | foo: "Howdy",
|
||||
// | bar: 3
|
||||
// | });
|
||||
//
|
||||
// This is equivalent to calling `set(foo, "Howdy")` and `set(bar, 3)`
|
||||
|
||||
if(typeof name === "object"){
|
||||
for(var x in name){
|
||||
this.set(x, name[x]);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
var names = this._getAttrNames(name),
|
||||
setter = this[names.s];
|
||||
if(lang.isFunction(setter)){
|
||||
// use the explicit setter
|
||||
var result = setter.apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
}else{
|
||||
// Mapping from widget attribute to DOMNode attribute/value/etc.
|
||||
// Map according to:
|
||||
// 1. attributeMap setting, if one exists (TODO: attributeMap deprecated, remove in 2.0)
|
||||
// 2. _setFooAttr: {...} type attribute in the widget (if one exists)
|
||||
// 3. apply to focusNode or domNode if standard attribute name, excluding funcs like onClick.
|
||||
// Checks if an attribute is a "standard attribute" by whether the DOMNode JS object has a similar
|
||||
// attribute name (ex: accept-charset attribute matches jsObject.acceptCharset).
|
||||
// Note also that Tree.focusNode() is a function not a DOMNode, so test for that.
|
||||
var defaultNode = this.focusNode && !lang.isFunction(this.focusNode) ? "focusNode" : "domNode",
|
||||
tag = this[defaultNode].tagName,
|
||||
attrsForTag = tagAttrs[tag] || (tagAttrs[tag] = getAttrs(this[defaultNode])),
|
||||
map = name in this.attributeMap ? this.attributeMap[name] :
|
||||
names.s in this ? this[names.s] :
|
||||
((names.l in attrsForTag && typeof value != "function") ||
|
||||
/^aria-|^data-|^role$/.test(name)) ? defaultNode : null;
|
||||
if(map != null){
|
||||
this._attrToDom(name, value, map);
|
||||
}
|
||||
this._set(name, value);
|
||||
}
|
||||
return result || this;
|
||||
},
|
||||
|
||||
_attrPairNames: {}, // shared between all widgets
|
||||
_getAttrNames: function(name){
|
||||
// summary:
|
||||
// Helper function for get() and set().
|
||||
// Caches attribute name values so we don't do the string ops every time.
|
||||
// tags:
|
||||
// private
|
||||
|
||||
var apn = this._attrPairNames;
|
||||
if(apn[name]){ return apn[name]; }
|
||||
var uc = name.replace(/^[a-z]|-[a-zA-Z]/g, function(c){ return c.charAt(c.length-1).toUpperCase(); });
|
||||
return (apn[name] = {
|
||||
n: name+"Node",
|
||||
s: "_set"+uc+"Attr", // converts dashes to camel case, ex: accept-charset --> _setAcceptCharsetAttr
|
||||
g: "_get"+uc+"Attr",
|
||||
l: uc.toLowerCase() // lowercase name w/out dashes, ex: acceptcharset
|
||||
});
|
||||
},
|
||||
|
||||
_set: function(/*String*/ name, /*anything*/ value){
|
||||
// summary:
|
||||
// Helper function to set new value for specified attribute, and call handlers
|
||||
// registered with watch() if the value has changed.
|
||||
var oldValue = this[name];
|
||||
this[name] = value;
|
||||
if(this._watchCallbacks && this._created && value !== oldValue){
|
||||
this._watchCallbacks(name, oldValue, value);
|
||||
}
|
||||
},
|
||||
|
||||
on: function(/*String*/ type, /*Function*/ func){
|
||||
// summary:
|
||||
// Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }).
|
||||
// description:
|
||||
// Call specified function when event `type` occurs, ex: `myWidget.on("click", function(){ ... })`.
|
||||
// Note that the function is not run in any particular scope, so if (for example) you want it to run in the
|
||||
// widget's scope you must do `myWidget.on("click", lang.hitch(myWidget, func))`.
|
||||
|
||||
return aspect.after(this, this._onMap(type), func, true);
|
||||
},
|
||||
|
||||
_onMap: function(/*String*/ type){
|
||||
// summary:
|
||||
// Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove")
|
||||
var ctor = this.constructor, map = ctor._onMap;
|
||||
if(!map){
|
||||
map = (ctor._onMap = {});
|
||||
for(var attr in ctor.prototype){
|
||||
if(/^on/.test(attr)){
|
||||
map[attr.replace(/^on/, "").toLowerCase()] = attr;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map[type.toLowerCase()]; // String
|
||||
},
|
||||
|
||||
toString: function(){
|
||||
// summary:
|
||||
// Returns a string that represents the widget
|
||||
// description:
|
||||
// When a widget is cast to a string, this method will be used to generate the
|
||||
// output. Currently, it does not implement any sort of reversible
|
||||
// serialization.
|
||||
return '[Widget ' + this.declaredClass + ', ' + (this.id || 'NO ID') + ']'; // String
|
||||
},
|
||||
|
||||
getChildren: function(){
|
||||
// summary:
|
||||
// Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode.
|
||||
// Does not return nested widgets, nor widgets that are part of this widget's template.
|
||||
return this.containerNode ? registry.findWidgets(this.containerNode) : []; // dijit._Widget[]
|
||||
},
|
||||
|
||||
getParent: function(){
|
||||
// summary:
|
||||
// Returns the parent widget of this widget
|
||||
return registry.getEnclosingWidget(this.domNode.parentNode);
|
||||
},
|
||||
|
||||
connect: function(
|
||||
/*Object|null*/ obj,
|
||||
/*String|Function*/ event,
|
||||
/*String|Function*/ method){
|
||||
// summary:
|
||||
// Connects specified obj/event to specified method of this object
|
||||
// and registers for disconnect() on widget destroy.
|
||||
// description:
|
||||
// Provide widget-specific analog to dojo.connect, except with the
|
||||
// implicit use of this widget as the target object.
|
||||
// Events connected with `this.connect` are disconnected upon
|
||||
// destruction.
|
||||
// returns:
|
||||
// A handle that can be passed to `disconnect` in order to disconnect before
|
||||
// the widget is destroyed.
|
||||
// example:
|
||||
// | var btn = new dijit.form.Button();
|
||||
// | // when foo.bar() is called, call the listener we're going to
|
||||
// | // provide in the scope of btn
|
||||
// | btn.connect(foo, "bar", function(){
|
||||
// | console.debug(this.toString());
|
||||
// | });
|
||||
// tags:
|
||||
// protected
|
||||
|
||||
var handle = connect.connect(obj, event, this, method);
|
||||
this._connects.push(handle);
|
||||
return handle; // _Widget.Handle
|
||||
},
|
||||
|
||||
disconnect: function(handle){
|
||||
// summary:
|
||||
// Disconnects handle created by `connect`.
|
||||
// Also removes handle from this widget's list of connects.
|
||||
// tags:
|
||||
// protected
|
||||
var i = array.indexOf(this._connects, handle);
|
||||
if(i != -1){
|
||||
handle.remove();
|
||||
this._connects.splice(i, 1);
|
||||
}
|
||||
},
|
||||
|
||||
subscribe: function(t, method){
|
||||
// summary:
|
||||
// Subscribes to the specified topic and calls the specified method
|
||||
// of this object and registers for unsubscribe() on widget destroy.
|
||||
// description:
|
||||
// Provide widget-specific analog to dojo.subscribe, except with the
|
||||
// implicit use of this widget as the target object.
|
||||
// t: String
|
||||
// The topic
|
||||
// method: Function
|
||||
// The callback
|
||||
// example:
|
||||
// | var btn = new dijit.form.Button();
|
||||
// | // when /my/topic is published, this button changes its label to
|
||||
// | // be the parameter of the topic.
|
||||
// | btn.subscribe("/my/topic", function(v){
|
||||
// | this.set("label", v);
|
||||
// | });
|
||||
// tags:
|
||||
// protected
|
||||
var handle = topic.subscribe(t, lang.hitch(this, method));
|
||||
this._connects.push(handle);
|
||||
return handle; // _Widget.Handle
|
||||
},
|
||||
|
||||
unsubscribe: function(/*Object*/ handle){
|
||||
// summary:
|
||||
// Unsubscribes handle created by this.subscribe.
|
||||
// Also removes handle from this widget's list of subscriptions
|
||||
// tags:
|
||||
// protected
|
||||
this.disconnect(handle);
|
||||
},
|
||||
|
||||
isLeftToRight: function(){
|
||||
// summary:
|
||||
// Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
|
||||
// tags:
|
||||
// protected
|
||||
return this.dir ? (this.dir == "ltr") : domGeometry.isBodyLtr(); //Boolean
|
||||
},
|
||||
|
||||
isFocusable: function(){
|
||||
// summary:
|
||||
// Return true if this widget can currently be focused
|
||||
// and false if not
|
||||
return this.focus && (domStyle.get(this.domNode, "display") != "none");
|
||||
},
|
||||
|
||||
placeAt: function(/* String|DomNode|_Widget */reference, /* String?|Int? */position){
|
||||
// summary:
|
||||
// Place this widget's domNode reference somewhere in the DOM based
|
||||
// on standard domConstruct.place conventions, or passing a Widget reference that
|
||||
// contains and addChild member.
|
||||
//
|
||||
// description:
|
||||
// A convenience function provided in all _Widgets, providing a simple
|
||||
// shorthand mechanism to put an existing (or newly created) Widget
|
||||
// somewhere in the dom, and allow chaining.
|
||||
//
|
||||
// reference:
|
||||
// The String id of a domNode, a domNode reference, or a reference to a Widget possessing
|
||||
// an addChild method.
|
||||
//
|
||||
// position:
|
||||
// If passed a string or domNode reference, the position argument
|
||||
// accepts a string just as domConstruct.place does, one of: "first", "last",
|
||||
// "before", or "after".
|
||||
//
|
||||
// If passed a _Widget reference, and that widget reference has an ".addChild" method,
|
||||
// it will be called passing this widget instance into that method, supplying the optional
|
||||
// position index passed.
|
||||
//
|
||||
// returns:
|
||||
// dijit._Widget
|
||||
// Provides a useful return of the newly created dijit._Widget instance so you
|
||||
// can "chain" this function by instantiating, placing, then saving the return value
|
||||
// to a variable.
|
||||
//
|
||||
// example:
|
||||
// | // create a Button with no srcNodeRef, and place it in the body:
|
||||
// | var button = new dijit.form.Button({ label:"click" }).placeAt(win.body());
|
||||
// | // now, 'button' is still the widget reference to the newly created button
|
||||
// | button.on("click", function(e){ console.log('click'); }));
|
||||
//
|
||||
// example:
|
||||
// | // create a button out of a node with id="src" and append it to id="wrapper":
|
||||
// | var button = new dijit.form.Button({},"src").placeAt("wrapper");
|
||||
//
|
||||
// example:
|
||||
// | // place a new button as the first element of some div
|
||||
// | var button = new dijit.form.Button({ label:"click" }).placeAt("wrapper","first");
|
||||
//
|
||||
// example:
|
||||
// | // create a contentpane and add it to a TabContainer
|
||||
// | var tc = dijit.byId("myTabs");
|
||||
// | new dijit.layout.ContentPane({ href:"foo.html", title:"Wow!" }).placeAt(tc)
|
||||
|
||||
if(reference.declaredClass && reference.addChild){
|
||||
reference.addChild(this, position);
|
||||
}else{
|
||||
domConstruct.place(this.domNode, reference, position);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
getTextDir: function(/*String*/ text,/*String*/ originalDir){
|
||||
// summary:
|
||||
// Return direction of the text.
|
||||
// The function overridden in the _BidiSupport module,
|
||||
// its main purpose is to calculate the direction of the
|
||||
// text, if was defined by the programmer through textDir.
|
||||
// tags:
|
||||
// protected.
|
||||
return originalDir;
|
||||
},
|
||||
|
||||
applyTextDir: function(/*===== element, text =====*/){
|
||||
// summary:
|
||||
// The function overridden in the _BidiSupport module,
|
||||
// originally used for setting element.dir according to this.textDir.
|
||||
// In this case does nothing.
|
||||
// element: DOMNode
|
||||
// text: String
|
||||
// tags:
|
||||
// protected.
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_WidgetsInTemplateMixin",["dojo/_base/array","dojo/_base/declare","dojo/parser","dijit/registry"],function(_1,_2,_3,_4){
|
||||
return _2("dijit._WidgetsInTemplateMixin",null,{_earlyTemplatedStartup:false,widgetsInTemplate:true,_beforeFillContent:function(){
|
||||
if(this.widgetsInTemplate){
|
||||
var _5=this.domNode;
|
||||
var cw=(this._startupWidgets=_3.parse(_5,{noStart:!this._earlyTemplatedStartup,template:true,inherited:{dir:this.dir,lang:this.lang,textDir:this.textDir},propsThis:this,scope:"dojo"}));
|
||||
this._supportingWidgets=_4.findWidgets(_5);
|
||||
this._attachTemplateNodes(cw,function(n,p){
|
||||
return n[p];
|
||||
});
|
||||
}
|
||||
},startup:function(){
|
||||
_1.forEach(this._startupWidgets,function(w){
|
||||
if(w&&!w._started&&w.startup){
|
||||
w.startup();
|
||||
}
|
||||
});
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
});
|
|
@ -1,62 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_WidgetsInTemplateMixin", [
|
||||
"dojo/_base/array", // array.forEach
|
||||
"dojo/_base/declare", // declare
|
||||
"dojo/parser", // parser.parse
|
||||
"dijit/registry" // registry.findWidgets
|
||||
], function(array, declare, parser, registry){
|
||||
|
||||
// module:
|
||||
// dijit/_WidgetsInTemplateMixin
|
||||
// summary:
|
||||
// Mixin to supplement _TemplatedMixin when template contains widgets
|
||||
|
||||
return declare("dijit._WidgetsInTemplateMixin", null, {
|
||||
// summary:
|
||||
// Mixin to supplement _TemplatedMixin when template contains widgets
|
||||
|
||||
// _earlyTemplatedStartup: Boolean
|
||||
// A fallback to preserve the 1.0 - 1.3 behavior of children in
|
||||
// templates having their startup called before the parent widget
|
||||
// fires postCreate. Defaults to 'false', causing child widgets to
|
||||
// have their .startup() called immediately before a parent widget
|
||||
// .startup(), but always after the parent .postCreate(). Set to
|
||||
// 'true' to re-enable to previous, arguably broken, behavior.
|
||||
_earlyTemplatedStartup: false,
|
||||
|
||||
// widgetsInTemplate: [protected] Boolean
|
||||
// Should we parse the template to find widgets that might be
|
||||
// declared in markup inside it? (Remove for 2.0 and assume true)
|
||||
widgetsInTemplate: true,
|
||||
|
||||
_beforeFillContent: function(){
|
||||
if(this.widgetsInTemplate){
|
||||
// Before copying over content, instantiate widgets in template
|
||||
var node = this.domNode;
|
||||
|
||||
var cw = (this._startupWidgets = parser.parse(node, {
|
||||
noStart: !this._earlyTemplatedStartup,
|
||||
template: true,
|
||||
inherited: {dir: this.dir, lang: this.lang, textDir: this.textDir},
|
||||
propsThis: this, // so data-dojo-props of widgets in the template can reference "this" to refer to me
|
||||
scope: "dojo" // even in multi-version mode templates use dojoType/data-dojo-type
|
||||
}));
|
||||
|
||||
this._supportingWidgets = registry.findWidgets(node);
|
||||
|
||||
this._attachTemplateNodes(cw, function(n,p){
|
||||
return n[p];
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
startup: function(){
|
||||
array.forEach(this._startupWidgets, function(w){
|
||||
if(w && !w._started && w.startup){
|
||||
w.startup();
|
||||
}
|
||||
});
|
||||
this.inherited(arguments);
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
//>>built
|
||||
define("dijit/_base",[".","./a11y","./WidgetSet","./_base/focus","./_base/manager","./_base/place","./_base/popup","./_base/scroll","./_base/sniff","./_base/typematic","./_base/wai","./_base/window"],function(_1){
|
||||
return _1._base;
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user