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,ie){"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,i="module-"+t,o=re(this),l=o.find(n.input),ee=o.find(n.popup),d=o.find(n.activator),u=this,p=o.data(i),f=!1,te=o.hasClass(Q.inverted),m=!1,h=!1,ae={initialize:function(){ae.debug("Initializing calendar for",u,o),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,o.data(i,p)},destroy:function(){ae.verbose("Destroying previous calendar for",u),o.removeData(i),ae.unbind.events(),ae.disconnect.classObserver()},setup:{config:function(){null!==ae.get.minDate()&&ae.set.minDate(o.data(X.minDate)),null!==ae.get.maxDate()&&ae.set.maxDate(o.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=o.children().first()).length)&&(re.fn.popup!==ie?(ee.length||(a=0!==(t=d.parent()).closest(n.append).length?"appendTo":"prependTo",ee=re("<div/>").addClass(Q.popup)[a](t)),ee.addClass(Q.calendar),te&&ee.addClass(Q.inverted),e=function(){return ae.refreshTooltips(),$.onVisible.apply(ee,arguments)},a=$.onHidden,l.length||(ee.attr("tabindex","0"),e=function(){return ae.refreshTooltips(),ae.focus(),$.onVisible.apply(ee,arguments)},a=function(){return ae.blur(),$.onHidden.apply(ee,arguments)}),t=ae.setting("on"),a=re.extend({},$.popupOptions,{popup:ee,on:t,hoverable:"hover"===t,closable:"click"===t,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:a}),ae.popup(a)):ae.error(s.popup))},inline:function(){d.length&&!$.inline||($.inline=!0,ee=re("<div/>").addClass(Q.calendar).appendTo(o),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,$):o.data(X.date)!==ie?e=a.date(o.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,a,n=ae.get.mode(),r=new Date,i=ae.get.date(),o=ae.get.focusDate(),s=ae.helper.dateInRange(o||i||$.initialDate||r);o||ae.set.focusDate(o=s,!1,!1);var l="year"===n,d="month"===n,u="day"===n,c="hour"===n,p="minute"===n,f="time"===$.type,m=Math.max($.multiMonth,1),h=u?ae.get.monthOffset():0,g=s.getMinutes(),D=s.getHours(),y=s.getDate(),v=s.getMonth()+h,b=s.getFullYear(),C=u?$.showWeekNumbers?8:7:c?4:_.column,w=u||c?6:_.row,M=u?m:1,x=ee,T=x.hasClass("left")?"right center":"left center";for(x.empty(),1<M&&(a=re("<div/>").addClass(Q.grid).appendTo(x)),t=0;t<M;t++){1<M&&(x=re("<div/>").addClass(Q.column).appendTo(a));var k=v+t,O=(new Date(b,k,1).getDay()-$.firstDayOfWeek%7+7)%7;!$.constantHeight&&u&&(j=new Date(b,k+1,0).getDate()+O,w=Math.ceil(j/7));var F=l?10:d?1:0,N=u?1:0,A=c||p?1:0,E=c||p?y:1,H=new Date(b-F,k-N,E-A,D),Y=new Date(b+F,k+N,E+A,D),I=l?new Date(10*Math.ceil(b/10)-9,0,0):d?new Date(b,0,0):u?new Date(b,k,0):new Date(b,k,y,-1),j=l?new Date(10*Math
|