From e10856876067b5cfa40791a3b340a605ea4201c7 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 18 Mar 2013 10:37:03 +0400 Subject: dojo: add some more controls to the layer --- lib/dojo/tt-rss-layer.js.uncompressed.js | 462 +++++++++++++++++++++++++++++++ 1 file changed, 462 insertions(+) (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 index 7b94f4a95..8d05b4f80 100644 --- a/lib/dojo/tt-rss-layer.js.uncompressed.js +++ b/lib/dojo/tt-rss-layer.js.uncompressed.js @@ -1,4 +1,5 @@ require({cache:{ +'url:dijit/templates/CheckedMenuItem.html':"\n\t\n\t\t\"\"\n\t\t\n\t\n\t\n\t\n\t \n\n", 'dijit/form/TextBox':function(){ require({cache:{ 'url:dijit/form/templates/TextBox.html':"
\n"}}); @@ -1326,6 +1327,7 @@ return ScrollingTabController; }); }, +'url:dijit/form/templates/ComboButton.html':"
\n", 'dijit/DialogUnderlay':function(){ define("dijit/DialogUnderlay", [ "dojo/_base/declare", // declare @@ -6844,6 +6846,94 @@ define("dijit/layout/AccordionContainer", [ return AccordionContainer; }); +}, +'dijit/form/ComboButton':function(){ +require({cache:{ +'url:dijit/form/templates/ComboButton.html':"
\n"}}); +define("dijit/form/ComboButton", [ + "dojo/_base/declare", // declare + "dojo/_base/event", // event.stop + "dojo/keys", // keys + "../focus", // focus.focus() + "./DropDownButton", + "dojo/text!./templates/ComboButton.html" +], function(declare, event, keys, focus, DropDownButton, template){ + +// module: +// dijit/form/ComboButton + +return declare("dijit.form.ComboButton", DropDownButton, { + // summary: + // A combination button and drop-down button. + // Users can click one side to "press" the button, or click an arrow + // icon to display the drop down. + // + // example: + // | + // + // example: + // | var button1 = new ComboButton({label: "hello world", onClick: foo, dropDown: "myMenu"}); + // | dojo.body().appendChild(button1.domNode); + // + + templateString: template, + + // Map widget attributes to DOMNode attributes. + _setIdAttr: "", // override _FormWidgetMixin which puts id on the focusNode + _setTabIndexAttr: ["focusNode", "titleNode"], + _setTitleAttr: "titleNode", + + // optionsTitle: String + // Text that describes the options menu (accessibility) + optionsTitle: "", + + baseClass: "dijitComboButton", + + // Set classes like dijitButtonContentsHover or dijitArrowButtonActive depending on + // mouse action over specified node + cssStateNodes: { + "buttonNode": "dijitButtonNode", + "titleNode": "dijitButtonContents", + "_popupStateNode": "dijitDownArrowButton" + }, + + _focusedNode: null, + + _onButtonKeyPress: function(/*Event*/ evt){ + // summary: + // Handler for right arrow key when focus is on left part of button + if(evt.charOrCode == keys[this.isLeftToRight() ? "RIGHT_ARROW" : "LEFT_ARROW"]){ + focus.focus(this._popupStateNode); + event.stop(evt); + } + }, + + _onArrowKeyPress: function(/*Event*/ evt){ + // summary: + // Handler for left arrow key when focus is on right part of button + if(evt.charOrCode == keys[this.isLeftToRight() ? "LEFT_ARROW" : "RIGHT_ARROW"]){ + focus.focus(this.titleNode); + event.stop(evt); + } + }, + + focus: function(/*String*/ position){ + // summary: + // Focuses this widget to according to position, if specified, + // otherwise on arrow node + // position: + // "start" or "end" + if(!this.disabled){ + focus.focus(position == "start" ? this.titleNode : this._popupStateNode); + } + } +}); + +}); + }, 'dijit/form/_AutoCompleterMixin':function(){ define("dijit/form/_AutoCompleterMixin", [ @@ -8254,6 +8344,82 @@ define("dijit/_base/window", [ }; }); +}, +'dijit/PopupMenuItem':function(){ +define("dijit/PopupMenuItem", [ + "dojo/_base/declare", // declare + "dojo/dom-style", // domStyle.set + "dojo/query", // query + "./registry", // registry.byNode + "./MenuItem", + "./hccss" +], function(declare, domStyle, query, registry, MenuItem){ + + // module: + // dijit/PopupMenuItem + + return declare("dijit.PopupMenuItem", MenuItem, { + // summary: + // An item in a Menu that spawn a drop down (usually a drop down menu) + + _fillContent: function(){ + // summary: + // When Menu is declared in markup, this code gets the menu label and + // the popup widget from the srcNodeRef. + // description: + // srcNodeRefinnerHTML contains both the menu item text and a popup widget + // The first part holds the menu item text and the second part is the popup + // example: + // |
+ // | pick me + // | ... + // |
+ // tags: + // protected + + if(this.srcNodeRef){ + var nodes = query("*", this.srcNodeRef); + this.inherited(arguments, [nodes[0]]); + + // save pointer to srcNode so we can grab the drop down widget after it's instantiated + this.dropDownContainer = this.srcNodeRef; + } + }, + + startup: function(){ + if(this._started){ return; } + this.inherited(arguments); + + // we didn't copy the dropdown widget from the this.srcNodeRef, so it's in no-man's + // land now. move it to win.doc.body. + if(!this.popup){ + var node = query("[widgetId]", this.dropDownContainer)[0]; + this.popup = registry.byNode(node); + } + this.ownerDocumentBody.appendChild(this.popup.domNode); + this.popup.startup(); + + this.popup.domNode.style.display="none"; + if(this.arrowWrapper){ + domStyle.set(this.arrowWrapper, "visibility", ""); + } + this.focusNode.setAttribute("aria-haspopup", "true"); + }, + + destroyDescendants: function(/*Boolean*/ preserveDom){ + if(this.popup){ + // Destroy the popup, unless it's already been destroyed. This can happen because + // the popup is a direct child of even though it's logically my child. + if(!this.popup._destroyed){ + this.popup.destroyRecursive(preserveDom); + } + delete this.popup; + } + this.inherited(arguments); + } + }); +}); + }, 'dojo/hccss':function(){ define("dojo/hccss", [ @@ -13614,6 +13780,34 @@ string.trim = String.prototype.trim ? }, 'url:dijit/templates/MenuSeparator.html':"\n\t\n\t\t
\n\t\t
\n\t\n\t\n\t\t
\n\t\t
\n\t\n", +'dijit/layout/AccordionPane':function(){ +define("dijit/layout/AccordionPane", [ + "dojo/_base/declare", // declare + "dojo/_base/kernel", // kernel.deprecated + "./ContentPane" +], function(declare, kernel, ContentPane){ + + // module: + // dijit/layout/AccordionPane + + return declare("dijit.layout.AccordionPane", ContentPane, { + // summary: + // Deprecated widget. Use `dijit/layout/ContentPane` instead. + // tags: + // deprecated + + constructor: function(){ + kernel.deprecated("dijit.layout.AccordionPane deprecated, use ContentPane instead", "", "2.0"); + }, + + onSelected: function(){ + // summary: + // called when this pane is selected + } + }); +}); + +}, 'dijit/dijit':function(){ define("dijit/dijit", [ "./main", @@ -14938,6 +15132,183 @@ Moveable.__MoveableArgs = declare([], { return Moveable; }); +}, +'dijit/TooltipDialog':function(){ +require({cache:{ +'url:dijit/templates/TooltipDialog.html':"
\n\t
\n\t\t
\n\t
\n\t
\n
\n"}}); +define("dijit/TooltipDialog", [ + "dojo/_base/declare", // declare + "dojo/dom-class", // domClass.replace + "dojo/_base/event", // event.stop + "dojo/keys", // keys + "dojo/_base/lang", // lang.hitch + "./focus", + "./layout/ContentPane", + "./_DialogMixin", + "./form/_FormMixin", + "./_TemplatedMixin", + "dojo/text!./templates/TooltipDialog.html", + "./main" // exports methods to dijit global +], function(declare, domClass, event, keys, lang, + focus, ContentPane, _DialogMixin, _FormMixin, _TemplatedMixin, template, dijit){ + + // module: + // dijit/TooltipDialog + + + return declare("dijit.TooltipDialog", + [ContentPane, _TemplatedMixin, _FormMixin, _DialogMixin], { + // summary: + // Pops up a dialog that appears like a Tooltip + + // title: String + // Description of tooltip dialog (required for a11y) + title: "", + + // doLayout: [protected] Boolean + // Don't change this parameter from the default value. + // This ContentPane parameter doesn't make sense for TooltipDialog, since TooltipDialog + // is never a child of a layout container, nor can you specify the size of + // TooltipDialog in order to control the size of an inner widget. + doLayout: false, + + // autofocus: Boolean + // A Toggle to modify the default focus behavior of a Dialog, which + // is to focus on the first dialog element after opening the dialog. + // False will disable autofocusing. Default: true. + autofocus: true, + + // baseClass: [protected] String + // The root className to use for the various states of this widget + baseClass: "dijitTooltipDialog", + + // _firstFocusItem: [private readonly] DomNode + // The pointer to the first focusable node in the dialog. + // Set by `dijit/_DialogMixin._getFocusItems()`. + _firstFocusItem: null, + + // _lastFocusItem: [private readonly] DomNode + // The pointer to which node has focus prior to our dialog. + // Set by `dijit/_DialogMixin._getFocusItems()`. + _lastFocusItem: null, + + templateString: template, + + _setTitleAttr: function(/*String*/ title){ + this.containerNode.title = title; + this._set("title", title); + }, + + postCreate: function(){ + this.inherited(arguments); + this.connect(this.containerNode, "onkeypress", "_onKey"); + }, + + orient: function(/*DomNode*/ node, /*String*/ aroundCorner, /*String*/ tooltipCorner){ + // summary: + // Configure widget to be displayed in given position relative to the button. + // This is called from the dijit.popup code, and should not be called + // directly. + // tags: + // protected + + // Note: intentionally not using dijitTooltip class since that sets position:absolute, which + // confuses dijit/popup trying to get the size of the tooltip. + var newC = { + "MR-ML": "dijitTooltipRight", + "ML-MR": "dijitTooltipLeft", + "TM-BM": "dijitTooltipAbove", + "BM-TM": "dijitTooltipBelow", + "BL-TL": "dijitTooltipBelow dijitTooltipABLeft", + "TL-BL": "dijitTooltipAbove dijitTooltipABLeft", + "BR-TR": "dijitTooltipBelow dijitTooltipABRight", + "TR-BR": "dijitTooltipAbove dijitTooltipABRight", + "BR-BL": "dijitTooltipRight", + "BL-BR": "dijitTooltipLeft" + }[aroundCorner + "-" + tooltipCorner]; + + domClass.replace(this.domNode, newC, this._currentOrientClass || ""); + this._currentOrientClass = newC; + + // Tooltip.orient() has code to reposition connector for when Tooltip is before/after anchor. + // Not putting here to avoid code bloat, and since TooltipDialogs are generally above/below. + // Should combine code from Tooltip and TooltipDialog. + }, + + focus: function(){ + // summary: + // Focus on first field + this._getFocusItems(this.containerNode); + focus.focus(this._firstFocusItem); + }, + + onOpen: function(/*Object*/ pos){ + // summary: + // Called when dialog is displayed. + // This is called from the dijit.popup code, and should not be called directly. + // tags: + // protected + + this.orient(this.domNode,pos.aroundCorner, pos.corner); + + // Position the tooltip connector for middle alignment. + // This could not have been done in orient() since the tooltip wasn't positioned at that time. + var aroundNodeCoords = pos.aroundNodePos; + if(pos.corner.charAt(0) == 'M' && pos.aroundCorner.charAt(0) == 'M'){ + this.connectorNode.style.top = aroundNodeCoords.y + ((aroundNodeCoords.h - this.connectorNode.offsetHeight) >> 1) - pos.y + "px"; + this.connectorNode.style.left = ""; + }else if(pos.corner.charAt(1) == 'M' && pos.aroundCorner.charAt(1) == 'M'){ + this.connectorNode.style.left = aroundNodeCoords.x + ((aroundNodeCoords.w - this.connectorNode.offsetWidth) >> 1) - pos.x + "px"; + } + + this._onShow(); // lazy load trigger (TODO: shouldn't we load before positioning?) + }, + + onClose: function(){ + // summary: + // Called when dialog is hidden. + // This is called from the dijit.popup code, and should not be called directly. + // tags: + // protected + this.onHide(); + }, + + _onKey: function(/*Event*/ evt){ + // summary: + // Handler for keyboard events + // description: + // Keep keyboard focus in dialog; close dialog on escape key + // tags: + // private + + var node = evt.target; + if(evt.charOrCode === keys.TAB){ + this._getFocusItems(this.containerNode); + } + var singleFocusItem = (this._firstFocusItem == this._lastFocusItem); + if(evt.charOrCode == keys.ESCAPE){ + // Use defer to avoid crash on IE, see #10396. + this.defer("onCancel"); + event.stop(evt); + }else if(node == this._firstFocusItem && evt.shiftKey && evt.charOrCode === keys.TAB){ + if(!singleFocusItem){ + focus.focus(this._lastFocusItem); // send focus to last item in dialog + } + event.stop(evt); + }else if(node == this._lastFocusItem && evt.charOrCode === keys.TAB && !evt.shiftKey){ + if(!singleFocusItem){ + focus.focus(this._firstFocusItem); // send focus to first item in dialog + } + event.stop(evt); + }else if(evt.charOrCode === keys.TAB){ + // we want the browser's default tab handling to move focus + // but we don't want the tab to propagate upwards + evt.stopPropagation(); + } + } + }); +}); + }, 'dojo/store/util/SimpleQueryEngine':function(){ define("dojo/store/util/SimpleQueryEngine", ["../../_base/array" /*=====, "../api/Store" =====*/], function(arrayUtil /*=====, Store =====*/){ @@ -15619,6 +15990,40 @@ define("dijit/layout/TabController", [ return TabController; }); +}, +'dijit/ToolbarSeparator':function(){ +define("dijit/ToolbarSeparator", [ + "dojo/_base/declare", // declare + "dojo/dom", // dom.setSelectable + "./_Widget", + "./_TemplatedMixin" +], function(declare, dom, _Widget, _TemplatedMixin){ + + // module: + // dijit/ToolbarSeparator + + + return declare("dijit.ToolbarSeparator", [_Widget, _TemplatedMixin], { + // summary: + // A spacer between two `dijit.Toolbar` items + + templateString: '', + + buildRendering: function(){ + this.inherited(arguments); + dom.setSelectable(this.domNode, false); + }, + + isFocusable: function(){ + // summary: + // This widget isn't focusable, so pass along that fact. + // tags: + // protected + return false; + } + }); +}); + }, 'dijit/layout/_LayoutWidget':function(){ define("dijit/layout/_LayoutWidget", [ @@ -16560,6 +16965,7 @@ define("dijit/layout/StackController", [ }); }, +'url:dijit/templates/TooltipDialog.html':"
\n\t
\n\t\t
\n\t
\n\t
\n
\n", 'dojo/dnd/Mover':function(){ define("dojo/dnd/Mover", [ "../_base/array", "../_base/declare", "../_base/event", "../_base/lang", "../sniff", "../_base/window", @@ -28665,6 +29071,62 @@ exports.isFormElement = function(/*Event*/ e){ return exports; }); +}, +'dijit/CheckedMenuItem':function(){ +require({cache:{ +'url:dijit/templates/CheckedMenuItem.html':"\n\t\n\t\t\"\"\n\t\t\n\t\n\t\n\t\n\t \n\n"}}); +define("dijit/CheckedMenuItem", [ + "dojo/_base/declare", // declare + "dojo/dom-class", // domClass.toggle + "./MenuItem", + "dojo/text!./templates/CheckedMenuItem.html", + "./hccss" +], function(declare, domClass, MenuItem, template){ + + // module: + // dijit/CheckedMenuItem + + return declare("dijit.CheckedMenuItem", MenuItem, { + // summary: + // A checkbox-like menu item for toggling on and off + + templateString: template, + + // checked: Boolean + // Our checked state + checked: false, + _setCheckedAttr: function(/*Boolean*/ checked){ + // summary: + // Hook so attr('checked', bool) works. + // Sets the class and state for the check box. + domClass.toggle(this.domNode, "dijitCheckedMenuItemChecked", checked); + this.domNode.setAttribute("aria-checked", checked ? "true" : "false"); + this._set("checked", checked); + }, + + iconClass: "", // override dijitNoIcon + + onChange: function(/*Boolean*/ /*===== checked =====*/){ + // summary: + // User defined function to handle check/uncheck events + // tags: + // callback + }, + + _onClick: function(evt){ + // summary: + // Clicking this item just toggles its state + // tags: + // private + if(!this.disabled){ + this.set("checked", !this.checked); + this.onChange(this.checked); + } + this.onClick(evt); + } + }); +}); + }, 'dijit/Viewport':function(){ define("dijit/Viewport", [ -- cgit v1.2.3-54-g00ecf