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/Select.js.uncompressed.js | 406 +++++++++++++++++++++++++++++++ 1 file changed, 406 insertions(+) create mode 100644 lib/dijit/form/Select.js.uncompressed.js (limited to 'lib/dijit/form/Select.js.uncompressed.js') diff --git a/lib/dijit/form/Select.js.uncompressed.js b/lib/dijit/form/Select.js.uncompressed.js new file mode 100644 index 000000000..43c45960a --- /dev/null +++ b/lib/dijit/form/Select.js.uncompressed.js @@ -0,0 +1,406 @@ +require({cache:{ +'url:dijit/form/templates/Select.html':"
\n"}}); +define("dijit/form/Select", [ + "dojo/_base/array", // array.forEach + "dojo/_base/declare", // declare + "dojo/dom-attr", // domAttr.set + "dojo/dom-class", // domClass.add domClass.remove domClass.toggle + "dojo/dom-geometry", // domGeometry.setMarginBox + "dojo/_base/event", // event.stop + "dojo/i18n", // i18n.getLocalization + "dojo/_base/lang", // lang.hitch + "dojo/sniff", // has("ie") + "./_FormSelectWidget", + "../_HasDropDown", + "../Menu", + "../MenuItem", + "../MenuSeparator", + "../Tooltip", + "dojo/text!./templates/Select.html", + "dojo/i18n!./nls/validate" +], function(array, declare, domAttr, domClass, domGeometry, event, i18n, lang, has, + _FormSelectWidget, _HasDropDown, Menu, MenuItem, MenuSeparator, Tooltip, template){ + +// module: +// dijit/form/Select + + +var _SelectMenu = declare("dijit.form._SelectMenu", Menu, { + // summary: + // An internally-used menu for dropdown that allows us a vertical scrollbar + + // Override Menu.autoFocus setting so that opening a Select highlights the current value. + autoFocus: true, + + buildRendering: function(){ + // summary: + // Stub in our own changes, so that our domNode is not a table + // otherwise, we won't respond correctly to heights/overflows + this.inherited(arguments); + var o = (this.menuTableNode = this.domNode); + var n = (this.domNode = this.ownerDocument.createElement("div")); + n.style.cssText = "overflow-x: hidden; overflow-y: scroll"; + if(o.parentNode){ + o.parentNode.replaceChild(n, o); + } + domClass.remove(o, "dijitMenuTable"); + n.className = o.className + " dijitSelectMenu"; + o.className = "dijitReset dijitMenuTable"; + o.setAttribute("role", "listbox"); + n.setAttribute("role", "presentation"); + n.appendChild(o); + }, + + postCreate: function(){ + // summary: + // stop mousemove from selecting text on IE to be consistent with other browsers + + this.inherited(arguments); + + this.connect(this.domNode, "onselectstart", event.stop); + }, + + + focus: function(){ + // summary: + // Overridden so that the previously selected value will be focused instead of only the first item + var found = false, + val = this.parentWidget.value; + if(lang.isArray(val)){ + val = val[val.length-1]; + } + if(val){ // if focus selected + array.forEach(this.parentWidget._getChildren(), function(child){ + if(child.option && (val === child.option.value)){ // find menu item widget with this value + found = true; + this.focusChild(child, false); // focus previous selection + } + }, this); + } + if(!found){ + this.inherited(arguments); // focus first item by default + } + }, + + resize: function(/*Object*/ mb){ + // summary: + // Overridden so that we are able to handle resizing our + // internal widget. Note that this is not a "full" resize + // implementation - it only works correctly if you pass it a + // marginBox. + // + // mb: Object + // The margin box to set this dropdown to. + if(mb){ + domGeometry.setMarginBox(this.domNode, mb); + if("w" in mb){ + // We've explicitly set the wrapper
's width, so set width to match. + // 100% is safer than a pixel value because there may be a scroll bar with + // browser/OS specific width. + this.menuTableNode.style.width = "100%"; + } + } + } +}); + +var Select = declare("dijit.form.Select", [_FormSelectWidget, _HasDropDown], { + // summary: + // This is a "styleable" select box - it is basically a DropDownButton which + // can take a `