Skip to content

Commit

Permalink
Refactor modules to CommonJS AMD, !strict refs #11869
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.dojotoolkit.org/src/dijit/trunk@23033 560b804f-0ae3-0310-86f3-f6aa0a117693
  • Loading branch information
kriszyp committed Oct 20, 2010
1 parent 6330214 commit 43f7a04
Show file tree
Hide file tree
Showing 355 changed files with 2,037 additions and 898 deletions.
33 changes: 13 additions & 20 deletions Calendar.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
dojo.provide("dijit.Calendar");

dojo.require("dojo.cldr.supplemental");
dojo.require("dojo.date");
dojo.require("dojo.date.locale");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.require("dijit._CssStateMixin");
dojo.require("dijit.form.DropDownButton");
define("dijit/Calendar", ["dojo", "dijit", "dojo/cldr/supplemental", "dojo/date", "dojo/date/locale", "dijit/_Widget", "dijit/_Templated", "dijit/_CssStateMixin", "dijit/form/DropDownButton"], function(dojo, dijit) {

dojo.declare(
"dijit.Calendar",
Expand Down Expand Up @@ -51,7 +42,7 @@ dojo.declare(
// 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,
Expand Down Expand Up @@ -116,25 +107,25 @@ dojo.declare(
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);
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.value = value;
if(!this.isDisabledDate(value, this.lang)){
this.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'));
this.onChange(this.get('value'));
this.onValueSelected(this.get('value')); // remove in 2.0
}
}
}
}
}else{
// clear value, and repopulate grid (to deselect the previously selected day) without changing currentFocus
Expand Down Expand Up @@ -351,15 +342,15 @@ dojo.declare(
newCell.setAttribute("tabIndex", this.tabIndex);
if(this._focused || forceFocus){
newCell.focus();
}
}

// set tabIndex=-1 on old focusable cell
if(oldCell && oldCell != newCell){
if(dojo.isWebKit){ // see #11064 about webkit bug
oldCell.setAttribute("tabIndex", "-1");
}else{
}else{
oldCell.removeAttribute("tabIndex");
}
}
}
},

Expand Down Expand Up @@ -424,7 +415,7 @@ dojo.declare(
// 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(dojo.hasClass(this._currentNode, "dijitCalendarActiveDate")){
if(dojo.hasClass(this._currentNode, "dijitCalendarActiveDate")) {
cls += " dijitCalendarActiveDate";
}
dojo.removeClass(this._currentNode, cls);
Expand Down Expand Up @@ -597,3 +588,5 @@ dojo.declare("dijit.Calendar._MonthDropDown", [dijit._Widget, dijit._Templated],
dojo.toggleClass(evt.target, "dijitCalendarMonthLabelHover", evt.type == "mouseover");
}
});

});
8 changes: 5 additions & 3 deletions CheckedMenuItem.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
dojo.provide("dijit.CheckedMenuItem");

dojo.require("dijit.MenuItem");
define("dijit/CheckedMenuItem", ["dojo", "dijit", "dijit/MenuItem"], function(dojo, dijit) {

dojo.declare("dijit.CheckedMenuItem",
dijit.MenuItem,
Expand Down Expand Up @@ -41,3 +39,7 @@ dojo.declare("dijit.CheckedMenuItem",
this.inherited(arguments);
}
});


return dijit.CheckedMenuItem;
});
15 changes: 5 additions & 10 deletions ColorPalette.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
dojo.provide("dijit.ColorPalette");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.require("dojo.colors");
dojo.require("dojo.i18n");

dojo.require("dijit._PaletteMixin");

