11 lines
26 KiB
JavaScript
11 lines
26 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(re,T,k,oe){"use strict";re.isFunction=re.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},T=void 0!==T&&T.Math==Math?T:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),re.fn.calendar=function(g){var D,e=re(this),y=e.selector||"",v=(new Date).getTime(),b=[],C=g,w="string"==typeof C,M=[].slice.call(arguments,1),x={5:{row:4,column:3},10:{row:3,column:2},15:{row:2,column:2},20:{row:3,column:1},30:{row:2,column:1}},ne=["","one","two","three","four","five","six","seven","eight"];return e.each(function(){var c,e,$=re.isPlainObject(g)?re.extend(!0,{},re.fn.calendar.settings,g):re.extend({},re.fn.calendar.settings),Q=$.className,t=$.namespace,n=$.selector,Z=$.formatter,a=$.parser,X=$.metadata,_=x[$.minTimeGap],s=$.error,r="."+t,o="module-"+t,i=re(this),l=i.find(n.input),ee=i.find(n.popup),d=i.find(n.activator),u=this,p=i.data(o),f=!1,te=i.hasClass(Q.inverted),m=!1,h=!1,ae={initialize:function(){ae.debug("Initializing calendar for",u,i),c=ae.get.isTouch(),ae.setup.config(),ae.setup.popup(),ae.setup.inline(),ae.setup.input(),ae.setup.date(),ae.create.calendar(),ae.bind.events(),ae.observeChanges(),ae.instantiate()},instantiate:function(){ae.verbose("Storing instance of calendar"),p=ae,i.data(o,p)},destroy:function(){ae.verbose("Destroying previous calendar for",u),i.removeData(o),ae.unbind.events(),ae.disconnect.classObserver()},setup:{config:function(){null!==ae.get.minDate()&&ae.set.minDate(i.data(X.minDate)),null!==ae.get.maxDate()&&ae.set.maxDate(i.data(X.maxDate)),ae.setting("type",ae.get.type()),ae.setting("on",$.on||(l.length?"focus":"click"))},popup:function(){var e,t,a;$.inline||(d.length||(d=i.children().first()).length)&&(re.fn.popup===oe?ae.error(s.popup):(ee.length||(e=0!==(t=d.parent()).closest(n.append).length?"appendTo":"prependTo",ee=re("<div/>").addClass(Q.popup)[e](t)),ee.addClass(Q.calendar),te&&ee.addClass(Q.inverted),e=function(){return ae.refreshTooltips(),$.onVisible.apply(ee,arguments)},t=$.onHidden,l.length||(ee.attr("tabindex","0"),e=function(){return ae.refreshTooltips(),ae.focus(),$.onVisible.apply(ee,arguments)},t=function(){return ae.blur(),$.onHidden.apply(ee,arguments)}),a=ae.setting("on"),a=re.extend({},$.popupOptions,{popup:ee,on:a,hoverable:"hover"===a,closable:"click"===a,onShow:function(){return ae.set.focusDate(ae.get.date()),ae.set.mode(ae.get.validatedMode($.startMode)),$.onShow.apply(ee,arguments)},onVisible:e,onHide:$.onHide,onHidden:t}),ae.popup(a)))},inline:function(){d.length&&!$.inline||($.inline=!0,ee=re("<div/>").addClass(Q.calendar).appendTo(i),l.length||ee.attr("tabindex","0"))},input:function(){$.touchReadonly&&l.length&&c&&l.prop("readonly",!0),ae.check.disabled()},date:function(){var e;$.initialDate?e=a.date($.initialDate,$):i.data(X.date)!==oe?e=a.date(i.data(X.date),$):l.length&&(e=a.date(l.val(),$)),ae.set.date(e,$.formatInput,!1),ae.set.mode(ae.get.mode(),!1)}},trigger:{change:function(){var e,t=l[0];t&&(e=k.createEvent("HTMLEvents"),ae.verbose("Triggering native change event"),e.initEvent("change",!0,!1),t.dispatchEvent(e))}},create:{calendar:function(){var e,t,S,a=ae.get.mode(),n=new Date,q=ae.get.date(),r=ae.get.focusDate(),o=ae.helper.dateInRange(r||q||$.initialDate||n),i=(r||ae.set.focusDate(r=o,!1,!1),"year"===a),s="month"===a,l="day"===a,d="hour"===a,u="minute"===a,W="time"===$.type,R=Math.max($.multiMonth,1),V=l?ae.get.monthOffset():0,c=o.getMinutes(),p=o.getHours(),f=o.getDate(),G=o.getMonth()+V,m=o.getFullYear(),h=l?$.showWeekNumbers?8:7:d?4:_.column,P=l||d?6:_.row,g=l?R:1,B=(D=ee).hasClass("left")?"right center":"left center";for(D.empty(),1<g&&(S=re("<div/>").addClass(Q.grid).appendTo(D)),t=0;t<g;t++){1<g&&(D=re("<div/>").addClass(Q.column).appendTo(S));var D,y=G+t,K=(new Date(m,y,1).getDay()-$.firstDayOfWeek%7+7)%7,v=(!$.constantHeight&&l&&(v=new Date(m,y+1,0).getDate()+K,P=Math.ceil(v/7)),i?10:s?1:0),b=l?1:0,C=d||u?1:0,w=d||u?f:1,M=new Date(m-v,y-b,w-C,p),b=new Date(m+v,y+b,w+C,p),w=i?new Date(10*Math.ceil(m/10)-9,0,0):s?new Date(m,0,0):l?new Date(m,y,0):new Date(m,y,f,-1),C=i?new Date(10*Math.c
|