summaryrefslogtreecommitdiff
path: root/lib/dijit/form/NumberSpinner.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dijit/form/NumberSpinner.js')
-rw-r--r--lib/dijit/form/NumberSpinner.js73
1 files changed, 2 insertions, 71 deletions
diff --git a/lib/dijit/form/NumberSpinner.js b/lib/dijit/form/NumberSpinner.js
index ba5a782f5..1f7dc1640 100644
--- a/lib/dijit/form/NumberSpinner.js
+++ b/lib/dijit/form/NumberSpinner.js
@@ -1,71 +1,2 @@
-/*
- Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
- Available via Academic Free License >= 2.1 OR the modified BSD license.
- see: http://dojotoolkit.org/license for details
-*/
-
-
-if(!dojo._hasResource["dijit.form.NumberSpinner"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dijit.form.NumberSpinner"] = true;
-dojo.provide("dijit.form.NumberSpinner");
-dojo.require("dijit.form._Spinner");
-dojo.require("dijit.form.NumberTextBox");
-
-
-dojo.declare("dijit.form.NumberSpinner",
- [dijit.form._Spinner, dijit.form.NumberTextBoxMixin],
- {
- // summary:
- // Extends NumberTextBox to add up/down arrows and pageup/pagedown for incremental change to the value
- //
- // description:
- // A `dijit.form.NumberTextBox` extension to provide keyboard accessible value selection
- // as well as icons for spinning direction. When using the keyboard, the typematic rules
- // apply, meaning holding the key will gradually increase or decrease the value and
- // accelerate.
- //
- // example:
- // | new dijit.form.NumberSpinner({ constraints:{ max:300, min:100 }}, "someInput");
-
- adjust: function(/*Object*/ val, /*Number*/ delta){
- // summary:
- // Change Number val by the given amount
- // tags:
- // protected
-
- var tc = this.constraints,
- v = isNaN(val),
- gotMax = !isNaN(tc.max),
- gotMin = !isNaN(tc.min)
- ;
- if(v && delta != 0){ // blank or invalid value and they want to spin, so create defaults
- val = (delta > 0) ?
- gotMin ? tc.min : gotMax ? tc.max : 0 :
- gotMax ? this.constraints.max : gotMin ? tc.min : 0
- ;
- }
- var newval = val + delta;
- if(v || isNaN(newval)){ return val; }
- if(gotMax && (newval > tc.max)){
- newval = tc.max;
- }
- if(gotMin && (newval < tc.min)){
- newval = tc.min;
- }
- return newval;
- },
-
- _onKeyPress: function(e){
- if((e.charOrCode == dojo.keys.HOME || e.charOrCode == dojo.keys.END) && !(e.ctrlKey || e.altKey || e.metaKey)
- && typeof this.get('value') != 'undefined' /* gibberish, so HOME and END are default editing keys*/){
- var value = this.constraints[(e.charOrCode == dojo.keys.HOME ? "min" : "max")];
- if(typeof value == "number"){
- this._setValueAttr(value, false);
- }
- // eat home or end key whether we change the value or not
- dojo.stopEvent(e);
- }
- }
-});
-
-}
+//>>built
+define("dijit/form/NumberSpinner",["dojo/_base/declare","dojo/_base/event","dojo/keys","./_Spinner","./NumberTextBox"],function(_1,_2,_3,_4,_5){return _1("dijit.form.NumberSpinner",[_4,_5.Mixin],{adjust:function(_6,_7){var tc=this.constraints,v=isNaN(_6),_8=!isNaN(tc.max),_9=!isNaN(tc.min);if(v&&_7!=0){_6=(_7>0)?_9?tc.min:_8?tc.max:0:_8?this.constraints.max:_9?tc.min:0;}var _a=_6+_7;if(v||isNaN(_a)){return _6;}if(_8&&(_a>tc.max)){_a=tc.max;}if(_9&&(_a<tc.min)){_a=tc.min;}return _a;},_onKeyPress:function(e){if((e.charOrCode==_3.HOME||e.charOrCode==_3.END)&&!(e.ctrlKey||e.altKey||e.metaKey)&&typeof this.get("value")!="undefined"){var _b=this.constraints[(e.charOrCode==_3.HOME?"min":"max")];if(typeof _b=="number"){this._setValueAttr(_b,false);}_2.stop(e);}}});}); \ No newline at end of file