Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sentsim committed Mar 31, 2021
1 parent e5ea1fe commit 2705982
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 32 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "layui",
"main": "dist/layui.js",
"version": "2.6.0",
"version": "2.6.1",
"homepage": "https://github.com/sentsin/layui",
"authors": [
"sentsin <xu@sentsin.com>"
Expand Down
2 changes: 1 addition & 1 deletion dist/css/layui.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/layui.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions examples/laydate.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@
<script>

layui.use('laydate', function(laydate){

//全局配置
laydate.set({
//trigger: 'focus'
})

//双控件
laydate.render({
Expand Down
28 changes: 22 additions & 6 deletions examples/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
<button class="layui-btn layui-btn-sm" lay-event="getData">获取当前页所有数据</button>
<button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
<button class="layui-btn layui-btn-sm" lay-event="reload">重载</button>
<button class="layui-btn layui-btn-sm" lay-event="reload2">重载2</button>
<button class="layui-btn layui-btn-sm" lay-event="reload">重载(保留初始参数)</button>
<button class="layui-btn layui-btn-sm" lay-event="reload2">重载(不保留初始参数)</button>
</div>
</script>

Expand Down Expand Up @@ -179,12 +179,20 @@
</table>
</div>

<script src="../src/layui.js" src="//www.layuicdn.com/layui-v2.0.1/layui.js" charset="utf-8"></script>
<script src="../src/layui.js" src1="//www.layuicdn.com/layui-v2.0.1/layui.js" charset="utf-8"></script>
<script>
layui.use('table', function(){
var table = layui.table;
//return;

//全局设定某参数
table.set({
where: {
token: '全局 token 参数'
}
//,height: 300
});

//渲染
window.ins1 = table.render({
elem: '#test'
Expand Down Expand Up @@ -228,6 +236,14 @@
field: 'experience' //排序字段,对应 cols 设定的各字段名
,type: 'desc' //排序方式 asc: 升序、desc: 降序、null: 默认排序
}

,where: {
test: '初始 test 参数'
}

,error: function(res, msg){
console.log(res, msg)
}


/*
Expand Down Expand Up @@ -299,17 +315,17 @@
table.reload('test', {
page: {curr: 5, limit: 10}
,where: {
a: 123
abc: 123
}
,cols: ins1.config.cols
//,height: 300
//,url: 'x'
});
}, true);
break;
case 'reload2':
table.reload('test', {
where: {
token: 'sasasas'
efg: 'sasasas'
}
,cols: [[
{type: 'checkbox', fixed: 'left'}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "layui-src",
"realname": "layui",
"version": "2.6.0",
"version": "2.6.1",
"description": "Classic modular front-end component library",
"main": "dist/layui.js",
"license": "MIT",
Expand Down
21 changes: 11 additions & 10 deletions src/css/layui.css
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,15 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-header a:hover{transition: all .5s; -webkit-transition: all .5s;}
.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-body{position: absolute; left: 200px; right: 0; top: 0; bottom: 0; z-index: 900; width: auto; overflow: hidden; overflow-y: auto; box-sizing: border-box;}

/* 后台框架大布局 */
.layui-layout-body{overflow: hidden;}
.layui-layout-admin .layui-header{background-color: #23262E;}
.layui-layout-body{overflow-x: hidden;}
.layui-layout-admin .layui-header{position: fixed; top: 0; left: 0; right: 0; background-color: #23262E;}
.layui-layout-admin .layui-side{top: 60px; width: 200px; overflow-x: hidden;}
.layui-layout-admin .layui-body{position: fixed; top: 60px; bottom: 44px;}
.layui-layout-admin .layui-body{bottom: auto; padding-bottom: 44px;}
.layui-layout-admin .layui-main{width: auto; margin: 0 15px;}
.layui-layout-admin .layui-footer{position: fixed; left: 200px; right: 0; bottom: 0; height: 44px; line-height: 44px; padding: 0 15px; background-color: #eee;}
.layui-layout-admin .layui-footer{position: fixed; left: 200px; right: 0; bottom: 0; z-index: 990; height: 44px; line-height: 44px; padding: 0 15px; background-color: #eee;}
.layui-layout-admin .layui-logo{position: absolute; left: 0; top: 0; width: 200px; height: 100%; line-height: 60px; text-align: center; color: #009688; font-size: 16px;}
.layui-layout-admin .layui-header .layui-nav{background: none;}
.layui-layout-left{position: absolute !important; left: 200px; top: 0;}
Expand Down Expand Up @@ -597,7 +597,7 @@ a cite{font-style: normal; *cursor:pointer;}
*/

.layui-btn{display: inline-block; vertical-align: middle; height: 38px; line-height: 38px; padding: 0 18px; background-color: #009688; color: #fff; white-space: nowrap; text-align: center; font-size: 14px; border: none; border-radius: 2px; cursor: pointer; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;}
.layui-btn{display: inline-block; vertical-align: middle; height: 38px; line-height: 38px; padding: 0 18px; border: 1px solid transparent; background-color: #009688; color: #fff; white-space: nowrap; text-align: center; font-size: 14px; border-radius: 2px; cursor: pointer; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;}
.layui-btn:hover{opacity: 0.8; filter:alpha(opacity=80); color: #fff;}
.layui-btn:active{opacity: 1; filter:alpha(opacity=100);}
.layui-btn+.layui-btn{margin-left: 10px;}
Expand All @@ -612,13 +612,13 @@ a cite{font-style: normal; *cursor:pointer;}
/* 圆角 */.layui-btn-radius{border-radius: 100px;}
.layui-btn .layui-icon{padding: 0 2px; vertical-align: middle\0; vertical-align: bottom;}

/* 原始 */.layui-btn-primary{border: 1px solid #d2d2d2; background: none; color: #666;}
/* 原始 */.layui-btn-primary{border-color: #d2d2d2; background: none; color: #666;}
.layui-btn-primary:hover{border-color: #009688; color: #333;}
/* 百搭 */.layui-btn-normal{background-color: #1E9FFF;}
/* 暖色 */.layui-btn-warm{background-color: #FFB800;}
/* 警告 */.layui-btn-danger{background-color: #FF5722;}
/* 选中 */.layui-btn-checked{background-color: #5FB878;}
/* 禁用 */.layui-btn-disabled,.layui-btn-disabled:hover,.layui-btn-disabled:active{border: 1px solid #eee; background-color: #FBFBFB; color: #d2d2d2; cursor: not-allowed; opacity: 1;}
/* 禁用 */.layui-btn-disabled,.layui-btn-disabled:hover,.layui-btn-disabled:active{border-color: #eee; background-color: #FBFBFB; color: #d2d2d2; cursor: not-allowed; opacity: 1;}

/* 大型 */.layui-btn-lg{height: 44px; line-height: 44px; padding: 0 25px; font-size: 16px;}
/* 小型 */.layui-btn-sm{height: 30px; line-height: 30px; padding: 0 10px; font-size: 12px;}
Expand Down Expand Up @@ -1200,10 +1200,11 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-timeline-axis{position: absolute; left: -5px; top: 0; z-index: 10; width: 20px; height: 20px; line-height: 20px; background-color: #fff; color: #5FB878; border-radius: 50%; text-align: center; cursor: pointer;}
.layui-timeline-axis:hover{color: #FF5722;}
.layui-timeline-item:before{content: ""; position: absolute; left: 5px; top: 0; z-index: 0; width: 1px; height: 100%;}
.layui-timeline-item:last-child:before{display: none;}

.layui-timeline-item:first-child:before{display: block;}
.layui-timeline-item:last-child:before{display: none;}
.layui-timeline-content{padding-left: 25px;;}
.layui-timeline-title{position: relative; margin-bottom: 10px;}
.layui-timeline-title{position: relative; margin-bottom: 10px; line-height: 22px;}

/* 小徽章 */
.layui-badge,
Expand Down
2 changes: 1 addition & 1 deletion src/layui.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}

,Layui = function(){
this.v = '2.6.0'; //版本号
this.v = '2.6.1'; //版本号
}

//获取layui所在目录
Expand Down
2 changes: 2 additions & 0 deletions src/modules/laydate.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,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();
Expand Down
28 changes: 19 additions & 9 deletions src/modules/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){

return {
config: options
,reload: function(options){
that.reload.call(that, options);
,reload: function(options, deep){
that.reload.call(that, options, deep);
}
,setColsWidth: function(){
that.setColsWidth.call(that);
Expand Down Expand Up @@ -228,8 +228,12 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
,Class = function(options){
var that = this;
that.index = ++table.index;
that.config = $.extend({}, that.config, table.config, options);
that.config = $.extend({}, that.config, $.extend(true, {}, table.config, options));
that.render();

if(!that.init_config){
that.init_config = $.extend({}, that.config); //记录初始执行的参数
}
};

//默认配置
Expand Down Expand Up @@ -637,14 +641,18 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
};

//表格重载
Class.prototype.reload = function(options){
Class.prototype.reload = function(options, deep){
var that = this;

options = options || {};
delete that.haveInit;

if(options.data && options.data.constructor === Array) delete that.config.data;
that.config = $.extend({}, that.config, options);

that.config = $.extend({}, that.config, function(){
return deep ? $.extend(true, {}, that.init_config, table.config, options)
: $.extend(true, {}, table.config, options);
}());

that.render();
};
Expand Down Expand Up @@ -724,11 +732,13 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
that.setColsWidth();
typeof options.done === 'function' && options.done(res, curr, res[response.countName]);
}
,error: function(e, m){
that.errorView('数据接口请求异常:'+ m);
,error: function(e, msg){
that.errorView('数据接口请求异常:'+ msg);

that.renderForm();
that.setColsWidth();

typeof options.error === 'function' && options.error(e, msg);
}
});
} else if(options.data && options.data.constructor === Array){ //已知数据
Expand Down Expand Up @@ -1976,12 +1986,12 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
};

//表格重载
table.reload = function(id, options){
table.reload = function(id, options, deep){
var config = getThisTableConfig(id); //获取当前实例配置项
if(!config) return;

var that = thisTable.that[id];
that.reload(options);
that.reload(options, deep);

return thisTable.call(that);
};
Expand Down

0 comments on commit 2705982

Please sign in to comment.