芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/www/cepali/lib/amd/build/popover_region_controller.min.js
define(["jquery","core/str","core/custom_interaction_events"],function(a,b,c){var d={CONTENT:".popover-region-content",CONTENT_CONTAINER:".popover-region-content-container",MENU_CONTAINER:".popover-region-container",MENU_TOGGLE:".popover-region-toggle",CAN_RECEIVE_FOCUS:'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]'},e=function(b){this.root=a(b),this.content=this.root.find(d.CONTENT),this.contentContainer=this.root.find(d.CONTENT_CONTAINER),this.menuContainer=this.root.find(d.MENU_CONTAINER),this.menuToggle=this.root.find(d.MENU_TOGGLE),this.isLoading=!1,this.promises={closeHandlers:a.Deferred(),navigationHandlers:a.Deferred()},this.registerBaseEventListeners()};return e.prototype.events=function(){return{menuOpened:"popoverregion:menuopened",menuClosed:"popoverregion:menuclosed",startLoading:"popoverregion:startLoading",stopLoading:"popoverregion:stopLoading"}},e.prototype.getContentContainer=function(){return this.contentContainer},e.prototype.getContent=function(){return this.content},e.prototype.isMenuOpen=function(){return!this.root.hasClass("collapsed")},e.prototype.toggleMenu=function(){this.isMenuOpen()?this.closeMenu():this.openMenu()},e.prototype.closeMenu=function(){this.isMenuOpen()&&(this.root.addClass("collapsed"),this.menuContainer.attr("aria-expanded","false"),this.menuContainer.attr("aria-hidden","true"),this.updateButtonAriaLabel(),this.root.trigger(this.events().menuClosed))},e.prototype.openMenu=function(){this.isMenuOpen()||(this.root.removeClass("collapsed"),this.menuContainer.attr("aria-expanded","true"),this.menuContainer.attr("aria-hidden","false"),this.updateButtonAriaLabel(),this.promises.closeHandlers.resolve(),this.promises.navigationHandlers.resolve(),this.root.trigger(this.events().menuOpened))},e.prototype.updateButtonAriaLabel=function(){this.isMenuOpen()?b.get_string("hidepopoverwindow").done(function(a){this.menuToggle.attr("aria-label",a)}.bind(this)):b.get_string("showpopoverwindow").done(function(a){this.menuToggle.attr("aria-label",a)}.bind(this))},e.prototype.startLoading=function(){this.isLoading=!0,this.getContentContainer().addClass("loading"),this.getContentContainer().attr("aria-busy","true"),this.root.trigger(this.events().startLoading)},e.prototype.stopLoading=function(){this.isLoading=!1,this.getContentContainer().removeClass("loading"),this.getContentContainer().attr("aria-busy","false"),this.root.trigger(this.events().stopLoading)},e.prototype.focusMenuToggle=function(){this.menuToggle.focus()},e.prototype.contentItemHasFocus=function(){return this.getContentItemWithFocus().length>0},e.prototype.getContentItemWithFocus=function(){var b=a(document.activeElement),c=this.getContent().children(),d=c.filter(b);return d.length||(d=c.has(b)),d},e.prototype.focusContentItem=function(a){a.is(d.CAN_RECEIVE_FOCUS)?a.focus():a.find(d.CAN_RECEIVE_FOCUS).first().focus()},e.prototype.focusFirstContentItem=function(){this.focusContentItem(this.getContent().children().first())},e.prototype.focusLastContentItem=function(){this.focusContentItem(this.getContent().children().last())},e.prototype.focusNextContentItem=function(){var a=this.getContentItemWithFocus();a.length&&a.next()&&this.focusContentItem(a.next())},e.prototype.focusPreviousContentItem=function(){var a=this.getContentItemWithFocus();a.length&&a.prev()&&this.focusContentItem(a.prev())},e.prototype.registerBaseEventListeners=function(){c.define(this.root,[c.events.activate,c.events.escape]),this.root.on(c.events.activate,d.MENU_TOGGLE,function(){this.toggleMenu()}.bind(this)),this.promises.closeHandlers.done(function(){this.root.on(c.events.escape,function(){this.closeMenu(),this.focusMenuToggle()}.bind(this)),a("html").click(function(b){var c=a(b.target);this.root.is(c)||this.root.has(c).length||this.closeMenu()}.bind(this)),c.define(this.getContentContainer(),[c.events.scrollBottom])}.bind(this))},e.prototype.registerListNavigationEventListeners=function(){c.define(this.root,[c.events.down]),this.root.on(c.events.down,function(a,b){this.isMenuOpen()?this.contentItemHasFocus()?this.focusNextContentItem():this.focusFirstContentItem():(this.openMenu(),this.focusFirstContentItem()),b.originalEvent.preventDefault()}.bind(this)),this.promises.navigationHandlers.done(function(){c.define(this.root,[c.events.up,c.events.home,c.events.end]),this.root.on(c.events.up,function(a,b){this.focusPreviousContentItem(),b.originalEvent.preventDefault()}.bind(this)),this.root.on(c.events.home,function(a,b){this.focusFirstContentItem(),b.originalEvent.preventDefault()}.bind(this)),this.root.on(c.events.end,function(a,b){this.focusLastContentItem(),b.originalEvent.preventDefault()}.bind(this))}.bind(this))},e});