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

11 lines
7.2 KiB
JavaScript
Raw Normal View History

2022-01-13 13:00:31 +00:00
/*
2023-08-17 09:47:40 +00:00
* # Fomantic UI - 2.9.2
2022-01-13 13:00:31 +00:00
* https://github.com/fomantic/Fomantic-UI
2023-08-17 09:47:40 +00:00
* https://fomantic-ui.com/
2022-01-13 13:00:31 +00:00
*
2023-08-17 09:47:40 +00:00
* Copyright 2023 Contributors
2022-01-13 13:00:31 +00:00
* Released under the MIT license
2023-08-17 09:47:40 +00:00
* https://opensource.org/licenses/MIT
2022-01-13 13:00:31 +00:00
*
*/
2023-08-17 09:47:40 +00:00
!function(k,T){"use strict";T=void 0!==T&&T.Math===Math?T:globalThis,k.fn.accordion=function(p){var m,h=k(this),b=Date.now(),y=[],C=p,O="string"==typeof C,x=[].slice.call(arguments,1);return h.each(function(){var e,a=k.isPlainObject(p)?k.extend(!0,{},k.fn.accordion.settings,p):k.extend({},k.fn.accordion.settings),s=a.className,n=a.namespace,l=a.selector,r=a.error,i="."+n,t="module-"+n,o=h.selector||"",c=k(this),d=c.find(l.title),u=c.find(l.content),g=this,f=c.data(t),v={initialize:function(){v.debug("Initializing",c),v.bind.events(),a.observeChanges&&v.observeChanges(),v.instantiate()},instantiate:function(){f=v,c.data(t,v)},destroy:function(){v.debug("Destroying previous instance",c),c.off(i).removeData(t)},refresh:function(){d=c.find(l.title),u=c.find(l.content)},observeChanges:function(){"MutationObserver"in T&&((e=new MutationObserver(function(e){v.debug("DOM tree modified, updating selector cache"),v.refresh()})).observe(g,{childList:!0,subtree:!0}),v.debug("Setting up mutation observer",e))},bind:{events:function(){v.debug("Binding delegated events"),c.on(a.on+i,l.trigger,v.event.click)}},event:{click:function(e){0===k(e.target).closest(l.ignore).length&&v.toggle.call(this)}},toggle:function(e){var e=void 0!==e?"number"==typeof e?d.eq(e):k(e).closest(l.title):k(this).closest(l.title),n=e.next(u),i=n.hasClass(s.animating),n=n.hasClass(s.active),t=n&&!i,n=!n&&i;v.debug("Toggling visibility of content",e),t||n?a.collapsible?v.close.call(e):v.debug("Cannot close accordion content collapsing is disabled"):v.open.call(e)},open:function(e){var e=void 0!==e?"number"==typeof e?d.eq(e):k(e).closest(l.title):k(this).closest(l.title),n=e.next(u),i=n.hasClass(s.animating);n.hasClass(s.active)||i?v.debug("Accordion already open, skipping",n):(v.debug("Opening accordion content",e),a.onOpening.call(n),a.onChanging.call(n),a.exclusive&&v.closeOthers.call(e),e.addClass(s.active),n.stop(!0,!0).addClass(s.animating),a.animateChildren&&(void 0!==k.fn.transition?n.children().transition({animation:"fade in",queue:!1,useFailSafe:!0,debug:a.debug,verbose:a.verbose,silent:a.silent,duration:a.duration,skipInlineHidden:!0,onComplete:function(){n.children().removeClass(s.transition)}}):n.children().stop(!0,!0).animate({opacity:1},a.duration,v.resetOpacity)),n.slideDown(a.duration,a.easing,function(){n.removeClass(s.animating).addClass(s.active),v.reset.display.call(this),a.onOpen.call(this),a.onChange.call(this)}))},close:function(e){var e=void 0!==e?"number"==typeof e?d.eq(e):k(e).closest(l.title):k(this).closest(l.title),n=e.next(u),i=n.hasClass(s.animating),t=n.hasClass(s.active);!t&&!(!t&&i)||t&&i||(v.debug("Closing accordion content",n),a.onClosing.call(n),a.onChanging.call(n),e.removeClass(s.active),n.stop(!0,!0).addClass(s.animating),a.animateChildren&&(void 0!==k.fn.transition?n.children().transition({animation:"fade out",queue:!1,useFailSafe:!0,debug:a.debug,verbose:a.verbose,silent:a.silent,duration:a.duration,skipInlineHidden:!0}):n.children().stop(!0,!0).animate({opacity:0},a.duration,v.resetOpacity)),n.slideUp(a.duration,a.easing,function(){n.removeClass(s.animating).removeClass(s.active),v.reset.display.call(this),a.onClose.call(this),a.onChange.call(this)}))},closeOthers:function(e){var n,e=void 0!==e?d.eq(e):k(this).closest(l.title),i=e.parents(l.content).prev(l.title),e=e.closest(l.accordion),t=l.title+"."+s.active+":visible",o=l.content+"."+s.active+":visible",o=a.closeNested?(n=e.find(t).not(i)).next(u):(n=e.find(t).not(i),e=e.find(o).find(t).not(i),(n=n.not(e)).next(u));0<n.length&&(v.debug("Exclusive enabled, closing other content",n),n.removeClass(s.active),o.removeClass(s.animating).stop(!0,!0),a.animateChildren&&(void 0!==k.fn.transition?o.children().transition({animation:"fade out",useFailSafe:!0,debug:a.debug,verbose:a.verbose,silent:a.silent,duration:a.duration,skipInlineHidden:!0}):o.children().stop(!0,!0).animate({opacity:0},a.duration,v.resetOpacity)),o.slideUp(a.duration,a.easing,function(){k(this).removeClass(s.active),v.reset.display.call(this)}))},reset:{display:function(){v.verbose("Removing inline display