dojo.requireLocalization("dojo", "colors");
define("dijit/ColorPalette", ["dojo", "dijit", "dijit/_Widget", "dijit/_Templated", "dojo/colors", "dojo/i18n", "dijit/_PaletteMixin", "i18n!dojo/nls/colors"], function(dojo, dijit) {

dojo.declare("dijit.ColorPalette",
[dijit._Widget, dijit._Templated, dijit._PaletteMixin],
Expand Down Expand Up @@ -107,3 +98,7 @@ dojo.declare("dijit._Color", dojo.Color,
}
}
);


return dijit.ColorPalette;
});
10 changes: 6 additions & 4 deletions Declaration.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
dojo.provide("dijit.Declaration");
dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
define("dijit/Declaration", ["dojo", "dijit", "dijit/_Widget", "dijit/_Templated"], function(dojo, dijit) {

dojo.declare(
"dijit.Declaration",
Expand Down Expand Up @@ -48,7 +46,7 @@ dojo.declare(
var evt = s.getAttribute("event") || s.getAttribute("data-dojo-event"),
func = dojo.parser._functionFromScript(s);
if(evt){
propList[evt] = func;
propList[evt] = func;
}else{
connects.push(s);
}
Expand Down Expand Up @@ -92,3 +90,7 @@ dojo.declare(
}
}
);


return dijit.Declaration;
});
22 changes: 19 additions & 3 deletions Dialog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
dojo.provide("dijit.Dialog");
define("dijit/Dialog", ["dojo", "dijit",
"dojo/dnd/move",
"dojo/dnd/TimedMoveable",
"dojo/fx",
"dojo/window",
"dijit/_Widget",
"dijit/_Templated",
"dijit/_CssStateMixin",
"dijit/form/_FormMixin",
"dijit/_DialogMixin",
"dijit/DialogUnderlay",
"dijit/layout/ContentPane",
"i18n!dijit/nls/common",
"dijit/TooltipDialog"], // For back-compat. TODO: remove in 2.0
function(dojo, dijit) {



dojo.require("dojo.dnd.move");
dojo.require("dojo.dnd.TimedMoveable");
Expand Down Expand Up @@ -568,5 +584,5 @@ dijit._dialogStack = [
{dialog: null, focus: null, underlayAttrs: null} // entry for stuff at z-index: 0
];

// For back-compat. TODO: remove in 2.0
dojo.require("dijit.TooltipDialog");
return dijit.dialog;
});
11 changes: 5 additions & 6 deletions DialogUnderlay.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
dojo.provide("dijit.DialogUnderlay");

dojo.require("dojo.window");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
define("dijit/DialogUnderlay", ["dojo", "dijit", "dojo/window", "dijit/_Widget", "dijit/_Templated"], function(dojo, dijit) {

dojo.declare(
"dijit.DialogUnderlay",
Expand Down Expand Up @@ -98,3 +93,7 @@ dojo.declare(
}
}
);


return dijit.DialogUnderlay;
});
44 changes: 18 additions & 26 deletions Editor.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
dojo.provide("dijit.Editor");
dojo.require("dijit._editor.RichText");

