apex4x
Version:
The Comprehensive ARIA Development Suite
7 lines • 1.8 kB
JavaScript
/*@license
ARIA Dialog Module 2.0 for Apex 4X
Author: Bryan Garaventa (https://www.linkedin.com/in/bgaraventa)
Home: WhatSock.com : Download: https://github.com/whatsock/apex
License: MIT (https://opensource.org/licenses/MIT)
*/
"setDialog"in $A||($A.addWidgetProfile("Dialog",{track:[],configure:function(e){var o=this,t={};return e.isModal&&o.track.length&&(e=o.track[o.track.length-1].css("z-index")||1e3,t["z-index"]=e+2),{style:t,isModal:!0,isAlert:!1,exposeBounds:!0,forceFocus:!0,forceFocusWithin:!0,returnFocus:!0,exposeHiddenClose:!0,circularTabbing:!0,preload:!0,preloadImages:!0,preloadCSS:!0,className:"modal",root:"body",append:!0,escToClose:!0,on:"click",click:function(e,o){e.stopPropagation()}}},role:function(e){var o={};return o.role=e.isAlert?"alertdialog":"dialog",o["aria-modal"]=e.isModal?"true":"false",o},beforeRender:function(o,e){o.isModal&&(o.backdrop=$A(this.backdrop).on({click:function(e){o.remove(),e.stopPropagation()}}).css($A.isNum(o.style["z-index"])&&1<o.style["z-index"]?{zIndex:o.style["z-index"]-1}:{}).appendTo("body").return())},afterRender:function(e,o){this.track.push(e),$A.hideBackground(e.wrapper),e.announce=!0===e.isAlert},afterRemove:function(e,o){var t=this;t.track.splice(t.track.length-1,1),t.track.length?(e.isModal&&$A.hideBackground(t.track[t.track.length-1].wrapper),e.rerouteFocus=t.track[t.track.length-1]):e.isModal&&$A.showBackground(),e.isModal&&$A.isNode(e.backdrop,null,null,11)&&$A.remove(e.backdrop)},backdrop:'<div class="modalBackdrop"></div>'}),$A.extend({setDialog:function(e,o){this._4X&&(o=e,e=this._X),$A.isPlainObject(e)&&(e=(o=e).trigger||o.content||null);function t(e){r.push($A.toDC(e,$A.extend({widgetType:"Dialog"},o||{})))}var r=[];return e?$A.query(e,o.context||document,function(e,o){t(o)}):t(),1===r.length?r[0]:r}}));