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'
|
title: 'menu item 1'
|
||||||
,href: '#1'
|
,href: '#1'
|
||||||
},{
|
},{
|
||||||
title: 'menu item 2'
|
title: 'menu item 2(点击不关闭)'
|
||||||
,href: '#2'
|
,href: '#2'
|
||||||
|
,id: 'bbb'
|
||||||
},{
|
},{
|
||||||
title: 'menu item 3'
|
title: 'menu item 3'
|
||||||
,href: '#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({
|
laydate.render({
|
||||||
elem: '#test-first',
|
elem: '#test-first',
|
||||||
min: 0,
|
min: 0,
|
||||||
shade: [0.1, '#ddd']
|
shade: [0.1, '#ddd'],
|
||||||
//max: '2016-12-30'
|
//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){
|
,{field:'username', title:'用户名', width:120, edit: function(d){
|
||||||
return !d.LAY_DISABLED;
|
return !d.LAY_DISABLED;
|
||||||
}, templet: '#usernameTpl'}
|
}, 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){
|
,{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>'
|
return '<em>'+ layui.util.escape(d.email) +'</em>'
|
||||||
}}
|
}}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "layui",
|
"name": "layui",
|
||||||
"version": "2.8.0-rc.8",
|
"version": "2.8.0-rc.9",
|
||||||
"description": "Classic modular Front-End UI library",
|
"description": "Classic modular Front-End UI library",
|
||||||
"main": "dist/layui.js",
|
"main": "dist/layui.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
,Layui = function(){
|
,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'; // 是否所有父子菜单均触发点击事件
|
var isClickAllScope = options.clickScope === 'all'; // 是否所有父子菜单均触发点击事件
|
||||||
|
|
||||||
if((!isChild || isClickAllScope) && data.type !== '-'){
|
if((!isChild || isClickAllScope) && data.type !== '-'){
|
||||||
isChild || that.remove();
|
var ret = typeof options.click === 'function' && options.click(data, othis);
|
||||||
typeof options.click === 'function' && options.click(data, othis);
|
ret === false || (isChild || that.remove());
|
||||||
layui.stope(e);
|
layui.stope(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -473,7 +473,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||||||
if(value === '' || (origin === 'blur') ? value !== text : not) num++;
|
if(value === '' || (origin === 'blur') ? value !== text : not) num++;
|
||||||
origin === 'keyup' && othis[not ? 'addClass' : 'removeClass'](HIDE);
|
origin === 'keyup' && othis[not ? 'addClass' : 'removeClass'](HIDE);
|
||||||
});
|
});
|
||||||
// 处理select分组元素
|
// 处理 select 分组元素
|
||||||
origin === 'keyup' && layui.each(dts, function(){
|
origin === 'keyup' && layui.each(dts, function(){
|
||||||
var othis = $(this)
|
var othis = $(this)
|
||||||
,thisDds = othis.nextUntil('dt').filter('dd') // 当前分组下的dd元素
|
,thisDds = othis.nextUntil('dt').filter('dd') // 当前分组下的dd元素
|
||||||
@ -503,15 +503,20 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||||||
}
|
}
|
||||||
}, 'keyup');
|
}, 'keyup');
|
||||||
|
|
||||||
|
// 当搜索值清空时
|
||||||
if(value === ''){
|
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(); // 定位滚动条
|
followScroll(); // 定位滚动条
|
||||||
};
|
};
|
||||||
|
|
||||||
if(isSearch){
|
if(isSearch){
|
||||||
input.on('keyup', search).on('blur', function(e){
|
input.on('input propertychange', search).on('blur', function(e){
|
||||||
var selectedIndex = select[0].selectedIndex;
|
var selectedIndex = select[0].selectedIndex;
|
||||||
|
|
||||||
thatInput = input; // 当前的 select 中的 input 元素
|
thatInput = input; // 当前的 select 中的 input 元素
|
||||||
@ -564,6 +569,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||||||
$(document).off('click', hide).on('click', hide); // 点击其它元素关闭 select
|
$(document).off('click', hide).on('click', hide); // 点击其它元素关闭 select
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 初始渲染 select 组件选项
|
||||||
selects.each(function(index, select){
|
selects.each(function(index, select){
|
||||||
var othis = $(this)
|
var othis = $(this)
|
||||||
,hasRender = othis.next('.'+CLASS)
|
,hasRender = othis.next('.'+CLASS)
|
||||||
@ -659,10 +665,9 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||||||
checks.each(function(index, check){
|
checks.each(function(index, check){
|
||||||
var othis = $(this);
|
var othis = $(this);
|
||||||
var skin = othis.attr('lay-skin') || 'primary';
|
var skin = othis.attr('lay-skin') || 'primary';
|
||||||
var title = (function(title){
|
var title = $.trim(check.title || function(){ // 向下兼容 lay-text 属性
|
||||||
// 向下兼容 lay-text 属性
|
return check.title = othis.attr('lay-text') || '';
|
||||||
return title || othis.attr('lay-text') || '';
|
}()).split('|');
|
||||||
})(check.title).replace(/\s/g, '').split('|');
|
|
||||||
var disabled = this.disabled;
|
var disabled = this.disabled;
|
||||||
|
|
||||||
if(!skins[skin]) skin = 'primary'; // 若非内置风格,则强制为默认风格
|
if(!skins[skin]) skin = 'primary'; // 若非内置风格,则强制为默认风格
|
||||||
|
@ -1863,7 +1863,7 @@
|
|||||||
,delete that.endTime
|
,delete that.endTime
|
||||||
);
|
);
|
||||||
that.setValue('');
|
that.setValue('');
|
||||||
that.done(['', {}, {}]).remove();
|
that.done(null, 'onClear').done(['', {}, {}]).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 现在
|
// 现在
|
||||||
@ -1883,7 +1883,7 @@
|
|||||||
|
|
||||||
that.setValue(that.parse());
|
that.setValue(that.parse());
|
||||||
isStatic && that.calendar();
|
isStatic && that.calendar();
|
||||||
that.done().remove();
|
that.done(null, 'onNow').done().remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
//确定
|
//确定
|
||||||
@ -1897,7 +1897,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
that.setValue(that.parse());
|
that.setValue(that.parse());
|
||||||
that.done().remove();
|
that.done(null, 'onConfirm').done().remove();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
active[type] && active[type]();
|
active[type] && active[type]();
|
||||||
|
@ -1197,6 +1197,12 @@ layer.closeAll = function(type, callback){
|
|||||||
if(domsElem.length === 0) typeof callback === 'function' && 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 开始合并在一起
|
拓展模块,layui 开始合并在一起
|
||||||
|
@ -1301,7 +1301,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
that.dataTotal = {};
|
that.dataTotal = []; // 记录合计行结果
|
||||||
|
|
||||||
var tds = [];
|
var tds = [];
|
||||||
that.eachCols(function(i3, item3){
|
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 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 content = function(){
|
||||||
var text = item3.totalRowText || '';
|
var text = item3.totalRowText || '';
|
||||||
var decimals = 'totalRowDecimals' in item3 ? item3.totalRowDecimals : 2;
|
|
||||||
var thisTotalNum = parseFloat(totalNums[field]).toFixed(decimals);
|
|
||||||
var tplData = {
|
var tplData = {
|
||||||
LAY_COL: item3
|
LAY_COL: item3
|
||||||
};
|
};
|
||||||
@ -1332,6 +1336,13 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
return TOTAL_NUMS || getContent;
|
return TOTAL_NUMS || getContent;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
// 合计原始结果
|
||||||
|
var total = TOTAL_NUMS || thisTotalNum || '';
|
||||||
|
item3.field && that.dataTotal.push({
|
||||||
|
field: item3.field,
|
||||||
|
total: $('<div>'+ content +'</div>').text()
|
||||||
|
});
|
||||||
|
|
||||||
// td 容器
|
// td 容器
|
||||||
var td = ['<td data-field="'+ field +'" data-key="'+ item3.key +'" '+ function(){
|
var td = ['<td data-field="'+ field +'" data-key="'+ item3.key +'" '+ function(){
|
||||||
var attr = [];
|
var attr = [];
|
||||||
@ -1368,7 +1379,6 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
}()
|
}()
|
||||||
,'</div></td>'].join('');
|
,'</div></td>'].join('');
|
||||||
|
|
||||||
item3.field && (that.dataTotal[field] = content);
|
|
||||||
tds.push(td);
|
tds.push(td);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2034,7 +2044,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
var cell = td.children(ELEM_CELL); //获取当前修改的列
|
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){
|
that.eachCols(function(i, item3){
|
||||||
@ -2645,14 +2655,14 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
dataMain.push(vals.join(','));
|
dataMain.push(vals.join(','));
|
||||||
});
|
});
|
||||||
|
|
||||||
//表合计
|
// 表合计
|
||||||
thatTable && layui.each(thatTable.dataTotal, function(key, value){
|
thatTable && layui.each(thatTable.dataTotal, function(i, o){
|
||||||
fieldsIsHide[key] || dataTotal.push(value);
|
fieldsIsHide[o.field] || dataTotal.push(o.total + '\t');
|
||||||
});
|
});
|
||||||
|
|
||||||
return dataTitle.join(',') + '\r\n' + dataMain.join('\r\n') + '\r\n' + dataTotal.join(',');
|
return dataTitle.join(',') + '\r\n' + dataMain.join('\r\n') + '\r\n' + dataTotal.join(',');
|
||||||
}());
|
}());
|
||||||
//return;
|
|
||||||
alink.download = (opts.title || config.title || 'table_'+ (config.index || '')) + '.' + type;
|
alink.download = (opts.title || config.title || 'table_'+ (config.index || '')) + '.' + type;
|
||||||
document.body.appendChild(alink);
|
document.body.appendChild(alink);
|
||||||
alink.click();
|
alink.click();
|
||||||
|
Loading…
Reference in New Issue
Block a user