From f0c99788a39ce7affd0dee89c4354ac45f2f8d9b Mon Sep 17 00:00:00 2001 From: sentsin Date: Mon, 21 Aug 2017 06:17:36 +0800 Subject: [PATCH 01/26] clear --- README.md | 22 - laydate.dev.js | 932 ------------------------------------ laydate.js | 11 - need/laydate.css | 73 --- skins/dahong/icon.png | Bin 307 -> 0 bytes skins/dahong/laydate.css | 58 --- skins/danlan/icon.png | Bin 328 -> 0 bytes skins/danlan/laydate.css | 67 --- skins/default/icon.png | Bin 314 -> 0 bytes skins/default/laydate.css | 68 --- skins/molv/icon.png | Bin 309 -> 0 bytes skins/molv/laydate.css | 59 --- skins/qianhuang/icon.png | Bin 328 -> 0 bytes skins/qianhuang/laydate.css | 70 --- skins/yahui/icon.png | Bin 314 -> 0 bytes skins/yahui/laydate.css | 68 --- skins/yalan/icon.png | Bin 324 -> 0 bytes skins/yalan/laydate.css | 58 --- test/demo1.html | 58 --- test/demo2.html | 19 - test/demo2.js | 7 - 21 files changed, 1570 deletions(-) delete mode 100644 README.md delete mode 100755 laydate.dev.js delete mode 100644 laydate.js delete mode 100644 need/laydate.css delete mode 100644 skins/dahong/icon.png delete mode 100644 skins/dahong/laydate.css delete mode 100644 skins/danlan/icon.png delete mode 100644 skins/danlan/laydate.css delete mode 100644 skins/default/icon.png delete mode 100644 skins/default/laydate.css delete mode 100644 skins/molv/icon.png delete mode 100644 skins/molv/laydate.css delete mode 100644 skins/qianhuang/icon.png delete mode 100644 skins/qianhuang/laydate.css delete mode 100644 skins/yahui/icon.png delete mode 100644 skins/yahui/laydate.css delete mode 100644 skins/yalan/icon.png delete mode 100644 skins/yalan/laydate.css delete mode 100644 test/demo1.html delete mode 100644 test/demo2.html delete mode 100644 test/demo2.js diff --git a/README.md b/README.md deleted file mode 100644 index 2514449..0000000 --- a/README.md +++ /dev/null @@ -1,22 +0,0 @@ -## 说明 -1. laydate.js是压缩后的核心代码,laydate.dev.js是开发版的源代码。 -1. need目录存放着核心css -1. skins是皮肤目录 -1. 将laydate pull到你的本地后,将其存放到您js相关目录下的laydate目录,不要改动laydate的结构,否则无法正常运行。 - -## 简要 -她基于原生JavaScript精心雕琢,兼容了包括IE6在内的所有主流浏览器。她具备优雅的内部代码,良好的性能体验,和完善的皮肤体系,并且完全开源,你可以任意获取开发版源代码,一扫某些传统日期控件的封闭与狭隘。layDate本着资源共享的开发者精神和对网页日历交互无穷的追求,延续了layui一贯的简单与易用。她遵循LGPL协议,您可以免费将她用于任何个人项目。 - -## 更新日志 - -1.1 - -1. layer.now(timestamp,format)支持多类型参数。timestamp支持今天的前若干天,和今天的后若干天,并且如果是一个有效的时间戳,则返回该时间戳对应的日期。如果什么都没传入,则返回当前时间日期。format为日期格式,为空时则采用默认的“-”分割。 -2. 优化核心代码。 -3. 分和秒的选择改成10列*6行。 -4. 修复星期未居中对齐的样式问题 -5. 修复在页面加载完毕事件中,调用laydate所造成的立即执行的bug -6. 皮肤包新增[墨绿]。 - -## 备注 -[官网](http://laydate.layui.com/)、[社区](http://fly.layui.com/) diff --git a/laydate.dev.js b/laydate.dev.js deleted file mode 100755 index 7af7992..0000000 --- a/laydate.dev.js +++ /dev/null @@ -1,932 +0,0 @@ -/** - - @Name : layDate v1.1 日期控件 - @Author: 贤心 - @Date: 2014-06-25 - @QQ群:176047195 - @Site:http://sentsin.com/layui/laydate - - */ - -;!function(win){ - -//全局配置,如果采用默认均不需要改动 -var config = { - path: '', //laydate所在路径 - skin: 'default', //初始化皮肤 - format: 'YYYY-MM-DD', //日期格式 - min: '1900-01-01 00:00:00', //最小日期 - max: '2099-12-31 23:59:59', //最大日期 - isv: false, - init: true -}; - -var Dates = {}, doc = document, creat = 'createElement', byid = 'getElementById', tags = 'getElementsByTagName'; -var as = ['laydate_box', 'laydate_void', 'laydate_click', 'LayDateSkin', 'skins/', '/laydate.css']; - - -//主接口 -win.laydate = function(options){ - options = options || {}; - try{ - as.event = win.event ? win.event : laydate.caller.arguments[0]; - } catch(e){}; - Dates.run(options); - return laydate; -}; - -laydate.v = '1.1'; - -//获取组件存放路径 -Dates.getPath = (function(){ - var js = document.scripts, jsPath = js[js.length - 1].src; - return config.path ? config.path : jsPath.substring(0, jsPath.lastIndexOf("/") + 1); -}()); - -Dates.use = function(lib, id){ - var link = doc[creat]('link'); - link.type = 'text/css'; - link.rel = 'stylesheet'; - link.href = Dates.getPath + lib + as[5]; - id && (link.id = id); - doc[tags]('head')[0].appendChild(link); - link = null; -}; - -Dates.trim = function(str){ - str = str || ''; - return str.replace(/^\s|\s$/g, '').replace(/\s+/g, ' '); -}; - -//补齐数位 -Dates.digit = function(num){ - return num < 10 ? '0' + (num|0) : num; -}; - -Dates.stopmp = function(e){ - e = e || win.event; - e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; - return this; -}; - -Dates.each = function(arr, fn){ - var i = 0, len = arr.length; - for(; i < len; i++){ - if(fn(i, arr[i]) === false){ - break - } - } -}; - -Dates.hasClass = function(elem, cls){ - elem = elem || {}; - return new RegExp('\\b' + cls +'\\b').test(elem.className); -}; - -Dates.addClass = function(elem, cls){ - elem = elem || {}; - Dates.hasClass(elem, cls) || (elem.className += ' ' + cls); - elem.className = Dates.trim(elem.className); - return this; -}; - -Dates.removeClass = function(elem, cls) { - elem = elem || {}; - if (Dates.hasClass(elem, cls)) { - var reg = new RegExp('\\b' + cls +'\\b'); - elem.className = elem.className.replace(reg, ''); - } - return this; -}; - -//清除css属性 -Dates.removeCssAttr = function(elem, attr){ - var s = elem.style; - if(s.removeProperty){ - s.removeProperty(attr); - } else { - s.removeAttribute(attr); - } -}; - -//显示隐藏 -Dates.shde = function(elem, type){ - elem.style.display = type ? 'none' : 'block'; -}; - -//简易选择器 -Dates.query = function(node){ - if(node && node.nodeType === 1){ - if(node.tagName.toLowerCase() !== 'input'){ - throw new Error('选择器elem错误'); - } - return node; - } - - var node = (Dates.trim(node)).split(' '), elemId = doc[byid](node[0].substr(1)), arr; - if(!elemId){ - return; - } else if(!node[1]){ - return elemId; - } else if(/^\./.test(node[1])){ - var find, child = node[1].substr(1), exp = new RegExp('\\b' + child +'\\b'); - arr = [] - find = doc.getElementsByClassName ? elemId.getElementsByClassName(child) : elemId[tags]('*'); - Dates.each(find, function(ii, that){ - exp.test(that.className) && arr.push(that); - }); - return arr[0] ? arr : ''; - } else { - arr = elemId[tags](node[1]); - return arr[0] ? elemId[tags](node[1]) : ''; - } -}; - -//事件监听器 -Dates.on = function(elem, even, fn){ - elem.attachEvent ? elem.attachEvent('on'+ even, function(){ - fn.call(elem, win.even); - }) : elem.addEventListener(even, fn, false); - return Dates; -}; - -//阻断mouseup -Dates.stopMosup = function(evt, elem){ - if(evt !== 'mouseup'){ - Dates.on(elem, 'mouseup', function(ev){ - Dates.stopmp(ev); - }); - } -}; - -Dates.run = function(options){ - var S = Dates.query, elem, devt, even = as.event, target; - try { - target = even.target || even.srcElement || {}; - } catch(e){ - target = {}; - } - elem = options.elem ? S(options.elem) : target; - - as.elemv = /textarea|input/.test(elem.tagName.toLocaleLowerCase()) ? 'value' : 'innerHTML'; - if (('init' in options ? options.init : config.init) && (!elem[as.elemv])) elem[as.elemv] = laydate.now(null, options.format || config.format); - - if(even && target.tagName){ - if(!elem || elem === Dates.elem){ - return; - } - Dates.stopMosup(even.type, elem); - Dates.stopmp(even); - Dates.view(elem, options); - Dates.reshow(); - } else { - devt = options.event || 'click'; - Dates.each((elem.length|0) > 0 ? elem : [elem], function(ii, that){ - Dates.stopMosup(devt, that); - Dates.on(that, devt, function(ev){ - Dates.stopmp(ev); - if(that !== Dates.elem){ - Dates.view(that, options); - Dates.reshow(); - } - }); - }); - } - - chgSkin(options.skin || config.skin) -}; - -Dates.scroll = function(type){ - type = type ? 'scrollLeft' : 'scrollTop'; - return doc.body[type] | doc.documentElement[type]; -}; - -Dates.winarea = function(type){ - return document.documentElement[type ? 'clientWidth' : 'clientHeight'] -}; - -//判断闰年 -Dates.isleap = function(year){ - return (year%4 === 0 && year%100 !== 0) || year%400 === 0; -}; - -//检测是否在有效期 -Dates.checkVoid = function(YY, MM, DD){ - var back = []; - YY = YY|0; - MM = MM|0; - DD = DD|0; - if(YY < Dates.mins[0]){ - back = ['y']; - } else if(YY > Dates.maxs[0]){ - back = ['y', 1]; - } else if(YY >= Dates.mins[0] && YY <= Dates.maxs[0]){ - if(YY == Dates.mins[0]){ - if(MM < Dates.mins[1]){ - back = ['m']; - } else if(MM == Dates.mins[1]){ - if(DD < Dates.mins[2]){ - back = ['d']; - } - } - } - if(YY == Dates.maxs[0]){ - if(MM > Dates.maxs[1]){ - back = ['m', 1]; - } else if(MM == Dates.maxs[1]){ - if(DD > Dates.maxs[2]){ - back = ['d', 1]; - } - } - } - } - return back; -}; - -//时分秒的有效检测 -Dates.timeVoid = function(times, index){ - if(Dates.ymd[1]+1 == Dates.mins[1] && Dates.ymd[2] == Dates.mins[2]){ - if(index === 0 && (times < Dates.mins[3])){ - return 1; - } else if(index === 1 && times < Dates.mins[4]){ - return 1; - } else if(index === 2 && times < Dates.mins[5]){ - return 1; - } - } else if(Dates.ymd[1]+1 == Dates.maxs[1] && Dates.ymd[2] == Dates.maxs[2]){ - if(index === 0 && times > Dates.maxs[3]){ - return 1; - } else if(index === 1 && times > Dates.maxs[4]){ - return 1; - } else if(index === 2 && times > Dates.maxs[5]){ - return 1; - } - } - if(times > (index ? 59 : 23)){ - return 1; - } -}; - -//检测日期是否合法 -Dates.check = function(){ - var reg = Dates.options.format.replace(/YYYY|MM|DD|hh|mm|ss/g,'\\d+\\').replace(/\\$/g, ''); - var exp = new RegExp(reg), value = Dates.elem[as.elemv]; - var arr = value.match(/\d+/g) || [], isvoid = Dates.checkVoid(arr[0], arr[1], arr[2]); - if(value.replace(/\s/g, '') !== ''){ - if(!exp.test(value)){ - Dates.elem[as.elemv] = ''; - Dates.msg('日期不符合格式,请重新选择。'); - return 1; - } else if(isvoid[0]){ - Dates.elem[as.elemv] = ''; - Dates.msg('日期不在有效期内,请重新选择。'); - return 1; - } else { - isvoid.value = Dates.elem[as.elemv].match(exp).join(); - arr = isvoid.value.match(/\d+/g); - if(arr[1] < 1){ - arr[1] = 1; - isvoid.auto = 1; - } else if(arr[1] > 12){ - arr[1] = 12; - isvoid.auto = 1; - } else if(arr[1].length < 2){ - isvoid.auto = 1; - } - if(arr[2] < 1){ - arr[2] = 1; - isvoid.auto = 1; - } else if(arr[2] > Dates.months[(arr[1]|0)-1]){ - arr[2] = 31; - isvoid.auto = 1; - } else if(arr[2].length < 2){ - isvoid.auto = 1; - } - if(arr.length > 3){ - if(Dates.timeVoid(arr[3], 0)){ - isvoid.auto = 1; - }; - if(Dates.timeVoid(arr[4], 1)){ - isvoid.auto = 1; - }; - if(Dates.timeVoid(arr[5], 2)){ - isvoid.auto = 1; - }; - } - if(isvoid.auto){ - Dates.creation([arr[0], arr[1]|0, arr[2]|0], 1); - } else if(isvoid.value !== Dates.elem[as.elemv]){ - Dates.elem[as.elemv] = isvoid.value; - } - } - } -}; - -//生成日期 -Dates.months = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; -Dates.viewDate = function(Y, M, D){ - var S = Dates.query, log = {}, De = new Date(); - Y < (Dates.mins[0]|0) && (Y = (Dates.mins[0]|0)); - Y > (Dates.maxs[0]|0) && (Y = (Dates.maxs[0]|0)); - - De.setFullYear(Y, M, D); - log.ymd = [De.getFullYear(), De.getMonth(), De.getDate()]; - - Dates.months[1] = Dates.isleap(log.ymd[0]) ? 29 : 28; - - De.setFullYear(log.ymd[0], log.ymd[1], 1); - log.FDay = De.getDay(); - - log.PDay = Dates.months[M === 0 ? 11 : M - 1] - log.FDay + 1; - log.NDay = 1; - - //渲染日 - Dates.each(as.tds, function(i, elem){ - var YY = log.ymd[0], MM = log.ymd[1] + 1, DD; - elem.className = ''; - if(i < log.FDay){ - elem.innerHTML = DD = i + log.PDay; - Dates.addClass(elem, 'laydate_nothis'); - MM === 1 && (YY -= 1); - MM = MM === 1 ? 12 : MM - 1; - } else if(i >= log.FDay && i < log.FDay + Dates.months[log.ymd[1]]){ - elem.innerHTML = DD = i - log.FDay + 1; - if(i - log.FDay + 1 === log.ymd[2]){ - Dates.addClass(elem, as[2]); - log.thisDay = elem; - } - } else { - elem.innerHTML = DD = log.NDay++; - Dates.addClass(elem, 'laydate_nothis'); - MM === 12 && (YY += 1); - MM = MM === 12 ? 1 : MM + 1; - } - - if(Dates.checkVoid(YY, MM, DD)[0]){ - Dates.addClass(elem, as[1]); - } - - Dates.options.festival && Dates.festival(elem, MM + '.' + DD); - elem.setAttribute('y', YY); - elem.setAttribute('m', MM); - elem.setAttribute('d', DD); - YY = MM = DD = null; - }); - - Dates.valid = !Dates.hasClass(log.thisDay, as[1]); - Dates.ymd = log.ymd; - - //锁定年月 - as.year.value = Dates.ymd[0] + '年'; - as.month.value = Dates.digit(Dates.ymd[1] + 1) + '月'; - - //定位月 - Dates.each(as.mms, function(i, elem){ - var getCheck = Dates.checkVoid(Dates.ymd[0], (elem.getAttribute('m')|0) + 1); - if(getCheck[0] === 'y' || getCheck[0] === 'm'){ - Dates.addClass(elem, as[1]); - } else { - Dates.removeClass(elem, as[1]); - } - Dates.removeClass(elem, as[2]); - getCheck = null - }); - Dates.addClass(as.mms[Dates.ymd[1]], as[2]); - - //定位时分秒 - log.times = [ - Dates.inymd[Dates.elemIndexMap.hour]|0 || 0, - Dates.inymd[Dates.elemIndexMap.minute]|0 || 0, - Dates.inymd[Dates.elemIndexMap.second]|0 || 0 - ]; - Dates.each(new Array(3), function(i){ - Dates.hmsin[i].value = Dates.digit(Dates.timeVoid(log.times[i], i) ? Dates.mins[i+3]|0 : log.times[i]|0); - }); - - //确定按钮状态 - Dates[Dates.valid ? 'removeClass' : 'addClass'](as.ok, as[1]); -}; - -//节日 -Dates.festival = function(td, md){ - var str; - switch(md){ - case '1.1': - str = '元旦'; - break; - case '3.8': - str = '妇女'; - break; - case '4.5': - str = '清明'; - break; - case '5.1': - str = '劳动'; - break; - case '6.1': - str = '儿童'; - break; - case '9.10': - str = '教师'; - break; - case '10.1': - str = '国庆'; - break; - }; - str && (td.innerHTML = str); - str = null; -}; - -//生成年列表 -Dates.viewYears = function(YY){ - var S = Dates.query, str = ''; - Dates.each(new Array(14), function(i){ - if(i === 7) { - str += '
  • '+ YY +'年
  • '; - } else { - str += '
  • '+ (YY-7+i) +'年
  • '; - } - }); - S('#laydate_ys').innerHTML = str; - Dates.each(S('#laydate_ys li'), function(i, elem){ - if(Dates.checkVoid(elem.getAttribute('y'))[0] === 'y'){ - Dates.addClass(elem, as[1]); - } else { - Dates.on(elem, 'click', function(ev){ - Dates.stopmp(ev).reshow(); - Dates.viewDate(this.getAttribute('y')|0, Dates.ymd[1], Dates.ymd[2]); - }); - } - }); -}; - -Dates.getEachElementIndex = function(format) { - var components = {}; - var currentIndex = 0; - format.replace(/YYYY|MM|DD|hh|mm|ss/g, function(str, index){ - if (str === 'YYYY') { - components['year'] = currentIndex++; - } else if (str === 'MM') { - components['month'] = currentIndex++; - } else if (str === 'DD') { - components['day'] = currentIndex++; - } else if (str === 'hh') { - components['hour'] = currentIndex++; - } else if (str === 'mm') { - components['minute'] = currentIndex++; - } else if (str === 'ss') { - components['second'] = currentIndex++; - } - return ""; - }); - return components; -}; - -//初始化面板数据 -Dates.initDate = function(format){ - var S = Dates.query, log = {}, De = new Date(); - var ymd = Dates.elem[as.elemv].match(/\d+/g) || []; - var elemIndexMap = Dates.getEachElementIndex(format); - Dates.elemIndexMap = elemIndexMap; - if(ymd.length < 3){ - ymd = Dates.options.start.match(/\d+/g) || []; - if(ymd.length < 3){ - ymd = [De.getFullYear(), De.getMonth()+1, De.getDate()]; - } - } - Dates.inymd = ymd; - Dates.viewDate(ymd[elemIndexMap.year], ymd[elemIndexMap.month] - 1, ymd[elemIndexMap.day]); -}; - -//是否显示零件 -Dates.iswrite = function(){ - var S = Dates.query, log = { - time: S('#laydate_hms') - }; - Dates.shde(log.time, !Dates.options.istime); - Dates.shde(as.oclear, !('isclear' in Dates.options ? Dates.options.isclear : 1)); - Dates.shde(as.otoday, !('istoday' in Dates.options ? Dates.options.istoday : 1)); - Dates.shde(as.ok, !('issure' in Dates.options ? Dates.options.issure : 1)); -}; - -//方位辨别 -Dates.orien = function(obj, pos){ - var tops, rect = Dates.elem.getBoundingClientRect(); - obj.style.left = rect.left + (pos ? 0 : Dates.scroll(1)) + 'px'; - if(rect.bottom + obj.offsetHeight/1.5 <= Dates.winarea()){ - tops = rect.bottom - 1; - } else { - tops = rect.top > obj.offsetHeight/1.5 ? rect.top - obj.offsetHeight + 1 : Dates.winarea() - obj.offsetHeight; - } - obj.style.top = Math.max(tops + (pos ? 0 : Dates.scroll()),1) + 'px'; -}; - -//吸附定位 -Dates.follow = function(obj){ - if(Dates.options.fixed){ - obj.style.position = 'fixed'; - Dates.orien(obj, 1); - } else { - obj.style.position = 'absolute'; - Dates.orien(obj); - } -}; - -//生成表格 -Dates.viewtb = (function(){ - var tr, view = [], weeks = [ '日', '一', '二', '三', '四', '五', '六']; - var log = {}, table = doc[creat]('table'), thead = doc[creat]('thead'); - thead.appendChild(doc[creat]('tr')); - log.creath = function(i){ - var th = doc[creat]('th'); - th.innerHTML = weeks[i]; - thead[tags]('tr')[0].appendChild(th); - th = null; - }; - - Dates.each(new Array(6), function(i){ - view.push([]); - tr = table.insertRow(0); - Dates.each(new Array(7), function(j){ - view[i][j] = 0; - i === 0 && log.creath(j); - tr.insertCell(j); - }); - }); - - table.insertBefore(thead, table.children[0]); - table.id = table.className = 'laydate_table'; - tr = view = null; - return table.outerHTML.toLowerCase(); -}()); - -//渲染控件骨架 -Dates.view = function(elem, options){ - var S = Dates.query, div, log = {}; - options = options || elem; - - Dates.elem = elem; - Dates.options = options; - Dates.options.format || (Dates.options.format = config.format); - Dates.options.start = Dates.options.start || ''; - Dates.mm = log.mm = [Dates.options.min || config.min, Dates.options.max || config.max]; - Dates.mins = log.mm[0].match(/\d+/g); - Dates.maxs = log.mm[1].match(/\d+/g); - - if(!Dates.box){ - div = doc[creat]('div'); - div.id = as[0]; - div.className = as[0]; - div.style.cssText = 'position: absolute;'; - div.setAttribute('name', 'laydate-v'+ laydate.v); - - div.innerHTML = log.html = '
    ' - +'
    ' - +'' - +'' - +'' - +'
    ' - +'' - +'
      ' - +'' - +'
      ' - +'
      ' - +'
      ' - +'' - +'' - +'' - +'
      '+ function(){ - var str = ''; - Dates.each(new Array(12), function(i){ - str += ''+ Dates.digit(i+1) +'月'; - }); - return str; - }() +'
      ' - +'
      ' - +'
      ' - - + Dates.viewtb - - +'
      ' - +'' - +'
      ' - +'
      ' - +'清空' - +'今天' - +'确认' - +'
      ' - +(config.isv ? 'laydate-v'+ laydate.v +'' : '') - +'
      '; - doc.body.appendChild(div); - Dates.box = S('#'+as[0]); - Dates.events(); - div = null; - } else { - Dates.shde(Dates.box); - } - Dates.follow(Dates.box); - options.zIndex ? Dates.box.style.zIndex = options.zIndex : Dates.removeCssAttr(Dates.box, 'z-index'); - Dates.stopMosup('click', Dates.box); - - Dates.initDate(options.format); - Dates.iswrite(); - Dates.check(); -}; - -//隐藏内部弹出元素 -Dates.reshow = function(){ - Dates.each(Dates.query('#'+ as[0] +' .laydate_show'), function(i, elem){ - Dates.removeClass(elem, 'laydate_show'); - }); - return this; -}; - -//关闭控件 -Dates.close = function(){ - Dates.reshow(); - Dates.shde(Dates.query('#'+ as[0]), 1); - Dates.elem = null; -}; - -//转换日期格式 -Dates.parse = function(ymd, hms, format){ - ymd = ymd.concat(hms); // [year, month, day, hour, minute, second] - format = format || (Dates.options ? Dates.options.format : config.format); - return format.replace(/YYYY|MM|DD|hh|mm|ss/g, function(str, index){ - var pos = -1; - if (str === 'YYYY') { - pos = 0; - } else if (str === 'MM') { - pos = 1; - } else if (str === 'DD') { - pos = 2; - } else if (str === 'hh') { - pos = 3; - } else if (str === 'mm') { - pos = 4; - } else if (str === 'ss') { - pos = 5; - } - return Dates.digit(ymd[pos]); - }); -}; - -//返回最终日期 -Dates.creation = function(ymd, hide){ - var S = Dates.query, hms = Dates.hmsin; - var getDates = Dates.parse(ymd, [hms[0].value, hms[1].value, hms[2].value]); - Dates.elem[as.elemv] = getDates; - if(!hide){ - Dates.close(); - typeof Dates.options.choose === 'function' && Dates.options.choose(getDates); - } -}; - -//事件 -Dates.events = function(){ - var S = Dates.query, log = { - box: '#'+as[0] - }; - - Dates.addClass(doc.body, 'laydate_body'); - - as.tds = S('#laydate_table td'); - as.mms = S('#laydate_ms span'); - as.year = S('#laydate_y'); - as.month = S('#laydate_m'); - - //显示更多年月 - Dates.each(S(log.box + ' .laydate_ym'), function(i, elem){ - Dates.on(elem, 'click', function(ev){ - Dates.stopmp(ev).reshow(); - Dates.addClass(this[tags]('div')[0], 'laydate_show'); - if(!i){ - log.YY = parseInt(as.year.value); - Dates.viewYears(log.YY); - } - }); - }); - - Dates.on(S(log.box), 'click', function(){ - Dates.reshow(); - }); - - //切换年 - log.tabYear = function(type){ - if(type === 0){ - Dates.ymd[0]--; - } else if(type === 1) { - Dates.ymd[0]++; - } else if(type === 2) { - log.YY -= 14; - } else { - log.YY += 14; - } - if(type < 2){ - Dates.viewDate(Dates.ymd[0], Dates.ymd[1], Dates.ymd[2]); - Dates.reshow(); - } else { - Dates.viewYears(log.YY); - } - }; - Dates.each(S('#laydate_YY .laydate_tab'), function(i, elem){ - Dates.on(elem, 'click', function(ev){ - Dates.stopmp(ev); - log.tabYear(i); - }); - }); - - - //切换月 - log.tabMonth = function(type){ - if(type){ - Dates.ymd[1]++; - if(Dates.ymd[1] === 12){ - Dates.ymd[0]++; - Dates.ymd[1] = 0; - } - } else { - Dates.ymd[1]--; - if(Dates.ymd[1] === -1){ - Dates.ymd[0]--; - Dates.ymd[1] = 11; - } - } - Dates.viewDate(Dates.ymd[0], Dates.ymd[1], Dates.ymd[2]); - }; - Dates.each(S('#laydate_MM .laydate_tab'), function(i, elem){ - Dates.on(elem, 'click', function(ev){ - Dates.stopmp(ev).reshow(); - log.tabMonth(i); - }); - }); - - //选择月 - Dates.each(S('#laydate_ms span'), function(i, elem){ - Dates.on(elem, 'click', function(ev){ - Dates.stopmp(ev).reshow(); - if(!Dates.hasClass(this, as[1])){ - Dates.viewDate(Dates.ymd[0], this.getAttribute('m')|0, Dates.ymd[2]); - } - }); - }); - - //选择日 - Dates.each(S('#laydate_table td'), function(i, elem){ - Dates.on(elem, 'click', function(ev){ - if(!Dates.hasClass(this, as[1])){ - Dates.stopmp(ev); - if(Dates.options.istime){ - + Dates.viewDate([this.getAttribute('y')|0, (this.getAttribute('m')|0)-1, this.getAttribute('d')|0]); - + }else{ - + Dates.creation([this.getAttribute('y')|0, this.getAttribute('m')|0, this.getAttribute('d')|0]); - + } - } - }); - }); - - //清空 - as.oclear = S('#laydate_clear'); - Dates.on(as.oclear, 'click', function(){ - Dates.elem[as.elemv] = ''; - Dates.close(); - }); - - //今天 - as.otoday = S('#laydate_today'); - Dates.on(as.otoday, 'click', function(){ - var now = new Date(); - // 2016-09-23 18:20:54 修复选中今天choose方法得不到数据 - // Dates.creation([now.getFullYear(), now.getMonth() + 1, now.getDate()]); - - // 2016-09-26 10:49:25 修复选中今天 如果YYYY-MM-DD hh:mm:ss格式,获取当前的时分秒 - var hms = Dates.hmsin; - var date = new Date(); - // 获取当前时间小时 - hms[0].value = date.getHours(); - // 获取当前时间分钟 - hms[1].value = date.getMinutes(); - // 获取当前时间秒 - hms[2].value = date.getSeconds(); - Dates.creation([Dates.ymd[0], Dates.ymd[1]+1, Dates.ymd[2]]); - }); - - //确认 - as.ok = S('#laydate_ok'); - Dates.on(as.ok, 'click', function(){ - if(Dates.valid){ - Dates.creation([Dates.ymd[0], Dates.ymd[1]+1, Dates.ymd[2]]); - } - }); - - //选择时分秒 - log.times = S('#laydate_time'); - Dates.hmsin = log.hmsin = S('#laydate_hms input'); - log.hmss = ['小时', '分钟', '秒数']; - log.hmsarr = []; - - //生成时分秒或警告信息 - Dates.msg = function(i, title){ - var str = '
      '+ (title || '提示') +'×
      '; - if(typeof i === 'string'){ - str += '

      '+ i +'

      '; - Dates.shde(S('#'+as[0])); - Dates.removeClass(log.times, 'laydate_time1').addClass(log.times, 'laydate_msg'); - } else { - if(!log.hmsarr[i]){ - str += '
      '; - Dates.each(new Array(i === 0 ? 24 : 60), function(i){ - str += ''+ i +''; - }); - str += '
      ' - log.hmsarr[i] = str; - } else { - str = log.hmsarr[i]; - } - Dates.removeClass(log.times, 'laydate_msg'); - Dates[i=== 0 ? 'removeClass' : 'addClass'](log.times, 'laydate_time1'); - } - Dates.addClass(log.times, 'laydate_show'); - log.times.innerHTML = str; - }; - - log.hmson = function(input, index){ - var span = S('#laydate_hmsno span'), set = Dates.valid ? null : 1; - Dates.each(span, function(i, elem){ - if(set){ - Dates.addClass(elem, as[1]); - } else if(Dates.timeVoid(i, index)){ - Dates.addClass(elem, as[1]); - } else { - Dates.on(elem, 'click', function(ev){ - if(!Dates.hasClass(this, as[1])){ - input.value = Dates.digit(this.innerHTML|0); - } - }); - } - }); - Dates.addClass(span[input.value|0], 'laydate_click'); - }; - - //展开选择 - Dates.each(log.hmsin, function(i, elem){ - Dates.on(elem, 'click', function(ev){ - Dates.stopmp(ev).reshow(); - Dates.msg(i, log.hmss[i]); - log.hmson(this, i); - }); - }); - - Dates.on(doc, 'mouseup', function(){ - var box = S('#'+as[0]); - if(box && box.style.display !== 'none'){ - Dates.check() || Dates.close(); - } - }).on(doc, 'keydown', function(event){ - event = event || win.event; - var codes = event.keyCode; - - //如果在日期显示的时候按回车 - if(codes === 13 && Dates.elem){ - Dates.creation([Dates.ymd[0], Dates.ymd[1]+1, Dates.ymd[2]]); - } - }); -}; - -Dates.init = (function(){ - Dates.use('need'); - Dates.use(as[4] + config.skin, as[3]); - Dates.skinLink = Dates.query('#'+as[3]); -}()); - -//重置定位 -laydate.reset = function(){ - (Dates.box && Dates.elem) && Dates.follow(Dates.box); -}; - -//返回指定日期 -laydate.now = function(timestamp, format){ - var De = new Date((timestamp|0) ? function(tamp){ - return tamp < 86400000 ? (+new Date + tamp*86400000) : tamp; - }(parseInt(timestamp)) : +new Date); - return Dates.parse( - [De.getFullYear(), De.getMonth()+1, De.getDate()], - [De.getHours(), De.getMinutes(), De.getSeconds()], - format - ); -}; - -//皮肤选择 -laydate.skin = chgSkin; - -//内部函数 -function chgSkin(lib) { - Dates.skinLink.href = Dates.getPath + as[4] + lib + as[5]; -}; - -}(window); diff --git a/laydate.js b/laydate.js deleted file mode 100644 index 52ef670..0000000 --- a/laydate.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - - @Name : layDate v1.1 日期控件 - @Author: 贤心 - @Date: 2014-06-25 - @QQ群:176047195 - @Site:http://sentsin.com/layui/laydate - - */ - -;!function(a){var b={path:"",defSkin:"default",format:"YYYY-MM-DD",min:"1900-01-01 00:00:00",max:"2099-12-31 23:59:59",isv:!1},c={},d=document,e="createElement",f="getElementById",g="getElementsByTagName",h=["laydate_box","laydate_void","laydate_click","LayDateSkin","skins/","/laydate.css"];a.laydate=function(b){b=b||{};try{h.event=a.event?a.event:laydate.caller.arguments[0]}catch(d){}return c.run(b),laydate},laydate.v="1.1",c.getPath=function(){var a=document.scripts,c=a[a.length-1].src;return b.path?b.path:c.substring(0,c.lastIndexOf("/")+1)}(),c.use=function(a,b){var f=d[e]("link");f.type="text/css",f.rel="stylesheet",f.href=c.getPath+a+h[5],b&&(f.id=b),d[g]("head")[0].appendChild(f),f=null},c.trim=function(a){return a=a||"",a.replace(/^\s|\s$/g,"").replace(/\s+/g," ")},c.digit=function(a){return 10>a?"0"+(0|a):a},c.stopmp=function(b){return b=b||a.event,b.stopPropagation?b.stopPropagation():b.cancelBubble=!0,this},c.each=function(a,b){for(var c=0,d=a.length;d>c&&b(c,a[c])!==!1;c++);},c.hasClass=function(a,b){return a=a||{},new RegExp("\\b"+b+"\\b").test(a.className)},c.addClass=function(a,b){return a=a||{},c.hasClass(a,b)||(a.className+=" "+b),a.className=c.trim(a.className),this},c.removeClass=function(a,b){if(a=a||{},c.hasClass(a,b)){var d=new RegExp("\\b"+b+"\\b");a.className=a.className.replace(d,"")}return this},c.removeCssAttr=function(a,b){var c=a.style;c.removeProperty?c.removeProperty(b):c.removeAttribute(b)},c.shde=function(a,b){a.style.display=b?"none":"block"},c.query=function(a){var e,b,h,i,j;return a=c.trim(a).split(" "),b=d[f](a[0].substr(1)),b?a[1]?/^\./.test(a[1])?(i=a[1].substr(1),j=new RegExp("\\b"+i+"\\b"),e=[],h=d.getElementsByClassName?b.getElementsByClassName(i):b[g]("*"),c.each(h,function(a,b){j.test(b.className)&&e.push(b)}),e[0]?e:""):(e=b[g](a[1]),e[0]?b[g](a[1]):""):b:void 0},c.on=function(b,d,e){return b.attachEvent?b.attachEvent("on"+d,function(){e.call(b,a.even)}):b.addEventListener(d,e,!1),c},c.stopMosup=function(a,b){"mouseup"!==a&&c.on(b,"mouseup",function(a){c.stopmp(a)})},c.run=function(a){var d,e,g,b=c.query,f=h.event;try{g=f.target||f.srcElement||{}}catch(i){g={}}if(d=a.elem?b(a.elem):g,f&&g.tagName){if(!d||d===c.elem)return;c.stopMosup(f.type,d),c.stopmp(f),c.view(d,a),c.reshow()}else e=a.event||"click",c.each((0|d.length)>0?d:[d],function(b,d){c.stopMosup(e,d),c.on(d,e,function(b){c.stopmp(b),d!==c.elem&&(c.view(d,a),c.reshow())})})},c.scroll=function(a){return a=a?"scrollLeft":"scrollTop",d.body[a]|d.documentElement[a]},c.winarea=function(a){return document.documentElement[a?"clientWidth":"clientHeight"]},c.isleap=function(a){return 0===a%4&&0!==a%100||0===a%400},c.checkVoid=function(a,b,d){var e=[];return a=0|a,b=0|b,d=0|d,ac.maxs[0]?e=["y",1]:a>=c.mins[0]&&a<=c.maxs[0]&&(a==c.mins[0]&&(bc.maxs[1]?e=["m",1]:b==c.maxs[1]&&d>c.maxs[2]&&(e=["d",1]))),e},c.timeVoid=function(a,b){if(c.ymd[1]+1==c.mins[1]&&c.ymd[2]==c.mins[2]){if(0===b&&ac.maxs[3])return 1;if(1===b&&a>c.maxs[4])return 1;if(2===b&&a>c.maxs[5])return 1}return a>(b?59:23)?1:void 0},c.check=function(){var a=c.options.format.replace(/YYYY|MM|DD|hh|mm|ss/g,"\\d+\\").replace(/\\$/g,""),b=new RegExp(a),d=c.elem[h.elemv],e=d.match(/\d+/g)||[],f=c.checkVoid(e[0],e[1],e[2]);if(""!==d.replace(/\s/g,"")){if(!b.test(d))return c.elem[h.elemv]="",c.msg("日期不符合格式,请重新选择。"),1;if(f[0])return c.elem[h.elemv]="",c.msg("日期不在有效期内,请重新选择。"),1;f.value=c.elem[h.elemv].match(b).join(),e=f.value.match(/\d+/g),e[1]<1?(e[1]=1,f.auto=1):e[1]>12?(e[1]=12,f.auto=1):e[1].length<2&&(f.auto=1),e[2]<1?(e[2]=1,f.auto=1):e[2]>c.months[(0|e[1])-1]?(e[2]=31,f.auto=1):e[2].length<2&&(f.auto=1),e.length>3&&(c.timeVoid(e[3],0)&&(f.auto=1),c.timeVoid(e[4],1)&&(f.auto=1),c.timeVoid(e[5],2)&&(f.auto=1)),f.auto?c.creation([e[0],0|e[1],0|e[2]],1):f.value!==c.elem[h.elemv]&&(c.elem[h.elemv]=f.value)}},c.months=[31,null,31,30,31,30,31,31,30,31,30,31],c.viewDate=function(a,b,d){var f=(c.query,{}),g=new Date;a<(0|c.mins[0])&&(a=0|c.mins[0]),a>(0|c.maxs[0])&&(a=0|c.maxs[0]),g.setFullYear(a,b,d),f.ymd=[g.getFullYear(),g.getMonth(),g.getDate()],c.months[1]=c.isleap(f.ymd[0])?29:28,g.setFullYear(f.ymd[0],f.ymd[1],1),f.FDay=g.getDay(),f.PDay=c.months[0===b?11:b-1]-f.FDay+1,f.NDay=1,c.each(h.tds,function(a,b){var g,d=f.ymd[0],e=f.ymd[1]+1;b.className="",a=f.FDay&&a'+a+"年":'
    • '+(a-7+b)+"年
    • "}),b("#laydate_ys").innerHTML=d,c.each(b("#laydate_ys li"),function(a,b){"y"===c.checkVoid(b.getAttribute("y"))[0]?c.addClass(b,h[1]):c.on(b,"click",function(a){c.stopmp(a).reshow(),c.viewDate(0|this.getAttribute("y"),c.ymd[1],c.ymd[2])})})},c.initDate=function(){var d=(c.query,new Date),e=c.elem[h.elemv].match(/\d+/g)||[];e.length<3&&(e=c.options.start.match(/\d+/g)||[],e.length<3&&(e=[d.getFullYear(),d.getMonth()+1,d.getDate()])),c.inymd=e,c.viewDate(e[0],e[1]-1,e[2])},c.iswrite=function(){var a=c.query,b={time:a("#laydate_hms")};c.shde(b.time,!c.options.istime),c.shde(h.oclear,!("isclear"in c.options?c.options.isclear:1)),c.shde(h.otoday,!("istoday"in c.options?c.options.istoday:1)),c.shde(h.ok,!("issure"in c.options?c.options.issure:1))},c.orien=function(a,b){var d,e=c.elem.getBoundingClientRect();a.style.left=e.left+(b?0:c.scroll(1))+"px",d=e.bottom+a.offsetHeight/1.5<=c.winarea()?e.bottom-1:e.top>a.offsetHeight/1.5?e.top-a.offsetHeight+1:c.winarea()-a.offsetHeight,a.style.top=d+(b?0:c.scroll())+"px"},c.follow=function(a){c.options.fixed?(a.style.position="fixed",c.orien(a,1)):(a.style.position="absolute",c.orien(a))},c.viewtb=function(){var a,b=[],f=["日","一","二","三","四","五","六"],h={},i=d[e]("table"),j=d[e]("thead");return j.appendChild(d[e]("tr")),h.creath=function(a){var b=d[e]("th");b.innerHTML=f[a],j[g]("tr")[0].appendChild(b),b=null},c.each(new Array(6),function(d){b.push([]),a=i.insertRow(0),c.each(new Array(7),function(c){b[d][c]=0,0===d&&h.creath(c),a.insertCell(c)})}),i.insertBefore(j,i.children[0]),i.id=i.className="laydate_table",a=b=null,i.outerHTML.toLowerCase()}(),c.view=function(a,f){var i,g=c.query,j={};f=f||a,c.elem=a,c.options=f,c.options.format||(c.options.format=b.format),c.options.start=c.options.start||"",c.mm=j.mm=[c.options.min||b.min,c.options.max||b.max],c.mins=j.mm[0].match(/\d+/g),c.maxs=j.mm[1].match(/\d+/g),h.elemv=/textarea|input/.test(c.elem.tagName.toLocaleLowerCase())?"value":"innerHTML",c.box?c.shde(c.box):(i=d[e]("div"),i.id=h[0],i.className=h[0],i.style.cssText="position: absolute;",i.setAttribute("name","laydate-v"+laydate.v),i.innerHTML=j.html='
        '+function(){var a="";return c.each(new Array(12),function(b){a+=''+c.digit(b+1)+"月"}),a}()+"
        "+"
        "+"
        "+c.viewtb+'
        '+'
          '+'
        • 时间
        • '+"
        • :
        • "+"
        • :
        • "+"
        • "+"
        "+'
        '+'
        '+'清空'+'今天'+'确认'+"
        "+(b.isv?'laydate-v'+laydate.v+"":"")+"
        ",d.body.appendChild(i),c.box=g("#"+h[0]),c.events(),i=null),c.follow(c.box),f.zIndex?c.box.style.zIndex=f.zIndex:c.removeCssAttr(c.box,"z-index"),c.stopMosup("click",c.box),c.initDate(),c.iswrite(),c.check()},c.reshow=function(){return c.each(c.query("#"+h[0]+" .laydate_show"),function(a,b){c.removeClass(b,"laydate_show")}),this},c.close=function(){c.reshow(),c.shde(c.query("#"+h[0]),1),c.elem=null},c.parse=function(a,d,e){return a=a.concat(d),e=e||(c.options?c.options.format:b.format),e.replace(/YYYY|MM|DD|hh|mm|ss/g,function(){return a.index=0|++a.index,c.digit(a[a.index])})},c.creation=function(a,b){var e=(c.query,c.hmsin),f=c.parse(a,[e[0].value,e[1].value,e[2].value]);c.elem[h.elemv]=f,b||(c.close(),"function"==typeof c.options.choose&&c.options.choose(f))},c.events=function(){var b=c.query,e={box:"#"+h[0]};c.addClass(d.body,"laydate_body"),h.tds=b("#laydate_table td"),h.mms=b("#laydate_ms span"),h.year=b("#laydate_y"),h.month=b("#laydate_m"),c.each(b(e.box+" .laydate_ym"),function(a,b){c.on(b,"click",function(b){c.stopmp(b).reshow(),c.addClass(this[g]("div")[0],"laydate_show"),a||(e.YY=parseInt(h.year.value),c.viewYears(e.YY))})}),c.on(b(e.box),"click",function(){c.reshow()}),e.tabYear=function(a){0===a?c.ymd[0]--:1===a?c.ymd[0]++:2===a?e.YY-=14:e.YY+=14,2>a?(c.viewDate(c.ymd[0],c.ymd[1],c.ymd[2]),c.reshow()):c.viewYears(e.YY)},c.each(b("#laydate_YY .laydate_tab"),function(a,b){c.on(b,"click",function(b){c.stopmp(b),e.tabYear(a)})}),e.tabMonth=function(a){a?(c.ymd[1]++,12===c.ymd[1]&&(c.ymd[0]++,c.ymd[1]=0)):(c.ymd[1]--,-1===c.ymd[1]&&(c.ymd[0]--,c.ymd[1]=11)),c.viewDate(c.ymd[0],c.ymd[1],c.ymd[2])},c.each(b("#laydate_MM .laydate_tab"),function(a,b){c.on(b,"click",function(b){c.stopmp(b).reshow(),e.tabMonth(a)})}),c.each(b("#laydate_ms span"),function(a,b){c.on(b,"click",function(a){c.stopmp(a).reshow(),c.hasClass(this,h[1])||c.viewDate(c.ymd[0],0|this.getAttribute("m"),c.ymd[2])})}),c.each(b("#laydate_table td"),function(a,b){c.on(b,"click",function(a){c.hasClass(this,h[1])||(c.stopmp(a),c.creation([0|this.getAttribute("y"),0|this.getAttribute("m"),0|this.getAttribute("d")]))})}),h.oclear=b("#laydate_clear"),c.on(h.oclear,"click",function(){c.elem[h.elemv]="",c.close()}),h.otoday=b("#laydate_today"),c.on(h.otoday,"click",function(){var hms=c.hmsin;var date=new Date();hms[0].value=date.getHours();hms[1].value=date.getMinutes();hms[2].value=date.getSeconds();c.creation([c.ymd[0],c.ymd[1]+1,c.ymd[2]]),c.close()}),h.ok=b("#laydate_ok"),c.on(h.ok,"click",function(){c.valid&&c.creation([c.ymd[0],c.ymd[1]+1,c.ymd[2]])}),e.times=b("#laydate_time"),c.hmsin=e.hmsin=b("#laydate_hms input"),e.hmss=["小时","分钟","秒数"],e.hmsarr=[],c.msg=function(a,d){var f='
        '+(d||"提示")+"×
        ";"string"==typeof a?(f+="

        "+a+"

        ",c.shde(b("#"+h[0])),c.removeClass(e.times,"laydate_time1").addClass(e.times,"laydate_msg")):(e.hmsarr[a]?f=e.hmsarr[a]:(f+='
        ',c.each(new Array(0===a?24:60),function(a){f+=""+a+""}),f+="
        ",e.hmsarr[a]=f),c.removeClass(e.times,"laydate_msg"),c[0===a?"removeClass":"addClass"](e.times,"laydate_time1")),c.addClass(e.times,"laydate_show"),e.times.innerHTML=f},e.hmson=function(a,d){var e=b("#laydate_hmsno span"),f=c.valid?null:1;c.each(e,function(b,e){f?c.addClass(e,h[1]):c.timeVoid(b,d)?c.addClass(e,h[1]):c.on(e,"click",function(){c.hasClass(this,h[1])||(a.value=c.digit(0|this.innerHTML))})}),c.addClass(e[0|a.value],"laydate_click")},c.each(e.hmsin,function(a,b){c.on(b,"click",function(b){c.stopmp(b).reshow(),c.msg(a,e.hmss[a]),e.hmson(this,a)})}),c.on(d,"mouseup",function(){var a=b("#"+h[0]);a&&"none"!==a.style.display&&(c.check()||c.close())}).on(d,"keydown",function(b){b=b||a.event;var d=b.keyCode;13===d&&c.creation([c.ymd[0],c.ymd[1]+1,c.ymd[2]])})},c.init=function(){c.use("need"),c.use(h[4]+b.defSkin,h[3]),c.skinLink=c.query("#"+h[3])}(),laydate.reset=function(){c.box&&c.elem&&c.follow(c.box)},laydate.now=function(a,b){var d=new Date(0|a?function(a){return 864e5>a?+new Date+864e5*a:a}(parseInt(a)):+new Date);return c.parse([d.getFullYear(),d.getMonth()+1,d.getDate()],[d.getHours(),d.getMinutes(),d.getSeconds()],b)},laydate.skin=function(a){c.skinLink.href=c.getPath+h[4]+a+h[5]}}(window); \ No newline at end of file diff --git a/need/laydate.css b/need/laydate.css deleted file mode 100644 index 2eb0a5b..0000000 --- a/need/laydate.css +++ /dev/null @@ -1,73 +0,0 @@ -/** - - @Name: laydate 核心样式 - @Author:贤心 - @Site:http://sentsin.com/layui/laydate - -**/ - -html{_background-image:url(about:blank); _background-attachment:fixed;} -.laydate_body .laydate_box, .laydate_body .laydate_box *{margin:0; padding:0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box;} -.laydate-icon, -.laydate-icon-default, -.laydate-icon-danlan, -.laydate-icon-dahong, -.laydate-icon-molv{height:22px; line-height:22px; padding-right:20px; border:1px solid #C6C6C6; background-repeat:no-repeat; background-position:right center; background-color:#fff; outline:0;} -.laydate-icon-default{ background-image:url(../skins/default/icon.png)} -.laydate-icon-danlan{border:1px solid #B1D2EC; background-image:url(../skins/danlan/icon.png)} -.laydate-icon-dahong{background-image:url(../skins/dahong/icon.png)} -.laydate-icon-molv{background-image:url(../skins/molv/icon.png)} -.laydate_body .laydate_box{width:240px; font:12px '\5B8B\4F53'; z-index:99999999; *margin:-2px 0 0 -2px; *overflow:hidden; _margin:0; _position:absolute!important; background-color:#fff;} -.laydate_body .laydate_box li{list-style:none;} -.laydate_body .laydate_box .laydate_void{cursor:text!important;} -.laydate_body .laydate_box a, .laydate_body .laydate_box a:hover{text-decoration:none; blr:expression(this.onFocus=this.blur()); cursor:pointer;} -.laydate_body .laydate_box a:hover{text-decoration:none;} -.laydate_body .laydate_box cite, .laydate_body .laydate_box label{position:absolute; width:0; height:0; border-width:5px; border-style:dashed; border-color:transparent; overflow:hidden; cursor:pointer;} -.laydate_body .laydate_box .laydate_yms, .laydate_body .laydate_box .laydate_time{display:none;} -.laydate_body .laydate_box .laydate_show{display:block;} -.laydate_body .laydate_box input{outline:0; font-size:14px; background-color:#fff;} -.laydate_body .laydate_top{position:relative; height:26px; padding:5px; *width:100%; z-index:99;} -.laydate_body .laydate_ym{position:relative; float:left; height:24px; cursor:pointer;} -.laydate_body .laydate_ym input{float:left; height:24px; line-height:24px; text-align:center; border:none; cursor:pointer;} -.laydate_body .laydate_ym .laydate_yms{position:absolute; left: -1px; top: 24px; height:181px;} -.laydate_body .laydate_y{width:121px; margin-right:6px;} -.laydate_body .laydate_y input{width:64px; margin-right:15px;} -.laydate_body .laydate_y .laydate_yms{width:121px; text-align:center;} -.laydate_body .laydate_y .laydate_yms a{position:relative; display:block; height:20px;} -.laydate_body .laydate_y .laydate_yms ul{height:139px; padding:0; *overflow:hidden;} -.laydate_body .laydate_y .laydate_yms ul li{float:left; width:60px; height:20px; line-height: 20px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;} -.laydate_body .laydate_m{width:99px;} -.laydate_body .laydate_m .laydate_yms{width:99px; padding:0;} -.laydate_body .laydate_m input{width:42px; margin-right:15px;} -.laydate_body .laydate_m .laydate_yms span{display:block; float:left; width:42px; margin: 5px 0 0 5px; line-height:24px; text-align:center; _display:inline;} -.laydate_body .laydate_choose{display:block; float:left; position:relative; width:20px; height:24px;} -.laydate_body .laydate_choose cite, .laydate_body .laydate_tab cite{left:50%; top:50%;} -.laydate_body .laydate_chtop cite{margin:-7px 0 0 -5px; border-bottom-style:solid;} -.laydate_body .laydate_chdown cite, .laydate_body .laydate_ym label{top:50%; margin:-2px 0 0 -5px; border-top-style:solid;} -.laydate_body .laydate_chprev cite{margin:-5px 0 0 -7px;} -.laydate_body .laydate_chnext cite{margin:-5px 0 0 -2px;} -.laydate_body .laydate_ym label{right:28px;} -.laydate_body .laydate_table{ width:230px; margin:0 5px; border-collapse:collapse; border-spacing:0px; } -.laydate_body .laydate_table td{width:31px; height:19px; line-height:19px; text-align: center; cursor:pointer; font-size: 12px;} -.laydate_body .laydate_table thead{height:22px; line-height:22px;} -.laydate_body .laydate_table thead th{font-weight:400; font-size:12px; text-align:center;} -.laydate_body .laydate_bottom{position:relative; height:22px; line-height:20px; padding:5px; font-size:12px;} -.laydate_body .laydate_bottom #laydate_hms{position: relative; z-index: 1; float:left; } -.laydate_body .laydate_time{ position:absolute; left:5px; bottom: 26px; width:129px; height:125px; *overflow:hidden;} -.laydate_body .laydate_time .laydate_hmsno{ padding:5px 0 0 5px;} -.laydate_body .laydate_time .laydate_hmsno span{display:block; float:left; width:24px; height:19px; line-height:19px; text-align:center; cursor:pointer; *margin-bottom:-5px;} -.laydate_body .laydate_time1{width:228px; height:154px;} -.laydate_body .laydate_time1 .laydate_hmsno{padding: 6px 0 0 8px;} -.laydate_body .laydate_time1 .laydate_hmsno span{width:21px; height:20px; line-height:20px;} -.laydate_body .laydate_msg{left:49px; bottom:67px; width:141px; height:auto; overflow: hidden;} -.laydate_body .laydate_msg p{padding:5px 10px;} -.laydate_body .laydate_bottom li{float:left; height:20px; line-height:20px; border-right:none; font-weight:900;} -.laydate_body .laydate_bottom .laydate_sj{width:33px; text-align:center; font-weight:400;} -.laydate_body .laydate_bottom input{float:left; width:21px; height:20px; line-height:20px; border:none; text-align:center; cursor:pointer; font-size:12px; font-weight:400;} -.laydate_body .laydate_bottom .laydte_hsmtex{height:20px; line-height:20px; text-align:center;} -.laydate_body .laydate_bottom .laydte_hsmtex span{position:absolute; width:20px; top:0; right:0px; cursor:pointer;} -.laydate_body .laydate_bottom .laydte_hsmtex span:hover{font-size:14px;} -.laydate_body .laydate_bottom .laydate_btn{position:absolute; right:5px; top:5px;} -.laydate_body .laydate_bottom .laydate_btn a{float:left; height:20px; padding:0 6px; _padding:0 5px;} -.laydate_body .laydate_bottom .laydate_v{position:absolute; left:10px; top:6px; font-family:Courier; z-index:0;} - diff --git a/skins/dahong/icon.png b/skins/dahong/icon.png deleted file mode 100644 index dfd870d912ff6b866507502dd9d792cab31f74e2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 307 zcmeAS@N?(olHy`uVBq!ia0vp^l0YoL!3HEBKfAITNU;<C#5R5WfrBD=NDxcD>w(67H)lP22|JW>Eak-(VM(S^Vo;^ji(&ms;-*o zb7dQYw1nNX4F(1YZHlT7rdcSLc^7z2;wrG5#yWjb^rIe?&xMR)bBrtw$Y*vWdg*YO zoeutU(07ySi?%~LO1Fec^phWJCl-n={Gnp$w_#_@+o$!fj&U+G7dpC3RNe5y;k)L= tX#&FPKYp<2E=*f@Jd4w`$l8v9;r(SRzg+)xCZMwzJYD@<);T3K0RUb8XyE_= diff --git a/skins/dahong/laydate.css b/skins/dahong/laydate.css deleted file mode 100644 index 82047c7..0000000 --- a/skins/dahong/laydate.css +++ /dev/null @@ -1,58 +0,0 @@ -/** - - @Name: laydate皮肤:大红 - @Author:贤心 - @Site:http://sentsin.com/layui/laydate - -**/ - -.laydate-icon{border:1px solid #ccc; background-image:url(icon.png)} - -.laydate_body .laydate_bottom #laydate_hms, -.laydate_body .laydate_time{border:1px solid #ccc;} - -.laydate_body .laydate_box, -.laydate_body .laydate_time{box-shadow: 2px 2px 5px rgba(0,0,0,.1);} - -.laydate_body .laydate_box{border-top:none; border-bottom:none; background-color:#fff; color:#333;} -.laydate_body .laydate_box input{background:none!important; color:#fff;} -.laydate_body .laydate_box .laydate_void{color:#ccc!important;} -.laydate_body .laydate_box a, .laydate_body .laydate_box a:hover{color:#333;} -.laydate_body .laydate_box a:hover{color:#666;} -.laydate_body .laydate_click{background-color:#F32043!important; color:#fff!important;} -.laydate_body .laydate_top{border-top:1px solid #D91600; background-color:#D91600} -.laydate_body .laydate_ym{border:1px solid #D91600; background-color:#D91600;} -.laydate_body .laydate_ym .laydate_yms{border:1px solid #D91600; background-color:#D91600; color:#fff;} -.laydate_body .laydate_y .laydate_yms a{border-bottom:1px solid #D91600;} -.laydate_body .laydate_y .laydate_yms .laydate_chdown{border-top:1px solid #D91600; border-bottom:none;} -.laydate_body .laydate_choose{border-left:1px solid #D91600;} -.laydate_body .laydate_chprev{border-left:none; border-right:1px solid #D91600;} -.laydate_body .laydate_choose:hover, -.laydate_body .laydate_y .laydate_yms a:hover{background-color:#F54766;} -.laydate_body .laydate_chtop cite{border-bottom-color:#fff;} -.laydate_body .laydate_chdown cite, .laydate_body .laydate_ym label{border-top-color:#fff;} -.laydate_body .laydate_chprev cite{border-right-style:solid; border-right-color:#fff;} -.laydate_body .laydate_chnext cite{border-left-style:solid; border-left-color:#fff;} -.laydate_body .laydate_table{width: 240px!important; margin: 0!important; border:1px solid #ccc; border-top:none; border-bottom:none;} -.laydate_body .laydate_table td{border:none; height:21px!important; line-height:21px!important; background-color:#fff; color:#333;} -.laydate_body .laydate_table .laydate_nothis{color:#999;} -.laydate_body .laydate_table thead{border-bottom:1px solid #ccc; height:21px!important; line-height:21px!important;} -.laydate_body .laydate_table thead th{} -.laydate_body .laydate_bottom{border:1px solid #ccc; border-top:none;} -.laydate_body .laydate_bottom #laydate_hms{background-color:#fff;} -.laydate_body .laydate_time{background-color:#fff;} -.laydate_body .laydate_time1{width: 226px!important; height: 152px!important;} -.laydate_body .laydate_bottom .laydate_sj{width:31px!important; border-right:1px solid #ccc; background-color:#fff;} -.laydate_body .laydate_bottom input{background-color:#fff; color:#333;} -.laydate_body .laydate_bottom .laydte_hsmtex{border-bottom:1px solid #ccc;} -.laydate_body .laydate_bottom .laydate_btn{border-right:1px solid #ccc;} -.laydate_body .laydate_bottom .laydate_v{color:#999} -.laydate_body .laydate_bottom .laydate_btn a{border: 1px solid #ccc; border-right:none; background-color:#fff;} -.laydate_body .laydate_bottom .laydate_btn a:hover{background-color:#F6F6F6; color:#333;} - -.laydate_body .laydate_m .laydate_yms span:hover, -.laydate_body .laydate_time .laydate_hmsno span:hover, -.laydate_body .laydate_y .laydate_yms ul li:hover, -.laydate_body .laydate_table td:hover{background-color:#F54766; color:#fff;} - - diff --git a/skins/danlan/icon.png b/skins/danlan/icon.png deleted file mode 100644 index 1d75693d5416ed05e40342d8977428cbd402f46d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 328 zcmeAS@N?(olHy`uVBq!ia0vp^l0YoL!3HEBKfAITNU;<KmG59{tw8!GBhiENM#)dzGVcPKmG59{twCv{ftOs zW4N;Q)!OTY3>;>=*3S97Q-7&|V4&B^*_(MTPLEp{EO2-FMERq>C$<(UCH;z0ntPpj zuhw;+PCLge`!D{>6<6ENoV!-|k>yvlBgwa_tr*1kXQoW_{Rng%1B0ilpUXO@geCxM C4sr(o diff --git a/skins/default/laydate.css b/skins/default/laydate.css deleted file mode 100644 index 39bdadd..0000000 --- a/skins/default/laydate.css +++ /dev/null @@ -1,68 +0,0 @@ -/** - - @Name: laydate皮肤:默认 - @Author:贤心 - @Site:http://sentsin.com/layui/laydate - -**/ - -.laydate-icon{border:1px solid #C6C6C6; background-image:url(icon.png)} - -.laydate_body .laydate_box, -.laydate_body .laydate_ym, -.laydate_body .laydate_ym .laydate_yms, -.laydate_body .laydate_table, -.laydate_body .laydate_table td, -.laydate_body .laydate_bottom #laydate_hms, -.laydate_body .laydate_time, -.laydate_body .laydate_bottom .laydate_btn a{border:1px solid #ccc;} - -.laydate_body .laydate_y .laydate_yms a, -.laydate_body .laydate_choose, -.laydate_body .laydate_table thead, -.laydate_body .laydate_bottom .laydte_hsmtex{background-color:#F6F6F6;} - -.laydate_body .laydate_box, -.laydate_body .laydate_ym .laydate_yms, -.laydate_body .laydate_time{box-shadow: 2px 2px 5px rgba(0,0,0,.1);} - -.laydate_body .laydate_box{border-top:none; border-bottom:none; background-color:#fff; color:#333;} -.laydate_body .laydate_box input{color:#333;} -.laydate_body .laydate_box .laydate_void{color:#ccc!important; /*text-decoration:line-through;*/} -.laydate_body .laydate_box .laydate_void:hover{background-color:#fff!important} -.laydate_body .laydate_box a, .laydate_body .laydate_box a:hover{color:#333;} -.laydate_body .laydate_box a:hover{color:#666;} -.laydate_body .laydate_click{background-color:#eee!important;} -.laydate_body .laydate_top{border-top:1px solid #C6C6C6;} -.laydate_body .laydate_ym .laydate_yms{border:1px solid #C6C6C6; background-color:#fff;} -.laydate_body .laydate_y .laydate_yms a{border-bottom:1px solid #C6C6C6;} -.laydate_body .laydate_y .laydate_yms .laydate_chdown{border-top:1px solid #C6C6C6; border-bottom:none;} -.laydate_body .laydate_choose{border-left:1px solid #C6C6C6;} -.laydate_body .laydate_chprev{border-left:none; border-right:1px solid #C6C6C6;} -.laydate_body .laydate_choose:hover, -.laydate_body .laydate_y .laydate_yms a:hover{background-color:#fff;} -.laydate_body .laydate_chtop cite{border-bottom-color:#666;} -.laydate_body .laydate_chdown cite, .laydate_body .laydate_ym label{border-top-color:#666;} -.laydate_body .laydate_chprev cite{border-right-style:solid; border-right-color:#666;} -.laydate_body .laydate_chnext cite{border-left-style:solid; border-left-color:#666;} -.laydate_body .laydate_table td{border:none; height:21px!important; line-height:21px!important; background-color:#fff;} -.laydate_body .laydate_table .laydate_nothis{color:#999;} -.laydate_body .laydate_table thead{height:21px!important; line-height:21px!important;} -.laydate_body .laydate_table thead th{border-bottom:1px solid #ccc;} -.laydate_body .laydate_bottom{border-bottom:1px solid #C6C6C6;} -.laydate_body .laydate_bottom #laydate_hms{background-color:#fff;} -.laydate_body .laydate_time{background-color:#fff;} -.laydate_body .laydate_bottom .laydate_sj{border-right:1px solid #C6C6C6; background-color:#F6F6F6;} -.laydate_body .laydate_bottom input{background-color:#fff;} -.laydate_body .laydate_bottom .laydte_hsmtex{border-bottom:1px solid #C6C6C6;} -.laydate_body .laydate_bottom .laydate_btn{border-right:1px solid #C6C6C6;} -.laydate_body .laydate_bottom .laydate_v{color:#999} -.laydate_body .laydate_bottom .laydate_btn a{border-right:none; background-color:#F6F6F6;} -.laydate_body .laydate_bottom .laydate_btn a:hover{color:#000; background-color:#fff;} - -.laydate_body .laydate_m .laydate_yms span:hover, -.laydate_body .laydate_y .laydate_yms ul li:hover, -.laydate_body .laydate_table td:hover, -.laydate_body .laydate_time .laydate_hmsno span:hover{background-color:#F3F3F3} - - diff --git a/skins/molv/icon.png b/skins/molv/icon.png deleted file mode 100644 index 948660fb555db0e80cb75d6c0e65bb2a73a07145..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 309 zcmeAS@N?(olHy`uVBq!ia0vp^l0YoL!3HEBKfAITNU;<KzsG`@?#WBR9_wMA~yayC`SQV23vceXm zv1BA(p3Ws=_bmSD5{(;zF)7LC_OR~eS#s*p^KA=`)~hsa+|{Q3;lVATSC6&6oUh_$ z=y-o3FXkDegFu#0Udh%rv%9vZCw;oGzQil&TdGL^r-^U4oL7AbDD1xY_KwzdpUys& vjq)}-UjDRtb@EM)>dCV!^S$zXs{6%@Lpy!+E>5-qI*h^7)z4*}Q$iB}YEyI8 diff --git a/skins/molv/laydate.css b/skins/molv/laydate.css deleted file mode 100644 index 8877b21..0000000 --- a/skins/molv/laydate.css +++ /dev/null @@ -1,59 +0,0 @@ -/** - - @Name: laydate皮肤:墨绿 - @Author:贤心 - @Site:http://sentsin.com/layui/laydate - -**/ - -.laydate-icon{border:1px solid #ccc; background-image:url(icon.png)} - -.laydate_body .laydate_bottom #laydate_hms, -.laydate_body .laydate_time{border:1px solid #ccc;} - -.laydate_body .laydate_box, -.laydate_body .laydate_ym .laydate_yms, -.laydate_body .laydate_time{box-shadow: 2px 2px 5px rgba(0,0,0,.1);} - -.laydate_body .laydate_box{border-top:none; border-bottom:none; background-color:#fff; color:#00625A;} -.laydate_body .laydate_box input{background:none!important; color:#fff;} -.laydate_body .laydate_box .laydate_void{color:#00E8D7!important;} -.laydate_body .laydate_box a, .laydate_body .laydate_box a:hover{color:#00625A;} -.laydate_body .laydate_box a:hover{color:#666;} -.laydate_body .laydate_click{background-color:#009F95!important; color:#fff!important;} -.laydate_body .laydate_top{border-top:1px solid #009F95; background-color:#009F95} -.laydate_body .laydate_ym{border:1px solid #009F95; background-color:#009F95;} -.laydate_body .laydate_ym .laydate_yms{border:1px solid #009F95; background-color:#009F95; color:#fff;} -.laydate_body .laydate_y .laydate_yms a{border-bottom:1px solid #009F95;} -.laydate_body .laydate_y .laydate_yms .laydate_chdown{border-top:1px solid #009F95; border-bottom:none;} -.laydate_body .laydate_choose{border-left:1px solid #009F95;} -.laydate_body .laydate_chprev{border-left:none; border-right:1px solid #009F95;} -.laydate_body .laydate_choose:hover, -.laydate_body .laydate_y .laydate_yms a:hover{background-color:#00C1B3;} -.laydate_body .laydate_chtop cite{border-bottom-color:#fff;} -.laydate_body .laydate_chdown cite, .laydate_body .laydate_ym label{border-top-color:#fff;} -.laydate_body .laydate_chprev cite{border-right-style:solid; border-right-color:#fff;} -.laydate_body .laydate_chnext cite{border-left-style:solid; border-left-color:#fff;} -.laydate_body .laydate_table{width: 240px!important; margin: 0!important; border:1px solid #ccc; border-top:none; border-bottom:none;} -.laydate_body .laydate_table td{border:none; height:21px!important; line-height:21px!important; background-color:#fff; color:#00625A;} -.laydate_body .laydate_table .laydate_nothis{color:#999;} -.laydate_body .laydate_table thead{border-bottom:1px solid #ccc; height:21px!important; line-height:21px!important;} -.laydate_body .laydate_table thead th{} -.laydate_body .laydate_bottom{border:1px solid #ccc; border-top:none;} -.laydate_body .laydate_bottom #laydate_hms{background-color:#fff;} -.laydate_body .laydate_time{background-color:#fff;} -.laydate_body .laydate_time1{width: 226px!important; height: 152px!important;} -.laydate_body .laydate_bottom .laydate_sj{width:31px!important; border-right:1px solid #ccc; background-color:#fff;} -.laydate_body .laydate_bottom input{background-color:#fff; color:#00625A;} -.laydate_body .laydate_bottom .laydte_hsmtex{border-bottom:1px solid #ccc;} -.laydate_body .laydate_bottom .laydate_btn{border-right:1px solid #ccc;} -.laydate_body .laydate_bottom .laydate_v{color:#999} -.laydate_body .laydate_bottom .laydate_btn a{border: 1px solid #ccc; border-right:none; background-color:#fff;} -.laydate_body .laydate_bottom .laydate_btn a:hover{background-color:#F6F6F6; color:#00625A;} - -.laydate_body .laydate_m .laydate_yms span:hover, -.laydate_body .laydate_time .laydate_hmsno span:hover, -.laydate_body .laydate_y .laydate_yms ul li:hover, -.laydate_body .laydate_table td:hover{background-color:#00C1B3; color:#fff;} - - diff --git a/skins/qianhuang/icon.png b/skins/qianhuang/icon.png deleted file mode 100644 index 598d52bb1806bd36f48b27b1e81224fe9839ef13..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 328 zcmeAS@N?(olHy`uVBq!ia0vp^l0YoL!3HEBKfAITNU;<KmG59{twKmG59{twCv{ftOs zW4N;Q)!OTY3>;>=*3S97Q-7&|V4&B^*_(MTPLEp{EO2-FMERq>C$<(UCH;z0ntPpj zuhw;+PCLge`!D{>6<6ENoV!-|k>yvlBgwa_tr*1kXQoW_{Rng%1B0ilpUXO@geCxM C4sr(o diff --git a/skins/yahui/laydate.css b/skins/yahui/laydate.css deleted file mode 100644 index 7e95356..0000000 --- a/skins/yahui/laydate.css +++ /dev/null @@ -1,68 +0,0 @@ -/** - - @Name: laydate皮肤:雅灰 - @Author:贤心 - @Site:http://sentsin.com/layui/laydate - -**/ - -.laydate-icon{border:1px solid #C6C6C6; background-image:url(icon.png)} - -.laydate_body .laydate_box, -.laydate_body .laydate_ym, -.laydate_body .laydate_ym .laydate_yms, -.laydate_body .laydate_table, -.laydate_body .laydate_table td, -.laydate_body .laydate_bottom #laydate_hms, -.laydate_body .laydate_time, -.laydate_body .laydate_bottom .laydate_btn a{border:1px solid #C6C6C6;} - -.laydate_body .laydate_y .laydate_yms a, -.laydate_body .laydate_choose, -.laydate_body .laydate_table thead, -.laydate_body .laydate_bottom .laydte_hsmtex{background-color:#F0F0F0;} - -.laydate_body .laydate_box, -.laydate_body .laydate_ym .laydate_yms, -.laydate_body .laydate_time{box-shadow: 2px 2px 5px rgba(0,0,0,.1);} - -.laydate_body .laydate_box{border-top:none; border-bottom:none; background-color:#fff; color:#333;} -.laydate_body .laydate_box input{color:#333;} -.laydate_body .laydate_box .laydate_void{color:#ccc!important; /*text-decoration:line-through;*/} -.laydate_body .laydate_box .laydate_void:hover{background-color:#fff!important} -.laydate_body .laydate_box a, .laydate_body .laydate_box a:hover{color:#333;} -.laydate_body .laydate_box a:hover{color:#666;} -.laydate_body .laydate_click{background-color:#E9E9E9!important;} -.laydate_body .laydate_top{border-top:1px solid #C6C6C6;} -.laydate_body .laydate_ym .laydate_yms{border:1px solid #C6C6C6; background-color:#fff;} -.laydate_body .laydate_y .laydate_yms a{border-bottom:1px solid #C6C6C6;} -.laydate_body .laydate_y .laydate_yms .laydate_chdown{border-top:1px solid #C6C6C6; border-bottom:none;} -.laydate_body .laydate_y .laydate_yms ul li:hover{background-color:#F1F1F1; color:#000;} -.laydate_body .laydate_m .laydate_yms span:hover{background-color:#F1F1F1; color:#000;} -.laydate_body .laydate_choose{border-left:1px solid #C6C6C6;} -.laydate_body .laydate_chprev{border-left:none; border-right:1px solid #C6C6C6;} -.laydate_body .laydate_choose:hover, -.laydate_body .laydate_y .laydate_yms a:hover{background-color:#F6F6F6;} -.laydate_body .laydate_chtop cite{border-bottom-color:#666;} -.laydate_body .laydate_chdown cite, .laydate_body .laydate_ym label{border-top-color:#666;} -.laydate_body .laydate_chprev cite{border-right-style:solid; border-right-color:#666;} -.laydate_body .laydate_chnext cite{border-left-style:solid; border-left-color:#666;} -.laydate_body .laydate_table td{border:1px solid #C6C6C6; color:#333;} -.laydate_body .laydate_table .laydate_nothis{color:#999;} -.laydate_body .laydate_table thead{ background-color:#E3E3E3; color:#000;} -.laydate_body .laydate_table thead th{} -.laydate_body .laydate_bottom{border-bottom:1px solid #C6C6C6;} -.laydate_body .laydate_bottom #laydate_hms{background-color:#fff;} -.laydate_body .laydate_time{background-color:#fff;} -.laydate_body .laydate_bottom .laydate_sj{border-right:1px solid #C6C6C6; background-color:#F3F3F3;} -.laydate_body .laydate_bottom input{background-color:#fff;} -.laydate_body .laydate_bottom .laydte_hsmtex{border-bottom:1px solid #C6C6C6;} -.laydate_body .laydate_bottom .laydate_btn{border-right:1px solid #C6C6C6;} -.laydate_body .laydate_bottom .laydate_v{color:#999} -.laydate_body .laydate_bottom .laydate_btn a{border-right:none; background-color:#F0F0F0;} -.laydate_body .laydate_bottom .laydate_btn a:hover{color:#000; background-color:#fff;} - -.laydate_body .laydate_table td:hover, -.laydate_body .laydate_bottom .laydate_time span:hover{background-color:#F2F2F2} - - diff --git a/skins/yalan/icon.png b/skins/yalan/icon.png deleted file mode 100644 index 659ad7107bfe7d3451f69481559f82cb2c37cc4a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 324 zcmeAS@N?(olHy`uVBq!ia0vp^l0YoL!3HEBKfAITNU;<C#5R5WfrBD=NDxcD>w(67H)lP22?l4)5S5wqWA9Py@Cx2JgtkLtF2iu zwRlJCV~f^viBGvM>^{2r&|!%Q`%hgzz%6d)q363lDVkqZD|w!&IR99xXTo*p_ot`(A1NKl zy|Y2`;%%XidjvFA#~7+=HQlKDFyGBNs9MN6+I-2gE8P>MF3VkFbwAmk(A>EG4$z$p Mp00i_>zopr05{@#QUCw| diff --git a/skins/yalan/laydate.css b/skins/yalan/laydate.css deleted file mode 100644 index 6b31c81..0000000 --- a/skins/yalan/laydate.css +++ /dev/null @@ -1,58 +0,0 @@ -/** - - @Name: laydate皮肤:雅兰 - @Author:贤心 - @Site:http://sentsin.com/layui/laydate - -**/ - -.laydate-icon{border:1px solid #34AADC; background-image:url(icon.png)} - -.laydate_body .laydate_box, -.laydate_body .laydate_table, -.laydate_body .laydate_table td, -.laydate_body .laydate_bottom #laydate_hms, -.laydate_body .laydate_time, -.laydate_body .laydate_bottom .laydate_btn a{border:1px solid #34AADC;} - -.laydate_body .laydate_box{box-shadow: 2px 2px 5px rgba(0,0,0,.1);} - -.laydate_body .laydate_box{background-color:#34AADC!important; color:#fff;} -.laydate_body .laydate_box input{background:none!important; color:#fff;} -.laydate_body .laydate_box .laydate_void{color:#fff!important; background:none!important;} -.laydate_body .laydate_box a, .laydate_body .laydate_box a:hover{color:#333;} -.laydate_body .laydate_box a:hover{color:#666;} -.laydate_body .laydate_click{background-color:#67BFE4!important; color:#fff!important;} -.laydate_body .laydate_top{} -.laydate_body .laydate_ym{background-color:#50B5E0; border:1px solid #50B5E0;} -.laydate_body .laydate_ym .laydate_yms{border:1px solid #2293C4; background-color:#2293C4;} -.laydate_body .laydate_y .laydate_yms a{border-bottom:1px solid #50B5E0; background-color:#50B5E0;} -.laydate_body .laydate_y .laydate_yms .laydate_chdown{border-top:1px solid #50B5E0; border-bottom:none;} -.laydate_body .laydate_choose{} -.laydate_body .laydate_chprev{border-left:none; border-right:1px solid #50B5E0;} -.laydate_body .laydate_choose:hover, -.laydate_body .laydate_y .laydate_yms a:hover{background-color:#61BBE2;} -.laydate_body .laydate_chtop cite{border-bottom-color:#C7E8F5;} -.laydate_body .laydate_chdown cite, .laydate_body .laydate_ym label{border-top-color:#C7E8F5;} -.laydate_body .laydate_chprev cite{border-right-style:solid; border-right-color:#C7E8F5;} -.laydate_body .laydate_chnext cite{border-left-style:solid; border-left-color:#C7E8F5;} -.laydate_body .laydate_table td{border:none; height:21px!important; line-height:21px!important; background-color:#50B5E0; color:#fff;} -.laydate_body .laydate_table .laydate_nothis{background:none;} -.laydate_body .laydate_table thead{height:21px!important; line-height:21px!important;} -.laydate_body .laydate_table thead th{} -.laydate_body .laydate_bottom{border-bottom:1px solid #34AADC; color:#fff;} -.laydate_body .laydate_bottom #laydate_hms{background-color:#50B5E0;} -.laydate_body .laydate_time{background-color:#2293C4;} -.laydate_body .laydate_bottom .laydate_sj{border-right:1px solid #50B5E0; background-color:#50B5E0; color:#fff;} -.laydate_body .laydate_bottom .laydte_hsmtex{border-bottom:1px solid #67BFE4; background-color:#2293C4;} -.laydate_body .laydate_bottom .laydate_btn{border-right:1px solid #34AADC;} -.laydate_body .laydate_bottom .laydate_v{color:#ccc} -.laydate_body .laydate_bottom .laydate_btn a{border-right:none; background-color:#50B5E0; color:#fff;} -.laydate_body .laydate_bottom .laydate_btn a:hover{background-color:#6BC0E4;} - -.laydate_body .laydate_m .laydate_yms span:hover, -.laydate_body .laydate_y .laydate_yms ul li:hover, -.laydate_body .laydate_table td:hover, -.laydate_body .laydate_time .laydate_hmsno span:hover{background-color:#87CBE9; color:#fff;} - - diff --git a/test/demo1.html b/test/demo1.html deleted file mode 100644 index 4fdc3be..0000000 --- a/test/demo1.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Demo1 - - - - -
        -
        - 方本框: -
        - -
        - 按钮触发: -
        - - -
        - -
        - -
        - 直接传dom: -
        - - - - - - \ No newline at end of file diff --git a/test/demo2.html b/test/demo2.html deleted file mode 100644 index f23889a..0000000 --- a/test/demo2.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Demo2 for Seajs - - -
        - - - - - - - - - \ No newline at end of file diff --git a/test/demo2.js b/test/demo2.js deleted file mode 100644 index 216b946..0000000 --- a/test/demo2.js +++ /dev/null @@ -1,7 +0,0 @@ -define(function(){ - 'use strict'; - - laydate({ - elem: '#J-xl' - }); -}); \ No newline at end of file From e5fd7df565bdc744ef9d900900fe45175382a9e8 Mon Sep 17 00:00:00 2001 From: sentsin Date: Mon, 21 Aug 2017 06:18:14 +0800 Subject: [PATCH 02/26] 5.0.0 --- CHANGELOG.md | 18 + LICENSE | 21 + README.md | 6 + dist/laydate.js | 2 + dist/theme/default/font/iconfont.eot | Bin 0 -> 2456 bytes dist/theme/default/font/iconfont.svg | 45 + dist/theme/default/font/iconfont.ttf | Bin 0 -> 2272 bytes dist/theme/default/font/iconfont.woff | Bin 0 -> 1492 bytes dist/theme/default/laydate.css | 2 + gulpfile.js | 52 + package.json | 25 + src/laydate.js | 1815 +++++++++++++++++++++++++ src/theme/default/font/iconfont.eot | Bin 0 -> 2456 bytes src/theme/default/font/iconfont.svg | 45 + src/theme/default/font/iconfont.ttf | Bin 0 -> 2272 bytes src/theme/default/font/iconfont.woff | Bin 0 -> 1492 bytes src/theme/default/laydate.css | 169 +++ test/test.url | 6 + 18 files changed, 2206 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 dist/laydate.js create mode 100644 dist/theme/default/font/iconfont.eot create mode 100644 dist/theme/default/font/iconfont.svg create mode 100644 dist/theme/default/font/iconfont.ttf create mode 100644 dist/theme/default/font/iconfont.woff create mode 100644 dist/theme/default/laydate.css create mode 100644 gulpfile.js create mode 100644 package.json create mode 100644 src/laydate.js create mode 100644 src/theme/default/font/iconfont.eot create mode 100644 src/theme/default/font/iconfont.svg create mode 100644 src/theme/default/font/iconfont.ttf create mode 100644 src/theme/default/font/iconfont.woff create mode 100644 src/theme/default/laydate.css create mode 100644 test/test.url diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2391656 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,18 @@ + +# v5.0.0 + +* 全新重写 +* 支持单独显示年选择器、年月选择器、日期选择器、时间选择器、日期时间选择器 +* 支持双控件,用于选择年/年月/日期/时间/日期时间五种类型选择器的范围(可顺时、逆时) +* 支持日期格式的自定义 +* 支持日期是否合法的自动校验 +* 支持有效日期范围的设定 +* 支持内置事件(可自定义)、外部事件、直接显示等多种调用方式 +* 支持中文版和国际版的语言设定 +* 支持开启公历节日和标记重要日期 +* 支持直接嵌套在页面的某个容器中 +* 支持底部按钮的任意顺序排版 +* 支持智能显示在最佳可视坐标 +* 支持回车快捷键选择 +* 支持多种内置主题的设定,支持自定义主题色,且可单独定制主题 + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..be179b1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 layui + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c460c7e --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ + +## 概要 +全面重写的 layDate 包含了大量的更新,其中主要以:年选择器、年月选择器、日期选择器、时间选择器、日期时间选择器 五种类型的选择方式为基本核心,并且均支持范围选择(即双控件)。内置强劲的自定义日期格式解析和合法校正机制,含中文版和国际版,主题简约却又不失灵活多样。由于内部采用的是零依赖的原生 JavaScript 编写,因此又可作为独立组件使用。毫无疑问,这是 layui 的虔心之作。 + +## 相关 +[示例与文档](http://www.layui.com/laydate/)、[社区](http://fly.layui.com) \ No newline at end of file diff --git a/dist/laydate.js b/dist/laydate.js new file mode 100644 index 0000000..229c7e8 --- /dev/null +++ b/dist/laydate.js @@ -0,0 +1,2 @@ +/*! laydate-v5.0.0 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ + ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",y="laydate-day-prev",h="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(t.dateTime)},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):"object"==typeof l?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,y=e?1:0,h=T(r.table[y]).find("td"),f=T(r.elemHeader[y][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(h,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e"+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(h&&y.removeChild(h),y.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),H=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},k=T(m[2]).find("."+g);H(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),k[0]&&k.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),H(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(y)||T(i).hasClass(h)?m:o),s>e&&svs$|eAFngtr$Wyy=ZNkcq#`CiW=yMTg}p(M>y3Vn%m zT0=85NqNe_K&9ParfANzDS`>mIG7^M!b;d^G(<5Pgy#R|fm%3GM-`H3aL1lkwq7*8 z{2kH7GEPDBGK8+RJ(tFakU{6_h{*~g4v5Pqb-F?@t^s_12Lgng&6~A1e z3JmP%#Zof%S=^U4h$0%1m;IKCGxnG?STVXEcSH%^K^q{u@e>JMuFBPknuxtzm8$zq z1Oa1&h1eI7_%cRe1r`xLrt853cuZ~()tf7i+3SmaFWU_+R#M1XEYI$`nb8%+1%2k z%F*snawCO^Y1T}o3RKAecOC@#gvD!21fo$=vlOp5Z_#3pGY#{*&J)>UnL{5>JR ze44$%X!~2n^U~+s+|eEKZCYdO?BCoJ*BaeN>;3*#zyG9LaXQ_Sib#Q%av~6r(gSN__d^eE`_q2GJD-~{BrK#sPuWVb1|M9j!qrcU)qQM<( zYv^9x#7FPc1sm(bk)IK&$jaKE(p|a1%&c`DjxvWv_>^&Ygm+2THyX3X>_#@f1xxIr z9$v@Noe|?OpBgbPF0sQd*RIJ|@wWS@gEXQ>9*zf^TpkWIDP03R^q|a}`MfV0R*kcq z^0h~Ny)s{b?1QYU;i%ecyulT|00_$XM40ySiH8Ugi&*=H{FU5CE2xvYh&-%xMG^=q zk{FJ6@DO+2PjvH;e91_uk+919jW5(tM2+%M<8345i-c6(2P!NmF7ul(3q^dqk0*pK zYP|Ol0T29i%Y4s;H_d3)>%z#^W*bZ7f^QZtgYUJm12|!0Co0Ak8!O;nu(6l=Xs?ay zkeeqEF*{Hh=}G#~#*BjWjg2J~vL9?LgTHHI2k<{Oc2WQ}!J0>*AotnWOXIxF#&s0o zkGr-=?WN|6A6p!o0*_nJ!8;T7srFZB# zy|^&%?2)N>sg%~z#e7y9#R7UJlh+Ex{2_g^6q_!U3L6Fn#KMA)P3E)sG;Tvx*6kXe zLc$$HP1pXb(r!3H@9f6JrGQb)YOx+>OGYRV$O`D?%C@2H?EkwLvA2UxiS&@ + + + + +Created by iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dist/theme/default/font/iconfont.ttf b/dist/theme/default/font/iconfont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0bd6c4a88dd899aea3926e49bdfb37e81004bcb9 GIT binary patch literal 2272 zcmc&#TWl0n82KNt^83(# zg?zD)t!0$i8_?xTMAC*uJ(*TNe&s#beh-;i1mU_VzX^O9vU)LBsrLK~M0_1xFk46^ zr3uc!{~UBRm#h}Kn+{?=2wlr3bNaq(&fP>#o6Yvf-j z&hVAUDTBRF+nsqbOr{uCUA;&pW1q#?Do{l=BIcMi#aY`Y16FvCVMLYS z9kda;8<(iP+K?ObO;LNbAvF$|2nu|Jh1eH{oeVEzU{T>iYW5a9r0gwe+fBU7X2iZ% zZNU;7*i#{5ZyR_XLd0`v9I!+@w#K|A_6a;nZ_`Kg9fx3vXw4tw%W{x9X@n+eJK-H+ zWt4|hDa?b>L`)jx?m=gFPnRl3hogh8;h~uP1osRnU4i&iBGRL{6d$YH&yNkpr=l?_ z%IgxFrA-_UgqeF+_3ibq3HjwS>+8Ne@Q5_P?Y+^yUHdz*hM|Oo~2vU#t}X}ZCq@z!!9?k%2)8V`)GhPqE4QQ2fADy z4s{*&X^?9Lu}5E6&L&H( zR4bm-OXa0PUYm?fw9-5Dyk5E!w|sOVUa4fXOsSC5W|2V8W(!)eR5+}sDzU{%rMPi? zTqG8JELF(i)3}XFq*IbA=+iiGhp2{riBeRcJY~$j0=q11YOt^@*Zya*2Yw5*Y|fV+ zX!RiPIe3?-jA$a8hL1&zCLS1N2dwj^$KC5K(^0G6DLx95k(XKllwJ=C6?L2PFC1OTvcj?W!%ck U%LUx7>Qb_{RMXw|I4MH>3rdt+EdT%j literal 0 HcmV?d00001 diff --git a/dist/theme/default/font/iconfont.woff b/dist/theme/default/font/iconfont.woff new file mode 100644 index 0000000000000000000000000000000000000000..bfe5599671f9441ceebdc8afeac71d4f65a741c7 GIT binary patch literal 1492 zcmY+Ec~Fx_7{)gwfRsQv0;F70?g7dvDTi_k2q?&X&U_&x2IUmw6v>BjMv!1R4M!=} zat=&T#2N_qQ9*2LQO=SDwfF%7h8S8TISJOqsY87jqJohDAyMQ=D)by+U2j;o((iXckC^DV zczE72m}3s{H1!QBN@7!xFa+U;7E&h2NPO&;2$_!{WCke2Q%=!RR6X#c*wHpdxVQ@K za*hDVQ^UH0&wKXz%uuu#yEzG=wzb3;(!RdM}$9bAdD=wplNTO;eyZC zaM2&yfiXjyZ6~lQXuFf+y6i;QlGYzd46q#^XH64j1zTk6hocD0jQb}8QIei?v+m!M zEs8<;=~df(i=8GaG;6EG(;}OU%e5Cb6m4jH3UrA!c?--Pi$T{%cW?w z*{9i}HN@-Md30G>345QLyekC9!Ul1&jl{R8jh&8VsBKL`7^4}hX0rIT%BTTieK%sF zs%v3xCAH4opxhz-QmdM;TIszbHRsw-;u^EBC`g8uzt30JX$z=NVUHAC6|Jm$*iu{J zUsWx()qYk+4^yD2KlIe&omj5!hY};(WhWc1V9qE-R-oRBt)nSWB%q-e;y}w&9mH-9D+eGe@vp`sKnL{YUT8p0R+=*_e&4;lmC$ zd=&ik7f4f|kb9C5tI34j7B7RQQs(WN8S@o#?8Q6FCAHgHYr?ZT9h=PJ6CH!YS-4)K zcaJxS(}NwkQ(mdkuh?(u@+Gf6YnvL_^H2LUM49?H+SMv4a`yC%;Q_-fZid)Ar^uDa zeo(e(Gn~`dQO2a{+{0&Eh*rMdbbi~Ca#cfo$4_mC_H)AKHo^Zw!0g_*6-T+*%T0tO zrh6hTL}x5Jz;!-vUswtMM9Xv~ygxQ5jZYrckbTiv!94Q3ES%6Rp}d&;SFbmcW!YHi zZQzb}&wh+K^QG?)1cW|5tgAe*HGPrFr;!2LC>%Dfy1K9BPb?clgT;k33$=l#v?%4j z{4ed-3j}P6SQwdB3~<5=M8h5?BM5S7gvaY;_zM4h8wll4 z7(xXYO_gNl76v?MZS?o+4;ntE=S8 zF&atkofJ(AjZ703tsWd|{E<1yO;4Nxr^6Kcj&!H6C-W z(`|q5eC8*5XP!ls-sGxvP{KqnbIGD*b5y}$iTwf-T_RYq+Zx=fVf9_P-1@4Bva?qzk-sa0xR#X8sMG&6E_&HiQKEtgx3 z>LtfIQt8)xnzrY;Yf+EB*DOR&shTfhb@0-ik46GN42H;azKOR$cS5Xl&6XwPzf#7( zRFpCaYtr3ymQWjRB`O~G2;TY7X;p5q+7h_!%j12);&&J2W5A7dm CyJwOB literal 0 HcmV?d00001 diff --git a/dist/theme/default/laydate.css b/dist/theme/default/laydate.css new file mode 100644 index 0000000..16001ce --- /dev/null +++ b/dist/theme/default/laydate.css @@ -0,0 +1,2 @@ +/*! laydate-v5.0.0 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..042701e --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,52 @@ +/** + layDate构建 +*/ + +var pkg = require('./package.json'); + +var gulp = require('gulp'); +var uglify = require('gulp-uglify'); +var minify = require('gulp-minify-css'); +var rename = require('gulp-rename'); +var header = require('gulp-header'); +var del = require('del'); + +var task = { + laydate: function() { + gulp.src('./src/**/*.css') + .pipe(minify({ + compatibility: 'ie7' + })) + .pipe(header('/*! <%= pkg.alias %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %> By <%= pkg.author %> */\n', {pkg: pkg})) + .pipe(gulp.dest('./dist')); + + return gulp.src('./src/laydate.js').pipe(uglify()) + .pipe(header('/*! <%= pkg.alias %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %> By <%= pkg.author %> */\n ;', {pkg: pkg})) + .pipe(gulp.dest('./dist')); + + } + ,other: function(){ + gulp.src('./src/**/font/*').pipe(rename({})) + .pipe(gulp.dest('./dist')); + } +}; + + +gulp.task('clear', function(cb){ //清理 + return del(['./dist/*'], cb); +}); +gulp.task('laydate', task.minjs); //压缩PC版本 +gulp.task('other', task.other); //移动一些配件 + +//全部 +gulp.task('default', ['clear'], function(){ + for(var key in task){ + task[key](); + } +}); + + + + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..2802422 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "layui-laydate", + "version": "5.0.0", + "alias": "laydate", + "description": "日期与时间组件", + "main": "src/laydate.js", + "license": "MIT", + "scripts": { + "run": "gulp" + }, + "repository": { + "type": "https", + "url": "https://github.com/sentsin/laydate.git" + }, + "author": "贤心", + "homepage": "http://www.layui.com/laydate/", + "devDependencies": { + "gulp": "^3.9.0", + "gulp-minify-css": "^1.2.4", + "gulp-uglify": "^1.5.4", + "gulp-rename": "^1.2.2", + "gulp-header": "^1.8.8", + "del": "^2.2.2" + } +} diff --git a/src/laydate.js b/src/laydate.js new file mode 100644 index 0000000..8ee9705 --- /dev/null +++ b/src/laydate.js @@ -0,0 +1,1815 @@ +/** + + @Name : layDate 5.0 日期时间控件 + @Author: 贤心 + @Site:http://www.layui.com/laydate/ + @License:MIT + + */ + +;!function(){ + "use strict"; + + var isLayui = window.layui && layui.define, ready = { + getPath: function(){ + var js = document.scripts, script = js[js.length - 1], jsPath = script.src; + if(script.getAttribute('merge')) return; + return jsPath.substring(0, jsPath.lastIndexOf('/') + 1); + }() + + //获取节点的style属性值 + ,getStyle: function(node, name){ + var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null); + return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name); + } + + //载入CSS配件 + ,link: function(href, fn, cssname){ + + //未设置路径,则不主动加载css + if(!laydate.path) return; + + var head = document.getElementsByTagName("head")[0], link = document.createElement('link'); + if(typeof fn === 'string') cssname = fn; + var app = (cssname || href).replace(/\.|\//g, ''); + var id = 'layuicss-'+ app, timeout = 0; + + link.rel = 'stylesheet'; + link.href = laydate.path + href; + link.id = id; + + if(!document.getElementById(id)){ + head.appendChild(link); + } + + if(typeof fn !== 'function') return; + + //轮询css是否加载完毕 + (function poll() { + if(++timeout > 8 * 1000 / 100){ + return window.console && console.error('laydate.css: Invalid'); + }; + parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100); + }()); + } + } + + ,laydate = { + v: '5.0' + ,config: {} //全局配置项 + ,index: (window.laydate && window.laydate.v) ? 100000 : 0 + ,path: ready.getPath + + //设置全局项 + ,set: function(options){ + var that = this; + that.config = ready.extend({}, that.config, options); + return that; + } + + //主体CSS等待事件 + ,ready: function(fn){ + var cssname = 'laydate', ver = '' + ,path = (isLayui ? 'modules/laydate/' : 'theme/') + 'default/laydate.css?v='+ laydate.v + ver; + isLayui ? layui.addcss(path, fn, cssname) : ready.link(path, fn, cssname); + return this; + } + } + + //操作当前实例 + ,thisDate = function(){ + var that = this; + return { + //提示框 + hint: function(content){ + that.hint.call(that, content); + } + ,config: that.config + }; + } + + //字符常量 + ,MOD_NAME = 'laydate', ELEM = '.layui-laydate', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'laydate-disabled', TIPS_OUT = '开始日期超出了结束日期
        建议重新选择', LIMIT_YEAR = [100, 200000] + + ,ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = '.laydate-btns-time' + + //组件构造器 + ,Class = function(options){ + var that = this; + that.index = ++laydate.index; + that.config = lay.extend({}, that.config, laydate.config, options); + laydate.ready(function(){ + that.init(); + }); + } + + //DOM查找 + ,lay = function(selector){ + return new LAY(selector); + } + + //DOM构造器 + ,LAY = function(selector){ + var index = 0 + ,nativeDOM = typeof selector === 'object' ? [selector] : ( + this.selector = selector + ,document.querySelectorAll(selector || null) + ); + for(; index < nativeDOM.length; index++){ + this.push(nativeDOM[index]); + } + }; + + + /* + lay对象操作 + */ + + LAY.prototype = []; + LAY.prototype.constructor = LAY; + + //普通对象深度扩展 + lay.extend = function(){ + var ai = 1, args = arguments + ,clone = function(target, obj){ + target = target || (obj.constructor === Array ? [] : {}); + for(var i in obj){ + //如果值为对象,则进入递归,继续深度合并 + target[i] = (obj[i] && (obj[i].constructor === Object)) + ? clone(target[i], obj[i]) + : obj[i]; + } + return target; + } + + args[0] = typeof args[0] === 'object' ? args[0] : {}; + + for(; ai < args.length; ai++){ + if(typeof args[ai] === 'object'){ + clone(args[0], args[ai]) + } + } + return args[0]; + }; + + //ie版本 + lay.ie = function(){ + var agent = navigator.userAgent.toLowerCase(); + return (!!window.ActiveXObject || "ActiveXObject" in window) ? ( + (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识 + ) : false; + }(); + + //中止冒泡 + lay.stope = function(e){ + e = e || win.event; + e.stopPropagation + ? e.stopPropagation() + : e.cancelBubble = true; + }; + + //对象遍历 + lay.each = function(obj, fn){ + var key + ,that = this; + if(typeof fn !== 'function') return that; + obj = obj || []; + if(obj.constructor === Object){ + for(key in obj){ + if(fn.call(obj[key], key, obj[key])) break; + } + } else { + for(key = 0; key < obj.length; key++){ + if(fn.call(obj[key], key, obj[key])) break; + } + } + return that; + }; + + //数字前置补零 + lay.digit = function(num, length, end){ + var str = ''; + num = String(num); + length = length || 2; + for(var i = num.length; i < length; i++){ + str += '0'; + } + return num < Math.pow(10, length) ? str + (num|0) : num; + }; + + //创建元素 + lay.elem = function(elemName, attr){ + var elem = document.createElement(elemName); + lay.each(attr || {}, function(key, value){ + elem.setAttribute(key, value); + }); + return elem; + }; + + //追加字符 + LAY.addStr = function(str, new_str){ + str = str.replace(/\s+/, ' '); + new_str = new_str.replace(/\s+/, ' ').split(' '); + lay.each(new_str, function(ii, item){ + if(!new RegExp('\\b'+ item + '\\b').test(str)){ + str = str + ' ' + item; + } + }); + return str.replace(/^\s|\s$/, ''); + }; + + //移除值 + LAY.removeStr = function(str, new_str){ + str = str.replace(/\s+/, ' '); + new_str = new_str.replace(/\s+/, ' ').split(' '); + lay.each(new_str, function(ii, item){ + var exp = new RegExp('\\b'+ item + '\\b') + if(exp.test(str)){ + str = str.replace(exp, ''); + } + }); + return str.replace(/\s+/, ' ').replace(/^\s|\s$/, ''); + }; + + //查找子元素 + LAY.prototype.find = function(selector){ + var that = this; + var index = 0, arr = [] + ,isObject = typeof selector === 'object'; + + this.each(function(i, item){ + var nativeDOM = isObject ? [selector] : item.querySelectorAll(selector || null); + for(; index < nativeDOM.length; index++){ + arr.push(nativeDOM[index]); + } + that.shift(); + }); + + if(!isObject){ + that.selector = (that.selector ? that.selector + ' ' : '') + selector + } + + lay.each(arr, function(i, item){ + that.push(item); + }); + + return that; + }; + + //DOM遍历 + LAY.prototype.each = function(fn){ + return lay.each.call(this, this, fn); + }; + + //添加css类 + LAY.prototype.addClass = function(className, type){ + return this.each(function(index, item){ + item.className = LAY[type ? 'removeStr' : 'addStr'](item.className, className) + }); + }; + + //移除css类 + LAY.prototype.removeClass = function(className){ + return this.addClass(className, true); + }; + + //是否包含css类 + LAY.prototype.hasClass = function(className){ + var has = false; + this.each(function(index, item){ + if(new RegExp('\\b'+ className +'\\b').test(item.className)){ + has = true; + } + }); + return has; + }; + + //添加或获取属性 + LAY.prototype.attr = function(key, value){ + var that = this; + return value === undefined ? function(){ + if(that.length > 0) return that[0].getAttribute(key); + }() : that.each(function(index, item){ + item.setAttribute(key, value); + }); + }; + + //移除属性 + LAY.prototype.removeAttr = function(key){ + return this.each(function(index, item){ + item.removeAttribute(key); + }); + }; + + //设置HTML内容 + LAY.prototype.html = function(html){ + return this.each(function(index, item){ + item.innerHTML = html; + }); + }; + + //设置值 + LAY.prototype.val = function(value){ + return this.each(function(index, item){ + item.value = value; + }); + }; + + //追加内容 + LAY.prototype.append = function(elem){ + return this.each(function(index, item){ + typeof elem === 'object' + ? item.appendChild(elem) + : item.innerHTML = item.innerHTML + elem; + }); + }; + + //移除内容 + LAY.prototype.remove = function(elem){ + return this.each(function(index, item){ + elem ? item.removeChild(elem) : item.parentNode.removeChild(item); + }); + }; + + //事件绑定 + LAY.prototype.on = function(eventName, fn){ + return this.each(function(index, item){ + item.attachEvent ? item.attachEvent('on' + eventName, function(e){ + e.target = e.srcElement; + fn.call(item, e); + }) : item.addEventListener(eventName, fn, false); + }); + }; + + //解除事件 + LAY.prototype.off = function(eventName, fn){ + return this.each(function(index, item){ + item.detachEvent + ? item.detachEvent('on'+ eventName, fn) + : item.removeEventListener(eventName, fn, false); + }); + }; + + + /* + 组件操作 + */ + + + //是否闰年 + Class.isLeapYear = function(year){ + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; + }; + + //默认配置 + Class.prototype.config = { + type: 'date' //控件类型,支持:year/month/date/time/datetime + ,range: false //是否开启范围选择,即双控件 + ,format: 'yyyy-MM-dd' //默认日期格式 + ,value: null //默认日期,支持传入new Date(),或者符合format参数设定的日期格式字符 + ,min: '1900-1-1' //有效最小日期,年月日必须用“-”分割,时分秒必须用“:”分割。注意:它并不是遵循 format 设定的格式。 + ,max: '2099-12-31' //有效最大日期,同上 + ,trigger: 'focus' //呼出控件的事件 + ,show: false //是否直接显示,如果设置true,则默认直接显示控件 + ,showBottom: true //是否显示底部栏 + ,btns: ['clear', 'now', 'confirm'] //右下角显示的按钮,会按照数组顺序排列 + ,lang: 'cn' //语言,只支持cn/en,即中文和英文 + ,theme: 'default' //主题 + ,position: null //控件定位方式定位, 默认absolute,支持:fixed/absolute/static + ,calendar: false //是否开启公历重要节日,仅支持中文版 + ,mark: {} //日期备注,如重要事件或活动标记 + ,zIndex: null //控件层叠顺序 + ,done: null //控件选择完毕后的回调,点击清空/现在/确定也均会触发 + ,change: null //日期时间改变后的回调 + }; + + //多语言 + Class.prototype.lang = function(){ + var that = this + ,options = that.config + ,text = { + cn: { + weeks: ['日', '一', '二', '三', '四', '五', '六'] + ,time: ['时', '分', '秒'] + ,timeTips: '选择时间' + ,startTime: '开始时间' + ,endTime: '结束时间' + ,dateTips: '返回日期' + ,month: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'] + ,tools: { + confirm: '确定' + ,clear: '清空' + ,now: '现在' + } + } + ,en: { + weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] + ,time: ['Hours', 'Minutes', 'Seconds'] + ,timeTips: 'Select Time' + ,startTime: 'Start Time' + ,endTime: 'End Time' + ,dateTips: 'Select Date' + ,month: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + ,tools: { + confirm: 'Confirm' + ,clear: 'Clear' + ,now: 'Now' + } + } + }; + return text[options.lang] || text['cn']; + }; + + //初始准备 + Class.prototype.init = function(){ + var that = this + ,options = that.config + ,dateType = 'yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s' + ,isStatic = options.position === 'static' + ,format = { + year: 'yyyy' + ,month: 'yyyy-MM' + ,date: 'yyyy-MM-dd' + ,time: 'HH:mm:ss' + ,datetime: 'yyyy-MM-dd HH:mm:ss' + }; + + options.elem = lay(options.elem); + options.eventElem = lay(options.eventElem); + + if(!options.elem[0]) return; + + //日期范围分隔符 + if(options.range === true) options.range = '-'; + + //根据不同type,初始化默认format + if(options.format === format.date){ + options.format = format[options.type]; + } + + //将日期格式转化成数组 + that.format = options.format.match(new RegExp(dateType + '|.', 'g')) || []; + + //生成正则表达式 + that.EXP_IF = ''; + that.EXP_SPLIT = ''; + lay.each(that.format, function(i, item){ + var EXP = new RegExp(dateType).test(item) + ? '\\b\\d{1,'+ function(){ + if(/yyyy/.test(item)) return 4; + if(/y/.test(item)) return 308; + return 2; + }() +'}\\b' + : '\\' + item; + that.EXP_IF = that.EXP_IF + EXP; + that.EXP_SPLIT = that.EXP_SPLIT + (that.EXP_SPLIT ? '|' : '') + '('+ EXP + ')'; + }); + that.EXP_IF = new RegExp('^'+ ( + options.range ? + that.EXP_IF + '\\s\\'+ options.range + '\\s' + that.EXP_IF + : that.EXP_IF + ) +'$'); + that.EXP_SPLIT = new RegExp(that.EXP_SPLIT, 'g'); + + //如果不是input|textarea元素,则默认采用click事件 + if(!that.isInput(options.elem[0])){ + if(options.trigger === 'focus'){ + options.trigger = 'click'; + } + } + + //设置唯一KEY + if(!options.elem.attr('lay-key')){ + options.elem.attr('lay-key', that.index); + options.eventElem.attr('lay-key', that.index); + } + + //记录重要日期 + options.mark = lay.extend({}, (options.calendar && options.lang === 'cn') ? { + '0-1-1': '元旦' + ,'0-2-14': '情人' + ,'0-3-8': '妇女' + ,'0-3-12': '植树' + ,'0-4-1': '愚人' + ,'0-5-1': '劳动' + ,'0-5-4': '青年' + ,'0-6-1': '儿童' + ,'0-9-10': '教师' + ,'0-9-18': '国耻' + ,'0-10-1': '国庆' + ,'0-12-25': '圣诞' + } : {}, options.mark); + + //获取限制内日期 + lay.each(['min', 'max'], function(i, item){ + var ymd = [], hms = []; + if(typeof options[item] === 'number'){ //如果为数字 + var day = options[item] + ,time = new Date().getTime() + ,STAMP = 86400000 //代表一天的时间戳 + ,thisDate = new Date( + day ? ( + day < STAMP ? time + day*STAMP : day //如果数字小于一天的时间戳,则数字为天数,否则为时间戳 + ) : time + ); + ymd = [thisDate.getFullYear(), thisDate.getMonth() + 1, thisDate.getDate()]; + day < STAMP || (hms = [thisDate.getHours(), thisDate.getMinutes(), thisDate.getSeconds()]); + } else { + ymd = (options[item].match(/\d+-\d+-\d+/) || [''])[0].split('-'); + hms = (options[item].match(/\d+:\d+:\d+/) || [''])[0].split(':'); + } + options[item] = { + year: ymd[0] | 0 || new Date().getFullYear() + ,month: ymd[1] ? (ymd[1] | 0) - 1 : new Date().getMonth() + ,date: ymd[2] | 0 || new Date().getDate() + ,hours: hms[0] | 0 + ,minutes: hms[1] | 0 + ,seconds: hms[2] | 0 + }; + }); + + that.elemID = 'layui-laydate'+ options.elem.attr('lay-key'); + + if(options.show || isStatic) that.render(); + isStatic || that.events(); + }; + + //控件主体渲染 + Class.prototype.render = function(){ + var that = this + ,options = that.config + ,lang = that.lang() + ,isStatic = options.position === 'static' + + //主面板 + ,elem = that.elem = lay.elem('div', { + id: that.elemID + ,'class': [ + 'layui-laydate' + ,options.range ? ' layui-laydate-range' : '' + ,isStatic ? ' layui-laydate-static' : '' + ,options.theme && options.theme !== 'default' && !/^#/.test(options.theme) ? (' laydate-theme-' + options.theme) : '' + ].join('') + }) + + //主区域 + ,elemMain = that.elemMain = [] + ,elemHeader = that.elemHeader = [] + ,elemCont = that.elemCont = [] + ,elemTable = that.table = [] + + //底部区域 + ,divFooter = that.footer = lay.elem('div', { + 'class': ELEM_FOOTER + }); + + if(options.zIndex) elem.style.zIndex = options.zIndex; + + //单双日历区域 + lay.each(new Array(2), function(i){ + if(!options.range && i > 0){ + return true; + } + + //头部区域 + var divHeader = lay.elem('div', { + 'class': 'layui-laydate-header' + }) + + //左右切换 + ,headerChild = [function(){ //上一年 + var elem = lay.elem('i', { + 'class': 'layui-icon laydate-icon laydate-prev-y' + }); + elem.innerHTML = ''; + return elem; + }(), function(){ //上一月 + var elem = lay.elem('i', { + 'class': 'layui-icon laydate-icon laydate-prev-m' + }); + elem.innerHTML = ''; + return elem; + }(), function(){ //年月选择 + var elem = lay.elem('div', { + 'class': 'laydate-set-ym' + }), spanY = lay.elem('span'), spanM = lay.elem('span'); + elem.appendChild(spanY); + elem.appendChild(spanM); + return elem; + }(), function(){ //下一月 + var elem = lay.elem('i', { + 'class': 'layui-icon laydate-icon laydate-next-m' + }); + elem.innerHTML = ''; + return elem; + }(), function(){ //下一年 + var elem = lay.elem('i', { + 'class': 'layui-icon laydate-icon laydate-next-y' + }); + elem.innerHTML = ''; + return elem; + }()] + + //日历内容区域 + ,divContent = lay.elem('div', { + 'class': 'layui-laydate-content' + }) + ,table = lay.elem('table') + ,thead = lay.elem('thead'), theadTr = lay.elem('tr'); + + //生成年月选择 + lay.each(headerChild, function(i, item){ + divHeader.appendChild(item); + }); + + //生成表格 + thead.appendChild(theadTr); + lay.each(new Array(6), function(i){ //表体 + var tr = table.insertRow(0); + lay.each(new Array(7), function(j){ + if(i === 0){ + var th = lay.elem('th'); + th.innerHTML = lang.weeks[j]; + theadTr.appendChild(th); + } + tr.insertCell(j); + }); + }); + table.insertBefore(thead, table.children[0]); //表头 + divContent.appendChild(table); + + elemMain[i] = lay.elem('div', { + 'class': 'layui-laydate-main laydate-main-list-'+ i + }); + + elemMain[i].appendChild(divHeader); + elemMain[i].appendChild(divContent); + + elemHeader.push(headerChild); + elemCont.push(divContent); + elemTable.push(table); + }); + + //生成底部栏 + lay(divFooter).html(function(){ + var html = [], btns = []; + if(options.type === 'datetime'){ + html.push(''+ lang.timeTips +''); + } + lay.each(options.btns, function(i, item){ + var title = lang.tools[item] || 'btn'; + if(options.range && item === 'now') return; + if(isStatic && item === 'clear') title = options.lang === 'cn' ? '重置' : 'Reset'; + btns.push(''+ title +''); + }); + html.push(''); + return html.join(''); + }()); + + //插入到主区域 + lay.each(elemMain, function(i, main){ + elem.appendChild(main); + }); + options.showBottom && elem.appendChild(divFooter); + + //生成自定义主题 + if(/^#/.test(options.theme)){ + var style = lay.elem('style') + ,styleText = [ + '#{{id}} .layui-laydate-header{background-color:{{theme}};}' + ,'#{{id}} .layui-this{background-color:{{theme}} !important;}' + ].join('').replace(/{{id}}/g, that.elemID).replace(/{{theme}}/g, options.theme); + + if('styleSheet' in style){ + style.setAttribute('type', 'text/css'); + style.styleSheet.cssText = styleText; + } else { + style.innerHTML = styleText; + } + + lay(elem).addClass('laydate-theme-molv'); + elem.appendChild(style); + } + + //移除上一个控件 + that.remove(); + + //如果是静态定位,则插入到指定的容器中,否则,插入到body + isStatic ? options.elem.append(elem) : ( + document.body.appendChild(elem) + ,that.position() //定位 + ); + + that.checkDate().calendar(); //初始校验 + that.changeEvent(); //日期切换 + + Class.thisElem = that.elemID; + + typeof options.ready === 'function' && options.ready(options.dateTime); + }; + + //控件移除 + Class.prototype.remove = function(){ + var that = this + ,options = that.config + ,elem = lay('#'+ that.elemID); + if(elem[0] && options.position !== 'static'){ + that.checkDate(function(){ + elem.remove(); + }); + } + return that; + }; + + //定位算法 + Class.prototype.position = function(){ + var that = this + ,options = that.config + ,elem = that.bindElem || options.elem[0] + ,rect = elem.getBoundingClientRect() //绑定元素的坐标 + ,elemWidth = that.elem.offsetWidth //控件的宽度 + ,elemHeight = that.elem.offsetHeight //控件的高度 + + //滚动条高度 + ,scrollArea = function(type){ + type = type ? 'scrollLeft' : 'scrollTop'; + return document.body[type] | document.documentElement[type]; + } + ,winArea = function(type){ + return document.documentElement[type ? 'clientWidth' : 'clientHeight'] + }, margin = 5, left = rect.left, top = rect.bottom; + + //如果右侧超出边界 + if(left + elemWidth + margin > winArea('width')){ + left = winArea('width') - elemWidth - margin; + } + + //如果底部超出边界 + if(top + elemHeight + margin > winArea()){ + top = rect.top > elemHeight //顶部是否有足够区域显示完全 + ? rect.top - elemHeight + : winArea() - elemHeight; + top = top - margin*2; + } + + if(options.position){ + that.elem.style.position = options.position; + } + that.elem.style.left = left + (options.position === 'fixed' ? 0 : scrollArea(1)) + 'px'; + that.elem.style.top = top + (options.position === 'fixed' ? 0 : scrollArea()) + 'px'; + }; + + //提示 + Class.prototype.hint = function(content){ + var that = this + ,options = that.config + ,div = lay.elem('div', { + 'class': ELEM_HINT + }); + + div.innerHTML = content || ''; + lay(that.elem).find('.'+ ELEM_HINT).remove(); + that.elem.appendChild(div); + + clearTimeout(that.hinTimer); + that.hinTimer = setTimeout(function(){ + lay(that.elem).find('.'+ ELEM_HINT).remove(); + }, 3000); + }; + + //获取递增/减后的年月 + Class.prototype.getAsYM = function(Y, M, type){ + type ? M-- : M++; + if(M < 0){ + M = 11; + Y--; + } + if(M > 11){ + M = 0; + Y++; + } + return [Y, M]; + }; + + //系统消息 + Class.prototype.systemDate = function(newDate){ + var thisDate = newDate || new Date(); + return { + year: thisDate.getFullYear() //年 + ,month: thisDate.getMonth() //月 + ,date: thisDate.getDate() //日 + ,hours: newDate ? newDate.getHours() : 0 //时 + ,minutes: newDate ? newDate.getMinutes() : 0 //分 + ,seconds: newDate ? newDate.getSeconds() : 0 //秒 + } + }; + + //日期校验 + Class.prototype.checkDate = function(fn){ + var that = this + ,thisDate = new Date() + ,options = that.config + ,dateTime = options.dateTime = options.dateTime || that.systemDate() + ,thisMaxDate, error + + ,elem = that.bindElem || options.elem[0] + ,valType = that.isInput(elem) ? 'val' : 'html' + ,value = that.isInput(elem) ? elem.value : (options.position === 'static' ? '' : elem.innerHTML) + + //校验日期有效数字 + ,checkValid = function(dateTime){ + if(dateTime.year > LIMIT_YEAR[1]) dateTime.year = LIMIT_YEAR[1], error = true; //不能超过20万年 + if(dateTime.month > 11) dateTime.month = 11, error = true; + if(dateTime.hours > 23) dateTime.hours = 0, error = true; + if(dateTime.minutes > 59) dateTime.minutes = 0, dateTime.hours++, error = true; + if(dateTime.seconds > 59) dateTime.seconds = 0, dateTime.minutes++, error = true; + + //计算当前月的最后一天 + thisMaxDate = laydate.getEndDate(dateTime.month + 1, dateTime.year); + if(dateTime.date > thisMaxDate) dateTime.date = thisMaxDate, error = true; + } + + //获得初始化日期值 + ,initDate = function(dateTime, value, index){ + var startEnd = ['startTime', 'endTime']; + value = value.match(that.EXP_SPLIT); + index = index || 0; + if(options.range){ + that[startEnd[index]] = that[startEnd[index]] || {}; + } + lay.each(that.format, function(i, item){ + var thisv = parseFloat(value[i]); + if(value[i].length < item.length) error = true; + if(/yyyy|y/.test(item)){ //年 + if(thisv < LIMIT_YEAR[0]) thisv = LIMIT_YEAR[0], error = true; //年不能低于100年 + dateTime.year = thisv; + } else if(/MM|M/.test(item)){ //月 + if(thisv < 1) thisv = 1, error = true; + dateTime.month = thisv - 1; + } else if(/dd|d/.test(item)){ //日 + if(thisv < 1) thisv = 1, error = true; + dateTime.date = thisv; + } else if(/HH|H/.test(item)){ //时 + if(thisv < 1) thisv = 0, error = true; + dateTime.hours = thisv; + options.range && (that[startEnd[index]].hours = thisv); + } else if(/mm|m/.test(item)){ //分 + if(thisv < 1) thisv = 0, error = true; + dateTime.minutes = thisv; + options.range && (that[startEnd[index]].minutes = thisv); + } else if(/ss|s/.test(item)){ //秒 + if(thisv < 1) thisv = 0, error = true; + dateTime.seconds = thisv; + options.range && (that[startEnd[index]].seconds = thisv); + } + }); + checkValid(dateTime) + }; + + value = value || options.value; + if(typeof value === 'string'){ + value = value.replace(/\s+/g, ' ').replace(/^\s|\s$/g, ''); + } + + if(typeof value === 'string' && value){ + if(that.EXP_IF.test(value)){ //校验日期格式 + if(options.range){ + value = value.split(' '+ options.range +' '); + that.startDate = that.startDate || that.systemDate(); + that.endDate = that.endDate || that.systemDate(); + options.dateTime = lay.extend({}, that.startDate); + lay.each([that.startDate, that.endDate], function(i, item){ + initDate(item, value[i], i); + }); + } else { + initDate(dateTime, value) + } + } else { + that.hint('日期格式不合法
        必须遵循下述格式:
        '+ ( + options.range ? (options.format + ' '+ options.range +' ' + options.format) : options.format + ) + '
        已为你重置'); + error = true; + } + } else if(typeof value === 'object'){ + options.dateTime = that.systemDate(value); + } else { + options.dateTime = that.systemDate(); + delete that.startState; + delete that.endState; + delete that.startDate; + delete that.endDate; + delete that.startTime; + delete that.endTime; + } + + checkValid(dateTime); + + if(error && value){ + that.setValue( + options.range ? (that.endDate ? that.parse() : '') : that.parse() + ); + } + fn && fn(); + return that; + }; + + //公历重要日期与自定义备注 + Class.prototype.mark = function(td, YMD){ + var that = this + ,mark, options = that.config; + + lay.each(options.mark, function(key, title){ + var keys = key.split('-'); + if((keys[0] == YMD[0] || keys[0] == 0) && keys[1] == YMD[1] && keys[2] == YMD[2]){ + mark = title || YMD[2]; + } + }); + mark && td.html(''+ mark +''); + + return that; + }; + + //无效日期范围的标记 + Class.prototype.limit = function(elem, date, index, time){ + var that = this + ,options = that.config, timestrap = {} + ,dateTime = options[index > 41 ? 'endDate' : 'dateTime'] + ,isOut, thisDateTime = lay.extend({}, dateTime, date || {}); + + lay.each({ + now: thisDateTime + ,min: options.min + ,max: options.max + }, function(key, item){ + timestrap[key] = that.newDate(lay.extend({ + year: item.year + ,month: item.month + ,date: item.date + }, function(){ + var hms = {}; + lay.each(time, function(i, keys){ + hms[keys] = item[keys]; + }); + return hms; + }())).getTime(); //time:是否比较时分秒 + }); + + isOut = timestrap.now < timestrap.min || timestrap.now > timestrap.max; + elem && elem[isOut ? 'addClass' : 'removeClass'](DISABLED); + return isOut; + }; + + //日历表 + Class.prototype.calendar = function(value){ + var that = this + ,options = that.config + ,dateTime = value || options.dateTime + ,thisDate = new Date(), startWeek, prevMaxDate, thisMaxDate + ,lang = that.lang() + + ,isAlone = options.type !== 'date' && options.type !== 'datetime' + ,index = value ? 1 : 0 + ,tds = lay(that.table[index]).find('td') + ,elemYM = lay(that.elemHeader[index][2]).find('span'); + + if(dateTime.year < LIMIT_YEAR[0]) dateTime.year = LIMIT_YEAR[0], that.hint('最低只能支持到公元'+ LIMIT_YEAR[0] +'年'); + if(dateTime.year > LIMIT_YEAR[1]) dateTime.year = LIMIT_YEAR[1], that.hint('最高只能支持到公元'+ LIMIT_YEAR[1] +'年'); + + //记录初始值 + if(!that.firstDate){ + that.firstDate = lay.extend({}, dateTime); + } + + //计算当前月第一天的星期 + thisDate.setFullYear(dateTime.year, dateTime.month, 1); + startWeek = thisDate.getDay(); + + prevMaxDate = laydate.getEndDate(dateTime.month, dateTime.year); //计算上个月的最后一天 + thisMaxDate = laydate.getEndDate(dateTime.month + 1, dateTime.year); //计算当前月的最后一天 + + //赋值日 + lay.each(tds, function(index, item){ + var YMD = [dateTime.year, dateTime.month], st = 0; + item = lay(item); + item.removeAttr('class'); + if(index < startWeek){ + st = prevMaxDate - startWeek + index; + item.addClass('laydate-day-prev'); + YMD = that.getAsYM(dateTime.year, dateTime.month, 'sub'); + } else if(index >= startWeek && index < thisMaxDate + startWeek){ + st = index - startWeek; + if(!options.range){ + st + 1 === dateTime.date && item.addClass(THIS); + } + } else { + st = index - thisMaxDate - startWeek; + item.addClass('laydate-day-next'); + YMD = that.getAsYM(dateTime.year, dateTime.month); + } + YMD[1]++; + YMD[2] = st + 1; + item.attr('lay-ymd', YMD.join('-')).html(YMD[2]); + that.mark(item, YMD).limit(item, { + year: YMD[0] + ,month: YMD[1] - 1 + ,date: YMD[2] + }, index); + }); + + //同步头部年月 + lay(elemYM[0]).attr('lay-ym', dateTime.year + '-' + (dateTime.month + 1)); + lay(elemYM[1]).attr('lay-ym', dateTime.year + '-' + (dateTime.month + 1)); + + if(options.lang === 'cn'){ + lay(elemYM[0]).attr('lay-type', 'year').html(dateTime.year + '年') + lay(elemYM[1]).attr('lay-type', 'month').html((dateTime.month + 1) + '月'); + } else { + lay(elemYM[0]).attr('lay-type', 'month').html(lang.month[dateTime.month]); + lay(elemYM[1]).attr('lay-type', 'year').html(dateTime.year); + } + + //初始默认选择器 + if(isAlone){ + if(options.range){ + value ? that.endDate = (that.endDate || { + year: dateTime.year + (options.type === 'year' ? 1 : 0) + ,month: dateTime.month + (options.type === 'month' ? 0 : -1) + }) : (that.startDate = that.startDate || { + year: dateTime.year + ,month: dateTime.month + }); + if(value){ + that.listYM = [ + [that.startDate.year, that.startDate.month + 1] + ,[that.endDate.year, that.endDate.month + 1] + ]; + that.list(options.type, 0).list(options.type, 1); + //同步按钮可点状态 + options.type === 'time' ? that.setBtnStatus('时间' + ,lay.extend({}, that.systemDate(), that.startTime) + ,lay.extend({}, that.systemDate(), that.endTime) + ) : that.setBtnStatus(true); + } + } + if(!options.range){ + that.listYM = [[dateTime.year, dateTime.month + 1]]; + that.list(options.type, 0); + } + } + + //赋值双日历 + if(options.range && !value){ + var EYM = that.getAsYM(dateTime.year, dateTime.month) + that.calendar(lay.extend({}, dateTime, { + year: EYM[0] + ,month: EYM[1] + })); + } + + //通过检测当前有效日期,来设定确定按钮是否可点 + if(!options.range) that.limit(lay(that.footer).find(ELEM_CONFIRM), null, 0, ['hours', 'minutes', 'seconds']); + + //标记选择范围 + if(options.range && value && !isAlone) that.stampRange(); + return that; + }; + + //生成年月时分秒列表 + Class.prototype.list = function(type, index){ + var that = this + ,options = that.config + ,dateTime = options.dateTime + ,lang = that.lang() + ,isAlone = options.range && options.type !== 'date' && options.type !== 'datetime' //独立范围选择器 + + ,ul = lay.elem('ul', { + 'class': ELEM_LIST + ' ' + ({ + year: 'laydate-year-list' + ,month: 'laydate-month-list' + ,time: 'laydate-time-list' + })[type] + }) + ,elemHeader = that.elemHeader[index] + ,elemYM = lay(elemHeader[2]).find('span') + ,elemCont = that.elemCont[index || 0] + ,haveList = lay(elemCont).find('.'+ ELEM_LIST)[0] + ,isCN = options.lang === 'cn' + ,text = isCN ? '年' : '' + + ,listYM = that.listYM[index] || {} + ,hms = ['hours', 'minutes', 'seconds'] + ,startEnd = ['startTime', 'endTime'][index]; + + if(listYM[0] < 1) listYM[0] = 1; + + if(type === 'year'){ //年列表 + var yearNum, startY = yearNum = listYM[0] - 7; + if(startY < 1) startY = yearNum = 1; + lay.each(new Array(15), function(i){ + var li = lay.elem('li', { + 'lay-ym': yearNum + }); + yearNum == listYM[0] && lay(li).addClass(THIS); + li.innerHTML = yearNum + text; + ul.appendChild(li); + + that.limit(lay(li), {year: yearNum}, index); + yearNum++; + }); + lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', (yearNum - 8) + '-' + listYM[1]) + .html((startY + text) + ' - ' + (yearNum - 1 + text)); + } else if(type === 'month'){ //月列表 + lay.each(new Array(12), function(i){ + var li = lay.elem('li', { + 'lay-ym': i + }); + i + 1 == listYM[1] && lay(li).addClass(THIS); + li.innerHTML = lang.month[i] + (isCN ? '月' : ''); + ul.appendChild(li); + + that.limit(lay(li), {year: listYM[0], month: i}, index); + }); + lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', listYM[0] + '-' + listYM[1]) + .html(listYM[0] + text); + } else if(type === 'time'){ //时间列表 + //检测时分秒状态是否在有效日期时间范围内 + var setTimeStatus = function(){ + lay(ul).find('ol').each(function(i, ol){ + lay(ol).find('li').each(function(ii, li){ + that.limit(lay(li), [{ + hours: ii + }, { + hours: that[startEnd].hours + ,minutes: ii + }, { + hours: that[startEnd].hours + ,minutes: that[startEnd].minutes + ,seconds: ii + }][i], index, [['hours'], ['hours', 'minutes'], ['hours', 'minutes', 'seconds']][i]); + }); + }); + if(!options.range) that.limit(lay(that.footer).find(ELEM_CONFIRM), that[startEnd], 0, ['hours', 'minutes', 'seconds']); + }; + if(options.range){ + if(!that[startEnd]) that[startEnd] = { + hours: 0 + ,minutes: 0 + ,seconds: 0 + }; + } else { + that[startEnd] = dateTime; + } + lay.each([24, 60, 60], function(i, item){ + var li = lay.elem('li'), childUL = ['

        '+ lang.time[i] +'

          ']; + lay.each(new Array(item), function(ii){ + childUL.push(''+ lay.digit(ii, 2) +''); + }); + li.innerHTML = childUL.join('') + '
        '; + ul.appendChild(li); + }); + setTimeStatus(); + } + + //插入容器 + if(haveList) elemCont.removeChild(haveList); + elemCont.appendChild(ul); + + //年月 + if(type === 'year' || type === 'month'){ + //显示切换箭头 + lay(that.elemMain[index]).addClass('laydate-ym-show'); + + //选中 + lay(ul).find('li').on('click', function(){ + var ym = lay(this).attr('lay-ym') | 0; + if(lay(this).hasClass(DISABLED)) return; + + if(index === 0){ + dateTime[type] = ym; + if(isAlone) that.startDate[type] = ym; + } else { //范围选择 + if(isAlone){ //非date/datetime类型 + that.endDate[type] = ym; + } else { //date/datetime类型 + var YM = type === 'year' + ? that.getAsYM(ym, listYM[1] - 1, 'sub') + : that.getAsYM(listYM[0], ym, 'sub'); + lay.extend(dateTime, { + year: YM[0] + ,month: YM[1] + }); + } + } + + if(options.type === 'year' || options.type === 'month'){ + lay(ul).find('.'+ THIS).removeClass(THIS); + lay(this).addClass(THIS); + + //如果为年月选择器,点击了年列表,则切换到月选择器 + if(options.type === 'month' && type === 'year'){ + that.listYM[index][0] = ym; + isAlone && (that[['startDate', 'endDate'][index]].year = ym); + that.list('month', index); + } + } else { + that.calendar(); + that.closeList(); + } + + that.setBtnStatus(); //同步按钮可点状态 + options.range || that.done(null, 'change'); + lay(that.footer).find(ELEM_TIME_BTN).removeClass(DISABLED); + }); + } else { + var span = lay.elem('span', { + 'class': ELEM_TIME_TEXT + }), scroll = function(){ //滚动条定位 + lay(ul).find('ol').each(function(i){ + var ol = this + ,li = lay(ol).find('li') + ol.scrollTop = 30*(that[startEnd][hms[i]] - 2); + if(ol.scrollTop <= 0){ + li.each(function(ii, item){ + if(!lay(this).hasClass(DISABLED)){ + ol.scrollTop = 30*(ii - 2); + return true; + } + }); + } + }); + }, haveSpan = lay(elemHeader[2]).find('.'+ ELEM_TIME_TEXT); + scroll() + span.innerHTML = options.range ? [lang.startTime,lang.endTime][index] : lang.timeTips + lay(that.elemMain[index]).addClass('laydate-time-show'); + if(haveSpan[0]) haveSpan.remove(); + elemHeader[2].appendChild(span); + + lay(ul).find('ol').each(function(i){ + var ol = this; + //选择时分秒 + lay(ol).find('li').on('click', function(){ + var value = this.innerHTML | 0; + if(lay(this).hasClass(DISABLED)) return; + if(options.range){ + that[startEnd][hms[i]] = value; + } else { + dateTime[hms[i]] = value; + } + lay(ol).find('.'+ THIS).removeClass(THIS); + lay(this).addClass(THIS); + + //同步按钮可点状态 + that.setBtnStatus( + null + ,lay.extend({}, that.systemDate(), that.startTime) + ,lay.extend({}, that.systemDate(), that.endTime) + ); + setTimeStatus(); + scroll(); + (that.endDate || options.type === 'time') && that.done(null, 'change'); + }); + }); + } + + return that; + }; + + //记录列表切换后的年月 + Class.prototype.listYM = []; + + //关闭列表 + Class.prototype.closeList = function(){ + var that = this + ,options = that.config; + + lay.each(that.elemCont, function(index, item){ + lay(this).find('.'+ ELEM_LIST).remove(); + lay(that.elemMain[index]).removeClass('laydate-ym-show laydate-time-show'); + }); + lay(that.elem).find('.'+ ELEM_TIME_TEXT).remove(); + }; + + //检测结束日期是否超出开始日期 + Class.prototype.setBtnStatus = function(tips, start, end){ + var that = this + ,options = that.config + ,isOut, elemBtn = lay(that.footer).find(ELEM_CONFIRM) + ,isAlone = options.range && options.type !== 'date' && options.type !== 'datetime'; + if(isAlone){ + start = start || that.startDate; + end = end || that.endDate; + isOut = that.newDate(start).getTime() > that.newDate(end).getTime(); + + //如果不在有效日期内,直接禁用按钮,否则比较开始和结束日期 + (that.limit(null, start) || that.limit(null, end)) + ? elemBtn.addClass(DISABLED) + : elemBtn[isOut ? 'addClass' : 'removeClass'](DISABLED); + + //是否异常提示 + if(tips && isOut) that.hint( + typeof tips === 'string' ? TIPS_OUT.replace(/日期/g, tips) : TIPS_OUT + ); + } + }; + + //转义为规定格式的日期字符 + Class.prototype.parse = function(state){ + var that = this + ,options = that.config + ,dateTime = state + ? lay.extend({}, that.endDate, that.endTime) + : (options.range ? lay.extend({}, that.startDate, that.startTime) : options.dateTime) + ,format = that.format.concat(); + + //转义为规定格式 + lay.each(format, function(i, item){ + if(/yyyy|y/.test(item)){ //年 + format[i] = lay.digit(dateTime.year, item.length); + } else if(/MM|M/.test(item)){ //月 + format[i] = lay.digit(dateTime.month + 1, item.length); + } else if(/dd|d/.test(item)){ //日 + format[i] = lay.digit(dateTime.date, item.length); + } else if(/HH|H/.test(item)){ //时 + format[i] = lay.digit(dateTime.hours, item.length); + } else if(/mm|m/.test(item)){ //分 + format[i] = lay.digit(dateTime.minutes, item.length); + } else if(/ss|s/.test(item)){ //秒 + format[i] = lay.digit(dateTime.seconds, item.length); + } + }); + + //返回日期范围字符 + if(options.range && !state){ + return format.join('') + ' '+ options.range +' ' + that.parse(1); + } + + return format.join(''); + }; + + //创建指定日期时间对象 + Class.prototype.newDate = function(dateTime){ + return new Date( + dateTime.year || 1 + ,dateTime.month || 0 + ,dateTime.date || 1 + ,dateTime.hours || 0 + ,dateTime.minutes || 0 + ,dateTime.seconds || 0 + ); + }; + + //赋值 + Class.prototype.setValue = function(value){ + var that = this + ,options = that.config + ,elem = that.bindElem || options.elem[0] + ,valType = that.isInput(elem) ? 'val' : 'html' + + options.position === 'static' || lay(elem)[valType](value || ''); + return this; + }; + + //标记范围内的日期 + Class.prototype.stampRange = function(){ + var that = this + ,options = that.config + ,startTime, endTime + ,tds = lay(that.elem).find('td'); + + if(options.range && !that.endDate) lay(that.footer).find(ELEM_CONFIRM).addClass(DISABLED); + if(!that.endDate) return; + + startTime = that.newDate({ + year: that.startDate.year + ,month: that.startDate.month + ,date: that.startDate.date + }).getTime(); + + endTime = that.newDate({ + year: that.endDate.year + ,month: that.endDate.month + ,date: that.endDate.date + }).getTime(); + + if(startTime > endTime) return that.hint(TIPS_OUT); + + lay.each(tds, function(i, item){ + var ymd = lay(item).attr('lay-ymd').split('-') + ,thisTime = that.newDate({ + year: ymd[0] + ,month: ymd[1] - 1 + ,date: ymd[2] + }).getTime(); + lay(item).removeClass(ELEM_SELECTED + ' ' + THIS); + if(thisTime === startTime || thisTime === endTime){ + lay(item).addClass( + lay(item).hasClass(ELEM_PREV) || lay(item).hasClass(ELEM_NEXT) + ? ELEM_SELECTED + : THIS + ); + } + if(thisTime > startTime && thisTime < endTime){ + lay(item).addClass(ELEM_SELECTED); + } + }); + }; + + //执行done/change回调 + Class.prototype.done = function(param, type){ + var that = this + ,options = that.config + ,start = lay.extend({}, that.startDate ? lay.extend(that.startDate, that.startTime) : options.dateTime) + ,end = lay.extend({}, lay.extend(that.endDate, that.endTime)) + + lay.each([start, end], function(i, item){ + if(!('month' in item)) return; + lay.extend(item, { + month: item.month + 1 + }); + }); + + param = param || [that.parse(), start, end]; + typeof options[type || 'done'] === 'function' && options[type || 'done'].apply(options, param); + + return that; + }; + + //选择日期 + Class.prototype.choose = function(td){ + var that = this + ,options = that.config + ,dateTime = options.dateTime + + ,tds = lay(that.elem).find('td') + ,YMD = td.attr('lay-ymd').split('-') + + ,setDateTime = function(one){ + var thisDate = new Date(); + + //同步dateTime + one && lay.extend(dateTime, YMD); + + //记录开始日期 + if(options.range){ + that.startDate ? lay.extend(that.startDate, YMD) : ( + that.startDate = lay.extend({}, YMD, that.startTime) + ); + that.startYMD = YMD; + } + }; + + YMD = { + year: YMD[0] | 0 + ,month: (YMD[1] | 0) - 1 + ,date: YMD[2] | 0 + }; + + if(td.hasClass(DISABLED)) return; + + //范围选择 + if(options.range){ + + lay.each(['startTime', 'endTime'], function(i, item){ + that[item] = that[item] || { + hours: 0 + ,minutes: 0 + ,seconds: 0 + }; + }); + + if(that.endState){ //重新选择 + setDateTime(); + delete that.endState; + delete that.endDate; + that.startState = true; + tds.removeClass(THIS + ' ' + ELEM_SELECTED); + td.addClass(THIS); + } else if(that.startState){ //选中截止 + td.addClass(THIS); + + that.endDate ? lay.extend(that.endDate, YMD) : ( + that.endDate = lay.extend({}, YMD, that.endTime) + ); + + //判断是否顺时或逆时选择 + if(that.newDate(YMD).getTime() < that.newDate(that.startYMD).getTime()){ + var startDate = lay.extend({}, that.endDate, { + hours: that.startDate.hours + ,minutes: that.startDate.minutes + ,seconds: that.startDate.seconds + }); + lay.extend(that.endDate, that.startDate, { + hours: that.endDate.hours + ,minutes: that.endDate.minutes + ,seconds: that.endDate.seconds + }); + that.startDate = startDate; + } + + options.showBottom || that.done(); + that.stampRange(); //标记范围内的日期 + that.endState = true; + that.done(null, 'change'); + } else { //选中开始 + td.addClass(THIS); + setDateTime(); + that.startState = true; + } + lay(that.footer).find(ELEM_CONFIRM)[that.endDate ? 'removeClass' : 'addClass'](DISABLED); + } else if(!(options.type === 'datatime' || options.position === 'static')){ + setDateTime(true); + that.setValue(that.parse()).remove().done(); + } else { + setDateTime(true); + that.calendar().done().done(null, 'change'); + } + }; + + //底部按钮 + Class.prototype.tool = function(btn, type){ + var that = this + ,options = that.config + ,dateTime = options.dateTime + ,isStatic = options.position === 'static' + ,active = { + //选择时间 + datetime: function(){ + if(lay(btn).hasClass(DISABLED)) return; + that.list('time', 0); + options.range && that.list('time', 1); + lay(btn).attr('lay-type', 'date').html(that.lang().dateTips); + } + + //选择日期 + ,date: function(){ + that.closeList(); + lay(btn).attr('lay-type', 'datetime').html(that.lang().timeTips); + } + + //清空、重置 + ,clear: function(){ + that.setValue('').remove(); + isStatic && ( + lay.extend(dateTime, that.firstDate) + ,that.calendar() + ) + options.range && ( + delete that.startState + ,delete that.endState + ,delete that.endDate + ,delete that.startTime + ,delete that.endTime + ); + that.done(['', {}, {}]); + } + + //现在 + ,now: function(){ + var thisDate = new Date(); + lay.extend(dateTime, that.systemDate(), { + hours: thisDate.getHours() + ,minutes: thisDate.getMinutes() + ,seconds: thisDate.getSeconds() + }); + that.setValue(that.parse()).remove(); + isStatic && that.calendar(); + that.done(); + } + + //确定 + ,confirm: function(){ + if(options.range){ + if(!that.endDate) return that.hint('请先选择日期范围'); + if(lay(btn).hasClass(DISABLED)) return; + } else { + if(lay(btn).hasClass(DISABLED)) return that.hint('不在有效日期或时间范围内'); + } + that.done(); + that.setValue(that.parse()).remove() + } + }; + active[type] && active[type](); + }; + + //统一切换处理 + Class.prototype.change = function(index){ + var that = this + ,options = that.config + ,dateTime = options.dateTime + ,isAlone = options.range && (options.type === 'year' || options.type === 'month') + + ,elemCont = that.elemCont[index || 0] + ,listYM = that.listYM[index] + ,addSubYeay = function(type){ + var startEnd = ['startDate', 'endDate'][index] + ,isYear = lay(elemCont).find('.laydate-year-list')[0] + ,isMonth = lay(elemCont).find('.laydate-month-list')[0]; + + //切换年列表 + if(isYear){ + listYM[0] = type ? listYM[0] - 15 : listYM[0] + 15; + that.list('year', index); + } + + if(isMonth){ //切换月面板中的年 + type ? listYM[0]-- : listYM[0]++; + that.list('month', index); + } + + if(isYear || isMonth){ + lay.extend(dateTime, { + year: listYM[0] + }); + if(isAlone) that[startEnd].year = listYM[0]; + options.range || that.done(null, 'change'); + that.setBtnStatus(); + options.range || that.limit(lay(that.footer).find(ELEM_CONFIRM), { + year: listYM[0] + }); + } + return isYear || isMonth; + }; + + return { + prevYear: function(){ + if(addSubYeay('sub')) return; + dateTime.year--; + that.calendar(); + options.range || that.done(null, 'change'); + } + ,prevMonth: function(){ + var YM = that.getAsYM(dateTime.year, dateTime.month, 'sub'); + lay.extend(dateTime, { + year: YM[0] + ,month: YM[1] + }); + that.calendar(); + options.range || that.done(null, 'change'); + } + ,nextMonth: function(){ + var YM = that.getAsYM(dateTime.year, dateTime.month); + lay.extend(dateTime, { + year: YM[0] + ,month: YM[1] + }); + that.calendar(); + options.range || that.done(null, 'change'); + } + ,nextYear: function(){ + if(addSubYeay()) return; + dateTime.year++ + that.calendar(); + options.range || that.done(null, 'change'); + } + }; + }; + + //日期切换事件 + Class.prototype.changeEvent = function(){ + var that = this + ,options = that.config; + + //日期选择事件 + lay(that.elem).on('click', function(e){ + lay.stope(e); + }); + + //年月切换 + lay.each(that.elemHeader, function(i, header){ + //上一年 + lay(header[0]).on('click', function(e){ + that.change(i).prevYear(); + }); + + //上一月 + lay(header[1]).on('click', function(e){ + that.change(i).prevMonth(); + }); + + //选择年月 + lay(header[2]).find('span').on('click', function(e){ + var othis = lay(this) + ,layYM = othis.attr('lay-ym').split('-') + ,layType = othis.attr('lay-type'); + + that.listYM[i] = [layYM[0] | 0, layYM[1] | 0]; + that.list(layType, i); + lay(that.footer).find(ELEM_TIME_BTN).addClass(DISABLED); + }); + + //下一月 + lay(header[3]).on('click', function(e){ + that.change(i).nextMonth(); + }); + + //下一年 + lay(header[4]).on('click', function(e){ + that.change(i).nextYear(); + }); + }); + + //点击日期 + lay.each(that.table, function(i, table){ + var tds = lay(table).find('td'); + tds.on('click', function(){ + that.choose(lay(this)); + }); + }); + + //点击底部按钮 + lay(that.footer).find('span').on('click', function(){ + var type = lay(this).attr('lay-type'); + that.tool(this, type); + }); + }; + + //是否输入框 + Class.prototype.isInput = function(elem){ + return /input|textarea/.test(elem.tagName.toLocaleLowerCase()); + }; + + //绑定的元素事件处理 + Class.prototype.events = function(){ + var that = this + ,options = that.config + + //绑定呼出控件事件 + ,showEvent = function(elem, bind){ + elem.on(options.trigger, function(){ + bind && (that.bindElem = this); + that.render(); + }); + }; + + if(!options.elem[0] || options.elem[0].eventHandler) return; + + showEvent(options.elem, 'bind'); + showEvent(options.eventElem); + + //绑定关闭控件事件 + lay(document).on('click', function(e){ + if(e.target === options.elem[0] + || e.target === options.eventElem[0] + || e.target === lay(options.closeStop)[0]){ + return; + } + that.remove(); + }).on('keydown', function(e){ + if(e.keyCode === 13){ + e.preventDefault(); + if(lay('#'+ that.elemID)[0] && that.elemID === Class.thisElem){ + lay(that.footer).find(ELEM_CONFIRM)[0].click(); + } + } + }); + + //自适应定位 + lay(window).on('resize', function(){ + if(!that.elem || !lay(ELEM)[0]){ + return false; + } + that.position(); + }); + + options.elem[0].eventHandler = true; + }; + + + //核心接口 + laydate.render = function(options){ + var inst = new Class(options); + return thisDate.call(inst); + }; + + //得到某月的最后一天 + laydate.getEndDate = function(month, year){ + var thisDate = new Date(); + //设置日期为下个月的第一天 + thisDate.setFullYear( + year || thisDate.getFullYear() + ,month || (thisDate.getMonth() + 1) + ,1); + //减去一天,得到当前月最后一天 + return new Date(thisDate.getTime() - 1000*60*60*24).getDate(); + }; + + //暴露lay + window.lay = window.lay || lay; + + //加载方式 + isLayui ? ( + laydate.ready() + ,layui.define(function(exports){ //layui加载 + laydate.path = layui.cache.dir; + exports(MOD_NAME, laydate); + }) + ) : ( + (typeof define === 'function' && define.amd) ? define(function(){ //requirejs加载 + return laydate; + }) : function(){ //普通script标签加载 + laydate.ready(); + window.laydate = laydate + }() + ); + +}(); \ No newline at end of file diff --git a/src/theme/default/font/iconfont.eot b/src/theme/default/font/iconfont.eot new file mode 100644 index 0000000000000000000000000000000000000000..c861caa8e2c1e5bfff43ca36bf79fe3195545148 GIT binary patch literal 2456 zcmc&$U2GIp6h3EWclM|4ENt8Dw(PdkmhM(tw(YtU3JL_Uh&B;HOP~_7bZ6U={bRd@ zEkWIo_!|<4i3VfP#9-i&L`)1Jkw+dhCIsS(AsAs3vs$|eAFngtr$Wyy=ZNkcq#`CiW=yMTg}p(M>y3Vn%m zT0=85NqNe_K&9ParfANzDS`>mIG7^M!b;d^G(<5Pgy#R|fm%3GM-`H3aL1lkwq7*8 z{2kH7GEPDBGK8+RJ(tFakU{6_h{*~g4v5Pqb-F?@t^s_12Lgng&6~A1e z3JmP%#Zof%S=^U4h$0%1m;IKCGxnG?STVXEcSH%^K^q{u@e>JMuFBPknuxtzm8$zq z1Oa1&h1eI7_%cRe1r`xLrt853cuZ~()tf7i+3SmaFWU_+R#M1XEYI$`nb8%+1%2k z%F*snawCO^Y1T}o3RKAecOC@#gvD!21fo$=vlOp5Z_#3pGY#{*&J)>UnL{5>JR ze44$%X!~2n^U~+s+|eEKZCYdO?BCoJ*BaeN>;3*#zyG9LaXQ_Sib#Q%av~6r(gSN__d^eE`_q2GJD-~{BrK#sPuWVb1|M9j!qrcU)qQM<( zYv^9x#7FPc1sm(bk)IK&$jaKE(p|a1%&c`DjxvWv_>^&Ygm+2THyX3X>_#@f1xxIr z9$v@Noe|?OpBgbPF0sQd*RIJ|@wWS@gEXQ>9*zf^TpkWIDP03R^q|a}`MfV0R*kcq z^0h~Ny)s{b?1QYU;i%ecyulT|00_$XM40ySiH8Ugi&*=H{FU5CE2xvYh&-%xMG^=q zk{FJ6@DO+2PjvH;e91_uk+919jW5(tM2+%M<8345i-c6(2P!NmF7ul(3q^dqk0*pK zYP|Ol0T29i%Y4s;H_d3)>%z#^W*bZ7f^QZtgYUJm12|!0Co0Ak8!O;nu(6l=Xs?ay zkeeqEF*{Hh=}G#~#*BjWjg2J~vL9?LgTHHI2k<{Oc2WQ}!J0>*AotnWOXIxF#&s0o zkGr-=?WN|6A6p!o0*_nJ!8;T7srFZB# zy|^&%?2)N>sg%~z#e7y9#R7UJlh+Ex{2_g^6q_!U3L6Fn#KMA)P3E)sG;Tvx*6kXe zLc$$HP1pXb(r!3H@9f6JrGQb)YOx+>OGYRV$O`D?%C@2H?EkwLvA2UxiS&@ + + + + +Created by iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/theme/default/font/iconfont.ttf b/src/theme/default/font/iconfont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0bd6c4a88dd899aea3926e49bdfb37e81004bcb9 GIT binary patch literal 2272 zcmc&#TWl0n82KNt^83(# zg?zD)t!0$i8_?xTMAC*uJ(*TNe&s#beh-;i1mU_VzX^O9vU)LBsrLK~M0_1xFk46^ zr3uc!{~UBRm#h}Kn+{?=2wlr3bNaq(&fP>#o6Yvf-j z&hVAUDTBRF+nsqbOr{uCUA;&pW1q#?Do{l=BIcMi#aY`Y16FvCVMLYS z9kda;8<(iP+K?ObO;LNbAvF$|2nu|Jh1eH{oeVEzU{T>iYW5a9r0gwe+fBU7X2iZ% zZNU;7*i#{5ZyR_XLd0`v9I!+@w#K|A_6a;nZ_`Kg9fx3vXw4tw%W{x9X@n+eJK-H+ zWt4|hDa?b>L`)jx?m=gFPnRl3hogh8;h~uP1osRnU4i&iBGRL{6d$YH&yNkpr=l?_ z%IgxFrA-_UgqeF+_3ibq3HjwS>+8Ne@Q5_P?Y+^yUHdz*hM|Oo~2vU#t}X}ZCq@z!!9?k%2)8V`)GhPqE4QQ2fADy z4s{*&X^?9Lu}5E6&L&H( zR4bm-OXa0PUYm?fw9-5Dyk5E!w|sOVUa4fXOsSC5W|2V8W(!)eR5+}sDzU{%rMPi? zTqG8JELF(i)3}XFq*IbA=+iiGhp2{riBeRcJY~$j0=q11YOt^@*Zya*2Yw5*Y|fV+ zX!RiPIe3?-jA$a8hL1&zCLS1N2dwj^$KC5K(^0G6DLx95k(XKllwJ=C6?L2PFC1OTvcj?W!%ck U%LUx7>Qb_{RMXw|I4MH>3rdt+EdT%j literal 0 HcmV?d00001 diff --git a/src/theme/default/font/iconfont.woff b/src/theme/default/font/iconfont.woff new file mode 100644 index 0000000000000000000000000000000000000000..bfe5599671f9441ceebdc8afeac71d4f65a741c7 GIT binary patch literal 1492 zcmY+Ec~Fx_7{)gwfRsQv0;F70?g7dvDTi_k2q?&X&U_&x2IUmw6v>BjMv!1R4M!=} zat=&T#2N_qQ9*2LQO=SDwfF%7h8S8TISJOqsY87jqJohDAyMQ=D)by+U2j;o((iXckC^DV zczE72m}3s{H1!QBN@7!xFa+U;7E&h2NPO&;2$_!{WCke2Q%=!RR6X#c*wHpdxVQ@K za*hDVQ^UH0&wKXz%uuu#yEzG=wzb3;(!RdM}$9bAdD=wplNTO;eyZC zaM2&yfiXjyZ6~lQXuFf+y6i;QlGYzd46q#^XH64j1zTk6hocD0jQb}8QIei?v+m!M zEs8<;=~df(i=8GaG;6EG(;}OU%e5Cb6m4jH3UrA!c?--Pi$T{%cW?w z*{9i}HN@-Md30G>345QLyekC9!Ul1&jl{R8jh&8VsBKL`7^4}hX0rIT%BTTieK%sF zs%v3xCAH4opxhz-QmdM;TIszbHRsw-;u^EBC`g8uzt30JX$z=NVUHAC6|Jm$*iu{J zUsWx()qYk+4^yD2KlIe&omj5!hY};(WhWc1V9qE-R-oRBt)nSWB%q-e;y}w&9mH-9D+eGe@vp`sKnL{YUT8p0R+=*_e&4;lmC$ zd=&ik7f4f|kb9C5tI34j7B7RQQs(WN8S@o#?8Q6FCAHgHYr?ZT9h=PJ6CH!YS-4)K zcaJxS(}NwkQ(mdkuh?(u@+Gf6YnvL_^H2LUM49?H+SMv4a`yC%;Q_-fZid)Ar^uDa zeo(e(Gn~`dQO2a{+{0&Eh*rMdbbi~Ca#cfo$4_mC_H)AKHo^Zw!0g_*6-T+*%T0tO zrh6hTL}x5Jz;!-vUswtMM9Xv~ygxQ5jZYrckbTiv!94Q3ES%6Rp}d&;SFbmcW!YHi zZQzb}&wh+K^QG?)1cW|5tgAe*HGPrFr;!2LC>%Dfy1K9BPb?clgT;k33$=l#v?%4j z{4ed-3j}P6SQwdB3~<5=M8h5?BM5S7gvaY;_zM4h8wll4 z7(xXYO_gNl76v?MZS?o+4;ntE=S8 zF&atkofJ(AjZ703tsWd|{E<1yO;4Nxr^6Kcj&!H6C-W z(`|q5eC8*5XP!ls-sGxvP{KqnbIGD*b5y}$iTwf-T_RYq+Zx=fVf9_P-1@4Bva?qzk-sa0xR#X8sMG&6E_&HiQKEtgx3 z>LtfIQt8)xnzrY;Yf+EB*DOR&shTfhb@0-ik46GN42H;azKOR$cS5Xl&6XwPzf#7( zRFpCaYtr3ymQWjRB`O~G2;TY7X;p5q+7h_!%j12);&&J2W5A7dm CyJwOB literal 0 HcmV?d00001 diff --git a/src/theme/default/laydate.css b/src/theme/default/laydate.css new file mode 100644 index 0000000..cc5c3fa --- /dev/null +++ b/src/theme/default/laydate.css @@ -0,0 +1,169 @@ +/** + + @Name: laydata + @Author: 贤心 + + **/ + + +html #layuicss-laydate{display: none; position: absolute; width: 1989px;} + +/** 图标字体 **/ +@font-face {font-family: 'laydate-icon'; + src: url('./font/iconfont.eot'); + src: url('./font/iconfont.eot#iefix') format('embedded-opentype'), + url('./font/iconfont.svg#iconfont') format('svg'), + url('./font/iconfont.woff') format('woff'), + url('./font/iconfont.ttf') format('truetype'); +} + +.laydate-icon{ + font-family:"laydate-icon" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +/* 主体结构 */ +.layui-laydate, .layui-laydate *{box-sizing: border-box;} +.layui-laydate{position: absolute; z-index: 66666666; margin: 5px 0; border-radius: 2px; font-size: 14px; -webkit-animation-duration: 0.3s; animation-duration: 0.3s; -webkit-animation-fill-mode: both; animation-fill-mode: both;} +.layui-laydate-main{width: 272px;} +.layui-laydate-header *, +.layui-laydate-content td, +.layui-laydate-list li{transition-duration: .3s; -webkit-transition-duration: .3s;} + +@-webkit-keyframes laydate-upbit{ /* 微微往上滑入 */ + from {-webkit-transform: translate3d(0, 20px, 0); opacity: 0.3;} + to {-webkit-transform: translate3d(0, 0, 0); opacity: 1;} +} +@keyframes laydate-upbit{ + from {transform: translate3d(0, 20px, 0); opacity: 0.3;} + to {transform: translate3d(0, 0, 0); opacity: 1;} +} +.layui-laydate{-webkit-animation-name: laydate-upbit; animation-name: laydate-upbit;} +.layui-laydate-static{ position: relative; z-index: 0; display: inline-block; margin: 0; -webkit-animation: none; animation: none;} + +/* 展开年月列表时 */ +.laydate-ym-show .laydate-prev-m, +.laydate-ym-show .laydate-next-m{display: none !important;} +.laydate-ym-show .laydate-prev-y, +.laydate-ym-show .laydate-next-y{display: inline-block !important;} +.laydate-ym-show .laydate-set-ym span[lay-type="month"]{display: none !important;} + +/* 展开时间列表时 */ +.laydate-time-show .layui-laydate-header .layui-icon, +.laydate-time-show .laydate-set-ym span[lay-type="year"], +.laydate-time-show .laydate-set-ym span[lay-type="month"]{display: none !important;} + +/* 头部结构 */ +.layui-laydate-header{position: relative; line-height:30px; padding: 10px 70px 5px;} +.layui-laydate-header *{display: inline-block; vertical-align: bottom;} +.layui-laydate-header i{position: absolute; top: 10px; padding: 0 5px; color: #999; font-size: 18px; cursor: pointer;} +.layui-laydate-header i.laydate-prev-y{left: 15px;} +.layui-laydate-header i.laydate-prev-m{left: 45px;} +.layui-laydate-header i.laydate-next-y{right: 15px;} +.layui-laydate-header i.laydate-next-m{right: 45px;} +.laydate-set-ym{width: 100%; text-align: center; box-sizing: border-box; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;} +.laydate-set-ym span{padding: 0 5px; cursor: pointer;} +.laydate-time-text{cursor: default !important;} + +/* 主体结构 */ +.layui-laydate-content{position: relative; padding: 10px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;} +.layui-laydate-content table{border-collapse: collapse; border-spacing: 0;} +.layui-laydate-content th, +.layui-laydate-content td{width: 36px; height: 30px; padding: 5px; text-align: center;} +.layui-laydate-content th{font-weight: 400;} +.layui-laydate-content td{position: relative; cursor: pointer;} +.laydate-day-mark{position: absolute; left: 0; top: 0; width: 100%; height: 100%; line-height: 30px; font-size: 12px; overflow: hidden;} +.laydate-day-mark::after{position: absolute; content:''; right: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%;} + +/* 底部结构 */ +.layui-laydate-footer{position: relative; height: 46px; line-height: 26px; padding: 10px 20px;} +.layui-laydate-footer span{margin-right: 15px; display: inline-block; cursor: pointer; font-size: 12px;} +.layui-laydate-footer span:hover{color: #5FB878;} +.laydate-footer-btns{position: absolute; right: 10px; top: 10px;} +.laydate-footer-btns span{height: 26px; line-height: 26px; margin: 0 0 0 -1px; padding: 0 10px; border: 1px solid #C9C9C9; background-color: #fff; white-space: nowrap; vertical-align: top; border-radius: 2px;} + +/* 年月列表 */ +.layui-laydate-list{position: absolute; left: 0; top: 0; width: 100%; height: 100%; padding: 10px; box-sizing: border-box; background-color: #fff;} +.layui-laydate-list>li{position: relative; display: inline-block; width: 33.3%; height: 36px; line-height: 36px; margin: 3px 0; vertical-align: middle; text-align: center; cursor: pointer;} +.laydate-month-list>li{width: 25%; margin: 17px 0;} +.laydate-time-list{} +.laydate-time-list>li{height: 100%; margin: 0; line-height: normal; cursor: default;} +.laydate-time-list p{position: relative; top: -4px; line-height: 29px;} +.laydate-time-list ol{height: 181px; overflow: hidden;} +.laydate-time-list>li:hover ol{overflow-y: auto;} +.laydate-time-list ol li{padding-left: 33px; line-height: 30px; text-align: left; cursor: pointer;} + +/* 提示 */ +.layui-laydate-hint{position: absolute; top: 115px; left: 50%; width: 250px; margin-left: -125px; line-height: 20px; padding: 15px; text-align: center; font-size: 12px; color: #FF5722;} + + +/* 双日历 */ +.layui-laydate-range{width: 546px;} +.layui-laydate-range .layui-laydate-main{display: inline-block; vertical-align: middle;} +.layui-laydate-range .laydate-main-list-0 .laydate-next-m, +.layui-laydate-range .laydate-main-list-0 .laydate-next-y, +.layui-laydate-range .laydate-main-list-1 .laydate-prev-y, +.layui-laydate-range .laydate-main-list-1 .laydate-prev-m{display: none;} +.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left: 1px solid #e2e2e2;} + + +/* 默认简约主题 */ +.layui-laydate, .layui-laydate-hint{border: 1px solid #d2d2d2; box-shadow: 0 2px 4px rgba(0,0,0,.12); background-color: #fff; color: #666;} +.layui-laydate-header{border-bottom: 1px solid #e2e2e2;} +.layui-laydate-header i:hover, +.layui-laydate-header span:hover{color: #5FB878;} +.layui-laydate-content{border-top: none 0; border-bottom: none 0;} +.layui-laydate-content th{color: #333;} +.layui-laydate-content td{color: #666;} +.layui-laydate-content td.laydate-selected{background-color: #00F7DE;} +.laydate-selected:hover{background-color: #00F7DE !important;} +.layui-laydate-content td:hover, +.layui-laydate-list li:hover{background-color: #eaeaea; color: #333;} +.laydate-time-list li ol{border: 1px solid #e2e2e2; border-left-width: 0;} +.laydate-time-list li:first-child ol{border-left-width: 1px;} +.laydate-time-list>li:hover{background: none;} +.layui-laydate-content .laydate-day-prev, +.layui-laydate-content .laydate-day-next{color: #d2d2d2;} +.laydate-selected.laydate-day-prev, +.laydate-selected.laydate-day-next{color: #fff !important;} +.layui-laydate-footer{border-top: 1px solid #e2e2e2;} +.layui-laydate-hint{color: #FF5722;} +.laydate-day-mark::after{background-color: #5FB878;} +.layui-laydate-content td.layui-this .laydate-day-mark::after{display: none;} +.layui-laydate-footer span[lay-type="date"]{color: #5FB878;} +.layui-laydate .layui-this{background-color: #009688 !important; color: #fff !important;} +.layui-laydate .laydate-disabled, +.layui-laydate .laydate-disabled:hover{background:none !important; color: #d2d2d2 !important; cursor: not-allowed !important; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;} + +/* 墨绿/自定义背景色主题 */ +.laydate-theme-molv{border: none;} +.laydate-theme-molv.layui-laydate-range{width: 548px} +.laydate-theme-molv .layui-laydate-main{width: 274px;} +.laydate-theme-molv .layui-laydate-header{border: none; background-color: #009688;} +.laydate-theme-molv .layui-laydate-header i, +.laydate-theme-molv .layui-laydate-header span{color: #f6f6f6;} +.laydate-theme-molv .layui-laydate-header i:hover, +.laydate-theme-molv .layui-laydate-header span:hover{color: #fff;} +.laydate-theme-molv .layui-laydate-content{border: 1px solid #e2e2e2; border-top: none; border-bottom: none;} +.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left: none;} +.laydate-theme-molv .layui-laydate-footer{border: 1px solid #e2e2e2;} + +/* 格子主题 */ +.laydate-theme-grid .layui-laydate-content td, +.laydate-theme-grid .layui-laydate-content thead, +.laydate-theme-grid .laydate-year-list>li, +.laydate-theme-grid .laydate-month-list>li{border: 1px solid #e2e2e2;} +.laydate-theme-grid .laydate-selected, +.laydate-theme-grid .laydate-selected:hover{background-color: #f2f2f2 !important; color: #009688 !important;} +.laydate-theme-grid .laydate-selected.laydate-day-prev, +.laydate-theme-grid .laydate-selected.laydate-day-next{color: #d2d2d2 !important;} +.laydate-theme-grid .laydate-year-list, +.laydate-theme-grid .laydate-month-list{margin: 1px 0 0 1px;} +.laydate-theme-grid .laydate-year-list>li, +.laydate-theme-grid .laydate-month-list>li{margin: 0 -1px -1px 0;} +.laydate-theme-grid .laydate-year-list>li{height: 43px; line-height: 43px;} +.laydate-theme-grid .laydate-month-list>li{height: 71px; line-height: 71px;} + diff --git a/test/test.url b/test/test.url new file mode 100644 index 0000000..8587d37 --- /dev/null +++ b/test/test.url @@ -0,0 +1,6 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +URL=http://www.layui.com/laydate/ +IDList= +HotKey=0 From c74d7c4f20c9f0705090da6b4aea468ad8c217f7 Mon Sep 17 00:00:00 2001 From: sentsin Date: Mon, 21 Aug 2017 06:26:16 +0800 Subject: [PATCH 03/26] 5.0.0 --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c460c7e..3c27b6b 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,8 @@ ## 概要 全面重写的 layDate 包含了大量的更新,其中主要以:年选择器、年月选择器、日期选择器、时间选择器、日期时间选择器 五种类型的选择方式为基本核心,并且均支持范围选择(即双控件)。内置强劲的自定义日期格式解析和合法校正机制,含中文版和国际版,主题简约却又不失灵活多样。由于内部采用的是零依赖的原生 JavaScript 编写,因此又可作为独立组件使用。毫无疑问,这是 layui 的虔心之作。 +## 官网 +[http://www.layui.com/laydate/](http://www.layui.com/laydate/) + ## 相关 -[示例与文档](http://www.layui.com/laydate/)、[社区](http://fly.layui.com) \ No newline at end of file +[文档](http://www.layui.com/doc/modules/laydate.html)、[社区](http://fly.layui.com) \ No newline at end of file From e6fcf95fe589841e71b930500bfec7f28b638b1b Mon Sep 17 00:00:00 2001 From: sentsin Date: Mon, 21 Aug 2017 16:37:18 +0800 Subject: [PATCH 04/26] fix css bug --- dist/theme/default/laydate.css | 2 +- src/theme/default/laydate.css | 20 +++----------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/dist/theme/default/laydate.css b/dist/theme/default/laydate.css index 16001ce..f74babf 100644 --- a/dist/theme/default/laydate.css +++ b/dist/theme/default/laydate.css @@ -1,2 +1,2 @@ /*! laydate-v5.0.0 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ -.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/src/theme/default/laydate.css b/src/theme/default/laydate.css index cc5c3fa..4485b1a 100644 --- a/src/theme/default/laydate.css +++ b/src/theme/default/laydate.css @@ -8,22 +8,8 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} -/** 图标字体 **/ -@font-face {font-family: 'laydate-icon'; - src: url('./font/iconfont.eot'); - src: url('./font/iconfont.eot#iefix') format('embedded-opentype'), - url('./font/iconfont.svg#iconfont') format('svg'), - url('./font/iconfont.woff') format('woff'), - url('./font/iconfont.ttf') format('truetype'); -} - -.laydate-icon{ - font-family:"laydate-icon" !important; - font-size: 16px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} +/* 初始化 */ +.layui-laydate *{margin: 0; padding: 0;} /* 主体结构 */ .layui-laydate, .layui-laydate *{box-sizing: border-box;} @@ -122,7 +108,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} .laydate-selected:hover{background-color: #00F7DE !important;} .layui-laydate-content td:hover, .layui-laydate-list li:hover{background-color: #eaeaea; color: #333;} -.laydate-time-list li ol{border: 1px solid #e2e2e2; border-left-width: 0;} +.laydate-time-list li ol{margin: 0; padding: 0; border: 1px solid #e2e2e2; border-left-width: 0;} .laydate-time-list li:first-child ol{border-left-width: 1px;} .laydate-time-list>li:hover{background: none;} .layui-laydate-content .laydate-day-prev, From 51ce00a7d429084fbbfe3a322a4f8ef73d12a6ea Mon Sep 17 00:00:00 2001 From: sentsin Date: Mon, 21 Aug 2017 16:47:40 +0800 Subject: [PATCH 05/26] fix css bug --- dist/theme/default/laydate.css | 2 +- src/theme/default/laydate.css | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dist/theme/default/laydate.css b/dist/theme/default/laydate.css index f74babf..f05c35f 100644 --- a/dist/theme/default/laydate.css +++ b/dist/theme/default/laydate.css @@ -1,2 +1,2 @@ /*! laydate-v5.0.0 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ -.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/src/theme/default/laydate.css b/src/theme/default/laydate.css index 4485b1a..c855ddb 100644 --- a/src/theme/default/laydate.css +++ b/src/theme/default/laydate.css @@ -11,6 +11,23 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} /* 初始化 */ .layui-laydate *{margin: 0; padding: 0;} +/** 图标字体 **/ +@font-face {font-family: 'laydate-icon'; + src: url('./font/iconfont.eot'); + src: url('./font/iconfont.eot#iefix') format('embedded-opentype'), + url('./font/iconfont.svg#iconfont') format('svg'), + url('./font/iconfont.woff') format('woff'), + url('./font/iconfont.ttf') format('truetype'); +} + +.laydate-icon{ + font-family:"laydate-icon" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + /* 主体结构 */ .layui-laydate, .layui-laydate *{box-sizing: border-box;} .layui-laydate{position: absolute; z-index: 66666666; margin: 5px 0; border-radius: 2px; font-size: 14px; -webkit-animation-duration: 0.3s; animation-duration: 0.3s; -webkit-animation-fill-mode: both; animation-fill-mode: both;} From 8245d17a4d98f45084271263c962ef248eb27cb8 Mon Sep 17 00:00:00 2001 From: sentsin Date: Tue, 22 Aug 2017 10:58:11 +0800 Subject: [PATCH 06/26] 5.0.1 --- CHANGELOG.md | 17 +---------------- dist/laydate.js | 4 ++-- dist/theme/default/laydate.css | 2 +- package.json | 2 +- src/laydate.js | 29 ++++++++++++++++++----------- 5 files changed, 23 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2391656..1696a86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,3 @@  -# v5.0.0 - -* 全新重写 -* 支持单独显示年选择器、年月选择器、日期选择器、时间选择器、日期时间选择器 -* 支持双控件,用于选择年/年月/日期/时间/日期时间五种类型选择器的范围(可顺时、逆时) -* 支持日期格式的自定义 -* 支持日期是否合法的自动校验 -* 支持有效日期范围的设定 -* 支持内置事件(可自定义)、外部事件、直接显示等多种调用方式 -* 支持中文版和国际版的语言设定 -* 支持开启公历节日和标记重要日期 -* 支持直接嵌套在页面的某个容器中 -* 支持底部按钮的任意顺序排版 -* 支持智能显示在最佳可视坐标 -* 支持回车快捷键选择 -* 支持多种内置主题的设定,支持自定义主题色,且可单独定制主题 +# [更新日志](http://www.layui.com/laydate/changelog.html) diff --git a/dist/laydate.js b/dist/laydate.js index 229c7e8..45c1c27 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! laydate-v5.0.0 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",y="laydate-day-prev",h="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(t.dateTime)},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):"object"==typeof l?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,y=e?1:0,h=T(r.table[y]).find("td"),f=T(r.elemHeader[y][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(h,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e"+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(h&&y.removeChild(h),y.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),H=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},k=T(m[2]).find("."+g);H(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),k[0]&&k.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),H(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(y)||T(i).hasClass(h)?m:o),s>e&&s80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.1",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):"object"==typeof l?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e"+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&sli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/package.json b/package.json index 2802422..a2047c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "layui-laydate", - "version": "5.0.0", + "version": "5.0.1", "alias": "laydate", "description": "日期与时间组件", "main": "src/laydate.js", diff --git a/src/laydate.js b/src/laydate.js index 8ee9705..3131cb9 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,6 +1,6 @@ /** - @Name : layDate 5.0 日期时间控件 + @Name : layDate 5.0.1 日期时间控件 @Author: 贤心 @Site:http://www.layui.com/laydate/ @License:MIT @@ -55,7 +55,7 @@ } ,laydate = { - v: '5.0' + v: '5.0.1' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath @@ -705,7 +705,9 @@ Class.thisElem = that.elemID; - typeof options.ready === 'function' && options.ready(options.dateTime); + typeof options.ready === 'function' && options.ready(lay.extend({}, options.dateTime, { + month: options.dateTime.month + 1 + })); }; //控件移除 @@ -866,6 +868,8 @@ checkValid(dateTime) }; + if(fn === 'limit') return checkValid(dateTime), that; + value = value || options.value; if(typeof value === 'string'){ value = value.replace(/\s+/g, ' ').replace(/^\s|\s$/g, ''); @@ -1212,7 +1216,7 @@ that.list('month', index); } } else { - that.calendar(); + that.checkDate('limit').calendar(); that.closeList(); } @@ -1516,12 +1520,15 @@ that.startState = true; } lay(that.footer).find(ELEM_CONFIRM)[that.endDate ? 'removeClass' : 'addClass'](DISABLED); - } else if(!(options.type === 'datatime' || options.position === 'static')){ + } else if(options.position === 'static'){ //直接嵌套的选中 + setDateTime(true); + that.calendar().done().done(null, 'change'); + } else if(options.type === 'date'){ setDateTime(true); that.setValue(that.parse()).remove().done(); - } else { + } else if(options.type === 'datetime'){ setDateTime(true); - that.calendar().done().done(null, 'change'); + that.calendar().done(null, 'change'); } }; @@ -1634,7 +1641,7 @@ prevYear: function(){ if(addSubYeay('sub')) return; dateTime.year--; - that.calendar(); + that.checkDate('limit').calendar(); options.range || that.done(null, 'change'); } ,prevMonth: function(){ @@ -1643,7 +1650,7 @@ year: YM[0] ,month: YM[1] }); - that.calendar(); + that.checkDate('limit').calendar(); options.range || that.done(null, 'change'); } ,nextMonth: function(){ @@ -1652,13 +1659,13 @@ year: YM[0] ,month: YM[1] }); - that.calendar(); + that.checkDate('limit').calendar(); options.range || that.done(null, 'change'); } ,nextYear: function(){ if(addSubYeay()) return; dateTime.year++ - that.calendar(); + that.checkDate('limit').calendar(); options.range || that.done(null, 'change'); } }; From 5afb50f9344eed6d71a38b7d1a23723a6a81ccc7 Mon Sep 17 00:00:00 2001 From: sentsin Date: Thu, 24 Aug 2017 08:20:24 +0800 Subject: [PATCH 07/26] 5.0.2 --- dist/laydate.js | 2 +- dist/theme/default/laydate.css | 2 +- src/laydate.js | 18 +++++++++++++----- src/theme/default/laydate.css | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 45c1c27..ef01826 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ /*! laydate-v5.0.1 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.1",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):"object"==typeof l?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e"+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&s80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.2",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e"+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&sli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/src/laydate.js b/src/laydate.js index 3131cb9..8f1552e 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,6 +1,6 @@ /** - @Name : layDate 5.0.1 日期时间控件 + @Name : layDate 5.0.2 日期时间控件 @Author: 贤心 @Site:http://www.layui.com/laydate/ @License:MIT @@ -55,7 +55,7 @@ } ,laydate = { - v: '5.0.1' + v: '5.0.2' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath @@ -874,6 +874,12 @@ if(typeof value === 'string'){ value = value.replace(/\s+/g, ' ').replace(/^\s|\s$/g, ''); } + + //如果点击了开始,单未选择结束就关闭,则重新选择开始 + if(that.startState && !that.endState){ + delete that.startState; + that.endState = true; + }; if(typeof value === 'string' && value){ if(that.EXP_IF.test(value)){ //校验日期格式 @@ -894,7 +900,7 @@ ) + '
        已为你重置'); error = true; } - } else if(typeof value === 'object'){ + } else if(value && value.constructor === Date){ //如果值为日期对象时 options.dateTime = that.systemDate(value); } else { options.dateTime = that.systemDate(); @@ -1587,7 +1593,9 @@ ,confirm: function(){ if(options.range){ if(!that.endDate) return that.hint('请先选择日期范围'); - if(lay(btn).hasClass(DISABLED)) return; + if(lay(btn).hasClass(DISABLED)) return that.hint( + options.type === 'time' ? TIPS_OUT.replace(/日期/g, '时间') : TIPS_OUT + ); } else { if(lay(btn).hasClass(DISABLED)) return that.hint('不在有效日期或时间范围内'); } @@ -1763,8 +1771,8 @@ that.remove(); }).on('keydown', function(e){ if(e.keyCode === 13){ - e.preventDefault(); if(lay('#'+ that.elemID)[0] && that.elemID === Class.thisElem){ + e.preventDefault(); lay(that.footer).find(ELEM_CONFIRM)[0].click(); } } diff --git a/src/theme/default/laydate.css b/src/theme/default/laydate.css index c855ddb..72202e5 100644 --- a/src/theme/default/laydate.css +++ b/src/theme/default/laydate.css @@ -97,7 +97,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} .laydate-time-list p{position: relative; top: -4px; line-height: 29px;} .laydate-time-list ol{height: 181px; overflow: hidden;} .laydate-time-list>li:hover ol{overflow-y: auto;} -.laydate-time-list ol li{padding-left: 33px; line-height: 30px; text-align: left; cursor: pointer;} +.laydate-time-list ol li{width: 130%; padding-left: 33px; line-height: 30px; text-align: left; cursor: pointer;} /* 提示 */ .layui-laydate-hint{position: absolute; top: 115px; left: 50%; width: 250px; margin-left: -125px; line-height: 20px; padding: 15px; text-align: center; font-size: 12px; color: #FF5722;} From 2754c84e41fa81ded1a20b77344fe38c05234522 Mon Sep 17 00:00:00 2001 From: sentsin Date: Fri, 25 Aug 2017 12:28:10 +0800 Subject: [PATCH 08/26] 5.0.2 --- .gitignore | 19 ++++++++ dist/laydate.js | 2 +- dist/theme/default/laydate.css | 2 +- gulpfile.js | 12 +++++ package.json | 2 +- release/doc/test.html | 39 +++++++++++++++ .../\345\256\230\347\275\221.url" | 6 +++ .../\346\226\207\346\241\243.url" | 8 ++++ .../\347\244\276\345\214\272.url" | 8 ++++ ...4\346\226\260\346\227\245\345\277\227.url" | 6 +++ release/layDate-v5.0.2/laydate/laydate.js | 2 + .../laydate/theme/default/font/iconfont.eot | Bin 0 -> 2456 bytes .../laydate/theme/default/font/iconfont.svg | 45 ++++++++++++++++++ .../laydate/theme/default/font/iconfont.ttf | Bin 0 -> 2272 bytes .../laydate/theme/default/font/iconfont.woff | Bin 0 -> 1492 bytes .../laydate/theme/default/laydate.css | 2 + release/layDate-v5.0.2/test.html | 39 +++++++++++++++ .../\345\256\230\347\275\221.url" | 6 +++ .../\346\226\207\346\241\243.url" | 8 ++++ .../\347\244\276\345\214\272.url" | 8 ++++ ...4\346\226\260\346\227\245\345\277\227.url" | 6 +++ release/laydate.bat | 1 + 22 files changed, 218 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 release/doc/test.html create mode 100644 "release/doc/\346\226\207\346\241\243/\345\256\230\347\275\221.url" create mode 100644 "release/doc/\346\226\207\346\241\243/\346\226\207\346\241\243.url" create mode 100644 "release/doc/\346\226\207\346\241\243/\347\244\276\345\214\272.url" create mode 100644 "release/doc/\346\233\264\346\226\260\346\227\245\345\277\227.url" create mode 100644 release/layDate-v5.0.2/laydate/laydate.js create mode 100644 release/layDate-v5.0.2/laydate/theme/default/font/iconfont.eot create mode 100644 release/layDate-v5.0.2/laydate/theme/default/font/iconfont.svg create mode 100644 release/layDate-v5.0.2/laydate/theme/default/font/iconfont.ttf create mode 100644 release/layDate-v5.0.2/laydate/theme/default/font/iconfont.woff create mode 100644 release/layDate-v5.0.2/laydate/theme/default/laydate.css create mode 100644 release/layDate-v5.0.2/test.html create mode 100644 "release/layDate-v5.0.2/\346\226\207\346\241\243/\345\256\230\347\275\221.url" create mode 100644 "release/layDate-v5.0.2/\346\226\207\346\241\243/\346\226\207\346\241\243.url" create mode 100644 "release/layDate-v5.0.2/\346\226\207\346\241\243/\347\244\276\345\214\272.url" create mode 100644 "release/layDate-v5.0.2/\346\233\264\346\226\260\346\227\245\345\277\227.url" create mode 100644 release/laydate.bat diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8129410 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +*.iml +.idea/ +.ipr +.iws +*~ +~* +*.diff +*.patch +*.bak +.DS_Store +Thumbs.db +.svn/ +*.swp +.nojekyll +.project +.settings/ +node_modules/ +_site/ +.npmignore diff --git a/dist/laydate.js b/dist/laydate.js index ef01826..0b2a759 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! laydate-v5.0.1 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ +/*! laydate-v5.0.2 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.2",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e"+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&sli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 042701e..18354eb 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,6 +11,10 @@ var rename = require('gulp-rename'); var header = require('gulp-header'); var del = require('del'); +//发行版本目录 +var releaseDir = './release/layDate-v' + pkg.version; +var release = releaseDir + '/laydate'; + var task = { laydate: function() { gulp.src('./src/**/*.css') @@ -38,6 +42,14 @@ gulp.task('clear', function(cb){ //清理 gulp.task('laydate', task.minjs); //压缩PC版本 gulp.task('other', task.other); //移动一些配件 +gulp.task('r', function(){ + gulp.src('./release/doc/**/*') + .pipe(gulp.dest(releaseDir)) + + return gulp.src('./dist/**/*') + .pipe(gulp.dest(releaseDir + '/laydate')) +}); + //全部 gulp.task('default', ['clear'], function(){ for(var key in task){ diff --git a/package.json b/package.json index a2047c1..7373030 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "layui-laydate", - "version": "5.0.1", + "version": "5.0.2", "alias": "laydate", "description": "日期与时间组件", "main": "src/laydate.js", diff --git a/release/doc/test.html b/release/doc/test.html new file mode 100644 index 0000000..68e15bc --- /dev/null +++ b/release/doc/test.html @@ -0,0 +1,39 @@ + + + + + 使用 layDate 独立版 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/release/doc/\346\226\207\346\241\243/\345\256\230\347\275\221.url" "b/release/doc/\346\226\207\346\241\243/\345\256\230\347\275\221.url" new file mode 100644 index 0000000..8587d37 --- /dev/null +++ "b/release/doc/\346\226\207\346\241\243/\345\256\230\347\275\221.url" @@ -0,0 +1,6 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +URL=http://www.layui.com/laydate/ +IDList= +HotKey=0 diff --git "a/release/doc/\346\226\207\346\241\243/\346\226\207\346\241\243.url" "b/release/doc/\346\226\207\346\241\243/\346\226\207\346\241\243.url" new file mode 100644 index 0000000..14a8b76 --- /dev/null +++ "b/release/doc/\346\226\207\346\241\243/\346\226\207\346\241\243.url" @@ -0,0 +1,8 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +URL=http://www.layui.com/doc/modules/laydate.html +IDList= +HotKey=0 +IconIndex=0 +IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe diff --git "a/release/doc/\346\226\207\346\241\243/\347\244\276\345\214\272.url" "b/release/doc/\346\226\207\346\241\243/\347\244\276\345\214\272.url" new file mode 100644 index 0000000..a2d508d --- /dev/null +++ "b/release/doc/\346\226\207\346\241\243/\347\244\276\345\214\272.url" @@ -0,0 +1,8 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +URL=http://fly.layui.com/ +IDList= +HotKey=0 +IconIndex=0 +IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe diff --git "a/release/doc/\346\233\264\346\226\260\346\227\245\345\277\227.url" "b/release/doc/\346\233\264\346\226\260\346\227\245\345\277\227.url" new file mode 100644 index 0000000..1dc10b0 --- /dev/null +++ "b/release/doc/\346\233\264\346\226\260\346\227\245\345\277\227.url" @@ -0,0 +1,6 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +URL=http://www.layui.com/laydate/changelog.html +IDList= +HotKey=0 diff --git a/release/layDate-v5.0.2/laydate/laydate.js b/release/layDate-v5.0.2/laydate/laydate.js new file mode 100644 index 0000000..0b2a759 --- /dev/null +++ b/release/layDate-v5.0.2/laydate/laydate.js @@ -0,0 +1,2 @@ +/*! laydate-v5.0.2 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ + ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.2",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e"+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&svs$|eAFngtr$Wyy=ZNkcq#`CiW=yMTg}p(M>y3Vn%m zT0=85NqNe_K&9ParfANzDS`>mIG7^M!b;d^G(<5Pgy#R|fm%3GM-`H3aL1lkwq7*8 z{2kH7GEPDBGK8+RJ(tFakU{6_h{*~g4v5Pqb-F?@t^s_12Lgng&6~A1e z3JmP%#Zof%S=^U4h$0%1m;IKCGxnG?STVXEcSH%^K^q{u@e>JMuFBPknuxtzm8$zq z1Oa1&h1eI7_%cRe1r`xLrt853cuZ~()tf7i+3SmaFWU_+R#M1XEYI$`nb8%+1%2k z%F*snawCO^Y1T}o3RKAecOC@#gvD!21fo$=vlOp5Z_#3pGY#{*&J)>UnL{5>JR ze44$%X!~2n^U~+s+|eEKZCYdO?BCoJ*BaeN>;3*#zyG9LaXQ_Sib#Q%av~6r(gSN__d^eE`_q2GJD-~{BrK#sPuWVb1|M9j!qrcU)qQM<( zYv^9x#7FPc1sm(bk)IK&$jaKE(p|a1%&c`DjxvWv_>^&Ygm+2THyX3X>_#@f1xxIr z9$v@Noe|?OpBgbPF0sQd*RIJ|@wWS@gEXQ>9*zf^TpkWIDP03R^q|a}`MfV0R*kcq z^0h~Ny)s{b?1QYU;i%ecyulT|00_$XM40ySiH8Ugi&*=H{FU5CE2xvYh&-%xMG^=q zk{FJ6@DO+2PjvH;e91_uk+919jW5(tM2+%M<8345i-c6(2P!NmF7ul(3q^dqk0*pK zYP|Ol0T29i%Y4s;H_d3)>%z#^W*bZ7f^QZtgYUJm12|!0Co0Ak8!O;nu(6l=Xs?ay zkeeqEF*{Hh=}G#~#*BjWjg2J~vL9?LgTHHI2k<{Oc2WQ}!J0>*AotnWOXIxF#&s0o zkGr-=?WN|6A6p!o0*_nJ!8;T7srFZB# zy|^&%?2)N>sg%~z#e7y9#R7UJlh+Ex{2_g^6q_!U3L6Fn#KMA)P3E)sG;Tvx*6kXe zLc$$HP1pXb(r!3H@9f6JrGQb)YOx+>OGYRV$O`D?%C@2H?EkwLvA2UxiS&@ + + + + +Created by iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/release/layDate-v5.0.2/laydate/theme/default/font/iconfont.ttf b/release/layDate-v5.0.2/laydate/theme/default/font/iconfont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0bd6c4a88dd899aea3926e49bdfb37e81004bcb9 GIT binary patch literal 2272 zcmc&#TWl0n82KNt^83(# zg?zD)t!0$i8_?xTMAC*uJ(*TNe&s#beh-;i1mU_VzX^O9vU)LBsrLK~M0_1xFk46^ zr3uc!{~UBRm#h}Kn+{?=2wlr3bNaq(&fP>#o6Yvf-j z&hVAUDTBRF+nsqbOr{uCUA;&pW1q#?Do{l=BIcMi#aY`Y16FvCVMLYS z9kda;8<(iP+K?ObO;LNbAvF$|2nu|Jh1eH{oeVEzU{T>iYW5a9r0gwe+fBU7X2iZ% zZNU;7*i#{5ZyR_XLd0`v9I!+@w#K|A_6a;nZ_`Kg9fx3vXw4tw%W{x9X@n+eJK-H+ zWt4|hDa?b>L`)jx?m=gFPnRl3hogh8;h~uP1osRnU4i&iBGRL{6d$YH&yNkpr=l?_ z%IgxFrA-_UgqeF+_3ibq3HjwS>+8Ne@Q5_P?Y+^yUHdz*hM|Oo~2vU#t}X}ZCq@z!!9?k%2)8V`)GhPqE4QQ2fADy z4s{*&X^?9Lu}5E6&L&H( zR4bm-OXa0PUYm?fw9-5Dyk5E!w|sOVUa4fXOsSC5W|2V8W(!)eR5+}sDzU{%rMPi? zTqG8JELF(i)3}XFq*IbA=+iiGhp2{riBeRcJY~$j0=q11YOt^@*Zya*2Yw5*Y|fV+ zX!RiPIe3?-jA$a8hL1&zCLS1N2dwj^$KC5K(^0G6DLx95k(XKllwJ=C6?L2PFC1OTvcj?W!%ck U%LUx7>Qb_{RMXw|I4MH>3rdt+EdT%j literal 0 HcmV?d00001 diff --git a/release/layDate-v5.0.2/laydate/theme/default/font/iconfont.woff b/release/layDate-v5.0.2/laydate/theme/default/font/iconfont.woff new file mode 100644 index 0000000000000000000000000000000000000000..bfe5599671f9441ceebdc8afeac71d4f65a741c7 GIT binary patch literal 1492 zcmY+Ec~Fx_7{)gwfRsQv0;F70?g7dvDTi_k2q?&X&U_&x2IUmw6v>BjMv!1R4M!=} zat=&T#2N_qQ9*2LQO=SDwfF%7h8S8TISJOqsY87jqJohDAyMQ=D)by+U2j;o((iXckC^DV zczE72m}3s{H1!QBN@7!xFa+U;7E&h2NPO&;2$_!{WCke2Q%=!RR6X#c*wHpdxVQ@K za*hDVQ^UH0&wKXz%uuu#yEzG=wzb3;(!RdM}$9bAdD=wplNTO;eyZC zaM2&yfiXjyZ6~lQXuFf+y6i;QlGYzd46q#^XH64j1zTk6hocD0jQb}8QIei?v+m!M zEs8<;=~df(i=8GaG;6EG(;}OU%e5Cb6m4jH3UrA!c?--Pi$T{%cW?w z*{9i}HN@-Md30G>345QLyekC9!Ul1&jl{R8jh&8VsBKL`7^4}hX0rIT%BTTieK%sF zs%v3xCAH4opxhz-QmdM;TIszbHRsw-;u^EBC`g8uzt30JX$z=NVUHAC6|Jm$*iu{J zUsWx()qYk+4^yD2KlIe&omj5!hY};(WhWc1V9qE-R-oRBt)nSWB%q-e;y}w&9mH-9D+eGe@vp`sKnL{YUT8p0R+=*_e&4;lmC$ zd=&ik7f4f|kb9C5tI34j7B7RQQs(WN8S@o#?8Q6FCAHgHYr?ZT9h=PJ6CH!YS-4)K zcaJxS(}NwkQ(mdkuh?(u@+Gf6YnvL_^H2LUM49?H+SMv4a`yC%;Q_-fZid)Ar^uDa zeo(e(Gn~`dQO2a{+{0&Eh*rMdbbi~Ca#cfo$4_mC_H)AKHo^Zw!0g_*6-T+*%T0tO zrh6hTL}x5Jz;!-vUswtMM9Xv~ygxQ5jZYrckbTiv!94Q3ES%6Rp}d&;SFbmcW!YHi zZQzb}&wh+K^QG?)1cW|5tgAe*HGPrFr;!2LC>%Dfy1K9BPb?clgT;k33$=l#v?%4j z{4ed-3j}P6SQwdB3~<5=M8h5?BM5S7gvaY;_zM4h8wll4 z7(xXYO_gNl76v?MZS?o+4;ntE=S8 zF&atkofJ(AjZ703tsWd|{E<1yO;4Nxr^6Kcj&!H6C-W z(`|q5eC8*5XP!ls-sGxvP{KqnbIGD*b5y}$iTwf-T_RYq+Zx=fVf9_P-1@4Bva?qzk-sa0xR#X8sMG&6E_&HiQKEtgx3 z>LtfIQt8)xnzrY;Yf+EB*DOR&shTfhb@0-ik46GN42H;azKOR$cS5Xl&6XwPzf#7( zRFpCaYtr3ymQWjRB`O~G2;TY7X;p5q+7h_!%j12);&&J2W5A7dm CyJwOB literal 0 HcmV?d00001 diff --git a/release/layDate-v5.0.2/laydate/theme/default/laydate.css b/release/layDate-v5.0.2/laydate/theme/default/laydate.css new file mode 100644 index 0000000..051b025 --- /dev/null +++ b/release/layDate-v5.0.2/laydate/theme/default/laydate.css @@ -0,0 +1,2 @@ +/*! laydate-v5.0.2 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/release/layDate-v5.0.2/test.html b/release/layDate-v5.0.2/test.html new file mode 100644 index 0000000..68e15bc --- /dev/null +++ b/release/layDate-v5.0.2/test.html @@ -0,0 +1,39 @@ + + + + + 使用 layDate 独立版 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/release/layDate-v5.0.2/\346\226\207\346\241\243/\345\256\230\347\275\221.url" "b/release/layDate-v5.0.2/\346\226\207\346\241\243/\345\256\230\347\275\221.url" new file mode 100644 index 0000000..8587d37 --- /dev/null +++ "b/release/layDate-v5.0.2/\346\226\207\346\241\243/\345\256\230\347\275\221.url" @@ -0,0 +1,6 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +URL=http://www.layui.com/laydate/ +IDList= +HotKey=0 diff --git "a/release/layDate-v5.0.2/\346\226\207\346\241\243/\346\226\207\346\241\243.url" "b/release/layDate-v5.0.2/\346\226\207\346\241\243/\346\226\207\346\241\243.url" new file mode 100644 index 0000000..14a8b76 --- /dev/null +++ "b/release/layDate-v5.0.2/\346\226\207\346\241\243/\346\226\207\346\241\243.url" @@ -0,0 +1,8 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +URL=http://www.layui.com/doc/modules/laydate.html +IDList= +HotKey=0 +IconIndex=0 +IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe diff --git "a/release/layDate-v5.0.2/\346\226\207\346\241\243/\347\244\276\345\214\272.url" "b/release/layDate-v5.0.2/\346\226\207\346\241\243/\347\244\276\345\214\272.url" new file mode 100644 index 0000000..a2d508d --- /dev/null +++ "b/release/layDate-v5.0.2/\346\226\207\346\241\243/\347\244\276\345\214\272.url" @@ -0,0 +1,8 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +URL=http://fly.layui.com/ +IDList= +HotKey=0 +IconIndex=0 +IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe diff --git "a/release/layDate-v5.0.2/\346\233\264\346\226\260\346\227\245\345\277\227.url" "b/release/layDate-v5.0.2/\346\233\264\346\226\260\346\227\245\345\277\227.url" new file mode 100644 index 0000000..1dc10b0 --- /dev/null +++ "b/release/layDate-v5.0.2/\346\233\264\346\226\260\346\227\245\345\277\227.url" @@ -0,0 +1,6 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +URL=http://www.layui.com/laydate/changelog.html +IDList= +HotKey=0 diff --git a/release/laydate.bat b/release/laydate.bat new file mode 100644 index 0000000..953809e --- /dev/null +++ b/release/laydate.bat @@ -0,0 +1 @@ +gulp && gulp r \ No newline at end of file From e9953ed08ce4581b51af224ae8db005b8ea97dad Mon Sep 17 00:00:00 2001 From: sentsin Date: Fri, 25 Aug 2017 12:28:42 +0800 Subject: [PATCH 09/26] 5.0.2 --- release/doc/test.html | 39 --------------- .../\345\256\230\347\275\221.url" | 6 --- .../\346\226\207\346\241\243.url" | 8 ---- .../\347\244\276\345\214\272.url" | 8 ---- ...4\346\226\260\346\227\245\345\277\227.url" | 6 --- release/layDate-v5.0.2/laydate/laydate.js | 2 - .../laydate/theme/default/font/iconfont.eot | Bin 2456 -> 0 bytes .../laydate/theme/default/font/iconfont.svg | 45 ------------------ .../laydate/theme/default/font/iconfont.ttf | Bin 2272 -> 0 bytes .../laydate/theme/default/font/iconfont.woff | Bin 1492 -> 0 bytes .../laydate/theme/default/laydate.css | 2 - release/layDate-v5.0.2/test.html | 39 --------------- .../\345\256\230\347\275\221.url" | 6 --- .../\346\226\207\346\241\243.url" | 8 ---- .../\347\244\276\345\214\272.url" | 8 ---- ...4\346\226\260\346\227\245\345\277\227.url" | 6 --- release/laydate.bat | 1 - 17 files changed, 184 deletions(-) delete mode 100644 release/doc/test.html delete mode 100644 "release/doc/\346\226\207\346\241\243/\345\256\230\347\275\221.url" delete mode 100644 "release/doc/\346\226\207\346\241\243/\346\226\207\346\241\243.url" delete mode 100644 "release/doc/\346\226\207\346\241\243/\347\244\276\345\214\272.url" delete mode 100644 "release/doc/\346\233\264\346\226\260\346\227\245\345\277\227.url" delete mode 100644 release/layDate-v5.0.2/laydate/laydate.js delete mode 100644 release/layDate-v5.0.2/laydate/theme/default/font/iconfont.eot delete mode 100644 release/layDate-v5.0.2/laydate/theme/default/font/iconfont.svg delete mode 100644 release/layDate-v5.0.2/laydate/theme/default/font/iconfont.ttf delete mode 100644 release/layDate-v5.0.2/laydate/theme/default/font/iconfont.woff delete mode 100644 release/layDate-v5.0.2/laydate/theme/default/laydate.css delete mode 100644 release/layDate-v5.0.2/test.html delete mode 100644 "release/layDate-v5.0.2/\346\226\207\346\241\243/\345\256\230\347\275\221.url" delete mode 100644 "release/layDate-v5.0.2/\346\226\207\346\241\243/\346\226\207\346\241\243.url" delete mode 100644 "release/layDate-v5.0.2/\346\226\207\346\241\243/\347\244\276\345\214\272.url" delete mode 100644 "release/layDate-v5.0.2/\346\233\264\346\226\260\346\227\245\345\277\227.url" delete mode 100644 release/laydate.bat diff --git a/release/doc/test.html b/release/doc/test.html deleted file mode 100644 index 68e15bc..0000000 --- a/release/doc/test.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - 使用 layDate 独立版 - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/release/doc/\346\226\207\346\241\243/\345\256\230\347\275\221.url" "b/release/doc/\346\226\207\346\241\243/\345\256\230\347\275\221.url" deleted file mode 100644 index 8587d37..0000000 --- "a/release/doc/\346\226\207\346\241\243/\345\256\230\347\275\221.url" +++ /dev/null @@ -1,6 +0,0 @@ -[{000214A0-0000-0000-C000-000000000046}] -Prop3=19,2 -[InternetShortcut] -URL=http://www.layui.com/laydate/ -IDList= -HotKey=0 diff --git "a/release/doc/\346\226\207\346\241\243/\346\226\207\346\241\243.url" "b/release/doc/\346\226\207\346\241\243/\346\226\207\346\241\243.url" deleted file mode 100644 index 14a8b76..0000000 --- "a/release/doc/\346\226\207\346\241\243/\346\226\207\346\241\243.url" +++ /dev/null @@ -1,8 +0,0 @@ -[{000214A0-0000-0000-C000-000000000046}] -Prop3=19,2 -[InternetShortcut] -URL=http://www.layui.com/doc/modules/laydate.html -IDList= -HotKey=0 -IconIndex=0 -IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe diff --git "a/release/doc/\346\226\207\346\241\243/\347\244\276\345\214\272.url" "b/release/doc/\346\226\207\346\241\243/\347\244\276\345\214\272.url" deleted file mode 100644 index a2d508d..0000000 --- "a/release/doc/\346\226\207\346\241\243/\347\244\276\345\214\272.url" +++ /dev/null @@ -1,8 +0,0 @@ -[{000214A0-0000-0000-C000-000000000046}] -Prop3=19,2 -[InternetShortcut] -URL=http://fly.layui.com/ -IDList= -HotKey=0 -IconIndex=0 -IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe diff --git "a/release/doc/\346\233\264\346\226\260\346\227\245\345\277\227.url" "b/release/doc/\346\233\264\346\226\260\346\227\245\345\277\227.url" deleted file mode 100644 index 1dc10b0..0000000 --- "a/release/doc/\346\233\264\346\226\260\346\227\245\345\277\227.url" +++ /dev/null @@ -1,6 +0,0 @@ -[{000214A0-0000-0000-C000-000000000046}] -Prop3=19,2 -[InternetShortcut] -URL=http://www.layui.com/laydate/changelog.html -IDList= -HotKey=0 diff --git a/release/layDate-v5.0.2/laydate/laydate.js b/release/layDate-v5.0.2/laydate/laydate.js deleted file mode 100644 index 0b2a759..0000000 --- a/release/layDate-v5.0.2/laydate/laydate.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! laydate-v5.0.2 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.2",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e"+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&svs$|eAFngtr$Wyy=ZNkcq#`CiW=yMTg}p(M>y3Vn%m zT0=85NqNe_K&9ParfANzDS`>mIG7^M!b;d^G(<5Pgy#R|fm%3GM-`H3aL1lkwq7*8 z{2kH7GEPDBGK8+RJ(tFakU{6_h{*~g4v5Pqb-F?@t^s_12Lgng&6~A1e z3JmP%#Zof%S=^U4h$0%1m;IKCGxnG?STVXEcSH%^K^q{u@e>JMuFBPknuxtzm8$zq z1Oa1&h1eI7_%cRe1r`xLrt853cuZ~()tf7i+3SmaFWU_+R#M1XEYI$`nb8%+1%2k z%F*snawCO^Y1T}o3RKAecOC@#gvD!21fo$=vlOp5Z_#3pGY#{*&J)>UnL{5>JR ze44$%X!~2n^U~+s+|eEKZCYdO?BCoJ*BaeN>;3*#zyG9LaXQ_Sib#Q%av~6r(gSN__d^eE`_q2GJD-~{BrK#sPuWVb1|M9j!qrcU)qQM<( zYv^9x#7FPc1sm(bk)IK&$jaKE(p|a1%&c`DjxvWv_>^&Ygm+2THyX3X>_#@f1xxIr z9$v@Noe|?OpBgbPF0sQd*RIJ|@wWS@gEXQ>9*zf^TpkWIDP03R^q|a}`MfV0R*kcq z^0h~Ny)s{b?1QYU;i%ecyulT|00_$XM40ySiH8Ugi&*=H{FU5CE2xvYh&-%xMG^=q zk{FJ6@DO+2PjvH;e91_uk+919jW5(tM2+%M<8345i-c6(2P!NmF7ul(3q^dqk0*pK zYP|Ol0T29i%Y4s;H_d3)>%z#^W*bZ7f^QZtgYUJm12|!0Co0Ak8!O;nu(6l=Xs?ay zkeeqEF*{Hh=}G#~#*BjWjg2J~vL9?LgTHHI2k<{Oc2WQ}!J0>*AotnWOXIxF#&s0o zkGr-=?WN|6A6p!o0*_nJ!8;T7srFZB# zy|^&%?2)N>sg%~z#e7y9#R7UJlh+Ex{2_g^6q_!U3L6Fn#KMA)P3E)sG;Tvx*6kXe zLc$$HP1pXb(r!3H@9f6JrGQb)YOx+>OGYRV$O`D?%C@2H?EkwLvA2UxiS&@ - - - - -Created by iconfont - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/release/layDate-v5.0.2/laydate/theme/default/font/iconfont.ttf b/release/layDate-v5.0.2/laydate/theme/default/font/iconfont.ttf deleted file mode 100644 index 0bd6c4a88dd899aea3926e49bdfb37e81004bcb9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2272 zcmc&#TWl0n82KNt^83(# zg?zD)t!0$i8_?xTMAC*uJ(*TNe&s#beh-;i1mU_VzX^O9vU)LBsrLK~M0_1xFk46^ zr3uc!{~UBRm#h}Kn+{?=2wlr3bNaq(&fP>#o6Yvf-j z&hVAUDTBRF+nsqbOr{uCUA;&pW1q#?Do{l=BIcMi#aY`Y16FvCVMLYS z9kda;8<(iP+K?ObO;LNbAvF$|2nu|Jh1eH{oeVEzU{T>iYW5a9r0gwe+fBU7X2iZ% zZNU;7*i#{5ZyR_XLd0`v9I!+@w#K|A_6a;nZ_`Kg9fx3vXw4tw%W{x9X@n+eJK-H+ zWt4|hDa?b>L`)jx?m=gFPnRl3hogh8;h~uP1osRnU4i&iBGRL{6d$YH&yNkpr=l?_ z%IgxFrA-_UgqeF+_3ibq3HjwS>+8Ne@Q5_P?Y+^yUHdz*hM|Oo~2vU#t}X}ZCq@z!!9?k%2)8V`)GhPqE4QQ2fADy z4s{*&X^?9Lu}5E6&L&H( zR4bm-OXa0PUYm?fw9-5Dyk5E!w|sOVUa4fXOsSC5W|2V8W(!)eR5+}sDzU{%rMPi? zTqG8JELF(i)3}XFq*IbA=+iiGhp2{riBeRcJY~$j0=q11YOt^@*Zya*2Yw5*Y|fV+ zX!RiPIe3?-jA$a8hL1&zCLS1N2dwj^$KC5K(^0G6DLx95k(XKllwJ=C6?L2PFC1OTvcj?W!%ck U%LUx7>Qb_{RMXw|I4MH>3rdt+EdT%j diff --git a/release/layDate-v5.0.2/laydate/theme/default/font/iconfont.woff b/release/layDate-v5.0.2/laydate/theme/default/font/iconfont.woff deleted file mode 100644 index bfe5599671f9441ceebdc8afeac71d4f65a741c7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1492 zcmY+Ec~Fx_7{)gwfRsQv0;F70?g7dvDTi_k2q?&X&U_&x2IUmw6v>BjMv!1R4M!=} zat=&T#2N_qQ9*2LQO=SDwfF%7h8S8TISJOqsY87jqJohDAyMQ=D)by+U2j;o((iXckC^DV zczE72m}3s{H1!QBN@7!xFa+U;7E&h2NPO&;2$_!{WCke2Q%=!RR6X#c*wHpdxVQ@K za*hDVQ^UH0&wKXz%uuu#yEzG=wzb3;(!RdM}$9bAdD=wplNTO;eyZC zaM2&yfiXjyZ6~lQXuFf+y6i;QlGYzd46q#^XH64j1zTk6hocD0jQb}8QIei?v+m!M zEs8<;=~df(i=8GaG;6EG(;}OU%e5Cb6m4jH3UrA!c?--Pi$T{%cW?w z*{9i}HN@-Md30G>345QLyekC9!Ul1&jl{R8jh&8VsBKL`7^4}hX0rIT%BTTieK%sF zs%v3xCAH4opxhz-QmdM;TIszbHRsw-;u^EBC`g8uzt30JX$z=NVUHAC6|Jm$*iu{J zUsWx()qYk+4^yD2KlIe&omj5!hY};(WhWc1V9qE-R-oRBt)nSWB%q-e;y}w&9mH-9D+eGe@vp`sKnL{YUT8p0R+=*_e&4;lmC$ zd=&ik7f4f|kb9C5tI34j7B7RQQs(WN8S@o#?8Q6FCAHgHYr?ZT9h=PJ6CH!YS-4)K zcaJxS(}NwkQ(mdkuh?(u@+Gf6YnvL_^H2LUM49?H+SMv4a`yC%;Q_-fZid)Ar^uDa zeo(e(Gn~`dQO2a{+{0&Eh*rMdbbi~Ca#cfo$4_mC_H)AKHo^Zw!0g_*6-T+*%T0tO zrh6hTL}x5Jz;!-vUswtMM9Xv~ygxQ5jZYrckbTiv!94Q3ES%6Rp}d&;SFbmcW!YHi zZQzb}&wh+K^QG?)1cW|5tgAe*HGPrFr;!2LC>%Dfy1K9BPb?clgT;k33$=l#v?%4j z{4ed-3j}P6SQwdB3~<5=M8h5?BM5S7gvaY;_zM4h8wll4 z7(xXYO_gNl76v?MZS?o+4;ntE=S8 zF&atkofJ(AjZ703tsWd|{E<1yO;4Nxr^6Kcj&!H6C-W z(`|q5eC8*5XP!ls-sGxvP{KqnbIGD*b5y}$iTwf-T_RYq+Zx=fVf9_P-1@4Bva?qzk-sa0xR#X8sMG&6E_&HiQKEtgx3 z>LtfIQt8)xnzrY;Yf+EB*DOR&shTfhb@0-ik46GN42H;azKOR$cS5Xl&6XwPzf#7( zRFpCaYtr3ymQWjRB`O~G2;TY7X;p5q+7h_!%j12);&&J2W5A7dm CyJwOB diff --git a/release/layDate-v5.0.2/laydate/theme/default/laydate.css b/release/layDate-v5.0.2/laydate/theme/default/laydate.css deleted file mode 100644 index 051b025..0000000 --- a/release/layDate-v5.0.2/laydate/theme/default/laydate.css +++ /dev/null @@ -1,2 +0,0 @@ -/*! laydate-v5.0.2 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ -.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/release/layDate-v5.0.2/test.html b/release/layDate-v5.0.2/test.html deleted file mode 100644 index 68e15bc..0000000 --- a/release/layDate-v5.0.2/test.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - 使用 layDate 独立版 - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/release/layDate-v5.0.2/\346\226\207\346\241\243/\345\256\230\347\275\221.url" "b/release/layDate-v5.0.2/\346\226\207\346\241\243/\345\256\230\347\275\221.url" deleted file mode 100644 index 8587d37..0000000 --- "a/release/layDate-v5.0.2/\346\226\207\346\241\243/\345\256\230\347\275\221.url" +++ /dev/null @@ -1,6 +0,0 @@ -[{000214A0-0000-0000-C000-000000000046}] -Prop3=19,2 -[InternetShortcut] -URL=http://www.layui.com/laydate/ -IDList= -HotKey=0 diff --git "a/release/layDate-v5.0.2/\346\226\207\346\241\243/\346\226\207\346\241\243.url" "b/release/layDate-v5.0.2/\346\226\207\346\241\243/\346\226\207\346\241\243.url" deleted file mode 100644 index 14a8b76..0000000 --- "a/release/layDate-v5.0.2/\346\226\207\346\241\243/\346\226\207\346\241\243.url" +++ /dev/null @@ -1,8 +0,0 @@ -[{000214A0-0000-0000-C000-000000000046}] -Prop3=19,2 -[InternetShortcut] -URL=http://www.layui.com/doc/modules/laydate.html -IDList= -HotKey=0 -IconIndex=0 -IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe diff --git "a/release/layDate-v5.0.2/\346\226\207\346\241\243/\347\244\276\345\214\272.url" "b/release/layDate-v5.0.2/\346\226\207\346\241\243/\347\244\276\345\214\272.url" deleted file mode 100644 index a2d508d..0000000 --- "a/release/layDate-v5.0.2/\346\226\207\346\241\243/\347\244\276\345\214\272.url" +++ /dev/null @@ -1,8 +0,0 @@ -[{000214A0-0000-0000-C000-000000000046}] -Prop3=19,2 -[InternetShortcut] -URL=http://fly.layui.com/ -IDList= -HotKey=0 -IconIndex=0 -IconFile=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe diff --git "a/release/layDate-v5.0.2/\346\233\264\346\226\260\346\227\245\345\277\227.url" "b/release/layDate-v5.0.2/\346\233\264\346\226\260\346\227\245\345\277\227.url" deleted file mode 100644 index 1dc10b0..0000000 --- "a/release/layDate-v5.0.2/\346\233\264\346\226\260\346\227\245\345\277\227.url" +++ /dev/null @@ -1,6 +0,0 @@ -[{000214A0-0000-0000-C000-000000000046}] -Prop3=19,2 -[InternetShortcut] -URL=http://www.layui.com/laydate/changelog.html -IDList= -HotKey=0 diff --git a/release/laydate.bat b/release/laydate.bat deleted file mode 100644 index 953809e..0000000 --- a/release/laydate.bat +++ /dev/null @@ -1 +0,0 @@ -gulp && gulp r \ No newline at end of file From e0f5c6f312f9dcd35f99f002663db3f0d00f74a1 Mon Sep 17 00:00:00 2001 From: sentsin Date: Fri, 25 Aug 2017 12:30:52 +0800 Subject: [PATCH 10/26] 5.0.2 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8129410..9435309 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ Thumbs.db .settings/ node_modules/ _site/ +release/ .npmignore From 44a0847074c02cee4ecfe857c06ac6b595a9ab79 Mon Sep 17 00:00:00 2001 From: sentsin Date: Wed, 30 Aug 2017 18:01:51 +0800 Subject: [PATCH 11/26] 5.0.3 --- dist/laydate.js | 4 ++-- dist/theme/default/laydate.css | 2 +- package.json | 21 ++++++++++++++++++--- src/laydate.js | 33 +++++++++++++++++++++++---------- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 0b2a759..cbf8ce5 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! laydate-v5.0.2 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.2",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e"+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&s80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.3",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&en.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(T(i),r,t),M++}),T(u[f?0:1]).attr("lay-ym",M-8+"-"+w[1]).html(b+D+" - "+(M-1+D))}else if("month"===e)T.each(new Array(12),function(e){var i=T.elem("li",{"lay-ym":e}),s={year:w[0],month:e};e+1==w[1]&&T(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),w[0]n.firstDate.year&&(s.date=a.max.date),n.limit(T(i),s,t)}),T(u[f?0:1]).attr("lay-ym",w[0]+"-"+w[1]).html(w[0]+D);else if("time"===e){var E=function(){T(d).find("ol").each(function(e,a){T(a).find("li").each(function(a,i){n.limit(T(i),[{hours:a},{hours:n[C].hours,minutes:a},{hours:n[C].hours,minutes:n[C].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(T(n.footer).find(p),n[C],0,["hours","minutes","seconds"])};a.range?n[C]||(n[C]={hours:0,minutes:0,seconds:0}):n[C]=i,T.each([24,60,60],function(e,t){var a=T.elem("li"),i=["

        "+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[C][x[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[C][x[e]]=r:i[x[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&sli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/package.json b/package.json index 7373030..ae830ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "layui-laydate", - "version": "5.0.2", + "version": "5.0.3", "alias": "laydate", "description": "日期与时间组件", "main": "src/laydate.js", @@ -10,7 +10,7 @@ }, "repository": { "type": "https", - "url": "https://github.com/sentsin/laydate.git" + "url": "git+https://github.com/sentsin/laydate.git" }, "author": "贤心", "homepage": "http://www.layui.com/laydate/", @@ -21,5 +21,20 @@ "gulp-rename": "^1.2.2", "gulp-header": "^1.8.8", "del": "^2.2.2" - } + }, + "bugs": { + "url": "https://github.com/sentsin/laydate/issues" + }, + "directories": { + "test": "test" + }, + "dependencies": {}, + "keywords": [ + "laydate", + "date", + "time", + "datetime", + "datepicker", + "calendar" + ] } diff --git a/src/laydate.js b/src/laydate.js index 8f1552e..f22cea3 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,6 +1,6 @@ /** - @Name : layDate 5.0.2 日期时间控件 + @Name : layDate 5.0.3 日期时间控件 @Author: 贤心 @Site:http://www.layui.com/laydate/ @License:MIT @@ -55,7 +55,7 @@ } ,laydate = { - v: '5.0.2' + v: '5.0.3' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath @@ -945,7 +945,6 @@ ,options = that.config, timestrap = {} ,dateTime = options[index > 41 ? 'endDate' : 'dateTime'] ,isOut, thisDateTime = lay.extend({}, dateTime, date || {}); - lay.each({ now: thisDateTime ,min: options.min @@ -1118,12 +1117,18 @@ lay.each(new Array(15), function(i){ var li = lay.elem('li', { 'lay-ym': yearNum - }); + }), ymd = {year: yearNum}; yearNum == listYM[0] && lay(li).addClass(THIS); li.innerHTML = yearNum + text; ul.appendChild(li); - - that.limit(lay(li), {year: yearNum}, index); + if(yearNum < that.firstDate.year){ + ymd.month = options.min.month; + ymd.date = options.min.date; + } else if(yearNum > that.firstDate.year){ + ymd.month = options.max.month; + ymd.date = options.max.date; + } + that.limit(lay(li), ymd, index); yearNum++; }); lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', (yearNum - 8) + '-' + listYM[1]) @@ -1132,12 +1137,16 @@ lay.each(new Array(12), function(i){ var li = lay.elem('li', { 'lay-ym': i - }); + }), ymd = {year: listYM[0], month: i}; i + 1 == listYM[1] && lay(li).addClass(THIS); li.innerHTML = lang.month[i] + (isCN ? '月' : ''); ul.appendChild(li); - - that.limit(lay(li), {year: listYM[0], month: i}, index); + if(listYM[0] < that.firstDate.year){ + ymd.date = options.min.date; + } else if(listYM[0] > that.firstDate.year){ + ymd.date = options.max.date; + } + that.limit(lay(li), ymd, index); }); lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', listYM[0] + '-' + listYM[1]) .html(listYM[0] + text); @@ -1704,8 +1713,12 @@ //选择年月 lay(header[2]).find('span').on('click', function(e){ var othis = lay(this) - ,layYM = othis.attr('lay-ym').split('-') + ,layYM = othis.attr('lay-ym') ,layType = othis.attr('lay-type'); + + if(!layYM) return; + + layYM = layYM.split('-'); that.listYM[i] = [layYM[0] | 0, layYM[1] | 0]; that.list(layType, i); From 7c4c57b55b75ced98a2794a1886a37b1bcc47bc6 Mon Sep 17 00:00:00 2001 From: sentsin Date: Fri, 1 Sep 2017 07:53:17 +0800 Subject: [PATCH 12/26] 5.0.4 --- dist/laydate.js | 4 ++-- dist/theme/default/laydate.css | 2 +- package.json | 2 +- src/laydate.js | 17 +++++++++++------ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index cbf8ce5..2a85223 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! laydate-v5.0.3 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.3",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&en.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(T(i),r,t),M++}),T(u[f?0:1]).attr("lay-ym",M-8+"-"+w[1]).html(b+D+" - "+(M-1+D))}else if("month"===e)T.each(new Array(12),function(e){var i=T.elem("li",{"lay-ym":e}),s={year:w[0],month:e};e+1==w[1]&&T(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),w[0]n.firstDate.year&&(s.date=a.max.date),n.limit(T(i),s,t)}),T(u[f?0:1]).attr("lay-ym",w[0]+"-"+w[1]).html(w[0]+D);else if("time"===e){var E=function(){T(d).find("ol").each(function(e,a){T(a).find("li").each(function(a,i){n.limit(T(i),[{hours:a},{hours:n[C].hours,minutes:a},{hours:n[C].hours,minutes:n[C].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(T(n.footer).find(p),n[C],0,["hours","minutes","seconds"])};a.range?n[C]||(n[C]={hours:0,minutes:0,seconds:0}):n[C]=i,T.each([24,60,60],function(e,t){var a=T.elem("li"),i=["

        "+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[C][x[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[C][x[e]]=r:i[x[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&s80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.4",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return"function"==typeof define&&define.amd?a():(e?layui.addcss(o,a,i):t.link(o,a,i),this)}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.value&&e.setValue(t.value),t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(T(i),r,t),M++}),T(u[f?0:1]).attr("lay-ym",M-8+"-"+w[1]).html(b+D+" - "+(M-1+D))}else if("month"===e)T.each(new Array(12),function(e){var i=T.elem("li",{"lay-ym":e}),s={year:w[0],month:e};e+1==w[1]&&T(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),w[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(T(i),s,t)}),T(u[f?0:1]).attr("lay-ym",w[0]+"-"+w[1]).html(w[0]+D);else if("time"===e){var E=function(){T(d).find("ol").each(function(e,a){T(a).find("li").each(function(a,i){n.limit(T(i),[{hours:a},{hours:n[C].hours,minutes:a},{hours:n[C].hours,minutes:n[C].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(T(n.footer).find(p),n[C],0,["hours","minutes","seconds"])};a.range?n[C]||(n[C]={hours:0,minutes:0,seconds:0}):n[C]=i,T.each([24,60,60],function(e,t){var a=T.elem("li"),i=["

        "+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[C][x[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[C][x[e]]=r:i[x[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&sli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/package.json b/package.json index ae830ce..da8201d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "layui-laydate", - "version": "5.0.3", + "version": "5.0.4", "alias": "laydate", "description": "日期与时间组件", "main": "src/laydate.js", diff --git a/src/laydate.js b/src/laydate.js index f22cea3..5f975d4 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,6 +1,6 @@ /** - @Name : layDate 5.0.3 日期时间控件 + @Name : layDate 5.0.4 日期时间控件 @Author: 贤心 @Site:http://www.layui.com/laydate/ @License:MIT @@ -55,7 +55,7 @@ } ,laydate = { - v: '5.0.3' + v: '5.0.4' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath @@ -71,6 +71,7 @@ ,ready: function(fn){ var cssname = 'laydate', ver = '' ,path = (isLayui ? 'modules/laydate/' : 'theme/') + 'default/laydate.css?v='+ laydate.v + ver; + if(typeof define === 'function' && define.amd) return fn(); isLayui ? layui.addcss(path, fn, cssname) : ready.link(path, fn, cssname); return this; } @@ -438,6 +439,9 @@ options.eventElem = lay(options.eventElem); if(!options.elem[0]) return; + + //默认赋值 + options.value && that.setValue(options.value); //日期范围分隔符 if(options.range === true) options.range = '-'; @@ -927,10 +931,11 @@ Class.prototype.mark = function(td, YMD){ var that = this ,mark, options = that.config; - lay.each(options.mark, function(key, title){ var keys = key.split('-'); - if((keys[0] == YMD[0] || keys[0] == 0) && keys[1] == YMD[1] && keys[2] == YMD[2]){ + if((keys[0] == YMD[0] || keys[0] == 0) //每年的每月 + && (keys[1] == YMD[1] || keys[1] == 0) //每月的每日 + && keys[2] == YMD[2]){ //特定日 mark = title || YMD[2]; } }); @@ -1124,7 +1129,7 @@ if(yearNum < that.firstDate.year){ ymd.month = options.min.month; ymd.date = options.min.date; - } else if(yearNum > that.firstDate.year){ + } else if(yearNum >= that.firstDate.year){ ymd.month = options.max.month; ymd.date = options.max.date; } @@ -1143,7 +1148,7 @@ ul.appendChild(li); if(listYM[0] < that.firstDate.year){ ymd.date = options.min.date; - } else if(listYM[0] > that.firstDate.year){ + } else if(listYM[0] >= that.firstDate.year){ ymd.date = options.max.date; } that.limit(lay(li), ymd, index); From 286a40b2023379c446d390fd0c1a0fbf5a1d6df9 Mon Sep 17 00:00:00 2001 From: sentsin Date: Sun, 3 Sep 2017 18:15:54 +0800 Subject: [PATCH 13/26] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/laydate.js | 4 ++-- dist/theme/default/laydate.css | 2 +- package.json | 4 ++-- src/laydate.js | 23 +++++++++++++++-------- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 2a85223..7c8b19f 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! laydate-v5.0.4 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.4",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return"function"==typeof define&&define.amd?a():(e?layui.addcss(o,a,i):t.link(o,a,i),this)}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.value&&e.setValue(t.value),t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(T(i),r,t),M++}),T(u[f?0:1]).attr("lay-ym",M-8+"-"+w[1]).html(b+D+" - "+(M-1+D))}else if("month"===e)T.each(new Array(12),function(e){var i=T.elem("li",{"lay-ym":e}),s={year:w[0],month:e};e+1==w[1]&&T(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),w[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(T(i),s,t)}),T(u[f?0:1]).attr("lay-ym",w[0]+"-"+w[1]).html(w[0]+D);else if("time"===e){var E=function(){T(d).find("ol").each(function(e,a){T(a).find("li").each(function(a,i){n.limit(T(i),[{hours:a},{hours:n[C].hours,minutes:a},{hours:n[C].hours,minutes:n[C].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(T(n.footer).find(p),n[C],0,["hours","minutes","seconds"])};a.range?n[C]||(n[C]={hours:0,minutes:0,seconds:0}):n[C]=i,T.each([24,60,60],function(e,t){var a=T.elem("li"),i=["

        "+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[C][x[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[C][x[e]]=r:i[x[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e){var t=this,n=t.config,a=e?T.extend({},t.endDate,t.endTime):n.range?T.extend({},t.startDate,t.startTime):n.dateTime,i=t.format.concat();return T.each(i,function(e,t){/yyyy|y/.test(t)?i[e]=T.digit(a.year,t.length):/MM|M/.test(t)?i[e]=T.digit(a.month+1,t.length):/dd|d/.test(t)?i[e]=T.digit(a.date,t.length):/HH|H/.test(t)?i[e]=T.digit(a.hours,t.length):/mm|m/.test(t)?i[e]=T.digit(a.minutes,t.length):/ss|s/.test(t)&&(i[e]=T.digit(a.seconds,t.length))}),n.range&&!e?i.join("")+" "+n.range+" "+t.parse(1):i.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&s80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.5",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return"function"==typeof define&&define.amd?a():(e?layui.addcss(o,a,i):t.link(o,a,i),this)}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(T(i),r,t),M++}),T(u[f?0:1]).attr("lay-ym",M-8+"-"+w[1]).html(b+D+" - "+(M-1+D))}else if("month"===e)T.each(new Array(12),function(e){var i=T.elem("li",{"lay-ym":e}),s={year:w[0],month:e};e+1==w[1]&&T(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),w[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(T(i),s,t)}),T(u[f?0:1]).attr("lay-ym",w[0]+"-"+w[1]).html(w[0]+D);else if("time"===e){var E=function(){T(d).find("ol").each(function(e,a){T(a).find("li").each(function(a,i){n.limit(T(i),[{hours:a},{hours:n[C].hours,minutes:a},{hours:n[C].hours,minutes:n[C].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(T(n.footer).find(p),n[C],0,["hours","minutes","seconds"])};a.range?n[C]||(n[C]={hours:0,minutes:0,seconds:0}):n[C]=i,T.each([24,60,60],function(e,t){var a=T.elem("li"),i=["

        "+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(T(n.footer).find(p),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[C][x[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[C][x[e]]=r:i[x[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?T.extend({},n.endDate,n.endTime):a.range?T.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return T.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=T.digit(i.year,t.length):/MM|M/.test(t)?r[e]=T.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=T.digit(i.date,t.length):/HH|H/.test(t)?r[e]=T.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=T.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=T.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&sli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/package.json b/package.json index da8201d..9f05112 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ -{ +{ "name": "layui-laydate", - "version": "5.0.4", + "version": "5.0.5", "alias": "laydate", "description": "日期与时间组件", "main": "src/laydate.js", diff --git a/src/laydate.js b/src/laydate.js index 5f975d4..b9d3d6b 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,6 +1,6 @@ /** - @Name : layDate 5.0.4 日期时间控件 + @Name : layDate 5.0.5 日期时间控件 @Author: 贤心 @Site:http://www.layui.com/laydate/ @License:MIT @@ -55,7 +55,7 @@ } ,laydate = { - v: '5.0.4' + v: '5.0.5' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath @@ -440,9 +440,6 @@ if(!options.elem[0]) return; - //默认赋值 - options.value && that.setValue(options.value); - //日期范围分隔符 if(options.range === true) options.range = '-'; @@ -536,6 +533,15 @@ if(options.show || isStatic) that.render(); isStatic || that.events(); + + //默认赋值 + if(options.value){ + if(options.value.constructor === Date){ + that.setValue(that.parse(0, that.systemDate(options.value))); + } else { + that.setValue(options.value); + } + } }; //控件主体渲染 @@ -1211,6 +1217,7 @@ if(index === 0){ dateTime[type] = ym; if(isAlone) that.startDate[type] = ym; + that.limit(lay(that.footer).find(ELEM_CONFIRM), null, 0); } else { //范围选择 if(isAlone){ //非date/datetime类型 that.endDate[type] = ym; @@ -1337,12 +1344,12 @@ }; //转义为规定格式的日期字符 - Class.prototype.parse = function(state){ + Class.prototype.parse = function(state, date){ var that = this ,options = that.config - ,dateTime = state + ,dateTime = date || (state ? lay.extend({}, that.endDate, that.endTime) - : (options.range ? lay.extend({}, that.startDate, that.startTime) : options.dateTime) + : (options.range ? lay.extend({}, that.startDate, that.startTime) : options.dateTime)) ,format = that.format.concat(); //转义为规定格式 From 60c03454bdd9b7404e44316170b5cd7005fe160e Mon Sep 17 00:00:00 2001 From: sentsin Date: Wed, 13 Sep 2017 13:08:02 +0800 Subject: [PATCH 14/26] 5.0.6 --- dist/laydate.js | 4 +-- dist/theme/default/laydate.css | 4 +-- gulpfile.js | 7 +++-- package.json | 2 +- src/laydate.js | 49 +++++++++++++++++----------------- src/theme/default/laydate.css | 26 +++++++++--------- 6 files changed, 48 insertions(+), 44 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 7c8b19f..390e832 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! laydate-v5.0.5 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.5",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return"function"==typeof define&&define.amd?a():(e?layui.addcss(o,a,i):t.link(o,a,i),this)}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-list",m="laydate-selected",u="layui-laydate-hint",h="laydate-day-prev",y="laydate-day-next",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v=".laydate-btns-time",D=function(e){var t=this;t.index=++n.index,t.config=T.extend({},t.config,n.config,e),n.ready(function(){t.init()})},T=function(e){return new w(e)},w=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},w.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},w.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},w.prototype.val=function(e){return this.each(function(t,n){n.value=e})},w.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},w.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},w.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},w.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},D.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=T(t.elem),t.eventElem=T(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",T.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\b\\d{1,"+function(){return/yyyy/.test(a)?4:/y/.test(a)?308:2}()+"}\\b":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+(e.EXP_SPLIT?"|":"")+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp(e.EXP_SPLIT,"g"),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=T.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),T.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=T.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=T.elem("div",{"class":"laydate-set-ym"}),t=T.elem("span"),n=T.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=T.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=T.elem("div",{"class":"layui-laydate-content"}),c=T.elem("table"),m=T.elem("thead"),u=T.elem("tr");T.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),T.each(new Array(6),function(e){var t=c.insertRow(0);T.each(new Array(7),function(a){if(0===e){var i=T.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=T.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),T(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),T.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),T.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var c=T.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,T(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),D.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(T.extend({},t.dateTime,{month:t.dateTime.month+1}))},D.prototype.remove=function(){var e=this,t=e.config,n=T("#"+e.elemID);return n[0]&&"static"!==t.position&&e.checkDate(function(){n.remove()}),e},D.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},D.prototype.hint=function(e){var t=this,n=(t.config,T.elem("div",{"class":u}));n.innerHTML=e||"",T(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){T(t.elem).find("."+u).remove()},3e3)},D.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=t.match(i.EXP_SPLIT),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),T.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},D.prototype.mark=function(e,t){var n,a=this,i=a.config;return T.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},D.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=T.extend({},d,t||{});return T.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(T.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return T.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},D.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=T(r.table[h]).find("td"),f=T(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=T.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),T.each(y,function(e,n){var d=[l.year,l.month],c=0;n=T(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(T(i),r,t),M++}),T(u[f?0:1]).attr("lay-ym",M-8+"-"+w[1]).html(b+D+" - "+(M-1+D))}else if("month"===e)T.each(new Array(12),function(e){var i=T.elem("li",{"lay-ym":e}),s={year:w[0],month:e};e+1==w[1]&&T(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),w[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(T(i),s,t)}),T(u[f?0:1]).attr("lay-ym",w[0]+"-"+w[1]).html(w[0]+D);else if("time"===e){var E=function(){T(d).find("ol").each(function(e,a){T(a).find("li").each(function(a,i){n.limit(T(i),[{hours:a},{hours:n[C].hours,minutes:a},{hours:n[C].hours,minutes:n[C].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(T(n.footer).find(p),n[C],0,["hours","minutes","seconds"])};a.range?n[C]||(n[C]={hours:0,minutes:0,seconds:0}):n[C]=i,T.each([24,60,60],function(e,t){var a=T.elem("li"),i=["

        "+r.time[e]+"

          "];T.each(new Array(t),function(t){i.push(""+T.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)T(n.elemMain[t]).addClass("laydate-ym-show"),T(d).find("li").on("click",function(){var r=0|T(this).attr("lay-ym");if(!T(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(T(n.footer).find(p),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,w[1]-1,"sub"):n.getAsYM(w[0],r,"sub");T.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(T(d).find("."+o).removeClass(o),T(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),T(n.footer).find(v).removeClass(s)}});else{var S=T.elem("span",{"class":g}),k=function(){T(d).find("ol").each(function(e){var t=this,a=T(t).find("li");t.scrollTop=30*(n[C][x[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!T(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=T(m[2]).find("."+g);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,T(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),m[2].appendChild(S),T(d).find("ol").each(function(e){var t=this;T(t).find("li").on("click",function(){var r=0|this.innerHTML;T(this).hasClass(s)||(a.range?n[C][x[e]]=r:i[x[e]]=r,T(t).find("."+o).removeClass(o),T(this).addClass(o),n.setBtnStatus(null,T.extend({},n.systemDate(),n.startTime),T.extend({},n.systemDate(),n.endTime)),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"))})})}return n},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;T.each(e.elemCont,function(t,n){T(this).find("."+c).remove(),T(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),T(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=T(i.footer).find(p),d=r.range&&"date"!==r.type&&"datetime"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},D.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?T.extend({},n.endDate,n.endTime):a.range?T.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return T.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=T.digit(i.year,t.length):/MM|M/.test(t)?r[e]=T.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=T.digit(i.date,t.length):/HH|H/.test(t)?r[e]=T.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=T.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=T.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},D.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||T(a)[i](e||""),this},D.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=T(n.elem).find("td");if(a.range&&!n.endDate&&T(n.footer).find(p).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void T.each(i,function(a,i){var r=T(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();T(i).removeClass(m+" "+o),s!==e&&s!==t||T(i).addClass(T(i).hasClass(h)||T(i).hasClass(y)?m:o),s>e&&s80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.6",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return"function"==typeof define&&define.amd?a():(e?layui.addcss(o,a,i):t.link(o,a,i),this)}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElem),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n[0]&&!n.hasClass(c)&&t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&sli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file +/*! laydate-v5.0.6 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 18354eb..f074aed 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,7 +12,7 @@ var header = require('gulp-header'); var del = require('del'); //发行版本目录 -var releaseDir = './release/layDate-v' + pkg.version; +var releaseDir = './release/zip/layDate-v' + pkg.version; var release = releaseDir + '/laydate'; var task = { @@ -42,7 +42,10 @@ gulp.task('clear', function(cb){ //清理 gulp.task('laydate', task.minjs); //压缩PC版本 gulp.task('other', task.other); //移动一些配件 -gulp.task('r', function(){ +gulp.task('clearZip', function(cb){ //清理 + return del(['./release/zip/*'], cb); +}); +gulp.task('r', ['clearZip'], function(){ gulp.src('./release/doc/**/*') .pipe(gulp.dest(releaseDir)) diff --git a/package.json b/package.json index 9f05112..6267136 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "layui-laydate", - "version": "5.0.5", + "version": "5.0.6", "alias": "laydate", "description": "日期与时间组件", "main": "src/laydate.js", diff --git a/src/laydate.js b/src/laydate.js index b9d3d6b..ca30988 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,6 +1,6 @@ /** - @Name : layDate 5.0.5 日期时间控件 + @Name : layDate 5.0.6 日期时间控件 @Author: 贤心 @Site:http://www.layui.com/laydate/ @License:MIT @@ -55,7 +55,7 @@ } ,laydate = { - v: '5.0.5' + v: '5.0.6' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath @@ -92,7 +92,7 @@ //字符常量 ,MOD_NAME = 'laydate', ELEM = '.layui-laydate', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'laydate-disabled', TIPS_OUT = '开始日期超出了结束日期
        建议重新选择', LIMIT_YEAR = [100, 200000] - ,ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = '.laydate-btns-time' + ,ELEM_STATIC = 'layui-laydate-static', ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = '.laydate-btns-time' //组件构造器 ,Class = function(options){ @@ -456,21 +456,25 @@ that.EXP_SPLIT = ''; lay.each(that.format, function(i, item){ var EXP = new RegExp(dateType).test(item) - ? '\\b\\d{1,'+ function(){ - if(/yyyy/.test(item)) return 4; - if(/y/.test(item)) return 308; - return 2; - }() +'}\\b' + ? '\\d{'+ function(){ + if(new RegExp(dateType).test(that.format[i === 0 ? i + 1 : i - 1]||'')){ + if(/^yyyy|y$/.test(item)) return 4; + return item.length; + } + if(/^yyyy$/.test(item)) return '1,4'; + if(/^y$/.test(item)) return '1,308'; + return '1,2'; + }() +'}' : '\\' + item; that.EXP_IF = that.EXP_IF + EXP; - that.EXP_SPLIT = that.EXP_SPLIT + (that.EXP_SPLIT ? '|' : '') + '('+ EXP + ')'; + that.EXP_SPLIT = that.EXP_SPLIT + '(' + EXP + ')'; }); that.EXP_IF = new RegExp('^'+ ( options.range ? that.EXP_IF + '\\s\\'+ options.range + '\\s' + that.EXP_IF : that.EXP_IF ) +'$'); - that.EXP_SPLIT = new RegExp(that.EXP_SPLIT, 'g'); + that.EXP_SPLIT = new RegExp('^'+ that.EXP_SPLIT +'$', ''); //如果不是input|textarea元素,则默认采用click事件 if(!that.isInput(options.elem[0])){ @@ -557,7 +561,7 @@ ,'class': [ 'layui-laydate' ,options.range ? ' layui-laydate-range' : '' - ,isStatic ? ' layui-laydate-static' : '' + ,isStatic ? (' '+ ELEM_STATIC) : '' ,options.theme && options.theme !== 'default' && !/^#/.test(options.theme) ? (' laydate-theme-' + options.theme) : '' ].join('') }) @@ -702,7 +706,7 @@ } //移除上一个控件 - that.remove(); + that.remove(Class.thisElem); //如果是静态定位,则插入到指定的容器中,否则,插入到body isStatic ? options.elem.append(elem) : ( @@ -721,11 +725,11 @@ }; //控件移除 - Class.prototype.remove = function(){ + Class.prototype.remove = function(prev){ var that = this ,options = that.config - ,elem = lay('#'+ that.elemID); - if(elem[0] && options.position !== 'static'){ + ,elem = lay('#'+ (prev || that.elemID)); + if(elem[0] && !elem.hasClass(ELEM_STATIC)){ that.checkDate(function(){ elem.remove(); }); @@ -844,7 +848,7 @@ //获得初始化日期值 ,initDate = function(dateTime, value, index){ var startEnd = ['startTime', 'endTime']; - value = value.match(that.EXP_SPLIT); + value = (value.match(that.EXP_SPLIT) || []).slice(1); index = index || 0; if(options.range){ that[startEnd[index]] = that[startEnd[index]] || {}; @@ -1288,16 +1292,13 @@ } lay(ol).find('.'+ THIS).removeClass(THIS); lay(this).addClass(THIS); - - //同步按钮可点状态 - that.setBtnStatus( - null - ,lay.extend({}, that.systemDate(), that.startTime) - ,lay.extend({}, that.systemDate(), that.endTime) - ); + setTimeStatus(); scroll(); (that.endDate || options.type === 'time') && that.done(null, 'change'); + + //同步按钮可点状态 + that.setBtnStatus(); }); }); } @@ -1325,7 +1326,7 @@ var that = this ,options = that.config ,isOut, elemBtn = lay(that.footer).find(ELEM_CONFIRM) - ,isAlone = options.range && options.type !== 'date' && options.type !== 'datetime'; + ,isAlone = options.range && options.type !== 'date' && options.type !== 'time'; if(isAlone){ start = start || that.startDate; end = end || that.endDate; diff --git a/src/theme/default/laydate.css b/src/theme/default/laydate.css index 72202e5..a2987aa 100644 --- a/src/theme/default/laydate.css +++ b/src/theme/default/laydate.css @@ -1,16 +1,3 @@ -/** - - @Name: laydata - @Author: 贤心 - - **/ - - -html #layuicss-laydate{display: none; position: absolute; width: 1989px;} - -/* 初始化 */ -.layui-laydate *{margin: 0; padding: 0;} - /** 图标字体 **/ @font-face {font-family: 'laydate-icon'; src: url('./font/iconfont.eot'); @@ -28,6 +15,19 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} -moz-osx-font-smoothing: grayscale; } +/** + + @Name: laydata + @Author: 贤心 + + **/ + + +html #layuicss-laydate{display: none; position: absolute; width: 1989px;} + +/* 初始化 */ +.layui-laydate *{margin: 0; padding: 0;} + /* 主体结构 */ .layui-laydate, .layui-laydate *{box-sizing: border-box;} .layui-laydate{position: absolute; z-index: 66666666; margin: 5px 0; border-radius: 2px; font-size: 14px; -webkit-animation-duration: 0.3s; animation-duration: 0.3s; -webkit-animation-fill-mode: both; animation-fill-mode: both;} From 2c8c9e384b391a750f53daa0285b39196a319ab6 Mon Sep 17 00:00:00 2001 From: sentsin Date: Thu, 14 Sep 2017 10:49:38 +0800 Subject: [PATCH 15/26] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gulpfile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/gulpfile.js b/gulpfile.js index f074aed..4be7cae 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -42,6 +42,7 @@ gulp.task('clear', function(cb){ //清理 gulp.task('laydate', task.minjs); //压缩PC版本 gulp.task('other', task.other); //移动一些配件 +//打包发行版 gulp.task('clearZip', function(cb){ //清理 return del(['./release/zip/*'], cb); }); From 898ec1d05d5474b9aa73c9746d63aefc1173236d Mon Sep 17 00:00:00 2001 From: sentsin Date: Fri, 15 Sep 2017 09:43:56 +0800 Subject: [PATCH 16/26] 5.0.7 --- dist/laydate.js | 4 ++-- dist/theme/default/laydate.css | 2 +- gulpfile.js | 4 ++-- package.json | 4 ++-- src/laydate.js | 5 ++--- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 390e832..5b8032d 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! laydate-v5.0.6 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.6",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return"function"==typeof define&&define.amd?a():(e?layui.addcss(o,a,i):t.link(o,a,i),this)}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElem),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n[0]&&!n.hasClass(c)&&t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&s80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.7",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElem),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n[0]&&!n.hasClass(c)&&t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&sli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 4be7cae..8bd2b59 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -21,11 +21,11 @@ var task = { .pipe(minify({ compatibility: 'ie7' })) - .pipe(header('/*! <%= pkg.alias %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %> By <%= pkg.author %> */\n', {pkg: pkg})) + .pipe(header('/*! <%= pkg.realname %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %> By <%= pkg.author %> */\n', {pkg: pkg})) .pipe(gulp.dest('./dist')); return gulp.src('./src/laydate.js').pipe(uglify()) - .pipe(header('/*! <%= pkg.alias %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %> By <%= pkg.author %> */\n ;', {pkg: pkg})) + .pipe(header('/*! <%= pkg.realname %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %> By <%= pkg.author %> */\n ;', {pkg: pkg})) .pipe(gulp.dest('./dist')); } diff --git a/package.json b/package.json index 6267136..51d0ac8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "layui-laydate", - "version": "5.0.6", - "alias": "laydate", + "realname": "laydate", + "version": "5.0.7", "description": "日期与时间组件", "main": "src/laydate.js", "license": "MIT", diff --git a/src/laydate.js b/src/laydate.js index ca30988..40026e7 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,6 +1,6 @@ /** - @Name : layDate 5.0.6 日期时间控件 + @Name : layDate 5.0.7 日期时间控件 @Author: 贤心 @Site:http://www.layui.com/laydate/ @License:MIT @@ -55,7 +55,7 @@ } ,laydate = { - v: '5.0.6' + v: '5.0.7' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath @@ -71,7 +71,6 @@ ,ready: function(fn){ var cssname = 'laydate', ver = '' ,path = (isLayui ? 'modules/laydate/' : 'theme/') + 'default/laydate.css?v='+ laydate.v + ver; - if(typeof define === 'function' && define.amd) return fn(); isLayui ? layui.addcss(path, fn, cssname) : ready.link(path, fn, cssname); return this; } From a5d90f1f054690211aa419e101ae1f148c3b791c Mon Sep 17 00:00:00 2001 From: sentsin Date: Thu, 2 Nov 2017 23:00:33 +0800 Subject: [PATCH 17/26] 5.0.8 --- dist/laydate.js | 4 ++-- dist/theme/default/laydate.css | 2 +- package.json | 2 +- src/laydate.js | 18 +++++++++--------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 5b8032d..c3f3f3f 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! laydate-v5.0.7 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.7",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElem),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElem=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n[0]&&!n.hasClass(c)&&t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&s80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.8",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n.hasClass(c)||t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month||12,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&sli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/package.json b/package.json index 51d0ac8..3c29c83 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "layui-laydate", "realname": "laydate", - "version": "5.0.7", + "version": "5.0.8", "description": "日期与时间组件", "main": "src/laydate.js", "license": "MIT", diff --git a/src/laydate.js b/src/laydate.js index 40026e7..3f96674 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,6 +1,6 @@ /** - @Name : layDate 5.0.7 日期时间控件 + @Name : layDate 5.0.8 日期时间控件 @Author: 贤心 @Site:http://www.layui.com/laydate/ @License:MIT @@ -55,7 +55,7 @@ } ,laydate = { - v: '5.0.7' + v: '5.0.8' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath @@ -162,7 +162,7 @@ //中止冒泡 lay.stope = function(e){ - e = e || win.event; + e = e || window.event; e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; @@ -705,7 +705,7 @@ } //移除上一个控件 - that.remove(Class.thisElem); + that.remove(Class.thisElemDate); //如果是静态定位,则插入到指定的容器中,否则,插入到body isStatic ? options.elem.append(elem) : ( @@ -716,8 +716,8 @@ that.checkDate().calendar(); //初始校验 that.changeEvent(); //日期切换 - Class.thisElem = that.elemID; - + Class.thisElemDate = that.elemID; + typeof options.ready === 'function' && options.ready(lay.extend({}, options.dateTime, { month: options.dateTime.month + 1 })); @@ -728,7 +728,7 @@ var that = this ,options = that.config ,elem = lay('#'+ (prev || that.elemID)); - if(elem[0] && !elem.hasClass(ELEM_STATIC)){ + if(!elem.hasClass(ELEM_STATIC)){ that.checkDate(function(){ elem.remove(); }); @@ -1006,8 +1006,8 @@ //计算当前月第一天的星期 thisDate.setFullYear(dateTime.year, dateTime.month, 1); startWeek = thisDate.getDay(); - - prevMaxDate = laydate.getEndDate(dateTime.month, dateTime.year); //计算上个月的最后一天 + + prevMaxDate = laydate.getEndDate(dateTime.month || 12, dateTime.year); //计算上个月的最后一天 thisMaxDate = laydate.getEndDate(dateTime.month + 1, dateTime.year); //计算当前月的最后一天 //赋值日 From 4803de1dba2cf730db1f2a08e1a67a4781f00422 Mon Sep 17 00:00:00 2001 From: sentsin Date: Thu, 16 Nov 2017 07:57:23 +0800 Subject: [PATCH 18/26] 5.0.85 --- dist/laydate.js | 4 ++-- dist/theme/default/laydate.css | 4 ++-- package.json | 2 +- src/laydate.js | 4 ++-- src/theme/default/laydate.css | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index c3f3f3f..41e2bc1 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! laydate-v5.0.8 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.8",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n.hasClass(c)||t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month||12,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&s80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.85",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n.hasClass(c)||t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month||12,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&sli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{color:#fff!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file +/*! laydate-v5.0.85 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/package.json b/package.json index 3c29c83..f8ff2e7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "layui-laydate", "realname": "laydate", - "version": "5.0.8", + "version": "5.0.85", "description": "日期与时间组件", "main": "src/laydate.js", "license": "MIT", diff --git a/src/laydate.js b/src/laydate.js index 3f96674..6b20069 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,6 +1,6 @@ /** - @Name : layDate 5.0.8 日期时间控件 + @Name : layDate 5.0.85 日期时间控件 @Author: 贤心 @Site:http://www.layui.com/laydate/ @License:MIT @@ -55,7 +55,7 @@ } ,laydate = { - v: '5.0.8' + v: '5.0.85' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath diff --git a/src/theme/default/laydate.css b/src/theme/default/laydate.css index a2987aa..5d1e033 100644 --- a/src/theme/default/laydate.css +++ b/src/theme/default/laydate.css @@ -131,7 +131,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} .layui-laydate-content .laydate-day-prev, .layui-laydate-content .laydate-day-next{color: #d2d2d2;} .laydate-selected.laydate-day-prev, -.laydate-selected.laydate-day-next{color: #fff !important;} +.laydate-selected.laydate-day-next{background-color: #f8f8f8 !important;} .layui-laydate-footer{border-top: 1px solid #e2e2e2;} .layui-laydate-hint{color: #FF5722;} .laydate-day-mark::after{background-color: #5FB878;} From bfc0c1bf6d627226ad9572fae2c5a4c336e45668 Mon Sep 17 00:00:00 2001 From: sentsin Date: Tue, 5 Dec 2017 12:35:36 +0800 Subject: [PATCH 19/26] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/laydate.js | 4 ++-- dist/theme/default/laydate.css | 4 ++-- package.json | 2 +- src/laydate.js | 21 ++++++++++++++++----- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 41e2bc1..83a12cb 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! laydate-v5.0.85 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.scripts,t=e[e.length-1],n=t.src;if(!t.getAttribute("merge"))return n.substring(0,n.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.85",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var n=this;return n.config=t.extend({},n.config,e),n},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n.hasClass(c)||t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month||12,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&s0;a--)if("interactive"===t[a].readyState){e=t[a].src;break}return e||t[n].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.9",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var t=this;return t.config=w.extend({},t.config,e),t},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n.hasClass(c)||t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month||12,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&sli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file +/*! laydate-v5.0.9 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} \ No newline at end of file diff --git a/package.json b/package.json index f8ff2e7..fb4fc39 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "layui-laydate", "realname": "laydate", - "version": "5.0.85", + "version": "5.0.9", "description": "日期与时间组件", "main": "src/laydate.js", "license": "MIT", diff --git a/src/laydate.js b/src/laydate.js index 6b20069..0a75401 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,6 +1,6 @@ /** - @Name : layDate 5.0.85 日期时间控件 + @Name : layDate 5.0.9 日期时间控件 @Author: 贤心 @Site:http://www.layui.com/laydate/ @License:MIT @@ -12,8 +12,18 @@ var isLayui = window.layui && layui.define, ready = { getPath: function(){ - var js = document.scripts, script = js[js.length - 1], jsPath = script.src; - if(script.getAttribute('merge')) return; + var jsPath = document.currentScript ? document.currentScript.src : function(){ + var js = document.scripts + ,last = js.length - 1 + ,src; + for(var i = last; i > 0; i--){ + if(js[i].readyState === 'interactive'){ + src = js[i].src; + break; + } + } + return src || js[last].src; + }(); return jsPath.substring(0, jsPath.lastIndexOf('/') + 1); }() @@ -55,7 +65,7 @@ } ,laydate = { - v: '5.0.85' + v: '5.0.9' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath @@ -63,7 +73,7 @@ //设置全局项 ,set: function(options){ var that = this; - that.config = ready.extend({}, that.config, options); + that.config = lay.extend({}, that.config, options); return that; } @@ -1379,6 +1389,7 @@ //创建指定日期时间对象 Class.prototype.newDate = function(dateTime){ + dateTime = dateTime || {}; return new Date( dateTime.year || 1 ,dateTime.month || 0 From d58c43b8d1c0f35483ce07b2e5c924bf0ab64113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsin@users.noreply.github.com> Date: Mon, 22 Mar 2021 01:46:09 +0800 Subject: [PATCH 20/26] update --- README.md | 4 +- dist/laydate.js | 4 +- dist/theme/default/laydate.css | 3 +- gulpfile.js | 3 +- package.json | 6 +- src/laydate.js | 528 ++++++++++++++++----------------- src/theme/default/laydate.css | 6 +- 7 files changed, 268 insertions(+), 286 deletions(-) diff --git a/README.md b/README.md index 3c27b6b..ace881f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ## 概要 -全面重写的 layDate 包含了大量的更新,其中主要以:年选择器、年月选择器、日期选择器、时间选择器、日期时间选择器 五种类型的选择方式为基本核心,并且均支持范围选择(即双控件)。内置强劲的自定义日期格式解析和合法校正机制,含中文版和国际版,主题简约却又不失灵活多样。由于内部采用的是零依赖的原生 JavaScript 编写,因此又可作为独立组件使用。毫无疑问,这是 layui 的虔心之作。 +一款被广泛使用的高级 Web 日历组件,颜值与功能兼备,足以应对日期相关的各种业务场景。其中主要以:年选择器、年月选择器、日期选择器、时间选择器、日期时间选择五种类型的选择方式为基本核心,并且均支持范围选择(即双控件)。内置强劲的自定义日期格式解析和合法校正机制,含中文版和国际版,主题简约却又不失灵活多样。内部采用是零依赖的原生 JavaScript 编写,可作为独立组件使用。 ## 官网 [http://www.layui.com/laydate/](http://www.layui.com/laydate/) ## 相关 -[文档](http://www.layui.com/doc/modules/laydate.html)、[社区](http://fly.layui.com) \ No newline at end of file +[文档](http://www.layui.com/doc/modules/laydate.html) \ No newline at end of file diff --git a/dist/laydate.js b/dist/laydate.js index 83a12cb..5f93fa9 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! laydate-v5.0.9 日期与时间组件 MIT License http://www.layui.com/laydate/ By 贤心 */ - ;!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,n=t.length-1,a=n;a>0;a--)if("interactive"===t[a].readyState){e=t[a].src;break}return e||t[n].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.9",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var t=this;return t.config=w.extend({},t.config,e),t},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n.hasClass(c)||t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month||12,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&s0;i--)if("interactive"===t[i].readyState){e=t[i].src;break}return e||t[n].src}();return e.substring(0,e.lastIndexOf("/")+1)},n.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},n.each=function(e,t){var a,n=this;if("function"!=typeof t)return n;if(e=e||[],e.constructor===Object){for(a in e)if(t.call(e[a],a,e[a]))break}else for(a=0;a80?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(n.getStyle(a.getElementById(s),"width"))?t():setTimeout(c,100))}()},i.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,a){new RegExp("\\b"+a+"\\b").test(e)||(e=e+" "+a)}),e.replace(/^\s|\s$/,"")},i.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,a){var n=new RegExp("\\b"+a+"\\b");n.test(e)&&(e=e.replace(n,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},i.prototype.lay=t,i.prototype.find=function(e){var t=this,a=0,i=[],l="object"==typeof e;return this.each(function(n,r){for(var o=l?[e]:r.querySelectorAll(e||null);a0)return a[0].getAttribute(e)}():a.each(function(a,n){n.setAttribute(e,t)})},i.prototype.removeAttr=function(e){return this.each(function(t,a){a.removeAttribute(e)})},i.prototype.html=function(e){return this.each(function(t,a){a.innerHTML=e})},i.prototype.val=function(e){return this.each(function(t,a){a.value=e})},i.prototype.append=function(e){return this.each(function(t,a){"object"==typeof e?a.appendChild(e):a.innerHTML=a.innerHTML+e})},i.prototype.remove=function(e){return this.each(function(t,a){e?a.removeChild(e):a.parentNode.removeChild(a)})},i.prototype.on=function(e,t){return this.each(function(a,n){n.attachEvent?n.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(n,e)}):n.addEventListener(e,t,!1)})},i.prototype.off=function(e,t){return this.each(function(a,n){n.detachEvent?n.detachEvent("on"+e,t):n.removeEventListener(e,t,!1)})},window.lay=n,window.layui&&layui.define&&layui.define(function(t){t(e,n)})}(),!function(e){"use strict";var t=e.layui&&layui.define,a={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,a,i){n.path&&e.lay&&lay.link&&lay.link(n.path+t,a,i)}},n={v:"5.1.0",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:a.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var i="laydate",l="",r=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+l;return t?layui.addcss(r,e,i):a.link(r,e,i),this}},i=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},l="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",y="开始时间不能早于结束时间
        请重新选择",c=[100,2e5],d="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",f="laydate-day-prev",p="laydate-day-next",g="layui-laydate-footer",v=".laydate-btns-confirm",T="laydate-time-text",D=".laydate-btns-time",w=function(e){var t=this;t.index=++n.index,t.config=lay.extend({},t.config,n.config,e),n.ready(function(){t.init()})};w.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},w.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},w.prototype.lang=function(){var e=this,t=e.config,a={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return a[t.lang]||a.cn},w.prototype.init=function(){var e=this,t=e.config,a="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",n="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=lay(t.elem),t.eventElem=lay(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(a+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",lay.each(e.format,function(t,n){var i=new RegExp(a).test(n)?"\\d{"+function(){return new RegExp(a).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=lay.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),lay.each(["min","max"],function(e,a){var n=[],i=[];if("number"==typeof t[a]){var l=t[a],r=(new Date).getTime(),o=864e5,s=new Date(l?l0)return!0;var n=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),a=lay.elem("span");return e.appendChild(t),e.appendChild(a),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],y=lay.elem("div",{"class":"layui-laydate-content"}),c=lay.elem("table"),d=lay.elem("thead"),m=lay.elem("tr");lay.each(i,function(e,t){n.appendChild(t)}),d.appendChild(m),lay.each(new Array(6),function(e){var t=c.insertRow(0);lay.each(new Array(7),function(n){if(0===e){var i=lay.elem("th");i.innerHTML=a.weeks[n],m.appendChild(i)}t.insertCell(n)})}),c.insertBefore(d,c.children[0]),y.appendChild(c),l[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),l[e].appendChild(n),l[e].appendChild(y),r.push(i),o.push(y),s.push(c)}),lay(y).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+a.timeTips+""),lay.each(t.btns,function(e,l){var r=a.tools[l]||"btn";t.range&&"now"===l||(n&&"clear"===l&&(r="cn"===t.lang?"重置":"Reset"),i.push(''+r+""))}),e.push('"),e.join("")}()),lay.each(l,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(y),/^#/.test(t.theme)){var c=lay.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,lay(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(w.thisElemDate),n?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),w.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1}))},w.prototype.remove=function(e){var t=this,a=(t.config,lay("#"+(e||t.elemID)));return a.hasClass(d)||t.checkDate(function(){a.remove(),delete t.endDate}),t},w.prototype.position=function(){var e=this,t=e.config,a=e.bindElem||t.elem[0],n=a.getBoundingClientRect(),i=e.elem.offsetWidth,l=e.elem.offsetHeight,r=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},o=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},s=5,y=n.left,c=n.bottom;y+i+s>o("width")&&(y=o("width")-i-s),c+l+s>o()&&(c=n.top>l?n.top-l:o()-l,c-=2*s),t.position&&(e.elem.style.position=t.position),e.elem.style.left=y+("fixed"===t.position?0:r(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:r())+"px"},w.prototype.hint=function(e){var t=this,a=(t.config,lay.elem("div",{"class":h}));t.elem&&(a.innerHTML=e||"",lay(t.elem).find("."+h).remove(),t.elem.appendChild(a),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+h).remove()},3e3))},w.prototype.getAsYM=function(e,t,a){return a?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},w.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},w.prototype.checkDate=function(e){var t,a,i=this,l=(new Date,i.config),r=l.dateTime=l.dateTime||i.systemDate(),o=i.bindElem||l.elem[0],s=(i.isInput(o)?"val":"html",i.isInput(o)?o.value:"static"===l.position?"":o.innerHTML),y=function(e){e.year>c[1]&&(e.year=c[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},d=function(e,t,n){var r=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,l.range&&(i[r[n]]=i[r[n]]||{}),lay.each(i.format,function(o,s){var y=parseFloat(t[o]);t[o].length必须遵循下述格式:
        "+(l.range?l.format+" "+l.range+" "+l.format:l.format)+"
        已为你重置"),a=!0):s&&s.constructor===Date?l.dateTime=i.systemDate(s):(l.dateTime=i.systemDate(),delete i.startTime,delete i.endTime),y(r),a&&s&&i.setValue(l.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},w.prototype.mark=function(e,t){var a,n=this,i=n.config;return lay.each(i.mark,function(e,n){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(a=n||t[2])}),a&&e.html(''+a+""),n},w.prototype.limit=function(e,t,a,n){var i,l=this,r=l.config,o={},y=r[a>41?"endDate":"dateTime"],c=lay.extend({},y,t||{});return lay.each({now:c,min:r.min,max:r.max},function(e,t){o[e]=l.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(n,function(a,n){e[n]=t[n]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](s),i},w.prototype.thisDateTime=function(e){var t=this,a=t.config;return e?t.endDate:a.dateTime},w.prototype.calendar=function(e,t,a){var i,l,r,s=this,y=s.config,t=t?1:0,d=e||s.thisDateTime(t),m=new Date,u=s.lang(),h="date"!==y.type&&"datetime"!==y.type,f=lay(s.table[t]).find("td"),p=lay(s.elemHeader[t][2]).find("span");return d.yearc[1]&&(d.year=c[1],s.hint("最高只能支持到公元"+c[1]+"年")),s.firstDate||(s.firstDate=lay.extend({},d)),m.setFullYear(d.year,d.month,1),i=m.getDay(),l=n.getEndDate(d.month||12,d.year),r=n.getEndDate(d.month+1,d.year),lay.each(f,function(e,t){var a=[d.year,d.month],n=0;t=lay(t),t.removeAttr("class"),e=i&&e=a.firstDate.year&&(l.month=n.max.month,l.date=n.max.date),a.limit(lay(i),l,t),x++}),lay(d[f?0:1]).attr("lay-ym",x-8+"-"+g[1]).html(M+p+" - "+(x-1+p))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),r={year:g[0],month:e};e+1==g[1]&&lay(i).addClass(o),i.innerHTML=l.month[e]+(f?"月":""),y.appendChild(i),g[0]=a.firstDate.year&&(r.date=n.max.date),a.limit(lay(i),r,t)}),lay(d[f?0:1]).attr("lay-ym",g[0]+"-"+g[1]).html(g[0]+p);else if("time"===e){var b=function(){lay(y).find("ol").each(function(e,n){lay(n).find("li").each(function(n,i){a.limit(lay(i),[{hours:n},{hours:a[C].hours,minutes:n},{hours:a[C].hours,minutes:a[C].minutes,seconds:n}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),n.range||a.limit(lay(a.footer).find(v),a[C],0,["hours","minutes","seconds"])};n.range?a[C]||(a[C]={hours:0,minutes:0,seconds:0}):a[C]=i,lay.each([24,60,60],function(e,t){var n=lay.elem("li"),i=["

        "+l.time[e]+"

          "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),n.innerHTML=i.join("")+"
        ",y.appendChild(n)}),b()}if(h&&u.removeChild(h),u.appendChild(y),"year"===e||"month"===e)lay(a.elemMain[t]).addClass("laydate-ym-show"),lay(y).find("li").on("click",function(){var l=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(s)){0===t?(i[e]=l,a.limit(lay(a.footer).find(v),null,0)):a.endDate[e]=l;var c="year"===n.type||"month"===n.type;c?(lay(y).find("."+o).removeClass(o),lay(this).addClass(o),"month"===n.type&&"year"===e&&(a.listYM[t][0]=l,r&&(t?i.year=l:a.endDate.year=l),a.list("month",t))):(a.checkDate("limit").calendar(null,t),a.closeList()),a.setBtnStatus(),n.range||(("month"===n.type&&"month"===e||"year"===n.type&&"year"===e)&&a.setValue(a.parse()).remove().done(),a.done(null,"change")),lay(a.footer).find(D).removeClass(s)}});else{var E=lay.elem("span",{"class":T}),k=function(){lay(y).find("ol").each(function(e){var t=this,n=lay(t).find("li");t.scrollTop=30*(a[C][w[e]]-2),t.scrollTop<=0&&n.each(function(e,a){if(!lay(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=lay(c[2]).find("."+T);k(),E.innerHTML=n.range?[l.startTime,l.endTime][t]:l.timeTips,lay(a.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(E),lay(y).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var l=0|this.innerHTML;lay(this).hasClass(s)||(n.range?a[C][w[e]]=l:i[w[e]]=l,lay(t).find("."+o).removeClass(o),lay(this).addClass(o),b(),k(),(a.endDate||"time"===n.type)&&a.done(null,"change"),a.setBtnStatus())})})}return a},w.prototype.listYM=[],w.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,a){lay(this).find("."+m).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+T).remove()},w.prototype.setBtnStatus=function(e,t,a){var n,i=this,l=i.config,r=lay(i.footer).find(v);l.range&&"time"!==l.type&&(t=t||l.dateTime,a=a||i.endDate,n=i.newDate(t).getTime()>i.newDate(a).getTime(),i.limit(null,t)||i.limit(null,a)?r.addClass(s):r[n?"addClass":"removeClass"](s),e&&n&&i.hint("string"==typeof e?y.replace(/日期/g,e):y))},w.prototype.parse=function(e,t){var a=this,n=a.config,i=t||(e?lay.extend({},a.endDate,a.endTime):n.range?lay.extend({},n.dateTime,a.startTime):n.dateTime),l=a.format.concat();return lay.each(l,function(e,t){/yyyy|y/.test(t)?l[e]=lay.digit(i.year,t.length):/MM|M/.test(t)?l[e]=lay.digit(i.month+1,t.length):/dd|d/.test(t)?l[e]=lay.digit(i.date,t.length):/HH|H/.test(t)?l[e]=lay.digit(i.hours,t.length):/mm|m/.test(t)?l[e]=lay.digit(i.minutes,t.length):/ss|s/.test(t)&&(l[e]=lay.digit(i.seconds,t.length))}),n.range&&!e?l.join("")+" "+n.range+" "+a.parse(1):l.join("")},w.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},w.prototype.setValue=function(e){var t=this,a=t.config,n=t.bindElem||a.elem[0],i=t.isInput(n)?"val":"html";return"static"===a.position||lay(n)[i](e||""),this},w.prototype.stampRange=function(){var e,t,a=this,n=a.config,i=n.dateTime,l=lay(a.elem).find("td");if(n.range&&!a.endDate&&lay(a.footer).find(v).addClass(s),a.endDate)return e=a.newDate({year:i.year,month:i.month,date:i.date}).getTime(),t=a.newDate({year:a.endDate.year,month:a.endDate.month,date:a.endDate.date}).getTime(),e>t?a.hint(y):void lay.each(l,function(n,i){var l=lay(i).attr("lay-ymd").split("-"),r=a.newDate({year:l[0],month:l[1]-1,date:l[2]}).getTime();lay(i).removeClass(u+" "+o),r!==e&&r!==t||lay(i).addClass(lay(i).hasClass(f)||lay(i).hasClass(p)?u:o),r>e&&rli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} \ No newline at end of file +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content,.layui-laydate-range .laydate-main-list-1 .layui-laydate-header{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 8bd2b59..ccc619b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -21,11 +21,10 @@ var task = { .pipe(minify({ compatibility: 'ie7' })) - .pipe(header('/*! <%= pkg.realname %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %> By <%= pkg.author %> */\n', {pkg: pkg})) .pipe(gulp.dest('./dist')); return gulp.src('./src/laydate.js').pipe(uglify()) - .pipe(header('/*! <%= pkg.realname %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %> By <%= pkg.author %> */\n ;', {pkg: pkg})) + .pipe(header('/*! <%= pkg.realname %> v<%= pkg.version %> | <%= pkg.description %> | The <%= pkg.license %> License */\n ;', {pkg: pkg})) .pipe(gulp.dest('./dist')); } diff --git a/package.json b/package.json index fb4fc39..7bb13c7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "layui-laydate", - "realname": "laydate", - "version": "5.0.9", + "realname": "layDate", + "version": "5.1.0", "description": "日期与时间组件", "main": "src/laydate.js", "license": "MIT", @@ -12,8 +12,6 @@ "type": "https", "url": "git+https://github.com/sentsin/laydate.git" }, - "author": "贤心", - "homepage": "http://www.layui.com/laydate/", "devDependencies": { "gulp": "^3.9.0", "gulp-minify-css": "^1.2.4", diff --git a/src/laydate.js b/src/laydate.js index 0a75401..2a56c4e 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,117 +1,18 @@ -/** - - @Name : layDate 5.0.9 日期时间控件 - @Author: 贤心 - @Site:http://www.layui.com/laydate/ - @License:MIT - - */ +/** + @Name:layDate 日期与时间组件 + @License: MIT + */ -;!function(){ - "use strict"; - - var isLayui = window.layui && layui.define, ready = { - getPath: function(){ - var jsPath = document.currentScript ? document.currentScript.src : function(){ - var js = document.scripts - ,last = js.length - 1 - ,src; - for(var i = last; i > 0; i--){ - if(js[i].readyState === 'interactive'){ - src = js[i].src; - break; - } - } - return src || js[last].src; - }(); - return jsPath.substring(0, jsPath.lastIndexOf('/') + 1); - }() - - //获取节点的style属性值 - ,getStyle: function(node, name){ - var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null); - return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name); - } - - //载入CSS配件 - ,link: function(href, fn, cssname){ - - //未设置路径,则不主动加载css - if(!laydate.path) return; - - var head = document.getElementsByTagName("head")[0], link = document.createElement('link'); - if(typeof fn === 'string') cssname = fn; - var app = (cssname || href).replace(/\.|\//g, ''); - var id = 'layuicss-'+ app, timeout = 0; - - link.rel = 'stylesheet'; - link.href = laydate.path + href; - link.id = id; - - if(!document.getElementById(id)){ - head.appendChild(link); - } - - if(typeof fn !== 'function') return; - - //轮询css是否加载完毕 - (function poll() { - if(++timeout > 8 * 1000 / 100){ - return window.console && console.error('laydate.css: Invalid'); - }; - parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100); - }()); - } - } - ,laydate = { - v: '5.0.9' - ,config: {} //全局配置项 - ,index: (window.laydate && window.laydate.v) ? 100000 : 0 - ,path: ready.getPath - - //设置全局项 - ,set: function(options){ - var that = this; - that.config = lay.extend({}, that.config, options); - return that; - } - - //主体CSS等待事件 - ,ready: function(fn){ - var cssname = 'laydate', ver = '' - ,path = (isLayui ? 'modules/laydate/' : 'theme/') + 'default/laydate.css?v='+ laydate.v + ver; - isLayui ? layui.addcss(path, fn, cssname) : ready.link(path, fn, cssname); - return this; - } - } - - //操作当前实例 - ,thisDate = function(){ - var that = this; - return { - //提示框 - hint: function(content){ - that.hint.call(that, content); - } - ,config: that.config - }; - } +/** lay 基础 DOM 操作 */ - //字符常量 - ,MOD_NAME = 'laydate', ELEM = '.layui-laydate', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'laydate-disabled', TIPS_OUT = '开始日期超出了结束日期
        建议重新选择', LIMIT_YEAR = [100, 200000] +;!function(){ + "use strict"; - ,ELEM_STATIC = 'layui-laydate-static', ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = '.laydate-btns-time' - //组件构造器 - ,Class = function(options){ - var that = this; - that.index = ++laydate.index; - that.config = lay.extend({}, that.config, laydate.config, options); - laydate.ready(function(){ - that.init(); - }); - } + var MOD_NAME = 'lay' //模块名 + ,VERSION = '1.0.0' //版本 + ,document = window.document //DOM查找 ,lay = function(selector){ @@ -132,7 +33,7 @@ /* - lay对象操作 + lay 对象操作 */ LAY.prototype = []; @@ -162,6 +63,9 @@ return args[0]; }; + //模块版本 + lay.v = VERSION; + //ie版本 lay.ie = function(){ var agent = navigator.userAgent.toLowerCase(); @@ -170,6 +74,23 @@ ) : false; }(); + //获取当前 JS 所在目录 + lay.getPath = function(){ + var jsPath = document.currentScript ? document.currentScript.src : function(){ + var js = document.scripts + ,last = js.length - 1 + ,src; + for(var i = last; i > 0; i--){ + if(js[i].readyState === 'interactive'){ + src = js[i].src; + break; + } + } + return src || js[last].src; + }(); + return jsPath.substring(0, jsPath.lastIndexOf('/') + 1); + } + //中止冒泡 lay.stope = function(e){ e = e || window.event; @@ -216,6 +137,38 @@ return elem; }; + //获取节点的 style 属性值 + lay.getStyle = function(node, name){ + var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null); + return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name); + }; + + //载入 CSS 依赖 + lay.link = function(href, fn, cssname){ + var head = document.getElementsByTagName("head")[0], link = document.createElement('link'); + if(typeof fn === 'string') cssname = fn; + var app = (cssname || href).replace(/\.|\//g, ''); + var id = 'layuicss-'+ app, timeout = 0; + + link.rel = 'stylesheet'; + link.href = href; + link.id = id; + + if(!document.getElementById(id)){ + head.appendChild(link); + } + + if(typeof fn !== 'function') return; + + //轮询css是否加载完毕 + (function poll() { + if(++timeout > 8 * 1000 / 100){ + return window.console && console.error(app + '.css: Invalid'); + }; + parseInt(lay.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100); + }()); + }; + //追加字符 LAY.addStr = function(str, new_str){ str = str.replace(/\s+/, ' '); @@ -241,6 +194,9 @@ return str.replace(/\s+/, ' ').replace(/^\s|\s$/, ''); }; + //版本 + LAY.prototype.lay = VERSION; + //查找子元素 LAY.prototype.find = function(selector){ var that = this; @@ -321,7 +277,7 @@ //设置值 LAY.prototype.val = function(value){ return this.each(function(index, item){ - item.value = value; + item.value = value; }); }; @@ -360,6 +316,91 @@ }); }; + //暴露 lay 到全局作用域 + window.lay = lay; + + //如果在 layui 体系中 + if(window.layui && layui.define){ + layui.define(function(exports){ //layui 加载 + exports(MOD_NAME, lay); + }); + } + +}(); + + + + +/** layDate 日期与时间控件 */ + +;!function(window){ + "use strict"; + + var isLayui = window.layui && layui.define, ready = { + getPath: (window.lay && lay.getPath) ? lay.getPath() : '' + + //载入 CSS 依赖 + ,link: function(href, fn, cssname){ + + //未设置路径,则不主动加载 css + if(!laydate.path) return; + + //加载 css + if(window.lay && lay.link){ + lay.link(laydate.path + href, fn, cssname); + } + } + } + + ,laydate = { + v: '5.1.0' + ,config: {} //全局配置项 + ,index: (window.laydate && window.laydate.v) ? 100000 : 0 + ,path: ready.getPath + + //设置全局项 + ,set: function(options){ + var that = this; + that.config = lay.extend({}, that.config, options); + return that; + } + + //主体CSS等待事件 + ,ready: function(fn){ + var cssname = 'laydate', ver = '' + ,path = (isLayui ? 'modules/laydate/' : 'theme/') + 'default/laydate.css?v='+ laydate.v + ver; + isLayui ? layui.addcss(path, fn, cssname) : ready.link(path, fn, cssname); + return this; + } + } + + //操作当前实例 + ,thisDate = function(){ + var that = this; + return { + //提示框 + hint: function(content){ + that.hint.call(that, content); + } + ,config: that.config + }; + } + + //字符常量 + ,MOD_NAME = 'laydate', ELEM = '.layui-laydate', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'laydate-disabled', TIPS_OUT = '开始时间不能早于结束时间
        请重新选择', LIMIT_YEAR = [100, 200000] + + ,ELEM_STATIC = 'layui-laydate-static', ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = '.laydate-btns-time' + + //组件构造器 + ,Class = function(options){ + var that = this; + that.index = ++laydate.index; + that.config = lay.extend({}, that.config, laydate.config, options); + laydate.ready(function(){ + that.init(); + }); + } + /* 组件操作 @@ -377,6 +418,7 @@ ,range: false //是否开启范围选择,即双控件 ,format: 'yyyy-MM-dd' //默认日期格式 ,value: null //默认日期,支持传入new Date(),或者符合format参数设定的日期格式字符 + ,isInitValue: true //用于控制是否自动向元素填充初始值(需配合 value 参数使用) ,min: '1900-1-1' //有效最小日期,年月日必须用“-”分割,时分秒必须用“:”分割。注意:它并不是遵循 format 设定的格式。 ,max: '2099-12-31' //有效最大日期,同上 ,trigger: 'focus' //呼出控件的事件 @@ -548,7 +590,7 @@ isStatic || that.events(); //默认赋值 - if(options.value){ + if(options.value && options.isInitValue){ if(options.value.constructor === Date){ that.setValue(that.parse(0, that.systemDate(options.value))); } else { @@ -723,7 +765,7 @@ ,that.position() //定位 ); - that.checkDate().calendar(); //初始校验 + that.checkDate().calendar(null, 0, 'init'); //初始校验 that.changeEvent(); //日期切换 Class.thisElemDate = that.elemID; @@ -741,6 +783,7 @@ if(!elem.hasClass(ELEM_STATIC)){ that.checkDate(function(){ elem.remove(); + delete that.endDate; }); } return that; @@ -792,6 +835,8 @@ 'class': ELEM_HINT }); + if(!that.elem) return; + div.innerHTML = content || ''; lay(that.elem).find('.'+ ELEM_HINT).remove(); that.elem.appendChild(div); @@ -816,7 +861,7 @@ return [Y, M]; }; - //系统消息 + //系统日期 Class.prototype.systemDate = function(newDate){ var thisDate = newDate || new Date(); return { @@ -898,20 +943,28 @@ value = value.replace(/\s+/g, ' ').replace(/^\s|\s$/g, ''); } - //如果点击了开始,单未选择结束就关闭,则重新选择开始 - if(that.startState && !that.endState){ - delete that.startState; - that.endState = true; - }; + //如果开启范围 + if(options.range){ + that.endDate = that.endDate || lay.extend({}, dateTime, function(){ + var obj = {} + ,EYM = that.getAsYM(dateTime.year, dateTime.month); + + if(options.type === 'year'){ + obj.year = dateTime.year + 1; + } else if(options.type !== 'time'){ + obj.year = EYM[0]; + obj.month = EYM[1]; + } + return obj; + }()); + } if(typeof value === 'string' && value){ if(that.EXP_IF.test(value)){ //校验日期格式 if(options.range){ value = value.split(' '+ options.range +' '); - that.startDate = that.startDate || that.systemDate(); - that.endDate = that.endDate || that.systemDate(); - options.dateTime = lay.extend({}, that.startDate); - lay.each([that.startDate, that.endDate], function(i, item){ + + lay.each([options.dateTime, that.endDate], function(i, item){ initDate(item, value[i], i); }); } else { @@ -927,10 +980,7 @@ options.dateTime = that.systemDate(value); } else { options.dateTime = that.systemDate(); - delete that.startState; - delete that.endState; - delete that.startDate; - delete that.endDate; + delete that.startTime; delete that.endTime; } @@ -992,16 +1042,23 @@ return isOut; }; + //当前日期对象 + Class.prototype.thisDateTime = function(index){ + var that = this + ,options = that.config; + return index ? that.endDate: options.dateTime; + }; + //日历表 - Class.prototype.calendar = function(value){ + Class.prototype.calendar = function(value, index, type){ var that = this ,options = that.config - ,dateTime = value || options.dateTime + ,index = index ? 1 : 0 + ,dateTime = value || that.thisDateTime(index) ,thisDate = new Date(), startWeek, prevMaxDate, thisMaxDate ,lang = that.lang() ,isAlone = options.type !== 'date' && options.type !== 'datetime' - ,index = value ? 1 : 0 ,tds = lay(that.table[index]).find('td') ,elemYM = lay(that.elemHeader[index][2]).find('span'); @@ -1021,21 +1078,19 @@ thisMaxDate = laydate.getEndDate(dateTime.month + 1, dateTime.year); //计算当前月的最后一天 //赋值日 - lay.each(tds, function(index, item){ + lay.each(tds, function(index_, item){ var YMD = [dateTime.year, dateTime.month], st = 0; item = lay(item); item.removeAttr('class'); - if(index < startWeek){ - st = prevMaxDate - startWeek + index; + if(index_ < startWeek){ + st = prevMaxDate - startWeek + index_; item.addClass('laydate-day-prev'); YMD = that.getAsYM(dateTime.year, dateTime.month, 'sub'); - } else if(index >= startWeek && index < thisMaxDate + startWeek){ - st = index - startWeek; - if(!options.range){ - st + 1 === dateTime.date && item.addClass(THIS); - } + } else if(index_ >= startWeek && index_ < thisMaxDate + startWeek){ + st = index_ - startWeek; + st + 1 === dateTime.date && item.addClass(THIS); } else { - st = index - thisMaxDate - startWeek; + st = index_ - thisMaxDate - startWeek; item.addClass('laydate-day-next'); YMD = that.getAsYM(dateTime.year, dateTime.month); } @@ -1046,7 +1101,7 @@ year: YMD[0] ,month: YMD[1] - 1 ,date: YMD[2] - }, index); + }, index_); }); //同步头部年月 @@ -1062,48 +1117,39 @@ } //初始默认选择器 - if(isAlone){ + if(isAlone){ //年、月等独立选择器 if(options.range){ - value ? that.endDate = (that.endDate || { - year: dateTime.year + (options.type === 'year' ? 1 : 0) - ,month: dateTime.month + (options.type === 'month' ? 0 : -1) - }) : (that.startDate = that.startDate || { - year: dateTime.year - ,month: dateTime.month - }); if(value){ that.listYM = [ - [that.startDate.year, that.startDate.month + 1] + [options.dateTime.year, options.dateTime.month + 1] ,[that.endDate.year, that.endDate.month + 1] ]; that.list(options.type, 0).list(options.type, 1); + //同步按钮可点状态 options.type === 'time' ? that.setBtnStatus('时间' ,lay.extend({}, that.systemDate(), that.startTime) ,lay.extend({}, that.systemDate(), that.endTime) ) : that.setBtnStatus(true); } - } - if(!options.range){ + } else { that.listYM = [[dateTime.year, dateTime.month + 1]]; that.list(options.type, 0); } } - //赋值双日历 - if(options.range && !value){ - var EYM = that.getAsYM(dateTime.year, dateTime.month) - that.calendar(lay.extend({}, dateTime, { - year: EYM[0] - ,month: EYM[1] - })); + //初始赋值双日历 + if(options.range && type === 'init' && !value){ + //执行渲染第二个日历 + that.calendar(that.endDate, 1); } //通过检测当前有效日期,来设定确定按钮是否可点 if(!options.range) that.limit(lay(that.footer).find(ELEM_CONFIRM), null, 0, ['hours', 'minutes', 'seconds']); - //标记选择范围 - if(options.range && value && !isAlone) that.stampRange(); + //同步按钮可点状态 + that.setBtnStatus(); + return that; }; @@ -1229,39 +1275,43 @@ if(index === 0){ dateTime[type] = ym; - if(isAlone) that.startDate[type] = ym; that.limit(lay(that.footer).find(ELEM_CONFIRM), null, 0); } else { //范围选择 - if(isAlone){ //非date/datetime类型 - that.endDate[type] = ym; - } else { //date/datetime类型 - var YM = type === 'year' - ? that.getAsYM(ym, listYM[1] - 1, 'sub') - : that.getAsYM(listYM[0], ym, 'sub'); - lay.extend(dateTime, { - year: YM[0] - ,month: YM[1] - }); - } + that.endDate[type] = ym; } - if(options.type === 'year' || options.type === 'month'){ + //当为年选择器或者年月选择器 + var isYearOrMonth = options.type === 'year' || options.type === 'month'; + if(isYearOrMonth){ lay(ul).find('.'+ THIS).removeClass(THIS); lay(this).addClass(THIS); //如果为年月选择器,点击了年列表,则切换到月选择器 if(options.type === 'month' && type === 'year'){ that.listYM[index][0] = ym; - isAlone && (that[['startDate', 'endDate'][index]].year = ym); + if(isAlone){ + if(index){ + dateTime.year = ym; + } else { + that.endDate.year = ym; + } + } that.list('month', index); } } else { - that.checkDate('limit').calendar(); + that.checkDate('limit').calendar(null, index); that.closeList(); } that.setBtnStatus(); //同步按钮可点状态 - options.range || that.done(null, 'change'); + //如果非范围选择,则选中即自动关闭选择器 + if(!options.range){ + //若为月选择器,只有当选择月份时才自动关闭;若为年选择器,选择年份即自动关闭 + if((options.type === 'month' && type === 'month') || (options.type === 'year' && type === 'year')){ + that.setValue(that.parse()).remove().done(); + } + that.done(null, 'change'); + } lay(that.footer).find(ELEM_TIME_BTN).removeClass(DISABLED); }); } else { @@ -1334,10 +1384,9 @@ Class.prototype.setBtnStatus = function(tips, start, end){ var that = this ,options = that.config - ,isOut, elemBtn = lay(that.footer).find(ELEM_CONFIRM) - ,isAlone = options.range && options.type !== 'date' && options.type !== 'time'; - if(isAlone){ - start = start || that.startDate; + ,isOut, elemBtn = lay(that.footer).find(ELEM_CONFIRM); + if(options.range && options.type !== 'time'){ + start = start || options.dateTime; end = end || that.endDate; isOut = that.newDate(start).getTime() > that.newDate(end).getTime(); @@ -1359,7 +1408,7 @@ ,options = that.config ,dateTime = date || (state ? lay.extend({}, that.endDate, that.endTime) - : (options.range ? lay.extend({}, that.startDate, that.startTime) : options.dateTime)) + : (options.range ? lay.extend({}, options.dateTime, that.startTime) : options.dateTime)) ,format = that.format.concat(); //转义为规定格式 @@ -1415,6 +1464,7 @@ Class.prototype.stampRange = function(){ var that = this ,options = that.config + ,dateTime = options.dateTime ,startTime, endTime ,tds = lay(that.elem).find('td'); @@ -1422,9 +1472,9 @@ if(!that.endDate) return; startTime = that.newDate({ - year: that.startDate.year - ,month: that.startDate.month - ,date: that.startDate.date + year: dateTime.year + ,month: dateTime.month + ,date: dateTime.date }).getTime(); endTime = that.newDate({ @@ -1460,7 +1510,7 @@ Class.prototype.done = function(param, type){ var that = this ,options = that.config - ,start = lay.extend({}, that.startDate ? lay.extend(that.startDate, that.startTime) : options.dateTime) + ,start = lay.extend({}, lay.extend(options.dateTime, that.startTime)) ,end = lay.extend({}, lay.extend(that.endDate, that.endTime)) lay.each([start, end], function(i, item){ @@ -1477,28 +1527,13 @@ }; //选择日期 - Class.prototype.choose = function(td){ + Class.prototype.choose = function(td, index){ var that = this ,options = that.config - ,dateTime = options.dateTime + ,dateTime = that.thisDateTime(index) ,tds = lay(that.elem).find('td') - ,YMD = td.attr('lay-ymd').split('-') - - ,setDateTime = function(one){ - var thisDate = new Date(); - - //同步dateTime - one && lay.extend(dateTime, YMD); - - //记录开始日期 - if(options.range){ - that.startDate ? lay.extend(that.startDate, YMD) : ( - that.startDate = lay.extend({}, YMD, that.startTime) - ); - that.startYMD = YMD; - } - }; + ,YMD = td.attr('lay-ymd').split('-'); YMD = { year: YMD[0] | 0 @@ -1507,10 +1542,12 @@ }; if(td.hasClass(DISABLED)) return; + + lay.extend(dateTime, YMD); //同步 dateTime //范围选择 if(options.range){ - + //补充时分秒 lay.each(['startTime', 'endTime'], function(i, item){ that[item] = that[item] || { hours: 0 @@ -1518,54 +1555,12 @@ ,seconds: 0 }; }); - - if(that.endState){ //重新选择 - setDateTime(); - delete that.endState; - delete that.endDate; - that.startState = true; - tds.removeClass(THIS + ' ' + ELEM_SELECTED); - td.addClass(THIS); - } else if(that.startState){ //选中截止 - td.addClass(THIS); - - that.endDate ? lay.extend(that.endDate, YMD) : ( - that.endDate = lay.extend({}, YMD, that.endTime) - ); - - //判断是否顺时或逆时选择 - if(that.newDate(YMD).getTime() < that.newDate(that.startYMD).getTime()){ - var startDate = lay.extend({}, that.endDate, { - hours: that.startDate.hours - ,minutes: that.startDate.minutes - ,seconds: that.startDate.seconds - }); - lay.extend(that.endDate, that.startDate, { - hours: that.endDate.hours - ,minutes: that.endDate.minutes - ,seconds: that.endDate.seconds - }); - that.startDate = startDate; - } - - options.showBottom || that.done(); - that.stampRange(); //标记范围内的日期 - that.endState = true; - that.done(null, 'change'); - } else { //选中开始 - td.addClass(THIS); - setDateTime(); - that.startState = true; - } - lay(that.footer).find(ELEM_CONFIRM)[that.endDate ? 'removeClass' : 'addClass'](DISABLED); + that.calendar(null, index); } else if(options.position === 'static'){ //直接嵌套的选中 - setDateTime(true); - that.calendar().done().done(null, 'change'); + that.calendar().done().done(null, 'change'); //同时执行 done 和 change 回调 } else if(options.type === 'date'){ - setDateTime(true); that.setValue(that.parse()).remove().done(); } else if(options.type === 'datetime'){ - setDateTime(true); that.calendar().done(null, 'change'); } }; @@ -1599,9 +1594,7 @@ ,that.calendar() ) options.range && ( - delete that.startState - ,delete that.endState - ,delete that.endDate + delete that.endDate ,delete that.startTime ,delete that.endTime ); @@ -1642,14 +1635,13 @@ Class.prototype.change = function(index){ var that = this ,options = that.config - ,dateTime = options.dateTime + ,dateTime = that.thisDateTime(index) ,isAlone = options.range && (options.type === 'year' || options.type === 'month') ,elemCont = that.elemCont[index || 0] ,listYM = that.listYM[index] ,addSubYeay = function(type){ - var startEnd = ['startDate', 'endDate'][index] - ,isYear = lay(elemCont).find('.laydate-year-list')[0] + var isYear = lay(elemCont).find('.laydate-year-list')[0] ,isMonth = lay(elemCont).find('.laydate-month-list')[0]; //切换年列表 @@ -1667,13 +1659,14 @@ lay.extend(dateTime, { year: listYM[0] }); - if(isAlone) that[startEnd].year = listYM[0]; - options.range || that.done(null, 'change'); - that.setBtnStatus(); + if(isAlone) dateTime.year = listYM[0]; + options.range || that.done(null, 'change'); options.range || that.limit(lay(that.footer).find(ELEM_CONFIRM), { year: listYM[0] }); } + + that.setBtnStatus(); return isYear || isMonth; }; @@ -1681,7 +1674,7 @@ prevYear: function(){ if(addSubYeay('sub')) return; dateTime.year--; - that.checkDate('limit').calendar(); + that.checkDate('limit').calendar(null, index); options.range || that.done(null, 'change'); } ,prevMonth: function(){ @@ -1690,7 +1683,7 @@ year: YM[0] ,month: YM[1] }); - that.checkDate('limit').calendar(); + that.checkDate('limit').calendar(null, index); options.range || that.done(null, 'change'); } ,nextMonth: function(){ @@ -1699,13 +1692,13 @@ year: YM[0] ,month: YM[1] }); - that.checkDate('limit').calendar(); + that.checkDate('limit').calendar(null, index); options.range || that.done(null, 'change'); } ,nextYear: function(){ if(addSubYeay()) return; dateTime.year++ - that.checkDate('limit').calendar(); + that.checkDate('limit').calendar(null, index); options.range || that.done(null, 'change'); } }; @@ -1763,7 +1756,7 @@ lay.each(that.table, function(i, table){ var tds = lay(table).find('td'); tds.on('click', function(){ - that.choose(lay(this)); + that.choose(lay(this), i); }); }); @@ -1844,23 +1837,20 @@ return new Date(thisDate.getTime() - 1000*60*60*24).getDate(); }; - //暴露lay - window.lay = window.lay || lay; - //加载方式 isLayui ? ( laydate.ready() - ,layui.define(function(exports){ //layui加载 + ,layui.define('lay', function(exports){ //layui 加载 laydate.path = layui.cache.dir; exports(MOD_NAME, laydate); }) ) : ( (typeof define === 'function' && define.amd) ? define(function(){ //requirejs加载 return laydate; - }) : function(){ //普通script标签加载 + }) : function(){ //普通 script 标签加载 laydate.ready(); - window.laydate = laydate + window.laydate = laydate; }() ); -}(); \ No newline at end of file +}(window); \ No newline at end of file diff --git a/src/theme/default/laydate.css b/src/theme/default/laydate.css index 5d1e033..54deccb 100644 --- a/src/theme/default/laydate.css +++ b/src/theme/default/laydate.css @@ -18,7 +18,6 @@ /** @Name: laydata - @Author: 贤心 **/ @@ -106,10 +105,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} /* 双日历 */ .layui-laydate-range{width: 546px;} .layui-laydate-range .layui-laydate-main{display: inline-block; vertical-align: middle;} -.layui-laydate-range .laydate-main-list-0 .laydate-next-m, -.layui-laydate-range .laydate-main-list-0 .laydate-next-y, -.layui-laydate-range .laydate-main-list-1 .laydate-prev-y, -.layui-laydate-range .laydate-main-list-1 .laydate-prev-m{display: none;} +.layui-laydate-range .laydate-main-list-1 .layui-laydate-header, .layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left: 1px solid #e2e2e2;} From 41c431f61901750c6f2c5caf7eadad5f23e56b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsin@users.noreply.github.com> Date: Mon, 22 Mar 2021 13:39:46 +0800 Subject: [PATCH 21/26] update --- dist/laydate.js | 2 +- package.json | 6 ++++-- src/laydate.js | 17 ++--------------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 5f93fa9..a59cab2 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ /*! layDate v5.1.0 | 日期与时间组件 | The MIT License */ - ;!function(){"use strict";var e="lay",t="1.0.0",a=window.document,n=function(e){return new i(e)},i=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,a.querySelectorAll(e||null));t0;i--)if("interactive"===t[i].readyState){e=t[i].src;break}return e||t[n].src}();return e.substring(0,e.lastIndexOf("/")+1)},n.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},n.each=function(e,t){var a,n=this;if("function"!=typeof t)return n;if(e=e||[],e.constructor===Object){for(a in e)if(t.call(e[a],a,e[a]))break}else for(a=0;a80?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(n.getStyle(a.getElementById(s),"width"))?t():setTimeout(c,100))}()},i.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,a){new RegExp("\\b"+a+"\\b").test(e)||(e=e+" "+a)}),e.replace(/^\s|\s$/,"")},i.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,a){var n=new RegExp("\\b"+a+"\\b");n.test(e)&&(e=e.replace(n,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},i.prototype.lay=t,i.prototype.find=function(e){var t=this,a=0,i=[],l="object"==typeof e;return this.each(function(n,r){for(var o=l?[e]:r.querySelectorAll(e||null);a0)return a[0].getAttribute(e)}():a.each(function(a,n){n.setAttribute(e,t)})},i.prototype.removeAttr=function(e){return this.each(function(t,a){a.removeAttribute(e)})},i.prototype.html=function(e){return this.each(function(t,a){a.innerHTML=e})},i.prototype.val=function(e){return this.each(function(t,a){a.value=e})},i.prototype.append=function(e){return this.each(function(t,a){"object"==typeof e?a.appendChild(e):a.innerHTML=a.innerHTML+e})},i.prototype.remove=function(e){return this.each(function(t,a){e?a.removeChild(e):a.parentNode.removeChild(a)})},i.prototype.on=function(e,t){return this.each(function(a,n){n.attachEvent?n.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(n,e)}):n.addEventListener(e,t,!1)})},i.prototype.off=function(e,t){return this.each(function(a,n){n.detachEvent?n.detachEvent("on"+e,t):n.removeEventListener(e,t,!1)})},window.lay=n,window.layui&&layui.define&&layui.define(function(t){t(e,n)})}(),!function(e){"use strict";var t=e.layui&&layui.define,a={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,a,i){n.path&&e.lay&&lay.link&&lay.link(n.path+t,a,i)}},n={v:"5.1.0",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:a.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var i="laydate",l="",r=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+l;return t?layui.addcss(r,e,i):a.link(r,e,i),this}},i=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},l="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",y="开始时间不能早于结束时间
        请重新选择",c=[100,2e5],d="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",f="laydate-day-prev",p="laydate-day-next",g="layui-laydate-footer",v=".laydate-btns-confirm",T="laydate-time-text",D=".laydate-btns-time",w=function(e){var t=this;t.index=++n.index,t.config=lay.extend({},t.config,n.config,e),n.ready(function(){t.init()})};w.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},w.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},w.prototype.lang=function(){var e=this,t=e.config,a={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return a[t.lang]||a.cn},w.prototype.init=function(){var e=this,t=e.config,a="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",n="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=lay(t.elem),t.eventElem=lay(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(a+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",lay.each(e.format,function(t,n){var i=new RegExp(a).test(n)?"\\d{"+function(){return new RegExp(a).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=lay.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),lay.each(["min","max"],function(e,a){var n=[],i=[];if("number"==typeof t[a]){var l=t[a],r=(new Date).getTime(),o=864e5,s=new Date(l?l0)return!0;var n=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),a=lay.elem("span");return e.appendChild(t),e.appendChild(a),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],y=lay.elem("div",{"class":"layui-laydate-content"}),c=lay.elem("table"),d=lay.elem("thead"),m=lay.elem("tr");lay.each(i,function(e,t){n.appendChild(t)}),d.appendChild(m),lay.each(new Array(6),function(e){var t=c.insertRow(0);lay.each(new Array(7),function(n){if(0===e){var i=lay.elem("th");i.innerHTML=a.weeks[n],m.appendChild(i)}t.insertCell(n)})}),c.insertBefore(d,c.children[0]),y.appendChild(c),l[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),l[e].appendChild(n),l[e].appendChild(y),r.push(i),o.push(y),s.push(c)}),lay(y).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+a.timeTips+""),lay.each(t.btns,function(e,l){var r=a.tools[l]||"btn";t.range&&"now"===l||(n&&"clear"===l&&(r="cn"===t.lang?"重置":"Reset"),i.push(''+r+""))}),e.push('"),e.join("")}()),lay.each(l,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(y),/^#/.test(t.theme)){var c=lay.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,lay(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(w.thisElemDate),n?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),w.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1}))},w.prototype.remove=function(e){var t=this,a=(t.config,lay("#"+(e||t.elemID)));return a.hasClass(d)||t.checkDate(function(){a.remove(),delete t.endDate}),t},w.prototype.position=function(){var e=this,t=e.config,a=e.bindElem||t.elem[0],n=a.getBoundingClientRect(),i=e.elem.offsetWidth,l=e.elem.offsetHeight,r=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},o=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},s=5,y=n.left,c=n.bottom;y+i+s>o("width")&&(y=o("width")-i-s),c+l+s>o()&&(c=n.top>l?n.top-l:o()-l,c-=2*s),t.position&&(e.elem.style.position=t.position),e.elem.style.left=y+("fixed"===t.position?0:r(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:r())+"px"},w.prototype.hint=function(e){var t=this,a=(t.config,lay.elem("div",{"class":h}));t.elem&&(a.innerHTML=e||"",lay(t.elem).find("."+h).remove(),t.elem.appendChild(a),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+h).remove()},3e3))},w.prototype.getAsYM=function(e,t,a){return a?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},w.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},w.prototype.checkDate=function(e){var t,a,i=this,l=(new Date,i.config),r=l.dateTime=l.dateTime||i.systemDate(),o=i.bindElem||l.elem[0],s=(i.isInput(o)?"val":"html",i.isInput(o)?o.value:"static"===l.position?"":o.innerHTML),y=function(e){e.year>c[1]&&(e.year=c[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},d=function(e,t,n){var r=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,l.range&&(i[r[n]]=i[r[n]]||{}),lay.each(i.format,function(o,s){var y=parseFloat(t[o]);t[o].length必须遵循下述格式:
        "+(l.range?l.format+" "+l.range+" "+l.format:l.format)+"
        已为你重置"),a=!0):s&&s.constructor===Date?l.dateTime=i.systemDate(s):(l.dateTime=i.systemDate(),delete i.startTime,delete i.endTime),y(r),a&&s&&i.setValue(l.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},w.prototype.mark=function(e,t){var a,n=this,i=n.config;return lay.each(i.mark,function(e,n){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(a=n||t[2])}),a&&e.html(''+a+""),n},w.prototype.limit=function(e,t,a,n){var i,l=this,r=l.config,o={},y=r[a>41?"endDate":"dateTime"],c=lay.extend({},y,t||{});return lay.each({now:c,min:r.min,max:r.max},function(e,t){o[e]=l.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(n,function(a,n){e[n]=t[n]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](s),i},w.prototype.thisDateTime=function(e){var t=this,a=t.config;return e?t.endDate:a.dateTime},w.prototype.calendar=function(e,t,a){var i,l,r,s=this,y=s.config,t=t?1:0,d=e||s.thisDateTime(t),m=new Date,u=s.lang(),h="date"!==y.type&&"datetime"!==y.type,f=lay(s.table[t]).find("td"),p=lay(s.elemHeader[t][2]).find("span");return d.yearc[1]&&(d.year=c[1],s.hint("最高只能支持到公元"+c[1]+"年")),s.firstDate||(s.firstDate=lay.extend({},d)),m.setFullYear(d.year,d.month,1),i=m.getDay(),l=n.getEndDate(d.month||12,d.year),r=n.getEndDate(d.month+1,d.year),lay.each(f,function(e,t){var a=[d.year,d.month],n=0;t=lay(t),t.removeAttr("class"),e=i&&e=a.firstDate.year&&(l.month=n.max.month,l.date=n.max.date),a.limit(lay(i),l,t),x++}),lay(d[f?0:1]).attr("lay-ym",x-8+"-"+g[1]).html(M+p+" - "+(x-1+p))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),r={year:g[0],month:e};e+1==g[1]&&lay(i).addClass(o),i.innerHTML=l.month[e]+(f?"月":""),y.appendChild(i),g[0]=a.firstDate.year&&(r.date=n.max.date),a.limit(lay(i),r,t)}),lay(d[f?0:1]).attr("lay-ym",g[0]+"-"+g[1]).html(g[0]+p);else if("time"===e){var b=function(){lay(y).find("ol").each(function(e,n){lay(n).find("li").each(function(n,i){a.limit(lay(i),[{hours:n},{hours:a[C].hours,minutes:n},{hours:a[C].hours,minutes:a[C].minutes,seconds:n}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),n.range||a.limit(lay(a.footer).find(v),a[C],0,["hours","minutes","seconds"])};n.range?a[C]||(a[C]={hours:0,minutes:0,seconds:0}):a[C]=i,lay.each([24,60,60],function(e,t){var n=lay.elem("li"),i=["

        "+l.time[e]+"

          "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),n.innerHTML=i.join("")+"
        ",y.appendChild(n)}),b()}if(h&&u.removeChild(h),u.appendChild(y),"year"===e||"month"===e)lay(a.elemMain[t]).addClass("laydate-ym-show"),lay(y).find("li").on("click",function(){var l=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(s)){0===t?(i[e]=l,a.limit(lay(a.footer).find(v),null,0)):a.endDate[e]=l;var c="year"===n.type||"month"===n.type;c?(lay(y).find("."+o).removeClass(o),lay(this).addClass(o),"month"===n.type&&"year"===e&&(a.listYM[t][0]=l,r&&(t?i.year=l:a.endDate.year=l),a.list("month",t))):(a.checkDate("limit").calendar(null,t),a.closeList()),a.setBtnStatus(),n.range||(("month"===n.type&&"month"===e||"year"===n.type&&"year"===e)&&a.setValue(a.parse()).remove().done(),a.done(null,"change")),lay(a.footer).find(D).removeClass(s)}});else{var E=lay.elem("span",{"class":T}),k=function(){lay(y).find("ol").each(function(e){var t=this,n=lay(t).find("li");t.scrollTop=30*(a[C][w[e]]-2),t.scrollTop<=0&&n.each(function(e,a){if(!lay(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=lay(c[2]).find("."+T);k(),E.innerHTML=n.range?[l.startTime,l.endTime][t]:l.timeTips,lay(a.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(E),lay(y).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var l=0|this.innerHTML;lay(this).hasClass(s)||(n.range?a[C][w[e]]=l:i[w[e]]=l,lay(t).find("."+o).removeClass(o),lay(this).addClass(o),b(),k(),(a.endDate||"time"===n.type)&&a.done(null,"change"),a.setBtnStatus())})})}return a},w.prototype.listYM=[],w.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,a){lay(this).find("."+m).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+T).remove()},w.prototype.setBtnStatus=function(e,t,a){var n,i=this,l=i.config,r=lay(i.footer).find(v);l.range&&"time"!==l.type&&(t=t||l.dateTime,a=a||i.endDate,n=i.newDate(t).getTime()>i.newDate(a).getTime(),i.limit(null,t)||i.limit(null,a)?r.addClass(s):r[n?"addClass":"removeClass"](s),e&&n&&i.hint("string"==typeof e?y.replace(/日期/g,e):y))},w.prototype.parse=function(e,t){var a=this,n=a.config,i=t||(e?lay.extend({},a.endDate,a.endTime):n.range?lay.extend({},n.dateTime,a.startTime):n.dateTime),l=a.format.concat();return lay.each(l,function(e,t){/yyyy|y/.test(t)?l[e]=lay.digit(i.year,t.length):/MM|M/.test(t)?l[e]=lay.digit(i.month+1,t.length):/dd|d/.test(t)?l[e]=lay.digit(i.date,t.length):/HH|H/.test(t)?l[e]=lay.digit(i.hours,t.length):/mm|m/.test(t)?l[e]=lay.digit(i.minutes,t.length):/ss|s/.test(t)&&(l[e]=lay.digit(i.seconds,t.length))}),n.range&&!e?l.join("")+" "+n.range+" "+a.parse(1):l.join("")},w.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},w.prototype.setValue=function(e){var t=this,a=t.config,n=t.bindElem||a.elem[0],i=t.isInput(n)?"val":"html";return"static"===a.position||lay(n)[i](e||""),this},w.prototype.stampRange=function(){var e,t,a=this,n=a.config,i=n.dateTime,l=lay(a.elem).find("td");if(n.range&&!a.endDate&&lay(a.footer).find(v).addClass(s),a.endDate)return e=a.newDate({year:i.year,month:i.month,date:i.date}).getTime(),t=a.newDate({year:a.endDate.year,month:a.endDate.month,date:a.endDate.date}).getTime(),e>t?a.hint(y):void lay.each(l,function(n,i){var l=lay(i).attr("lay-ymd").split("-"),r=a.newDate({year:l[0],month:l[1]-1,date:l[2]}).getTime();lay(i).removeClass(u+" "+o),r!==e&&r!==t||lay(i).addClass(lay(i).hasClass(f)||lay(i).hasClass(p)?u:o),r>e&&r0;i--)if("interactive"===a[i].readyState){e=a[i].src;break}return e||a[n].src}();return e.substring(0,e.lastIndexOf("/")+1)},a.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},a.each=function(e,t){var a,n=this;if("function"!=typeof t)return n;if(e=e||[],e.constructor===Object){for(a in e)if(t.call(e[a],a,e[a]))break}else for(a=0;a80?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(a.getStyle(t.getElementById(s),"width"))?n():setTimeout(c,100))}()},n.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),a.each(t,function(t,a){new RegExp("\\b"+a+"\\b").test(e)||(e=e+" "+a)}),e.replace(/^\s|\s$/,"")},n.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),a.each(t,function(t,a){var n=new RegExp("\\b"+a+"\\b");n.test(e)&&(e=e.replace(n,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},n.prototype.find=function(e){var t=this,n=0,i=[],l="object"==typeof e;return this.each(function(a,r){for(var o=l?[e]:r.querySelectorAll(e||null);n0)return a[0].getAttribute(e)}():a.each(function(a,n){n.setAttribute(e,t)})},n.prototype.removeAttr=function(e){return this.each(function(t,a){a.removeAttribute(e)})},n.prototype.html=function(e){return this.each(function(t,a){a.innerHTML=e})},n.prototype.val=function(e){return this.each(function(t,a){a.value=e})},n.prototype.append=function(e){return this.each(function(t,a){"object"==typeof e?a.appendChild(e):a.innerHTML=a.innerHTML+e})},n.prototype.remove=function(e){return this.each(function(t,a){e?a.removeChild(e):a.parentNode.removeChild(a)})},n.prototype.on=function(e,t){return this.each(function(a,n){n.attachEvent?n.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(n,e)}):n.addEventListener(e,t,!1)})},n.prototype.off=function(e,t){return this.each(function(a,n){n.detachEvent?n.detachEvent("on"+e,t):n.removeEventListener(e,t,!1)})},window.lay=a,window.layui&&layui.define&&layui.define(function(t){t(e,a)})}(),!function(e){"use strict";var t=e.layui&&layui.define,a={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,a,i){n.path&&e.lay&&lay.link&&lay.link(n.path+t,a,i)}},n={v:"5.1.0",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:a.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var i="laydate",l="",r=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+l;return t?layui.addcss(r,e,i):a.link(r,e,i),this}},i=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},l="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",y="开始时间不能早于结束时间
        请重新选择",c=[100,2e5],d="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",f="laydate-day-prev",p="laydate-day-next",g="layui-laydate-footer",v=".laydate-btns-confirm",T="laydate-time-text",D=".laydate-btns-time",w=function(e){var t=this;t.index=++n.index,t.config=lay.extend({},t.config,n.config,e),n.ready(function(){t.init()})};w.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},w.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},w.prototype.lang=function(){var e=this,t=e.config,a={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return a[t.lang]||a.cn},w.prototype.init=function(){var e=this,t=e.config,a="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",n="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=lay(t.elem),t.eventElem=lay(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(a+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",lay.each(e.format,function(t,n){var i=new RegExp(a).test(n)?"\\d{"+function(){return new RegExp(a).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=lay.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),lay.each(["min","max"],function(e,a){var n=[],i=[];if("number"==typeof t[a]){var l=t[a],r=(new Date).getTime(),o=864e5,s=new Date(l?l0)return!0;var n=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),a=lay.elem("span");return e.appendChild(t),e.appendChild(a),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],y=lay.elem("div",{"class":"layui-laydate-content"}),c=lay.elem("table"),d=lay.elem("thead"),m=lay.elem("tr");lay.each(i,function(e,t){n.appendChild(t)}),d.appendChild(m),lay.each(new Array(6),function(e){var t=c.insertRow(0);lay.each(new Array(7),function(n){if(0===e){var i=lay.elem("th");i.innerHTML=a.weeks[n],m.appendChild(i)}t.insertCell(n)})}),c.insertBefore(d,c.children[0]),y.appendChild(c),l[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),l[e].appendChild(n),l[e].appendChild(y),r.push(i),o.push(y),s.push(c)}),lay(y).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+a.timeTips+""),lay.each(t.btns,function(e,l){var r=a.tools[l]||"btn";t.range&&"now"===l||(n&&"clear"===l&&(r="cn"===t.lang?"重置":"Reset"),i.push(''+r+""))}),e.push('"),e.join("")}()),lay.each(l,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(y),/^#/.test(t.theme)){var c=lay.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,lay(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(w.thisElemDate),n?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),w.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1}))},w.prototype.remove=function(e){var t=this,a=(t.config,lay("#"+(e||t.elemID)));return a.hasClass(d)||t.checkDate(function(){a.remove(),delete t.endDate}),t},w.prototype.position=function(){var e=this,t=e.config,a=e.bindElem||t.elem[0],n=a.getBoundingClientRect(),i=e.elem.offsetWidth,l=e.elem.offsetHeight,r=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},o=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},s=5,y=n.left,c=n.bottom;y+i+s>o("width")&&(y=o("width")-i-s),c+l+s>o()&&(c=n.top>l?n.top-l:o()-l,c-=2*s),t.position&&(e.elem.style.position=t.position),e.elem.style.left=y+("fixed"===t.position?0:r(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:r())+"px"},w.prototype.hint=function(e){var t=this,a=(t.config,lay.elem("div",{"class":h}));t.elem&&(a.innerHTML=e||"",lay(t.elem).find("."+h).remove(),t.elem.appendChild(a),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+h).remove()},3e3))},w.prototype.getAsYM=function(e,t,a){return a?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},w.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},w.prototype.checkDate=function(e){var t,a,i=this,l=(new Date,i.config),r=l.dateTime=l.dateTime||i.systemDate(),o=i.bindElem||l.elem[0],s=(i.isInput(o)?"val":"html",i.isInput(o)?o.value:"static"===l.position?"":o.innerHTML),y=function(e){e.year>c[1]&&(e.year=c[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},d=function(e,t,n){var r=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,l.range&&(i[r[n]]=i[r[n]]||{}),lay.each(i.format,function(o,s){var y=parseFloat(t[o]);t[o].length必须遵循下述格式:
        "+(l.range?l.format+" "+l.range+" "+l.format:l.format)+"
        已为你重置"),a=!0):s&&s.constructor===Date?l.dateTime=i.systemDate(s):(l.dateTime=i.systemDate(),delete i.startTime,delete i.endTime),y(r),a&&s&&i.setValue(l.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},w.prototype.mark=function(e,t){var a,n=this,i=n.config;return lay.each(i.mark,function(e,n){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(a=n||t[2])}),a&&e.html(''+a+""),n},w.prototype.limit=function(e,t,a,n){var i,l=this,r=l.config,o={},y=r[a>41?"endDate":"dateTime"],c=lay.extend({},y,t||{});return lay.each({now:c,min:r.min,max:r.max},function(e,t){o[e]=l.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(n,function(a,n){e[n]=t[n]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](s),i},w.prototype.thisDateTime=function(e){var t=this,a=t.config;return e?t.endDate:a.dateTime},w.prototype.calendar=function(e,t,a){var i,l,r,s=this,y=s.config,t=t?1:0,d=e||s.thisDateTime(t),m=new Date,u=s.lang(),h="date"!==y.type&&"datetime"!==y.type,f=lay(s.table[t]).find("td"),p=lay(s.elemHeader[t][2]).find("span");return d.yearc[1]&&(d.year=c[1],s.hint("最高只能支持到公元"+c[1]+"年")),s.firstDate||(s.firstDate=lay.extend({},d)),m.setFullYear(d.year,d.month,1),i=m.getDay(),l=n.getEndDate(d.month||12,d.year),r=n.getEndDate(d.month+1,d.year),lay.each(f,function(e,t){var a=[d.year,d.month],n=0;t=lay(t),t.removeAttr("class"),e=i&&e=a.firstDate.year&&(l.month=n.max.month,l.date=n.max.date),a.limit(lay(i),l,t),x++}),lay(d[f?0:1]).attr("lay-ym",x-8+"-"+g[1]).html(M+p+" - "+(x-1+p))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),r={year:g[0],month:e};e+1==g[1]&&lay(i).addClass(o),i.innerHTML=l.month[e]+(f?"月":""),y.appendChild(i),g[0]=a.firstDate.year&&(r.date=n.max.date),a.limit(lay(i),r,t)}),lay(d[f?0:1]).attr("lay-ym",g[0]+"-"+g[1]).html(g[0]+p);else if("time"===e){var b=function(){lay(y).find("ol").each(function(e,n){lay(n).find("li").each(function(n,i){a.limit(lay(i),[{hours:n},{hours:a[C].hours,minutes:n},{hours:a[C].hours,minutes:a[C].minutes,seconds:n}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),n.range||a.limit(lay(a.footer).find(v),a[C],0,["hours","minutes","seconds"])};n.range?a[C]||(a[C]={hours:0,minutes:0,seconds:0}):a[C]=i,lay.each([24,60,60],function(e,t){var n=lay.elem("li"),i=["

        "+l.time[e]+"

          "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),n.innerHTML=i.join("")+"
        ",y.appendChild(n)}),b()}if(h&&u.removeChild(h),u.appendChild(y),"year"===e||"month"===e)lay(a.elemMain[t]).addClass("laydate-ym-show"),lay(y).find("li").on("click",function(){var l=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(s)){0===t?(i[e]=l,a.limit(lay(a.footer).find(v),null,0)):a.endDate[e]=l;var c="year"===n.type||"month"===n.type;c?(lay(y).find("."+o).removeClass(o),lay(this).addClass(o),"month"===n.type&&"year"===e&&(a.listYM[t][0]=l,r&&(t?i.year=l:a.endDate.year=l),a.list("month",t))):(a.checkDate("limit").calendar(null,t),a.closeList()),a.setBtnStatus(),n.range||(("month"===n.type&&"month"===e||"year"===n.type&&"year"===e)&&a.setValue(a.parse()).remove().done(),a.done(null,"change")),lay(a.footer).find(D).removeClass(s)}});else{var E=lay.elem("span",{"class":T}),k=function(){lay(y).find("ol").each(function(e){var t=this,n=lay(t).find("li");t.scrollTop=30*(a[C][w[e]]-2),t.scrollTop<=0&&n.each(function(e,a){if(!lay(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=lay(c[2]).find("."+T);k(),E.innerHTML=n.range?[l.startTime,l.endTime][t]:l.timeTips,lay(a.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(E),lay(y).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var l=0|this.innerHTML;lay(this).hasClass(s)||(n.range?a[C][w[e]]=l:i[w[e]]=l,lay(t).find("."+o).removeClass(o),lay(this).addClass(o),b(),k(),(a.endDate||"time"===n.type)&&a.done(null,"change"),a.setBtnStatus())})})}return a},w.prototype.listYM=[],w.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,a){lay(this).find("."+m).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+T).remove()},w.prototype.setBtnStatus=function(e,t,a){var n,i=this,l=i.config,r=lay(i.footer).find(v);l.range&&"time"!==l.type&&(t=t||l.dateTime,a=a||i.endDate,n=i.newDate(t).getTime()>i.newDate(a).getTime(),i.limit(null,t)||i.limit(null,a)?r.addClass(s):r[n?"addClass":"removeClass"](s),e&&n&&i.hint("string"==typeof e?y.replace(/日期/g,e):y))},w.prototype.parse=function(e,t){var a=this,n=a.config,i=t||(e?lay.extend({},a.endDate,a.endTime):n.range?lay.extend({},n.dateTime,a.startTime):n.dateTime),l=a.format.concat();return lay.each(l,function(e,t){/yyyy|y/.test(t)?l[e]=lay.digit(i.year,t.length):/MM|M/.test(t)?l[e]=lay.digit(i.month+1,t.length):/dd|d/.test(t)?l[e]=lay.digit(i.date,t.length):/HH|H/.test(t)?l[e]=lay.digit(i.hours,t.length):/mm|m/.test(t)?l[e]=lay.digit(i.minutes,t.length):/ss|s/.test(t)&&(l[e]=lay.digit(i.seconds,t.length))}),n.range&&!e?l.join("")+" "+n.range+" "+a.parse(1):l.join("")},w.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},w.prototype.setValue=function(e){var t=this,a=t.config,n=t.bindElem||a.elem[0],i=t.isInput(n)?"val":"html";return"static"===a.position||lay(n)[i](e||""),this},w.prototype.stampRange=function(){var e,t,a=this,n=a.config,i=n.dateTime,l=lay(a.elem).find("td");if(n.range&&!a.endDate&&lay(a.footer).find(v).addClass(s),a.endDate)return e=a.newDate({year:i.year,month:i.month,date:i.date}).getTime(),t=a.newDate({year:a.endDate.year,month:a.endDate.month,date:a.endDate.date}).getTime(),e>t?a.hint(y):void lay.each(l,function(n,i){var l=lay(i).attr("lay-ymd").split("-"),r=a.newDate({year:l[0],month:l[1]-1,date:l[2]}).getTime();lay(i).removeClass(u+" "+o),r!==e&&r!==t||lay(i).addClass(lay(i).hasClass(f)||lay(i).hasClass(p)?u:o),r>e&&r Date: Wed, 31 Mar 2021 23:27:06 +0800 Subject: [PATCH 22/26] update --- dist/laydate.js | 4 +- dist/theme/default/laydate.css | 2 +- gulpfile.js | 2 +- package.json | 2 +- src/laydate.js | 283 ++++++++++++++++++++++----------- src/theme/default/laydate.css | 51 +++--- 6 files changed, 216 insertions(+), 128 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index a59cab2..031c724 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! layDate v5.1.0 | 日期与时间组件 | The MIT License */ - ;!function(){"use strict";var e="lay",t=window.document,a=function(e){return new n(e)},n=function(e){for(var a=0,n="object"==typeof e?[e]:(this.selector=e,t.querySelectorAll(e||null));a0;i--)if("interactive"===a[i].readyState){e=a[i].src;break}return e||a[n].src}();return e.substring(0,e.lastIndexOf("/")+1)},a.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},a.each=function(e,t){var a,n=this;if("function"!=typeof t)return n;if(e=e||[],e.constructor===Object){for(a in e)if(t.call(e[a],a,e[a]))break}else for(a=0;a80?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(a.getStyle(t.getElementById(s),"width"))?n():setTimeout(c,100))}()},n.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),a.each(t,function(t,a){new RegExp("\\b"+a+"\\b").test(e)||(e=e+" "+a)}),e.replace(/^\s|\s$/,"")},n.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),a.each(t,function(t,a){var n=new RegExp("\\b"+a+"\\b");n.test(e)&&(e=e.replace(n,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},n.prototype.find=function(e){var t=this,n=0,i=[],l="object"==typeof e;return this.each(function(a,r){for(var o=l?[e]:r.querySelectorAll(e||null);n0)return a[0].getAttribute(e)}():a.each(function(a,n){n.setAttribute(e,t)})},n.prototype.removeAttr=function(e){return this.each(function(t,a){a.removeAttribute(e)})},n.prototype.html=function(e){return this.each(function(t,a){a.innerHTML=e})},n.prototype.val=function(e){return this.each(function(t,a){a.value=e})},n.prototype.append=function(e){return this.each(function(t,a){"object"==typeof e?a.appendChild(e):a.innerHTML=a.innerHTML+e})},n.prototype.remove=function(e){return this.each(function(t,a){e?a.removeChild(e):a.parentNode.removeChild(a)})},n.prototype.on=function(e,t){return this.each(function(a,n){n.attachEvent?n.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(n,e)}):n.addEventListener(e,t,!1)})},n.prototype.off=function(e,t){return this.each(function(a,n){n.detachEvent?n.detachEvent("on"+e,t):n.removeEventListener(e,t,!1)})},window.lay=a,window.layui&&layui.define&&layui.define(function(t){t(e,a)})}(),!function(e){"use strict";var t=e.layui&&layui.define,a={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,a,i){n.path&&e.lay&&lay.link&&lay.link(n.path+t,a,i)}},n={v:"5.1.0",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:a.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var i="laydate",l="",r=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+l;return t?layui.addcss(r,e,i):a.link(r,e,i),this}},i=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},l="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",y="开始时间不能早于结束时间
        请重新选择",c=[100,2e5],d="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",f="laydate-day-prev",p="laydate-day-next",g="layui-laydate-footer",v=".laydate-btns-confirm",T="laydate-time-text",D=".laydate-btns-time",w=function(e){var t=this;t.index=++n.index,t.config=lay.extend({},t.config,n.config,e),n.ready(function(){t.init()})};w.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},w.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},w.prototype.lang=function(){var e=this,t=e.config,a={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return a[t.lang]||a.cn},w.prototype.init=function(){var e=this,t=e.config,a="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",n="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=lay(t.elem),t.eventElem=lay(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(a+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",lay.each(e.format,function(t,n){var i=new RegExp(a).test(n)?"\\d{"+function(){return new RegExp(a).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=lay.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),lay.each(["min","max"],function(e,a){var n=[],i=[];if("number"==typeof t[a]){var l=t[a],r=(new Date).getTime(),o=864e5,s=new Date(l?l0)return!0;var n=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),a=lay.elem("span");return e.appendChild(t),e.appendChild(a),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],y=lay.elem("div",{"class":"layui-laydate-content"}),c=lay.elem("table"),d=lay.elem("thead"),m=lay.elem("tr");lay.each(i,function(e,t){n.appendChild(t)}),d.appendChild(m),lay.each(new Array(6),function(e){var t=c.insertRow(0);lay.each(new Array(7),function(n){if(0===e){var i=lay.elem("th");i.innerHTML=a.weeks[n],m.appendChild(i)}t.insertCell(n)})}),c.insertBefore(d,c.children[0]),y.appendChild(c),l[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),l[e].appendChild(n),l[e].appendChild(y),r.push(i),o.push(y),s.push(c)}),lay(y).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+a.timeTips+""),lay.each(t.btns,function(e,l){var r=a.tools[l]||"btn";t.range&&"now"===l||(n&&"clear"===l&&(r="cn"===t.lang?"重置":"Reset"),i.push(''+r+""))}),e.push('"),e.join("")}()),lay.each(l,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(y),/^#/.test(t.theme)){var c=lay.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in c?(c.setAttribute("type","text/css"),c.styleSheet.cssText=m):c.innerHTML=m,lay(i).addClass("laydate-theme-molv"),i.appendChild(c)}e.remove(w.thisElemDate),n?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),w.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1}))},w.prototype.remove=function(e){var t=this,a=(t.config,lay("#"+(e||t.elemID)));return a.hasClass(d)||t.checkDate(function(){a.remove(),delete t.endDate}),t},w.prototype.position=function(){var e=this,t=e.config,a=e.bindElem||t.elem[0],n=a.getBoundingClientRect(),i=e.elem.offsetWidth,l=e.elem.offsetHeight,r=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},o=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},s=5,y=n.left,c=n.bottom;y+i+s>o("width")&&(y=o("width")-i-s),c+l+s>o()&&(c=n.top>l?n.top-l:o()-l,c-=2*s),t.position&&(e.elem.style.position=t.position),e.elem.style.left=y+("fixed"===t.position?0:r(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:r())+"px"},w.prototype.hint=function(e){var t=this,a=(t.config,lay.elem("div",{"class":h}));t.elem&&(a.innerHTML=e||"",lay(t.elem).find("."+h).remove(),t.elem.appendChild(a),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+h).remove()},3e3))},w.prototype.getAsYM=function(e,t,a){return a?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},w.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},w.prototype.checkDate=function(e){var t,a,i=this,l=(new Date,i.config),r=l.dateTime=l.dateTime||i.systemDate(),o=i.bindElem||l.elem[0],s=(i.isInput(o)?"val":"html",i.isInput(o)?o.value:"static"===l.position?"":o.innerHTML),y=function(e){e.year>c[1]&&(e.year=c[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},d=function(e,t,n){var r=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,l.range&&(i[r[n]]=i[r[n]]||{}),lay.each(i.format,function(o,s){var y=parseFloat(t[o]);t[o].length必须遵循下述格式:
        "+(l.range?l.format+" "+l.range+" "+l.format:l.format)+"
        已为你重置"),a=!0):s&&s.constructor===Date?l.dateTime=i.systemDate(s):(l.dateTime=i.systemDate(),delete i.startTime,delete i.endTime),y(r),a&&s&&i.setValue(l.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},w.prototype.mark=function(e,t){var a,n=this,i=n.config;return lay.each(i.mark,function(e,n){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(a=n||t[2])}),a&&e.html(''+a+""),n},w.prototype.limit=function(e,t,a,n){var i,l=this,r=l.config,o={},y=r[a>41?"endDate":"dateTime"],c=lay.extend({},y,t||{});return lay.each({now:c,min:r.min,max:r.max},function(e,t){o[e]=l.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(n,function(a,n){e[n]=t[n]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](s),i},w.prototype.thisDateTime=function(e){var t=this,a=t.config;return e?t.endDate:a.dateTime},w.prototype.calendar=function(e,t,a){var i,l,r,s=this,y=s.config,t=t?1:0,d=e||s.thisDateTime(t),m=new Date,u=s.lang(),h="date"!==y.type&&"datetime"!==y.type,f=lay(s.table[t]).find("td"),p=lay(s.elemHeader[t][2]).find("span");return d.yearc[1]&&(d.year=c[1],s.hint("最高只能支持到公元"+c[1]+"年")),s.firstDate||(s.firstDate=lay.extend({},d)),m.setFullYear(d.year,d.month,1),i=m.getDay(),l=n.getEndDate(d.month||12,d.year),r=n.getEndDate(d.month+1,d.year),lay.each(f,function(e,t){var a=[d.year,d.month],n=0;t=lay(t),t.removeAttr("class"),e=i&&e=a.firstDate.year&&(l.month=n.max.month,l.date=n.max.date),a.limit(lay(i),l,t),x++}),lay(d[f?0:1]).attr("lay-ym",x-8+"-"+g[1]).html(M+p+" - "+(x-1+p))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),r={year:g[0],month:e};e+1==g[1]&&lay(i).addClass(o),i.innerHTML=l.month[e]+(f?"月":""),y.appendChild(i),g[0]=a.firstDate.year&&(r.date=n.max.date),a.limit(lay(i),r,t)}),lay(d[f?0:1]).attr("lay-ym",g[0]+"-"+g[1]).html(g[0]+p);else if("time"===e){var b=function(){lay(y).find("ol").each(function(e,n){lay(n).find("li").each(function(n,i){a.limit(lay(i),[{hours:n},{hours:a[C].hours,minutes:n},{hours:a[C].hours,minutes:a[C].minutes,seconds:n}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),n.range||a.limit(lay(a.footer).find(v),a[C],0,["hours","minutes","seconds"])};n.range?a[C]||(a[C]={hours:0,minutes:0,seconds:0}):a[C]=i,lay.each([24,60,60],function(e,t){var n=lay.elem("li"),i=["

        "+l.time[e]+"

          "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),n.innerHTML=i.join("")+"
        ",y.appendChild(n)}),b()}if(h&&u.removeChild(h),u.appendChild(y),"year"===e||"month"===e)lay(a.elemMain[t]).addClass("laydate-ym-show"),lay(y).find("li").on("click",function(){var l=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(s)){0===t?(i[e]=l,a.limit(lay(a.footer).find(v),null,0)):a.endDate[e]=l;var c="year"===n.type||"month"===n.type;c?(lay(y).find("."+o).removeClass(o),lay(this).addClass(o),"month"===n.type&&"year"===e&&(a.listYM[t][0]=l,r&&(t?i.year=l:a.endDate.year=l),a.list("month",t))):(a.checkDate("limit").calendar(null,t),a.closeList()),a.setBtnStatus(),n.range||(("month"===n.type&&"month"===e||"year"===n.type&&"year"===e)&&a.setValue(a.parse()).remove().done(),a.done(null,"change")),lay(a.footer).find(D).removeClass(s)}});else{var E=lay.elem("span",{"class":T}),k=function(){lay(y).find("ol").each(function(e){var t=this,n=lay(t).find("li");t.scrollTop=30*(a[C][w[e]]-2),t.scrollTop<=0&&n.each(function(e,a){if(!lay(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=lay(c[2]).find("."+T);k(),E.innerHTML=n.range?[l.startTime,l.endTime][t]:l.timeTips,lay(a.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(E),lay(y).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var l=0|this.innerHTML;lay(this).hasClass(s)||(n.range?a[C][w[e]]=l:i[w[e]]=l,lay(t).find("."+o).removeClass(o),lay(this).addClass(o),b(),k(),(a.endDate||"time"===n.type)&&a.done(null,"change"),a.setBtnStatus())})})}return a},w.prototype.listYM=[],w.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,a){lay(this).find("."+m).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+T).remove()},w.prototype.setBtnStatus=function(e,t,a){var n,i=this,l=i.config,r=lay(i.footer).find(v);l.range&&"time"!==l.type&&(t=t||l.dateTime,a=a||i.endDate,n=i.newDate(t).getTime()>i.newDate(a).getTime(),i.limit(null,t)||i.limit(null,a)?r.addClass(s):r[n?"addClass":"removeClass"](s),e&&n&&i.hint("string"==typeof e?y.replace(/日期/g,e):y))},w.prototype.parse=function(e,t){var a=this,n=a.config,i=t||(e?lay.extend({},a.endDate,a.endTime):n.range?lay.extend({},n.dateTime,a.startTime):n.dateTime),l=a.format.concat();return lay.each(l,function(e,t){/yyyy|y/.test(t)?l[e]=lay.digit(i.year,t.length):/MM|M/.test(t)?l[e]=lay.digit(i.month+1,t.length):/dd|d/.test(t)?l[e]=lay.digit(i.date,t.length):/HH|H/.test(t)?l[e]=lay.digit(i.hours,t.length):/mm|m/.test(t)?l[e]=lay.digit(i.minutes,t.length):/ss|s/.test(t)&&(l[e]=lay.digit(i.seconds,t.length))}),n.range&&!e?l.join("")+" "+n.range+" "+a.parse(1):l.join("")},w.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},w.prototype.setValue=function(e){var t=this,a=t.config,n=t.bindElem||a.elem[0],i=t.isInput(n)?"val":"html";return"static"===a.position||lay(n)[i](e||""),this},w.prototype.stampRange=function(){var e,t,a=this,n=a.config,i=n.dateTime,l=lay(a.elem).find("td");if(n.range&&!a.endDate&&lay(a.footer).find(v).addClass(s),a.endDate)return e=a.newDate({year:i.year,month:i.month,date:i.date}).getTime(),t=a.newDate({year:a.endDate.year,month:a.endDate.month,date:a.endDate.date}).getTime(),e>t?a.hint(y):void lay.each(l,function(n,i){var l=lay(i).attr("lay-ymd").split("-"),r=a.newDate({year:l[0],month:l[1]-1,date:l[2]}).getTime();lay(i).removeClass(u+" "+o),r!==e&&r!==t||lay(i).addClass(lay(i).hasClass(f)||lay(i).hasClass(p)?u:o),r>e&&r0;i--)if("interactive"===n[i].readyState){e=n[i].src;break}return e||n[a].src}();return e.substring(0,e.lastIndexOf("/")+1)},n.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},n.each=function(e,t){var n,a=this;if("function"!=typeof t)return a;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;n80?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(n.getStyle(t.getElementById(s),"width"))?a():setTimeout(y,100))}()},n.hasScrollbar=function(){return t.body.scrollHeight>(window.innerHeight||t.documentElement.clientHeight)},n.position=function(e,a,i){if(a){i=i||{},e!==t&&e!==n("body")[0]||(i.clickType="right");var r="right"===i.clickType?function(){var e=i.e||window.event||{};return{left:e.clientX,top:e.clientY,right:e.clientX,bottom:e.clientY}}():e.getBoundingClientRect(),l=a.offsetWidth,o=a.offsetHeight,s=function(e){return e=e?"scrollLeft":"scrollTop",t.body[e]|t.documentElement[e]},c=function(e){return t.documentElement[e?"clientWidth":"clientHeight"]},y=5,d=r.left,u=r.bottom;d+l+y>c("width")&&(d=c("width")-l-y),u+o+y>c()&&(r.top>o+y?u=r.top-o-2*y:"right"===i.clickType&&(u=c()-o-2*y,u<0&&(u=0)));var m=i.position;if(m&&(a.style.position=m),a.style.left=d+("fixed"===m?0:s(1))+"px",a.style.top=u+("fixed"===m?0:s())+"px",!n.hasScrollbar()){var h=a.getBoundingClientRect();!i.SYSTEM_RELOAD&&h.bottom+y>c()&&(i.SYSTEM_RELOAD=!0,setTimeout(function(){n.position(e,a,i)},50))}}},n.options=function(e,t){var a=n(e),i=t||"lay-options";try{return new Function("return "+(a.attr(i)||"{}"))()}catch(r){return hint.error("parseerror:"+r,"error"),{}}},n.isTopElem=function(e){var a=[t,n("body")[0]],i=!1;return n.each(a,function(t,n){if(n===e)return i=!0}),i},a.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){new RegExp("\\b"+n+"\\b").test(e)||(e=e+" "+n)}),e.replace(/^\s|\s$/,"")},a.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){var a=new RegExp("\\b"+n+"\\b");a.test(e)&&(e=e.replace(a,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},a.prototype.find=function(e){var t=this,a=0,i=[],r="object"==typeof e;return this.each(function(n,l){for(var o=r?[e]:l.querySelectorAll(e||null);a0)return a[0].style[e]}():a.each(function(a,r){"object"==typeof e?n.each(e,function(e,t){r.style[e]=i(t)}):r.style[e]=i(t)})},a.prototype.width=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetWidth}():t.each(function(n,a){t.css("width",e)})},a.prototype.height=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetHeight}():t.each(function(n,a){t.css("height",e)})},a.prototype.attr=function(e,t){var n=this;return void 0===t?function(){if(n.length>0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},a.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},a.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},a.prototype.val=function(e){return this.each(function(t,n){n.value=e})},a.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},a.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},a.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},a.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},window.lay=n,window.layui&&layui.define&&layui.define(function(t){t(e,n)})}(),!function(e){"use strict";var t=e.layui&&layui.define,n={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,n,i){a.path&&e.lay&&lay.link&&lay.link(a.path+t,n,i)}},a={v:"5.2.0",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:n.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var i="laydate",r="",l=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+a.v+r;return t?layui.addcss(l,e,i):n.link(l,e,i),this}},i=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},r="laydate",l=".layui-laydate",o="layui-this",s="laydate-disabled",c=[100,2e5],y="layui-laydate-static",d="layui-laydate-list",u="layui-laydate-hint",m="layui-laydate-footer",h=".laydate-btns-confirm",f="laydate-time-text",p=".laydate-btns-time",g=function(e){var t=this;t.index=++a.index,t.config=lay.extend({},t.config,a.config,e),a.ready(function(){t.init()})};g.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},g.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"click",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},g.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"},timeout:"结束时间不能早于开始时间
        请重新选择",invalidDate:"不在有效日期或时间范围内",formatError:["日期格式不合法
        必须遵循下述格式:
        ","
        已为你重置"]},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
        Please re-select",invalidDate:"Invalid date",formatError:["The date format error
        Must be followed:
        ","
        It has been reset"]}};return n[t.lang]||n.cn},g.prototype.init=function(){var t=this,n=t.config,a="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",i="static"===n.position,r={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};n.elem=lay(n.elem),n.eventElem=lay(n.eventElem),n.elem[0]&&(n.range===!0&&(n.range="-"),r[n.type]||(e.console&&console.error&&console.error("laydate type error:'"+n.type+"' is not supported"),n.type="date"),n.format===r.date&&(n.format=r[n.type]||r.date),t.format=n.format.match(new RegExp(a+"|.","g"))||[],t.EXP_IF="",t.EXP_SPLIT="",lay.each(t.format,function(e,n){var i=new RegExp(a).test(n)?"\\d{"+function(){return new RegExp(a).test(t.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;t.EXP_IF=t.EXP_IF+i,t.EXP_SPLIT=t.EXP_SPLIT+"("+i+")"}),t.EXP_IF=new RegExp("^"+(n.range?t.EXP_IF+"\\s\\"+n.range+"\\s"+t.EXP_IF:t.EXP_IF)+"$"),t.EXP_SPLIT=new RegExp("^"+t.EXP_SPLIT+"$",""),t.isInput(n.elem[0])||"focus"===n.trigger&&(n.trigger="click"),n.elem.attr("lay-key")||(n.elem.attr("lay-key",t.index),n.eventElem.attr("lay-key",t.index)),n.mark=lay.extend({},n.calendar&&"cn"===n.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},n.mark),lay.each(["min","max"],function(e,t){var a=[],i=[];if("number"==typeof n[t]){var r=n[t],l=(new Date).getTime(),o=864e5,s=new Date(r?r0)return!0;var a=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),n=lay.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],c=lay.elem("div",{"class":"layui-laydate-content"}),y=lay.elem("table"),d=lay.elem("thead"),u=lay.elem("tr");lay.each(i,function(e,t){a.appendChild(t)}),d.appendChild(u),lay.each(new Array(6),function(e){var t=y.insertRow(0);lay.each(new Array(7),function(a){if(0===e){var i=lay.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),y.insertBefore(d,y.children[0]),c.appendChild(y),r[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(c),l.push(i),o.push(c),s.push(y)}),lay(c).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),lay.each(t.btns,function(e,r){var l=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(l="cn"===t.lang?"重置":"Reset"),i.push(''+l+""))}),e.push('"),e.join("")}()),lay.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(c),/^#/.test(t.theme)){var d=lay.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in d?(d.setAttribute("type","text/css"),d.styleSheet.cssText=u):d.innerHTML=u,lay(i).addClass("laydate-theme-molv"),i.appendChild(d)}e.remove(g.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),g.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1}))},g.prototype.remove=function(e){var t=this,n=(t.config,lay("#"+(e||t.elemID)));return n[0]?(n.hasClass(y)||t.checkDate(function(){n.remove(),delete t.endDate}),t):t},g.prototype.position=function(){var e=this,t=e.config;return lay.position(e.bindElem||t.elem[0],e.elem,{position:t.position}),e},g.prototype.hint=function(e){var t=this,n=(t.config,lay.elem("div",{"class":u}));t.elem&&(n.innerHTML=e||"",lay(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+u).remove()},3e3))},g.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},g.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},g.prototype.checkDate=function(e){var t,n,i=this,r=(new Date,i.config),l=i.lang(),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],y=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),d=function(e){e.year>c[1]&&(e.year=c[1],n=!0),e.month>11&&(e.month=11,n=!0),e.hours>23&&(e.hours=0,n=!0),e.minutes>59&&(e.minutes=0,e.hours++,n=!0),e.seconds>59&&(e.seconds=0,e.minutes++,n=!0),t=a.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,n=!0)},u=function(e,t,a){var l=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),a=a||0,r.range&&(i[l[a]]=i[l[a]]||{}),lay.each(i.format,function(o,s){var y=parseFloat(t[o]);t[o].length'+n+""),a},g.prototype.limit=function(e,t,n,a){var i,r=this,l=r.config,o={},c=l[n>41?"endDate":"dateTime"],y=lay.extend({},c,t||{});return lay.each({now:y,min:l.min,max:l.max},function(e,t){o[e]=r.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](s),i},g.prototype.thisDateTime=function(e){var t=this,n=t.config;return e?t.endDate:n.dateTime},g.prototype.calendar=function(e,t,n){var i,r,l,s=this,y=s.config,t=t?1:0,d=e||s.thisDateTime(t),u=new Date,m=s.lang(),f="date"!==y.type&&"datetime"!==y.type,p=lay(s.table[t]).find("td"),g=lay(s.elemHeader[t][2]).find("span");return d.yearc[1]&&(d.year=c[1],s.hint(m.invalidDate)),s.firstDate||(s.firstDate=lay.extend({},d)),u.setFullYear(d.year,d.month,1),i=u.getDay(),r=a.getEndDate(d.month||12,d.year),l=a.getEndDate(d.month+1,d.year),lay.each(p,function(e,t){var n=[d.year,d.month],a=0;t=lay(t),t.removeAttr("class"),e=i&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(lay(i),r,t),x++}),lay(u[v?0:1]).attr("lay-ym",x-8+"-"+D[1]).html(M+T+" - "+(x-1+T))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),l={year:D[0],month:e};e+1==D[1]&&lay(i).addClass(o),i.innerHTML=r.month[e]+(v?"月":""),c.appendChild(i),D[0]=n.firstDate.year&&(l.date=a.max.date),n.limit(lay(i),l,t)}),lay(u[v?0:1]).attr("lay-ym",D[0]+"-"+D[1]).html(D[0]+T);else if("time"===e){var C=function(){lay(c).find("ol").each(function(e,a){lay(a).find("li").each(function(a,i){n.limit(lay(i),[{hours:a},{hours:n[b].hours,minutes:a},{hours:n[b].hours,minutes:n[b].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(lay(n.footer).find(h),n[b],0,["hours","minutes","seconds"])};a.range?n[b]||(n[b]={hours:0,minutes:0,seconds:0}):n[b]=i,lay.each([24,60,60],function(e,t){var a=lay.elem("li"),i=["

        "+r.time[e]+"

          "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",c.appendChild(a)}),C()}if(g&&m.removeChild(g),m.appendChild(c),"year"===e||"month"===e)lay(n.elemMain[t]).addClass("laydate-ym-show"),lay(c).find("li").on("click",function(){var r=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(s)){0===t?(i[e]=r,n.limit(lay(n.footer).find(h),null,0)):n.endDate[e]=r;var y="year"===a.type||"month"===a.type;y?(lay(c).find("."+o).removeClass(o),lay(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(t?i.year=r:n.endDate.year=r),n.list("month",t))):(n.checkDate("limit").calendar(null,t),n.closeList()),n.setBtnStatus(),a.range||(("month"===a.type&&"month"===e||"year"===a.type&&"year"===e)&&n.setValue(n.parse()).remove().done(),n.done(null,"change")),lay(n.footer).find(p).removeClass(s)}});else{var E=lay.elem("span",{"class":f}),k=function(){lay(c).find("ol").each(function(e){var t=this,a=lay(t).find("li");t.scrollTop=30*(n[b][w[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!lay(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},S=lay(y[2]).find("."+f);k(),E.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,lay(n.elemMain[t]).addClass("laydate-time-show"),S[0]&&S.remove(),y[2].appendChild(E),lay(c).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var r=0|this.innerHTML;lay(this).hasClass(s)||(a.range?n[b][w[e]]=r:i[w[e]]=r,lay(t).find("."+o).removeClass(o),lay(this).addClass(o),C(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},g.prototype.listYM=[],g.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,n){lay(this).find("."+d).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+f).remove()},g.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,l=i.lang(),o=lay(i.footer).find(h);r.range&&"time"!==r.type&&(t=t||r.dateTime,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.timeout.replace(/日期/g,e):l.timeout))},g.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?lay.extend({},n.endDate,n.endTime):a.range?lay.extend({},a.dateTime,n.startTime):a.dateTime),r=n.format.concat();return lay.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=lay.digit(i.year,t.length):/MM|M/.test(t)?r[e]=lay.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=lay.digit(i.date,t.length):/HH|H/.test(t)?r[e]=lay.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=lay.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=lay.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},g.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},g.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||lay(a)[i](e||""),this},g.prototype.done=function(e,t){var n=this,a=n.config,i=lay.extend({},lay.extend(a.dateTime,n.startTime)),r=lay.extend({},lay.extend(n.endDate,n.endTime));return lay.each([i,r],function(e,t){"month"in t&&lay.extend(t,{month:t.month+1})}),e=e||[n.parse(),i,r],"function"==typeof a[t||"done"]&&a[t||"done"].apply(a,e),n},g.prototype.choose=function(e,t){var n=this,a=n.config,i=n.thisDateTime(t),r=(lay(n.elem).find("td"),e.attr("lay-ymd").split("-"));r={year:0|r[0],month:(0|r[1])-1,date:0|r[2]},e.hasClass(s)||(lay.extend(i,r),a.range?(lay.each(["startTime","endTime"],function(e,t){n[t]=n[t]||{hours:0,minutes:0,seconds:0}}),n.calendar(null,t)):"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"))},g.prototype.tool=function(e,t){var n=this,a=n.config,i=n.lang(),r=a.dateTime,l="static"===a.position,o={datetime:function(){lay(e).hasClass(s)||(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(){n.setValue("").remove(),l&&(lay.extend(r,n.firstDate),n.calendar()),a.range&&(delete n.endDate,delete n.startTime,delete n.endTime),n.done(["",{},{}])},now:function(){var e=new Date;lay.extend(r,n.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),n.setValue(n.parse()).remove(),l&&n.calendar(),n.done()},confirm:function(){if(a.range){if(lay(e).hasClass(s))return n.hint("time"===a.type?i.timeout.replace(/日期/g,"时间"):i.timeout)}else if(lay(e).hasClass(s))return n.hint(i.invalidDate);n.done(),n.setValue(n.parse()).remove()}};o[t]&&o[t]()},g.prototype.change=function(e){var t=this,n=t.config,a=t.thisDateTime(e),i=n.range&&("year"===n.type||"month"===n.type),r=t.elemCont[e||0],l=t.listYM[e],o=function(o){var s=lay(r).find(".laydate-year-list")[0],c=lay(r).find(".laydate-month-list")[0];return s&&(l[0]=o?l[0]-15:l[0]+15,t.list("year",e)),c&&(o?l[0]--:l[0]++,t.list("month",e)),(s||c)&&(lay.extend(a,{year:l[0]}),i&&(a.year=l[0]),n.range||t.done(null,"change"),n.range||t.limit(lay(t.footer).find(h),{year:l[0]})),t.setBtnStatus(),s||c};return{prevYear:function(){o("sub")||(a.year--,t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change"))},prevMonth:function(){var i=t.getAsYM(a.year,a.month,"sub");lay.extend(a,{year:i[0],month:i[1]}),t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change")},nextMonth:function(){var i=t.getAsYM(a.year,a.month);lay.extend(a,{year:i[0],month:i[1]}),t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change")},nextYear:function(){o()||(a.year++,t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change"))}}},g.prototype.changeEvent=function(){var e=this;e.config;lay(e.elem).on("click",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),i=a.attr("lay-ym"),r=a.attr("lay-type");i&&(i=i.split("-"),e.listYM[t]=[0|i[0],0|i[1]],e.list(r,t),lay(e.footer).find(p).addClass(s))}),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)})},g.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())},g.prototype.events=function(){var t=this,n=t.config,a=function(e,a){e.on(n.trigger,function(){a&&(t.bindElem=this),t.render()}),e.on("blur",function(){t.remove()})};n.elem[0]&&!n.elem[0].eventHandler&&(a(n.elem,"bind"),a(n.eventElem),lay(document).on("click",function(e){e.target!==n.elem[0]&&e.target!==n.eventElem[0]&&e.target!==lay(n.closeStop)[0]&&t.remove()}).on("keydown",function(e){13===e.keyCode&&lay("#"+t.elemID)[0]&&t.elemID===g.thisElemDate&&(e.preventDefault(),lay(t.footer).find(h)[0].click())}),lay(e).on("resize",function(){return!(!t.elem||!lay(l)[0])&&void t.position()}),n.elem[0].eventHandler=!0)},a.render=function(e){var t=new g(e);return i.call(t)},a.getEndDate=function(e,t){var n=new Date;return n.setFullYear(t||n.getFullYear(),e||n.getMonth()+1,1),new Date(n.getTime()-864e5).getDate()},t?(a.ready(),layui.define("lay",function(e){a.path=layui.cache.dir,e(r,a)})):"function"==typeof define&&define.amd?define(function(){return a}):function(){a.ready(),e.laydate=a}()}(window); \ No newline at end of file diff --git a/dist/theme/default/laydate.css b/dist/theme/default/laydate.css index 369e1a4..5f03d17 100644 --- a/dist/theme/default/laydate.css +++ b/dist/theme/default/laydate.css @@ -1 +1 @@ -.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content,.layui-laydate-range .laydate-main-list-1 .layui-laydate-header{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;animation-name:laydate-downbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@keyframes laydate-downbit{0%{opacity:.3;transform:translate3d(0,-5px,0)}100%{opacity:1;transform:translate3d(0,0,0)}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content,.layui-laydate-range .laydate-main-list-1 .layui-laydate-header{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index ccc619b..2aa825d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -43,7 +43,7 @@ gulp.task('other', task.other); //移动一些配件 //打包发行版 gulp.task('clearZip', function(cb){ //清理 - return del(['./release/zip/*'], cb); + return del(['./release/zip/layDate-v'+ pkg.version], cb); }); gulp.task('r', ['clearZip'], function(){ gulp.src('./release/doc/**/*') diff --git a/package.json b/package.json index 0ee59c5..4a7747a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "layui-laydate", "realname": "layDate", - "version": "5.1.0", + "version": "5.2.0", "description": "日期与时间组件", "main": "src/laydate.js", "license": "MIT", diff --git a/src/laydate.js b/src/laydate.js index 4f30bff..cd0de46 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -165,6 +165,109 @@ }()); }; + //当前页面是否存在滚动条 + lay.hasScrollbar = function(){ + return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight); + }; + + //元素定位 + lay.position = function(elem, elemView, obj){ + if(!elemView) return; + obj = obj || {}; + + //如果绑定的是 document 或 body 元素,则直接获取鼠标坐标 + if(elem === document || elem === lay('body')[0]){ + obj.clickType = 'right'; + } + + //绑定绑定元素的坐标 + var rect = obj.clickType === 'right' ? function(){ + var e = obj.e || window.event || {}; + return { + left: e.clientX + ,top: e.clientY + ,right: e.clientX + ,bottom: e.clientY + } + }() : elem.getBoundingClientRect() + ,elemWidth = elemView.offsetWidth //控件的宽度 + ,elemHeight = elemView.offsetHeight //控件的高度 + + //滚动条高度 + ,scrollArea = function(type){ + type = type ? 'scrollLeft' : 'scrollTop'; + return document.body[type] | document.documentElement[type]; + } + + //窗口宽高 + ,winArea = function(type){ + return document.documentElement[type ? 'clientWidth' : 'clientHeight'] + }, margin = 5, left = rect.left, top = rect.bottom; + + //判断右侧是否超出边界 + if(left + elemWidth + margin > winArea('width')){ + left = winArea('width') - elemWidth - margin; //如果超出右侧,则将面板向右靠齐 + } + + //判断底部和顶部是否超出边界 + if(top + elemHeight + margin > winArea()){ + //优先顶部是否有足够区域显示完全 + if(rect.top > elemHeight + margin){ + top = rect.top - elemHeight - margin*2; //顶部有足够的区域显示 + } else { + //如果面板是鼠标右键弹出,且顶部没有足够区域显示,则将面板向底部靠齐 + if(obj.clickType === 'right'){ + top = winArea() - elemHeight - margin*2; + if(top < 0) top = 0; //不能溢出窗口顶部 + } + } + } + + //定位类型 + var position = obj.position; + if(position) elemView.style.position = position; + + //设置坐标 + elemView.style.left = left + (position === 'fixed' ? 0 : scrollArea(1)) + 'px'; + elemView.style.top = top + (position === 'fixed' ? 0 : scrollArea()) + 'px'; + + //防止页面无滚动条时,又因为弹出面板而出现滚动条导致的坐标计算偏差 + if(!lay.hasScrollbar()){ + var rect1 = elemView.getBoundingClientRect(); + //如果弹出面板的溢出窗口底部,则表示将出现滚动条,此时需要重新计算坐标 + if(!obj.SYSTEM_RELOAD && (rect1.bottom + margin) > winArea()){ + obj.SYSTEM_RELOAD = true; + setTimeout(function(){ + lay.position(elem, elemView, obj); + }, 50); + } + } + }; + + //获取元素上的参数配置上 + lay.options = function(elem, attr){ + var othis = lay(elem) + ,attrName = attr || 'lay-options'; + try { + return new Function('return '+ (othis.attr(attrName) || '{}'))(); + } catch(ev) { + hint.error('parseerror:'+ ev, 'error'); + return {}; + } + }; + + //元素是否属于顶级元素(document 或 body) + lay.isTopElem = function(elem){ + var topElems = [document, lay('body')[0]] + ,matched = false; + lay.each(topElems, function(index, item){ + if(item === elem){ + return matched = true + } + }); + return matched; + }; + //追加字符 LAY.addStr = function(str, new_str){ str = str.replace(/\s+/, ' '); @@ -227,12 +330,12 @@ }); }; - //移除css类 + //移除 css 类 LAY.prototype.removeClass = function(className){ return this.addClass(className, true); }; - //是否包含css类 + //是否包含 css 类 LAY.prototype.hasClass = function(className){ var has = false; this.each(function(index, item){ @@ -243,6 +346,41 @@ return has; }; + //添加或获取 css style + LAY.prototype.css = function(key, value){ + var that = this + ,parseValue = function(v){ + return isNaN(v) ? v : (v +'px'); + }; + return (typeof key === 'string' && value === undefined) ? function(){ + if(that.length > 0) return that[0].style[key]; + }() : that.each(function(index, item){ + typeof key === 'object' ? lay.each(key, function(thisKey, thisValue){ + item.style[thisKey] = parseValue(thisValue); + }) : item.style[key] = parseValue(value); + }); + }; + + //添加或获取宽度 + LAY.prototype.width = function(value){ + var that = this; + return value === undefined ? function(){ + if(that.length > 0) return that[0].offsetWidth; //此处还需做兼容 + }() : that.each(function(index, item){ + that.css('width', value); + }); + }; + + //添加或获取高度 + LAY.prototype.height = function(value){ + var that = this; + return value === undefined ? function(){ + if(that.length > 0) return that[0].offsetHeight; //此处还需做兼容 + }() : that.each(function(index, item){ + that.css('height', value); + }); + }; + //添加或获取属性 LAY.prototype.attr = function(key, value){ var that = this; @@ -343,7 +481,7 @@ } ,laydate = { - v: '5.1.0' + v: '5.2.0' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath @@ -377,7 +515,7 @@ } //字符常量 - ,MOD_NAME = 'laydate', ELEM = '.layui-laydate', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'laydate-disabled', TIPS_OUT = '开始时间不能早于结束时间
        请重新选择', LIMIT_YEAR = [100, 200000] + ,MOD_NAME = 'laydate', ELEM = '.layui-laydate', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'laydate-disabled', LIMIT_YEAR = [100, 200000] ,ELEM_STATIC = 'layui-laydate-static', ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = '.laydate-btns-time' @@ -409,8 +547,8 @@ ,isInitValue: true //用于控制是否自动向元素填充初始值(需配合 value 参数使用) ,min: '1900-1-1' //有效最小日期,年月日必须用“-”分割,时分秒必须用“:”分割。注意:它并不是遵循 format 设定的格式。 ,max: '2099-12-31' //有效最大日期,同上 - ,trigger: 'focus' //呼出控件的事件 - ,show: false //是否直接显示,如果设置true,则默认直接显示控件 + ,trigger: 'click' //呼出控件的事件 + ,show: false //是否直接显示,如果设置 true,则默认直接显示控件 ,showBottom: true //是否显示底部栏 ,btns: ['clear', 'now', 'confirm'] //右下角显示的按钮,会按照数组顺序排列 ,lang: 'cn' //语言,只支持cn/en,即中文和英文 @@ -441,6 +579,9 @@ ,clear: '清空' ,now: '现在' } + ,timeout: '结束时间不能早于开始时间
        请重新选择' + ,invalidDate: '不在有效日期或时间范围内' + ,formatError: ['日期格式不合法
        必须遵循下述格式:
        ', '
        已为你重置'] } ,en: { weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] @@ -455,6 +596,9 @@ ,clear: 'Clear' ,now: 'Now' } + ,timeout: 'End time cannot be less than start Time
        Please re-select' + ,invalidDate: 'Invalid date' + ,formatError: ['The date format error
        Must be followed:
        ', '
        It has been reset'] } }; return text[options.lang] || text['cn']; @@ -482,11 +626,20 @@ //日期范围分隔符 if(options.range === true) options.range = '-'; - //根据不同type,初始化默认format + //若 type 设置非法,则初始化为 date 类型 + if(!format[options.type]){ + window.console && console.error && console.error('laydate type error:\''+ options.type + '\' is not supported') + options.type = 'date'; + } + + //根据不同 type,初始化默认 format + if(options.format === format.date){ - options.format = format[options.type]; + options.format = format[options.type] || format.date; + } + //将日期格式转化成数组 that.format = options.format.match(new RegExp(dateType + '|.', 'g')) || []; @@ -768,6 +921,8 @@ var that = this ,options = that.config ,elem = lay('#'+ (prev || that.elemID)); + if(!elem[0]) return that; + if(!elem.hasClass(ELEM_STATIC)){ that.checkDate(function(){ elem.remove(); @@ -780,39 +935,11 @@ //定位算法 Class.prototype.position = function(){ var that = this - ,options = that.config - ,elem = that.bindElem || options.elem[0] - ,rect = elem.getBoundingClientRect() //绑定元素的坐标 - ,elemWidth = that.elem.offsetWidth //控件的宽度 - ,elemHeight = that.elem.offsetHeight //控件的高度 - - //滚动条高度 - ,scrollArea = function(type){ - type = type ? 'scrollLeft' : 'scrollTop'; - return document.body[type] | document.documentElement[type]; - } - ,winArea = function(type){ - return document.documentElement[type ? 'clientWidth' : 'clientHeight'] - }, margin = 5, left = rect.left, top = rect.bottom; - - //如果右侧超出边界 - if(left + elemWidth + margin > winArea('width')){ - left = winArea('width') - elemWidth - margin; - } - - //如果底部超出边界 - if(top + elemHeight + margin > winArea()){ - top = rect.top > elemHeight //顶部是否有足够区域显示完全 - ? rect.top - elemHeight - : winArea() - elemHeight; - top = top - margin*2; - } - - if(options.position){ - that.elem.style.position = options.position; - } - that.elem.style.left = left + (options.position === 'fixed' ? 0 : scrollArea(1)) + 'px'; - that.elem.style.top = top + (options.position === 'fixed' ? 0 : scrollArea()) + 'px'; + ,options = that.config; + lay.position(that.bindElem || options.elem[0], that.elem, { + position: options.position + }); + return that; }; //提示 @@ -867,6 +994,7 @@ var that = this ,thisDate = new Date() ,options = that.config + ,lang = that.lang() ,dateTime = options.dateTime = options.dateTime || that.systemDate() ,thisMaxDate, error @@ -959,9 +1087,9 @@ initDate(dateTime, value) } } else { - that.hint('日期格式不合法
        必须遵循下述格式:
        '+ ( + that.hint(lang.formatError[0] + ( options.range ? (options.format + ' '+ options.range +' ' + options.format) : options.format - ) + '
        已为你重置'); + ) + lang.formatError[1]); error = true; } } else if(value && value.constructor === Date){ //如果值为日期对象时 @@ -1050,8 +1178,8 @@ ,tds = lay(that.table[index]).find('td') ,elemYM = lay(that.elemHeader[index][2]).find('span'); - if(dateTime.year < LIMIT_YEAR[0]) dateTime.year = LIMIT_YEAR[0], that.hint('最低只能支持到公元'+ LIMIT_YEAR[0] +'年'); - if(dateTime.year > LIMIT_YEAR[1]) dateTime.year = LIMIT_YEAR[1], that.hint('最高只能支持到公元'+ LIMIT_YEAR[1] +'年'); + if(dateTime.year < LIMIT_YEAR[0]) dateTime.year = LIMIT_YEAR[0], that.hint(lang.invalidDate); + if(dateTime.year > LIMIT_YEAR[1]) dateTime.year = LIMIT_YEAR[1], that.hint(lang.invalidDate); //记录初始值 if(!that.firstDate){ @@ -1372,6 +1500,7 @@ Class.prototype.setBtnStatus = function(tips, start, end){ var that = this ,options = that.config + ,lang = that.lang() ,isOut, elemBtn = lay(that.footer).find(ELEM_CONFIRM); if(options.range && options.type !== 'time'){ start = start || options.dateTime; @@ -1385,7 +1514,7 @@ //是否异常提示 if(tips && isOut) that.hint( - typeof tips === 'string' ? TIPS_OUT.replace(/日期/g, tips) : TIPS_OUT + typeof tips === 'string' ? lang.timeout.replace(/日期/g, tips) : lang.timeout ); } }; @@ -1448,52 +1577,6 @@ return this; }; - //标记范围内的日期 - Class.prototype.stampRange = function(){ - var that = this - ,options = that.config - ,dateTime = options.dateTime - ,startTime, endTime - ,tds = lay(that.elem).find('td'); - - if(options.range && !that.endDate) lay(that.footer).find(ELEM_CONFIRM).addClass(DISABLED); - if(!that.endDate) return; - - startTime = that.newDate({ - year: dateTime.year - ,month: dateTime.month - ,date: dateTime.date - }).getTime(); - - endTime = that.newDate({ - year: that.endDate.year - ,month: that.endDate.month - ,date: that.endDate.date - }).getTime(); - - if(startTime > endTime) return that.hint(TIPS_OUT); - - lay.each(tds, function(i, item){ - var ymd = lay(item).attr('lay-ymd').split('-') - ,thisTime = that.newDate({ - year: ymd[0] - ,month: ymd[1] - 1 - ,date: ymd[2] - }).getTime(); - lay(item).removeClass(ELEM_SELECTED + ' ' + THIS); - if(thisTime === startTime || thisTime === endTime){ - lay(item).addClass( - lay(item).hasClass(ELEM_PREV) || lay(item).hasClass(ELEM_NEXT) - ? ELEM_SELECTED - : THIS - ); - } - if(thisTime > startTime && thisTime < endTime){ - lay(item).addClass(ELEM_SELECTED); - } - }); - }; - //执行done/change回调 Class.prototype.done = function(param, type){ var that = this @@ -1557,6 +1640,7 @@ Class.prototype.tool = function(btn, type){ var that = this ,options = that.config + ,lang = that.lang() ,dateTime = options.dateTime ,isStatic = options.position === 'static' ,active = { @@ -1605,12 +1689,11 @@ //确定 ,confirm: function(){ if(options.range){ - if(!that.endDate) return that.hint('请先选择日期范围'); if(lay(btn).hasClass(DISABLED)) return that.hint( - options.type === 'time' ? TIPS_OUT.replace(/日期/g, '时间') : TIPS_OUT + options.type === 'time' ? lang.timeout.replace(/日期/g, '时间') : lang.timeout ); } else { - if(lay(btn).hasClass(DISABLED)) return that.hint('不在有效日期或时间范围内'); + if(lay(btn).hasClass(DISABLED)) return that.hint(lang.invalidDate); } that.done(); that.setValue(that.parse()).remove() @@ -1771,6 +1854,11 @@ bind && (that.bindElem = this); that.render(); }); + + //失去焦点自动关闭 + elem.on('blur', function(){ + that.remove(); + }); }; if(!options.elem[0] || options.elem[0].eventHandler) return; @@ -1788,7 +1876,7 @@ that.remove(); }).on('keydown', function(e){ if(e.keyCode === 13){ - if(lay('#'+ that.elemID)[0] && that.elemID === Class.thisElem){ + if(lay('#'+ that.elemID)[0] && that.elemID === Class.thisElemDate){ e.preventDefault(); lay(that.footer).find(ELEM_CONFIRM)[0].click(); } @@ -1840,4 +1928,5 @@ }() ); -}(window); \ No newline at end of file +}(window); + diff --git a/src/theme/default/laydate.css b/src/theme/default/laydate.css index 54deccb..6fc9499 100644 --- a/src/theme/default/laydate.css +++ b/src/theme/default/laydate.css @@ -1,20 +1,3 @@ -/** 图标字体 **/ -@font-face {font-family: 'laydate-icon'; - src: url('./font/iconfont.eot'); - src: url('./font/iconfont.eot#iefix') format('embedded-opentype'), - url('./font/iconfont.svg#iconfont') format('svg'), - url('./font/iconfont.woff') format('woff'), - url('./font/iconfont.ttf') format('truetype'); -} - -.laydate-icon{ - font-family:"laydate-icon" !important; - font-size: 16px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - /** @Name: laydata @@ -29,21 +12,19 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} /* 主体结构 */ .layui-laydate, .layui-laydate *{box-sizing: border-box;} -.layui-laydate{position: absolute; z-index: 66666666; margin: 5px 0; border-radius: 2px; font-size: 14px; -webkit-animation-duration: 0.3s; animation-duration: 0.3s; -webkit-animation-fill-mode: both; animation-fill-mode: both;} +.layui-laydate{position: absolute; z-index: 66666666; margin: 5px 0; border-radius: 2px; font-size: 14px; -webkit-animation-duration: 0.2s; animation-duration: 0.2s; -webkit-animation-fill-mode: both; animation-fill-mode: both;} .layui-laydate-main{width: 272px;} .layui-laydate-header *, .layui-laydate-content td, .layui-laydate-list li{transition-duration: .3s; -webkit-transition-duration: .3s;} -@-webkit-keyframes laydate-upbit{ /* 微微往上滑入 */ - from {-webkit-transform: translate3d(0, 20px, 0); opacity: 0.3;} - to {-webkit-transform: translate3d(0, 0, 0); opacity: 1;} -} -@keyframes laydate-upbit{ - from {transform: translate3d(0, 20px, 0); opacity: 0.3;} - to {transform: translate3d(0, 0, 0); opacity: 1;} +/* 微微往下滑入 */ +@keyframes laydate-downbit { + 0% {opacity: 0.3; transform: translate3d(0, -5px, 0);} + 100% {opacity: 1; transform: translate3d(0, 0, 0);} } -.layui-laydate{-webkit-animation-name: laydate-upbit; animation-name: laydate-upbit;} + +.layui-laydate{animation-name: laydate-downbit;} .layui-laydate-static{ position: relative; z-index: 0; display: inline-block; margin: 0; -webkit-animation: none; animation: none;} /* 展开年月列表时 */ @@ -166,3 +147,21 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} .laydate-theme-grid .laydate-year-list>li{height: 43px; line-height: 43px;} .laydate-theme-grid .laydate-month-list>li{height: 71px; line-height: 71px;} + + +/** 图标字体 **/ +@font-face {font-family: 'laydate-icon'; + src: url('./font/iconfont.eot'); + src: url('./font/iconfont.eot#iefix') format('embedded-opentype'), + url('./font/iconfont.svg#iconfont') format('svg'), + url('./font/iconfont.woff') format('woff'), + url('./font/iconfont.ttf') format('truetype'); +} + +.laydate-icon{ + font-family:"laydate-icon" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} \ No newline at end of file From 9d2068b02da60068676a28918568f6b1c71b56b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsin@users.noreply.github.com> Date: Thu, 1 Apr 2021 01:40:20 +0800 Subject: [PATCH 23/26] update --- dist/laydate.js | 2 +- src/laydate.js | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 031c724..96afe95 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ /*! layDate v5.2.0 | 日期与时间组件 | The MIT License */ - ;!function(){"use strict";var e="lay",t=window.document,n=function(e){return new a(e)},a=function(e){for(var n=0,a="object"==typeof e?[e]:(this.selector=e,t.querySelectorAll(e||null));n0;i--)if("interactive"===n[i].readyState){e=n[i].src;break}return e||n[a].src}();return e.substring(0,e.lastIndexOf("/")+1)},n.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},n.each=function(e,t){var n,a=this;if("function"!=typeof t)return a;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;n80?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(n.getStyle(t.getElementById(s),"width"))?a():setTimeout(y,100))}()},n.hasScrollbar=function(){return t.body.scrollHeight>(window.innerHeight||t.documentElement.clientHeight)},n.position=function(e,a,i){if(a){i=i||{},e!==t&&e!==n("body")[0]||(i.clickType="right");var r="right"===i.clickType?function(){var e=i.e||window.event||{};return{left:e.clientX,top:e.clientY,right:e.clientX,bottom:e.clientY}}():e.getBoundingClientRect(),l=a.offsetWidth,o=a.offsetHeight,s=function(e){return e=e?"scrollLeft":"scrollTop",t.body[e]|t.documentElement[e]},c=function(e){return t.documentElement[e?"clientWidth":"clientHeight"]},y=5,d=r.left,u=r.bottom;d+l+y>c("width")&&(d=c("width")-l-y),u+o+y>c()&&(r.top>o+y?u=r.top-o-2*y:"right"===i.clickType&&(u=c()-o-2*y,u<0&&(u=0)));var m=i.position;if(m&&(a.style.position=m),a.style.left=d+("fixed"===m?0:s(1))+"px",a.style.top=u+("fixed"===m?0:s())+"px",!n.hasScrollbar()){var h=a.getBoundingClientRect();!i.SYSTEM_RELOAD&&h.bottom+y>c()&&(i.SYSTEM_RELOAD=!0,setTimeout(function(){n.position(e,a,i)},50))}}},n.options=function(e,t){var a=n(e),i=t||"lay-options";try{return new Function("return "+(a.attr(i)||"{}"))()}catch(r){return hint.error("parseerror:"+r,"error"),{}}},n.isTopElem=function(e){var a=[t,n("body")[0]],i=!1;return n.each(a,function(t,n){if(n===e)return i=!0}),i},a.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){new RegExp("\\b"+n+"\\b").test(e)||(e=e+" "+n)}),e.replace(/^\s|\s$/,"")},a.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){var a=new RegExp("\\b"+n+"\\b");a.test(e)&&(e=e.replace(a,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},a.prototype.find=function(e){var t=this,a=0,i=[],r="object"==typeof e;return this.each(function(n,l){for(var o=r?[e]:l.querySelectorAll(e||null);a0)return a[0].style[e]}():a.each(function(a,r){"object"==typeof e?n.each(e,function(e,t){r.style[e]=i(t)}):r.style[e]=i(t)})},a.prototype.width=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetWidth}():t.each(function(n,a){t.css("width",e)})},a.prototype.height=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetHeight}():t.each(function(n,a){t.css("height",e)})},a.prototype.attr=function(e,t){var n=this;return void 0===t?function(){if(n.length>0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},a.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},a.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},a.prototype.val=function(e){return this.each(function(t,n){n.value=e})},a.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},a.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},a.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},a.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},window.lay=n,window.layui&&layui.define&&layui.define(function(t){t(e,n)})}(),!function(e){"use strict";var t=e.layui&&layui.define,n={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,n,i){a.path&&e.lay&&lay.link&&lay.link(a.path+t,n,i)}},a={v:"5.2.0",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:n.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var i="laydate",r="",l=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+a.v+r;return t?layui.addcss(l,e,i):n.link(l,e,i),this}},i=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},r="laydate",l=".layui-laydate",o="layui-this",s="laydate-disabled",c=[100,2e5],y="layui-laydate-static",d="layui-laydate-list",u="layui-laydate-hint",m="layui-laydate-footer",h=".laydate-btns-confirm",f="laydate-time-text",p=".laydate-btns-time",g=function(e){var t=this;t.index=++a.index,t.config=lay.extend({},t.config,a.config,e),a.ready(function(){t.init()})};g.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},g.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"click",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},g.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"},timeout:"结束时间不能早于开始时间
        请重新选择",invalidDate:"不在有效日期或时间范围内",formatError:["日期格式不合法
        必须遵循下述格式:
        ","
        已为你重置"]},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
        Please re-select",invalidDate:"Invalid date",formatError:["The date format error
        Must be followed:
        ","
        It has been reset"]}};return n[t.lang]||n.cn},g.prototype.init=function(){var t=this,n=t.config,a="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",i="static"===n.position,r={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};n.elem=lay(n.elem),n.eventElem=lay(n.eventElem),n.elem[0]&&(n.range===!0&&(n.range="-"),r[n.type]||(e.console&&console.error&&console.error("laydate type error:'"+n.type+"' is not supported"),n.type="date"),n.format===r.date&&(n.format=r[n.type]||r.date),t.format=n.format.match(new RegExp(a+"|.","g"))||[],t.EXP_IF="",t.EXP_SPLIT="",lay.each(t.format,function(e,n){var i=new RegExp(a).test(n)?"\\d{"+function(){return new RegExp(a).test(t.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;t.EXP_IF=t.EXP_IF+i,t.EXP_SPLIT=t.EXP_SPLIT+"("+i+")"}),t.EXP_IF=new RegExp("^"+(n.range?t.EXP_IF+"\\s\\"+n.range+"\\s"+t.EXP_IF:t.EXP_IF)+"$"),t.EXP_SPLIT=new RegExp("^"+t.EXP_SPLIT+"$",""),t.isInput(n.elem[0])||"focus"===n.trigger&&(n.trigger="click"),n.elem.attr("lay-key")||(n.elem.attr("lay-key",t.index),n.eventElem.attr("lay-key",t.index)),n.mark=lay.extend({},n.calendar&&"cn"===n.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},n.mark),lay.each(["min","max"],function(e,t){var a=[],i=[];if("number"==typeof n[t]){var r=n[t],l=(new Date).getTime(),o=864e5,s=new Date(r?r0)return!0;var a=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),n=lay.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],c=lay.elem("div",{"class":"layui-laydate-content"}),y=lay.elem("table"),d=lay.elem("thead"),u=lay.elem("tr");lay.each(i,function(e,t){a.appendChild(t)}),d.appendChild(u),lay.each(new Array(6),function(e){var t=y.insertRow(0);lay.each(new Array(7),function(a){if(0===e){var i=lay.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),y.insertBefore(d,y.children[0]),c.appendChild(y),r[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(c),l.push(i),o.push(c),s.push(y)}),lay(c).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),lay.each(t.btns,function(e,r){var l=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(l="cn"===t.lang?"重置":"Reset"),i.push(''+l+""))}),e.push('"),e.join("")}()),lay.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(c),/^#/.test(t.theme)){var d=lay.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in d?(d.setAttribute("type","text/css"),d.styleSheet.cssText=u):d.innerHTML=u,lay(i).addClass("laydate-theme-molv"),i.appendChild(d)}e.remove(g.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),g.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1}))},g.prototype.remove=function(e){var t=this,n=(t.config,lay("#"+(e||t.elemID)));return n[0]?(n.hasClass(y)||t.checkDate(function(){n.remove(),delete t.endDate}),t):t},g.prototype.position=function(){var e=this,t=e.config;return lay.position(e.bindElem||t.elem[0],e.elem,{position:t.position}),e},g.prototype.hint=function(e){var t=this,n=(t.config,lay.elem("div",{"class":u}));t.elem&&(n.innerHTML=e||"",lay(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+u).remove()},3e3))},g.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},g.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},g.prototype.checkDate=function(e){var t,n,i=this,r=(new Date,i.config),l=i.lang(),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],y=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),d=function(e){e.year>c[1]&&(e.year=c[1],n=!0),e.month>11&&(e.month=11,n=!0),e.hours>23&&(e.hours=0,n=!0),e.minutes>59&&(e.minutes=0,e.hours++,n=!0),e.seconds>59&&(e.seconds=0,e.minutes++,n=!0),t=a.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,n=!0)},u=function(e,t,a){var l=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),a=a||0,r.range&&(i[l[a]]=i[l[a]]||{}),lay.each(i.format,function(o,s){var y=parseFloat(t[o]);t[o].length'+n+""),a},g.prototype.limit=function(e,t,n,a){var i,r=this,l=r.config,o={},c=l[n>41?"endDate":"dateTime"],y=lay.extend({},c,t||{});return lay.each({now:y,min:l.min,max:l.max},function(e,t){o[e]=r.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](s),i},g.prototype.thisDateTime=function(e){var t=this,n=t.config;return e?t.endDate:n.dateTime},g.prototype.calendar=function(e,t,n){var i,r,l,s=this,y=s.config,t=t?1:0,d=e||s.thisDateTime(t),u=new Date,m=s.lang(),f="date"!==y.type&&"datetime"!==y.type,p=lay(s.table[t]).find("td"),g=lay(s.elemHeader[t][2]).find("span");return d.yearc[1]&&(d.year=c[1],s.hint(m.invalidDate)),s.firstDate||(s.firstDate=lay.extend({},d)),u.setFullYear(d.year,d.month,1),i=u.getDay(),r=a.getEndDate(d.month||12,d.year),l=a.getEndDate(d.month+1,d.year),lay.each(p,function(e,t){var n=[d.year,d.month],a=0;t=lay(t),t.removeAttr("class"),e=i&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(lay(i),r,t),x++}),lay(u[v?0:1]).attr("lay-ym",x-8+"-"+D[1]).html(M+T+" - "+(x-1+T))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),l={year:D[0],month:e};e+1==D[1]&&lay(i).addClass(o),i.innerHTML=r.month[e]+(v?"月":""),c.appendChild(i),D[0]=n.firstDate.year&&(l.date=a.max.date),n.limit(lay(i),l,t)}),lay(u[v?0:1]).attr("lay-ym",D[0]+"-"+D[1]).html(D[0]+T);else if("time"===e){var C=function(){lay(c).find("ol").each(function(e,a){lay(a).find("li").each(function(a,i){n.limit(lay(i),[{hours:a},{hours:n[b].hours,minutes:a},{hours:n[b].hours,minutes:n[b].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(lay(n.footer).find(h),n[b],0,["hours","minutes","seconds"])};a.range?n[b]||(n[b]={hours:0,minutes:0,seconds:0}):n[b]=i,lay.each([24,60,60],function(e,t){var a=lay.elem("li"),i=["

        "+r.time[e]+"

          "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",c.appendChild(a)}),C()}if(g&&m.removeChild(g),m.appendChild(c),"year"===e||"month"===e)lay(n.elemMain[t]).addClass("laydate-ym-show"),lay(c).find("li").on("click",function(){var r=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(s)){0===t?(i[e]=r,n.limit(lay(n.footer).find(h),null,0)):n.endDate[e]=r;var y="year"===a.type||"month"===a.type;y?(lay(c).find("."+o).removeClass(o),lay(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(t?i.year=r:n.endDate.year=r),n.list("month",t))):(n.checkDate("limit").calendar(null,t),n.closeList()),n.setBtnStatus(),a.range||(("month"===a.type&&"month"===e||"year"===a.type&&"year"===e)&&n.setValue(n.parse()).remove().done(),n.done(null,"change")),lay(n.footer).find(p).removeClass(s)}});else{var E=lay.elem("span",{"class":f}),k=function(){lay(c).find("ol").each(function(e){var t=this,a=lay(t).find("li");t.scrollTop=30*(n[b][w[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!lay(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},S=lay(y[2]).find("."+f);k(),E.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,lay(n.elemMain[t]).addClass("laydate-time-show"),S[0]&&S.remove(),y[2].appendChild(E),lay(c).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var r=0|this.innerHTML;lay(this).hasClass(s)||(a.range?n[b][w[e]]=r:i[w[e]]=r,lay(t).find("."+o).removeClass(o),lay(this).addClass(o),C(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},g.prototype.listYM=[],g.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,n){lay(this).find("."+d).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+f).remove()},g.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,l=i.lang(),o=lay(i.footer).find(h);r.range&&"time"!==r.type&&(t=t||r.dateTime,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.timeout.replace(/日期/g,e):l.timeout))},g.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?lay.extend({},n.endDate,n.endTime):a.range?lay.extend({},a.dateTime,n.startTime):a.dateTime),r=n.format.concat();return lay.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=lay.digit(i.year,t.length):/MM|M/.test(t)?r[e]=lay.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=lay.digit(i.date,t.length):/HH|H/.test(t)?r[e]=lay.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=lay.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=lay.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},g.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},g.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||lay(a)[i](e||""),this},g.prototype.done=function(e,t){var n=this,a=n.config,i=lay.extend({},lay.extend(a.dateTime,n.startTime)),r=lay.extend({},lay.extend(n.endDate,n.endTime));return lay.each([i,r],function(e,t){"month"in t&&lay.extend(t,{month:t.month+1})}),e=e||[n.parse(),i,r],"function"==typeof a[t||"done"]&&a[t||"done"].apply(a,e),n},g.prototype.choose=function(e,t){var n=this,a=n.config,i=n.thisDateTime(t),r=(lay(n.elem).find("td"),e.attr("lay-ymd").split("-"));r={year:0|r[0],month:(0|r[1])-1,date:0|r[2]},e.hasClass(s)||(lay.extend(i,r),a.range?(lay.each(["startTime","endTime"],function(e,t){n[t]=n[t]||{hours:0,minutes:0,seconds:0}}),n.calendar(null,t)):"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"))},g.prototype.tool=function(e,t){var n=this,a=n.config,i=n.lang(),r=a.dateTime,l="static"===a.position,o={datetime:function(){lay(e).hasClass(s)||(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(){n.setValue("").remove(),l&&(lay.extend(r,n.firstDate),n.calendar()),a.range&&(delete n.endDate,delete n.startTime,delete n.endTime),n.done(["",{},{}])},now:function(){var e=new Date;lay.extend(r,n.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),n.setValue(n.parse()).remove(),l&&n.calendar(),n.done()},confirm:function(){if(a.range){if(lay(e).hasClass(s))return n.hint("time"===a.type?i.timeout.replace(/日期/g,"时间"):i.timeout)}else if(lay(e).hasClass(s))return n.hint(i.invalidDate);n.done(),n.setValue(n.parse()).remove()}};o[t]&&o[t]()},g.prototype.change=function(e){var t=this,n=t.config,a=t.thisDateTime(e),i=n.range&&("year"===n.type||"month"===n.type),r=t.elemCont[e||0],l=t.listYM[e],o=function(o){var s=lay(r).find(".laydate-year-list")[0],c=lay(r).find(".laydate-month-list")[0];return s&&(l[0]=o?l[0]-15:l[0]+15,t.list("year",e)),c&&(o?l[0]--:l[0]++,t.list("month",e)),(s||c)&&(lay.extend(a,{year:l[0]}),i&&(a.year=l[0]),n.range||t.done(null,"change"),n.range||t.limit(lay(t.footer).find(h),{year:l[0]})),t.setBtnStatus(),s||c};return{prevYear:function(){o("sub")||(a.year--,t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change"))},prevMonth:function(){var i=t.getAsYM(a.year,a.month,"sub");lay.extend(a,{year:i[0],month:i[1]}),t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change")},nextMonth:function(){var i=t.getAsYM(a.year,a.month);lay.extend(a,{year:i[0],month:i[1]}),t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change")},nextYear:function(){o()||(a.year++,t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change"))}}},g.prototype.changeEvent=function(){var e=this;e.config;lay(e.elem).on("click",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),i=a.attr("lay-ym"),r=a.attr("lay-type");i&&(i=i.split("-"),e.listYM[t]=[0|i[0],0|i[1]],e.list(r,t),lay(e.footer).find(p).addClass(s))}),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)})},g.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())},g.prototype.events=function(){var t=this,n=t.config,a=function(e,a){e.on(n.trigger,function(){a&&(t.bindElem=this),t.render()}),e.on("blur",function(){t.remove()})};n.elem[0]&&!n.elem[0].eventHandler&&(a(n.elem,"bind"),a(n.eventElem),lay(document).on("click",function(e){e.target!==n.elem[0]&&e.target!==n.eventElem[0]&&e.target!==lay(n.closeStop)[0]&&t.remove()}).on("keydown",function(e){13===e.keyCode&&lay("#"+t.elemID)[0]&&t.elemID===g.thisElemDate&&(e.preventDefault(),lay(t.footer).find(h)[0].click())}),lay(e).on("resize",function(){return!(!t.elem||!lay(l)[0])&&void t.position()}),n.elem[0].eventHandler=!0)},a.render=function(e){var t=new g(e);return i.call(t)},a.getEndDate=function(e,t){var n=new Date;return n.setFullYear(t||n.getFullYear(),e||n.getMonth()+1,1),new Date(n.getTime()-864e5).getDate()},t?(a.ready(),layui.define("lay",function(e){a.path=layui.cache.dir,e(r,a)})):"function"==typeof define&&define.amd?define(function(){return a}):function(){a.ready(),e.laydate=a}()}(window); \ No newline at end of file + ;!function(){"use strict";var e="lay",t=window.document,n=function(e){return new a(e)},a=function(e){for(var n=0,a="object"==typeof e?[e]:(this.selector=e,t.querySelectorAll(e||null));n0;i--)if("interactive"===n[i].readyState){e=n[i].src;break}return e||n[a].src}();return e.substring(0,e.lastIndexOf("/")+1)},n.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},n.each=function(e,t){var n,a=this;if("function"!=typeof t)return a;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;n80?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(n.getStyle(t.getElementById(s),"width"))?a():setTimeout(y,100))}()},n.hasScrollbar=function(){return t.body.scrollHeight>(window.innerHeight||t.documentElement.clientHeight)},n.position=function(e,a,i){if(a){i=i||{},e!==t&&e!==n("body")[0]||(i.clickType="right");var r="right"===i.clickType?function(){var e=i.e||window.event||{};return{left:e.clientX,top:e.clientY,right:e.clientX,bottom:e.clientY}}():e.getBoundingClientRect(),l=a.offsetWidth,o=a.offsetHeight,s=function(e){return e=e?"scrollLeft":"scrollTop",t.body[e]|t.documentElement[e]},c=function(e){return t.documentElement[e?"clientWidth":"clientHeight"]},y=5,d=r.left,u=r.bottom;d+l+y>c("width")&&(d=c("width")-l-y),u+o+y>c()&&(r.top>o+y?u=r.top-o-2*y:"right"===i.clickType&&(u=c()-o-2*y,u<0&&(u=0)));var m=i.position;if(m&&(a.style.position=m),a.style.left=d+("fixed"===m?0:s(1))+"px",a.style.top=u+("fixed"===m?0:s())+"px",!n.hasScrollbar()){var h=a.getBoundingClientRect();!i.SYSTEM_RELOAD&&h.bottom+y>c()&&(i.SYSTEM_RELOAD=!0,setTimeout(function(){n.position(e,a,i)},50))}}},n.options=function(e,t){var a=n(e),i=t||"lay-options";try{return new Function("return "+(a.attr(i)||"{}"))()}catch(r){return hint.error("parseerror:"+r,"error"),{}}},n.isTopElem=function(e){var a=[t,n("body")[0]],i=!1;return n.each(a,function(t,n){if(n===e)return i=!0}),i},a.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){new RegExp("\\b"+n+"\\b").test(e)||(e=e+" "+n)}),e.replace(/^\s|\s$/,"")},a.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){var a=new RegExp("\\b"+n+"\\b");a.test(e)&&(e=e.replace(a,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},a.prototype.find=function(e){var t=this,a=0,i=[],r="object"==typeof e;return this.each(function(n,l){for(var o=r?[e]:l.querySelectorAll(e||null);a0)return a[0].style[e]}():a.each(function(a,r){"object"==typeof e?n.each(e,function(e,t){r.style[e]=i(t)}):r.style[e]=i(t)})},a.prototype.width=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetWidth}():t.each(function(n,a){t.css("width",e)})},a.prototype.height=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetHeight}():t.each(function(n,a){t.css("height",e)})},a.prototype.attr=function(e,t){var n=this;return void 0===t?function(){if(n.length>0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},a.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},a.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},a.prototype.val=function(e){return this.each(function(t,n){n.value=e})},a.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},a.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},a.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},a.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},window.lay=n,window.layui&&layui.define&&layui.define(function(t){t(e,n)})}(),!function(e){"use strict";var t=e.layui&&layui.define,n={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,n,i){a.path&&e.lay&&lay.link&&lay.link(a.path+t,n,i)}},a={v:"5.2.0",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:n.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var i="laydate",r="",l=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+a.v+r;return t?layui.addcss(l,e,i):n.link(l,e,i),this}},i=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},r="laydate",l=".layui-laydate",o="layui-this",s="laydate-disabled",c=[100,2e5],y="layui-laydate-static",d="layui-laydate-list",u="layui-laydate-hint",m="layui-laydate-footer",h=".laydate-btns-confirm",f="laydate-time-text",p=".laydate-btns-time",g=function(e){var t=this;t.index=++a.index,t.config=lay.extend({},t.config,a.config,e),a.ready(function(){t.init()})};g.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},g.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"click",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},g.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"},timeout:"结束时间不能早于开始时间
        请重新选择",invalidDate:"不在有效日期或时间范围内",formatError:["日期格式不合法
        必须遵循下述格式:
        ","
        已为你重置"]},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
        Please re-select",invalidDate:"Invalid date",formatError:["The date format error
        Must be followed:
        ","
        It has been reset"]}};return n[t.lang]||n.cn},g.prototype.init=function(){var t=this,n=t.config,a="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",i="static"===n.position,r={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};n.elem=lay(n.elem),n.eventElem=lay(n.eventElem),n.elem[0]&&(n.range===!0&&(n.range="-"),r[n.type]||(e.console&&console.error&&console.error("laydate type error:'"+n.type+"' is not supported"),n.type="date"),n.format===r.date&&(n.format=r[n.type]||r.date),t.format=n.format.match(new RegExp(a+"|.","g"))||[],t.EXP_IF="",t.EXP_SPLIT="",lay.each(t.format,function(e,n){var i=new RegExp(a).test(n)?"\\d{"+function(){return new RegExp(a).test(t.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;t.EXP_IF=t.EXP_IF+i,t.EXP_SPLIT=t.EXP_SPLIT+"("+i+")"}),t.EXP_IF=new RegExp("^"+(n.range?t.EXP_IF+"\\s\\"+n.range+"\\s"+t.EXP_IF:t.EXP_IF)+"$"),t.EXP_SPLIT=new RegExp("^"+t.EXP_SPLIT+"$",""),t.isInput(n.elem[0])||"focus"===n.trigger&&(n.trigger="click"),n.elem.attr("lay-key")||(n.elem.attr("lay-key",t.index),n.eventElem.attr("lay-key",t.index)),n.mark=lay.extend({},n.calendar&&"cn"===n.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},n.mark),lay.each(["min","max"],function(e,t){var a=[],i=[];if("number"==typeof n[t]){var r=n[t],l=(new Date).getTime(),o=864e5,s=new Date(r?r0)return!0;var a=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),n=lay.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],c=lay.elem("div",{"class":"layui-laydate-content"}),y=lay.elem("table"),d=lay.elem("thead"),u=lay.elem("tr");lay.each(i,function(e,t){a.appendChild(t)}),d.appendChild(u),lay.each(new Array(6),function(e){var t=y.insertRow(0);lay.each(new Array(7),function(a){if(0===e){var i=lay.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),y.insertBefore(d,y.children[0]),c.appendChild(y),r[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(c),l.push(i),o.push(c),s.push(y)}),lay(c).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),lay.each(t.btns,function(e,r){var l=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(l="cn"===t.lang?"重置":"Reset"),i.push(''+l+""))}),e.push('"),e.join("")}()),lay.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(c),/^#/.test(t.theme)){var d=lay.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in d?(d.setAttribute("type","text/css"),d.styleSheet.cssText=u):d.innerHTML=u,lay(i).addClass("laydate-theme-molv"),i.appendChild(d)}e.remove(g.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),g.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1}))},g.prototype.remove=function(e){var t=this,n=(t.config,lay("#"+(e||t.elemID)));return n[0]?(n.hasClass(y)||t.checkDate(function(){n.remove(),delete t.endDate}),t):t},g.prototype.position=function(){var e=this,t=e.config;return lay.position(e.bindElem||t.elem[0],e.elem,{position:t.position}),e},g.prototype.hint=function(e){var t=this,n=(t.config,lay.elem("div",{"class":u}));t.elem&&(n.innerHTML=e||"",lay(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+u).remove()},3e3))},g.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},g.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},g.prototype.checkDate=function(e){var t,n,i=this,r=(new Date,i.config),l=i.lang(),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],y=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),d=function(e){e.year>c[1]&&(e.year=c[1],n=!0),e.month>11&&(e.month=11,n=!0),e.hours>23&&(e.hours=0,n=!0),e.minutes>59&&(e.minutes=0,e.hours++,n=!0),e.seconds>59&&(e.seconds=0,e.minutes++,n=!0),t=a.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,n=!0)},u=function(e,t,a){var l=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),a=a||0,r.range&&(i[l[a]]=i[l[a]]||{}),lay.each(i.format,function(o,s){var y=parseFloat(t[o]);t[o].length'+n+""),a},g.prototype.limit=function(e,t,n,a){var i,r=this,l=r.config,o={},c=l[n>41?"endDate":"dateTime"],y=lay.extend({},c,t||{});return lay.each({now:y,min:l.min,max:l.max},function(e,t){o[e]=r.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](s),i},g.prototype.thisDateTime=function(e){var t=this,n=t.config;return e?t.endDate:n.dateTime},g.prototype.calendar=function(e,t,n){var i,r,l,s=this,y=s.config,t=t?1:0,d=e||s.thisDateTime(t),u=new Date,m=s.lang(),f="date"!==y.type&&"datetime"!==y.type,p=lay(s.table[t]).find("td"),g=lay(s.elemHeader[t][2]).find("span");return d.yearc[1]&&(d.year=c[1],s.hint(m.invalidDate)),s.firstDate||(s.firstDate=lay.extend({},d)),u.setFullYear(d.year,d.month,1),i=u.getDay(),r=a.getEndDate(d.month||12,d.year),l=a.getEndDate(d.month+1,d.year),lay.each(p,function(e,t){var n=[d.year,d.month],a=0;t=lay(t),t.removeAttr("class"),e=i&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(lay(i),r,t),x++}),lay(u[v?0:1]).attr("lay-ym",x-8+"-"+D[1]).html(M+T+" - "+(x-1+T))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),l={year:D[0],month:e};e+1==D[1]&&lay(i).addClass(o),i.innerHTML=r.month[e]+(v?"月":""),c.appendChild(i),D[0]=n.firstDate.year&&(l.date=a.max.date),n.limit(lay(i),l,t)}),lay(u[v?0:1]).attr("lay-ym",D[0]+"-"+D[1]).html(D[0]+T);else if("time"===e){var C=function(){lay(c).find("ol").each(function(e,a){lay(a).find("li").each(function(a,i){n.limit(lay(i),[{hours:a},{hours:n[b].hours,minutes:a},{hours:n[b].hours,minutes:n[b].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(lay(n.footer).find(h),n[b],0,["hours","minutes","seconds"])};a.range?n[b]||(n[b]={hours:0,minutes:0,seconds:0}):n[b]=i,lay.each([24,60,60],function(e,t){var a=lay.elem("li"),i=["

        "+r.time[e]+"

          "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",c.appendChild(a)}),C()}if(g&&m.removeChild(g),m.appendChild(c),"year"===e||"month"===e)lay(n.elemMain[t]).addClass("laydate-ym-show"),lay(c).find("li").on("click",function(){var r=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(s)){0===t?(i[e]=r,n.limit(lay(n.footer).find(h),null,0)):n.endDate[e]=r;var y="year"===a.type||"month"===a.type;y?(lay(c).find("."+o).removeClass(o),lay(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(t?i.year=r:n.endDate.year=r),n.list("month",t))):(n.checkDate("limit").calendar(null,t),n.closeList()),n.setBtnStatus(),a.range||(("month"===a.type&&"month"===e||"year"===a.type&&"year"===e)&&n.setValue(n.parse()).remove().done(),n.done(null,"change")),lay(n.footer).find(p).removeClass(s)}});else{var E=lay.elem("span",{"class":f}),k=function(){lay(c).find("ol").each(function(e){var t=this,a=lay(t).find("li");t.scrollTop=30*(n[b][w[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!lay(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},S=lay(y[2]).find("."+f);k(),E.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,lay(n.elemMain[t]).addClass("laydate-time-show"),S[0]&&S.remove(),y[2].appendChild(E),lay(c).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var r=0|this.innerHTML;lay(this).hasClass(s)||(a.range?n[b][w[e]]=r:i[w[e]]=r,lay(t).find("."+o).removeClass(o),lay(this).addClass(o),C(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},g.prototype.listYM=[],g.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,n){lay(this).find("."+d).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+f).remove()},g.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,l=i.lang(),o=lay(i.footer).find(h);r.range&&"time"!==r.type&&(t=t||r.dateTime,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.timeout.replace(/日期/g,e):l.timeout))},g.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?lay.extend({},n.endDate,n.endTime):a.range?lay.extend({},a.dateTime,n.startTime):a.dateTime),r=n.format.concat();return lay.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=lay.digit(i.year,t.length):/MM|M/.test(t)?r[e]=lay.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=lay.digit(i.date,t.length):/HH|H/.test(t)?r[e]=lay.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=lay.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=lay.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},g.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},g.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||lay(a)[i](e||""),this},g.prototype.done=function(e,t){var n=this,a=n.config,i=lay.extend({},lay.extend(a.dateTime,n.startTime)),r=lay.extend({},lay.extend(n.endDate,n.endTime));return lay.each([i,r],function(e,t){"month"in t&&lay.extend(t,{month:t.month+1})}),e=e||[n.parse(),i,r],"function"==typeof a[t||"done"]&&a[t||"done"].apply(a,e),n},g.prototype.choose=function(e,t){var n=this,a=n.config,i=n.thisDateTime(t),r=(lay(n.elem).find("td"),e.attr("lay-ymd").split("-"));r={year:0|r[0],month:(0|r[1])-1,date:0|r[2]},e.hasClass(s)||(lay.extend(i,r),a.range?(lay.each(["startTime","endTime"],function(e,t){n[t]=n[t]||{hours:0,minutes:0,seconds:0}}),n.calendar(null,t)):"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"))},g.prototype.tool=function(e,t){var n=this,a=n.config,i=n.lang(),r=a.dateTime,l="static"===a.position,o={datetime:function(){lay(e).hasClass(s)||(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(){n.setValue("").remove(),l&&(lay.extend(r,n.firstDate),n.calendar()),a.range&&(delete n.endDate,delete n.startTime,delete n.endTime),n.done(["",{},{}])},now:function(){var e=new Date;lay.extend(r,n.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),n.setValue(n.parse()).remove(),l&&n.calendar(),n.done()},confirm:function(){if(a.range){if(lay(e).hasClass(s))return n.hint("time"===a.type?i.timeout.replace(/日期/g,"时间"):i.timeout)}else if(lay(e).hasClass(s))return n.hint(i.invalidDate);n.done(),n.setValue(n.parse()).remove()}};o[t]&&o[t]()},g.prototype.change=function(e){var t=this,n=t.config,a=t.thisDateTime(e),i=n.range&&("year"===n.type||"month"===n.type),r=t.elemCont[e||0],l=t.listYM[e],o=function(o){var s=lay(r).find(".laydate-year-list")[0],c=lay(r).find(".laydate-month-list")[0];return s&&(l[0]=o?l[0]-15:l[0]+15,t.list("year",e)),c&&(o?l[0]--:l[0]++,t.list("month",e)),(s||c)&&(lay.extend(a,{year:l[0]}),i&&(a.year=l[0]),n.range||t.done(null,"change"),n.range||t.limit(lay(t.footer).find(h),{year:l[0]})),t.setBtnStatus(),s||c};return{prevYear:function(){o("sub")||(a.year--,t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change"))},prevMonth:function(){var i=t.getAsYM(a.year,a.month,"sub");lay.extend(a,{year:i[0],month:i[1]}),t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change")},nextMonth:function(){var i=t.getAsYM(a.year,a.month);lay.extend(a,{year:i[0],month:i[1]}),t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change")},nextYear:function(){o()||(a.year++,t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change"))}}},g.prototype.changeEvent=function(){var e=this;e.config;lay(e.elem).on("click",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),i=a.attr("lay-ym"),r=a.attr("lay-type");i&&(i=i.split("-"),e.listYM[t]=[0|i[0],0|i[1]],e.list(r,t),lay(e.footer).find(p).addClass(s))}),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)})},g.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())},g.prototype.events=function(){var t=this,n=t.config,a=function(e,a){e.on(n.trigger,function(){a&&(t.bindElem=this),t.render()})};n.elem[0]&&!n.elem[0].eventHandler&&(a(n.elem,"bind"),a(n.eventElem),lay(document).on("click",function(e){e.target!==n.elem[0]&&e.target!==n.eventElem[0]&&e.target!==lay(n.closeStop)[0]&&t.remove()}).on("keydown",function(e){13===e.keyCode&&lay("#"+t.elemID)[0]&&t.elemID===g.thisElemDate&&(e.preventDefault(),lay(t.footer).find(h)[0].click())}),lay(e).on("resize",function(){return!(!t.elem||!lay(l)[0])&&void t.position()}),n.elem[0].eventHandler=!0)},a.render=function(e){var t=new g(e);return i.call(t)},a.getEndDate=function(e,t){var n=new Date;return n.setFullYear(t||n.getFullYear(),e||n.getMonth()+1,1),new Date(n.getTime()-864e5).getDate()},t?(a.ready(),layui.define("lay",function(e){a.path=layui.cache.dir,e(r,a)})):"function"==typeof define&&define.amd?define(function(){return a}):function(){a.ready(),e.laydate=a}()}(window); \ No newline at end of file diff --git a/src/laydate.js b/src/laydate.js index cd0de46..31c3112 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1854,11 +1854,6 @@ bind && (that.bindElem = this); that.render(); }); - - //失去焦点自动关闭 - elem.on('blur', function(){ - that.remove(); - }); }; if(!options.elem[0] || options.elem[0].eventHandler) return; From ee6946dca7558bce4992b5932c5ab818f4e53142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsin@users.noreply.github.com> Date: Thu, 22 Apr 2021 10:25:41 +0800 Subject: [PATCH 24/26] update --- dist/laydate.js | 4 +- dist/theme/default/laydate.css | 2 +- package.json | 2 +- src/laydate.js | 142 +++++++++++++++++++++++++++++---- src/theme/default/laydate.css | 4 +- 5 files changed, 133 insertions(+), 21 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 96afe95..0fd3bbe 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! layDate v5.2.0 | 日期与时间组件 | The MIT License */ - ;!function(){"use strict";var e="lay",t=window.document,n=function(e){return new a(e)},a=function(e){for(var n=0,a="object"==typeof e?[e]:(this.selector=e,t.querySelectorAll(e||null));n0;i--)if("interactive"===n[i].readyState){e=n[i].src;break}return e||n[a].src}();return e.substring(0,e.lastIndexOf("/")+1)},n.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},n.each=function(e,t){var n,a=this;if("function"!=typeof t)return a;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;n80?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(n.getStyle(t.getElementById(s),"width"))?a():setTimeout(y,100))}()},n.hasScrollbar=function(){return t.body.scrollHeight>(window.innerHeight||t.documentElement.clientHeight)},n.position=function(e,a,i){if(a){i=i||{},e!==t&&e!==n("body")[0]||(i.clickType="right");var r="right"===i.clickType?function(){var e=i.e||window.event||{};return{left:e.clientX,top:e.clientY,right:e.clientX,bottom:e.clientY}}():e.getBoundingClientRect(),l=a.offsetWidth,o=a.offsetHeight,s=function(e){return e=e?"scrollLeft":"scrollTop",t.body[e]|t.documentElement[e]},c=function(e){return t.documentElement[e?"clientWidth":"clientHeight"]},y=5,d=r.left,u=r.bottom;d+l+y>c("width")&&(d=c("width")-l-y),u+o+y>c()&&(r.top>o+y?u=r.top-o-2*y:"right"===i.clickType&&(u=c()-o-2*y,u<0&&(u=0)));var m=i.position;if(m&&(a.style.position=m),a.style.left=d+("fixed"===m?0:s(1))+"px",a.style.top=u+("fixed"===m?0:s())+"px",!n.hasScrollbar()){var h=a.getBoundingClientRect();!i.SYSTEM_RELOAD&&h.bottom+y>c()&&(i.SYSTEM_RELOAD=!0,setTimeout(function(){n.position(e,a,i)},50))}}},n.options=function(e,t){var a=n(e),i=t||"lay-options";try{return new Function("return "+(a.attr(i)||"{}"))()}catch(r){return hint.error("parseerror:"+r,"error"),{}}},n.isTopElem=function(e){var a=[t,n("body")[0]],i=!1;return n.each(a,function(t,n){if(n===e)return i=!0}),i},a.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){new RegExp("\\b"+n+"\\b").test(e)||(e=e+" "+n)}),e.replace(/^\s|\s$/,"")},a.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){var a=new RegExp("\\b"+n+"\\b");a.test(e)&&(e=e.replace(a,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},a.prototype.find=function(e){var t=this,a=0,i=[],r="object"==typeof e;return this.each(function(n,l){for(var o=r?[e]:l.querySelectorAll(e||null);a0)return a[0].style[e]}():a.each(function(a,r){"object"==typeof e?n.each(e,function(e,t){r.style[e]=i(t)}):r.style[e]=i(t)})},a.prototype.width=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetWidth}():t.each(function(n,a){t.css("width",e)})},a.prototype.height=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetHeight}():t.each(function(n,a){t.css("height",e)})},a.prototype.attr=function(e,t){var n=this;return void 0===t?function(){if(n.length>0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},a.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},a.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},a.prototype.val=function(e){return this.each(function(t,n){n.value=e})},a.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},a.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},a.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},a.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},window.lay=n,window.layui&&layui.define&&layui.define(function(t){t(e,n)})}(),!function(e){"use strict";var t=e.layui&&layui.define,n={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,n,i){a.path&&e.lay&&lay.link&&lay.link(a.path+t,n,i)}},a={v:"5.2.0",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:n.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var i="laydate",r="",l=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+a.v+r;return t?layui.addcss(l,e,i):n.link(l,e,i),this}},i=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},r="laydate",l=".layui-laydate",o="layui-this",s="laydate-disabled",c=[100,2e5],y="layui-laydate-static",d="layui-laydate-list",u="layui-laydate-hint",m="layui-laydate-footer",h=".laydate-btns-confirm",f="laydate-time-text",p=".laydate-btns-time",g=function(e){var t=this;t.index=++a.index,t.config=lay.extend({},t.config,a.config,e),a.ready(function(){t.init()})};g.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},g.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"click",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},g.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"},timeout:"结束时间不能早于开始时间
        请重新选择",invalidDate:"不在有效日期或时间范围内",formatError:["日期格式不合法
        必须遵循下述格式:
        ","
        已为你重置"]},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
        Please re-select",invalidDate:"Invalid date",formatError:["The date format error
        Must be followed:
        ","
        It has been reset"]}};return n[t.lang]||n.cn},g.prototype.init=function(){var t=this,n=t.config,a="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",i="static"===n.position,r={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};n.elem=lay(n.elem),n.eventElem=lay(n.eventElem),n.elem[0]&&(n.range===!0&&(n.range="-"),r[n.type]||(e.console&&console.error&&console.error("laydate type error:'"+n.type+"' is not supported"),n.type="date"),n.format===r.date&&(n.format=r[n.type]||r.date),t.format=n.format.match(new RegExp(a+"|.","g"))||[],t.EXP_IF="",t.EXP_SPLIT="",lay.each(t.format,function(e,n){var i=new RegExp(a).test(n)?"\\d{"+function(){return new RegExp(a).test(t.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;t.EXP_IF=t.EXP_IF+i,t.EXP_SPLIT=t.EXP_SPLIT+"("+i+")"}),t.EXP_IF=new RegExp("^"+(n.range?t.EXP_IF+"\\s\\"+n.range+"\\s"+t.EXP_IF:t.EXP_IF)+"$"),t.EXP_SPLIT=new RegExp("^"+t.EXP_SPLIT+"$",""),t.isInput(n.elem[0])||"focus"===n.trigger&&(n.trigger="click"),n.elem.attr("lay-key")||(n.elem.attr("lay-key",t.index),n.eventElem.attr("lay-key",t.index)),n.mark=lay.extend({},n.calendar&&"cn"===n.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},n.mark),lay.each(["min","max"],function(e,t){var a=[],i=[];if("number"==typeof n[t]){var r=n[t],l=(new Date).getTime(),o=864e5,s=new Date(r?r0)return!0;var a=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),n=lay.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],c=lay.elem("div",{"class":"layui-laydate-content"}),y=lay.elem("table"),d=lay.elem("thead"),u=lay.elem("tr");lay.each(i,function(e,t){a.appendChild(t)}),d.appendChild(u),lay.each(new Array(6),function(e){var t=y.insertRow(0);lay.each(new Array(7),function(a){if(0===e){var i=lay.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),y.insertBefore(d,y.children[0]),c.appendChild(y),r[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(c),l.push(i),o.push(c),s.push(y)}),lay(c).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),lay.each(t.btns,function(e,r){var l=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(l="cn"===t.lang?"重置":"Reset"),i.push(''+l+""))}),e.push('"),e.join("")}()),lay.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(c),/^#/.test(t.theme)){var d=lay.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in d?(d.setAttribute("type","text/css"),d.styleSheet.cssText=u):d.innerHTML=u,lay(i).addClass("laydate-theme-molv"),i.appendChild(d)}e.remove(g.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),g.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1}))},g.prototype.remove=function(e){var t=this,n=(t.config,lay("#"+(e||t.elemID)));return n[0]?(n.hasClass(y)||t.checkDate(function(){n.remove(),delete t.endDate}),t):t},g.prototype.position=function(){var e=this,t=e.config;return lay.position(e.bindElem||t.elem[0],e.elem,{position:t.position}),e},g.prototype.hint=function(e){var t=this,n=(t.config,lay.elem("div",{"class":u}));t.elem&&(n.innerHTML=e||"",lay(t.elem).find("."+u).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+u).remove()},3e3))},g.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},g.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},g.prototype.checkDate=function(e){var t,n,i=this,r=(new Date,i.config),l=i.lang(),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],y=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),d=function(e){e.year>c[1]&&(e.year=c[1],n=!0),e.month>11&&(e.month=11,n=!0),e.hours>23&&(e.hours=0,n=!0),e.minutes>59&&(e.minutes=0,e.hours++,n=!0),e.seconds>59&&(e.seconds=0,e.minutes++,n=!0),t=a.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,n=!0)},u=function(e,t,a){var l=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),a=a||0,r.range&&(i[l[a]]=i[l[a]]||{}),lay.each(i.format,function(o,s){var y=parseFloat(t[o]);t[o].length'+n+""),a},g.prototype.limit=function(e,t,n,a){var i,r=this,l=r.config,o={},c=l[n>41?"endDate":"dateTime"],y=lay.extend({},c,t||{});return lay.each({now:y,min:l.min,max:l.max},function(e,t){o[e]=r.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](s),i},g.prototype.thisDateTime=function(e){var t=this,n=t.config;return e?t.endDate:n.dateTime},g.prototype.calendar=function(e,t,n){var i,r,l,s=this,y=s.config,t=t?1:0,d=e||s.thisDateTime(t),u=new Date,m=s.lang(),f="date"!==y.type&&"datetime"!==y.type,p=lay(s.table[t]).find("td"),g=lay(s.elemHeader[t][2]).find("span");return d.yearc[1]&&(d.year=c[1],s.hint(m.invalidDate)),s.firstDate||(s.firstDate=lay.extend({},d)),u.setFullYear(d.year,d.month,1),i=u.getDay(),r=a.getEndDate(d.month||12,d.year),l=a.getEndDate(d.month+1,d.year),lay.each(p,function(e,t){var n=[d.year,d.month],a=0;t=lay(t),t.removeAttr("class"),e=i&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(lay(i),r,t),x++}),lay(u[v?0:1]).attr("lay-ym",x-8+"-"+D[1]).html(M+T+" - "+(x-1+T))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),l={year:D[0],month:e};e+1==D[1]&&lay(i).addClass(o),i.innerHTML=r.month[e]+(v?"月":""),c.appendChild(i),D[0]=n.firstDate.year&&(l.date=a.max.date),n.limit(lay(i),l,t)}),lay(u[v?0:1]).attr("lay-ym",D[0]+"-"+D[1]).html(D[0]+T);else if("time"===e){var C=function(){lay(c).find("ol").each(function(e,a){lay(a).find("li").each(function(a,i){n.limit(lay(i),[{hours:a},{hours:n[b].hours,minutes:a},{hours:n[b].hours,minutes:n[b].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(lay(n.footer).find(h),n[b],0,["hours","minutes","seconds"])};a.range?n[b]||(n[b]={hours:0,minutes:0,seconds:0}):n[b]=i,lay.each([24,60,60],function(e,t){var a=lay.elem("li"),i=["

        "+r.time[e]+"

          "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",c.appendChild(a)}),C()}if(g&&m.removeChild(g),m.appendChild(c),"year"===e||"month"===e)lay(n.elemMain[t]).addClass("laydate-ym-show"),lay(c).find("li").on("click",function(){var r=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(s)){0===t?(i[e]=r,n.limit(lay(n.footer).find(h),null,0)):n.endDate[e]=r;var y="year"===a.type||"month"===a.type;y?(lay(c).find("."+o).removeClass(o),lay(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(t?i.year=r:n.endDate.year=r),n.list("month",t))):(n.checkDate("limit").calendar(null,t),n.closeList()),n.setBtnStatus(),a.range||(("month"===a.type&&"month"===e||"year"===a.type&&"year"===e)&&n.setValue(n.parse()).remove().done(),n.done(null,"change")),lay(n.footer).find(p).removeClass(s)}});else{var E=lay.elem("span",{"class":f}),k=function(){lay(c).find("ol").each(function(e){var t=this,a=lay(t).find("li");t.scrollTop=30*(n[b][w[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!lay(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},S=lay(y[2]).find("."+f);k(),E.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,lay(n.elemMain[t]).addClass("laydate-time-show"),S[0]&&S.remove(),y[2].appendChild(E),lay(c).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var r=0|this.innerHTML;lay(this).hasClass(s)||(a.range?n[b][w[e]]=r:i[w[e]]=r,lay(t).find("."+o).removeClass(o),lay(this).addClass(o),C(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},g.prototype.listYM=[],g.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,n){lay(this).find("."+d).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+f).remove()},g.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,l=i.lang(),o=lay(i.footer).find(h);r.range&&"time"!==r.type&&(t=t||r.dateTime,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.timeout.replace(/日期/g,e):l.timeout))},g.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?lay.extend({},n.endDate,n.endTime):a.range?lay.extend({},a.dateTime,n.startTime):a.dateTime),r=n.format.concat();return lay.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=lay.digit(i.year,t.length):/MM|M/.test(t)?r[e]=lay.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=lay.digit(i.date,t.length):/HH|H/.test(t)?r[e]=lay.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=lay.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=lay.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},g.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},g.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||lay(a)[i](e||""),this},g.prototype.done=function(e,t){var n=this,a=n.config,i=lay.extend({},lay.extend(a.dateTime,n.startTime)),r=lay.extend({},lay.extend(n.endDate,n.endTime));return lay.each([i,r],function(e,t){"month"in t&&lay.extend(t,{month:t.month+1})}),e=e||[n.parse(),i,r],"function"==typeof a[t||"done"]&&a[t||"done"].apply(a,e),n},g.prototype.choose=function(e,t){var n=this,a=n.config,i=n.thisDateTime(t),r=(lay(n.elem).find("td"),e.attr("lay-ymd").split("-"));r={year:0|r[0],month:(0|r[1])-1,date:0|r[2]},e.hasClass(s)||(lay.extend(i,r),a.range?(lay.each(["startTime","endTime"],function(e,t){n[t]=n[t]||{hours:0,minutes:0,seconds:0}}),n.calendar(null,t)):"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"))},g.prototype.tool=function(e,t){var n=this,a=n.config,i=n.lang(),r=a.dateTime,l="static"===a.position,o={datetime:function(){lay(e).hasClass(s)||(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(){n.setValue("").remove(),l&&(lay.extend(r,n.firstDate),n.calendar()),a.range&&(delete n.endDate,delete n.startTime,delete n.endTime),n.done(["",{},{}])},now:function(){var e=new Date;lay.extend(r,n.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),n.setValue(n.parse()).remove(),l&&n.calendar(),n.done()},confirm:function(){if(a.range){if(lay(e).hasClass(s))return n.hint("time"===a.type?i.timeout.replace(/日期/g,"时间"):i.timeout)}else if(lay(e).hasClass(s))return n.hint(i.invalidDate);n.done(),n.setValue(n.parse()).remove()}};o[t]&&o[t]()},g.prototype.change=function(e){var t=this,n=t.config,a=t.thisDateTime(e),i=n.range&&("year"===n.type||"month"===n.type),r=t.elemCont[e||0],l=t.listYM[e],o=function(o){var s=lay(r).find(".laydate-year-list")[0],c=lay(r).find(".laydate-month-list")[0];return s&&(l[0]=o?l[0]-15:l[0]+15,t.list("year",e)),c&&(o?l[0]--:l[0]++,t.list("month",e)),(s||c)&&(lay.extend(a,{year:l[0]}),i&&(a.year=l[0]),n.range||t.done(null,"change"),n.range||t.limit(lay(t.footer).find(h),{year:l[0]})),t.setBtnStatus(),s||c};return{prevYear:function(){o("sub")||(a.year--,t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change"))},prevMonth:function(){var i=t.getAsYM(a.year,a.month,"sub");lay.extend(a,{year:i[0],month:i[1]}),t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change")},nextMonth:function(){var i=t.getAsYM(a.year,a.month);lay.extend(a,{year:i[0],month:i[1]}),t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change")},nextYear:function(){o()||(a.year++,t.checkDate("limit").calendar(null,e),n.range||t.done(null,"change"))}}},g.prototype.changeEvent=function(){var e=this;e.config;lay(e.elem).on("click",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),i=a.attr("lay-ym"),r=a.attr("lay-type");i&&(i=i.split("-"),e.listYM[t]=[0|i[0],0|i[1]],e.list(r,t),lay(e.footer).find(p).addClass(s))}),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)})},g.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())},g.prototype.events=function(){var t=this,n=t.config,a=function(e,a){e.on(n.trigger,function(){a&&(t.bindElem=this),t.render()})};n.elem[0]&&!n.elem[0].eventHandler&&(a(n.elem,"bind"),a(n.eventElem),lay(document).on("click",function(e){e.target!==n.elem[0]&&e.target!==n.eventElem[0]&&e.target!==lay(n.closeStop)[0]&&t.remove()}).on("keydown",function(e){13===e.keyCode&&lay("#"+t.elemID)[0]&&t.elemID===g.thisElemDate&&(e.preventDefault(),lay(t.footer).find(h)[0].click())}),lay(e).on("resize",function(){return!(!t.elem||!lay(l)[0])&&void t.position()}),n.elem[0].eventHandler=!0)},a.render=function(e){var t=new g(e);return i.call(t)},a.getEndDate=function(e,t){var n=new Date;return n.setFullYear(t||n.getFullYear(),e||n.getMonth()+1,1),new Date(n.getTime()-864e5).getDate()},t?(a.ready(),layui.define("lay",function(e){a.path=layui.cache.dir,e(r,a)})):"function"==typeof define&&define.amd?define(function(){return a}):function(){a.ready(),e.laydate=a}()}(window); \ No newline at end of file +/*! layDate v5.2.1 | 日期与时间组件 | The MIT License */ + ;!function(){"use strict";var e="lay",t=window.document,n=function(e){return new a(e)},a=function(e){for(var n=0,a="object"==typeof e?[e]:(this.selector=e,t.querySelectorAll(e||null));n0;i--)if("interactive"===n[i].readyState){e=n[i].src;break}return e||n[a].src}();return e.substring(0,e.lastIndexOf("/")+1)},n.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},n.each=function(e,t){var n,a=this;if("function"!=typeof t)return a;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;n1e4/i?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(n.getStyle(r,"width"))?(e===y&&r.removeAttribute("lay-status"),r.getAttribute("lay-status")===y?setTimeout(d,i):a()):(r.setAttribute("lay-status",y),setTimeout(function(){d(y)},i)))}()},n.hasScrollbar=function(){return t.body.scrollHeight>(window.innerHeight||t.documentElement.clientHeight)},n.position=function(e,a,i){if(a){i=i||{},e!==t&&e!==n("body")[0]||(i.clickType="right");var r="right"===i.clickType?function(){var e=i.e||window.event||{};return{left:e.clientX,top:e.clientY,right:e.clientX,bottom:e.clientY}}():e.getBoundingClientRect(),l=a.offsetWidth,o=a.offsetHeight,s=function(e){return e=e?"scrollLeft":"scrollTop",t.body[e]|t.documentElement[e]},y=function(e){return t.documentElement[e?"clientWidth":"clientHeight"]},c=5,d=r.left,u=r.bottom;d+l+c>y("width")&&(d=y("width")-l-c),u+o+c>y()&&(r.top>o+c?u=r.top-o-2*c:"right"===i.clickType&&(u=y()-o-2*c,u<0&&(u=0)));var m=i.position;if(m&&(a.style.position=m),a.style.left=d+("fixed"===m?0:s(1))+"px",a.style.top=u+("fixed"===m?0:s())+"px",!n.hasScrollbar()){var h=a.getBoundingClientRect();!i.SYSTEM_RELOAD&&h.bottom+c>y()&&(i.SYSTEM_RELOAD=!0,setTimeout(function(){n.position(e,a,i)},50))}}},n.options=function(e,t){var a=n(e),i=t||"lay-options";try{return new Function("return "+(a.attr(i)||"{}"))()}catch(r){return hint.error("parseerror:"+r,"error"),{}}},n.isTopElem=function(e){var a=[t,n("body")[0]],i=!1;return n.each(a,function(t,n){if(n===e)return i=!0}),i},a.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){new RegExp("\\b"+n+"\\b").test(e)||(e=e+" "+n)}),e.replace(/^\s|\s$/,"")},a.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){var a=new RegExp("\\b"+n+"\\b");a.test(e)&&(e=e.replace(a,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},a.prototype.find=function(e){var t=this,a=0,i=[],r="object"==typeof e;return this.each(function(n,l){for(var o=r?[e]:l.querySelectorAll(e||null);a0)return a[0].style[e]}():a.each(function(a,r){"object"==typeof e?n.each(e,function(e,t){r.style[e]=i(t)}):r.style[e]=i(t)})},a.prototype.width=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetWidth}():t.each(function(n,a){t.css("width",e)})},a.prototype.height=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetHeight}():t.each(function(n,a){t.css("height",e)})},a.prototype.attr=function(e,t){var n=this;return void 0===t?function(){if(n.length>0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},a.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},a.prototype.html=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].innerHTML}():this.each(function(t,n){n.innerHTML=e})},a.prototype.val=function(e){return void 0===e?function(){if(that.length>0)return that[0].value}():this.each(function(t,n){n.value=e})},a.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},a.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},a.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},a.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},window.lay=n,window.layui&&layui.define&&layui.define(function(t){t(e,n)})}(),!function(e){"use strict";var t=e.layui&&layui.define,n={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,n,i){a.path&&e.lay&&lay.link&&lay.link(a.path+t,n,i)}},a={v:"5.2.1",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:n.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var i="laydate",r="",l=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+a.v+r;return t?layui.addcss(l,e,i):n.link(l,e,i),this}},i=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},r="laydate",l=".layui-laydate",o="layui-this",s="laydate-disabled",y=[100,2e5],c="layui-laydate-static",d="layui-laydate-list",u="laydate-selected",m="layui-laydate-hint",h="layui-laydate-footer",f=".laydate-btns-confirm",p="laydate-time-text",g=".laydate-btns-time",v=function(e){var t=this;t.index=++a.index,t.config=lay.extend({},t.config,a.config,e),a.ready(function(){t.init()})};v.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},v.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"click",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},v.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"},timeout:"结束时间不能早于开始时间
        请重新选择",invalidDate:"不在有效日期或时间范围内",formatError:["日期格式不合法
        必须遵循下述格式:
        ","
        已为你重置"]},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
        Please re-select",invalidDate:"Invalid date",formatError:["The date format error
        Must be followed:
        ","
        It has been reset"]}};return n[t.lang]||n.cn},v.prototype.init=function(){var t=this,n=t.config,a="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",i="static"===n.position,r={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};n.elem=lay(n.elem),n.eventElem=lay(n.eventElem),n.elem[0]&&(n.range===!0&&(n.range="-"),r[n.type]||(e.console&&console.error&&console.error("laydate type error:'"+n.type+"' is not supported"),n.type="date"),n.format===r.date&&(n.format=r[n.type]||r.date),t.format=n.format.match(new RegExp(a+"|.","g"))||[],t.EXP_IF="",t.EXP_SPLIT="",lay.each(t.format,function(e,n){var i=new RegExp(a).test(n)?"\\d{"+function(){return new RegExp(a).test(t.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;t.EXP_IF=t.EXP_IF+i,t.EXP_SPLIT=t.EXP_SPLIT+"("+i+")"}),t.EXP_IF=new RegExp("^"+(n.range?t.EXP_IF+"\\s\\"+n.range+"\\s"+t.EXP_IF:t.EXP_IF)+"$"),t.EXP_SPLIT=new RegExp("^"+t.EXP_SPLIT+"$",""),t.isInput(n.elem[0])||"focus"===n.trigger&&(n.trigger="click"),n.elem.attr("lay-key")||(n.elem.attr("lay-key",t.index),n.eventElem.attr("lay-key",t.index)),n.mark=lay.extend({},n.calendar&&"cn"===n.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},n.mark),lay.each(["min","max"],function(e,t){var a=[],i=[];if("number"==typeof n[t]){var r=n[t],l=(new Date).getTime(),o=864e5,s=new Date(r?r0)return!0;var a=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),n=lay.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],y=lay.elem("div",{"class":"layui-laydate-content"}),c=lay.elem("table"),d=lay.elem("thead"),u=lay.elem("tr");lay.each(i,function(e,t){a.appendChild(t)}),d.appendChild(u),lay.each(new Array(6),function(e){var t=c.insertRow(0);lay.each(new Array(7),function(a){if(0===e){var i=lay.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(d,c.children[0]),y.appendChild(c),r[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(y),l.push(i),o.push(y),s.push(c)}),lay(y).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),lay.each(t.btns,function(e,r){var l=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(l="cn"===t.lang?"重置":"Reset"),i.push(''+l+""))}),e.push('"),e.join("")}()),lay.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(y),/^#/.test(t.theme)){var d=lay.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in d?(d.setAttribute("type","text/css"),d.styleSheet.cssText=u):d.innerHTML=u,lay(i).addClass("laydate-theme-molv"),i.appendChild(d)}e.remove(v.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),v.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1}))},v.prototype.remove=function(e){var t=this,n=(t.config,lay("#"+(e||t.elemID)));return n[0]?(n.hasClass(c)||t.checkDate(function(){n.remove(),delete t.endDate}),t):t},v.prototype.position=function(){var e=this,t=e.config;return lay.position(e.bindElem||t.elem[0],e.elem,{position:t.position}),e},v.prototype.hint=function(e){var t=this,n=(t.config,lay.elem("div",{"class":m}));t.elem&&(n.innerHTML=e||"",lay(t.elem).find("."+m).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+m).remove()},3e3))},v.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},v.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},v.prototype.checkDate=function(e){var t,n,i=this,r=(new Date,i.config),l=i.lang(),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],c=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),d=function(e){e.year>y[1]&&(e.year=y[1],n=!0),e.month>11&&(e.month=11,n=!0),e.hours>23&&(e.hours=0,n=!0),e.minutes>59&&(e.minutes=0,e.hours++,n=!0),e.seconds>59&&(e.seconds=0,e.minutes++,n=!0),t=a.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,n=!0)},u=function(e,t,a){var l=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),a=a||0,r.range&&(i[l[a]]=i[l[a]]||{}),lay.each(i.format,function(o,s){var c=parseFloat(t[o]);t[o].length'+n+""),a},v.prototype.limit=function(e,t,n,a){var i,r=this,l=r.config,o={},y=l[n>41?"endDate":"dateTime"],c=lay.extend({},y,t||{});return lay.each({now:c,min:l.min,max:l.max},function(e,t){o[e]=r.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](s),i},v.prototype.thisDateTime=function(e){var t=this,n=t.config;return e?t.endDate:n.dateTime},v.prototype.calendar=function(e,t,n){var i,r,l,s=this,c=s.config,t=t?1:0,d=e||s.thisDateTime(t),u=new Date,m=s.lang(),h="date"!==c.type&&"datetime"!==c.type,p=lay(s.table[t]).find("td"),g=lay(s.elemHeader[t][2]).find("span");return d.yeary[1]&&(d.year=y[1],s.hint(m.invalidDate)),s.firstDate||(s.firstDate=lay.extend({},d)),u.setFullYear(d.year,d.month,1),i=u.getDay(),r=a.getEndDate(d.month||12,d.year),l=a.getEndDate(d.month+1,d.year),lay.each(p,function(e,t){var n=[d.year,d.month],a=0;t=lay(t),t.removeAttr("class"),e=i&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(lay(i),r,t),x++}),lay(u[v?0:1]).attr("lay-ym",x-8+"-"+D[1]).html(C+T+" - "+(x-1+T))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),l={year:D[0],month:e};e+1==D[1]&&lay(i).addClass(o),i.innerHTML=r.month[e]+(v?"月":""),y.appendChild(i),D[0]=n.firstDate.year&&(l.date=a.max.date),n.limit(lay(i),l,t)}),lay(u[v?0:1]).attr("lay-ym",D[0]+"-"+D[1]).html(D[0]+T);else if("time"===e){var M=function(){lay(y).find("ol").each(function(e,a){lay(a).find("li").each(function(a,i){n.limit(lay(i),[{hours:a},{hours:n[b].hours,minutes:a},{hours:n[b].hours,minutes:n[b].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(lay(n.footer).find(f),n[b],0,["hours","minutes","seconds"])};a.range?n[b]||(n[b]={hours:0,minutes:0,seconds:0}):n[b]=i,lay.each([24,60,60],function(e,t){var a=lay.elem("li"),i=["

        "+r.time[e]+"

          "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",y.appendChild(a)}),M()}if(h&&m.removeChild(h),m.appendChild(y),"year"===e||"month"===e)lay(n.elemMain[t]).addClass("laydate-ym-show"),lay(y).find("li").on("click",function(){var r=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(s)){0===t?(i[e]=r,n.limit(lay(n.footer).find(f),null,0)):n.endDate[e]=r;var c="year"===a.type||"month"===a.type;c?(lay(y).find("."+o).removeClass(o),lay(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(t?i.year=r:n.endDate.year=r),n.list("month",t))):(n.checkDate("limit").calendar(null,t),n.closeList()),n.setBtnStatus(),a.range||(("month"===a.type&&"month"===e||"year"===a.type&&"year"===e)&&n.setValue(n.parse()).remove().done(),n.done(null,"change")),lay(n.footer).find(g).removeClass(s)}});else{var E=lay.elem("span",{"class":p}),k=function(){lay(y).find("ol").each(function(e){var t=this,a=lay(t).find("li");t.scrollTop=30*(n[b][w[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!lay(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},S=lay(c[2]).find("."+p);k(),E.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,lay(n.elemMain[t]).addClass("laydate-time-show"),S[0]&&S.remove(),c[2].appendChild(E),lay(y).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var r=0|this.innerHTML;lay(this).hasClass(s)||(a.range?n[b][w[e]]=r:i[w[e]]=r,lay(t).find("."+o).removeClass(o),lay(this).addClass(o),M(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},v.prototype.listYM=[],v.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,n){lay(this).find("."+d).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+p).remove()},v.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,l=i.lang(),o=lay(i.footer).find(f);r.range&&"time"!==r.type&&(t=t||r.dateTime,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.timeout.replace(/日期/g,e):l.timeout))},v.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?lay.extend({},n.endDate,n.endTime):a.range?lay.extend({},a.dateTime,n.startTime):a.dateTime),r=n.format.concat();return lay.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=lay.digit(i.year,t.length):/MM|M/.test(t)?r[e]=lay.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=lay.digit(i.date,t.length):/HH|H/.test(t)?r[e]=lay.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=lay.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=lay.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},v.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},v.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||lay(a)[i](e||""),this},v.prototype.stampRange=function(e,t){var n,a,i=this,r=i.config;r.range&&(n=i.newDate(r.dateTime).getTime(),a=i.newDate(i.endDate).getTime(),lay.each(t,function(t,r){var l=lay(r).attr("lay-ymd").split("-"),o=i.newDate({year:l[0],month:l[1]-1,date:l[2]}).getTime();0==e?o>n&&lay(r).addClass(u):oli,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content,.layui-laydate-range .laydate-main-list-1 .layui-laydate-header{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} \ No newline at end of file +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;animation-name:laydate-downbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@keyframes laydate-downbit{0%{opacity:.3;transform:translate3d(0,-5px,0)}100%{opacity:1;transform:translate3d(0,0,0)}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content,.layui-laydate-range .laydate-main-list-1 .layui-laydate-header{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#B5FFF8}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eee;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} \ No newline at end of file diff --git a/package.json b/package.json index 4a7747a..59749e9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "layui-laydate", "realname": "layDate", - "version": "5.2.0", + "version": "5.2.1", "description": "日期与时间组件", "main": "src/laydate.js", "license": "MIT", diff --git a/src/laydate.js b/src/laydate.js index 31c3112..88cd4f7 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -141,10 +141,17 @@ //载入 CSS 依赖 lay.link = function(href, fn, cssname){ - var head = document.getElementsByTagName("head")[0], link = document.createElement('link'); + var head = document.getElementsByTagName("head")[0] + ,link = document.createElement('link'); + if(typeof fn === 'string') cssname = fn; + var app = (cssname || href).replace(/\.|\//g, ''); - var id = 'layuicss-'+ app, timeout = 0; + var id = 'layuicss-'+ app + ,STAUTS_NAME = 'creating' + ,timeout = 0; + + link.rel = 'stylesheet'; link.href = href; @@ -153,15 +160,31 @@ if(!document.getElementById(id)){ head.appendChild(link); } - + if(typeof fn !== 'function') return; - - //轮询css是否加载完毕 - (function poll() { - if(++timeout > 8 * 1000 / 100){ - return window.console && console.error(app + '.css: Invalid'); + + //轮询 css 是否加载完毕 + (function poll(status) { + var delay = 100 + ,getLinkElem = document.getElementById(id); //获取动态插入的 link 元素 + + //如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范 + if(++timeout > 10 * 1000 / delay){ + return window.console && console.error(app +'.css: Invalid'); }; - parseInt(lay.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100); + + //css 加载就绪 + if(parseInt(lay.getStyle(getLinkElem, 'width')) === 1989){ + //如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态 + if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status'); + //如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调 + getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn(); + } else { + getLinkElem.setAttribute('lay-status', STAUTS_NAME); + setTimeout(function(){ + poll(STAUTS_NAME); + }, delay); + } }()); }; @@ -398,16 +421,21 @@ }); }; - //设置HTML内容 + //设置或获取 HTML 内容 LAY.prototype.html = function(html){ - return this.each(function(index, item){ + var that = this; + return html === undefined ? function(){ + if(that.length > 0) return that[0].innerHTML; + }() : this.each(function(index, item){ item.innerHTML = html; }); }; - //设置值 + //设置或获取值 LAY.prototype.val = function(value){ - return this.each(function(index, item){ + return value === undefined ? function(){ + if(that.length > 0) return that[0].value; + }() : this.each(function(index, item){ item.value = value; }); }; @@ -481,7 +509,7 @@ } ,laydate = { - v: '5.2.0' + v: '5.2.1' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: ready.getPath @@ -1265,6 +1293,7 @@ //同步按钮可点状态 that.setBtnStatus(); + that.stampRange(index, tds); //标记范围内的日期 return that; }; @@ -1577,7 +1606,90 @@ return this; }; - //执行done/change回调 + //标记范围内的日期 + Class.prototype.stampRange = function(index, tds){ + var that = this + ,options = that.config + ,startTime, endTime; + + if(!options.range) return; + + startTime = that.newDate(options.dateTime).getTime(); + endTime = that.newDate(that.endDate).getTime(); + + //标记范围样式 + lay.each(tds, function(i, item){ + var ymd = lay(item).attr('lay-ymd').split('-') + ,thisTime = that.newDate({ + year: ymd[0] + ,month: ymd[1] - 1 + ,date: ymd[2] + }).getTime(); + + if(index == 0){ + if(thisTime > startTime){ + lay(item).addClass(ELEM_SELECTED); + } + } else { + if(thisTime < endTime){ + lay(item).addClass(ELEM_SELECTED); + } + } + + return; + if(thisTime === startTime || thisTime === endTime){ + lay(item).addClass( + lay(item).hasClass(ELEM_PREV) || lay(item).hasClass(ELEM_NEXT) + ? ELEM_SELECTED + : THIS + ); + } + if(thisTime > startTime && thisTime < endTime){ + lay(item).addClass(ELEM_SELECTED); + } + }); + + return; + + if(options.range && !that.endDate) lay(that.footer).find(ELEM_CONFIRM).addClass(DISABLED); + if(!that.endDate) return; + + startTime = that.newDate({ + year: that.startDate.year + ,month: that.startDate.month + ,date: that.startDate.date + }).getTime(); + + endTime = that.newDate({ + year: that.endDate.year + ,month: that.endDate.month + ,date: that.endDate.date + }).getTime(); + + if(startTime > endTime) return that.hint(TIPS_OUT); + + lay.each(tds, function(i, item){ + var ymd = lay(item).attr('lay-ymd').split('-') + ,thisTime = that.newDate({ + year: ymd[0] + ,month: ymd[1] - 1 + ,date: ymd[2] + }).getTime(); + lay(item).removeClass(ELEM_SELECTED + ' ' + THIS); + if(thisTime === startTime || thisTime === endTime){ + lay(item).addClass( + lay(item).hasClass(ELEM_PREV) || lay(item).hasClass(ELEM_NEXT) + ? ELEM_SELECTED + : THIS + ); + } + if(thisTime > startTime && thisTime < endTime){ + lay(item).addClass(ELEM_SELECTED); + } + }); + }; + + //执行 done/change 回调 Class.prototype.done = function(param, type){ var that = this ,options = that.config diff --git a/src/theme/default/laydate.css b/src/theme/default/laydate.css index 6fc9499..d6e8eef 100644 --- a/src/theme/default/laydate.css +++ b/src/theme/default/laydate.css @@ -98,10 +98,10 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} .layui-laydate-content{border-top: none 0; border-bottom: none 0;} .layui-laydate-content th{color: #333;} .layui-laydate-content td{color: #666;} -.layui-laydate-content td.laydate-selected{background-color: #00F7DE;} +.layui-laydate-content td.laydate-selected{background-color: #B5FFF8;} .laydate-selected:hover{background-color: #00F7DE !important;} .layui-laydate-content td:hover, -.layui-laydate-list li:hover{background-color: #eaeaea; color: #333;} +.layui-laydate-list li:hover{background-color: #eee; color: #333;} .laydate-time-list li ol{margin: 0; padding: 0; border: 1px solid #e2e2e2; border-left-width: 0;} .laydate-time-list li:first-child ol{border-left-width: 1px;} .laydate-time-list>li:hover{background: none;} From 2296f2be934312021bf24454c24fc98eaf3311e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsin@users.noreply.github.com> Date: Sat, 8 May 2021 22:30:22 +0800 Subject: [PATCH 25/26] update --- dist/laydate.js | 4 +- dist/theme/default/laydate.css | 2 +- gulpfile.js | 13 +- package.json | 2 +- src/laydate.js | 521 +++++++++++++++++++++------------ src/theme/default/laydate.css | 50 ++-- 6 files changed, 369 insertions(+), 223 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 0fd3bbe..2af9779 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,2 @@ -/*! layDate v5.2.1 | 日期与时间组件 | The MIT License */ - ;!function(){"use strict";var e="lay",t=window.document,n=function(e){return new a(e)},a=function(e){for(var n=0,a="object"==typeof e?[e]:(this.selector=e,t.querySelectorAll(e||null));n0;i--)if("interactive"===n[i].readyState){e=n[i].src;break}return e||n[a].src}();return e.substring(0,e.lastIndexOf("/")+1)},n.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},n.each=function(e,t){var n,a=this;if("function"!=typeof t)return a;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;n1e4/i?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(n.getStyle(r,"width"))?(e===y&&r.removeAttribute("lay-status"),r.getAttribute("lay-status")===y?setTimeout(d,i):a()):(r.setAttribute("lay-status",y),setTimeout(function(){d(y)},i)))}()},n.hasScrollbar=function(){return t.body.scrollHeight>(window.innerHeight||t.documentElement.clientHeight)},n.position=function(e,a,i){if(a){i=i||{},e!==t&&e!==n("body")[0]||(i.clickType="right");var r="right"===i.clickType?function(){var e=i.e||window.event||{};return{left:e.clientX,top:e.clientY,right:e.clientX,bottom:e.clientY}}():e.getBoundingClientRect(),l=a.offsetWidth,o=a.offsetHeight,s=function(e){return e=e?"scrollLeft":"scrollTop",t.body[e]|t.documentElement[e]},y=function(e){return t.documentElement[e?"clientWidth":"clientHeight"]},c=5,d=r.left,u=r.bottom;d+l+c>y("width")&&(d=y("width")-l-c),u+o+c>y()&&(r.top>o+c?u=r.top-o-2*c:"right"===i.clickType&&(u=y()-o-2*c,u<0&&(u=0)));var m=i.position;if(m&&(a.style.position=m),a.style.left=d+("fixed"===m?0:s(1))+"px",a.style.top=u+("fixed"===m?0:s())+"px",!n.hasScrollbar()){var h=a.getBoundingClientRect();!i.SYSTEM_RELOAD&&h.bottom+c>y()&&(i.SYSTEM_RELOAD=!0,setTimeout(function(){n.position(e,a,i)},50))}}},n.options=function(e,t){var a=n(e),i=t||"lay-options";try{return new Function("return "+(a.attr(i)||"{}"))()}catch(r){return hint.error("parseerror:"+r,"error"),{}}},n.isTopElem=function(e){var a=[t,n("body")[0]],i=!1;return n.each(a,function(t,n){if(n===e)return i=!0}),i},a.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){new RegExp("\\b"+n+"\\b").test(e)||(e=e+" "+n)}),e.replace(/^\s|\s$/,"")},a.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){var a=new RegExp("\\b"+n+"\\b");a.test(e)&&(e=e.replace(a,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},a.prototype.find=function(e){var t=this,a=0,i=[],r="object"==typeof e;return this.each(function(n,l){for(var o=r?[e]:l.querySelectorAll(e||null);a0)return a[0].style[e]}():a.each(function(a,r){"object"==typeof e?n.each(e,function(e,t){r.style[e]=i(t)}):r.style[e]=i(t)})},a.prototype.width=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetWidth}():t.each(function(n,a){t.css("width",e)})},a.prototype.height=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetHeight}():t.each(function(n,a){t.css("height",e)})},a.prototype.attr=function(e,t){var n=this;return void 0===t?function(){if(n.length>0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},a.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},a.prototype.html=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].innerHTML}():this.each(function(t,n){n.innerHTML=e})},a.prototype.val=function(e){return void 0===e?function(){if(that.length>0)return that[0].value}():this.each(function(t,n){n.value=e})},a.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},a.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},a.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},a.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},window.lay=n,window.layui&&layui.define&&layui.define(function(t){t(e,n)})}(),!function(e){"use strict";var t=e.layui&&layui.define,n={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,n,i){a.path&&e.lay&&lay.link&&lay.link(a.path+t,n,i)}},a={v:"5.2.1",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:n.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var i="laydate",r="",l=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+a.v+r;return t?layui.addcss(l,e,i):n.link(l,e,i),this}},i=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},r="laydate",l=".layui-laydate",o="layui-this",s="laydate-disabled",y=[100,2e5],c="layui-laydate-static",d="layui-laydate-list",u="laydate-selected",m="layui-laydate-hint",h="layui-laydate-footer",f=".laydate-btns-confirm",p="laydate-time-text",g=".laydate-btns-time",v=function(e){var t=this;t.index=++a.index,t.config=lay.extend({},t.config,a.config,e),a.ready(function(){t.init()})};v.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},v.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"click",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},v.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"},timeout:"结束时间不能早于开始时间
        请重新选择",invalidDate:"不在有效日期或时间范围内",formatError:["日期格式不合法
        必须遵循下述格式:
        ","
        已为你重置"]},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
        Please re-select",invalidDate:"Invalid date",formatError:["The date format error
        Must be followed:
        ","
        It has been reset"]}};return n[t.lang]||n.cn},v.prototype.init=function(){var t=this,n=t.config,a="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",i="static"===n.position,r={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};n.elem=lay(n.elem),n.eventElem=lay(n.eventElem),n.elem[0]&&(n.range===!0&&(n.range="-"),r[n.type]||(e.console&&console.error&&console.error("laydate type error:'"+n.type+"' is not supported"),n.type="date"),n.format===r.date&&(n.format=r[n.type]||r.date),t.format=n.format.match(new RegExp(a+"|.","g"))||[],t.EXP_IF="",t.EXP_SPLIT="",lay.each(t.format,function(e,n){var i=new RegExp(a).test(n)?"\\d{"+function(){return new RegExp(a).test(t.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;t.EXP_IF=t.EXP_IF+i,t.EXP_SPLIT=t.EXP_SPLIT+"("+i+")"}),t.EXP_IF=new RegExp("^"+(n.range?t.EXP_IF+"\\s\\"+n.range+"\\s"+t.EXP_IF:t.EXP_IF)+"$"),t.EXP_SPLIT=new RegExp("^"+t.EXP_SPLIT+"$",""),t.isInput(n.elem[0])||"focus"===n.trigger&&(n.trigger="click"),n.elem.attr("lay-key")||(n.elem.attr("lay-key",t.index),n.eventElem.attr("lay-key",t.index)),n.mark=lay.extend({},n.calendar&&"cn"===n.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},n.mark),lay.each(["min","max"],function(e,t){var a=[],i=[];if("number"==typeof n[t]){var r=n[t],l=(new Date).getTime(),o=864e5,s=new Date(r?r0)return!0;var a=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),n=lay.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],y=lay.elem("div",{"class":"layui-laydate-content"}),c=lay.elem("table"),d=lay.elem("thead"),u=lay.elem("tr");lay.each(i,function(e,t){a.appendChild(t)}),d.appendChild(u),lay.each(new Array(6),function(e){var t=c.insertRow(0);lay.each(new Array(7),function(a){if(0===e){var i=lay.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(d,c.children[0]),y.appendChild(c),r[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(y),l.push(i),o.push(y),s.push(c)}),lay(y).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),lay.each(t.btns,function(e,r){var l=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(l="cn"===t.lang?"重置":"Reset"),i.push(''+l+""))}),e.push('"),e.join("")}()),lay.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(y),/^#/.test(t.theme)){var d=lay.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in d?(d.setAttribute("type","text/css"),d.styleSheet.cssText=u):d.innerHTML=u,lay(i).addClass("laydate-theme-molv"),i.appendChild(d)}e.remove(v.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),v.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1}))},v.prototype.remove=function(e){var t=this,n=(t.config,lay("#"+(e||t.elemID)));return n[0]?(n.hasClass(c)||t.checkDate(function(){n.remove(),delete t.endDate}),t):t},v.prototype.position=function(){var e=this,t=e.config;return lay.position(e.bindElem||t.elem[0],e.elem,{position:t.position}),e},v.prototype.hint=function(e){var t=this,n=(t.config,lay.elem("div",{"class":m}));t.elem&&(n.innerHTML=e||"",lay(t.elem).find("."+m).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+m).remove()},3e3))},v.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},v.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},v.prototype.checkDate=function(e){var t,n,i=this,r=(new Date,i.config),l=i.lang(),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],c=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),d=function(e){e.year>y[1]&&(e.year=y[1],n=!0),e.month>11&&(e.month=11,n=!0),e.hours>23&&(e.hours=0,n=!0),e.minutes>59&&(e.minutes=0,e.hours++,n=!0),e.seconds>59&&(e.seconds=0,e.minutes++,n=!0),t=a.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,n=!0)},u=function(e,t,a){var l=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),a=a||0,r.range&&(i[l[a]]=i[l[a]]||{}),lay.each(i.format,function(o,s){var c=parseFloat(t[o]);t[o].length'+n+""),a},v.prototype.limit=function(e,t,n,a){var i,r=this,l=r.config,o={},y=l[n>41?"endDate":"dateTime"],c=lay.extend({},y,t||{});return lay.each({now:c,min:l.min,max:l.max},function(e,t){o[e]=r.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](s),i},v.prototype.thisDateTime=function(e){var t=this,n=t.config;return e?t.endDate:n.dateTime},v.prototype.calendar=function(e,t,n){var i,r,l,s=this,c=s.config,t=t?1:0,d=e||s.thisDateTime(t),u=new Date,m=s.lang(),h="date"!==c.type&&"datetime"!==c.type,p=lay(s.table[t]).find("td"),g=lay(s.elemHeader[t][2]).find("span");return d.yeary[1]&&(d.year=y[1],s.hint(m.invalidDate)),s.firstDate||(s.firstDate=lay.extend({},d)),u.setFullYear(d.year,d.month,1),i=u.getDay(),r=a.getEndDate(d.month||12,d.year),l=a.getEndDate(d.month+1,d.year),lay.each(p,function(e,t){var n=[d.year,d.month],a=0;t=lay(t),t.removeAttr("class"),e=i&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(lay(i),r,t),x++}),lay(u[v?0:1]).attr("lay-ym",x-8+"-"+D[1]).html(C+T+" - "+(x-1+T))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),l={year:D[0],month:e};e+1==D[1]&&lay(i).addClass(o),i.innerHTML=r.month[e]+(v?"月":""),y.appendChild(i),D[0]=n.firstDate.year&&(l.date=a.max.date),n.limit(lay(i),l,t)}),lay(u[v?0:1]).attr("lay-ym",D[0]+"-"+D[1]).html(D[0]+T);else if("time"===e){var M=function(){lay(y).find("ol").each(function(e,a){lay(a).find("li").each(function(a,i){n.limit(lay(i),[{hours:a},{hours:n[b].hours,minutes:a},{hours:n[b].hours,minutes:n[b].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(lay(n.footer).find(f),n[b],0,["hours","minutes","seconds"])};a.range?n[b]||(n[b]={hours:0,minutes:0,seconds:0}):n[b]=i,lay.each([24,60,60],function(e,t){var a=lay.elem("li"),i=["

        "+r.time[e]+"

          "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",y.appendChild(a)}),M()}if(h&&m.removeChild(h),m.appendChild(y),"year"===e||"month"===e)lay(n.elemMain[t]).addClass("laydate-ym-show"),lay(y).find("li").on("click",function(){var r=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(s)){0===t?(i[e]=r,n.limit(lay(n.footer).find(f),null,0)):n.endDate[e]=r;var c="year"===a.type||"month"===a.type;c?(lay(y).find("."+o).removeClass(o),lay(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(t?i.year=r:n.endDate.year=r),n.list("month",t))):(n.checkDate("limit").calendar(null,t),n.closeList()),n.setBtnStatus(),a.range||(("month"===a.type&&"month"===e||"year"===a.type&&"year"===e)&&n.setValue(n.parse()).remove().done(),n.done(null,"change")),lay(n.footer).find(g).removeClass(s)}});else{var E=lay.elem("span",{"class":p}),k=function(){lay(y).find("ol").each(function(e){var t=this,a=lay(t).find("li");t.scrollTop=30*(n[b][w[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!lay(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},S=lay(c[2]).find("."+p);k(),E.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,lay(n.elemMain[t]).addClass("laydate-time-show"),S[0]&&S.remove(),c[2].appendChild(E),lay(y).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var r=0|this.innerHTML;lay(this).hasClass(s)||(a.range?n[b][w[e]]=r:i[w[e]]=r,lay(t).find("."+o).removeClass(o),lay(this).addClass(o),M(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},v.prototype.listYM=[],v.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,n){lay(this).find("."+d).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+p).remove()},v.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,l=i.lang(),o=lay(i.footer).find(f);r.range&&"time"!==r.type&&(t=t||r.dateTime,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.timeout.replace(/日期/g,e):l.timeout))},v.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?lay.extend({},n.endDate,n.endTime):a.range?lay.extend({},a.dateTime,n.startTime):a.dateTime),r=n.format.concat();return lay.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=lay.digit(i.year,t.length):/MM|M/.test(t)?r[e]=lay.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=lay.digit(i.date,t.length):/HH|H/.test(t)?r[e]=lay.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=lay.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=lay.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},v.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},v.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||lay(a)[i](e||""),this},v.prototype.stampRange=function(e,t){var n,a,i=this,r=i.config;r.range&&(n=i.newDate(r.dateTime).getTime(),a=i.newDate(i.endDate).getTime(),lay.each(t,function(t,r){var l=lay(r).attr("lay-ymd").split("-"),o=i.newDate({year:l[0],month:l[1]-1,date:l[2]}).getTime();0==e?o>n&&lay(r).addClass(u):o0;i--)if("interactive"===n[i].readyState){e=n[i].src;break}return e||n[a].src}();return e.substring(0,e.lastIndexOf("/")+1)},n.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},n.each=function(e,t){var n,a=this;if("function"!=typeof t)return a;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;n1e4/i?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(n.getStyle(r,"width"))?(e===c&&r.removeAttribute("lay-status"),r.getAttribute("lay-status")===c?setTimeout(d,i):a()):(r.setAttribute("lay-status",c),setTimeout(function(){d(c)},i)))}()},n.hasScrollbar=function(){return t.body.scrollHeight>(window.innerHeight||t.documentElement.clientHeight)},n.position=function(e,a,i){if(a){i=i||{},e!==t&&e!==n("body")[0]||(i.clickType="right");var r="right"===i.clickType?function(){var e=i.e||window.event||{};return{left:e.clientX,top:e.clientY,right:e.clientX,bottom:e.clientY}}():e.getBoundingClientRect(),l=a.offsetWidth,o=a.offsetHeight,s=function(e){return e=e?"scrollLeft":"scrollTop",t.body[e]|t.documentElement[e]},c=function(e){return t.documentElement[e?"clientWidth":"clientHeight"]},y=5,d=r.left,u=r.bottom;d+l+y>c("width")&&(d=c("width")-l-y),u+o+y>c()&&(r.top>o+y?u=r.top-o-2*y:"right"===i.clickType&&(u=c()-o-2*y,u<0&&(u=0)));var m=i.position;if(m&&(a.style.position=m),a.style.left=d+("fixed"===m?0:s(1))+"px",a.style.top=u+("fixed"===m?0:s())+"px",!n.hasScrollbar()){var h=a.getBoundingClientRect();!i.SYSTEM_RELOAD&&h.bottom+y>c()&&(i.SYSTEM_RELOAD=!0,setTimeout(function(){n.position(e,a,i)},50))}}},n.options=function(e,t){var a=n(e),i=t||"lay-options";try{return new Function("return "+(a.attr(i)||"{}"))()}catch(r){return hint.error("parseerror\uff1a"+r,"error"),{}}},n.isTopElem=function(e){var a=[t,n("body")[0]],i=!1;return n.each(a,function(t,n){if(n===e)return i=!0}),i},a.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){new RegExp("\\b"+n+"\\b").test(e)||(e=e+" "+n)}),e.replace(/^\s|\s$/,"")},a.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){var a=new RegExp("\\b"+n+"\\b");a.test(e)&&(e=e.replace(a,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},a.prototype.find=function(e){var t=this,a=0,i=[],r="object"==typeof e;return this.each(function(n,l){for(var o=r?l.contains(e):l.querySelectorAll(e||null);a0)return a[0].style[e]}():a.each(function(a,r){"object"==typeof e?n.each(e,function(e,t){r.style[e]=i(t)}):r.style[e]=i(t)})},a.prototype.width=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetWidth}():t.each(function(n,a){t.css("width",e)})},a.prototype.height=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetHeight}():t.each(function(n,a){t.css("height",e)})},a.prototype.attr=function(e,t){var n=this;return void 0===t?function(){if(n.length>0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},a.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},a.prototype.html=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].innerHTML}():this.each(function(t,n){n.innerHTML=e})},a.prototype.val=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].value}():this.each(function(t,n){n.value=e})},a.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},a.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},a.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},a.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},window.lay=n,window.layui&&layui.define&&layui.define(function(t){t(e,n)})}(),!function(e){"use strict";var t=e.layui&&layui.define,n={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,n,a){i.path&&e.lay&&lay.link&&lay.link(i.path+t,n,a)}},a=e.LAYUI_GLOBAL||{},i={v:"5.3.0",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:a.laydate_dir||n.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var a="laydate",r="",l=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+i.v+r;return t?layui.addcss(l,e,a):n.link(l,e,a),this}},r=function(){var e=this,t=e.config,n=t.id;return r.that[n]=e,{hint:function(t){e.hint.call(e,t)},config:e.config}},l="laydate",o=".layui-laydate",s="layui-this",c="laydate-disabled",y=[100,2e5],d="layui-laydate-static",u="layui-laydate-list",m="layui-laydate-hint",h="layui-laydate-footer",f=".laydate-btns-confirm",p="laydate-time-text",g="laydate-btns-time",v="layui-laydate-preview",T=function(e){var t=this;t.index=++i.index,t.config=lay.extend({},t.config,i.config,e),e=t.config,e.id="id"in e?e.id:t.index,i.ready(function(){t.init()})},D="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s";r.formatArr=function(e){return(e||"").match(new RegExp(D+"|.","g"))||[]},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"click",show:!1,showBottom:!0,isPreview:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"],time:["\u65f6","\u5206","\u79d2"],timeTips:"\u9009\u62e9\u65f6\u95f4",startTime:"\u5f00\u59cb\u65f6\u95f4",endTime:"\u7ed3\u675f\u65f6\u95f4",dateTips:"\u8fd4\u56de\u65e5\u671f",month:["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"],tools:{confirm:"\u786e\u5b9a",clear:"\u6e05\u7a7a",now:"\u73b0\u5728"},timeout:"\u7ed3\u675f\u65f6\u95f4\u4e0d\u80fd\u65e9\u4e8e\u5f00\u59cb\u65f6\u95f4
        \u8bf7\u91cd\u65b0\u9009\u62e9",invalidDate:"\u4e0d\u5728\u6709\u6548\u65e5\u671f\u6216\u65f6\u95f4\u8303\u56f4\u5185",formatError:["\u65e5\u671f\u683c\u5f0f\u4e0d\u5408\u6cd5
        \u5fc5\u987b\u9075\u5faa\u4e0b\u8ff0\u683c\u5f0f\uff1a
        ","
        \u5df2\u4e3a\u4f60\u91cd\u7f6e"],preview:"\u5f53\u524d\u9009\u4e2d\u7684\u7ed3\u679c"},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
        Please re-select",invalidDate:"Invalid date",formatError:["The date format error
        Must be followed\uff1a
        ","
        It has been reset"],preview:"The selected result"}};return n[t.lang]||n.cn},T.prototype.init=function(){var t=this,n=t.config,a="static"===n.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};n.elem=lay(n.elem),n.eventElem=lay(n.eventElem),n.elem[0]&&(t.rangeStr=n.range?"string"==typeof n.range?n.range:"-":"",n.range&&n.range.constructor===Array&&(t.rangeElem=[lay(n.range[0]),lay(n.range[1])]),i[n.type]||(e.console&&console.error&&console.error("laydate type error:'"+n.type+"' is not supported"),n.type="date"),n.format===i.date&&(n.format=i[n.type]||i.date),t.format=r.formatArr(n.format),t.EXP_IF="",t.EXP_SPLIT="",lay.each(t.format,function(e,n){var a=new RegExp(D).test(n)?"\\d{"+function(){return new RegExp(D).test(t.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;t.EXP_IF=t.EXP_IF+a,t.EXP_SPLIT=t.EXP_SPLIT+"("+a+")"}),t.EXP_IF_ONE=new RegExp("^"+t.EXP_IF+"$"),t.EXP_IF=new RegExp("^"+(n.range?t.EXP_IF+"\\s\\"+t.rangeStr+"\\s"+t.EXP_IF:t.EXP_IF)+"$"),t.EXP_SPLIT=new RegExp("^"+t.EXP_SPLIT+"$",""),t.isInput(n.elem[0])||"focus"===n.trigger&&(n.trigger="click"),n.elem.attr("lay-key")||(n.elem.attr("lay-key",t.index),n.eventElem.attr("lay-key",t.index)),n.mark=lay.extend({},n.calendar&&"cn"===n.lang?{"0-1-1":"\u5143\u65e6","0-2-14":"\u60c5\u4eba","0-3-8":"\u5987\u5973","0-3-12":"\u690d\u6811","0-4-1":"\u611a\u4eba","0-5-1":"\u52b3\u52a8","0-5-4":"\u9752\u5e74","0-6-1":"\u513f\u7ae5","0-9-10":"\u6559\u5e08","0-9-18":"\u56fd\u803b","0-10-1":"\u56fd\u5e86","0-12-25":"\u5723\u8bde"}:{},n.mark),lay.each(["min","max"],function(e,t){var a=[],i=[];if("number"==typeof n[t]){var r=n[t],l=(new Date).getTime(),o=864e5,s=new Date(r?r0)return!0;var a=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),n=lay.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],r=lay.elem("div",{"class":"layui-laydate-content"}),y=lay.elem("table"),d=lay.elem("thead"),u=lay.elem("tr");lay.each(i,function(e,t){a.appendChild(t)}),d.appendChild(u),lay.each(new Array(6),function(e){var t=y.insertRow(0);lay.each(new Array(7),function(a){if(0===e){var i=lay.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),y.insertBefore(d,y.children[0]),r.appendChild(y),l[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),l[e].appendChild(a),l[e].appendChild(r),o.push(i),s.push(r),c.push(y)}),lay(y).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),(t.range||"datetime"!==t.type)&&e.push(''),lay.each(t.btns,function(e,r){var l=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(l="cn"===t.lang?"\u91cd\u7f6e":"Reset"),i.push(''+l+""))}),e.push('"),e.join("")}()),lay.each(l,function(e,t){r.appendChild(t)}),t.showBottom&&r.appendChild(y),/^#/.test(t.theme)){var u=lay.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in u?(u.setAttribute("type","text/css"),u.styleSheet.cssText=m):u.innerHTML=m,lay(r).addClass("laydate-theme-molv"),r.appendChild(u)}i.thisId=t.id,e.remove(T.thisElemDate),a?t.elem.append(r):(document.body.appendChild(r),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1})),e.preview()},T.prototype.remove=function(e){var t=this,n=(t.config,lay("#"+(e||t.elemID)));return n[0]?(n.hasClass(d)||t.checkDate(function(){n.remove()}),t):t},T.prototype.position=function(){var e=this,t=e.config;return lay.position(e.bindElem||t.elem[0],e.elem,{position:t.position}),e},T.prototype.hint=function(e){var t=this,n=(t.config,lay.elem("div",{"class":m}));t.elem&&(n.innerHTML=e||"",lay(t.elem).find("."+m).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+m).remove()},3e3))},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,n,a=this,r=(new Date,a.config),l=a.lang(),o=r.dateTime=r.dateTime||a.systemDate(),s=a.bindElem||r.elem[0],c=(a.isInput(s)?"val":"html",function(){if(a.rangeElem){var e=[a.rangeElem[0].val(),a.rangeElem[1].val()];if(e[0]&&e[1])return e.join(" "+a.rangeStr+" ")}return a.isInput(s)?s.value:"static"===r.position?"":lay(s).attr("lay-date")}()),d=function(e){e.year>y[1]&&(e.year=y[1],n=!0),e.month>11&&(e.month=11,n=!0),e.hours>23&&(e.hours=0,n=!0),e.minutes>59&&(e.minutes=0,e.hours++,n=!0),e.seconds>59&&(e.seconds=0,e.minutes++,n=!0),t=i.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,n=!0)},u=function(e,t,i){var l=["startTime","endTime"];t=(t.match(a.EXP_SPLIT)||[]).slice(1),i=i||0,r.range&&(a[l[i]]=a[l[i]]||{}),lay.each(a.format,function(o,s){var c=parseFloat(t[o]);t[o].lengthh(r.max)||h(o)h(r.max))&&(a.endDate=lay.extend({},r.max)),e&&e(),a},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return lay.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,l=r.config,o={},s=l[n>41?"endDate":"dateTime"],y=lay.extend({},s,t||{});return lay.each({now:y,min:l.min,max:l.max},function(e,t){o[e]=r.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](c),i},T.prototype.thisDateTime=function(e){var t=this,n=t.config;return e?t.endDate:n.dateTime},T.prototype.calendar=function(e,t,n){var a,r,l,o=this,c=o.config,t=t?1:0,d=e||o.thisDateTime(t),u=new Date,m=o.lang(),h="date"!==c.type&&"datetime"!==c.type,p=lay(o.table[t]).find("td"),g=lay(o.elemHeader[t][2]).find("span");return d.yeary[1]&&(d.year=y[1],o.hint(m.invalidDate)),o.firstDate||(o.firstDate=lay.extend({},d)),u.setFullYear(d.year,d.month,1),a=u.getDay(),r=i.getEndDate(d.month||12,d.year),l=i.getEndDate(d.month+1,d.year),lay.each(p,function(e,t){var n=[d.year,d.month],i=0;t=lay(t),t.removeAttr("class"),e=a&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(lay(i),r,t),x++}),lay(d[v?0:1]).attr("lay-ym",x-8+"-"+D[1]).html(b+T+" - "+(x-1+T))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),l={year:D[0],month:e};e+1==D[1]&&lay(i).addClass(s),i.innerHTML=r.month[e]+(v?"\u6708":""),o.appendChild(i),D[0]=n.firstDate.year&&(l.date=a.max.date),n.limit(lay(i),l,t)}),lay(d[v?0:1]).attr("lay-ym",D[0]+"-"+D[1]).html(D[0]+T);else if("time"===e){var M=function(){lay(o).find("ol").each(function(e,a){lay(a).find("li").each(function(a,i){n.limit(lay(i),[{hours:a},{hours:n[E].hours,minutes:a},{hours:n[E].hours,minutes:n[E].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(lay(n.footer).find(f),n[E],0,["hours","minutes","seconds"])};a.range?n[E]||(n[E]="startTime"===E?i:n.endDate):n[E]=i,lay.each([24,60,60],function(e,t){var a=lay.elem("li"),i=["

        "+r.time[e]+"

          "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",o.appendChild(a)}),M()}if(h&&m.removeChild(h),m.appendChild(o),"year"===e||"month"===e)lay(n.elemMain[t]).addClass("laydate-ym-show"),lay(o).find("li").on("click",function(){var r=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(c)){0===t?(i[e]=r,n.limit(lay(n.footer).find(f),null,0)):n.endDate[e]=r;var y="year"===a.type||"month"===a.type;y?(lay(o).find("."+s).removeClass(s),lay(this).addClass(s),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(t?i.year=r:n.endDate.year=r),n.list("month",t))):(n.checkDate("limit").calendar(null,t),n.closeList()),n.setBtnStatus(),a.range||("month"===a.type&&"month"===e||"year"===a.type&&"year"===e)&&n.setValue(n.parse()).remove().done(),n.done(null,"change"),lay(n.footer).find("."+g).removeClass(c)}});else{var C=lay.elem("span",{"class":p}),S=function(){lay(o).find("ol").each(function(e){var t=this,a=lay(t).find("li");t.scrollTop=30*(n[E][w[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!lay(this).hasClass(c))return t.scrollTop=30*(e-2),!0})})},I=lay(y[2]).find("."+p);S(),C.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,lay(n.elemMain[t]).addClass("laydate-time-show"),I[0]&&I.remove(),y[2].appendChild(C),lay(o).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var r=0|this.innerHTML;lay(this).hasClass(c)||(a.range?n[E][w[e]]=r:i[w[e]]=r,lay(t).find("."+s).removeClass(s),lay(this).addClass(s),M(),S(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,n){lay(this).find("."+u).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+p).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,l=i.lang(),o=lay(i.footer).find(f);r.range&&"time"!==r.type&&(t=t||r.dateTime,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(c):o[a?"addClass":"removeClass"](c),e&&a&&i.hint("string"==typeof e?l.timeout.replace(/\u65e5\u671f/g,e):l.timeout))},T.prototype.parse=function(e,t){var n=this,a=n.config,r=t||("end"==e?lay.extend({},n.endDate,n.endTime):a.range?lay.extend({},a.dateTime,n.startTime):a.dateTime),l=i.parse(r,n.format,1);return a.range&&void 0===e?l+" "+n.rangeStr+" "+n.parse("end"):l},T.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0];return"static"===n.position?t:(e=e||"",t.isInput(a)?lay(a).val(e):t.rangeElem?(t.rangeElem[0].val(e?t.parse("start"):""),t.rangeElem[1].val(e?t.parse("end"):"")):(0===lay(a).find("*").length&&lay(a).html(e),lay(a).attr("lay-date",e)),t)},T.prototype.preview=function(){var e=this,t=e.config;if(t.isPreview){var n=lay(e.elem).find("."+v),a=t.range?e.endDate?e.parse():"":e.parse();n.html(a).css({color:"#5FB878","font-size":"14px;"}),setTimeout(function(){n.css({color:"#666","font-size":"12px;"})},300)}},T.prototype.done=function(e,t){var n=this,a=n.config,i=lay.extend({},lay.extend(a.dateTime,n.startTime)),r=lay.extend({},lay.extend(n.endDate,n.endTime));return lay.each([i,r],function(e,t){"month"in t&&lay.extend(t,{month:t.month+1})}),n.preview(),e=e||[n.parse(),i,r],"function"==typeof a[t||"done"]&&a[t||"done"].apply(a,e),n},T.prototype.choose=function(e,t){var n=this,a=n.config,i=n.thisDateTime(t),r=(lay(n.elem).find("td"),e.attr("lay-ymd").split("-"));r={year:0|r[0],month:(0|r[1])-1,date:0|r[2]},e.hasClass(c)||(lay.extend(i,r),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"))},T.prototype.tool=function(e,t){var n=this,a=n.config,i=n.lang(),r=a.dateTime,l="static"===a.position,o={datetime:function(){lay(e).hasClass(c)||(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(){l&&(lay.extend(r,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(r,n.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),n.setValue(n.parse()).remove(),l&&n.calendar(),n.done()},confirm:function(){if(a.range){if(lay(e).hasClass(c))return n.hint("time"===a.type?i.timeout.replace(/\u65e5\u671f/g,"\u65f6\u95f4"):i.timeout)}else if(lay(e).hasClass(c))return n.hint(i.invalidDate);n.done(),n.setValue(n.parse()).remove()}};o[t]&&o[t]()},T.prototype.change=function(e){var t=this,n=t.config,a=t.thisDateTime(e),i=n.range&&("year"===n.type||"month"===n.type),r=t.elemCont[e||0],l=t.listYM[e],o=function(o){var s=lay(r).find(".laydate-year-list")[0],c=lay(r).find(".laydate-month-list")[0];return s&&(l[0]=o?l[0]-15:l[0]+15,t.list("year",e)),c&&(o?l[0]--:l[0]++,t.list("month",e)),(s||c)&&(lay.extend(a,{year:l[0]}),i&&(a.year=l[0]),n.range||t.done(null,"change"),n.range||t.limit(lay(t.footer).find(f),{year:l[0]})),t.setBtnStatus(),s||c};return{prevYear:function(){o("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(){o()||(a.year++,t.checkDate("limit").calendar(null,e),t.done(null,"change"))}}},T.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),i=a.attr("lay-ym"),r=a.attr("lay-type");i&&(i=i.split("-"),e.listYM[t]=[0|i[0],0|i[1]],e.list(r,t),lay(e.footer).find("."+g).addClass(c))}),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)})},T.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())},T.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)},r.that={},r.getThis=function(e){var t=r.that[e];return t||hint.error(e?l+" instance with ID '"+e+"' not found":"ID argument required"),t},n.run=function(t){t(document).on("mousedown",function(e){if(i.thisId){var n=r.getThis(i.thisId);if(n){var a=n.config;e.target!==a.elem[0]&&e.target!==a.eventElem[0]&&e.target!==t(a.closeStop)[0]&&n.remove()}}}).on("keydown",function(e){if(i.thisId){var n=r.getThis(i.thisId);n&&13===e.keyCode&&t("#"+n.elemID)[0]&&n.elemID===T.thisElemDate&&(e.preventDefault(),t(n.footer).find(f)[0].click())}}),t(e).on("resize",function(){if(i.thisId){var e=r.getThis(i.thisId);if(e)return!(!e.elem||!t(o)[0])&&void e.position()}})},i.render=function(e){var t=new T(e);return r.call(t)},i.parse=function(e,t,n){return e=e||{},"string"==typeof t&&(t=r.formatArr(t)),t=(t||[]).concat(),lay.each(t,function(a,i){/yyyy|y/.test(i)?t[a]=lay.digit(e.year,i.length):/MM|M/.test(i)?t[a]=lay.digit(e.month+(n||0),i.length):/dd|d/.test(i)?t[a]=lay.digit(e.date,i.length):/HH|H/.test(i)?t[a]=lay.digit(e.hours,i.length):/mm|m/.test(i)?t[a]=lay.digit(e.minutes,i.length):/ss|s/.test(i)&&(t[a]=lay.digit(e.seconds,i.length))}),t.join("")},i.getEndDate=function(e,t){var n=new Date;return n.setFullYear(t||n.getFullYear(),e||n.getMonth()+1,1),new Date(n.getTime()-864e5).getDate()},t?(i.ready(),layui.define("lay",function(e){i.path=layui.cache.dir,n.run(lay),e(l,i)})):"function"==typeof define&&define.amd?define(function(){return n.run(lay),i}):function(){i.ready(),n.run(e.lay),e.laydate=i}()}(window); \ No newline at end of file diff --git a/dist/theme/default/laydate.css b/dist/theme/default/laydate.css index 8a596ec..507b007 100644 --- a/dist/theme/default/laydate.css +++ b/dist/theme/default/laydate.css @@ -1 +1 @@ -.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;animation-name:laydate-downbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@keyframes laydate-downbit{0%{opacity:.3;transform:translate3d(0,-5px,0)}100%{opacity:1;transform:translate3d(0,0,0)}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content,.layui-laydate-range .laydate-main-list-1 .layui-laydate-header{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#B5FFF8}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eee;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} \ No newline at end of file +.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}@font-face{font-family:laydate-icon;src:url(font/iconfont.eot);src:url(font/iconfont.eot#iefix) format('embedded-opentype'),url(font/iconfont.svg#iconfont) format('svg'),url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype')}.laydate-icon{font-family:laydate-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;animation-name:laydate-downbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@keyframes laydate-downbit{0%{opacity:.3;transform:translate3d(0,-5px,0)}100%{opacity:1;transform:translate3d(0,0,0)}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;padding:0 5px;color:#999;font-size:18px;cursor:pointer}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-set-ym span{padding:0 10px;cursor:pointer}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px}.layui-laydate-footer span{display:inline-block;vertical-align:top;height:26px;line-height:24px;padding:0 10px;border:1px solid #C9C9C9;border-radius:2px;background-color:#fff;font-size:12px;cursor:pointer;white-space:nowrap;transition:all .3s}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-footer span:hover{color:#5FB878}.layui-laydate-footer span.layui-laydate-preview{cursor:default;border-color:transparent!important}.layui-laydate-footer span.layui-laydate-preview:hover{color:#666}.layui-laydate-footer span:first-child.layui-laydate-preview{padding-left:0}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{margin:0 0 0 -1px}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;height:30px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content,.layui-laydate-range .laydate-main-list-1 .layui-laydate-header{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#B5FFF8}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eee;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 2aa825d..e39b8da 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,6 +1,7 @@ -/** - layDate构建 -*/ + +/*! + * laydate build + */ var pkg = require('./package.json'); @@ -23,7 +24,11 @@ var task = { })) .pipe(gulp.dest('./dist')); - return gulp.src('./src/laydate.js').pipe(uglify()) + return gulp.src('./src/laydate.js').pipe(uglify({ + output: { + ascii_only: true //escape Unicode characters in strings and regexps + } + })) .pipe(header('/*! <%= pkg.realname %> v<%= pkg.version %> | <%= pkg.description %> | The <%= pkg.license %> License */\n ;', {pkg: pkg})) .pipe(gulp.dest('./dist')); diff --git a/package.json b/package.json index 59749e9..d41587f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "layui-laydate", "realname": "layDate", - "version": "5.2.1", + "version": "5.3.0", "description": "日期与时间组件", "main": "src/laydate.js", "license": "MIT", diff --git a/src/laydate.js b/src/laydate.js index 88cd4f7..1c57735 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,9 +1,11 @@ -/** - @Name:layDate 日期与时间组件 - @License: MIT + +/*! + * layDate 日期与时间组件 + * MIT Licensed */ -/** lay 基础 DOM 操作 */ + +/*! lay 基础 DOM 操作 */ ;!function(){ "use strict"; @@ -60,7 +62,7 @@ }; //lay 模块版本 - lay.v = '1.0.0'; + lay.v = '1.0.6'; //ie版本 lay.ie = function(){ @@ -323,7 +325,7 @@ ,isObject = typeof selector === 'object'; this.each(function(i, item){ - var nativeDOM = isObject ? [selector] : item.querySelectorAll(selector || null); + var nativeDOM = isObject ? item.contains(selector) : item.querySelectorAll(selector || null); for(; index < nativeDOM.length; index++){ arr.push(nativeDOM[index]); } @@ -433,6 +435,7 @@ //设置或获取值 LAY.prototype.val = function(value){ + var that = this; return value === undefined ? function(){ if(that.length > 0) return that[0].value; }() : this.each(function(index, item){ @@ -487,7 +490,11 @@ }(); -/** layDate 日期与时间控件 */ + +/*! + * layDate 日期与时间控件 + * MIT Licensed + */ ;!function(window){ "use strict"; @@ -507,12 +514,16 @@ } } } - + + //识别预先可能定义的指定全局对象 + ,GLOBAL = window.LAYUI_GLOBAL || {} + + //外部调用 ,laydate = { - v: '5.2.1' + v: '5.3.0' ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 - ,path: ready.getPath + ,path: GLOBAL.laydate_dir || ready.getPath //设置全局项 ,set: function(options){ @@ -531,8 +542,13 @@ } //操作当前实例 - ,thisDate = function(){ - var that = this; + ,thisModule = function(){ + var that = this + ,options = that.config + ,id = options.id; + + thisModule.that[id] = that; //记录当前实例对象 + return { //提示框 hint: function(content){ @@ -545,18 +561,32 @@ //字符常量 ,MOD_NAME = 'laydate', ELEM = '.layui-laydate', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'laydate-disabled', LIMIT_YEAR = [100, 200000] - ,ELEM_STATIC = 'layui-laydate-static', ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = '.laydate-btns-time' + ,ELEM_STATIC = 'layui-laydate-static', ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = 'laydate-btns-time', ELEM_PREVIEW = 'layui-laydate-preview' //组件构造器 ,Class = function(options){ var that = this; that.index = ++laydate.index; that.config = lay.extend({}, that.config, laydate.config, options); + + //初始化 id 参数 + options = that.config; + options.id = ('id' in options) ? options.id : that.index; + + //初始化 laydate.ready(function(){ that.init(); }); } + //日期格式字符 + ,dateType = 'yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s'; + + //将日期格式字符转换为数组 + thisModule.formatArr = function(format){ + return (format || '').match(new RegExp(dateType + '|.', 'g')) || [] + }; + /* 组件操作 */ @@ -578,6 +608,7 @@ ,trigger: 'click' //呼出控件的事件 ,show: false //是否直接显示,如果设置 true,则默认直接显示控件 ,showBottom: true //是否显示底部栏 + ,isPreview: true //是否显示值预览 ,btns: ['clear', 'now', 'confirm'] //右下角显示的按钮,会按照数组顺序排列 ,lang: 'cn' //语言,只支持cn/en,即中文和英文 ,theme: 'default' //主题 @@ -610,6 +641,7 @@ ,timeout: '结束时间不能早于开始时间
        请重新选择' ,invalidDate: '不在有效日期或时间范围内' ,formatError: ['日期格式不合法
        必须遵循下述格式:
        ', '
        已为你重置'] + ,preview: '当前选中的结果' } ,en: { weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] @@ -627,6 +659,7 @@ ,timeout: 'End time cannot be less than start Time
        Please re-select' ,invalidDate: 'Invalid date' ,formatError: ['The date format error
        Must be followed:
        ', '
        It has been reset'] + ,preview: 'The selected result' } }; return text[options.lang] || text['cn']; @@ -636,7 +669,6 @@ Class.prototype.init = function(){ var that = this ,options = that.config - ,dateType = 'yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s' ,isStatic = options.position === 'static' ,format = { year: 'yyyy' @@ -652,7 +684,15 @@ if(!options.elem[0]) return; //日期范围分隔符 - if(options.range === true) options.range = '-'; + that.rangeStr = options.range ? (typeof options.range === 'string' ? options.range : '-') : ''; + + //若 range 参数为数组,则表示为开始日期和结束日期的 input 对象 + if(options.range && options.range.constructor === Array){ + that.rangeElem = [ + lay(options.range[0]), + lay(options.range[1]) + ]; + } //若 type 设置非法,则初始化为 date 类型 if(!format[options.type]){ @@ -661,15 +701,12 @@ } //根据不同 type,初始化默认 format - if(options.format === format.date){ options.format = format[options.type] || format.date; - } - //将日期格式转化成数组 - that.format = options.format.match(new RegExp(dateType + '|.', 'g')) || []; + that.format = thisModule.formatArr(options.format); //生成正则表达式 that.EXP_IF = ''; @@ -689,9 +726,11 @@ that.EXP_IF = that.EXP_IF + EXP; that.EXP_SPLIT = that.EXP_SPLIT + '(' + EXP + ')'; }); + //验证日期格式正则 + that.EXP_IF_ONE = new RegExp('^'+ that.EXP_IF +'$'); //验证单个日期格式 that.EXP_IF = new RegExp('^'+ ( options.range ? - that.EXP_IF + '\\s\\'+ options.range + '\\s' + that.EXP_IF + that.EXP_IF + '\\s\\'+ that.rangeStr + '\\s' + that.EXP_IF : that.EXP_IF ) +'$'); that.EXP_SPLIT = new RegExp('^'+ that.EXP_SPLIT +'$', ''); @@ -731,10 +770,10 @@ if(typeof options[item] === 'number'){ //如果为数字 var day = options[item] ,time = new Date().getTime() - ,STAMP = 86400000 //代表一天的时间戳 + ,STAMP = 86400000 //代表一天的毫秒数 ,thisDate = new Date( day ? ( - day < STAMP ? time + day*STAMP : day //如果数字小于一天的时间戳,则数字为天数,否则为时间戳 + day < STAMP ? time + day*STAMP : day //如果数字小于一天的毫秒数,则数字为天数,否则为毫秒数 ) : time ); ymd = [thisDate.getFullYear(), thisDate.getMonth() + 1, thisDate.getDate()]; @@ -888,8 +927,12 @@ lay(divFooter).html(function(){ var html = [], btns = []; if(options.type === 'datetime'){ - html.push(''+ lang.timeTips +''); + html.push(''+ lang.timeTips +''); + } + if(!(!options.range && options.type === 'datetime')){ + html.push('') } + lay.each(options.btns, function(i, item){ var title = lang.tools[item] || 'btn'; if(options.range && item === 'now') return; @@ -925,6 +968,9 @@ elem.appendChild(style); } + //记录当前执行的实例索引 + laydate.thisId = options.id; + //移除上一个控件 that.remove(Class.thisElemDate); @@ -942,6 +988,8 @@ typeof options.ready === 'function' && options.ready(lay.extend({}, options.dateTime, { month: options.dateTime.month + 1 })); + + that.preview(); }; //控件移除 @@ -954,7 +1002,8 @@ if(!elem.hasClass(ELEM_STATIC)){ that.checkDate(function(){ elem.remove(); - delete that.endDate; + //delete options.dateTime; + //delete that.endDate; }); } return that; @@ -1028,7 +1077,16 @@ ,elem = that.bindElem || options.elem[0] ,valType = that.isInput(elem) ? 'val' : 'html' - ,value = that.isInput(elem) ? elem.value : (options.position === 'static' ? '' : elem.innerHTML) + ,value = function(){ + //如果传入了开始和结束日期的 input 对象,则将其拼接为日期范围字符 + if(that.rangeElem){ + var vals = [that.rangeElem[0].val(), that.rangeElem[1].val()]; + if(vals[0] && vals[1]){ + return vals.join(' ' + that.rangeStr + ' '); + } + } + return that.isInput(elem) ? elem.value : (options.position === 'static' ? '' : lay(elem).attr('lay-date')); + }() //校验日期有效数字 ,checkValid = function(dateTime){ @@ -1048,6 +1106,7 @@ var startEnd = ['startTime', 'endTime']; value = (value.match(that.EXP_SPLIT) || []).slice(1); index = index || 0; + if(options.range){ that[startEnd[index]] = that[startEnd[index]] || {}; } @@ -1077,7 +1136,7 @@ options.range && (that[startEnd[index]].seconds = thisv); } }); - checkValid(dateTime) + checkValid(dateTime); }; if(fn === 'limit') return checkValid(dateTime), that; @@ -1086,56 +1145,106 @@ if(typeof value === 'string'){ value = value.replace(/\s+/g, ' ').replace(/^\s|\s$/g, ''); } - - //如果开启范围 - if(options.range){ - that.endDate = that.endDate || lay.extend({}, dateTime, function(){ - var obj = {} - ,EYM = that.getAsYM(dateTime.year, dateTime.month); - - if(options.type === 'year'){ - obj.year = dateTime.year + 1; - } else if(options.type !== 'time'){ - obj.year = EYM[0]; - obj.month = EYM[1]; - } - return obj; - }()); - } + + //如果开启范围,则计算结束日期 + var getEndDate = function(){ + if(options.range){ + that.endDate = that.endDate || lay.extend({}, options.dateTime, function(){ + var obj = {} + ,dateTime = options.dateTime + ,EYM = that.getAsYM(dateTime.year, dateTime.month); + + //初始右侧面板的年月 + if(options.type === 'year'){ + obj.year = dateTime.year + 1; + } else if(options.type !== 'time'){ + obj.year = EYM[0]; + obj.month = EYM[1]; + } + + //初始右侧面板的时间 + if(options.type === 'datetime' || options.type === 'time'){ + obj.hours = 23; + obj.minutes = obj.seconds = 59; + } + + return obj; + }()); + } + }; + getEndDate(); if(typeof value === 'string' && value){ if(that.EXP_IF.test(value)){ //校验日期格式 if(options.range){ - value = value.split(' '+ options.range +' '); - + value = value.split(' '+ that.rangeStr +' '); lay.each([options.dateTime, that.endDate], function(i, item){ initDate(item, value[i], i); }); } else { - initDate(dateTime, value) + initDate(dateTime, value); } } else { + //格式不合法 that.hint(lang.formatError[0] + ( - options.range ? (options.format + ' '+ options.range +' ' + options.format) : options.format + options.range ? (options.format + ' '+ that.rangeStr +' ' + options.format) : options.format ) + lang.formatError[1]); error = true; } } else if(value && value.constructor === Date){ //如果值为日期对象时 options.dateTime = that.systemDate(value); } else { + //重置开始日期 options.dateTime = that.systemDate(); - delete that.startTime; + + //重置结束日期 + delete that.endDate; //删除原有的结束日期 + getEndDate(); //并重新获得新的结束日期 delete that.endTime; } - + + //从日期范围表单中获取初始值 + (function(){ + if(that.rangeElem){ + var vals = [that.rangeElem[0].val(), that.rangeElem[1].val()] + ,arrDate = [options.dateTime, that.endDate]; + lay.each(vals, function(_i, _v){ + if(that.EXP_IF_ONE.test(_v)){ //校验日期格式 + initDate(arrDate[_i], _v, _i); + } + }); + } + })(); + + //校验日期有效数字 checkValid(dateTime); - + if(options.range) checkValid(that.endDate); + + //如果初始值格式错误,则纠正初始值 if(error && value){ that.setValue( options.range ? (that.endDate ? that.parse() : '') : that.parse() ); } + + //如果当前日期不在设定的最大小日期区间,则自动纠正在可选区域 + var getDateTime = function(obj){ + return that.newDate(obj).getTime(); + }; + + //校验主面板是否在可选日期区间 + if(getDateTime(dateTime) > getDateTime(options.max) || getDateTime(dateTime) < getDateTime(options.min)){ + dateTime = options.dateTime = lay.extend({}, options.min); + } + + //校验右侧面板是否在可选日期区间 + if(options.range){ + if(getDateTime(that.endDate) < getDateTime(options.min) || getDateTime(that.endDate) > getDateTime(options.max)){ + that.endDate = lay.extend({}, options.max); + } + } + fn && fn(); return that; }; @@ -1163,6 +1272,7 @@ ,options = that.config, timestrap = {} ,dateTime = options[index > 41 ? 'endDate' : 'dateTime'] ,isOut, thisDateTime = lay.extend({}, dateTime, date || {}); + lay.each({ now: thisDateTime ,min: options.min @@ -1253,8 +1363,8 @@ lay(elemYM[1]).attr('lay-ym', dateTime.year + '-' + (dateTime.month + 1)); if(options.lang === 'cn'){ - lay(elemYM[0]).attr('lay-type', 'year').html(dateTime.year + '年') - lay(elemYM[1]).attr('lay-type', 'month').html((dateTime.month + 1) + '月'); + lay(elemYM[0]).attr('lay-type', 'year').html(dateTime.year + ' 年') + lay(elemYM[1]).attr('lay-type', 'month').html((dateTime.month + 1) + ' 月'); } else { lay(elemYM[0]).attr('lay-type', 'month').html(lang.month[dateTime.month]); lay(elemYM[1]).attr('lay-type', 'year').html(dateTime.year); @@ -1293,7 +1403,6 @@ //同步按钮可点状态 that.setBtnStatus(); - that.stampRange(index, tds); //标记范围内的日期 return that; }; @@ -1326,7 +1435,8 @@ if(listYM[0] < 1) listYM[0] = 1; - if(type === 'year'){ //年列表 + //生成年列表 + if(type === 'year'){ var yearNum, startY = yearNum = listYM[0] - 7; if(startY < 1) startY = yearNum = 1; lay.each(new Array(15), function(i){ @@ -1348,7 +1458,10 @@ }); lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', (yearNum - 8) + '-' + listYM[1]) .html((startY + text) + ' - ' + (yearNum - 1 + text)); - } else if(type === 'month'){ //月列表 + } + + //生成月列表 + else if(type === 'month'){ lay.each(new Array(12), function(i){ var li = lay.elem('li', { 'lay-ym': i @@ -1365,7 +1478,10 @@ }); lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', listYM[0] + '-' + listYM[1]) .html(listYM[0] + text); - } else if(type === 'time'){ //时间列表 + } + + //生成时间列表 + else if(type === 'time'){ //检测时分秒状态是否在有效日期时间范围内 var setTimeStatus = function(){ lay(ul).find('ol').each(function(i, ol){ @@ -1384,15 +1500,17 @@ }); if(!options.range) that.limit(lay(that.footer).find(ELEM_CONFIRM), that[startEnd], 0, ['hours', 'minutes', 'seconds']); }; + + //初始化时间对象 if(options.range){ - if(!that[startEnd]) that[startEnd] = { - hours: 0 - ,minutes: 0 - ,seconds: 0 - }; + if(!that[startEnd]){ + that[startEnd] = startEnd === 'startTime' ? dateTime : that.endDate; + } } else { that[startEnd] = dateTime; } + + //生成时分秒 lay.each([24, 60, 60], function(i, item){ var li = lay.elem('li'), childUL = ['

        '+ lang.time[i] +'

          ']; lay.each(new Array(item), function(ii){ @@ -1408,7 +1526,7 @@ if(haveList) elemCont.removeChild(haveList); elemCont.appendChild(ul); - //年月 + //年月面板 - 选择事件 if(type === 'year' || type === 'month'){ //显示切换箭头 lay(that.elemMain[index]).addClass('laydate-ym-show'); @@ -1449,20 +1567,26 @@ } that.setBtnStatus(); //同步按钮可点状态 - //如果非范围选择,则选中即自动关闭选择器 + + //若为月选择器,只有当选择月份时才自动关闭; + //若为年选择器,选择年份即自动关闭 + //且在范围未开启时 if(!options.range){ - //若为月选择器,只有当选择月份时才自动关闭;若为年选择器,选择年份即自动关闭 if((options.type === 'month' && type === 'month') || (options.type === 'year' && type === 'year')){ that.setValue(that.parse()).remove().done(); } - that.done(null, 'change'); } - lay(that.footer).find(ELEM_TIME_BTN).removeClass(DISABLED); + + that.done(null, 'change'); + lay(that.footer).find('.'+ ELEM_TIME_BTN).removeClass(DISABLED); }); - } else { + } else { //时间选择面板 - 选择事件 var span = lay.elem('span', { 'class': ELEM_TIME_TEXT - }), scroll = function(){ //滚动条定位 + }) + + //滚动条定位 + ,scroll = function(){ lay(ul).find('ol').each(function(i){ var ol = this ,li = lay(ol).find('li') @@ -1476,10 +1600,13 @@ }); } }); - }, haveSpan = lay(elemHeader[2]).find('.'+ ELEM_TIME_TEXT); - scroll() - span.innerHTML = options.range ? [lang.startTime,lang.endTime][index] : lang.timeTips + } + ,haveSpan = lay(elemHeader[2]).find('.'+ ELEM_TIME_TEXT); + + scroll(); + span.innerHTML = options.range ? [lang.startTime,lang.endTime][index] : lang.timeTips; lay(that.elemMain[index]).addClass('laydate-time-show'); + if(haveSpan[0]) haveSpan.remove(); elemHeader[2].appendChild(span); @@ -1489,6 +1616,7 @@ lay(ol).find('li').on('click', function(){ var value = this.innerHTML | 0; if(lay(this).hasClass(DISABLED)) return; + if(options.range){ that[startEnd][hms[i]] = value; } else { @@ -1552,34 +1680,17 @@ Class.prototype.parse = function(state, date){ var that = this ,options = that.config - ,dateTime = date || (state + ,dateTime = date || (state == 'end' ? lay.extend({}, that.endDate, that.endTime) : (options.range ? lay.extend({}, options.dateTime, that.startTime) : options.dateTime)) - ,format = that.format.concat(); - - //转义为规定格式 - lay.each(format, function(i, item){ - if(/yyyy|y/.test(item)){ //年 - format[i] = lay.digit(dateTime.year, item.length); - } else if(/MM|M/.test(item)){ //月 - format[i] = lay.digit(dateTime.month + 1, item.length); - } else if(/dd|d/.test(item)){ //日 - format[i] = lay.digit(dateTime.date, item.length); - } else if(/HH|H/.test(item)){ //时 - format[i] = lay.digit(dateTime.hours, item.length); - } else if(/mm|m/.test(item)){ //分 - format[i] = lay.digit(dateTime.minutes, item.length); - } else if(/ss|s/.test(item)){ //秒 - format[i] = lay.digit(dateTime.seconds, item.length); - } - }); + ,format = laydate.parse(dateTime, that.format, 1); //返回日期范围字符 - if(options.range && !state){ - return format.join('') + ' '+ options.range +' ' + that.parse(1); + if(options.range && state === undefined){ + return format + ' '+ that.rangeStr +' ' + that.parse('end'); } - return format.join(''); + return format; }; //创建指定日期时间对象 @@ -1599,94 +1710,53 @@ Class.prototype.setValue = function(value){ var that = this ,options = that.config - ,elem = that.bindElem || options.elem[0] - ,valType = that.isInput(elem) ? 'val' : 'html' + ,elem = that.bindElem || options.elem[0]; - options.position === 'static' || lay(elem)[valType](value || ''); - return this; - }; - - //标记范围内的日期 - Class.prototype.stampRange = function(index, tds){ - var that = this - ,options = that.config - ,startTime, endTime; - - if(!options.range) return; - - startTime = that.newDate(options.dateTime).getTime(); - endTime = that.newDate(that.endDate).getTime(); - - //标记范围样式 - lay.each(tds, function(i, item){ - var ymd = lay(item).attr('lay-ymd').split('-') - ,thisTime = that.newDate({ - year: ymd[0] - ,month: ymd[1] - 1 - ,date: ymd[2] - }).getTime(); - - if(index == 0){ - if(thisTime > startTime){ - lay(item).addClass(ELEM_SELECTED); - } + //静态展现则不作默认赋值 + if(options.position === 'static') return that; + + value = value || ''; + + //绑定的元素是否为 input + if(that.isInput(elem)){ + lay(elem).val(value); + } else { + //如果 range 传入了开始和结束的 input 对象,则分别对其赋值 + if(that.rangeElem){ + that.rangeElem[0].val(value ? that.parse('start') : ''); + that.rangeElem[1].val(value ? that.parse('end') : ''); } else { - if(thisTime < endTime){ - lay(item).addClass(ELEM_SELECTED); + if(lay(elem).find('*').length === 0){ + lay(elem).html(value); } + lay(elem).attr('lay-date', value); } - - return; - if(thisTime === startTime || thisTime === endTime){ - lay(item).addClass( - lay(item).hasClass(ELEM_PREV) || lay(item).hasClass(ELEM_NEXT) - ? ELEM_SELECTED - : THIS - ); - } - if(thisTime > startTime && thisTime < endTime){ - lay(item).addClass(ELEM_SELECTED); - } - }); + } + + return that; + }; + + //预览 + Class.prototype.preview = function(){ + var that = this + ,options = that.config; - return; + if(!options.isPreview) return; - if(options.range && !that.endDate) lay(that.footer).find(ELEM_CONFIRM).addClass(DISABLED); - if(!that.endDate) return; - - startTime = that.newDate({ - year: that.startDate.year - ,month: that.startDate.month - ,date: that.startDate.date - }).getTime(); - - endTime = that.newDate({ - year: that.endDate.year - ,month: that.endDate.month - ,date: that.endDate.date - }).getTime(); - - if(startTime > endTime) return that.hint(TIPS_OUT); - - lay.each(tds, function(i, item){ - var ymd = lay(item).attr('lay-ymd').split('-') - ,thisTime = that.newDate({ - year: ymd[0] - ,month: ymd[1] - 1 - ,date: ymd[2] - }).getTime(); - lay(item).removeClass(ELEM_SELECTED + ' ' + THIS); - if(thisTime === startTime || thisTime === endTime){ - lay(item).addClass( - lay(item).hasClass(ELEM_PREV) || lay(item).hasClass(ELEM_NEXT) - ? ELEM_SELECTED - : THIS - ); - } - if(thisTime > startTime && thisTime < endTime){ - lay(item).addClass(ELEM_SELECTED); - } + var elemPreview = lay(that.elem).find('.'+ ELEM_PREVIEW) + ,value = options.range ? (that.endDate ? that.parse() : '') : that.parse(); + + //显示预览 + elemPreview.html(value).css({ + 'color': '#5FB878' + ,'font-size': '14px;' }); + setTimeout(function(){ + elemPreview.css({ + 'color': '#666' + ,'font-size': '12px;' + }); + }, 300); }; //执行 done/change 回调 @@ -1703,6 +1773,8 @@ }); }); + that.preview(); + param = param || [that.parse(), start, end]; typeof options[type || 'done'] === 'function' && options[type || 'done'].apply(options, param); @@ -1738,7 +1810,7 @@ ,seconds: 0 }; }); - that.calendar(null, index); + that.calendar(null, index).done(null, 'change'); } else if(options.position === 'static'){ //直接嵌套的选中 that.calendar().done().done(null, 'change'); //同时执行 done 和 change 回调 } else if(options.type === 'date'){ @@ -1772,16 +1844,17 @@ //清空、重置 ,clear: function(){ - that.setValue('').remove(); isStatic && ( lay.extend(dateTime, that.firstDate) ,that.calendar() ) options.range && ( - delete that.endDate + delete options.dateTime + ,delete that.endDate ,delete that.startTime ,delete that.endTime ); + that.setValue('').remove(); that.done(['', {}, {}]); } @@ -1858,7 +1931,7 @@ if(addSubYeay('sub')) return; dateTime.year--; that.checkDate('limit').calendar(null, index); - options.range || that.done(null, 'change'); + that.done(null, 'change'); } ,prevMonth: function(){ var YM = that.getAsYM(dateTime.year, dateTime.month, 'sub'); @@ -1867,7 +1940,7 @@ ,month: YM[1] }); that.checkDate('limit').calendar(null, index); - options.range || that.done(null, 'change'); + that.done(null, 'change'); } ,nextMonth: function(){ var YM = that.getAsYM(dateTime.year, dateTime.month); @@ -1876,13 +1949,13 @@ ,month: YM[1] }); that.checkDate('limit').calendar(null, index); - options.range || that.done(null, 'change'); + that.done(null, 'change'); } ,nextYear: function(){ if(addSubYeay()) return; dateTime.year++ that.checkDate('limit').calendar(null, index); - options.range || that.done(null, 'change'); + that.done(null, 'change'); } }; }; @@ -1895,6 +1968,8 @@ //日期选择事件 lay(that.elem).on('click', function(e){ lay.stope(e); + }).on('mousedown', function(e){ + lay.stope(e); }); //年月切换 @@ -1921,7 +1996,7 @@ that.listYM[i] = [layYM[0] | 0, layYM[1] | 0]; that.list(layType, i); - lay(that.footer).find(ELEM_TIME_BTN).addClass(DISABLED); + lay(that.footer).find('.'+ ELEM_TIME_BTN).addClass(DISABLED); }); //下一月 @@ -1973,15 +2048,42 @@ showEvent(options.elem, 'bind'); showEvent(options.eventElem); + options.elem[0].eventHandler = true; + }; + + //记录所有实例 + thisModule.that = {}; //记录所有实例对象 + + //获取当前实例对象 + thisModule.getThis = function(id){ + var that = thisModule.that[id]; + if(!that) hint.error(id ? (MOD_NAME +' instance with ID \''+ id +'\' not found') : 'ID argument required'); + return that; + }; + + //初始执行 + ready.run = function(lay){ //绑定关闭控件事件 - lay(document).on('click', function(e){ - if(e.target === options.elem[0] - || e.target === options.eventElem[0] - || e.target === lay(options.closeStop)[0]){ - return; - } + lay(document).on('mousedown', function(e){ + if(!laydate.thisId) return; + var that = thisModule.getThis(laydate.thisId); + if(!that) return; + + var options = that.config; + + if( + e.target === options.elem[0] || + e.target === options.eventElem[0] || + e.target === lay(options.closeStop)[0] + ) return; + that.remove(); + }).on('keydown', function(e){ + if(!laydate.thisId) return; + var that = thisModule.getThis(laydate.thisId); + if(!that) return; + if(e.keyCode === 13){ if(lay('#'+ that.elemID)[0] && that.elemID === Class.thisElemDate){ e.preventDefault(); @@ -1992,19 +2094,53 @@ //自适应定位 lay(window).on('resize', function(){ + if(!laydate.thisId) return; + var that = thisModule.getThis(laydate.thisId); + if(!that) return; + if(!that.elem || !lay(ELEM)[0]){ return false; } + that.position(); }); - - options.elem[0].eventHandler = true; }; //核心接口 laydate.render = function(options){ var inst = new Class(options); - return thisDate.call(inst); + return thisModule.call(inst); + }; + + //将指定对象转化为日期值 + laydate.parse = function(dateTime, format, one){ + dateTime = dateTime || {}; + + //如果 format 是字符型,则转换为数组格式 + if(typeof format === 'string'){ + format = thisModule.formatArr(format); + } + + format = (format || []).concat(); + + //转义为规定格式 + lay.each(format, function(i, item){ + if(/yyyy|y/.test(item)){ //年 + format[i] = lay.digit(dateTime.year, item.length); + } else if(/MM|M/.test(item)){ //月 + format[i] = lay.digit(dateTime.month + (one || 0), item.length); + } else if(/dd|d/.test(item)){ //日 + format[i] = lay.digit(dateTime.date, item.length); + } else if(/HH|H/.test(item)){ //时 + format[i] = lay.digit(dateTime.hours, item.length); + } else if(/mm|m/.test(item)){ //分 + format[i] = lay.digit(dateTime.minutes, item.length); + } else if(/ss|s/.test(item)){ //秒 + format[i] = lay.digit(dateTime.seconds, item.length); + } + }); + + return format.join(''); }; //得到某月的最后一天 @@ -2024,13 +2160,16 @@ laydate.ready() ,layui.define('lay', function(exports){ //layui 加载 laydate.path = layui.cache.dir; + ready.run(lay); exports(MOD_NAME, laydate); }) ) : ( - (typeof define === 'function' && define.amd) ? define(function(){ //requirejs加载 + (typeof define === 'function' && define.amd) ? define(function(){ //requirejs 加载 + ready.run(lay); return laydate; }) : function(){ //普通 script 标签加载 laydate.ready(); + ready.run(window.lay); window.laydate = laydate; }() ); diff --git a/src/theme/default/laydate.css b/src/theme/default/laydate.css index d6e8eef..63b4497 100644 --- a/src/theme/default/laydate.css +++ b/src/theme/default/laydate.css @@ -1,3 +1,20 @@ +/** 图标字体 **/ +@font-face {font-family: 'laydate-icon'; + src: url('./font/iconfont.eot'); + src: url('./font/iconfont.eot#iefix') format('embedded-opentype'), + url('./font/iconfont.svg#iconfont') format('svg'), + url('./font/iconfont.woff') format('woff'), + url('./font/iconfont.ttf') format('truetype'); +} + +.laydate-icon{ + font-family:"laydate-icon" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + /** @Name: laydata @@ -48,7 +65,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} .layui-laydate-header i.laydate-next-y{right: 15px;} .layui-laydate-header i.laydate-next-m{right: 45px;} .laydate-set-ym{width: 100%; text-align: center; box-sizing: border-box; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;} -.laydate-set-ym span{padding: 0 5px; cursor: pointer;} +.laydate-set-ym span{padding: 0 10px; cursor: pointer;} .laydate-time-text{cursor: default !important;} /* 主体结构 */ @@ -58,15 +75,18 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} .layui-laydate-content td{width: 36px; height: 30px; padding: 5px; text-align: center;} .layui-laydate-content th{font-weight: 400;} .layui-laydate-content td{position: relative; cursor: pointer;} -.laydate-day-mark{position: absolute; left: 0; top: 0; width: 100%; height: 100%; line-height: 30px; font-size: 12px; overflow: hidden;} +.laydate-day-mark{position: absolute; left: 0; top: 0; width: 100%; line-height: 30px; font-size: 12px; overflow: hidden;} .laydate-day-mark::after{position: absolute; content:''; right: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%;} /* 底部结构 */ -.layui-laydate-footer{position: relative; height: 46px; line-height: 26px; padding: 10px 20px;} -.layui-laydate-footer span{margin-right: 15px; display: inline-block; cursor: pointer; font-size: 12px;} +.layui-laydate-footer{position: relative; height: 46px; line-height: 26px; padding: 10px;} +.layui-laydate-footer span{display: inline-block; vertical-align: top; height: 26px; line-height: 24px; padding: 0 10px; border: 1px solid #C9C9C9; border-radius: 2px; background-color: #fff; font-size: 12px; cursor: pointer; white-space: nowrap; transition: all .3s;} .layui-laydate-footer span:hover{color: #5FB878;} +.layui-laydate-footer span.layui-laydate-preview{cursor: default; border-color: transparent !important;} +.layui-laydate-footer span.layui-laydate-preview:hover{color: #666;} +.layui-laydate-footer span:first-child.layui-laydate-preview{padding-left: 0;} .laydate-footer-btns{position: absolute; right: 10px; top: 10px;} -.laydate-footer-btns span{height: 26px; line-height: 26px; margin: 0 0 0 -1px; padding: 0 10px; border: 1px solid #C9C9C9; background-color: #fff; white-space: nowrap; vertical-align: top; border-radius: 2px;} +.laydate-footer-btns span{margin: 0 0 0 -1px;} /* 年月列表 */ .layui-laydate-list{position: absolute; left: 0; top: 0; width: 100%; height: 100%; padding: 10px; box-sizing: border-box; background-color: #fff;} @@ -77,7 +97,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} .laydate-time-list p{position: relative; top: -4px; line-height: 29px;} .laydate-time-list ol{height: 181px; overflow: hidden;} .laydate-time-list>li:hover ol{overflow-y: auto;} -.laydate-time-list ol li{width: 130%; padding-left: 33px; line-height: 30px; text-align: left; cursor: pointer;} +.laydate-time-list ol li{width: 130%; padding-left: 33px; height: 30px; line-height: 30px; text-align: left; cursor: pointer;} /* 提示 */ .layui-laydate-hint{position: absolute; top: 115px; left: 50%; width: 250px; margin-left: -125px; line-height: 20px; padding: 15px; text-align: center; font-size: 12px; color: #FF5722;} @@ -147,21 +167,3 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} .laydate-theme-grid .laydate-year-list>li{height: 43px; line-height: 43px;} .laydate-theme-grid .laydate-month-list>li{height: 71px; line-height: 71px;} - - -/** 图标字体 **/ -@font-face {font-family: 'laydate-icon'; - src: url('./font/iconfont.eot'); - src: url('./font/iconfont.eot#iefix') format('embedded-opentype'), - url('./font/iconfont.svg#iconfont') format('svg'), - url('./font/iconfont.woff') format('woff'), - url('./font/iconfont.ttf') format('truetype'); -} - -.laydate-icon{ - font-family:"laydate-icon" !important; - font-size: 16px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} \ No newline at end of file From f3ccfc871fe6d25b4147e85b8084bdd7474eab7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsin@users.noreply.github.com> Date: Fri, 21 May 2021 23:03:58 +0800 Subject: [PATCH 26/26] update --- dist/laydate.js | 5 +- gulpfile.js | 2 +- package.json | 2 +- src/laydate.js | 871 +++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 758 insertions(+), 122 deletions(-) diff --git a/dist/laydate.js b/dist/laydate.js index 2af9779..98a1e6a 100644 --- a/dist/laydate.js +++ b/dist/laydate.js @@ -1,2 +1,3 @@ -/*! layDate v5.3.0 | 日期与时间组件 | The MIT License */ - ;!function(){"use strict";var e="lay",t=window.document,n=function(e){return new a(e)},a=function(e){for(var n=0,a="object"==typeof e?[e]:(this.selector=e,t.querySelectorAll(e||null));n0;i--)if("interactive"===n[i].readyState){e=n[i].src;break}return e||n[a].src}();return e.substring(0,e.lastIndexOf("/")+1)},n.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},n.each=function(e,t){var n,a=this;if("function"!=typeof t)return a;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;n1e4/i?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(n.getStyle(r,"width"))?(e===c&&r.removeAttribute("lay-status"),r.getAttribute("lay-status")===c?setTimeout(d,i):a()):(r.setAttribute("lay-status",c),setTimeout(function(){d(c)},i)))}()},n.hasScrollbar=function(){return t.body.scrollHeight>(window.innerHeight||t.documentElement.clientHeight)},n.position=function(e,a,i){if(a){i=i||{},e!==t&&e!==n("body")[0]||(i.clickType="right");var r="right"===i.clickType?function(){var e=i.e||window.event||{};return{left:e.clientX,top:e.clientY,right:e.clientX,bottom:e.clientY}}():e.getBoundingClientRect(),l=a.offsetWidth,o=a.offsetHeight,s=function(e){return e=e?"scrollLeft":"scrollTop",t.body[e]|t.documentElement[e]},c=function(e){return t.documentElement[e?"clientWidth":"clientHeight"]},y=5,d=r.left,u=r.bottom;d+l+y>c("width")&&(d=c("width")-l-y),u+o+y>c()&&(r.top>o+y?u=r.top-o-2*y:"right"===i.clickType&&(u=c()-o-2*y,u<0&&(u=0)));var m=i.position;if(m&&(a.style.position=m),a.style.left=d+("fixed"===m?0:s(1))+"px",a.style.top=u+("fixed"===m?0:s())+"px",!n.hasScrollbar()){var h=a.getBoundingClientRect();!i.SYSTEM_RELOAD&&h.bottom+y>c()&&(i.SYSTEM_RELOAD=!0,setTimeout(function(){n.position(e,a,i)},50))}}},n.options=function(e,t){var a=n(e),i=t||"lay-options";try{return new Function("return "+(a.attr(i)||"{}"))()}catch(r){return hint.error("parseerror\uff1a"+r,"error"),{}}},n.isTopElem=function(e){var a=[t,n("body")[0]],i=!1;return n.each(a,function(t,n){if(n===e)return i=!0}),i},a.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){new RegExp("\\b"+n+"\\b").test(e)||(e=e+" "+n)}),e.replace(/^\s|\s$/,"")},a.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),n.each(t,function(t,n){var a=new RegExp("\\b"+n+"\\b");a.test(e)&&(e=e.replace(a,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},a.prototype.find=function(e){var t=this,a=0,i=[],r="object"==typeof e;return this.each(function(n,l){for(var o=r?l.contains(e):l.querySelectorAll(e||null);a0)return a[0].style[e]}():a.each(function(a,r){"object"==typeof e?n.each(e,function(e,t){r.style[e]=i(t)}):r.style[e]=i(t)})},a.prototype.width=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetWidth}():t.each(function(n,a){t.css("width",e)})},a.prototype.height=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetHeight}():t.each(function(n,a){t.css("height",e)})},a.prototype.attr=function(e,t){var n=this;return void 0===t?function(){if(n.length>0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},a.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},a.prototype.html=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].innerHTML}():this.each(function(t,n){n.innerHTML=e})},a.prototype.val=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].value}():this.each(function(t,n){n.value=e})},a.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},a.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},a.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},a.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},window.lay=n,window.layui&&layui.define&&layui.define(function(t){t(e,n)})}(),!function(e){"use strict";var t=e.layui&&layui.define,n={getPath:e.lay&&lay.getPath?lay.getPath():"",link:function(t,n,a){i.path&&e.lay&&lay.link&&lay.link(i.path+t,n,a)}},a=e.LAYUI_GLOBAL||{},i={v:"5.3.0",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:a.laydate_dir||n.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var a="laydate",r="",l=(t?"modules/laydate/":"theme/")+"default/laydate.css?v="+i.v+r;return t?layui.addcss(l,e,a):n.link(l,e,a),this}},r=function(){var e=this,t=e.config,n=t.id;return r.that[n]=e,{hint:function(t){e.hint.call(e,t)},config:e.config}},l="laydate",o=".layui-laydate",s="layui-this",c="laydate-disabled",y=[100,2e5],d="layui-laydate-static",u="layui-laydate-list",m="layui-laydate-hint",h="layui-laydate-footer",f=".laydate-btns-confirm",p="laydate-time-text",g="laydate-btns-time",v="layui-laydate-preview",T=function(e){var t=this;t.index=++i.index,t.config=lay.extend({},t.config,i.config,e),e=t.config,e.id="id"in e?e.id:t.index,i.ready(function(){t.init()})},D="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s";r.formatArr=function(e){return(e||"").match(new RegExp(D+"|.","g"))||[]},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"click",show:!1,showBottom:!0,isPreview:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"],time:["\u65f6","\u5206","\u79d2"],timeTips:"\u9009\u62e9\u65f6\u95f4",startTime:"\u5f00\u59cb\u65f6\u95f4",endTime:"\u7ed3\u675f\u65f6\u95f4",dateTips:"\u8fd4\u56de\u65e5\u671f",month:["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"],tools:{confirm:"\u786e\u5b9a",clear:"\u6e05\u7a7a",now:"\u73b0\u5728"},timeout:"\u7ed3\u675f\u65f6\u95f4\u4e0d\u80fd\u65e9\u4e8e\u5f00\u59cb\u65f6\u95f4
          \u8bf7\u91cd\u65b0\u9009\u62e9",invalidDate:"\u4e0d\u5728\u6709\u6548\u65e5\u671f\u6216\u65f6\u95f4\u8303\u56f4\u5185",formatError:["\u65e5\u671f\u683c\u5f0f\u4e0d\u5408\u6cd5
          \u5fc5\u987b\u9075\u5faa\u4e0b\u8ff0\u683c\u5f0f\uff1a
          ","
          \u5df2\u4e3a\u4f60\u91cd\u7f6e"],preview:"\u5f53\u524d\u9009\u4e2d\u7684\u7ed3\u679c"},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
          Please re-select",invalidDate:"Invalid date",formatError:["The date format error
          Must be followed\uff1a
          ","
          It has been reset"],preview:"The selected result"}};return n[t.lang]||n.cn},T.prototype.init=function(){var t=this,n=t.config,a="static"===n.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};n.elem=lay(n.elem),n.eventElem=lay(n.eventElem),n.elem[0]&&(t.rangeStr=n.range?"string"==typeof n.range?n.range:"-":"",n.range&&n.range.constructor===Array&&(t.rangeElem=[lay(n.range[0]),lay(n.range[1])]),i[n.type]||(e.console&&console.error&&console.error("laydate type error:'"+n.type+"' is not supported"),n.type="date"),n.format===i.date&&(n.format=i[n.type]||i.date),t.format=r.formatArr(n.format),t.EXP_IF="",t.EXP_SPLIT="",lay.each(t.format,function(e,n){var a=new RegExp(D).test(n)?"\\d{"+function(){return new RegExp(D).test(t.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;t.EXP_IF=t.EXP_IF+a,t.EXP_SPLIT=t.EXP_SPLIT+"("+a+")"}),t.EXP_IF_ONE=new RegExp("^"+t.EXP_IF+"$"),t.EXP_IF=new RegExp("^"+(n.range?t.EXP_IF+"\\s\\"+t.rangeStr+"\\s"+t.EXP_IF:t.EXP_IF)+"$"),t.EXP_SPLIT=new RegExp("^"+t.EXP_SPLIT+"$",""),t.isInput(n.elem[0])||"focus"===n.trigger&&(n.trigger="click"),n.elem.attr("lay-key")||(n.elem.attr("lay-key",t.index),n.eventElem.attr("lay-key",t.index)),n.mark=lay.extend({},n.calendar&&"cn"===n.lang?{"0-1-1":"\u5143\u65e6","0-2-14":"\u60c5\u4eba","0-3-8":"\u5987\u5973","0-3-12":"\u690d\u6811","0-4-1":"\u611a\u4eba","0-5-1":"\u52b3\u52a8","0-5-4":"\u9752\u5e74","0-6-1":"\u513f\u7ae5","0-9-10":"\u6559\u5e08","0-9-18":"\u56fd\u803b","0-10-1":"\u56fd\u5e86","0-12-25":"\u5723\u8bde"}:{},n.mark),lay.each(["min","max"],function(e,t){var a=[],i=[];if("number"==typeof n[t]){var r=n[t],l=(new Date).getTime(),o=864e5,s=new Date(r?r0)return!0;var a=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),n=lay.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],r=lay.elem("div",{"class":"layui-laydate-content"}),y=lay.elem("table"),d=lay.elem("thead"),u=lay.elem("tr");lay.each(i,function(e,t){a.appendChild(t)}),d.appendChild(u),lay.each(new Array(6),function(e){var t=y.insertRow(0);lay.each(new Array(7),function(a){if(0===e){var i=lay.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),y.insertBefore(d,y.children[0]),r.appendChild(y),l[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),l[e].appendChild(a),l[e].appendChild(r),o.push(i),s.push(r),c.push(y)}),lay(y).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),(t.range||"datetime"!==t.type)&&e.push(''),lay.each(t.btns,function(e,r){var l=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(l="cn"===t.lang?"\u91cd\u7f6e":"Reset"),i.push(''+l+""))}),e.push('"),e.join("")}()),lay.each(l,function(e,t){r.appendChild(t)}),t.showBottom&&r.appendChild(y),/^#/.test(t.theme)){var u=lay.elem("style"),m=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in u?(u.setAttribute("type","text/css"),u.styleSheet.cssText=m):u.innerHTML=m,lay(r).addClass("laydate-theme-molv"),r.appendChild(u)}i.thisId=t.id,e.remove(T.thisElemDate),a?t.elem.append(r):(document.body.appendChild(r),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(lay.extend({},t.dateTime,{month:t.dateTime.month+1})),e.preview()},T.prototype.remove=function(e){var t=this,n=(t.config,lay("#"+(e||t.elemID)));return n[0]?(n.hasClass(d)||t.checkDate(function(){n.remove()}),t):t},T.prototype.position=function(){var e=this,t=e.config;return lay.position(e.bindElem||t.elem[0],e.elem,{position:t.position}),e},T.prototype.hint=function(e){var t=this,n=(t.config,lay.elem("div",{"class":m}));t.elem&&(n.innerHTML=e||"",lay(t.elem).find("."+m).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+m).remove()},3e3))},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,n,a=this,r=(new Date,a.config),l=a.lang(),o=r.dateTime=r.dateTime||a.systemDate(),s=a.bindElem||r.elem[0],c=(a.isInput(s)?"val":"html",function(){if(a.rangeElem){var e=[a.rangeElem[0].val(),a.rangeElem[1].val()];if(e[0]&&e[1])return e.join(" "+a.rangeStr+" ")}return a.isInput(s)?s.value:"static"===r.position?"":lay(s).attr("lay-date")}()),d=function(e){e.year>y[1]&&(e.year=y[1],n=!0),e.month>11&&(e.month=11,n=!0),e.hours>23&&(e.hours=0,n=!0),e.minutes>59&&(e.minutes=0,e.hours++,n=!0),e.seconds>59&&(e.seconds=0,e.minutes++,n=!0),t=i.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,n=!0)},u=function(e,t,i){var l=["startTime","endTime"];t=(t.match(a.EXP_SPLIT)||[]).slice(1),i=i||0,r.range&&(a[l[i]]=a[l[i]]||{}),lay.each(a.format,function(o,s){var c=parseFloat(t[o]);t[o].lengthh(r.max)||h(o)h(r.max))&&(a.endDate=lay.extend({},r.max)),e&&e(),a},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return lay.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,l=r.config,o={},s=l[n>41?"endDate":"dateTime"],y=lay.extend({},s,t||{});return lay.each({now:y,min:l.min,max:l.max},function(e,t){o[e]=r.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](c),i},T.prototype.thisDateTime=function(e){var t=this,n=t.config;return e?t.endDate:n.dateTime},T.prototype.calendar=function(e,t,n){var a,r,l,o=this,c=o.config,t=t?1:0,d=e||o.thisDateTime(t),u=new Date,m=o.lang(),h="date"!==c.type&&"datetime"!==c.type,p=lay(o.table[t]).find("td"),g=lay(o.elemHeader[t][2]).find("span");return d.yeary[1]&&(d.year=y[1],o.hint(m.invalidDate)),o.firstDate||(o.firstDate=lay.extend({},d)),u.setFullYear(d.year,d.month,1),a=u.getDay(),r=i.getEndDate(d.month||12,d.year),l=i.getEndDate(d.month+1,d.year),lay.each(p,function(e,t){var n=[d.year,d.month],i=0;t=lay(t),t.removeAttr("class"),e=a&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(lay(i),r,t),x++}),lay(d[v?0:1]).attr("lay-ym",x-8+"-"+D[1]).html(b+T+" - "+(x-1+T))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),l={year:D[0],month:e};e+1==D[1]&&lay(i).addClass(s),i.innerHTML=r.month[e]+(v?"\u6708":""),o.appendChild(i),D[0]=n.firstDate.year&&(l.date=a.max.date),n.limit(lay(i),l,t)}),lay(d[v?0:1]).attr("lay-ym",D[0]+"-"+D[1]).html(D[0]+T);else if("time"===e){var M=function(){lay(o).find("ol").each(function(e,a){lay(a).find("li").each(function(a,i){n.limit(lay(i),[{hours:a},{hours:n[E].hours,minutes:a},{hours:n[E].hours,minutes:n[E].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(lay(n.footer).find(f),n[E],0,["hours","minutes","seconds"])};a.range?n[E]||(n[E]="startTime"===E?i:n.endDate):n[E]=i,lay.each([24,60,60],function(e,t){var a=lay.elem("li"),i=["

          "+r.time[e]+"

            "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),a.innerHTML=i.join("")+"
          ",o.appendChild(a)}),M()}if(h&&m.removeChild(h),m.appendChild(o),"year"===e||"month"===e)lay(n.elemMain[t]).addClass("laydate-ym-show"),lay(o).find("li").on("click",function(){var r=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(c)){0===t?(i[e]=r,n.limit(lay(n.footer).find(f),null,0)):n.endDate[e]=r;var y="year"===a.type||"month"===a.type;y?(lay(o).find("."+s).removeClass(s),lay(this).addClass(s),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(t?i.year=r:n.endDate.year=r),n.list("month",t))):(n.checkDate("limit").calendar(null,t),n.closeList()),n.setBtnStatus(),a.range||("month"===a.type&&"month"===e||"year"===a.type&&"year"===e)&&n.setValue(n.parse()).remove().done(),n.done(null,"change"),lay(n.footer).find("."+g).removeClass(c)}});else{var C=lay.elem("span",{"class":p}),S=function(){lay(o).find("ol").each(function(e){var t=this,a=lay(t).find("li");t.scrollTop=30*(n[E][w[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!lay(this).hasClass(c))return t.scrollTop=30*(e-2),!0})})},I=lay(y[2]).find("."+p);S(),C.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,lay(n.elemMain[t]).addClass("laydate-time-show"),I[0]&&I.remove(),y[2].appendChild(C),lay(o).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var r=0|this.innerHTML;lay(this).hasClass(c)||(a.range?n[E][w[e]]=r:i[w[e]]=r,lay(t).find("."+s).removeClass(s),lay(this).addClass(s),M(),S(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,n){lay(this).find("."+u).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+p).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,l=i.lang(),o=lay(i.footer).find(f);r.range&&"time"!==r.type&&(t=t||r.dateTime,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(c):o[a?"addClass":"removeClass"](c),e&&a&&i.hint("string"==typeof e?l.timeout.replace(/\u65e5\u671f/g,e):l.timeout))},T.prototype.parse=function(e,t){var n=this,a=n.config,r=t||("end"==e?lay.extend({},n.endDate,n.endTime):a.range?lay.extend({},a.dateTime,n.startTime):a.dateTime),l=i.parse(r,n.format,1);return a.range&&void 0===e?l+" "+n.rangeStr+" "+n.parse("end"):l},T.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0];return"static"===n.position?t:(e=e||"",t.isInput(a)?lay(a).val(e):t.rangeElem?(t.rangeElem[0].val(e?t.parse("start"):""),t.rangeElem[1].val(e?t.parse("end"):"")):(0===lay(a).find("*").length&&lay(a).html(e),lay(a).attr("lay-date",e)),t)},T.prototype.preview=function(){var e=this,t=e.config;if(t.isPreview){var n=lay(e.elem).find("."+v),a=t.range?e.endDate?e.parse():"":e.parse();n.html(a).css({color:"#5FB878","font-size":"14px;"}),setTimeout(function(){n.css({color:"#666","font-size":"12px;"})},300)}},T.prototype.done=function(e,t){var n=this,a=n.config,i=lay.extend({},lay.extend(a.dateTime,n.startTime)),r=lay.extend({},lay.extend(n.endDate,n.endTime));return lay.each([i,r],function(e,t){"month"in t&&lay.extend(t,{month:t.month+1})}),n.preview(),e=e||[n.parse(),i,r],"function"==typeof a[t||"done"]&&a[t||"done"].apply(a,e),n},T.prototype.choose=function(e,t){var n=this,a=n.config,i=n.thisDateTime(t),r=(lay(n.elem).find("td"),e.attr("lay-ymd").split("-"));r={year:0|r[0],month:(0|r[1])-1,date:0|r[2]},e.hasClass(c)||(lay.extend(i,r),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"))},T.prototype.tool=function(e,t){var n=this,a=n.config,i=n.lang(),r=a.dateTime,l="static"===a.position,o={datetime:function(){lay(e).hasClass(c)||(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(){l&&(lay.extend(r,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(r,n.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),n.setValue(n.parse()).remove(),l&&n.calendar(),n.done()},confirm:function(){if(a.range){if(lay(e).hasClass(c))return n.hint("time"===a.type?i.timeout.replace(/\u65e5\u671f/g,"\u65f6\u95f4"):i.timeout)}else if(lay(e).hasClass(c))return n.hint(i.invalidDate);n.done(),n.setValue(n.parse()).remove()}};o[t]&&o[t]()},T.prototype.change=function(e){var t=this,n=t.config,a=t.thisDateTime(e),i=n.range&&("year"===n.type||"month"===n.type),r=t.elemCont[e||0],l=t.listYM[e],o=function(o){var s=lay(r).find(".laydate-year-list")[0],c=lay(r).find(".laydate-month-list")[0];return s&&(l[0]=o?l[0]-15:l[0]+15,t.list("year",e)),c&&(o?l[0]--:l[0]++,t.list("month",e)),(s||c)&&(lay.extend(a,{year:l[0]}),i&&(a.year=l[0]),n.range||t.done(null,"change"),n.range||t.limit(lay(t.footer).find(f),{year:l[0]})),t.setBtnStatus(),s||c};return{prevYear:function(){o("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(){o()||(a.year++,t.checkDate("limit").calendar(null,e),t.done(null,"change"))}}},T.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),i=a.attr("lay-ym"),r=a.attr("lay-type");i&&(i=i.split("-"),e.listYM[t]=[0|i[0],0|i[1]],e.list(r,t),lay(e.footer).find("."+g).addClass(c))}),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)})},T.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())},T.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)},r.that={},r.getThis=function(e){var t=r.that[e];return t||hint.error(e?l+" instance with ID '"+e+"' not found":"ID argument required"),t},n.run=function(t){t(document).on("mousedown",function(e){if(i.thisId){var n=r.getThis(i.thisId);if(n){var a=n.config;e.target!==a.elem[0]&&e.target!==a.eventElem[0]&&e.target!==t(a.closeStop)[0]&&n.remove()}}}).on("keydown",function(e){if(i.thisId){var n=r.getThis(i.thisId);n&&13===e.keyCode&&t("#"+n.elemID)[0]&&n.elemID===T.thisElemDate&&(e.preventDefault(),t(n.footer).find(f)[0].click())}}),t(e).on("resize",function(){if(i.thisId){var e=r.getThis(i.thisId);if(e)return!(!e.elem||!t(o)[0])&&void e.position()}})},i.render=function(e){var t=new T(e);return r.call(t)},i.parse=function(e,t,n){return e=e||{},"string"==typeof t&&(t=r.formatArr(t)),t=(t||[]).concat(),lay.each(t,function(a,i){/yyyy|y/.test(i)?t[a]=lay.digit(e.year,i.length):/MM|M/.test(i)?t[a]=lay.digit(e.month+(n||0),i.length):/dd|d/.test(i)?t[a]=lay.digit(e.date,i.length):/HH|H/.test(i)?t[a]=lay.digit(e.hours,i.length):/mm|m/.test(i)?t[a]=lay.digit(e.minutes,i.length):/ss|s/.test(i)&&(t[a]=lay.digit(e.seconds,i.length))}),t.join("")},i.getEndDate=function(e,t){var n=new Date;return n.setFullYear(t||n.getFullYear(),e||n.getMonth()+1,1),new Date(n.getTime()-864e5).getDate()},t?(i.ready(),layui.define("lay",function(e){i.path=layui.cache.dir,n.run(lay),e(l,i)})):"function"==typeof define&&define.amd?define(function(){return n.run(lay),i}):function(){i.ready(),n.run(e.lay),e.laydate=i}()}(window); \ No newline at end of file +/*! 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&&n(e)}))},a.prototype.config=function(e){e=e||{};for(var t in e)n[t]=e[t];return this},a.prototype.modules=function(){var e={};for(var t in s)e[t]=s[t];return e}(),a.prototype.extend=function(e){var t=this;e=e||{};for(var n in e)t[n]||t.modules[n]?o(n+" Module already exists","error"):t.modules[n]=e[n];return t},a.prototype.router=function(e){var t=this,e=e||location.hash,n={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(e=e.replace(/^#\//,""),n.href="/"+e,e=e.replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),n.search[t[0]]=t[1]}():n.path.push(t)}),n):n},a.prototype.url=function(e){var t=this,n={pathname:function(){var t=e?function(){var t=(e.match(/\.[^.]+?\/.+/)||[])[0]||"";return t.replace(/^[^\/]+/,"").replace(/\?.+/,"")}():location.pathname;return t.replace(/^\//,"").split("/")}(),search:function(){var n={},a=(e?function(){var t=(e.match(/\?.+/)||[])[0]||"";return t.replace(/\#.+/,"")}():location.search).replace(/^\?+/,"").split("&");return t.each(a,function(e,t){var a=t.indexOf("="),r=function(){return a<0?t.substr(0,t.length):0!==a&&t.substr(0,a)}();r&&(n[r]=a>0?t.substr(a+1):null)}),n}(),hash:t.router(function(){return e?(e.match(/#.+/)||[])[0]||"/":location.hash}())};return n},a.prototype.data=function(t,n,a){if(t=t||"layui",a=a||localStorage,e.JSON&&e.JSON.parse){if(null===n)return delete a[t];n="object"==typeof n?n:{key:n};try{var r=JSON.parse(a[t])}catch(i){var r={}}return"value"in n&&(r[n.key]=n.value),n.remove&&delete r[n.key],a[t]=JSON.stringify(r),n.key?r[n.key]:r}},a.prototype.sessionData=function(e,t){return this.data(e,t,sessionStorage)},a.prototype.device=function(t){var n=navigator.userAgent.toLowerCase(),a=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(n.match(t)||[])[1],e||!1},r={os:function(){return/windows/.test(n)?"windows":/linux/.test(n)?"linux":/iphone|ipod|ipad|ios/.test(n)?"ios":/mac/.test(n)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((n.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:a("micromessenger")};return t&&!r[t]&&(r[t]=a(t)),r.android=/android/.test(n),r.ios="ios"===r.os,r.mobile=!(!r.android&&!r.ios),r},a.prototype.hint=function(){return{error:o}},a.prototype._typeof=function(e){return null===e?String(e):"object"==typeof e||"function"==typeof e?function(){var t=Object.prototype.toString.call(e).match(/\s(.+)\]$/)||[],n="Function|Array|Date|RegExp|Object|Error|Symbol";return t=t[1]||"Object",new RegExp("\\b("+n+")\\b").test(t)?t.toLowerCase():"object"}():typeof e},a.prototype._isArray=function(t){var n,a=this,r=a._typeof(t);return!(!t||"object"!=typeof t||t===e)&&(n="length"in t&&t.length,"array"===r||0===n||"number"==typeof n&&n>0&&n-1 in t)},a.prototype.each=function(e,t){var n,a=this,r=function(e,n){return t.call(n[e],e,n[e])};if("function"!=typeof t)return a;if(e=e||[],a._isArray(e))for(n=0;n(window.innerHeight||d.documentElement.clientHeight)},m.position=function(e,t,n){if(t){n=n||{},e!==d&&e!==m("body")[0]||(n.clickType="right");var a="right"===n.clickType?function(){var e=n.e||window.event||{};return{left:e.clientX,top:e.clientY,right:e.clientX,bottom:e.clientY}}():e.getBoundingClientRect(),r=t.offsetWidth,i=t.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",d.body[e]|d.documentElement[e]},l=function(e){return d.documentElement[e?"clientWidth":"clientHeight"]},s=5,c=a.left,u=a.bottom;c+r+s>l("width")&&(c=l("width")-r-s),u+i+s>l()&&(a.top>i+s?u=a.top-i-2*s:"right"===n.clickType&&(u=l()-i-2*s,u<0&&(u=0)));var y=n.position;if(y&&(t.style.position=y),t.style.left=c+("fixed"===y?0:o(1))+"px",t.style.top=u+("fixed"===y?0:o())+"px",!m.hasScrollbar()){var f=t.getBoundingClientRect();!n.SYSTEM_RELOAD&&f.bottom+s>l()&&(n.SYSTEM_RELOAD=!0,setTimeout(function(){m.position(e,t,n)},50))}}},m.options=function(e,t){var n=m(e),a=t||"lay-options";try{return new Function("return "+(n.attr(a)||"{}"))()}catch(r){return hint.error("parseerror\uff1a"+r,"error"),{}}},m.isTopElem=function(e){var t=[d,m("body")[0]],n=!1;return m.each(t,function(t,a){if(a===e)return n=!0}),n},f.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),m.each(t,function(t,n){new RegExp("\\b"+n+"\\b").test(e)||(e=e+" "+n)}),e.replace(/^\s|\s$/,"")},f.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),m.each(t,function(t,n){var a=new RegExp("\\b"+n+"\\b");a.test(e)&&(e=e.replace(a,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},f.prototype.find=function(e){var t=this,n=0,a=[],r="object"==typeof e;return this.each(function(i,o){for(var l=r?o.contains(e):o.querySelectorAll(e||null);n0)return n[0].style[e]}():n.each(function(n,r){"object"==typeof e?m.each(e,function(e,t){r.style[e]=a(t)}):r.style[e]=a(t)})},f.prototype.width=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetWidth}():t.each(function(n,a){t.css("width",e)})},f.prototype.height=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].offsetHeight}():t.each(function(n,a){t.css("height",e)})},f.prototype.attr=function(e,t){var n=this;return void 0===t?function(){if(n.length>0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},f.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},f.prototype.html=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].innerHTML}():this.each(function(t,n){n.innerHTML=e})},f.prototype.val=function(e){var t=this;return void 0===e?function(){if(t.length>0)return t[0].value}():this.each(function(t,n){n.value=e})},f.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},f.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},f.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},f.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},window.lay=m,window.layui&&u.define&&u.define(function(e){e(y,m)})}(window,window.document),!function(e,t){"use strict";var n=e.layui&&layui.define,a={getPath:e.lay&&lay.getPath?lay.getPath:"",link:function(t,n,a){i.path&&e.lay&&lay.layui&&lay.layui.link(i.path+t,n,a)}},r=e.LAYUI_GLOBAL||{},i={v:"5.3.1",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:r.laydate_dir||a.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var t="laydate",r="",o=(n?"modules/laydate/":"theme/")+"default/laydate.css?v="+i.v+r;return n?layui.addcss(o,e,t):a.link(o,e,t),this}},o=function(){var e=this,t=e.config,n=t.id;return o.that[n]=e,{hint:function(t){e.hint.call(e,t)},config:e.config}},l="laydate",s=".layui-laydate",c="layui-this",u="laydate-disabled",y=[100,2e5],d="layui-laydate-static",m="layui-laydate-list",f="layui-laydate-hint",h="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v="laydate-btns-time",T="layui-laydate-preview",w=function(e){var t=this;t.index=++i.index,t.config=lay.extend({},t.config,i.config,e),e=t.config,e.id="id"in e?e.id:t.index,i.ready(function(){t.init()})},D="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s";o.formatArr=function(e){return(e||"").match(new RegExp(D+"|.","g"))||[]},w.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},w.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"click",show:!1,showBottom:!0,isPreview:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},w.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"],time:["\u65f6","\u5206","\u79d2"],timeTips:"\u9009\u62e9\u65f6\u95f4",startTime:"\u5f00\u59cb\u65f6\u95f4",endTime:"\u7ed3\u675f\u65f6\u95f4",dateTips:"\u8fd4\u56de\u65e5\u671f",month:["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"],tools:{confirm:"\u786e\u5b9a",clear:"\u6e05\u7a7a",now:"\u73b0\u5728"},timeout:"\u7ed3\u675f\u65f6\u95f4\u4e0d\u80fd\u65e9\u4e8e\u5f00\u59cb\u65f6\u95f4
          \u8bf7\u91cd\u65b0\u9009\u62e9",invalidDate:"\u4e0d\u5728\u6709\u6548\u65e5\u671f\u6216\u65f6\u95f4\u8303\u56f4\u5185",formatError:["\u65e5\u671f\u683c\u5f0f\u4e0d\u5408\u6cd5
          \u5fc5\u987b\u9075\u5faa\u4e0b\u8ff0\u683c\u5f0f\uff1a
          ","
          \u5df2\u4e3a\u4f60\u91cd\u7f6e"],preview:"\u5f53\u524d\u9009\u4e2d\u7684\u7ed3\u679c"},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
          Please re-select",invalidDate:"Invalid date",formatError:["The date format error
          Must be followed\uff1a
          ","
          It has been reset"],preview:"The selected result"}};return n[t.lang]||n.cn},w.prototype.init=function(){var t=this,n=t.config,a="static"===n.position,r={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};n.elem=lay(n.elem),n.eventElem=lay(n.eventElem),n.elem[0]&&(t.rangeStr=n.range?"string"==typeof n.range?n.range:"-":"",n.range&&n.range.constructor===Array&&(t.rangeElem=[lay(n.range[0]),lay(n.range[1])]),r[n.type]||(e.console&&console.error&&console.error("laydate type error:'"+n.type+"' is not supported"),n.type="date"),n.format===r.date&&(n.format=r[n.type]||r.date),t.format=o.formatArr(n.format),t.EXP_IF="",t.EXP_SPLIT="",lay.each(t.format,function(e,n){var a=new RegExp(D).test(n)?"\\d{"+function(){return new RegExp(D).test(t.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(n)?4:n.length:/^yyyy$/.test(n)?"1,4":/^y$/.test(n)?"1,308":"1,2"}()+"}":"\\"+n;t.EXP_IF=t.EXP_IF+a,t.EXP_SPLIT=t.EXP_SPLIT+"("+a+")"}),t.EXP_IF_ONE=new RegExp("^"+t.EXP_IF+"$"),t.EXP_IF=new RegExp("^"+(n.range?t.EXP_IF+"\\s\\"+t.rangeStr+"\\s"+t.EXP_IF:t.EXP_IF)+"$"),t.EXP_SPLIT=new RegExp("^"+t.EXP_SPLIT+"$",""),t.isInput(n.elem[0])||"focus"===n.trigger&&(n.trigger="click"),n.elem.attr("lay-key")||(n.elem.attr("lay-key",t.index),n.eventElem.attr("lay-key",t.index)),n.mark=lay.extend({},n.calendar&&"cn"===n.lang?{"0-1-1":"\u5143\u65e6","0-2-14":"\u60c5\u4eba","0-3-8":"\u5987\u5973","0-3-12":"\u690d\u6811","0-4-1":"\u611a\u4eba","0-5-1":"\u52b3\u52a8","0-5-4":"\u9752\u5e74","0-6-1":"\u513f\u7ae5","0-9-10":"\u6559\u5e08","0-9-18":"\u56fd\u803b","0-10-1":"\u56fd\u5e86","0-12-25":"\u5723\u8bde"}:{},n.mark),lay.each(["min","max"],function(e,t){var a=[],r=[];if("number"==typeof n[t]){var i=n[t],o=(new Date).getTime(),l=864e5,s=new Date(i?i0)return!0;var t=lay.elem("div",{"class":"layui-laydate-header"}),r=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),n=lay.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],i=lay.elem("div",{"class":"layui-laydate-content"}),o=lay.elem("table"),y=lay.elem("thead"),d=lay.elem("tr");lay.each(r,function(e,n){t.appendChild(n)}),y.appendChild(d),lay.each(new Array(6),function(e){var t=o.insertRow(0);lay.each(new Array(7),function(n){if(0===e){var r=lay.elem("th");r.innerHTML=a.weeks[n],d.appendChild(r)}t.insertCell(n)})}),o.insertBefore(y,o.children[0]),i.appendChild(o),l[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),l[e].appendChild(t),l[e].appendChild(i),s.push(r),c.push(i),u.push(o)}),lay(y).html(function(){var e=[],t=[];return"datetime"===n.type&&e.push(''+a.timeTips+""),(n.range||"datetime"!==n.type)&&e.push(''),lay.each(n.btns,function(e,i){var o=a.tools[i]||"btn";n.range&&"now"===i||(r&&"clear"===i&&(o="cn"===n.lang?"\u91cd\u7f6e":"Reset"),t.push(''+o+""))}),e.push('"),e.join("")}()),lay.each(l,function(e,t){o.appendChild(t)}),n.showBottom&&o.appendChild(y),/^#/.test(n.theme)){var m=lay.elem("style"),f=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,n.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=f):m.innerHTML=f,lay(o).addClass("laydate-theme-molv"),o.appendChild(m)}i.thisId=n.id,e.remove(w.thisElemDate),r?n.elem.append(o):(t.body.appendChild(o),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),w.thisElemDate=e.elemID,"function"==typeof n.ready&&n.ready(lay.extend({},n.dateTime,{month:n.dateTime.month+1})),e.preview()},w.prototype.remove=function(e){var t=this,n=(t.config,lay("#"+(e||t.elemID)));return n[0]?(n.hasClass(d)||t.checkDate(function(){n.remove()}),t):t},w.prototype.position=function(){var e=this,t=e.config;return lay.position(e.bindElem||t.elem[0],e.elem,{position:t.position}),e},w.prototype.hint=function(e){var t=this,n=(t.config,lay.elem("div",{"class":f}));t.elem&&(n.innerHTML=e||"",lay(t.elem).find("."+f).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+f).remove()},3e3))},w.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},w.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},w.prototype.checkDate=function(e){var t,n,a=this,r=(new Date,a.config),o=a.lang(),l=r.dateTime=r.dateTime||a.systemDate(),s=a.bindElem||r.elem[0],c=(a.isInput(s)?"val":"html",function(){if(a.rangeElem){var e=[a.rangeElem[0].val(),a.rangeElem[1].val()];if(e[0]&&e[1])return e.join(" "+a.rangeStr+" ")}return a.isInput(s)?s.value:"static"===r.position?"":lay(s).attr("lay-date")}()),u=function(e){e.year>y[1]&&(e.year=y[1],n=!0),e.month>11&&(e.month=11,n=!0),e.hours>23&&(e.hours=0,n=!0),e.minutes>59&&(e.minutes=0,e.hours++,n=!0),e.seconds>59&&(e.seconds=0,e.minutes++,n=!0),t=i.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,n=!0)},d=function(e,t,i){var o=["startTime","endTime"];t=(t.match(a.EXP_SPLIT)||[]).slice(1),i=i||0,r.range&&(a[o[i]]=a[o[i]]||{}),lay.each(a.format,function(l,s){var c=parseFloat(t[l]);t[l].lengthf(r.max)||f(l)f(r.max))&&(a.endDate=lay.extend({},r.max)),e&&e(),a},w.prototype.mark=function(e,t){var n,a=this,r=a.config;return lay.each(r.mark,function(e,a){var r=e.split("-");r[0]!=t[0]&&0!=r[0]||r[1]!=t[1]&&0!=r[1]||r[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},w.prototype.limit=function(e,t,n,a){var r,i=this,o=i.config,l={},s=o[n>41?"endDate":"dateTime"],c=lay.extend({},s,t||{});return lay.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=i.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),r=l.nowl.max,e&&e[r?"addClass":"removeClass"](u),r},w.prototype.thisDateTime=function(e){var t=this,n=t.config;return e?t.endDate:n.dateTime},w.prototype.calendar=function(e,t,n){var a,r,o,l=this,s=l.config,t=t?1:0,u=e||l.thisDateTime(t),d=new Date,m=l.lang(),f="date"!==s.type&&"datetime"!==s.type,h=lay(l.table[t]).find("td"),g=lay(l.elemHeader[t][2]).find("span");return u.yeary[1]&&(u.year=y[1],l.hint(m.invalidDate)),l.firstDate||(l.firstDate=lay.extend({},u)),d.setFullYear(u.year,u.month,1),a=d.getDay(),r=i.getEndDate(u.month||12,u.year),o=i.getEndDate(u.month+1,u.year),lay.each(h,function(e,t){var n=[u.year,u.month],i=0;t=lay(t),t.removeAttr("class"),e=a&&e=n.firstDate.year&&(i.month=a.max.month,i.date=a.max.date),n.limit(lay(r),i,t),E++}),lay(y[h?0:1]).attr("lay-ym",E-8+"-"+w[1]).html(x+T+" - "+(E-1+T))}else if("month"===e)lay.each(new Array(12),function(e){var r=lay.elem("li",{"lay-ym":e}),o={year:w[0],month:e};e+1==w[1]&&lay(r).addClass(c),r.innerHTML=i.month[e]+(h?"\u6708":""),l.appendChild(r),w[0]=n.firstDate.year&&(o.date=a.max.date),n.limit(lay(r),o,t)}),lay(y[h?0:1]).attr("lay-ym",w[0]+"-"+w[1]).html(w[0]+T);else if("time"===e){var C=function(){lay(l).find("ol").each(function(e,a){lay(a).find("li").each(function(a,r){n.limit(lay(r),[{hours:a},{hours:n[b].hours,minutes:a},{hours:n[b].hours,minutes:n[b].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(lay(n.footer).find(p),n[b],0,["hours","minutes","seconds"])};a.range?n[b]||(n[b]="startTime"===b?r:n.endDate):n[b]=r,lay.each([24,60,60],function(e,t){var a=lay.elem("li"),r=["

          "+i.time[e]+"

            "];lay.each(new Array(t),function(t){r.push(""+lay.digit(t,2)+"")}),a.innerHTML=r.join("")+"
          ",l.appendChild(a)}),C()}if(f&&d.removeChild(f),d.appendChild(l),"year"===e||"month"===e)lay(n.elemMain[t]).addClass("laydate-ym-show"),lay(l).find("li").on("click",function(){var i=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(u)){0===t?(r[e]=i,n.limit(lay(n.footer).find(p),null,0)):n.endDate[e]=i;var s="year"===a.type||"month"===a.type;s?(lay(l).find("."+c).removeClass(c),lay(this).addClass(c),"month"===a.type&&"year"===e&&(n.listYM[t][0]=i,o&&((t?n.endDate:r).year=i),n.list("month",t))):(n.checkDate("limit").calendar(null,t),n.closeList()),n.setBtnStatus(),a.range||("month"===a.type&&"month"===e||"year"===a.type&&"year"===e)&&n.setValue(n.parse()).remove().done(),n.done(null,"change"),lay(n.footer).find("."+v).removeClass(u)}});else{var M=lay.elem("span",{"class":g}),S=function(){lay(l).find("ol").each(function(e){var t=this,a=lay(t).find("li");t.scrollTop=30*(n[b][D[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!lay(this).hasClass(u))return t.scrollTop=30*(e-2),!0})})},k=lay(s[2]).find("."+g);S(),M.innerHTML=a.range?[i.startTime,i.endTime][t]:i.timeTips,lay(n.elemMain[t]).addClass("laydate-time-show"),k[0]&&k.remove(),s[2].appendChild(M),lay(l).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var i=0|this.innerHTML;lay(this).hasClass(u)||(a.range?n[b][D[e]]=i:r[D[e]]=i,lay(t).find("."+c).removeClass(c),lay(this).addClass(c),C(),S(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},w.prototype.listYM=[],w.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,n){lay(this).find("."+m).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+g).remove()},w.prototype.setBtnStatus=function(e,t,n){var a,r=this,i=r.config,o=r.lang(),l=lay(r.footer).find(p);i.range&&"time"!==i.type&&(t=t||i.dateTime,n=n||r.endDate,a=r.newDate(t).getTime()>r.newDate(n).getTime(),r.limit(null,t)||r.limit(null,n)?l.addClass(u):l[a?"addClass":"removeClass"](u),e&&a&&r.hint("string"==typeof e?o.timeout.replace(/\u65e5\u671f/g,e):o.timeout))},w.prototype.parse=function(e,t){var n=this,a=n.config,r=t||("end"==e?lay.extend({},n.endDate,n.endTime):a.range?lay.extend({},a.dateTime,n.startTime):a.dateTime),o=i.parse(r,n.format,1);return a.range&&void 0===e?o+" "+n.rangeStr+" "+n.parse("end"):o},w.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},w.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0];return"static"===n.position?t:(e=e||"",t.isInput(a)?lay(a).val(e):t.rangeElem?(t.rangeElem[0].val(e?t.parse("start"):""),t.rangeElem[1].val(e?t.parse("end"):"")):(0===lay(a).find("*").length&&lay(a).html(e),lay(a).attr("lay-date",e)),t)},w.prototype.preview=function(){var e=this,t=e.config;if(t.isPreview){var n=lay(e.elem).find("."+T),a=t.range?e.endDate?e.parse():"":e.parse();n.html(a).css({color:"#5FB878","font-size":"14px;"}),setTimeout(function(){ +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+" instance with ID '"+e+"' not found":"ID argument required"),t},a.run=function(n){n(t).on("mousedown",function(e){if(i.thisId){var t=o.getThis(i.thisId);if(t){var a=t.config;e.target!==a.elem[0]&&e.target!==a.eventElem[0]&&e.target!==n(a.closeStop)[0]&&t.remove()}}}).on("keydown",function(e){if(i.thisId){var t=o.getThis(i.thisId);t&&13===e.keyCode&&n("#"+t.elemID)[0]&&t.elemID===w.thisElemDate&&(e.preventDefault(),n(t.footer).find(p)[0].click())}}),n(e).on("resize",function(){if(i.thisId){var e=o.getThis(i.thisId);if(e)return!(!e.elem||!n(s)[0])&&void e.position()}})},i.render=function(e){var t=new w(e);return o.call(t)},i.parse=function(e,t,n){return e=e||{},"string"==typeof t&&(t=o.formatArr(t)),t=(t||[]).concat(),lay.each(t,function(a,r){/yyyy|y/.test(r)?t[a]=lay.digit(e.year,r.length):/MM|M/.test(r)?t[a]=lay.digit(e.month+(n||0),r.length):/dd|d/.test(r)?t[a]=lay.digit(e.date,r.length):/HH|H/.test(r)?t[a]=lay.digit(e.hours,r.length):/mm|m/.test(r)?t[a]=lay.digit(e.minutes,r.length):/ss|s/.test(r)&&(t[a]=lay.digit(e.seconds,r.length))}),t.join("")},i.getEndDate=function(e,t){var n=new Date;return n.setFullYear(t||n.getFullYear(),e||n.getMonth()+1,1),new Date(n.getTime()-864e5).getDate()},n?(i.ready(),layui.define("lay",function(e){i.path=layui.cache.dir,a.run(lay),e(l,i)})):"function"==typeof define&&define.amd?define(function(){return a.run(lay),i}):function(){i.ready(),a.run(e.lay),e.laydate=i}()}(window,window.document); \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index e39b8da..7eea768 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -29,7 +29,7 @@ var task = { ascii_only: true //escape Unicode characters in strings and regexps } })) - .pipe(header('/*! <%= pkg.realname %> v<%= pkg.version %> | <%= pkg.description %> | The <%= pkg.license %> License */\n ;', {pkg: pkg})) + .pipe(header('/*! <%= pkg.realname %> v<%= pkg.version %> | <%= pkg.description %> | <%= pkg.license %> Licensed */\n ;', {pkg: pkg})) .pipe(gulp.dest('./dist')); } diff --git a/package.json b/package.json index d41587f..b5eebd7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "layui-laydate", "realname": "layDate", - "version": "5.3.0", + "version": "5.3.1", "description": "日期与时间组件", "main": "src/laydate.js", "license": "MIT", diff --git a/src/laydate.js b/src/laydate.js index 1c57735..0c04177 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -1,13 +1,734 @@ /*! - * layDate 日期与时间组件 + * layDate 日期与时间组件(单独版) * MIT Licensed */ -/*! lay 基础 DOM 操作 */ +/*! + * Layui + * Classic modular Front-End UI library + * MIT Licensed + */ + +;!function(win){ + "use strict"; + + var doc = win.document, config = { + modules: {} //记录模块物理路径 + ,status: {} //记录模块加载状态 + ,timeout: 10 //符合规范的模块请求最长等待秒数 + ,event: {} //记录模块自定义事件 + } + + ,Layui = function(){ + this.v = '2.6.7'; // layui 版本号 + } + + //识别预先可能定义的指定全局对象 + ,GLOBAL = win.LAYUI_GLOBAL || {} + + //获取 layui 所在目录 + ,getPath = function(){ + var jsPath = doc.currentScript ? doc.currentScript.src : function(){ + var js = doc.scripts + ,last = js.length - 1 + ,src; + for(var i = last; i > 0; i--){ + if(js[i].readyState === 'interactive'){ + src = js[i].src; + break; + } + } + return src || js[last].src; + }(); + + return config.dir = GLOBAL.dir || jsPath.substring(0, jsPath.lastIndexOf('/') + 1); + }() + + //异常提示 + ,error = function(msg, type){ + type = type || 'log'; + win.console && console[type] && console[type]('layui error hint: ' + msg); + } + + ,isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]' + + //内置模块 + ,modules = config.builtin = { + lay: 'lay' //基础 DOM 操作 + ,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' //DOM 库(第三方) + + ,all: 'all' + ,'layui.all': 'layui.all' //聚合标识(功能性的,非真实模块) + }; + + //记录基础数据 + Layui.prototype.cache = config; + + //定义模块 + Layui.prototype.define = function(deps, factory){ + var that = this + ,type = typeof deps === 'function' + ,callback = function(){ + var setApp = function(app, exports){ + layui[app] = exports; + config.status[app] = true; + }; + typeof factory === 'function' && factory(function(app, exports){ + setApp(app, exports); + config.callback[app] = function(){ + factory(setApp); + } + }); + return this; + }; + + type && ( + factory = deps, + deps = [] + ); + + that.use(deps, callback, null, 'define'); + return that; + }; + + //使用特定模块 + Layui.prototype.use = function(apps, callback, exports, from){ + var that = this + ,dir = config.dir = config.dir ? config.dir : getPath + ,head = doc.getElementsByTagName('head')[0]; + + apps = function(){ + if(typeof apps === 'string'){ + return [apps]; + } + //当第一个参数为 function 时,则自动加载所有内置模块,且执行的回调即为该 function 参数; + else if(typeof apps === 'function'){ + callback = apps; + return ['all']; + } + return apps; + }(); + + //如果页面已经存在 jQuery 1.7+ 库且所定义的模块依赖 jQuery,则不加载内部 jquery 模块 + if(win.jQuery && jQuery.fn.on){ + that.each(apps, function(index, item){ + if(item === 'jquery'){ + apps.splice(index, 1); + } + }); + layui.jquery = layui.$ = jQuery; + } + + var item = apps[0] + ,timeout = 0; + exports = exports || []; + + //静态资源host + config.host = config.host || (dir.match(/\/\/([\s\S]+?)\//)||['//'+ location.host +'/'])[0]; + + //加载完毕 + function onScriptLoad(e, url){ + var readyRegExp = navigator.platform === 'PLaySTATION 3' ? /^complete$/ : /^(complete|loaded)$/ + if (e.type === 'load' || (readyRegExp.test((e.currentTarget || e.srcElement).readyState))) { + config.modules[item] = url; + head.removeChild(node); + (function poll() { + if(++timeout > config.timeout * 1000 / 4){ + return error(item + ' is not a valid module', 'error'); + }; + config.status[item] ? onCallback() : setTimeout(poll, 4); + }()); + } + } + + //回调 + function onCallback(){ + exports.push(layui[item]); + apps.length > 1 ? + that.use(apps.slice(1), callback, exports, from) + : ( typeof callback === 'function' && function(){ + //保证文档加载完毕再执行回调 + if(layui.jquery && typeof layui.jquery === 'function' && from !== 'define'){ + return layui.jquery(function(){ + callback.apply(layui, exports); + }); + } + callback.apply(layui, exports); + }() ); + } + + //如果引入了聚合板,内置的模块则不必重复加载 + if( apps.length === 0 || (layui['layui.all'] && modules[item]) ){ + return onCallback(), that; + } + + //获取加载的模块 URL + //如果是内置模块,则按照 dir 参数拼接模块路径 + //如果是扩展模块,则判断模块路径值是否为 {/} 开头, + //如果路径值是 {/} 开头,则模块路径即为后面紧跟的字符。 + //否则,则按照 base 参数拼接模块路径 + + var url = ( modules[item] ? (dir + 'modules/') + : (/^\{\/\}/.test(that.modules[item]) ? '' : (config.base || '')) + ) + (that.modules[item] || item) + '.js'; + url = url.replace(/^\{\/\}/, ''); + + //如果扩展模块(即:非内置模块)对象已经存在,则不必再加载 + if(!config.modules[item] && layui[item]){ + config.modules[item] = url; //并记录起该扩展模块的 url + } + + //首次加载模块 + if(!config.modules[item]){ + var node = doc.createElement('script'); + + node.async = true; + node.charset = 'utf-8'; + node.src = url + function(){ + var version = config.version === true + ? (config.v || (new Date()).getTime()) + : (config.version||''); + return version ? ('?v=' + version) : ''; + }(); + + head.appendChild(node); + + if(node.attachEvent && !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) && !isOpera){ + node.attachEvent('onreadystatechange', function(e){ + onScriptLoad(e, url); + }); + } else { + node.addEventListener('load', function(e){ + onScriptLoad(e, url); + }, false); + } + + config.modules[item] = url; + } else { //缓存 + (function poll() { + if(++timeout > config.timeout * 1000 / 4){ + return error(item + ' is not a valid module', 'error'); + }; + (typeof config.modules[item] === 'string' && config.status[item]) + ? onCallback() + : setTimeout(poll, 4); + }()); + } + + return that; + }; + + //获取节点的 style 属性值 + Layui.prototype.getStyle = function(node, name){ + var style = node.currentStyle ? node.currentStyle : win.getComputedStyle(node, null); + return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name); + }; + + //css外部加载器 + Layui.prototype.link = function(href, fn, cssname){ + var that = this + ,head = doc.getElementsByTagName('head')[0] + ,link = doc.createElement('link'); + + if(typeof fn === 'string') cssname = fn; + + var app = (cssname || href).replace(/\.|\//g, '') + ,id = link.id = 'layuicss-'+ app + ,STAUTS_NAME = 'creating' + ,timeout = 0; + + link.rel = 'stylesheet'; + link.href = href + (config.debug ? '?v='+new Date().getTime() : ''); + link.media = 'all'; + + if(!doc.getElementById(id)){ + head.appendChild(link); + } + + if(typeof fn !== 'function') return that; + + //轮询 css 是否加载完毕 + (function poll(status) { + var delay = 100 + ,getLinkElem = doc.getElementById(id); //获取动态插入的 link 元素 + + //如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范 + if(++timeout > config.timeout * 1000 / delay){ + return error(href + ' timeout'); + }; + + //css 加载就绪 + if(parseInt(that.getStyle(getLinkElem, 'width')) === 1989){ + //如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态 + if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status'); + //如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调 + getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn(); + } else { + getLinkElem.setAttribute('lay-status', STAUTS_NAME); + setTimeout(function(){ + poll(STAUTS_NAME); + }, delay); + } + }()); + + //轮询css是否加载完毕 + /* + (function poll() { + if(++timeout > config.timeout * 1000 / 100){ + return error(href + ' timeout'); + }; + parseInt(that.getStyle(doc.getElementById(id), 'width')) === 1989 ? function(){ + fn(); + }() : setTimeout(poll, 100); + }()); + */ + + return that; + }; + + //css 内部加载器 + Layui.prototype.addcss = function(firename, fn, cssname){ + return layui.link(config.dir + 'css/' + firename, fn, cssname); + }; + + //存储模块的回调 + config.callback = {}; + + //重新执行模块的工厂函数 + Layui.prototype.factory = function(modName){ + if(layui[modName]){ + return typeof config.callback[modName] === 'function' + ? config.callback[modName] + : null; + } + }; + + //图片预加载 + Layui.prototype.img = function(url, callback, error) { + var img = new Image(); + img.src = url; + if(img.complete){ + return callback(img); + } + img.onload = function(){ + img.onload = null; + typeof callback === 'function' && callback(img); + }; + img.onerror = function(e){ + img.onerror = null; + typeof error === 'function' && error(e); + }; + }; + + //全局配置 + Layui.prototype.config = function(options){ + options = options || {}; + for(var key in options){ + config[key] = options[key]; + } + return this; + }; + + //记录全部模块 + Layui.prototype.modules = function(){ + var clone = {}; + for(var o in modules){ + clone[o] = modules[o]; + } + return clone; + }(); + + //拓展模块 + Layui.prototype.extend = function(options){ + var that = this; + + //验证模块是否被占用 + options = options || {}; + for(var o in options){ + if(that[o] || that.modules[o]){ + error(o+ ' Module already exists', 'error'); + } else { + that.modules[o] = options[o]; + } + } + + return that; + }; + + // location.hash 路由解析 + Layui.prototype.router = function(hash){ + var that = this + ,hash = hash || location.hash + ,data = { + path: [] + ,search: {} + ,hash: (hash.match(/[^#](#.*$)/) || [])[1] || '' + }; + + if(!/^#\//.test(hash)) return data; //禁止非路由规范 + hash = hash.replace(/^#\//, ''); + data.href = '/' + hash; + hash = hash.replace(/([^#])(#.*$)/, '$1').split('/') || []; + + //提取 Hash 结构 + that.each(hash, function(index, item){ + /^\w+=/.test(item) ? function(){ + item = item.split('='); + data.search[item[0]] = item[1]; + }() : data.path.push(item); + }); + + return data; + }; + + //URL 解析 + Layui.prototype.url = function(href){ + var that = this + ,data = { + //提取 url 路径 + pathname: function(){ + var pathname = href + ? function(){ + var str = (href.match(/\.[^.]+?\/.+/) || [])[0] || ''; + return str.replace(/^[^\/]+/, '').replace(/\?.+/, ''); + }() + : location.pathname; + return pathname.replace(/^\//, '').split('/'); + }() + + //提取 url 参数 + ,search: function(){ + var obj = {} + ,search = (href + ? function(){ + var str = (href.match(/\?.+/) || [])[0] || ''; + return str.replace(/\#.+/, ''); + }() + : location.search + ).replace(/^\?+/, '').split('&'); //去除 ?,按 & 分割参数 + + //遍历分割后的参数 + that.each(search, function(index, item){ + var _index = item.indexOf('=') + ,key = function(){ //提取 key + if(_index < 0){ + return item.substr(0, item.length); + } else if(_index === 0){ + return false; + } else { + return item.substr(0, _index); + } + }(); + //提取 value + if(key){ + obj[key] = _index > 0 ? item.substr(_index + 1) : null; + } + }); + + return obj; + }() + + //提取 Hash + ,hash: that.router(function(){ + return href + ? ((href.match(/#.+/) || [])[0] || '/') + : location.hash; + }()) + }; + + return data; + }; + + //本地持久性存储 + Layui.prototype.data = function(table, settings, storage){ + table = table || 'layui'; + storage = storage || localStorage; + + if(!win.JSON || !win.JSON.parse) return; + + //如果settings为null,则删除表 + if(settings === null){ + return delete storage[table]; + } + + settings = typeof settings === 'object' + ? settings + : {key: settings}; + + try{ + var data = JSON.parse(storage[table]); + } catch(e){ + var data = {}; + } + + if('value' in settings) data[settings.key] = settings.value; + if(settings.remove) delete data[settings.key]; + storage[table] = JSON.stringify(data); + + return settings.key ? data[settings.key] : data; + }; + + //本地会话性存储 + Layui.prototype.sessionData = function(table, settings){ + return this.data(table, settings, sessionStorage); + } + + //设备信息 + Layui.prototype.device = function(key){ + var agent = navigator.userAgent.toLowerCase() + + //获取版本号 + ,getVersion = function(label){ + var exp = new RegExp(label + '/([^\\s\\_\\-]+)'); + label = (agent.match(exp)||[])[1]; + return label || false; + } + + //返回结果集 + ,result = { + os: function(){ //底层操作系统 + if(/windows/.test(agent)){ + return 'windows'; + } else if(/linux/.test(agent)){ + return 'linux'; + } else if(/iphone|ipod|ipad|ios/.test(agent)){ + return 'ios'; + } else if(/mac/.test(agent)){ + return 'mac'; + } + }() + ,ie: function(){ //ie版本 + return (!!win.ActiveXObject || "ActiveXObject" in win) ? ( + (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识 + ) : false; + }() + ,weixin: getVersion('micromessenger') //是否微信 + }; + + //任意的key + if(key && !result[key]){ + result[key] = getVersion(key); + } + + //移动设备 + result.android = /android/.test(agent); + result.ios = result.os === 'ios'; + result.mobile = (result.android || result.ios) ? true : false; + + return result; + }; + + //提示 + Layui.prototype.hint = function(){ + return { + error: error + }; + }; + + + //typeof 类型细分 -> string/number/boolean/undefined/null、object/array/function/… + Layui.prototype._typeof = function(operand){ + if(operand === null) return String(operand); + + //细分引用类型 + return (typeof operand === 'object' || typeof operand === 'function') ? function(){ + var type = Object.prototype.toString.call(operand).match(/\s(.+)\]$/) || [] //匹配类型字符 + ,classType = 'Function|Array|Date|RegExp|Object|Error|Symbol'; //常见类型字符 + + type = type[1] || 'Object'; + + //除匹配到的类型外,其他对象均返回 object + return new RegExp('\\b('+ classType + ')\\b').test(type) + ? type.toLowerCase() + : 'object'; + }() : typeof operand; + }; + + //对象是否具备数组结构(此处为兼容 jQuery 对象) + Layui.prototype._isArray = function(obj){ + var that = this + ,len + ,type = that._typeof(obj); + + if(!obj || (typeof obj !== 'object') || obj === win) return false; + + len = 'length' in obj && obj.length; //兼容 ie + return type === 'array' || len === 0 || ( + typeof len === 'number' && len > 0 && (len - 1) in obj //兼容 jQuery 对象 + ); + }; + + //遍历 + Layui.prototype.each = function(obj, fn){ + var key + ,that = this + ,callFn = function(key, obj){ //回调 + return fn.call(obj[key], key, obj[key]) + }; + + if(typeof fn !== 'function') return that; + obj = obj || []; + + //优先处理数组结构 + if(that._isArray(obj)){ + for(key = 0; key < obj.length; key++){ + if(callFn(key, obj)) break; + } + } else { + for(key in obj){ + if(callFn(key, obj)) break; + } + } + + return that; + }; + + //将数组中的对象按其某个成员排序 + Layui.prototype.sort = function(obj, key, desc){ + var clone = JSON.parse( + JSON.stringify(obj || []) + ); + + if(!key) return clone; + + //如果是数字,按大小排序;如果是非数字,则按字典序排序 + clone.sort(function(o1, o2){ + var isNum = /^-?\d+$/ + ,v1 = o1[key] + ,v2 = o2[key]; + + if(isNum.test(v1)) v1 = parseFloat(v1); + if(isNum.test(v2)) v2 = parseFloat(v2); + + return v1 - v2; + + /* + if(v1 && !v2){ + return 1; + } else if(!v1 && v2){ + return -1; + } + + if(v1 > v2){ + return 1; + } else if (v1 < v2) { + return -1; + } else { + return 0; + } + */ + + }); + + desc && clone.reverse(); //倒序 + return clone; + }; + + //阻止事件冒泡 + Layui.prototype.stope = function(thisEvent){ + thisEvent = thisEvent || win.event; + try { thisEvent.stopPropagation() } catch(e){ + thisEvent.cancelBubble = true; + } + }; + + //字符常理 + var EV_REMOVE = 'LAYUI-EVENT-REMOVE'; + + //自定义模块事件 + Layui.prototype.onevent = function(modName, events, callback){ + if(typeof modName !== 'string' + || typeof callback !== 'function') return this; + + return Layui.event(modName, events, null, callback); + }; + + //执行自定义模块事件 + Layui.prototype.event = Layui.event = function(modName, events, params, fn){ + var that = this + ,result = null + ,filter = (events || '').match(/\((.*)\)$/)||[] //提取事件过滤器字符结构,如:select(xxx) + ,eventName = (modName + '.'+ events).replace(filter[0], '') //获取事件名称,如:form.select + ,filterName = filter[1] || '' //获取过滤器名称,,如:xxx + ,callback = function(_, item){ + var res = item && item.call(that, params); + res === false && result === null && (result = false); + }; + + //如果参数传入特定字符,则执行移除事件 + if(params === EV_REMOVE){ + delete (that.cache.event[eventName] || {})[filterName]; + return that; + } + + //添加事件 + if(fn){ + config.event[eventName] = config.event[eventName] || {}; + + //这里不再对重复事件做支持 + //config.event[eventName][filterName] ? config.event[eventName][filterName].push(fn) : + config.event[eventName][filterName] = [fn]; + return this; + } + + //执行事件回调 + layui.each(config.event[eventName], function(key, item){ + //执行当前模块的全部事件 + if(filterName === '{*}'){ + layui.each(item, callback); + return; + } + + //执行指定事件 + key === '' && layui.each(item, callback); + (filterName && key === filterName) && layui.each(item, callback); + }); + + return result; + }; + + //新增模块事件 + Layui.prototype.on = function(events, modName, callback){ + var that = this; + return that.onevent.call(that, modName, events, callback); + } + + //移除模块事件 + Layui.prototype.off = function(events, modName){ + var that = this; + return that.event.call(that, modName, events, EV_REMOVE); + }; + + //exports layui + var layui = new Layui(); + + + + +/*! lay 基础 DOM 操作 | MIT Licensed */ + -;!function(){ "use strict"; var MOD_NAME = 'lay' //模块名 @@ -62,59 +783,37 @@ }; //lay 模块版本 - lay.v = '1.0.6'; + lay.v = '1.0.7'; //ie版本 lay.ie = function(){ var agent = navigator.userAgent.toLowerCase(); return (!!window.ActiveXObject || "ActiveXObject" in window) ? ( - (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识 + (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于 ie11 并没有 msie 的标识 ) : false; }(); - //获取当前 JS 所在目录 - lay.getPath = function(){ - var jsPath = document.currentScript ? document.currentScript.src : function(){ - var js = document.scripts - ,last = js.length - 1 - ,src; - for(var i = last; i > 0; i--){ - if(js[i].readyState === 'interactive'){ - src = js[i].src; - break; - } - } - return src || js[last].src; - }(); - return jsPath.substring(0, jsPath.lastIndexOf('/') + 1); - } - //中止冒泡 - lay.stope = function(e){ - e = e || window.event; - e.stopPropagation - ? e.stopPropagation() - : e.cancelBubble = true; - }; - //对象遍历 - lay.each = function(obj, fn){ - var key - ,that = this; - if(typeof fn !== 'function') return that; - obj = obj || []; - if(obj.constructor === Object){ - for(key in obj){ - if(fn.call(obj[key], key, obj[key])) break; - } - } else { - for(key = 0; key < obj.length; key++){ - if(fn.call(obj[key], key, obj[key])) break; - } - } - return that; + + + + /** + * 获取 layui 常见方法,以便用于组件单独版 + */ + + lay.layui = layui; + lay.getPath = layui.cache.dir; //获取当前 JS 所在目录 + lay.stope = layui.stope; //中止冒泡 + lay.each = function(){ //遍历 + layui.each.apply(layui, arguments); + return this; }; + + + + //数字前置补零 lay.digit = function(num, length, end){ var str = ''; @@ -134,62 +833,7 @@ }); return elem; }; - - //获取节点的 style 属性值 - lay.getStyle = function(node, name){ - var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null); - return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name); - }; - - //载入 CSS 依赖 - lay.link = function(href, fn, cssname){ - var head = document.getElementsByTagName("head")[0] - ,link = document.createElement('link'); - - if(typeof fn === 'string') cssname = fn; - - var app = (cssname || href).replace(/\.|\//g, ''); - var id = 'layuicss-'+ app - ,STAUTS_NAME = 'creating' - ,timeout = 0; - - - - link.rel = 'stylesheet'; - link.href = href; - link.id = id; - - if(!document.getElementById(id)){ - head.appendChild(link); - } - if(typeof fn !== 'function') return; - - //轮询 css 是否加载完毕 - (function poll(status) { - var delay = 100 - ,getLinkElem = document.getElementById(id); //获取动态插入的 link 元素 - - //如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范 - if(++timeout > 10 * 1000 / delay){ - return window.console && console.error(app +'.css: Invalid'); - }; - - //css 加载就绪 - if(parseInt(lay.getStyle(getLinkElem, 'width')) === 1989){ - //如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态 - if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status'); - //如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调 - getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn(); - } else { - getLinkElem.setAttribute('lay-status', STAUTS_NAME); - setTimeout(function(){ - poll(STAUTS_NAME); - }, delay); - } - }()); - }; - //当前页面是否存在滚动条 lay.hasScrollbar = function(){ return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight); @@ -488,19 +1132,16 @@ }); } -}(); +}(window, window.document); -/*! - * layDate 日期与时间控件 - * MIT Licensed - */ +/*! layDate 日期与时间控件 | MIT Licensed */ -;!function(window){ +;!function(window, document){ "use strict"; var isLayui = window.layui && layui.define, ready = { - getPath: (window.lay && lay.getPath) ? lay.getPath() : '' + getPath: (window.lay && lay.getPath) ? lay.getPath : '' //载入 CSS 依赖 ,link: function(href, fn, cssname){ @@ -509,8 +1150,8 @@ if(!laydate.path) return; //加载 css - if(window.lay && lay.link){ - lay.link(laydate.path + href, fn, cssname); + if(window.lay && lay.layui){ + lay.layui.link(laydate.path + href, fn, cssname); } } } @@ -520,7 +1161,7 @@ //外部调用 ,laydate = { - v: '5.3.0' + v: '5.3.1' //layDate 版本号 ,config: {} //全局配置项 ,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,path: GLOBAL.laydate_dir || ready.getPath @@ -1173,7 +1814,7 @@ } }; getEndDate(); - + if(typeof value === 'string' && value){ if(that.EXP_IF.test(value)){ //校验日期格式 if(options.range){ @@ -1552,13 +2193,7 @@ //如果为年月选择器,点击了年列表,则切换到月选择器 if(options.type === 'month' && type === 'year'){ that.listYM[index][0] = ym; - if(isAlone){ - if(index){ - dateTime.year = ym; - } else { - that.endDate.year = ym; - } - } + isAlone && ((index ? that.endDate : dateTime).year = ym); that.list('month', index); } } else { @@ -2174,5 +2809,5 @@ }() ); -}(window); +}(window, window.document);