You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 lines
37 KiB
Plaintext

11 months ago
/*! layDate v5.3.1 | 日期与时间组件 | MIT Licensed */
;!function(e){"use strict";var t=e.document,n={modules:{},status:{},timeout:10,event:{}},a=function(){this.v="2.6.7"},r=e.LAYUI_GLOBAL||{},i=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,n=t.scripts,a=n.length-1,r=a;r>0;r--)if("interactive"===n[r].readyState){e=n[r].src;break}return e||n[a].src}();return n.dir=r.dir||e.substring(0,e.lastIndexOf("/")+1)}(),o=function(t,n){n=n||"log",e.console&&console[n]&&console[n]("layui error hint: "+t)},l="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),s=n.builtin={lay:"lay",layer:"layer",laydate:"laydate",laypage:"laypage",laytpl:"laytpl",layedit:"layedit",form:"form",upload:"upload",dropdown:"dropdown",transfer:"transfer",tree:"tree",table:"table",element:"element",rate:"rate",colorpicker:"colorpicker",slider:"slider",carousel:"carousel",flow:"flow",util:"util",code:"code",jquery:"jquery",all:"all","layui.all":"layui.all"};a.prototype.cache=n,a.prototype.define=function(e,t){var a=this,r="function"==typeof e,i=function(){var e=function(e,t){u[e]=t,n.status[e]=!0};return"function"==typeof t&&t(function(a,r){e(a,r),n.callback[a]=function(){t(e)}}),this};return r&&(t=e,e=[]),a.use(e,i,null,"define"),a},a.prototype.use=function(a,r,c,y){function d(e,t){var a="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||a.test((e.currentTarget||e.srcElement).readyState))&&(n.modules[g]=t,p.removeChild(w),function r(){return++v>1e3*n.timeout/4?o(g+" is not a valid module","error"):void(n.status[g]?m():setTimeout(r,4))}())}function m(){c.push(u[g]),a.length>1?f.use(a.slice(1),r,c,y):"function"==typeof r&&function(){return u.jquery&&"function"==typeof u.jquery&&"define"!==y?u.jquery(function(){r.apply(u,c)}):void r.apply(u,c)}()}var f=this,h=n.dir=n.dir?n.dir:i,p=t.getElementsByTagName("head")[0];a=function(){return"string"==typeof a?[a]:"function"==typeof a?(r=a,["all"]):a}(),e.jQuery&&jQuery.fn.on&&(f.each(a,function(e,t){"jquery"===t&&a.splice(e,1)}),u.jquery=u.$=jQuery);var g=a[0],v=0;if(c=c||[],n.host=n.host||(h.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===a.length||u["layui.all"]&&s[g])return m(),f;var T=(s[g]?h+"modules/":/^\{\/\}/.test(f.modules[g])?"":n.base||"")+(f.modules[g]||g)+".js";if(T=T.replace(/^\{\/\}/,""),!n.modules[g]&&u[g]&&(n.modules[g]=T),n.modules[g])!function D(){return++v>1e3*n.timeout/4?o(g+" is not a valid module","error"):void("string"==typeof n.modules[g]&&n.status[g]?m():setTimeout(D,4))}();else{var w=t.createElement("script");w.async=!0,w.charset="utf-8",w.src=T+function(){var e=n.version===!0?n.v||(new Date).getTime():n.version||"";return e?"?v="+e:""}(),p.appendChild(w),!w.attachEvent||w.attachEvent.toString&&w.attachEvent.toString().indexOf("[native code")<0||l?w.addEventListener("load",function(e){d(e,T)},!1):w.attachEvent("onreadystatechange",function(e){d(e,T)}),n.modules[g]=T}return f},a.prototype.getStyle=function(t,n){var a=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return a[a.getPropertyValue?"getPropertyValue":"getAttribute"](n)},a.prototype.link=function(e,a,r){var i=this,l=t.getElementsByTagName("head")[0],s=t.createElement("link");"string"==typeof a&&(r=a);var c=(r||e).replace(/\.|\//g,""),u=s.id="layuicss-"+c,y="creating",d=0;return s.rel="stylesheet",s.href=e+(n.debug?"?v="+(new Date).getTime():""),s.media="all",t.getElementById(u)||l.appendChild(s),"function"!=typeof a?i:(function m(r){var l=100,s=t.getElementById(u);return++d>1e3*n.timeout/l?o(e+" timeout"):void(1989===parseInt(i.getStyle(s,"width"))?(r===y&&s.removeAttribute("lay-status"),s.getAttribute("lay-status")===y?setTimeout(m,l):a()):(s.setAttribute("lay-status",y),setTimeout(function(){m(y)},l)))}(),i)},a.prototype.addcss=function(e,t,a){return u.link(n.dir+"css/"+e,t,a)},n.callback={},a.prototype.factory=function(e){if(u[e])return"function"==typeof n.callback[e]?n.callback[e]:null},a.prototype.img=function(e,t,n){var a=new Image;return a.src=e,a.complete?t(a):(a.onload=function(){a.onload=null,"function"==typeof t&&t(a)},void(a.onerror=function(e){a.onerror=null,"function"==typeof
n.css({color:"#666","font-size":"12px;"})},300)}},w.prototype.done=function(e,t){var n=this,a=n.config,r=lay.extend({},lay.extend(a.dateTime,n.startTime)),i=lay.extend({},lay.extend(n.endDate,n.endTime));return lay.each([r,i],function(e,t){"month"in t&&lay.extend(t,{month:t.month+1})}),n.preview(),e=e||[n.parse(),r,i],"function"==typeof a[t||"done"]&&a[t||"done"].apply(a,e),n},w.prototype.choose=function(e,t){var n=this,a=n.config,r=n.thisDateTime(t),i=(lay(n.elem).find("td"),e.attr("lay-ymd").split("-"));i={year:0|i[0],month:(0|i[1])-1,date:0|i[2]},e.hasClass(u)||(lay.extend(r,i),a.range?(lay.each(["startTime","endTime"],function(e,t){n[t]=n[t]||{hours:0,minutes:0,seconds:0}}),n.calendar(null,t).done(null,"change")):"static"===a.position?n.calendar().done().done(null,"change"):"date"===a.type?n.setValue(n.parse()).remove().done():"datetime"===a.type&&n.calendar().done(null,"change"))},w.prototype.tool=function(e,t){var n=this,a=n.config,r=n.lang(),i=a.dateTime,o="static"===a.position,l={datetime:function(){lay(e).hasClass(u)||(n.list("time",0),a.range&&n.list("time",1),lay(e).attr("lay-type","date").html(n.lang().dateTips))},date:function(){n.closeList(),lay(e).attr("lay-type","datetime").html(n.lang().timeTips)},clear:function(){o&&(lay.extend(i,n.firstDate),n.calendar()),a.range&&(delete a.dateTime,delete n.endDate,delete n.startTime,delete n.endTime),n.setValue("").remove(),n.done(["",{},{}])},now:function(){var e=new Date;lay.extend(i,n.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),n.setValue(n.parse()).remove(),o&&n.calendar(),n.done()},confirm:function(){if(a.range){if(lay(e).hasClass(u))return n.hint("time"===a.type?r.timeout.replace(/\u65e5\u671f/g,"\u65f6\u95f4"):r.timeout)}else if(lay(e).hasClass(u))return n.hint(r.invalidDate);n.done(),n.setValue(n.parse()).remove()}};l[t]&&l[t]()},w.prototype.change=function(e){var t=this,n=t.config,a=t.thisDateTime(e),r=n.range&&("year"===n.type||"month"===n.type),i=t.elemCont[e||0],o=t.listYM[e],l=function(l){var s=lay(i).find(".laydate-year-list")[0],c=lay(i).find(".laydate-month-list")[0];return s&&(o[0]=l?o[0]-15:o[0]+15,t.list("year",e)),c&&(l?o[0]--:o[0]++,t.list("month",e)),(s||c)&&(lay.extend(a,{year:o[0]}),r&&(a.year=o[0]),n.range||t.done(null,"change"),n.range||t.limit(lay(t.footer).find(p),{year:o[0]})),t.setBtnStatus(),s||c};return{prevYear:function(){l("sub")||(a.year--,t.checkDate("limit").calendar(null,e),t.done(null,"change"))},prevMonth:function(){var n=t.getAsYM(a.year,a.month,"sub");lay.extend(a,{year:n[0],month:n[1]}),t.checkDate("limit").calendar(null,e),t.done(null,"change")},nextMonth:function(){var n=t.getAsYM(a.year,a.month);lay.extend(a,{year:n[0],month:n[1]}),t.checkDate("limit").calendar(null,e),t.done(null,"change")},nextYear:function(){l()||(a.year++,t.checkDate("limit").calendar(null,e),t.done(null,"change"))}}},w.prototype.changeEvent=function(){var e=this;e.config;lay(e.elem).on("click",function(e){lay.stope(e)}).on("mousedown",function(e){lay.stope(e)}),lay.each(e.elemHeader,function(t,n){lay(n[0]).on("click",function(n){e.change(t).prevYear()}),lay(n[1]).on("click",function(n){e.change(t).prevMonth()}),lay(n[2]).find("span").on("click",function(n){var a=lay(this),r=a.attr("lay-ym"),i=a.attr("lay-type");r&&(r=r.split("-"),e.listYM[t]=[0|r[0],0|r[1]],e.list(i,t),lay(e.footer).find("."+v).addClass(u))}),lay(n[3]).on("click",function(n){e.change(t).nextMonth()}),lay(n[4]).on("click",function(n){e.change(t).nextYear()})}),lay.each(e.table,function(t,n){var a=lay(n).find("td");a.on("click",function(){e.choose(lay(this),t)})}),lay(e.footer).find("span").on("click",function(){var t=lay(this).attr("lay-type");e.tool(this,t)})},w.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())},w.prototype.events=function(){var e=this,t=e.config,n=function(n,a){n.on(t.trigger,function(){a&&(e.bindElem=this),e.render()})};t.elem[0]&&!t.elem[0].eventHandler&&(n(t.elem,"bind"),n(t.eventElem),t.elem[0].eventHandler=!0)},o.that={},o.getThis=function(e){var t=o.that[e];return t||hint.error(e?l+"