dojo.require("dijit.Toolbar");
dojo.require("dijit.ToolbarSeparator");
dojo.require("dijit._editor._Plugin");
dojo.require("dijit._editor.plugins.EnterKeyHandling");
dojo.require("dijit._editor.range");
dojo.require("dijit._Container");
dojo.require("dojo.i18n");
dojo.require("dijit.layout._LayoutWidget");
dojo.require("dijit._editor.range");
dojo.requireLocalization("dijit._editor", "commands");
define("dijit/Editor", ["dojo", "dijit", "dijit/_editor/RichText", "dijit/Toolbar", "dijit/ToolbarSeparator", "dijit/_editor/_Plugin", "dijit/_editor/plugins/EnterKeyHandling", "dijit/_editor/range", "dijit/_Container", "dojo/i18n", "dijit/layout/_LayoutWidget", "dijit/_editor/range", "i18n!dijit/_editor/nls/commands"], function(dojo, dijit) {

dojo.declare(
"dijit.Editor",
Expand Down Expand Up @@ -197,7 +185,7 @@ dojo.declare(
}
/*
else{
// do nothing, the editor is already laid out correctly. The user has probably specified
// 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
}
*/
Expand Down Expand Up @@ -239,7 +227,7 @@ dojo.declare(
var offsetHeight = b.offsetHeight;
var offsetLeft = b.offsetLeft;

// Check for vertical scroller click.
//Check for vertical scroller click.
bodyDir = b.dir ? b.dir.toLowerCase() : "";
if(bodyDir != "rtl"){
if(clientWidth < offsetWidth && e.x > clientWidth && e.x < offsetWidth){
Expand Down Expand Up @@ -274,7 +262,7 @@ dojo.declare(
},
onBeforeDeactivate: function(e){
// summary:
// Called on IE right before focus is lost. Saves the selected range.
// Called on IE right before focus is lost. Saves the selected range.
// tags:
// private
if(this.customUndo){
Expand All @@ -297,7 +285,7 @@ dojo.declare(
// 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
Expand Down Expand Up @@ -332,7 +320,7 @@ dojo.declare(
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.
// Called by plugins, but not meant to be called by end users.
// tags:
// protected
if(this.customUndo && (cmd == 'undo' || cmd == 'redo')){
Expand Down Expand Up @@ -368,7 +356,7 @@ dojo.declare(
queryCommandEnabled: function(cmd){
// summary:
// Returns true if specified editor command is enabled.
// Used by the plugins to know when to highlight/not highlight buttons.
// Used by the plugins to know when to highlight/not highlight buttons.
// tags:
// protected
if(this.customUndo && (cmd == 'undo' || cmd == 'redo')){
Expand Down Expand Up @@ -700,7 +688,7 @@ dojo.declare(
this.endEditing(true);
this.inherited(arguments);
},

replaceValue: function(/*String*/ html){
// summary:
// over-ride of replaceValue to support custom undo and stack maintainence.
Expand All @@ -725,16 +713,16 @@ dojo.declare(
_setDisabledAttr: function(/*Boolean*/ value){
var disableFunc = dojo.hitch(this, function(){
if((!this.disabled && value) || (!this._buttonEnabledPlugins && value)){
// Disable editor: disable all enabled buttons and remember that list
// Disable editor: disable all enabled buttons and remember that list
dojo.forEach(this._plugins, function(p){
p.set("disabled", true);
});
}else if(this.disabled && !value){
});
}else if(this.disabled && !value){
// Restore plugins to being active.
dojo.forEach(this._plugins, function(p){
p.set("disabled", false);
});
}
});
}
});
this.setValueDeferred.addCallback(disableFunc);
this.inherited(arguments);
Expand Down Expand Up @@ -773,8 +761,12 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){
p = new _p({ buttonClass: dijit.form.ToggleButton, command: name });
break;
case "|":
p = new _p({ button: new dijit.ToolbarSeparator(), setEditor: function(editor){this.editor = editor;} });
p = new _p({ button: new dijit.ToolbarSeparator(), setEditor: function(editor) {this.editor = editor;} });
}
// console.log('name',name,p);
o.plugin=p;
});


return dijit.Editor;
});
15 changes: 5 additions & 10 deletions InlineEditBox.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
dojo.provide("dijit.InlineEditBox");

dojo.require("dojo.i18n");

dojo.require("dijit._Widget");
dojo.require("dijit._Container");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.TextBox");

dojo.requireLocalization("dijit", "common");
define("dijit/InlineEditBox", ["dojo", "dijit", "dojo/i18n", "dijit/_Widget", "dijit/_Container", "dijit/form/Button", "dijit/form/TextBox", "i18n!dijit/nls/common"], function(dojo, dijit) {

dojo.declare("dijit.InlineEditBox",
dijit._Widget,
Expand Down Expand Up @@ -570,3 +561,7 @@ dojo.declare(
}), 0);
}
});


return dijit.InlineEditBox;
});
19 changes: 5 additions & 14 deletions Menu.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
dojo.provide("dijit.Menu");

dojo.require("dojo.window");

dojo.require("dijit._Widget");
dojo.require("dijit._KeyNavContainer");
dojo.require("dijit._Templated");
define("dijit/Menu", ["dojo", "dijit", "dojo/window", "dijit/_Widget", "dijit/_KeyNavContainer", "dijit/_Templated",
"dijit/MenuItem", "dijit/PopupMenuItem", "dijit/CheckedMenuItem", "dijit/MenuSeparator"], // Back-compat (TODO: remove in 2.0)
function(dojo, dijit) {

dojo.declare("dijit._MenuBase",
[dijit._Widget, dijit._Templated, dijit._KeyNavContainer],
Expand Down Expand Up @@ -690,10 +686,5 @@ dojo.declare("dijit.Menu",
}
);

// Back-compat (TODO: remove in 2.0)
dojo.require("dijit.MenuItem");
dojo.require("dijit.PopupMenuItem");
dojo.require("dijit.CheckedMenuItem");
dojo.require("dijit.MenuSeparator");


return dijit.Menu;
});
8 changes: 5 additions & 3 deletions MenuBar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
dojo.provide("dijit.MenuBar");

dojo.require("dijit.Menu");
define("dijit/MenuBar", ["dojo", "dijit", "dijit/Menu"], function(dojo, dijit) {

dojo.declare("dijit.MenuBar", dijit._MenuBase, {
// summary:
Expand Down Expand Up @@ -64,3 +62,7 @@ dojo.declare("dijit.MenuBar", dijit._MenuBase, {
}
}
});


return dijit.MenuBar;
});
Loading

0 comments on commit 43f7a04

Please sign in to comment.