update
This commit is contained in:
@@ -890,8 +890,11 @@ hr, .layui-timeline-item:before{background-color: #e6e6e6;}
|
||||
|
||||
.layui-laypage .layui-laypage-count,
|
||||
.layui-laypage .layui-laypage-limits,
|
||||
.layui-laypage .layui-laypage-refresh,
|
||||
.layui-laypage .layui-laypage-skip{margin-left: 10px; margin-right: 10px; padding: 0; border: none;}
|
||||
.layui-laypage .layui-laypage-limits{vertical-align: top;}
|
||||
.layui-laypage .layui-laypage-limits,
|
||||
.layui-laypage .layui-laypage-refresh{vertical-align: top;}
|
||||
.layui-laypage .layui-laypage-refresh i{font-size: 18px; cursor: pointer;}
|
||||
.layui-laypage select{height: 22px; padding: 3px; border-radius: 2px; cursor: pointer;}
|
||||
.layui-laypage .layui-laypage-skip{height: 30px; line-height: 30px; color: #999;}
|
||||
.layui-laypage input, .layui-laypage button{height: 30px; line-height: 30px; border-radius: 2px; vertical-align: top; background-color: #fff; box-sizing: border-box;}
|
||||
@@ -972,10 +975,14 @@ hr, .layui-timeline-item:before{background-color: #e6e6e6;}
|
||||
.layui-table-sort[lay-sort="asc"] .layui-table-sort-asc{border-bottom-color: #000;}
|
||||
.layui-table-sort[lay-sort="desc"] .layui-table-sort-desc{border-top-color: #000;}
|
||||
.layui-table-cell{height: 28px; line-height: 28px; padding: 0 15px; position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-sizing: border-box;}
|
||||
.layui-table-cell .layui-form-checkbox[lay-skin="primary"]{top: -1px; vertical-align: middle;}
|
||||
.layui-table-cell .layui-form-checkbox[lay-skin="primary"],
|
||||
.layui-table-cell .layui-form-radio[lay-skin="primary"]{top: -1px; vertical-align: middle;}
|
||||
.layui-table-cell .layui-form-radio{padding-right: 0px}
|
||||
.layui-table-cell .layui-form-radio>i{margin-right: 0px;}
|
||||
.layui-table-cell .layui-table-link{color: #01AAED;}
|
||||
|
||||
.laytable-cell-checkbox,
|
||||
.laytable-cell-radio,
|
||||
.laytable-cell-space,
|
||||
.laytable-cell-numbers{padding: 0; text-align: center;}
|
||||
|
||||
|
||||
@@ -68,6 +68,26 @@ layui.define('layer', function(exports){
|
||||
Form.prototype.on = function(events, callback){
|
||||
return layui.onevent.call(this, MOD_NAME, events, callback);
|
||||
};
|
||||
|
||||
//初始赋值
|
||||
Form.prototype.val = function(filter, object){
|
||||
var that = this
|
||||
,formElem = $(ELEM + '[lay-filter="' + filter +'"]');
|
||||
formElem.each(function(index, item){
|
||||
var itemFrom = $(this);
|
||||
layui.each(object, function(key, value){
|
||||
var itemElem = itemFrom.find('[name="'+ key +'"]');
|
||||
itemElem.val(value);
|
||||
if(!itemElem[0]) return;
|
||||
|
||||
//如果有 checked 的内置属性,就改变 checked 属性的值
|
||||
if('checked' in itemElem[0]){
|
||||
itemElem[0].checked = value;
|
||||
}
|
||||
});
|
||||
});
|
||||
form.render(null, filter);
|
||||
};
|
||||
|
||||
//表单控件渲染
|
||||
Form.prototype.render = function(type, filter){
|
||||
@@ -96,7 +116,7 @@ layui.define('layer', function(exports){
|
||||
,input = title.find('input')
|
||||
,dl = reElem.find('dl')
|
||||
,dds = dl.children('dd')
|
||||
|
||||
,index = Number(select.val()? select.val(): -1) + 1 ;
|
||||
|
||||
if(disabled) return;
|
||||
|
||||
@@ -106,7 +126,8 @@ layui.define('layer', function(exports){
|
||||
,dlHeight = dl.outerHeight();
|
||||
reElem.addClass(CLASS+'ed');
|
||||
dds.removeClass(HIDE);
|
||||
|
||||
//确保没有选择的时候第一个也会有样式
|
||||
dl.children('dd:eq('+index+')').addClass(THIS);
|
||||
//上下定位识别
|
||||
if(top + dlHeight > win.height() && top >= dlHeight){
|
||||
reElem.addClass(CLASS + 'up');
|
||||
@@ -153,8 +174,48 @@ layui.define('layer', function(exports){
|
||||
//Tab键
|
||||
if(keyCode === 9){
|
||||
hideDown();
|
||||
} else if(keyCode === 13){ //回车键
|
||||
}
|
||||
//up 键
|
||||
if(keyCode === 38){
|
||||
e.preventDefault();
|
||||
index--;
|
||||
// 如果是不可点击状态,则跳过
|
||||
if(dl.children('dd:eq('+index+')').hasClass(DISABLED)) index--;
|
||||
if(index < 0) index = 0;
|
||||
|
||||
dl.children('dd:eq('+index+')').addClass(THIS).siblings().removeClass(THIS);
|
||||
}
|
||||
//down 键
|
||||
if(keyCode === 40){
|
||||
e.preventDefault();
|
||||
index++;
|
||||
if(dl.children('dd:eq('+index+')').hasClass(DISABLED)) index++;
|
||||
if(index > dds.length - 1) index = dds.length - 1;
|
||||
|
||||
dl.children('dd:eq('+index+')').addClass(THIS).siblings().removeClass(THIS);
|
||||
}
|
||||
//回车键
|
||||
if(keyCode === 13){
|
||||
e.preventDefault();
|
||||
var othis = dl.children('dd:eq('+index+')')
|
||||
,value = othis.attr('lay-value')
|
||||
,filter = select.attr('lay-filter'); //获取过滤器
|
||||
|
||||
if(index === 0){
|
||||
input.val('');
|
||||
} else {
|
||||
input.val(othis.text());
|
||||
}
|
||||
|
||||
select.val(value).removeClass('layui-form-danger')
|
||||
layui.event.call(this, MOD_NAME, 'select('+ filter +')', {
|
||||
elem: select[0]
|
||||
,value: value
|
||||
,othis: reElem
|
||||
});
|
||||
|
||||
hideDown(true);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -212,16 +273,17 @@ layui.define('layer', function(exports){
|
||||
dds.on('click', function(){
|
||||
var othis = $(this), value = othis.attr('lay-value');
|
||||
var filter = select.attr('lay-filter'); //获取过滤器
|
||||
|
||||
if(othis.hasClass(DISABLED)) return false;
|
||||
|
||||
if(othis.hasClass('layui-select-tips')){
|
||||
input.val('');
|
||||
index = 0;
|
||||
} else {
|
||||
input.val(othis.text());
|
||||
othis.addClass(THIS);
|
||||
index = Number(value) + 1;
|
||||
}
|
||||
|
||||
|
||||
othis.siblings().removeClass(THIS);
|
||||
select.val(value).removeClass('layui-form-danger')
|
||||
layui.event.call(this, MOD_NAME, 'select('+ filter +')', {
|
||||
|
||||
@@ -321,7 +321,7 @@
|
||||
//设置值
|
||||
LAY.prototype.val = function(value){
|
||||
return this.each(function(index, item){
|
||||
item.value = value;
|
||||
item.value = value;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -377,6 +377,7 @@
|
||||
,range: false //是否开启范围选择,即双控件
|
||||
,format: 'yyyy-MM-dd' //默认日期格式
|
||||
,value: null //默认日期,支持传入new Date(),或者符合format参数设定的日期格式字符
|
||||
,isInitValue: false //用于控制是否自动向元素填充初始值(需配合 value 参数使用)
|
||||
,min: '1900-1-1' //有效最小日期,年月日必须用“-”分割,时分秒必须用“:”分割。注意:它并不是遵循 format 设定的格式。
|
||||
,max: '2099-12-31' //有效最大日期,同上
|
||||
,trigger: 'focus' //呼出控件的事件
|
||||
@@ -548,7 +549,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 {
|
||||
|
||||
@@ -18,6 +18,7 @@ layui.define(function(exports){
|
||||
|
||||
//构造器
|
||||
,Class = function(options){
|
||||
|
||||
var that = this;
|
||||
that.config = options || {};
|
||||
that.config.index = ++laypage.index;
|
||||
@@ -75,7 +76,7 @@ layui.define(function(exports){
|
||||
? Math.ceil( (config.curr + (groups > 1 ? 1 : 0)) / (groups > 0 ? groups : 1) )
|
||||
: 1
|
||||
|
||||
//试图片段
|
||||
//视图片段
|
||||
,views = {
|
||||
//上一页
|
||||
prev: function(){
|
||||
@@ -162,6 +163,9 @@ layui.define(function(exports){
|
||||
return options.join('') +'</select></span>';
|
||||
}()
|
||||
|
||||
//刷新
|
||||
,refresh: '<span class="layui-laypage-refresh"><i class="layui-icon">ဂ</i></span>'
|
||||
|
||||
//跳页区域
|
||||
,skip: function(){
|
||||
return ['<span class="layui-laypage-skip">到第'
|
||||
@@ -255,6 +259,24 @@ layui.define(function(exports){
|
||||
});
|
||||
};
|
||||
|
||||
//刷新当前页
|
||||
Class.prototype.update = function(elem){
|
||||
if(!elem) return;
|
||||
var that = this
|
||||
,config = that.config
|
||||
,curr = config.curr
|
||||
,spani = elem[tag]('i')[0];
|
||||
|
||||
if(spani){
|
||||
laypage.on(spani, 'click', function(){
|
||||
config.curr = curr;
|
||||
that.render();
|
||||
console.log(config.curr);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//渲染分页
|
||||
Class.prototype.render = function(load){
|
||||
var that = this
|
||||
@@ -271,7 +293,7 @@ layui.define(function(exports){
|
||||
doc[id](config.elem).innerHTML = view;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
config.jump && config.jump(config, load);
|
||||
|
||||
var elem = doc[id]('layui-laypage-' + config.index);
|
||||
@@ -282,6 +304,8 @@ layui.define(function(exports){
|
||||
}
|
||||
|
||||
that.skip(elem);
|
||||
|
||||
that.update(elem);
|
||||
};
|
||||
|
||||
//外部接口
|
||||
|
||||
@@ -277,11 +277,11 @@
|
||||
}
|
||||
img.onload = function(){
|
||||
img.onload = null;
|
||||
callback(img);
|
||||
typeof callback === 'function' && callback(img);
|
||||
};
|
||||
img.onerror = function(e){
|
||||
img.onerror = null;
|
||||
error(e);
|
||||
typeof error === 'function' && error(e);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user