11 lines
57 KiB
JavaScript
11 lines
57 KiB
JavaScript
|
/*
|
||
|
* # Fomantic UI - 2.8.8
|
||
|
* https://github.com/fomantic/Fomantic-UI
|
||
|
* http://fomantic-ui.com/
|
||
|
*
|
||
|
* Copyright 2022 Contributors
|
||
|
* Released under the MIT license
|
||
|
* http://opensource.org/licenses/MIT
|
||
|
*
|
||
|
*/
|
||
|
!function(te,ne,ie,ae){"use strict";te.isFunction=te.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},ne=void 0!==ne&&ne.Math==Math?ne:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),te.fn.dropdown=function(B){var K,W=te(this),Q=te(ie),Y=W.selector||"",$="ontouchstart"in ie.documentElement,X=$?"touchstart":"click",G=(new Date).getTime(),J=[],Z=B,_="string"==typeof Z,ee=[].slice.call(arguments,1);return W.each(function(n){var d,e,t,i,a,s,o,r,l,v=te.isPlainObject(B)?te.extend(!0,{},te.fn.dropdown.settings,B):te.extend({},te.fn.dropdown.settings),m=v.className,h=v.message,c=v.fields,f=v.keys,g=v.metadata,u=v.namespace,p=v.regExp,b=v.selector,w=v.error,C=v.templates,y="."+u,x="module-"+u,S=te(this),A=te(v.context),T=S.find(b.text),L=S.find(b.search),I=S.find(b.sizer),D=S.find(b.input),k=S.find(b.icon),O=S.find(b.clearIcon),q=0<S.prev().find(b.text).length?S.prev().find(b.text):S.prev(),R=S.children(b.menu),V=R.find(b.item),E=v.hideDividers?V.parent().children(b.divider):te(),M=!1,z=!1,F=!1,P=!1,N=this,H=!1,j=S.data(x),U={initialize:function(){U.debug("Initializing dropdown",v),U.is.alreadySetup()?U.setup.reference():(v.ignoreDiacritics&&!String.prototype.normalize&&(v.ignoreDiacritics=!1,U.error(w.noNormalize,N)),U.setup.layout(),v.values&&(U.set.initialLoad(),U.change.values(v.values),U.remove.initialLoad()),U.refreshData(),U.save.defaults(),U.restore.selected(),U.create.id(),U.bind.events(),U.observeChanges(),U.instantiate())},instantiate:function(){U.verbose("Storing instance of dropdown",U),j=U,S.data(x,U)},destroy:function(){U.verbose("Destroying previous dropdown",S),U.remove.tabbable(),U.remove.active(),R.transition("stop all"),R.removeClass(m.visible).addClass(m.hidden),S.off(y).removeData(x),R.off(y),Q.off(a),U.disconnect.menuObserver(),U.disconnect.selectObserver(),U.disconnect.classObserver()},observeChanges:function(){"MutationObserver"in ne&&(o=new MutationObserver(U.event.select.mutation),r=new MutationObserver(U.event.menu.mutation),l=new MutationObserver(U.event.class.mutation),U.debug("Setting up mutation observer",o,r,l),U.observe.select(),U.observe.menu(),U.observe.class())},disconnect:{menuObserver:function(){r&&r.disconnect()},selectObserver:function(){o&&o.disconnect()},classObserver:function(){l&&l.disconnect()}},observe:{select:function(){U.has.input()&&o&&o.observe(S[0],{childList:!0,subtree:!0})},menu:function(){U.has.menu()&&r&&r.observe(R[0],{childList:!0,subtree:!0})},class:function(){U.has.search()&&l&&l.observe(S[0],{attributes:!0})}},create:{id:function(){s=(Math.random().toString(16)+"000000000").substr(2,8),a="."+s,U.verbose("Creating unique id for element",s)},userChoice:function(e){var n,i;return!!(e=e||U.get.userValues())&&(e=Array.isArray(e)?e:[e],te.each(e,function(e,t){!1===U.get.item(t)&&(i=v.templates.addition(U.add.variables(h.addResult,t)),i=te("<div />").html(i).attr("data-"+g.value,t).attr("data-"+g.text,t).addClass(m.addition).addClass(m.item),v.hideAdditions&&i.addClass(m.hidden),n=n===ae?i:n.add(i),U.verbose("Creating user choices for value",t,i))}),n)},userLabels:function(e){var t=U.get.userValues();t&&(U.debug("Adding user labels",t),te.each(t,function(e,t){U.verbose("Adding custom user value"),U.add.label(t,t)}))},menu:function(){R=te("<div />").addClass(m.menu).appendTo(S)},sizer:function(){I=te("<span />").addClass(m.sizer).insertAfter(L)}},search:function(e){e=e!==ae?e:U.get.query(),U.verbose("Searching for query",e),!1===v.fireOnInit&&U.is.initialLoad()?U.verbose("Skipping callback on initial load",v.onSearch):U.has.minCharacters(e)&&!1!==v.onSearch.call(N,e)?U.filter(e):U.hide(null,!0)},select:{firstUnfiltered:function(){U.verbose("Selecting first non-filtered element"),U.remove.selectedItem(),V.not(b.unselectable).not(b.addition+b.hidden).eq(0).addClass(m.selected)},nextAvailable:function(e){var t=(e=e.eq(0)).nextAll(b.item).not(b.unselectable).eq(0),e=e.prevAll(b.item).not(b.unselectable).eq(0);0<t.length?(U.verbose("Moving selection to",t),t.addClass(m.selected)):(U.verbose("Moving selection to",e),e.addClass
|