Browse Source

upgrade

pull/196/head
sentsin 7 years ago
parent
commit
9a2400a07a
  1. 31
      gulpfile.js
  2. 2
      package.json
  3. 68
      src/css/layui.css
  4. BIN
      src/font/iconfont.eot
  5. 44
      src/font/iconfont.svg
  6. BIN
      src/font/iconfont.ttf
  7. BIN
      src/font/iconfont.woff
  8. 79
      src/lay/modules/element.js
  9. 1
      src/lay/modules/table.js
  10. 1
      src/lay/modules/upload.js
  11. 5
      src/layui.js

31
gulpfile.js

@ -36,9 +36,15 @@ var argv = require('minimist')(process.argv.slice(2), {
,releaseDir = './release/zip/layui-v' + pkg.version
,release = releaseDir + '/layui'
//目标木
,destDir = function(ver){
return ver ? release : function(){
return argv.rc ? 'rc' : 'dist'
}();
}
//任务
,task = {
//压缩js模块
minjs: function(ver) {
ver = ver === 'open';
@ -54,7 +60,7 @@ var argv = require('minimist')(process.argv.slice(2), {
,'!./src/lay/all.js'
,'!./src/lay/all-mobile.js'
]
,dir = ver ? release : 'dist';
,dir = destDir(ver);
//过滤 layim
if(ver || argv.open){
@ -64,7 +70,6 @@ var argv = require('minimist')(process.argv.slice(2), {
return gulp.src(src).pipe(uglify())
.pipe(header.apply(null, note))
.pipe(gulp.dest('./'+ dir));
}
//打包PC合并版JS,即包含layui.js和所有模块的合并
@ -75,7 +80,7 @@ var argv = require('minimist')(process.argv.slice(2), {
'./src/**/{layui,all,'+ mods +'}.js'
,'!./src/**/mobile/*.js'
]
,dir = ver ? release : 'dist';
,dir = destDir(ver);
return gulp.src(src).pipe(uglify())
.pipe(concat('layui.all.js', {newLine: ''}))
@ -92,7 +97,7 @@ var argv = require('minimist')(process.argv.slice(2), {
,'./src/lay/modules/laytpl.js'
,'./src/**/mobile/{'+ mods +'}.js'
]
,dir = ver ? release : 'dist';
,dir = destDir(ver);
if(ver || argv.open){
src.push('./src/**/mobile/layim-mobile-open.js');
@ -115,7 +120,7 @@ var argv = require('minimist')(process.argv.slice(2), {
'./src/css/**/*.css'
,'!./src/css/**/font.css'
]
,dir = ver ? release : 'dist'
,dir = destDir(ver)
,noteNew = JSON.parse(JSON.stringify(note));
if(ver || argv.open){
@ -134,7 +139,7 @@ var argv = require('minimist')(process.argv.slice(2), {
,font: function(ver){
ver = ver === 'open';
var dir = ver ? release : 'dist';
var dir = destDir(ver);
return gulp.src('./src/font/*')
.pipe(rename({}))
@ -146,7 +151,7 @@ var argv = require('minimist')(process.argv.slice(2), {
ver = ver === 'open';
var src = ['./src/**/*.{png,jpg,gif,html,mp3,json}']
,dir = ver ? release : 'dist';
,dir = destDir(ver);
if(ver || argv.open){
src.push('!./src/**/layim/**/*.*');
@ -165,7 +170,7 @@ var argv = require('minimist')(process.argv.slice(2), {
//清理
gulp.task('clear', function(cb) {
return del(['./dist/*'], cb);
return del(['./'+ (argv.rc ? 'rc' : 'dist') +'/*'], cb);
});
gulp.task('clearRelease', function(cb) {
return del([releaseDir], cb);
@ -179,15 +184,15 @@ gulp.task('font', task.font);
gulp.task('mv', task.mv);
gulp.task('release', task.release);
//发行版
gulp.task('default', ['clearRelease'], function(){ //命令:gulp
//发行版 gulp
gulp.task('default', ['clearRelease'], function(){
for(var key in task){
task[key]('open');
}
});
//完整任务
gulp.task('all', ['clear'], function(){ //命令:gulp all,过滤layim:gulp all --open
//完整任务 gulp all
gulp.task('all', ['clear'], function(){ //过滤 layim:gulp all --open、rc 版:gulp all --rc
for(var key in task){
task[key]();
}

2
package.json

@ -1,7 +1,7 @@
{
"name": "layui-src",
"realname": "layui",
"version": "2.2.5",
"version": "2.2.6",
"independents": {
"layim": "3.7.6"
},

68
src/css/layui.css

@ -46,11 +46,11 @@ a cite{font-style: normal; *cursor:pointer;}
/** 图标字体 **/
@font-face {font-family: 'layui-icon';
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');
src: url('../font/iconfont.eot?v=226_rc2');
src: url('../font/iconfont.eot?v=226_rc2#iefix') format('embedded-opentype'),
url('../font/iconfont.svg?v=226_rc2#iconfont') format('svg'),
url('../font/iconfont.woff?v=226_rc2') format('woff'),
url('../font/iconfont.ttf?v=226_rc2') format('truetype');
}
.layui-icon{
@ -76,9 +76,9 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-yinqing:before { content: "\e628"; }
.layui-icon-yuejuancuohao:before { content: "\1006"; }
.layui-icon-close:before { content: "\1006"; }
.layui-icon-cuo:before { content: "\1007"; }
.layui-icon-close-fill:before { content: "\1007"; }
.layui-icon-baobiao:before { content: "\e629"; }
@ -94,7 +94,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-tubiao:before { content: "\e62c"; }
.layui-icon-right:before { content: "\1005"; }
.layui-icon-ok-circle:before { content: "\1005"; }
.layui-icon-huanfu2:before { content: "\e61b"; }
@ -102,9 +102,9 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-biaoge:before { content: "\e62d"; }
.layui-icon-youyou:before { content: "\e602"; }
.layui-icon-right:before { content: "\e602"; }
.layui-icon-zuozuo:before { content: "\e603"; }
.layui-icon-left:before { content: "\e603"; }
.layui-icon-cart-simple:before { content: "\e698"; }
@ -120,7 +120,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-tianjia:before { content: "\e61f"; }
.layui-icon-xiazai:before { content: "\e601"; }
.layui-icon-download-circle:before { content: "\e601"; }
.layui-icon-xuanzemoban48:before { content: "\e630"; }
@ -132,7 +132,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-speaker:before { content: "\e645"; }
.layui-icon-xiangxia:before { content: "\e61a"; }
.layui-icon-down:before { content: "\e61a"; }
.layui-icon-wenjian:before { content: "\e621"; }
@ -156,13 +156,15 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-jinshui:before { content: "\e636"; }
.layui-icon-username:before { content: "\e66f"; }
.layui-icon-find-fill:before { content: "\e670"; }
.layui-icon-about:before { content: "\e60b"; }
.layui-icon-location:before { content: "\e715"; }
.layui-icon-xiangshang:before { content: "\e619"; }
.layui-icon-up:before { content: "\e619"; }
.layui-icon-pause:before { content: "\e651"; }
@ -178,6 +180,8 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-haoyouqingqiu:before { content: "\e612"; }
.layui-icon-refresh-3:before { content: "\e9aa"; }
.layui-icon-weibiaoti1:before { content: "\e605"; }
.layui-icon-chuangkou:before { content: "\e638"; }
@ -292,10 +296,14 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-notice:before { content: "\e667"; }
.layui-icon-login-weibo:before { content: "\e675"; }
.layui-icon-voice:before { content: "\e688"; }
.layui-icon-download:before { content: "\e681"; }
.layui-icon-login-qq:before { content: "\e676"; }
.layui-icon-snowflake:before { content: "\e6b1"; }
.layui-icon-yemian1:before { content: "\e655"; }
@ -308,16 +316,18 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-app:before { content: "\e653"; }
.layui-icon-xiayiye:before { content: "\e65a"; }
.layui-icon-prev:before { content: "\e65a"; }
.layui-icon-website:before { content: "\e7ae"; }
.layui-icon-xiayiye1:before { content: "\e65b"; }
.layui-icon-next:before { content: "\e65b"; }
.layui-icon-component:before { content: "\e857"; }
.layui-icon-more:before { content: "\e65f"; }
.layui-icon-login-wechat:before { content: "\e677"; }
.layui-icon-shrink-right:before { content: "\e668"; }
.layui-icon-spread-left:before { content: "\e66b"; }
@ -332,6 +342,8 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-nan:before { content: "\e662"; }
.layui-icon-password:before { content: "\e673"; }
.layui-icon-senior:before { content: "\e674"; }
.layui-icon-theme:before { content: "\e66a"; }
@ -346,13 +358,18 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-loading-2:before { content: "\e66d"; }
.layui-icon-vercode:before { content: "\e679"; }
.layui-icon-cellphone:before { content: "\e678"; }
/* 基本布局 */
.layui-main{position: relative; width: 1140px; margin: 0 auto;}
.layui-header{position: relative; z-index: 1000; height: 60px;}
.layui-header a:hover{transition: all .5s; -webkit-transition: all .5s;}
.layui-side{position: fixed; top: 0; bottom: 0; z-index: 999; width: 200px; overflow-x: hidden;}
.layui-side-scroll{width: 220px; height: 100%; overflow-x: hidden;}
.layui-side{position: fixed; left: 0; top: 0; bottom: 0; z-index: 999; width: 200px; overflow-x: hidden;}
.layui-side-scroll{position: relative; width: 220px; height: 100%; overflow-x: hidden;}
.layui-body{position: absolute; left: 200px; right: 0; top: 0; bottom: 0; z-index: 998; width: auto; overflow: hidden; overflow-y: auto; box-sizing: border-box;}
/* 后台框架大布局 */.layui-layout-body{overflow: hidden;}
@ -576,7 +593,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-colla-item,
.layui-colla-content{border-top-width: 1px; border-top-style: solid;}
.layui-colla-item:first-child{border-top: none;}
.layui-colla-title{position: relative; height: 42px; line-height: 42px; padding: 0 15px 0 35px; color: #333; background-color: #f2f2f2; cursor: pointer; font-size: 14px;}
.layui-colla-title{position: relative; height: 42px; line-height: 42px; padding: 0 15px 0 35px; color: #333; background-color: #f2f2f2; cursor: pointer; font-size: 14px; overflow: hidden;}
.layui-colla-content{display: none; padding: 10px 15px; line-height: 22px; color: #666;}
.layui-colla-icon{position: absolute; left: 15px; top: 0; font-size: 14px;}
@ -585,6 +602,8 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-card:last-child{margin-bottom: 0;}
.layui-card-header{position: relative; height: 42px; line-height: 42px; padding: 0 15px; border-bottom: 1px solid #f6f6f6; color: #333; border-radius: 2px 2px 0 0; font-size: 14px;}
.layui-card-body{position: relative; padding: 10px 15px; line-height: 24px;}
.layui-card-body[pad15]{padding: 15px;}
.layui-card-body[pad20]{padding: 20px;}
.layui-card-body .layui-table{margin: 5px 0;}
.layui-card .layui-tab{margin: 0;}
@ -1049,7 +1068,8 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.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: 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{margin-top: -9px; border-style: dashed; border-color: transparent; border-bottom-style: solid; border-bottom-color: #fff;}
.layui-nav-itemed > a .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;}
@ -1061,7 +1081,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; line-height: 45px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
.layui-nav-tree .layui-nav-item a{position: relative; 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,
@ -1080,9 +1100,10 @@ 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; 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;}
.layui-nav-tree .layui-nav-more{right: 10px;}
.layui-nav-itemed>.layui-nav-child{display: block; padding: 0; background-color: rgba(0,0,0,.3) !important;}
.layui-nav-itemed>.layui-nav-child>.layui-this>.layui-nav-child{display: block;}
/* 侧边 */.layui-nav-side{position: fixed; top: 0; bottom: 0; left: 0; overflow-x: hidden; z-index: 999;}
@ -1244,6 +1265,7 @@ body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; co
.layui-anim{-webkit-animation-duration: 0.3s; animation-duration: 0.3s; -webkit-animation-fill-mode: both; animation-fill-mode: both;}
.layui-anim.layui-icon{display: inline-block;}
.layui-anim-loop{-webkit-animation-iteration-count: infinite; animation-iteration-count: infinite;}
.layui-trans,.layui-trans a{transition: all .3s; -webkit-transition: all .3s;} /* 过度变换 */
@-webkit-keyframes layui-rotate{ /* 循环旋转 */
from {-webkit-transform: rotate(0deg);}

BIN
src/font/iconfont.eot

Binary file not shown.

44
src/font/iconfont.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 231 KiB

After

Width:  |  Height:  |  Size: 269 KiB

BIN
src/font/iconfont.ttf

Binary file not shown.

BIN
src/font/iconfont.woff

Binary file not shown.

79
src/lay/modules/element.js

@ -38,7 +38,9 @@ layui.define('jquery', function(exports){
,titElem = tabElem.children(TITLE)
,barElem = titElem.children('.layui-tab-bar')
,contElem = tabElem.children('.layui-tab-content')
,li = '<li lay-id="'+ (options.id||'') +'">'+ (options.title||'unnaming') +'</li>';
,li = '<li lay-id="'+ (options.id||'') +'"'
+(options.attr ? ' lay-attr="'+ options.attr +'"' : '') +'>'+ (options.title||'unnaming') +'</li>';
barElem[0] ? barElem.before(li) : titElem.append(li);
contElem.append('<div class="layui-tab-item">'+ (options.content||'') +'</div>');
call.hideTabMore(true);
@ -152,7 +154,7 @@ layui.define('jquery', function(exports){
,item = othis.children('.layui-tab-content').children('.layui-tab-item')
,STOPE = 'lay-stope="tabmore"'
,span = $('<span class="layui-unselect layui-tab-bar" '+ STOPE +'><i '+ STOPE +' class="layui-icon">&#xe61a;</i></span>');
if(that === window && device.ie != 8){
call.hideTabMore(true)
}
@ -169,6 +171,8 @@ layui.define('jquery', function(exports){
});
}
if(typeof othis.attr('lay-unauto') === 'string') return;
//响应式
if(title.prop('scrollWidth') > title.outerWidth()+1){
if(title.find('.'+BAR)[0]) return;
@ -193,7 +197,8 @@ layui.define('jquery', function(exports){
}
}
//点击选中导航菜单
//点击一级菜单
/*
,clickThis: function(){
var othis = $(this), parents = othis.parents(NAV_ELEM)
,filter = parents.attr('lay-filter')
@ -209,7 +214,43 @@ layui.define('jquery', function(exports){
layui.event.call(this, MOD_NAME, 'nav('+ filter +')', othis);
}
)
*/
//点击菜单 - a标签触发
,clickThis: function(){
var othis = $(this)
,parents = othis.parents(NAV_ELEM)
,filter = parents.attr('lay-filter')
,parent = othis.parent()
,child = othis.siblings('.'+NAV_CHILD)
,unselect = typeof parent.attr('lay-unselect') === 'string';
if(!(othis.attr('href') !== 'javascript:;' && othis.attr('target') === '_blank') && !unselect){
if(!child[0]){
parents.find('.'+THIS).removeClass(THIS);
parent.addClass(THIS);
}
}
//如果是垂直菜单
if(parents.hasClass(NAV_TREE)){
child.removeClass(NAV_ANIM);
//如果有子菜单,则展开
if(child[0]){
parent[child.css('display') === 'none' ? 'addClass': 'removeClass'](NAV_ITEM+'ed');
if(parents.attr('lay-shrink') === 'all'){
parent.siblings().removeClass(NAV_ITEM + 'ed');
}
}
}
layui.event.call(this, MOD_NAME, 'nav('+ filter +')', othis);
}
//点击子菜单选中
/*
,clickChild: function(){
var othis = $(this), parents = othis.parents(NAV_ELEM)
,filter = parents.attr('lay-filter');
@ -217,15 +258,7 @@ layui.define('jquery', function(exports){
othis.addClass(THIS);
layui.event.call(this, MOD_NAME, 'nav('+ filter +')', othis);
}
//展开二级菜单
,showChild: function(){
var othis = $(this), parents = othis.parents(NAV_ELEM);
var parent = othis.parent(), child = othis.siblings('.'+NAV_CHILD);
if(parents.hasClass(NAV_TREE)){
child.removeClass(NAV_ANIM);
parent[child.css('display') === 'none' ? 'addClass': 'removeClass'](NAV_ITEM+'ed');
}
}
*/
//折叠面板
,collapse: function(){
@ -234,12 +267,14 @@ layui.define('jquery', function(exports){
,parents = othis.parents('.layui-collapse').eq(0)
,filter = parents.attr('lay-filter')
,isNone = elemCont.css('display') === 'none';
//是否手风琴
if(typeof parents.attr('lay-accordion') === 'string'){
var show = parents.children('.layui-colla-item').children('.'+SHOW);
show.siblings('.layui-colla-title').children('.layui-colla-icon').html('&#xe602;');
show.removeClass(SHOW);
}
elemCont[isNone ? 'addClass' : 'removeClass'](SHOW);
icon.html(isNone ? '&#xe61a;' : '&#xe602;');
@ -270,7 +305,7 @@ layui.define('jquery', function(exports){
if(nav.hasClass(NAV_TREE)){
bar.css({
top: othis.position().top
,height: othis.children('a').height()
,height: othis.children('a').outerHeight()
,opacity: 1
});
} else {
@ -337,18 +372,18 @@ layui.define('jquery', function(exports){
});
}
itemElem.each(function(){
var oitem = $(this), child = oitem.find('.'+NAV_CHILD);
//展开子菜单
itemElem.find('a').each(function(){
var thisA = $(this)
,parent = thisA.parent()
,child = thisA.siblings('.'+NAV_CHILD);
//二级菜单
if(child[0] && !oitem.find('.'+NAV_MORE)[0]){
var one = oitem.children('a');
one.append('<span class="'+ NAV_MORE +'"></span>');
//输出小箭头
if(child[0] && !thisA.children('.'+NAV_MORE)[0]){
thisA.append('<span class="'+ NAV_MORE +'"></span>');
}
oitem.off('click', call.clickThis).on('click', call.clickThis); //点击选中
oitem.children('a').off('click', call.showChild).on('click', call.showChild); //展开二级菜单
child.children('dd').off('click', call.clickChild).on('click', call.clickChild); //点击子菜单选中
thisA.off('click', call.clickThis).on('click', call.clickThis); //点击菜单
});
});
}

1
src/lay/modules/table.js

@ -417,6 +417,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
,url: options.url
,data: $.extend(params, options.where)
,dataType: 'json'
,headers: options.headers || {}
,success: function(res){
if(res[response.statusName] != response.statusCode){
that.renderForm();

1
src/lay/modules/upload.js

@ -207,6 +207,7 @@ layui.define('layer' , function(exports){
,contentType: false
,processData: false
,dataType: 'json'
,headers: options.headers || {}
,success: function(res){
successful++;
done(index, res);

5
src/layui.js vendored

@ -19,7 +19,7 @@
}
,Layui = function(){
this.v = '2.2.5'; //版本号
this.v = '2.2.6'; //版本号
}
//获取layui所在目录
@ -330,7 +330,8 @@
};
if(!/^#\//.test(hash)) return data; //禁止非路由规范
data.href = hash = hash.replace(/^#\//, '');
hash = hash.replace(/^#\//, '');
data.href = '/' + hash;
hash = hash.replace(/([^#])(#.*$)/, '$1').split('/') || [];
//提取Hash结构

Loading…
Cancel
Save