update
This commit is contained in:
@@ -144,6 +144,7 @@ layui.define('layer', function(exports){
|
||||
index = select[0].selectedIndex; //获取最新的 selectedIndex
|
||||
reElem.addClass(CLASS+'ed');
|
||||
dds.removeClass(HIDE);
|
||||
nearElem = null;
|
||||
|
||||
//初始选中样式
|
||||
dds.eq(index).addClass(THIS).siblings().removeClass(THIS);
|
||||
@@ -231,6 +232,22 @@ layui.define('layer', function(exports){
|
||||
|
||||
//标注样式
|
||||
nearDd.addClass(THIS).siblings().removeClass(THIS);
|
||||
|
||||
//定位滚动条
|
||||
var ddThis = dl.children('dd.layui-this')
|
||||
,posTop = ddThis.position().top
|
||||
,dlHeight = dl.height()
|
||||
,ddHeight = ddThis.height();
|
||||
|
||||
//若选中元素在滚动条不可见底部
|
||||
if(posTop > dlHeight){
|
||||
dl.scrollTop(posTop + dl.scrollTop() - dlHeight + ddHeight - 5);
|
||||
}
|
||||
|
||||
//若选择玄素在滚动条不可见顶部
|
||||
if(posTop < 0){
|
||||
dl.scrollTop(posTop + dl.scrollTop());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@
|
||||
,range: false //是否开启范围选择,即双控件
|
||||
,format: 'yyyy-MM-dd' //默认日期格式
|
||||
,value: null //默认日期,支持传入new Date(),或者符合format参数设定的日期格式字符
|
||||
,isInitValue: false //用于控制是否自动向元素填充初始值(需配合 value 参数使用)
|
||||
,isInitValue: true //用于控制是否自动向元素填充初始值(需配合 value 参数使用)
|
||||
,min: '1900-1-1' //有效最小日期,年月日必须用“-”分割,时分秒必须用“:”分割。注意:它并不是遵循 format 设定的格式。
|
||||
,max: '2099-12-31' //有效最大日期,同上
|
||||
,trigger: 'focus' //呼出控件的事件
|
||||
|
||||
@@ -127,11 +127,11 @@ layui.define('layer' , function(exports){
|
||||
$('#'+ ELEM_IFRAME)[0] || $('body').append(iframe);
|
||||
|
||||
//包裹文件域
|
||||
if(!options.elem.next().hasClass(ELEM_IFRAME)){
|
||||
if(!options.elem.next().hasClass(ELEM_FORM)){
|
||||
that.elemFile.wrap(elemForm);
|
||||
|
||||
//追加额外的参数
|
||||
options.elem.next('.'+ ELEM_IFRAME).append(function(){
|
||||
options.elem.next('.'+ ELEM_FORM).append(function(){
|
||||
var arr = [];
|
||||
layui.each(options.data, function(key, value){
|
||||
value = typeof value === 'function' ? value() : value;
|
||||
@@ -288,14 +288,17 @@ layui.define('layer' , function(exports){
|
||||
|
||||
//回调返回的参数
|
||||
,args = {
|
||||
//预览
|
||||
preview: function(callback){
|
||||
that.preview(callback);
|
||||
}
|
||||
//上传
|
||||
,upload: function(index, file){
|
||||
var thisFile = {};
|
||||
thisFile[index] = file;
|
||||
that.upload(thisFile);
|
||||
}
|
||||
//追加文件到队列
|
||||
,pushFile: function(){
|
||||
that.files = that.files || {};
|
||||
layui.each(that.chooseFiles, function(index, item){
|
||||
@@ -303,12 +306,22 @@ layui.define('layer' , function(exports){
|
||||
});
|
||||
return that.files;
|
||||
}
|
||||
//重置文件
|
||||
,resetFile: function(index, file, filename){
|
||||
var newFile = new File([file], filename);
|
||||
that.files = that.files || {};
|
||||
that.files[index] = newFile;
|
||||
}
|
||||
}
|
||||
|
||||
//提交上传
|
||||
,send = function(){
|
||||
if(type === 'choose'){
|
||||
return options.choose && options.choose(args);
|
||||
,send = function(){
|
||||
//选择文件的回调
|
||||
if(type === 'choose' || options.auto){
|
||||
options.choose && options.choose(args);
|
||||
if(type === 'choose'){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//上传前的回调
|
||||
|
||||
@@ -164,6 +164,13 @@ layui.define('jquery', function(exports){
|
||||
.replace(/mm/g, hms[1])
|
||||
.replace(/ss/g, hms[2]);
|
||||
}
|
||||
|
||||
//防 xss 攻击
|
||||
,escape: function(html){
|
||||
return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
|
||||
.replace(/</g, '<').replace(/>/g, '>')
|
||||
.replace(/'/g, ''').replace(/"/g, '"');
|
||||
}
|
||||
};
|
||||
|
||||
exports('util', util);
|
||||
|
||||
Reference in New Issue
Block a user