wishthis/node_modules/fomantic-ui/dist/components/accordion.min.js
2022-04-08 12:55:35 +02:00

11 lines
No EOL
7.4 KiB
JavaScript

/*
* # Fomantic UI - 2.9.0-beta.275+3f2aae7
* https://github.com/fomantic/Fomantic-UI
* http://fomantic-ui.com/
*
* Copyright 2022 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function(T,k,F){"use strict";T.isFunction=T.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},k=void 0!==k&&k.Math==Math?k:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),T.fn.accordion=function(m){var h,v=T(this),b=(new Date).getTime(),y=[],C=m,O="string"==typeof C,x=[].slice.call(arguments,1);return v.each(function(){var e,s=T.isPlainObject(m)?T.extend(!0,{},T.fn.accordion.settings,m):T.extend({},T.fn.accordion.settings),a=s.className,n=s.namespace,r=s.selector,l=s.error,t="."+n,i="module-"+n,o=v.selector||"",c=T(this),d=c.find(r.title),u=c.find(r.content),g=this,f=c.data(i),p={initialize:function(){p.debug("Initializing",c),p.bind.events(),s.observeChanges&&p.observeChanges(),p.instantiate()},instantiate:function(){f=p,c.data(i,p)},destroy:function(){p.debug("Destroying previous instance",c),c.off(t).removeData(i)},refresh:function(){d=c.find(r.title),u=c.find(r.content)},observeChanges:function(){"MutationObserver"in k&&((e=new MutationObserver(function(e){p.debug("DOM tree modified, updating selector cache"),p.refresh()})).observe(g,{childList:!0,subtree:!0}),p.debug("Setting up mutation observer",e))},bind:{events:function(){p.debug("Binding delegated events"),c.on(s.on+t,r.trigger,p.event.click)}},event:{click:function(e){0===T(e.target).closest(r.ignore).length&&p.toggle.call(this)}},toggle:function(e){var e=e!==F?"number"==typeof e?d.eq(e):T(e).closest(r.title):T(this).closest(r.title),n=e.next(u),t=n.hasClass(a.animating),n=n.hasClass(a.active),i=n&&!t,n=!n&&t;p.debug("Toggling visibility of content",e),i||n?s.collapsible?p.close.call(e):p.debug("Cannot close accordion content collapsing is disabled"):p.open.call(e)},open:function(e){var e=e!==F?"number"==typeof e?d.eq(e):T(e).closest(r.title):T(this).closest(r.title),n=e.next(u),t=n.hasClass(a.animating);n.hasClass(a.active)||t?p.debug("Accordion already open, skipping",n):(p.debug("Opening accordion content",e),s.onOpening.call(n),s.onChanging.call(n),s.exclusive&&p.closeOthers.call(e),e.addClass(a.active),n.stop(!0,!0).addClass(a.animating),s.animateChildren&&(T.fn.transition!==F&&c.transition("is supported")?n.children().transition({animation:"fade in",queue:!1,useFailSafe:!0,debug:s.debug,verbose:s.verbose,duration:s.duration,skipInlineHidden:!0,onComplete:function(){n.children().removeClass(a.transition)}}):n.children().stop(!0,!0).animate({opacity:1},s.duration,p.resetOpacity)),n.slideDown(s.duration,s.easing,function(){n.removeClass(a.animating).addClass(a.active),p.reset.display.call(this),s.onOpen.call(this),s.onChange.call(this)}))},close:function(e){var e=e!==F?"number"==typeof e?d.eq(e):T(e).closest(r.title):T(this).closest(r.title),n=e.next(u),t=n.hasClass(a.animating),i=n.hasClass(a.active);!i&&!(!i&&t)||i&&t||(p.debug("Closing accordion content",n),s.onClosing.call(n),s.onChanging.call(n),e.removeClass(a.active),n.stop(!0,!0).addClass(a.animating),s.animateChildren&&(T.fn.transition!==F&&c.transition("is supported")?n.children().transition({animation:"fade out",queue:!1,useFailSafe:!0,debug:s.debug,verbose:s.verbose,duration:s.duration,skipInlineHidden:!0}):n.children().stop(!0,!0).animate({opacity:0},s.duration,p.resetOpacity)),n.slideUp(s.duration,s.easing,function(){n.removeClass(a.animating).removeClass(a.active),p.reset.display.call(this),s.onClose.call(this),s.onChange.call(this)}))},closeOthers:function(e){var n,e=e!==F?d.eq(e):T(this).closest(r.title),t=e.parents(r.content).prev(r.title),e=e.closest(r.accordion),i=r.title+"."+a.active+":visible",o=r.content+"."+a.active+":visible",o=s.closeNested?(n=e.find(i).not(t)).next(u):(n=e.find(i).not(t),e=e.find(o).find(i).not(t),(n=n.not(e)).next(u));0<n.length&&(p.debug("Exclusive enabled, closing other content",n),n.removeClass(a.active),o.removeClass(a.animating).stop(!0,!0),s.animateChildren&&(T.fn.transition!==F&&c.transition("is supported")?o.children().transition({animation:"fade out",useFailSafe:!0,debug:s.debug,verbose:s.verbose,duration:s.duration,skipInlineHidden:!0}):o.children().stop(!0,!0).animate({opacity:0},s.duration,p.resetOpacity)),o.slideUp(s.duration,s.easing,function(){T(this).removeClass(a.active),p.reset.display.call(this)}))},reset:{display:function(){p.verbose("Removing inline display from element",this),T(this).css("display",""),""===T(this).attr("style")&&T(this).attr("style","").removeAttr("style")},opacity:function(){p.verbose("Removing inline opacity from element",this),T(this).css("opacity",""),""===T(this).attr("style")&&T(this).attr("style","").removeAttr("style")}},setting:function(e,n){if(p.debug("Changing setting",e,n),T.isPlainObject(e))T.extend(!0,s,e);else{if(n===F)return s[e];T.isPlainObject(s[e])?T.extend(!0,s[e],n):s[e]=n}},internal:function(e,n){if(p.debug("Changing internal",e,n),n===F)return p[e];T.isPlainObject(e)?T.extend(!0,p,e):p[e]=n},debug:function(){!s.silent&&s.debug&&(s.performance?p.performance.log(arguments):(p.debug=Function.prototype.bind.call(console.info,console,s.name+":"),p.debug.apply(console,arguments)))},verbose:function(){!s.silent&&s.verbose&&s.debug&&(s.performance?p.performance.log(arguments):(p.verbose=Function.prototype.bind.call(console.info,console,s.name+":"),p.verbose.apply(console,arguments)))},error:function(){s.silent||(p.error=Function.prototype.bind.call(console.error,console,s.name+":"),p.error.apply(console,arguments))},performance:{log:function(e){var n,t;s.performance&&(t=(n=(new Date).getTime())-(b||n),b=n,y.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:g,"Execution Time":t})),clearTimeout(p.performance.timer),p.performance.timer=setTimeout(p.performance.display,500)},display:function(){var e=s.name+":",t=0;b=!1,clearTimeout(p.performance.timer),T.each(y,function(e,n){t+=n["Execution Time"]}),e+=" "+t+"ms",o&&(e+=" '"+o+"'"),(console.group!==F||console.table!==F)&&0<y.length&&(console.groupCollapsed(e),console.table?console.table(y):T.each(y,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),y=[]}},invoke:function(i,e,n){var o,s,t,a=f;return e=e||x,n=g||n,"string"==typeof i&&a!==F&&(i=i.split(/[\. ]/),o=i.length-1,T.each(i,function(e,n){var t=e!=o?n+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(T.isPlainObject(a[t])&&e!=o)a=a[t];else{if(a[t]!==F)return s=a[t],!1;{if(!T.isPlainObject(a[n])||e==o)return a[n]!==F?s=a[n]:p.error(l.method,i),!1;a=a[n]}}})),T.isFunction(s)?t=s.apply(n,e):s!==F&&(t=s),Array.isArray(h)?h.push(t):h!==F?h=[h,t]:t!==F&&(h=t),s}};O?(f===F&&p.initialize(),p.invoke(C)):(f!==F&&f.invoke("destroy"),p.initialize())}),h!==F?h:this},T.fn.accordion.settings={name:"Accordion",namespace:"accordion",silent:!1,debug:!1,verbose:!1,performance:!0,on:"click",observeChanges:!0,exclusive:!0,collapsible:!0,closeNested:!1,animateChildren:!0,duration:350,easing:"easeOutQuad",onOpening:function(){},onClosing:function(){},onChanging:function(){},onOpen:function(){},onClose:function(){},onChange:function(){},error:{method:"The method you called is not defined"},className:{active:"active",animating:"animating",transition:"transition"},selector:{accordion:".accordion",title:".title",trigger:".title",ignore:".ui.dropdown",content:".content"}},T.extend(T.easing,{easeOutQuad:function(e,n,t,i,o){return-i*(n/=o)*(n-2)+t}})}(jQuery,window,void document);