commit
db70201c4f
2
dist/layui.js
vendored
2
dist/layui.js
vendored
File diff suppressed because one or more lines are too long
@ -172,14 +172,18 @@ layui.use('dropdown', function(){
|
||||
title: 'menu item 1'
|
||||
,href: '#1'
|
||||
},{
|
||||
title: 'menu item 2'
|
||||
title: 'menu item 2(点击不关闭)'
|
||||
,href: '#2'
|
||||
,id: 'bbb'
|
||||
},{
|
||||
title: 'menu item 3'
|
||||
,href: '#3'
|
||||
}]
|
||||
,click: function(){
|
||||
|
||||
,click: function(data, othis){
|
||||
console.log(data);
|
||||
if(data.id === 'bbb'){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -157,8 +157,20 @@ layui.use('laydate', function(laydate){
|
||||
laydate.render({
|
||||
elem: '#test-first',
|
||||
min: 0,
|
||||
shade: [0.1, '#ddd']
|
||||
//max: '2016-12-30'
|
||||
shade: [0.1, '#ddd'],
|
||||
//max: '2016-12-30',
|
||||
done: function(){
|
||||
console.log('done',arguments);
|
||||
},
|
||||
onConfirm: function(){
|
||||
console.log('confirm',arguments);
|
||||
},
|
||||
onNow: function(){
|
||||
console.log('now',arguments);
|
||||
},
|
||||
onClear: function(){
|
||||
console.log('clear',arguments);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
@ -160,6 +160,7 @@ layui.use(['table', 'dropdown'], function(){
|
||||
,{field:'username', title:'用户名', width:120, edit: function(d){
|
||||
return !d.LAY_DISABLED;
|
||||
}, templet: '#usernameTpl'}
|
||||
,{field:'xxx', title:'测试', edit: 'text'}
|
||||
,{field:'email', minWidth: 160, maxWidth: 320, title:'邮箱 <i class="layui-icon layui-icon-email"></i>', fieldTitle: '邮箱', hide: 0, edit: 'text', templet: function(d){
|
||||
return '<em>'+ layui.util.escape(d.email) +'</em>'
|
||||
}}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "layui",
|
||||
"version": "2.8.0-rc.8",
|
||||
"version": "2.8.0-rc.9",
|
||||
"description": "Classic modular Front-End UI library",
|
||||
"main": "dist/layui.js",
|
||||
"license": "MIT",
|
||||
|
@ -15,7 +15,7 @@
|
||||
}
|
||||
|
||||
,Layui = function(){
|
||||
this.v = '2.8.0-rc.8'; // Layui 版本号
|
||||
this.v = '2.8.0-rc.9'; // Layui 版本号
|
||||
}
|
||||
|
||||
//识别预先可能定义的指定全局对象
|
||||
|
@ -275,8 +275,8 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
|
||||
var isClickAllScope = options.clickScope === 'all'; // 是否所有父子菜单均触发点击事件
|
||||
|
||||
if((!isChild || isClickAllScope) && data.type !== '-'){
|
||||
isChild || that.remove();
|
||||
typeof options.click === 'function' && options.click(data, othis);
|
||||
var ret = typeof options.click === 'function' && options.click(data, othis);
|
||||
ret === false || (isChild || that.remove());
|
||||
layui.stope(e);
|
||||
}
|
||||
});
|
||||
|
@ -473,7 +473,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
||||
if(value === '' || (origin === 'blur') ? value !== text : not) num++;
|
||||
origin === 'keyup' && othis[not ? 'addClass' : 'removeClass'](HIDE);
|
||||
});
|
||||
// 处理select分组元素
|
||||
// 处理 select 分组元素
|
||||
origin === 'keyup' && layui.each(dts, function(){
|
||||
var othis = $(this)
|
||||
,thisDds = othis.nextUntil('dt').filter('dd') // 当前分组下的dd元素
|
||||
@ -503,15 +503,20 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
||||
}
|
||||
}, 'keyup');
|
||||
|
||||
// 当搜索值清空时
|
||||
if(value === ''){
|
||||
dl.find('.'+NONE).remove();
|
||||
// 取消选中项
|
||||
select.val('');
|
||||
dl.find('.'+ THIS).removeClass(THIS);
|
||||
(select[0].options[0] || {}).value || dl.children('dd:eq(0)').addClass(THIS);
|
||||
dl.find('.'+ NONE).remove();
|
||||
}
|
||||
|
||||
followScroll(); // 定位滚动条
|
||||
};
|
||||
|
||||
if(isSearch){
|
||||
input.on('keyup', search).on('blur', function(e){
|
||||
input.on('input propertychange', search).on('blur', function(e){
|
||||
var selectedIndex = select[0].selectedIndex;
|
||||
|
||||
thatInput = input; // 当前的 select 中的 input 元素
|
||||
@ -564,6 +569,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
||||
$(document).off('click', hide).on('click', hide); // 点击其它元素关闭 select
|
||||
}
|
||||
|
||||
// 初始渲染 select 组件选项
|
||||
selects.each(function(index, select){
|
||||
var othis = $(this)
|
||||
,hasRender = othis.next('.'+CLASS)
|
||||
@ -659,10 +665,9 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
||||
checks.each(function(index, check){
|
||||
var othis = $(this);
|
||||
var skin = othis.attr('lay-skin') || 'primary';
|
||||
var title = (function(title){
|
||||
// 向下兼容 lay-text 属性
|
||||
return title || othis.attr('lay-text') || '';
|
||||
})(check.title).replace(/\s/g, '').split('|');
|
||||
var title = $.trim(check.title || function(){ // 向下兼容 lay-text 属性
|
||||
return check.title = othis.attr('lay-text') || '';
|
||||
}()).split('|');
|
||||
var disabled = this.disabled;
|
||||
|
||||
if(!skins[skin]) skin = 'primary'; // 若非内置风格,则强制为默认风格
|
||||
|
@ -1863,7 +1863,7 @@
|
||||
,delete that.endTime
|
||||
);
|
||||
that.setValue('');
|
||||
that.done(['', {}, {}]).remove();
|
||||
that.done(null, 'onClear').done(['', {}, {}]).remove();
|
||||
}
|
||||
|
||||
// 现在
|
||||
@ -1883,7 +1883,7 @@
|
||||
|
||||
that.setValue(that.parse());
|
||||
isStatic && that.calendar();
|
||||
that.done().remove();
|
||||
that.done(null, 'onNow').done().remove();
|
||||
}
|
||||
|
||||
//确定
|
||||
@ -1897,7 +1897,7 @@
|
||||
}
|
||||
|
||||
that.setValue(that.parse());
|
||||
that.done().remove();
|
||||
that.done(null, 'onConfirm').done().remove();
|
||||
}
|
||||
};
|
||||
active[type] && active[type]();
|
||||
|
@ -1197,6 +1197,12 @@ layer.closeAll = function(type, callback){
|
||||
if(domsElem.length === 0) typeof callback === 'function' && callback();
|
||||
};
|
||||
|
||||
// 根据弹层类型关闭最近打开的层
|
||||
layer.closeLast = function(type){
|
||||
type = type || 'page';
|
||||
layer.close($('.layui-layer-'+ type +':last').attr("times"));
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
拓展模块,layui 开始合并在一起
|
||||
|
@ -1301,7 +1301,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||
});
|
||||
});
|
||||
|
||||
that.dataTotal = {};
|
||||
that.dataTotal = []; // 记录合计行结果
|
||||
|
||||
var tds = [];
|
||||
that.eachCols(function(i3, item3){
|
||||
@ -1309,12 +1309,16 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||
|
||||
// 合计数据的特定字段
|
||||
var TOTAL_NUMS = totalRowData && totalRowData[item3.field];
|
||||
|
||||
// 合计数据的小数点位数处理
|
||||
var decimals = 'totalRowDecimals' in item3 ? item3.totalRowDecimals : 2;
|
||||
var thisTotalNum = totalNums[field]
|
||||
? parseFloat(totalNums[field] || 0).toFixed(decimals)
|
||||
: '';
|
||||
|
||||
// td 内容
|
||||
// td 显示内容
|
||||
var content = function(){
|
||||
var text = item3.totalRowText || '';
|
||||
var decimals = 'totalRowDecimals' in item3 ? item3.totalRowDecimals : 2;
|
||||
var thisTotalNum = parseFloat(totalNums[field]).toFixed(decimals);
|
||||
var tplData = {
|
||||
LAY_COL: item3
|
||||
};
|
||||
@ -1332,6 +1336,13 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||
return TOTAL_NUMS || getContent;
|
||||
}();
|
||||
|
||||
// 合计原始结果
|
||||
var total = TOTAL_NUMS || thisTotalNum || '';
|
||||
item3.field && that.dataTotal.push({
|
||||
field: item3.field,
|
||||
total: $('<div>'+ content +'</div>').text()
|
||||
});
|
||||
|
||||
// td 容器
|
||||
var td = ['<td data-field="'+ field +'" data-key="'+ item3.key +'" '+ function(){
|
||||
var attr = [];
|
||||
@ -1368,7 +1379,6 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||
}()
|
||||
,'</div></td>'].join('');
|
||||
|
||||
item3.field && (that.dataTotal[field] = content);
|
||||
tds.push(td);
|
||||
});
|
||||
|
||||
@ -2034,7 +2044,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||
var cell = td.children(ELEM_CELL); //获取当前修改的列
|
||||
|
||||
// 更新缓存中的数据
|
||||
if(key in data) data[key] = obj.data[key] = value;
|
||||
data[key] = obj.data[key] = value;
|
||||
|
||||
// 更新相应列视图
|
||||
that.eachCols(function(i, item3){
|
||||
@ -2645,14 +2655,14 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||
dataMain.push(vals.join(','));
|
||||
});
|
||||
|
||||
//表合计
|
||||
thatTable && layui.each(thatTable.dataTotal, function(key, value){
|
||||
fieldsIsHide[key] || dataTotal.push(value);
|
||||
// 表合计
|
||||
thatTable && layui.each(thatTable.dataTotal, function(i, o){
|
||||
fieldsIsHide[o.field] || dataTotal.push(o.total + '\t');
|
||||
});
|
||||
|
||||
return dataTitle.join(',') + '\r\n' + dataMain.join('\r\n') + '\r\n' + dataTotal.join(',');
|
||||
}());
|
||||
//return;
|
||||
|
||||
alink.download = (opts.title || config.title || 'table_'+ (config.index || '')) + '.' + type;
|
||||
document.body.appendChild(alink);
|
||||
alink.click();
|
||||
|
Loading…
Reference in New Issue
Block a user