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

11 lines
28 KiB
JavaScript
Raw Normal View History

2022-01-13 13:00:31 +00:00
/*
2022-10-10 08:26:02 +00:00
* # Fomantic UI - 2.9.0
2022-01-13 13:00:31 +00:00
* https://github.com/fomantic/Fomantic-UI
* http://fomantic-ui.com/
*
2022-06-08 10:36:39 +00:00
* Copyright 2022 Contributors
2022-01-13 13:00:31 +00:00
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
2022-09-15 12:58:37 +00:00
!function(re,T,Y,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 y,e=re(this),D=e.selector||"",v=(new Date).getTime(),b=[],M=g,C="string"==typeof M,w=[].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,z=re.isPlainObject(g)?re.extend(!0,{},re.fn.calendar.settings,g):re.extend({},re.fn.calendar.settings),Q=z.className,t=z.namespace,a=z.selector,Z=z.formatter,n=z.parser,X=z.metadata,_=x[z.minTimeGap],s=z.error,r="."+t,o="module-"+t,i=re(this),l=i.find(a.input),ee=i.find(a.popup),d=i.find(a.activator),u=this,p=i.data(o),f=!1,te=i.hasClass(Q.inverted),h=!1,m=!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",z.on||"click")},popup:function(){var e,t;z.inline||(d.length||(d=i.children().first()).length)&&(re.fn.popup===oe?ae.error(s.popup):(ee.length||(e=0!==(t=d.parent()).closest(a.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(),z.onVisible.apply(ee,arguments)},l.length||(ee.attr("tabindex","0"),e=function(){return ae.refreshTooltips(),ae.focus(),z.onVisible.apply(ee,arguments)}),t=ae.setting("on"),t=re.extend({},z.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(z.startMode)),z.onShow.apply(ee,arguments)},onVisible:e,onHide:z.onHide,onHidden:function(){return ae.blur(),z.onHidden.apply(ee,arguments)}}),ae.popup(t)))},inline:function(){d.length&&!z.inline||(z.inline=!0,ee=re("<div/>").addClass(Q.calendar).appendTo(i),l.length||ee.attr("tabindex","0"))},input:function(){z.touchReadonly&&l.length&&c&&l.prop("readonly",!0),ae.check.disabled()},date:function(){var e;z.initialDate?e=n.date(z.initialDate,z):i.data(X.date)!==oe?e=n.date(i.data(X.date),z):l.length&&(e=n.date(l.val(),z)),ae.set.date(e,z.formatInput,!1),ae.set.mode(ae.get.mode(),!1)}},trigger:{change:function(){var e,t=l[0];t&&(e=Y.createEvent("HTMLEvents"),ae.verbose("Triggering native change event"),e.initEvent("change",!0,!1),t.dispatchEvent(e))}},create:{calendar:function(){var e,t,j,a=ae.get.mode(),n=new Date,q=ae.get.date(),r=ae.get.focusDate(),o=ae.helper.dateInRange(r||q||z.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"===z.type,R=Math.max(z.multiMonth,1),V=l?ae.get.monthOffset():0,c=o.getMinutes(),p=o.getHours(),f=o.getDate(),G=o.getMonth()+V,h=o.getFullYear(),m=l?z.showWeekNumbers?8:7:d?4:_.column,P=l||d?6:_.row,g=l?R:1,y=(D=ee).hasClass("left")?"right center":"left center";for(D.empty(),1<g&&(j=re("<div/>").addClass(Q.grid).appendTo(D)),t=0;t<g;t++){1<g&&(D=re("<div/>").addClass(Q.column).appendTo(j));var D,v=G+t,B=(new Date(h,v,1).getDay()-z.firstDayOfWeek%7+7)%7,b=(!z.constantHeight&&l&&(b=new Date(h,v+1,0).getDate()+B,P=Math.ceil(b/7)),i?10:s?1:0),M=l?1:0,C=d||u?1:0,w=d||u?f:1,x=new Date(h-b,v-M,w-C,p),M=new Date(h+b,v+M,w+C,p),w=i?new Date(10*Math.ceil(h/10)-9,0,0):s?new Date(h,0,0):l?new Date(h,v,0):new Date(h,v,f,-1),C=i?new Date(10*Math.ceil(h/10)+1,0,1):s?new Date(h+1,0,1):l