wishthis/node_modules/fomantic-ui/dist/components/flyout.min.js

11 lines
22 KiB
JavaScript
Raw Normal View History

2022-09-30 13:48:25 +00:00
/*
2022-10-10 08:26:02 +00:00
* # Fomantic UI - 2.9.0
2022-09-30 13:48:25 +00:00
* https://github.com/fomantic/Fomantic-UI
* http://fomantic-ui.com/
*
* Copyright 2022 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
2022-10-10 08:26:02 +00:00
!function(Q,U,X,_){"use strict";Q.isFunction=Q.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},U=void 0!==U&&U.Math==Math?U:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),Q.flyout=Q.fn.flyout=function(O){var P,e=Q(this),D=Q(U),L=Q(X),z=Q("html"),B=Q("head"),N=Q("body"),R=e.selector||"",I=(new Date).getTime(),j=[],K=O,V="string"==typeof K,W=[].slice.call(arguments,1),q=U.requestAnimationFrame||U.mozRequestAnimationFrame||U.webkitRequestAnimationFrame||U.msRequestAnimationFrame||function(e){setTimeout(e,0)};return e.each(function(){var t,e,o,s,n,i,r,c,l=Q.isPlainObject(O)?Q.extend(!0,{},Q.fn.flyout.settings,O):Q.extend({},Q.fn.flyout.settings),a=l.selector,u=l.className,d=l.namespace,f=l.fields,h=l.regExp,g=l.error,p="."+d,m="module-"+d,b=Q(this),v=[U,X].indexOf(l.context)<0?L.find(l.context):N,y=b.find(a.close),k=b.children(a.flyout),x=v.children(a.pusher),w=b.hasClass("flyout"),S=this,C=w?b.data(m):_,A=!1,T=v[0]===N[0],F="",E="",H=!1,M={initialize:function(){var s;M.debug("Initializing flyout",O),M.create.id(),w||(M.create.flyout(),Q.isFunction(l.onHidden)||(l.onHidden=function(){M.destroy(),b.remove()}),l.autoShow||(l.autoShow=!0)),b.addClass(l.class),""!==l.title&&b.find(a.header).html(M.helpers.escape(l.title,l.preserveHTML)).addClass(l.classTitle),""!==l.content&&b.find(a.content).html(M.helpers.escape(l.content,l.preserveHTML)).addClass(l.classContent),M.has.configActions()&&(0===(s=b.find(a.actions).addClass(l.classActions)).length?s=Q("<div/>",{class:u.actions+" "+(l.classActions||"")}).appendTo(b):s.empty(),l.actions.forEach(function(e){var t=e[f.icon]?"<i "+(e[f.text]?'aria-hidden="true"':"")+' class="'+M.helpers.deQuote(e[f.icon])+' icon"></i>':"",n=M.helpers.escape(e[f.text]||"",l.preserveHTML),i=M.helpers.deQuote(e[f.class]||""),o=e[f.click]&&Q.isFunction(e[f.click])?e[f.click]:function(){};s.append(Q("<button/>",{html:t+n,"aria-label":(e[f.text]||e[f.icon]||"").replace(/<[^>]+(>|$)/g,""),class:u.button+" "+i,click:function(){!1!==o.call(S,b)&&M.hide()}}))})),c=M.get.transitionEvent(),l.delaySetup?q(M.setup.layout):M.setup.layout(),q(function(){M.setup.cache()}),"left"!=M.get.direction()&&"right"!=M.get.direction()||(M.setup.heights(),M.bind.resize()),M.bind.events(),M.observeChanges(),M.instantiate(),l.autoShow&&M.show()},instantiate:function(){M.verbose("Storing instance of module",M),C=M,b.data(m,C)},create:{flyout:function(){var e;M.verbose("Programmaticaly create flyout",v),b=Q("<div/>",{class:u.flyout,role:"dialog","aria-modal":l.dimPage}),l.closeIcon&&(y=Q("<i/>",{class:u.close,role:"button",tabindex:0,"aria-label":l.text.close}),b.append(y)),""!==l.title&&(e="_"+M.get.id()+"title",b.attr("aria-labelledby",e),Q("<div/>",{class:u.header,id:e}).appendTo(b)),""!==l.content&&(e="_"+M.get.id()+"desc",b.attr("aria-describedby",e),Q("<div/>",{class:u.content,id:e}).appendTo(b)),M.has.configActions()&&Q("<div/>",{class:u.actions}).appendTo(b),b.prependTo(v),S=b[0]},id:function(){n=(Math.random().toString(16)+"000000000").slice(2,10),s="."+n,M.verbose("Creating unique id for element",n)}},destroy:function(){i&&i.disconnect(),M.verbose("Destroying previous module for",b),b.off(p).removeData(m),M.is.ios()&&M.remove.ios(),y.off(s),t&&t.off(s),v.off(s),D.off(s),L.off(s)},event:{keyboard:function(e){e.which===l.keys.escape&&(l.closable?(M.debug("Escape key pressed hiding flyout"),M.hide()):M.debug("Escape key pressed, but closable is set to false"),e.preventDefault())},resize:function(){M.setup.heights()},clickaway:function(e){var t;l.closable&&(t=0<x.find(e.target).length||x.is(e.target),e=v.is(e.target),t&&(M.verbose("User clicked on dimmed page"),M.hide()),e&&(M.verbose("User clicked on dimmable context (scaled out page)"),M.hide()))},close:function(e){M.hide()},closeKeyUp:function(e){e=e.which;e!==l.keys.enter&&e!==l.keys.space||M.hide()},inputKeyDown:{first:function(e){e.which===l.keys.tab&&e.shiftKey&&(t.last().focus(),e.preventDefault())},last:function(e){e.which!==l.keys.tab||e.shiftKey||(t.first().focus(),e.preventDefault())}},approve:function(e){A