This commit is contained in:
sentsin
2017-10-30 15:03:16 +08:00
parent 364fdeffc9
commit 8ccb98f6cd
41 changed files with 228 additions and 79 deletions

View File

@@ -22,11 +22,11 @@ pre{white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; w
/** 图标字体 **/
@font-face {font-family: 'layui-icon';
src: url('../font/iconfont.eot?v=213');
src: url('../font/iconfont.eot?v=213#iefix') format('embedded-opentype'),
url('../font/iconfont.svg?v=213#iconfont') format('svg'),
url('../font/iconfont.woff?v=213') format('woff'),
url('../font/iconfont.ttf?v=213') format('truetype');
src: url('../font/iconfont.eot?v=220');
src: url('../font/iconfont.eot?v=220#iefix') format('embedded-opentype'),
url('../font/iconfont.svg?v=220#iconfont') format('svg'),
url('../font/iconfont.woff?v=220') format('woff'),
url('../font/iconfont.ttf?v=220') format('truetype');
}
.layui-icon{
@@ -274,6 +274,11 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-progress-text{position: relative; top: -18px; line-height: 18px; font-size: 12px; color: #666}
.layui-progress-big .layui-progress-text{position: static; padding: 0 10px; color: #fff;}
/* 卡片面板 */
.layui-card{margin-bottom: 15px; border-radius: 2px; background-color: #fff; box-shadow: 0 1px 2px 0 rgba(0,0,0,.05);}
.layui-card-header{position: relative; height: 42px; line-height: 42px; padding: 0 15px; border-bottom: 1px dotted #E9E9E9; color: #333; border-radius: 2px 2px 0 0; font-size: 14px;}
.layui-card-body{padding: 10px 15px; line-height: 24px;}
/* 折叠面板 */
.layui-collapse{border: 1px solid #e2e2e2; border-radius: 2px;}
.layui-colla-item{border-top: 1px solid #e2e2e2}
@@ -675,9 +680,9 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-nav-img{width: 30px; height: 30px; margin-right: 10px; border-radius: 50%;}
.layui-nav .layui-nav-more{content:''; width: 0; height: 0; border-style: dashed; border-color: transparent; overflow: hidden; cursor: pointer; transition: all .2s; -webkit-transition: all .2s;}
.layui-nav .layui-nav-more{position: absolute; top: 28px; right: 3px; border-width: 6px; border-top-style: solid; border-top-color: #fff; border-top-color: rgba(255,255,255,.7);}
.layui-nav .layui-nav-more{position: absolute; top: 50%; right: 3px; margin-top: -3px; border-width: 6px; border-top-style: solid; border-top-color: #fff; border-top-color: rgba(255,255,255,.7);}
.layui-nav .layui-nav-mored,
.layui-nav-itemed .layui-nav-more{top: 22px; border-style: dashed; border-color: transparent; border-bottom-style: solid; border-bottom-color: #fff;}
.layui-nav-itemed .layui-nav-more{margin-top: -9px; border-style: dashed; border-color: transparent; border-bottom-style: solid; border-bottom-color: #fff;}
.layui-nav-child{display: none; position: absolute; left: 0; top: 65px; min-width: 100%; line-height: 36px; padding: 5px 0; box-shadow: 0 2px 4px rgba(0,0,0,.12); border: 1px solid #d2d2d2; background-color: #fff; z-index: 100; border-radius: 2px; white-space: nowrap;}
.layui-nav .layui-nav-child a{color: #333;}
@@ -689,7 +694,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
/* 垂直导航菜单 */.layui-nav-tree{width: 200px; padding: 0;}
.layui-nav-tree .layui-nav-item{display: block; width: 100%; line-height: 45px;}
.layui-nav-tree .layui-nav-item a{height: 45px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
.layui-nav-tree .layui-nav-item a{height: 45px; line-height: 45px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
.layui-nav-tree .layui-nav-item a:hover{background-color: #4E5465;}
.layui-nav-tree .layui-nav-bar{width: 5px; height: 0;}
.layui-nav-tree .layui-this,
@@ -708,7 +713,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-nav-tree .layui-nav-child a{color: #fff; color: rgba(255,255,255,.7);}
.layui-nav-tree .layui-nav-child a:hover,
.layui-nav-tree .layui-nav-child{background: none; color: #fff;}
.layui-nav-tree .layui-nav-more{top: 20px; right: 10px;}
.layui-nav-tree .layui-nav-more{top: 20px; right: 10px; margin: 0;}
.layui-nav-itemed .layui-nav-more{top: 14px;}
.layui-nav-itemed .layui-nav-child{display: block; padding: 0; background-color: rgba(0,0,0,.3) !important;}
@@ -903,6 +908,18 @@ body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; co
}
.layui-anim-upbit{-webkit-animation-name: layui-upbit; animation-name: layui-upbit;}
@-webkit-keyframes layui-movey{ /* 垂直位移 */
0% {-webkit-transform: translate3d(0, 50px, 0);}
50% {-webkit-transform: translate3d(0, -50px, 0);}
100% {-webkit-transform: translate3d(0, 50px, 0);}
}
@keyframes layui-movey{
0% {transform: translate3d(0, 50px, 0);}
50% {transform: translate3d(0, -50px, 0);}
100% {transform: translate3d(0, 50px, 0);}
}
.layui-anim-movey{-webkit-animation-name: layui-movey; animation-name: layui-movey;}
@-webkit-keyframes layui-scale { /* 放大 */
0% {opacity: 0.3; -webkit-transform: scale(.5);}
100% {opacity: 1; -webkit-transform: scale(1);}

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 202 KiB

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -66,6 +66,16 @@ layui.define('jquery', function(exports){
return this;
};
//自定义Tab选项卡
Element.prototype.tab = function(options){
options = options || {};
dom.on('click', options.headerElem, function(e){
var index = $(this).index();
call.tabClick.call(this, e, index, null, options);
});
};
//动态改变进度条
Element.prototype.progress = function(filter, percent){
var ELEM = 'layui-progress'
@@ -84,11 +94,12 @@ layui.define('jquery', function(exports){
//基础事件体
,call = {
//Tab点击
tabClick: function(e, index, liElem){
tabClick: function(e, index, liElem, options){
options = options || {};
var othis = liElem || $(this)
,index = index || othis.parent().children('li').index(othis)
,parents = othis.parents('.layui-tab').eq(0)
,item = parents.children('.layui-tab-content').children('.layui-tab-item')
,parents = options.headerElem ? othis.parent() : othis.parents('.layui-tab').eq(0)
,item = $(options.bodyElem) || parents.children('.layui-tab-content').children('.layui-tab-item')
,elemA = othis.find('a')
,filter = parents.attr('lay-filter');
@@ -105,9 +116,10 @@ layui.define('jquery', function(exports){
//Tab删除
,tabDelete: function(e, othis){
var li = othis || $(this).parent(), index = li.index();
var parents = li.parents('.layui-tab').eq(0);
var item = parents.children('.layui-tab-content').children('.layui-tab-item')
var li = othis || $(this).parent(), index = li.index()
,parents = li.parents('.layui-tab').eq(0)
,item = parents.children('.layui-tab-content').children('.layui-tab-item')
,filter = parents.attr('lay-filter');
if(li.hasClass(THIS)){
if(li.next()[0]){
@@ -122,6 +134,11 @@ layui.define('jquery', function(exports){
setTimeout(function(){
call.tabAuto();
}, 50);
layui.event.call(this, MOD_NAME, 'tabDelete('+ filter +')', {
elem: parents
,index: index
});
}
//Tab自适应
@@ -180,11 +197,12 @@ layui.define('jquery', function(exports){
,clickThis: function(){
var othis = $(this), parents = othis.parents(NAV_ELEM)
,filter = parents.attr('lay-filter')
,elemA = othis.find('a');
,elemA = othis.find('a')
,unselect = typeof othis.attr('lay-unselect') === 'string';
if(othis.find('.'+NAV_CHILD)[0]) return;
if(!(elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank')){
if(!(elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank') && !unselect){
parents.find('.'+THIS).removeClass(THIS);
othis.addClass(THIS);
}
@@ -234,8 +252,10 @@ layui.define('jquery', function(exports){
};
//初始化元素操作
Element.prototype.init = function(type){
var that = this, items = {
Element.prototype.init = function(type, filter){
var that = this, elemFilter = function(){
return filter ? ('[lay-filter="' + filter +'"]') : '';
}(), items = {
//Tab选项卡
tab: function(){
@@ -278,7 +298,7 @@ layui.define('jquery', function(exports){
}
}
$(NAV_ELEM).each(function(index){
$(NAV_ELEM + elemFilter).each(function(index){
var othis = $(this)
,bar = $('<span class="'+ NAV_BAR +'"></span>')
,itemElem = othis.find('.'+NAV_ITEM);
@@ -337,7 +357,7 @@ layui.define('jquery', function(exports){
,breadcrumb: function(){
var ELEM = '.layui-breadcrumb';
$(ELEM).each(function(){
$(ELEM + elemFilter).each(function(){
var othis = $(this)
,separator = othis.attr('lay-separator') || '>'
,aNode = othis.find('a');
@@ -354,7 +374,7 @@ layui.define('jquery', function(exports){
,progress: function(){
var ELEM = 'layui-progress';
$('.'+ELEM).each(function(){
$('.' + ELEM + elemFilter).each(function(){
var othis = $(this)
,elemBar = othis.find('.layui-progress-bar')
,width = elemBar.attr('lay-percent');
@@ -373,7 +393,7 @@ layui.define('jquery', function(exports){
,collapse: function(){
var ELEM = 'layui-collapse';
$('.'+ELEM).each(function(){
$('.' + ELEM + elemFilter).each(function(){
var elemItem = $(this).find('.layui-colla-item')
elemItem.each(function(){
var othis = $(this)
@@ -393,13 +413,15 @@ layui.define('jquery', function(exports){
}
};
return layui.each(items, function(index, item){
return items[type] ? items[type]() : layui.each(items, function(index, item){
item();
});
};
Element.prototype.render = Element.prototype.init;
var element = new Element(), dom = $(document);
element.init();
element.render();
var TITLE = '.layui-tab-title li';
dom.on('click', TITLE, call.tabClick); //Tab切换

View File

@@ -51,15 +51,27 @@ layui.define(function(exports){
var that = this, tplog = tpl;
var jss = exp('^'+config.open+'#', ''), jsse = exp(config.close+'$', '');
tpl = tpl.replace(/\s+|\r|\t|\n/g, ' ').replace(exp(config.open+'#'), config.open+'# ')
tpl = tpl.replace(/\s+|\r|\t|\n/g, ' ')
.replace(exp(config.open+'#'), config.open+'# ')
.replace(exp(config.close+'}'), '} '+config.close).replace(/\\/g, '\\\\')
//不匹配指定区域的内容
.replace(exp(config.open + '!(.+?)!' + config.close), function(str){
str = str.replace(exp('^'+ config.open + '!'), '')
.replace(exp('!'+ config.close), '')
.replace(exp(config.open + '|' + config.close), function(tag){
return tag.replace(/(.)/g, '\\$1')
});
return str
})
//匹配JS规则内容
.replace(/(?="|')/g, '\\').replace(tool.query(), function(str){
str = str.replace(jss, '').replace(jsse, '');
return '";' + str.replace(/\\/g, '') + ';view+="';
})
//匹配普通字段
.replace(tool.query(1), function(str){
var start = '"+(';
if(str.replace(/\s/g, '') === config.open+config.close){

View File

@@ -95,13 +95,23 @@ layui.define('jquery', function(exports){
//某个时间在当前时间的多久前
,timeAgo: function(time, onlyDate){
var stamp = new Date().getTime() - new Date(time).getTime();
var arr = [[], []]
,stamp = new Date().getTime() - new Date(time).getTime();
//超过30天返回具体日期
if(stamp > 1000*60*60*24*30){
stamp = new Date(time).toLocaleString();
onlyDate && (stamp = stamp.replace(/\s[\S]+$/g, ''));
return stamp;
//返回具体日期
if(stamp > 1000*60*60*24*8){
stamp = new Date(time);
arr[0][0] = stamp.getFullYear();
arr[0][1] = stamp.getMonth() + 1;
arr[0][2] = stamp.getDate();
//是否输出时间
if(!onlyDate){
arr[1][0] = stamp.getHours();
arr[1][1] = stamp.getMinutes();
arr[1][2] = stamp.getSeconds();
}
return arr[0].join('-') + ' ' + arr[1].join(':');
}
//30天以内返回“多久前”
@@ -109,7 +119,7 @@ layui.define('jquery', function(exports){
return ((stamp/1000/60/60/24)|0) + '天前';
} else if(stamp >= 1000*60*60){
return ((stamp/1000/60/60)|0) + '小时前';
} else if(stamp >= 1000*60*3){ //3分钟以内为:刚刚
} else if(stamp >= 1000*60*2){ //2分钟以内为:刚刚
return ((stamp/1000/60)|0) + '分钟前';
} else if(stamp < 0){
return '未来';

View File

@@ -19,7 +19,7 @@
}
,Layui = function(){
this.v = '2.1.5'; //版本号
this.v = '2.1.6'; //版本号
}
//获取layui所在目录