From f0cfe83e3725f9a3928da97a6e3085e79cb25309 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 18 Mar 2013 10:26:24 +0400 Subject: upgrade dojo to 1.8.3 (refs #570) --- lib/dijit/form/Button.js.uncompressed.js | 121 +++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 lib/dijit/form/Button.js.uncompressed.js (limited to 'lib/dijit/form/Button.js.uncompressed.js') diff --git a/lib/dijit/form/Button.js.uncompressed.js b/lib/dijit/form/Button.js.uncompressed.js new file mode 100644 index 000000000..40bbbcf39 --- /dev/null +++ b/lib/dijit/form/Button.js.uncompressed.js @@ -0,0 +1,121 @@ +require({cache:{ +'url:dijit/form/templates/Button.html':"\n"}}); +define("dijit/form/Button", [ + "require", + "dojo/_base/declare", // declare + "dojo/dom-class", // domClass.toggle + "dojo/has", // has("dijit-legacy-requires") + "dojo/_base/kernel", // kernel.deprecated + "dojo/_base/lang", // lang.trim + "dojo/ready", + "./_FormWidget", + "./_ButtonMixin", + "dojo/text!./templates/Button.html" +], function(require, declare, domClass, has, kernel, lang, ready, _FormWidget, _ButtonMixin, template){ + +// module: +// dijit/form/Button + +// Back compat w/1.6, remove for 2.0 +if(has("dijit-legacy-requires")){ + ready(0, function(){ + var requires = ["dijit/form/DropDownButton", "dijit/form/ComboButton", "dijit/form/ToggleButton"]; + require(requires); // use indirection so modules not rolled into a build + }); +} + +return declare("dijit.form.Button", [_FormWidget, _ButtonMixin], { + // summary: + // Basically the same thing as a normal HTML button, but with special styling. + // description: + // Buttons can display a label, an icon, or both. + // A label should always be specified (through innerHTML) or the label + // attribute. It can be hidden via showLabel=false. + // example: + // | + // + // example: + // | var button1 = new Button({label: "hello world", onClick: foo}); + // | dojo.body().appendChild(button1.domNode); + + // showLabel: Boolean + // Set this to true to hide the label text and display only the icon. + // (If showLabel=false then iconClass must be specified.) + // Especially useful for toolbars. + // If showLabel=true, the label will become the title (a.k.a. tooltip/hint) of the icon. + // + // The exception case is for computers in high-contrast mode, where the label + // will still be displayed, since the icon doesn't appear. + showLabel: true, + + // iconClass: String + // Class to apply to DOMNode in button to make it display an icon + iconClass: "dijitNoIcon", + _setIconClassAttr: { node: "iconNode", type: "class" }, + + baseClass: "dijitButton", + + templateString: template, + + // Map widget attributes to DOMNode attributes. + _setValueAttr: "valueNode", + + _onClick: function(/*Event*/ e){ + // summary: + // Internal function to handle click actions + var ok = this.inherited(arguments); + if(ok){ + if(this.valueNode){ + this.valueNode.click(); + e.preventDefault(); // cancel BUTTON click and continue with hidden INPUT click + e.stopPropagation(); // avoid two events bubbling from Button widget + // leave ok = true so that subclasses can do what they need to do + } + } + return ok; + }, + + _fillContent: function(/*DomNode*/ source){ + // Overrides _Templated._fillContent(). + // If button label is specified as srcNodeRef.innerHTML rather than + // this.params.label, handle it here. + // TODO: remove the method in 2.0, parser will do it all for me + if(source && (!this.params || !("label" in this.params))){ + var sourceLabel = lang.trim(source.innerHTML); + if(sourceLabel){ + this.label = sourceLabel; // _applyAttributes will be called after buildRendering completes to update the DOM + } + } + }, + + _setShowLabelAttr: function(val){ + if(this.containerNode){ + domClass.toggle(this.containerNode, "dijitDisplayNone", !val); + } + this._set("showLabel", val); + }, + + setLabel: function(/*String*/ content){ + // summary: + // Deprecated. Use set('label', ...) instead. + kernel.deprecated("dijit.form.Button.setLabel() is deprecated. Use set('label', ...) instead.", "", "2.0"); + this.set("label", content); + }, + + _setLabelAttr: function(/*String*/ content){ + // summary: + // Hook for set('label', ...) to work. + // description: + // Set the label (text) of the button; takes an HTML string. + // If the label is hidden (showLabel=false) then and no title has + // been specified, then label is also set as title attribute of icon. + this.inherited(arguments); + if(!this.showLabel && !("title" in this.params)){ + this.titleNode.title = lang.trim(this.containerNode.innerText || this.containerNode.textContent || ''); + } + } +}); + + +}); + -- cgit v1.2.3