From 0181c0110985cfd2659e81c8cc1ef5a2f73bc697 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 14 Aug 2012 19:04:32 +0400 Subject: dojo: remove uncompressed files --- lib/dojo/tt-rss-layer.js.uncompressed.js | 32247 ----------------------------- 1 file changed, 32247 deletions(-) delete mode 100644 lib/dojo/tt-rss-layer.js.uncompressed.js (limited to 'lib/dojo/tt-rss-layer.js.uncompressed.js') diff --git a/lib/dojo/tt-rss-layer.js.uncompressed.js b/lib/dojo/tt-rss-layer.js.uncompressed.js deleted file mode 100644 index cc43d8726..000000000 --- a/lib/dojo/tt-rss-layer.js.uncompressed.js +++ /dev/null @@ -1,32247 +0,0 @@ -require({cache:{ -'dijit/form/TextBox':function(){ -require({cache:{ -'url:dijit/form/templates/TextBox.html':"
\n"}}); -define("dijit/form/TextBox", [ - "dojo/_base/declare", // declare - "dojo/dom-construct", // domConstruct.create - "dojo/dom-style", // domStyle.getComputedStyle - "dojo/_base/kernel", // kernel.deprecated - "dojo/_base/lang", // lang.hitch - "dojo/_base/sniff", // has("ie") has("mozilla") - "dojo/_base/window", // win.doc.selection.createRange - "./_FormValueWidget", - "./_TextBoxMixin", - "dojo/text!./templates/TextBox.html", - ".." // to export dijit._setSelectionRange, remove in 2.0 -], function(declare, domConstruct, domStyle, kernel, lang, has, win, - _FormValueWidget, _TextBoxMixin, template, dijit){ - -/*===== - var _FormValueWidget = dijit.form._FormValueWidget; - var _TextBoxMixin = dijit.form._TextBoxMixin; -=====*/ - - // module: - // dijit/form/TextBox - // summary: - // A base class for textbox form inputs - - var TextBox = declare(/*====="dijit.form.TextBox", =====*/ [_FormValueWidget, _TextBoxMixin], { - // summary: - // A base class for textbox form inputs - - templateString: template, - _singleNodeTemplate: '', - - _buttonInputDisabled: has("ie") ? "disabled" : "", // allows IE to disallow focus, but Firefox cannot be disabled for mousedown events - - baseClass: "dijitTextBox", - - postMixInProperties: function(){ - var type = this.type.toLowerCase(); - if(this.templateString && this.templateString.toLowerCase() == "input" || ((type == "hidden" || type == "file") && this.templateString == this.constructor.prototype.templateString)){ - this.templateString = this._singleNodeTemplate; - } - this.inherited(arguments); - }, - - _onInput: function(e){ - this.inherited(arguments); - if(this.intermediateChanges){ // _TextBoxMixin uses onInput - var _this = this; - // the setTimeout allows the key to post to the widget input box - setTimeout(function(){ _this._handleOnChange(_this.get('value'), false); }, 0); - } - }, - - _setPlaceHolderAttr: function(v){ - this._set("placeHolder", v); - if(!this._phspan){ - this._attachPoints.push('_phspan'); - // dijitInputField class gives placeHolder same padding as the input field - // parent node already has dijitInputField class but it doesn't affect this - // since it's position: absolute. - this._phspan = domConstruct.create('span',{className:'dijitPlaceHolder dijitInputField'},this.textbox,'after'); - } - this._phspan.innerHTML=""; - this._phspan.appendChild(document.createTextNode(v)); - this._updatePlaceHolder(); - }, - - _updatePlaceHolder: function(){ - if(this._phspan){ - this._phspan.style.display=(this.placeHolder&&!this.focused&&!this.textbox.value)?"":"none"; - } - }, - - _setValueAttr: function(value, /*Boolean?*/ priorityChange, /*String?*/ formattedValue){ - this.inherited(arguments); - this._updatePlaceHolder(); - }, - - getDisplayedValue: function(){ - // summary: - // Deprecated. Use get('displayedValue') instead. - // tags: - // deprecated - kernel.deprecated(this.declaredClass+"::getDisplayedValue() is deprecated. Use set('displayedValue') instead.", "", "2.0"); - return this.get('displayedValue'); - }, - - setDisplayedValue: function(/*String*/ value){ - // summary: - // Deprecated. Use set('displayedValue', ...) instead. - // tags: - // deprecated - kernel.deprecated(this.declaredClass+"::setDisplayedValue() is deprecated. Use set('displayedValue', ...) instead.", "", "2.0"); - this.set('displayedValue', value); - }, - - _onBlur: function(e){ - if(this.disabled){ return; } - this.inherited(arguments); - this._updatePlaceHolder(); - }, - - _onFocus: function(/*String*/ by){ - if(this.disabled || this.readOnly){ return; } - this.inherited(arguments); - this._updatePlaceHolder(); - } - }); - - if(has("ie")){ - TextBox = declare(/*===== "dijit.form.TextBox.IEMixin", =====*/ TextBox, { - declaredClass: "dijit.form.TextBox", // for user code referencing declaredClass - - _isTextSelected: function(){ - var range = win.doc.selection.createRange(); - var parent = range.parentElement(); - return parent == this.textbox && range.text.length == 0; - }, - - postCreate: function(){ - this.inherited(arguments); - // IE INPUT tag fontFamily has to be set directly using STYLE - // the setTimeout gives IE a chance to render the TextBox and to deal with font inheritance - setTimeout(lang.hitch(this, function(){ - try{ - var s = domStyle.getComputedStyle(this.domNode); // can throw an exception if widget is immediately destroyed - if(s){ - var ff = s.fontFamily; - if(ff){ - var inputs = this.domNode.getElementsByTagName("INPUT"); - if(inputs){ - for(var i=0; i < inputs.length; i++){ - inputs[i].style.fontFamily = ff; - } - } - } - } - }catch(e){/*when used in a Dialog, and this is called before the dialog is - shown, s.fontFamily would trigger "Invalid Argument" error.*/} - }), 0); - } - }); - - // Overrides definition of _setSelectionRange from _TextBoxMixin (TODO: move to _TextBoxMixin.js?) - dijit._setSelectionRange = _TextBoxMixin._setSelectionRange = function(/*DomNode*/ element, /*Number?*/ start, /*Number?*/ stop){ - if(element.createTextRange){ - var r = element.createTextRange(); - r.collapse(true); - r.moveStart("character", -99999); // move to 0 - r.moveStart("character", start); // delta from 0 is the correct position - r.moveEnd("character", stop-start); - r.select(); - } - } - }else if(has("mozilla")){ - TextBox = declare(/*===== "dijit.form.TextBox.MozMixin", =====*/TextBox, { - declaredClass: "dijit.form.TextBox", // for user code referencing declaredClass - - _onBlur: function(e){ - this.inherited(arguments); - if(this.selectOnClick){ - // clear selection so that the next mouse click doesn't reselect - this.textbox.selectionStart = this.textbox.selectionEnd = undefined; - } - } - }); - }else{ - TextBox.prototype.declaredClass = "dijit.form.TextBox"; - } - lang.setObject("dijit.form.TextBox", TextBox); // don't do direct assignment, it confuses API doc parser - - return TextBox; -}); - -}, -'dijit/_base/scroll':function(){ -define("dijit/_base/scroll", [ - "dojo/window", // windowUtils.scrollIntoView - ".." // export symbol to dijit -], function(windowUtils, dijit){ - // module: - // dijit/_base/scroll - // summary: - // Back compatibility module, new code should use windowUtils directly instead of using this module. - - dijit.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){ - // summary: - // Scroll the passed node into view, if it is not already. - // Deprecated, use `windowUtils.scrollIntoView` instead. - - windowUtils.scrollIntoView(node, pos); - }; -}); - -}, -'dijit/_TemplatedMixin':function(){ -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
", - - // 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"; - } - }); -}); - -}, -'dijit/layout/ScrollingTabController':function(){ -require({cache:{ -'url:dijit/layout/templates/ScrollingTabController.html':"
\n\t
\n\t
\n\t
\n\t
\n\t\t
\n\t
\n
", -'url:dijit/layout/templates/_ScrollingTabControllerButton.html':"
\n\t
\n\t\t
\n\t\t\t\"\"\n\t\t\t\n\t\t
\n\t
\n
"}}); -define("dijit/layout/ScrollingTabController", [ - "dojo/_base/array", // array.forEach - "dojo/_base/declare", // declare - "dojo/dom-class", // domClass.add domClass.contains - "dojo/dom-geometry", // domGeometry.contentBox - "dojo/dom-style", // domStyle.style - "dojo/_base/fx", // Animation - "dojo/_base/lang", // lang.hitch - "dojo/query", // query - "dojo/_base/sniff", // has("ie"), has("webkit"), has("quirks") - "../registry", // registry.byId() - "dojo/text!./templates/ScrollingTabController.html", - "dojo/text!./templates/_ScrollingTabControllerButton.html", - "./TabController", - "./utils", // marginBox2contextBox, layoutChildren - "../_WidgetsInTemplateMixin", - "../Menu", - "../MenuItem", - "../form/Button", - "../_HasDropDown", - "dojo/NodeList-dom" // NodeList.style -], function(array, declare, domClass, domGeometry, domStyle, fx, lang, query, has, - registry, tabControllerTemplate, buttonTemplate, TabController, layoutUtils, _WidgetsInTemplateMixin, - Menu, MenuItem, Button, _HasDropDown){ - -/*===== -var _WidgetsInTemplateMixin = dijit._WidgetsInTemplateMixin; -var Menu = dijit.Menu; -var _HasDropDown = dijit._HasDropDown; -var TabController = dijit.layout.TabController; -=====*/ - - -// module: -// dijit/layout/ScrollingTabController -// summary: -// Set of tabs with left/right arrow keys and a menu to switch between tabs not -// all fitting on a single row. - - -var ScrollingTabController = declare("dijit.layout.ScrollingTabController", [TabController, _WidgetsInTemplateMixin], { - // summary: - // Set of tabs with left/right arrow keys and a menu to switch between tabs not - // all fitting on a single row. - // Works only for horizontal tabs (either above or below the content, not to the left - // or right). - // tags: - // private - - baseClass: "dijitTabController dijitScrollingTabController", - - templateString: tabControllerTemplate, - - // useMenu: [const] Boolean - // True if a menu should be used to select tabs when they are too - // wide to fit the TabContainer, false otherwise. - useMenu: true, - - // useSlider: [const] Boolean - // True if a slider should be used to select tabs when they are too - // wide to fit the TabContainer, false otherwise. - useSlider: true, - - // tabStripClass: [const] String - // The css class to apply to the tab strip, if it is visible. - tabStripClass: "", - - widgetsInTemplate: true, - - // _minScroll: Number - // The distance in pixels from the edge of the tab strip which, - // if a scroll animation is less than, forces the scroll to - // go all the way to the left/right. - _minScroll: 5, - - // Override default behavior mapping class to DOMNode - _setClassAttr: { node: "containerNode", type: "class" }, - - buildRendering: function(){ - this.inherited(arguments); - var n = this.domNode; - - this.scrollNode = this.tablistWrapper; - this._initButtons(); - - if(!this.tabStripClass){ - this.tabStripClass = "dijitTabContainer" + - this.tabPosition.charAt(0).toUpperCase() + - this.tabPosition.substr(1).replace(/-.*/, "") + - "None"; - domClass.add(n, "tabStrip-disabled") - } - - domClass.add(this.tablistWrapper, this.tabStripClass); - }, - - onStartup: function(){ - this.inherited(arguments); - - // TabController is hidden until it finishes drawing, to give - // a less visually jumpy instantiation. When it's finished, set visibility to "" - // to that the tabs are hidden/shown depending on the container's visibility setting. - domStyle.set(this.domNode, "visibility", ""); - this._postStartup = true; - }, - - onAddChild: function(page, insertIndex){ - this.inherited(arguments); - - // changes to the tab button label or iconClass will have changed the width of the - // buttons, so do a resize - array.forEach(["label", "iconClass"], function(attr){ - this.pane2watches[page.id].push( - this.pane2button[page.id].watch(attr, lang.hitch(this, function(){ - if(this._postStartup && this._dim){ - this.resize(this._dim); - } - })) - ); - }, this); - - // Increment the width of the wrapper when a tab is added - // This makes sure that the buttons never wrap. - // The value 200 is chosen as it should be bigger than most - // Tab button widths. - domStyle.set(this.containerNode, "width", - (domStyle.get(this.containerNode, "width") + 200) + "px"); - }, - - onRemoveChild: function(page, insertIndex){ - // null out _selectedTab because we are about to delete that dom node - var button = this.pane2button[page.id]; - if(this._selectedTab === button.domNode){ - this._selectedTab = null; - } - - this.inherited(arguments); - }, - - _initButtons: function(){ - // summary: - // Creates the buttons used to scroll to view tabs that - // may not be visible if the TabContainer is too narrow. - - // Make a list of the buttons to display when the tab labels become - // wider than the TabContainer, and hide the other buttons. - // Also gets the total width of the displayed buttons. - this._btnWidth = 0; - this._buttons = query("> .tabStripButton", this.domNode).filter(function(btn){ - if((this.useMenu && btn == this._menuBtn.domNode) || - (this.useSlider && (btn == this._rightBtn.domNode || btn == this._leftBtn.domNode))){ - this._btnWidth += domGeometry.getMarginSize(btn).w; - return true; - }else{ - domStyle.set(btn, "display", "none"); - return false; - } - }, this); - }, - - _getTabsWidth: function(){ - var children = this.getChildren(); - if(children.length){ - var leftTab = children[this.isLeftToRight() ? 0 : children.length - 1].domNode, - rightTab = children[this.isLeftToRight() ? children.length - 1 : 0].domNode; - return rightTab.offsetLeft + domStyle.get(rightTab, "width") - leftTab.offsetLeft; - }else{ - return 0; - } - }, - - _enableBtn: function(width){ - // summary: - // Determines if the tabs are wider than the width of the TabContainer, and - // thus that we need to display left/right/menu navigation buttons. - var tabsWidth = this._getTabsWidth(); - width = width || domStyle.get(this.scrollNode, "width"); - return tabsWidth > 0 && width < tabsWidth; - }, - - resize: function(dim){ - // summary: - // Hides or displays the buttons used to scroll the tab list and launch the menu - // that selects tabs. - - // Save the dimensions to be used when a child is renamed. - this._dim = dim; - - // Set my height to be my natural height (tall enough for one row of tab labels), - // and my content-box width based on margin-box width specified in dim parameter. - // But first reset scrollNode.height in case it was set by layoutChildren() call - // in a previous run of this method. - this.scrollNode.style.height = "auto"; - var cb = this._contentBox = layoutUtils.marginBox2contentBox(this.domNode, {h: 0, w: dim.w}); - cb.h = this.scrollNode.offsetHeight; - domGeometry.setContentSize(this.domNode, cb); - - // Show/hide the left/right/menu navigation buttons depending on whether or not they - // are needed. - var enable = this._enableBtn(this._contentBox.w); - this._buttons.style("display", enable ? "" : "none"); - - // Position and size the navigation buttons and the tablist - this._leftBtn.layoutAlign = "left"; - this._rightBtn.layoutAlign = "right"; - this._menuBtn.layoutAlign = this.isLeftToRight() ? "right" : "left"; - layoutUtils.layoutChildren(this.domNode, this._contentBox, - [this._menuBtn, this._leftBtn, this._rightBtn, {domNode: this.scrollNode, layoutAlign: "client"}]); - - // set proper scroll so that selected tab is visible - if(this._selectedTab){ - if(this._anim && this._anim.status() == "playing"){ - this._anim.stop(); - } - this.scrollNode.scrollLeft = this._convertToScrollLeft(this._getScrollForSelectedTab()); - } - - // Enable/disabled left right buttons depending on whether or not user can scroll to left or right - this._setButtonClass(this._getScroll()); - - this._postResize = true; - - // Return my size so layoutChildren() can use it. - // Also avoids IE9 layout glitch on browser resize when scroll buttons present - return {h: this._contentBox.h, w: dim.w}; - }, - - _getScroll: function(){ - // summary: - // Returns the current scroll of the tabs where 0 means - // "scrolled all the way to the left" and some positive number, based on # - // of pixels of possible scroll (ex: 1000) means "scrolled all the way to the right" - return (this.isLeftToRight() || has("ie") < 8 || (has("ie") && has("quirks")) || has("webkit")) ? this.scrollNode.scrollLeft : - domStyle.get(this.containerNode, "width") - domStyle.get(this.scrollNode, "width") - + (has("ie") == 8 ? -1 : 1) * this.scrollNode.scrollLeft; - }, - - _convertToScrollLeft: function(val){ - // summary: - // Given a scroll value where 0 means "scrolled all the way to the left" - // and some positive number, based on # of pixels of possible scroll (ex: 1000) - // means "scrolled all the way to the right", return value to set this.scrollNode.scrollLeft - // to achieve that scroll. - // - // This method is to adjust for RTL funniness in various browsers and versions. - if(this.isLeftToRight() || has("ie") < 8 || (has("ie") && has("quirks")) || has("webkit")){ - return val; - }else{ - var maxScroll = domStyle.get(this.containerNode, "width") - domStyle.get(this.scrollNode, "width"); - return (has("ie") == 8 ? -1 : 1) * (val - maxScroll); - } - }, - - onSelectChild: function(/*dijit._Widget*/ page){ - // summary: - // Smoothly scrolls to a tab when it is selected. - - var tab = this.pane2button[page.id]; - if(!tab || !page){return;} - - var node = tab.domNode; - - // Save the selection - if(node != this._selectedTab){ - this._selectedTab = node; - - // Scroll to the selected tab, except on startup, when scrolling is handled in resize() - if(this._postResize){ - var sl = this._getScroll(); - - if(sl > node.offsetLeft || - sl + domStyle.get(this.scrollNode, "width") < - node.offsetLeft + domStyle.get(node, "width")){ - this.createSmoothScroll().play(); - } - } - } - - this.inherited(arguments); - }, - - _getScrollBounds: function(){ - // summary: - // Returns the minimum and maximum scroll setting to show the leftmost and rightmost - // tabs (respectively) - var children = this.getChildren(), - scrollNodeWidth = domStyle.get(this.scrollNode, "width"), // about 500px - containerWidth = domStyle.get(this.containerNode, "width"), // 50,000px - maxPossibleScroll = containerWidth - scrollNodeWidth, // scrolling until right edge of containerNode visible - tabsWidth = this._getTabsWidth(); - - if(children.length && tabsWidth > scrollNodeWidth){ - // Scrolling should happen - return { - min: this.isLeftToRight() ? 0 : children[children.length-1].domNode.offsetLeft, - max: this.isLeftToRight() ? - (children[children.length-1].domNode.offsetLeft + domStyle.get(children[children.length-1].domNode, "width")) - scrollNodeWidth : - maxPossibleScroll - }; - }else{ - // No scrolling needed, all tabs visible, we stay either scrolled to far left or far right (depending on dir) - var onlyScrollPosition = this.isLeftToRight() ? 0 : maxPossibleScroll; - return { - min: onlyScrollPosition, - max: onlyScrollPosition - }; - } - }, - - _getScrollForSelectedTab: function(){ - // summary: - // Returns the scroll value setting so that the selected tab - // will appear in the center - var w = this.scrollNode, - n = this._selectedTab, - scrollNodeWidth = domStyle.get(this.scrollNode, "width"), - scrollBounds = this._getScrollBounds(); - - // TODO: scroll minimal amount (to either right or left) so that - // selected tab is fully visible, and just return if it's already visible? - var pos = (n.offsetLeft + domStyle.get(n, "width")/2) - scrollNodeWidth/2; - pos = Math.min(Math.max(pos, scrollBounds.min), scrollBounds.max); - - // TODO: - // If scrolling close to the left side or right side, scroll - // all the way to the left or right. See this._minScroll. - // (But need to make sure that doesn't scroll the tab out of view...) - return pos; - }, - - createSmoothScroll: function(x){ - // summary: - // Creates a dojo._Animation object that smoothly scrolls the tab list - // either to a fixed horizontal pixel value, or to the selected tab. - // description: - // If an number argument is passed to the function, that horizontal - // pixel position is scrolled to. Otherwise the currently selected - // tab is scrolled to. - // x: Integer? - // An optional pixel value to scroll to, indicating distance from left. - - // Calculate position to scroll to - if(arguments.length > 0){ - // position specified by caller, just make sure it's within bounds - var scrollBounds = this._getScrollBounds(); - x = Math.min(Math.max(x, scrollBounds.min), scrollBounds.max); - }else{ - // scroll to center the current tab - x = this._getScrollForSelectedTab(); - } - - if(this._anim && this._anim.status() == "playing"){ - this._anim.stop(); - } - - var self = this, - w = this.scrollNode, - anim = new fx.Animation({ - beforeBegin: function(){ - if(this.curve){ delete this.curve; } - var oldS = w.scrollLeft, - newS = self._convertToScrollLeft(x); - anim.curve = new fx._Line(oldS, newS); - }, - onAnimate: function(val){ - w.scrollLeft = val; - } - }); - this._anim = anim; - - // Disable/enable left/right buttons according to new scroll position - this._setButtonClass(x); - - return anim; // dojo._Animation - }, - - _getBtnNode: function(/*Event*/ e){ - // summary: - // Gets a button DOM node from a mouse click event. - // e: - // The mouse click event. - var n = e.target; - while(n && !domClass.contains(n, "tabStripButton")){ - n = n.parentNode; - } - return n; - }, - - doSlideRight: function(/*Event*/ e){ - // summary: - // Scrolls the menu to the right. - // e: - // The mouse click event. - this.doSlide(1, this._getBtnNode(e)); - }, - - doSlideLeft: function(/*Event*/ e){ - // summary: - // Scrolls the menu to the left. - // e: - // The mouse click event. - this.doSlide(-1,this._getBtnNode(e)); - }, - - doSlide: function(/*Number*/ direction, /*DomNode*/ node){ - // summary: - // Scrolls the tab list to the left or right by 75% of the widget width. - // direction: - // If the direction is 1, the widget scrolls to the right, if it is - // -1, it scrolls to the left. - - if(node && domClass.contains(node, "dijitTabDisabled")){return;} - - var sWidth = domStyle.get(this.scrollNode, "width"); - var d = (sWidth * 0.75) * direction; - - var to = this._getScroll() + d; - - this._setButtonClass(to); - - this.createSmoothScroll(to).play(); - }, - - _setButtonClass: function(/*Number*/ scroll){ - // summary: - // Disables the left scroll button if the tabs are scrolled all the way to the left, - // or the right scroll button in the opposite case. - // scroll: Integer - // amount of horizontal scroll - - var scrollBounds = this._getScrollBounds(); - this._leftBtn.set("disabled", scroll <= scrollBounds.min); - this._rightBtn.set("disabled", scroll >= scrollBounds.max); - } -}); - - -var ScrollingTabControllerButtonMixin = declare("dijit.layout._ScrollingTabControllerButtonMixin", null, { - baseClass: "dijitTab tabStripButton", - - templateString: buttonTemplate, - - // Override inherited tabIndex: 0 from dijit.form.Button, because user shouldn't be - // able to tab to the left/right/menu buttons - tabIndex: "", - - // Similarly, override FormWidget.isFocusable() because clicking a button shouldn't focus it - // either (this override avoids focus() call in FormWidget.js) - isFocusable: function(){ return false; } -}); -/*===== -ScrollingTabControllerButtonMixin = dijit.layout._ScrollingTabControllerButtonMixin; -=====*/ - -// Class used in template -declare("dijit.layout._ScrollingTabControllerButton", - [Button, ScrollingTabControllerButtonMixin]); - -// Class used in template -declare( - "dijit.layout._ScrollingTabControllerMenuButton", - [Button, _HasDropDown, ScrollingTabControllerButtonMixin], -{ - // id of the TabContainer itself - containerId: "", - - // -1 so user can't tab into the button, but so that button can still be focused programatically. - // Because need to move focus to the button (or somewhere) before the menu is hidden or IE6 will crash. - tabIndex: "-1", - - isLoaded: function(){ - // recreate menu every time, in case the TabContainer's list of children (or their icons/labels) have changed - return false; - }, - - loadDropDown: function(callback){ - this.dropDown = new Menu({ - id: this.containerId + "_menu", - dir: this.dir, - lang: this.lang, - textDir: this.textDir - }); - var container = registry.byId(this.containerId); - array.forEach(container.getChildren(), function(page){ - var menuItem = new MenuItem({ - id: page.id + "_stcMi", - label: page.title, - iconClass: page.iconClass, - dir: page.dir, - lang: page.lang, - textDir: page.textDir, - onClick: function(){ - container.selectChild(page); - } - }); - this.dropDown.addChild(menuItem); - }, this); - callback(); - }, - - closeDropDown: function(/*Boolean*/ focus){ - this.inherited(arguments); - if(this.dropDown){ - this.dropDown.destroyRecursive(); - delete this.dropDown; - } - } -}); - -return ScrollingTabController; -}); - -}, -'dijit/place':function(){ -define("dijit/place", [ - "dojo/_base/array", // array.forEach array.map array.some - "dojo/dom-geometry", // domGeometry.getMarginBox domGeometry.position - "dojo/dom-style", // domStyle.getComputedStyle - "dojo/_base/kernel", // kernel.deprecated - "dojo/_base/window", // win.body - "dojo/window", // winUtils.getBox - "." // dijit (defining dijit.place to match API doc) -], function(array, domGeometry, domStyle, kernel, win, winUtils, dijit){ - - // module: - // dijit/place - // summary: - // Code to place a popup relative to another node - - - function _place(/*DomNode*/ node, choices, layoutNode, aroundNodeCoords){ - // summary: - // Given a list of spots to put node, put it at the first spot where it fits, - // of if it doesn't fit anywhere then the place with the least overflow - // choices: Array - // Array of elements like: {corner: 'TL', pos: {x: 10, y: 20} } - // Above example says to put the top-left corner of the node at (10,20) - // layoutNode: Function(node, aroundNodeCorner, nodeCorner, size) - // for things like tooltip, they are displayed differently (and have different dimensions) - // based on their orientation relative to the parent. This adjusts the popup based on orientation. - // It also passes in the available size for the popup, which is useful for tooltips to - // tell them that their width is limited to a certain amount. layoutNode() may return a value expressing - // how much the popup had to be modified to fit into the available space. This is used to determine - // what the best placement is. - // aroundNodeCoords: Object - // Size of aroundNode, ex: {w: 200, h: 50} - - // get {x: 10, y: 10, w: 100, h:100} type obj representing position of - // viewport over document - var view = winUtils.getBox(); - - // This won't work if the node is inside a
, - // so reattach it to win.doc.body. (Otherwise, the positioning will be wrong - // and also it might get cutoff) - if(!node.parentNode || String(node.parentNode.tagName).toLowerCase() != "body"){ - win.body().appendChild(node); - } - - var best = null; - array.some(choices, function(choice){ - var corner = choice.corner; - var pos = choice.pos; - var overflow = 0; - - // calculate amount of space available given specified position of node - var spaceAvailable = { - w: { - 'L': view.l + view.w - pos.x, - 'R': pos.x - view.l, - 'M': view.w - }[corner.charAt(1)], - h: { - 'T': view.t + view.h - pos.y, - 'B': pos.y - view.t, - 'M': view.h - }[corner.charAt(0)] - }; - - // configure node to be displayed in given position relative to button - // (need to do this in order to get an accurate size for the node, because - // a tooltip's size changes based on position, due to triangle) - if(layoutNode){ - var res = layoutNode(node, choice.aroundCorner, corner, spaceAvailable, aroundNodeCoords); - overflow = typeof res == "undefined" ? 0 : res; - } - - // get node's size - var style = node.style; - var oldDisplay = style.display; - var oldVis = style.visibility; - if(style.display == "none"){ - style.visibility = "hidden"; - style.display = ""; - } - var mb = domGeometry. getMarginBox(node); - style.display = oldDisplay; - style.visibility = oldVis; - - // coordinates and size of node with specified corner placed at pos, - // and clipped by viewport - var - startXpos = { - 'L': pos.x, - 'R': pos.x - mb.w, - 'M': Math.max(view.l, Math.min(view.l + view.w, pos.x + (mb.w >> 1)) - mb.w) // M orientation is more flexible - }[corner.charAt(1)], - startYpos = { - 'T': pos.y, - 'B': pos.y - mb.h, - 'M': Math.max(view.t, Math.min(view.t + view.h, pos.y + (mb.h >> 1)) - mb.h) - }[corner.charAt(0)], - startX = Math.max(view.l, startXpos), - startY = Math.max(view.t, startYpos), - endX = Math.min(view.l + view.w, startXpos + mb.w), - endY = Math.min(view.t + view.h, startYpos + mb.h), - width = endX - startX, - height = endY - startY; - - overflow += (mb.w - width) + (mb.h - height); - - if(best == null || overflow < best.overflow){ - best = { - corner: corner, - aroundCorner: choice.aroundCorner, - x: startX, - y: startY, - w: width, - h: height, - overflow: overflow, - spaceAvailable: spaceAvailable - }; - } - - return !overflow; - }); - - // In case the best position is not the last one we checked, need to call - // layoutNode() again. - if(best.overflow && layoutNode){ - layoutNode(node, best.aroundCorner, best.corner, best.spaceAvailable, aroundNodeCoords); - } - - // And then position the node. Do this last, after the layoutNode() above - // has sized the node, due to browser quirks when the viewport is scrolled - // (specifically that a Tooltip will shrink to fit as though the window was - // scrolled to the left). - // - // In RTL mode, set style.right rather than style.left so in the common case, - // window resizes move the popup along with the aroundNode. - var l = domGeometry.isBodyLtr(), - s = node.style; - s.top = best.y + "px"; - s[l ? "left" : "right"] = (l ? best.x : view.w - best.x - best.w) + "px"; - s[l ? "right" : "left"] = "auto"; // needed for FF or else tooltip goes to far left - - return best; - } - - /*===== - dijit.place.__Position = function(){ - // x: Integer - // horizontal coordinate in pixels, relative to document body - // y: Integer - // vertical coordinate in pixels, relative to document body - - this.x = x; - this.y = y; - }; - =====*/ - - /*===== - dijit.place.__Rectangle = function(){ - // x: Integer - // horizontal offset in pixels, relative to document body - // y: Integer - // vertical offset in pixels, relative to document body - // w: Integer - // width in pixels. Can also be specified as "width" for backwards-compatibility. - // h: Integer - // height in pixels. Can also be specified as "height" from backwards-compatibility. - - this.x = x; - this.y = y; - this.w = w; - this.h = h; - }; - =====*/ - - return (dijit.place = { - // summary: - // Code to place a DOMNode relative to another DOMNode. - // Load using require(["dijit/place"], function(place){ ... }). - - at: function(node, pos, corners, padding){ - // summary: - // Positions one of the node's corners at specified position - // such that node is fully visible in viewport. - // description: - // NOTE: node is assumed to be absolutely or relatively positioned. - // node: DOMNode - // The node to position - // pos: dijit.place.__Position - // Object like {x: 10, y: 20} - // corners: String[] - // Array of Strings representing order to try corners in, like ["TR", "BL"]. - // Possible values are: - // * "BL" - bottom left - // * "BR" - bottom right - // * "TL" - top left - // * "TR" - top right - // padding: dijit.place.__Position? - // optional param to set padding, to put some buffer around the element you want to position. - // example: - // Try to place node's top right corner at (10,20). - // If that makes node go (partially) off screen, then try placing - // bottom left corner at (10,20). - // | place(node, {x: 10, y: 20}, ["TR", "BL"]) - var choices = array.map(corners, function(corner){ - var c = { corner: corner, pos: {x:pos.x,y:pos.y} }; - if(padding){ - c.pos.x += corner.charAt(1) == 'L' ? padding.x : -padding.x; - c.pos.y += corner.charAt(0) == 'T' ? padding.y : -padding.y; - } - return c; - }); - - return _place(node, choices); - }, - - around: function( - /*DomNode*/ node, - /*DomNode || dijit.place.__Rectangle*/ anchor, - /*String[]*/ positions, - /*Boolean*/ leftToRight, - /*Function?*/ layoutNode){ - - // summary: - // Position node adjacent or kitty-corner to anchor - // such that it's fully visible in viewport. - // - // description: - // Place node such that corner of node touches a corner of - // aroundNode, and that node is fully visible. - // - // anchor: - // Either a DOMNode or a __Rectangle (object with x, y, width, height). - // - // positions: - // Ordered list of positions to try matching up. - // * before: places drop down to the left of the anchor node/widget, or to the right in the case - // of RTL scripts like Hebrew and Arabic; aligns either the top of the drop down - // with the top of the anchor, or the bottom of the drop down with bottom of the anchor. - // * after: places drop down to the right of the anchor node/widget, or to the left in the case - // of RTL scripts like Hebrew and Arabic; aligns either the top of the drop down - // with the top of the anchor, or the bottom of the drop down with bottom of the anchor. - // * before-centered: centers drop down 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 drop down to the right of the anchor node/widget, or to the left - // in the case of RTL scripts like Hebrew and Arabic - // * above-centered: drop down is centered above anchor node - // * above: drop down goes above anchor node, left sides aligned - // * above-alt: drop down goes above anchor node, right sides aligned - // * below-centered: drop down is centered above anchor node - // * below: drop down goes below anchor node - // * below-alt: drop down goes below anchor node, right sides aligned - // - // layoutNode: Function(node, aroundNodeCorner, nodeCorner) - // For things like tooltip, they are displayed differently (and have different dimensions) - // based on their orientation relative to the parent. This adjusts the popup based on orientation. - // - // leftToRight: - // True if widget is LTR, false if widget is RTL. Affects the behavior of "above" and "below" - // positions slightly. - // - // example: - // | placeAroundNode(node, aroundNode, {'BL':'TL', 'TR':'BR'}); - // This will try to position node such that node's top-left corner is at the same position - // as the bottom left corner of the aroundNode (ie, put node below - // aroundNode, with left edges aligned). If that fails it will try to put - // the bottom-right corner of node where the top right corner of aroundNode is - // (ie, put node above aroundNode, with right edges aligned) - // - - // if around is a DOMNode (or DOMNode id), convert to coordinates - var aroundNodePos = (typeof anchor == "string" || "offsetWidth" in anchor) - ? domGeometry.position(anchor, true) - : anchor; - - // Adjust anchor positioning for the case that a parent node has overflw hidden, therefore cuasing the anchor not to be completely visible - if(anchor.parentNode){ - var parent = anchor.parentNode; - while(parent && parent.nodeType == 1 && parent.nodeName != "BODY"){ //ignoring the body will help performance - var parentPos = domGeometry.position(parent, true); - var parentStyleOverflow = domStyle.getComputedStyle(parent).overflow; - if(parentStyleOverflow == "hidden" || parentStyleOverflow == "auto" || parentStyleOverflow == "scroll"){ - var bottomYCoord = Math.min(aroundNodePos.y + aroundNodePos.h, parentPos.y + parentPos.h); - var rightXCoord = Math.min(aroundNodePos.x + aroundNodePos.w, parentPos.x + parentPos.w); - aroundNodePos.x = Math.max(aroundNodePos.x, parentPos.x); - aroundNodePos.y = Math.max(aroundNodePos.y, parentPos.y); - aroundNodePos.h = bottomYCoord - aroundNodePos.y; - aroundNodePos.w = rightXCoord - aroundNodePos.x; - } - parent = parent.parentNode; - } - } - - var x = aroundNodePos.x, - y = aroundNodePos.y, - width = "w" in aroundNodePos ? aroundNodePos.w : (aroundNodePos.w = aroundNodePos.width), - height = "h" in aroundNodePos ? aroundNodePos.h : (kernel.deprecated("place.around: dijit.place.__Rectangle: { x:"+x+", y:"+y+", height:"+aroundNodePos.height+", width:"+width+" } has been deprecated. Please use { x:"+x+", y:"+y+", h:"+aroundNodePos.height+", w:"+width+" }", "", "2.0"), aroundNodePos.h = aroundNodePos.height); - - // Convert positions arguments into choices argument for _place() - var choices = []; - function push(aroundCorner, corner){ - choices.push({ - aroundCorner: aroundCorner, - corner: corner, - pos: { - x: { - 'L': x, - 'R': x + width, - 'M': x + (width >> 1) - }[aroundCorner.charAt(1)], - y: { - 'T': y, - 'B': y + height, - 'M': y + (height >> 1) - }[aroundCorner.charAt(0)] - } - }) - } - array.forEach(positions, function(pos){ - var ltr = leftToRight; - switch(pos){ - case "above-centered": - push("TM", "BM"); - break; - case "below-centered": - push("BM", "TM"); - break; - case "after-centered": - ltr = !ltr; - // fall through - case "before-centered": - push(ltr ? "ML" : "MR", ltr ? "MR" : "ML"); - break; - case "after": - ltr = !ltr; - // fall through - case "before": - push(ltr ? "TL" : "TR", ltr ? "TR" : "TL"); - push(ltr ? "BL" : "BR", ltr ? "BR" : "BL"); - break; - case "below-alt": - ltr = !ltr; - // fall through - case "below": - // first try to align left borders, next try to align right borders (or reverse for RTL mode) - push(ltr ? "BL" : "BR", ltr ? "TL" : "TR"); - push(ltr ? "BR" : "BL", ltr ? "TR" : "TL"); - break; - case "above-alt": - ltr = !ltr; - // fall through - case "above": - // first try to align left borders, next try to align right borders (or reverse for RTL mode) - push(ltr ? "TL" : "TR", ltr ? "BL" : "BR"); - push(ltr ? "TR" : "TL", ltr ? "BR" : "BL"); - break; - default: - // To assist dijit/_base/place, accept arguments of type {aroundCorner: "BL", corner: "TL"}. - // Not meant to be used directly. - push(pos.aroundCorner, pos.corner); - } - }); - - var position = _place(node, choices, layoutNode, {w: width, h: height}); - position.aroundNodePos = aroundNodePos; - - return position; - } - }); -}); - -}, -'dijit/_HasDropDown':function(){ -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 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 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 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; - } - } - - }); -}); - -}, -'dijit/tree/TreeStoreModel':function(){ -define("dijit/tree/TreeStoreModel", [ - "dojo/_base/array", // array.filter array.forEach array.indexOf array.some - "dojo/aspect", // aspect.after - "dojo/_base/declare", // declare - "dojo/_base/json", // json.stringify - "dojo/_base/lang" // lang.hitch -], function(array, aspect, declare, json, lang){ - - // module: - // dijit/tree/TreeStoreModel - // summary: - // Implements dijit.Tree.model connecting to a dojo.data store with a single - // root item. - - return declare("dijit.tree.TreeStoreModel", null, { - // summary: - // Implements dijit.Tree.model connecting to a dojo.data store with a single - // root item. Any methods passed into the constructor will override - // the ones defined here. - - // store: dojo.data.Store - // Underlying store - store: null, - - // childrenAttrs: String[] - // One or more attribute names (attributes in the dojo.data item) that specify that item's children - childrenAttrs: ["children"], - - // newItemIdAttr: String - // Name of attribute in the Object passed to newItem() that specifies the id. - // - // If newItemIdAttr is set then it's used when newItem() is called to see if an - // item with the same id already exists, and if so just links to the old item - // (so that the old item ends up with two parents). - // - // Setting this to null or "" will make every drop create a new item. - newItemIdAttr: "id", - - // labelAttr: String - // If specified, get label for tree node from this attribute, rather - // than by calling store.getLabel() - labelAttr: "", - - // root: [readonly] dojo.data.Item - // Pointer to the root item (read only, not a parameter) - root: null, - - // query: anything - // Specifies datastore query to return the root item for the tree. - // Must only return a single item. Alternately can just pass in pointer - // to root item. - // example: - // | {id:'ROOT'} - query: null, - - // deferItemLoadingUntilExpand: Boolean - // Setting this to true will cause the TreeStoreModel to defer calling loadItem on nodes - // until they are expanded. This allows for lazying loading where only one - // loadItem (and generally one network call, consequently) per expansion - // (rather than one for each child). - // This relies on partial loading of the children items; each children item of a - // fully loaded item should contain the label and info about having children. - deferItemLoadingUntilExpand: false, - - constructor: function(/* Object */ args){ - // summary: - // Passed the arguments listed above (store, etc) - // tags: - // private - - lang.mixin(this, args); - - this.connects = []; - - var store = this.store; - if(!store.getFeatures()['dojo.data.api.Identity']){ - throw new Error("dijit.Tree: store must support dojo.data.Identity"); - } - - // if the store supports Notification, subscribe to the notification events - if(store.getFeatures()['dojo.data.api.Notification']){ - this.connects = this.connects.concat([ - aspect.after(store, "onNew", lang.hitch(this, "onNewItem"), true), - aspect.after(store, "onDelete", lang.hitch(this, "onDeleteItem"), true), - aspect.after(store, "onSet", lang.hitch(this, "onSetItem"), true) - ]); - } - }, - - destroy: function(){ - var h; - while(h = this.connects.pop()){ h.remove(); } - // TODO: should cancel any in-progress processing of getRoot(), getChildren() - }, - - // ======================================================================= - // Methods for traversing hierarchy - - getRoot: function(onItem, onError){ - // summary: - // Calls onItem with the root item for the tree, possibly a fabricated item. - // Calls onError on error. - if(this.root){ - onItem(this.root); - }else{ - this.store.fetch({ - query: this.query, - onComplete: lang.hitch(this, function(items){ - if(items.length != 1){ - throw new Error(this.declaredClass + ": query " + json.stringify(this.query) + " returned " + items.length + - " items, but must return exactly one item"); - } - this.root = items[0]; - onItem(this.root); - }), - onError: onError - }); - } - }, - - mayHaveChildren: function(/*dojo.data.Item*/ item){ - // summary: - // Tells if an item has or may have children. Implementing logic here - // avoids showing +/- expando icon for nodes that we know don't have children. - // (For efficiency reasons we may not want to check if an element actually - // has children until user clicks the expando node) - return array.some(this.childrenAttrs, function(attr){ - return this.store.hasAttribute(item, attr); - }, this); - }, - - getChildren: function(/*dojo.data.Item*/ parentItem, /*function(items)*/ onComplete, /*function*/ onError){ - // summary: - // Calls onComplete() with array of child items of given parent item, all loaded. - - var store = this.store; - if(!store.isItemLoaded(parentItem)){ - // The parent is not loaded yet, we must be in deferItemLoadingUntilExpand - // mode, so we will load it and just return the children (without loading each - // child item) - var getChildren = lang.hitch(this, arguments.callee); - store.loadItem({ - item: parentItem, - onItem: function(parentItem){ - getChildren(parentItem, onComplete, onError); - }, - onError: onError - }); - return; - } - // get children of specified item - var childItems = []; - for(var i=0; i= 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(); - } - } -}); - -}); - -}, -'dijit/focus':function(){ -define("dijit/focus", [ - "dojo/aspect", - "dojo/_base/declare", // declare - "dojo/dom", // domAttr.get dom.isDescendant - "dojo/dom-attr", // domAttr.get dom.isDescendant - "dojo/dom-construct", // connect to domConstruct.empty, domConstruct.destroy - "dojo/Evented", - "dojo/_base/lang", // lang.hitch - "dojo/on", - "dojo/ready", - "dojo/_base/sniff", // has("ie") - "dojo/Stateful", - "dojo/_base/unload", // unload.addOnWindowUnload - "dojo/_base/window", // win.body - "dojo/window", // winUtils.get - "./a11y", // a11y.isTabNavigable - "./registry", // registry.byId - "." // to set dijit.focus -], function(aspect, declare, dom, domAttr, domConstruct, Evented, lang, on, ready, has, Stateful, unload, win, winUtils, - a11y, registry, dijit){ - - // module: - // dijit/focus - // summary: - // Returns a singleton that tracks the currently focused node, and which widgets are currently "active". - -/*===== - dijit.focus = { - // summary: - // Tracks the currently focused node, and which widgets are currently "active". - // Access via require(["dijit/focus"], function(focus){ ... }). - // - // A widget is considered active if it or a descendant widget has focus, - // or if a non-focusable node of this widget or a descendant was recently clicked. - // - // Call focus.watch("curNode", callback) to track the current focused DOMNode, - // or focus.watch("activeStack", callback) to track the currently focused stack of widgets. - // - // Call focus.on("widget-blur", func) or focus.on("widget-focus", ...) to monitor when - // when widgets become active/inactive - // - // Finally, focus(node) will focus a node, suppressing errors if the node doesn't exist. - - // curNode: DomNode - // Currently focused item on screen - curNode: null, - - // activeStack: dijit._Widget[] - // List of currently active widgets (focused widget and it's ancestors) - activeStack: [], - - registerIframe: function(iframe){ - // summary: - // Registers listeners on the specified iframe so that any click - // or focus event on that iframe (or anything in it) is reported - // as a focus/click event on the