Browse Source

update

pull/859/head v2.6.3
贤心 4 years ago
parent
commit
b0646a2f11
  1. 2
      bower.json
  2. 2
      dist/css/modules/laydate/default/laydate.css
  3. 6
      dist/layui.js
  4. 31
      examples/all.html
  5. 6
      examples/extends/mod1.js
  6. 9
      examples/extends/mod2.js
  7. 5
      examples/laydate.html
  8. 3
      examples/layer.html
  9. 5
      examples/table.html
  10. 2
      gulpfile.js
  11. 2
      package.json
  12. 4
      src/css/modules/laydate/default/laydate.css
  13. 35
      src/layui.js
  14. 32
      src/modules/all.js
  15. 2
      src/modules/carousel.js
  16. 2
      src/modules/code.js
  17. 2
      src/modules/colorpicker.js
  18. 2
      src/modules/demo.js
  19. 4
      src/modules/dropdown.js
  20. 2
      src/modules/element.js
  21. 2
      src/modules/flow.js
  22. 2
      src/modules/form.js
  23. 88
      src/modules/laydate.js
  24. 2
      src/modules/layedit.js
  25. 4
      src/modules/layer.js
  26. 2
      src/modules/laypage.js
  27. 2
      src/modules/laytpl.js
  28. 13
      src/modules/layui.all.js
  29. 2
      src/modules/rate.js
  30. 2
      src/modules/slider.js
  31. 15
      src/modules/table.js
  32. 2
      src/modules/transfer.js
  33. 2
      src/modules/tree.js
  34. 2
      src/modules/upload.js
  35. 2
      src/modules/util.js

2
bower.json

@ -1,7 +1,7 @@
{
"name": "layui",
"main": "dist/layui.js",
"version": "2.6.2",
"version": "2.6.3",
"homepage": "https://github.com/sentsin/layui",
"authors": [
"sentsin <xu@sentsin.com>"

2
dist/css/modules/laydate/default/laydate.css vendored

File diff suppressed because one or more lines are too long

6
dist/layui.js vendored

File diff suppressed because one or more lines are too long

31
examples/all.html

@ -1,15 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>完整库使用 - layui</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>完整库使用 - layui</title>
<link rel="stylesheet" href="../src/css/layui.css">
<link rel="stylesheet" href="../src/css/layui.css">
<style>
body{padding: 10px;}
</style>
<style>
body{padding: 10px;}
</style>
</head>
<body>
@ -25,6 +26,7 @@ resize: none;">
</textarea>
<div id="demo1"></div>
<button class="layui-btn demo" test-active="test-form">测试弹出式 Form</button>
<button class="layui-btn demo" test-active="test-use">测试是否重复加载内置组件</button>
@ -39,7 +41,14 @@ resize: none;">
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
内容1
<div class="layui-form">
<select name="city" lay-verify="">
<option value="">请选择一个城市</option>
<option value="010">北京</option>
<option value="021">上海</option>
<option value="0571">杭州</option>
</select>
</div>
</div>
<div class="layui-tab-item">
<div id="test2" class="demo-transfer"></div>
@ -53,7 +62,7 @@ resize: none;">
<script src="../dist/layui.js"></script>
<script>
;!function(){
layui.use(function(){
var $ = layui.jquery
,layer = layui.layer
,form = layui.form
@ -62,9 +71,7 @@ resize: none;">
,transfer = layui.transfer
,util = layui.util;
layer.ready(function(){
layer.msg('hello');
});
laypage.render({
elem: 'demo1'
@ -143,7 +150,7 @@ resize: none;">
});
}
});
}();
});
</script>
</body>
</html>

6
examples/extends/mod1.js

@ -1,5 +1,7 @@
layui.define(['mod2', 'layer'], function(exports){
/**
扩展模块且依赖 mod2
**/
layui.define('mod2', function(exports){
var $ = layui.jquery;
console.log(layui.mod2, layui.layer, layui.form)

9
examples/extends/mod2.js

@ -1,6 +1,11 @@
/**
扩展模块只依赖内置模块
**/
layui.define(['jquery', 'form'], function(exports){
console.log(layui.$)
layui.define(function(exports){
console.log('mod2.js')
layer.alert(1)
exports('mod2', {
name: 'mod2'

5
examples/laydate.html

@ -123,9 +123,10 @@ layui.use('laydate', function(laydate){
elem: '#test1' //指定元素
,type: 'datetime'
,trigger: 'click'
,lang: 'en'
//,lang: 'en'
//,theme: 'grid'
,range: true //开启日期范围,默认使用“_”分割
,value: '2021-03-27 00:00:00 - 2021-02-27 00:00:00'
//,value: '2021-03-27 00:00:00 - 2021-02-27 00:00:00'
,done: function(value, date, endDate){
console.log(value, date, endDate);
}

3
examples/layer.html

@ -38,7 +38,8 @@ layui.use('layer', function(){
var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
layer.msg('hello');
var index = layer.msg('hello');
//layer.close(index);
//触发事件
var active = {

5
examples/table.html

@ -183,7 +183,6 @@ body{padding: 20px; /*overflow-y: scroll;*/}
<script>
layui.use('table', function(){
var table = layui.table;
//return;
//全局设定某参数
table.set({
@ -228,7 +227,7 @@ layui.use('table', function(){
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
,{field:'city', title:'城市', width:120, templet: '#cityTpl1'}
,{field:'sign', title:'签名'}
,{field:'experience', title:'积分', width:80, sort: true, totalRow: true, templet: '<div>{{ d.experience }} 分</div>'}
,{field:'experience', title:'积分', width:80, sort: true, totalRow: '{{ d.TOTAL_NUMS }} 分', templet: '<div>{{ d.experience }} 分</div>'}
,{field:'ip', title:'IP', width:120}
,{field:'logins', title:'登入次数', width:100, sort: true, totalRow: true}
,{field:'joinTime', title:'加入时间', width:120}
@ -319,7 +318,7 @@ layui.use('table', function(){
break;
case 'reload':
//深度重载
table.reload('test', {
var instReload = table.reload('test', {
where: {
abc: 123

2
gulpfile.js

@ -50,7 +50,7 @@ var argv = require('minimist')(process.argv.slice(2), {
//聚合 JS 文件
alljs: function(ver){
var src = [
'./src/**/{layui,all,'+ mods +'}.js'
'./src/**/{layui,layui.all,'+ mods +'}.js'
]
,dir = destDir(ver);

2
package.json

@ -1,7 +1,7 @@
{
"name": "layui-src",
"realname": "layui",
"version": "2.6.2",
"version": "2.6.3",
"description": "Classic modular front-end component library",
"main": "dist/layui.js",
"license": "MIT",

4
src/css/modules/laydate/default/laydate.css

@ -98,10 +98,10 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
.layui-laydate-content{border-top: none 0; border-bottom: none 0;}
.layui-laydate-content th{color: #333;}
.layui-laydate-content td{color: #666;}
.layui-laydate-content td.laydate-selected{background-color: #00F7DE;}
.layui-laydate-content td.laydate-selected{background-color: #B5FFF8;}
.laydate-selected:hover{background-color: #00F7DE !important;}
.layui-laydate-content td:hover,
.layui-laydate-list li:hover{background-color: #eaeaea; color: #333;}
.layui-laydate-list li:hover{background-color: #eee; color: #333;}
.laydate-time-list li ol{margin: 0; padding: 0; border: 1px solid #e2e2e2; border-left-width: 0;}
.laydate-time-list li:first-child ol{border-left-width: 1px;}
.laydate-time-list>li:hover{background: none;}

35
src/layui.js vendored

@ -17,7 +17,7 @@
}
,Layui = function(){
this.v = '2.6.2'; //版本号
this.v = '2.6.3'; //版本号
}
//获取layui所在目录
@ -46,7 +46,7 @@
,isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]'
//内置模块
,modules = {
,modules = config.builtin = {
lay: 'lay' //基础 DOM 操作
,layer: 'layer' //弹层
,laydate: 'laydate' //日期
@ -69,7 +69,8 @@
,code: 'code' //代码修饰器
,jquery: 'jquery' //DOM 库(第三方)
,'layui.all': '../layui' //聚合
,all: 'all'
,'layui.all': 'layui.all' //聚合标识(功能性的,非真实模块)
};
//记录基础数据
@ -108,9 +109,20 @@
,dir = config.dir = config.dir ? config.dir : getPath
,head = doc.getElementsByTagName('head')[0];
apps = typeof apps === 'string' ? [apps] : apps;
apps = function(){
if(typeof apps === 'string'){
return [apps];
}
//当第一个参数为 function 时,则自动加载所有内置模块,且执行的回调即为该 function 参数;
else if(typeof apps === 'function'){
callback = apps;
return ['all'];
}
return apps;
}();
//如果页面已经存在 jQuery 1.7+ 库且所定义的模块依赖 jQuery,则不加载内部 jquery 模块
/*
if(window.jQuery && jQuery.fn.on){
that.each(apps, function(index, item){
if(item === 'jquery'){
@ -119,6 +131,7 @@
});
layui.jquery = layui.$ = jQuery;
}
*/
var item = apps[0]
,timeout = 0;
@ -147,13 +160,19 @@
exports.push(layui[item]);
apps.length > 1 ?
that.use(apps.slice(1), callback, exports)
: ( typeof callback === 'function' && callback.apply(layui, exports) );
: ( typeof callback === 'function' && function(){
//保证文档加载完毕再执行回调
if(layui.jquery && typeof layui.jquery === 'function'){
return layui.jquery(function(){
callback.apply(layui, exports);
});
}
callback.apply(layui, exports);
}() );
}
//如果引入了聚合板,内置的模块则不必重复加载
if(apps.length === 0
|| (layui['layui.all'] && modules[item])
){
if( apps.length === 0 || (layui['layui.all'] && modules[item]) ){
return onCallback(), that;
}

32
src/modules/all.js

@ -1,13 +1,33 @@
/**
@Name用于打包聚合版该文件不会存在于构建后的目录
@Name用于加载所有内置模块
@LicenseMIT
*/
layui.define(function(exports){
var cache = layui.cache;
layui.config({
dir: cache.dir.replace(/lay\/dest\/$/, '')
layui.define(function(){
var mods = []
,builtin = layui.cache.builtin;
layui.each(builtin, function(modName){
(modName === 'all' || modName === 'layui.all') || mods.push(modName);
});
exports('layui.all', layui.v);
layui.cache.startTime = new Date().getTime();
return mods;
}(), function(exports){
"use strict";
var MOD_NAME = 'all'
//外部接口
,all = {
config: {}
,time: function(){
var time = new Date().getTime() - layui.cache.startTime;
delete layui.cache.startTime;
return time;
}()
};
exports(MOD_NAME, all);
});

2
src/modules/carousel.js

@ -1,6 +1,6 @@
/**
@Namelayui.carousel 轮播模块
@Namecarousel 轮播模块
@LicenseMIT
*/

2
src/modules/code.js

@ -1,6 +1,6 @@
/**
@Namelayui.code 代码修饰器
@Namecode 代码修饰器
@LicenseMIT
*/

2
src/modules/colorpicker.js

@ -1,6 +1,6 @@
/**
@Title: layui.colorpicker 颜色选择器组件
@Title: colorpicker 颜色选择器组件
@LicenseMIT
*/

2
src/modules/demo.js

@ -1,6 +1,6 @@
/**
@Namelayui.MODULE_DEMO_NAME 模块组件通用结构
@NameMODULE_DEMO_NAME 模块组件通用结构
@LicenseMIT
*/

4
src/modules/dropdown.js

@ -1,12 +1,12 @@
/**
@Namelayui.dropdown 下拉菜单组件
@Namedropdown 下拉菜单组件
@LicenseMIT
*/
layui.define(['jquery', 'laytpl', 'lay'], function(exports){
//"use strict";
"use strict";
var $ = layui.$
,laytpl = layui.laytpl

2
src/modules/element.js

@ -1,6 +1,6 @@
/**
@Namelayui.element 常用元素操作
@Nameelement 常用元素操作
@LicenseMIT
*/

2
src/modules/flow.js

@ -1,6 +1,6 @@
/**
@Namelayui.flow 流加载
@Name flow 流加载组件
@LicenseMIT
*/

2
src/modules/form.js

@ -1,6 +1,6 @@
/**
@Namelayui.form 表单组件
@Nameform 表单组件
@LicenseMIT
*/

88
src/modules/laydate.js

@ -20,7 +20,7 @@
}
,laydate = {
v: '5.2.0'
v: '5.2.1'
,config: {} //全局配置项
,index: (window.laydate && window.laydate.v) ? 100000 : 0
,path: ready.getPath
@ -804,6 +804,7 @@
//同步按钮可点状态
that.setBtnStatus();
that.stampRange(index, tds); //标记范围内的日期
return that;
};
@ -1116,7 +1117,90 @@
return this;
};
//执行done/change回调
//标记范围内的日期
Class.prototype.stampRange = function(index, tds){
var that = this
,options = that.config
,startTime, endTime;
if(!options.range) return;
startTime = that.newDate(options.dateTime).getTime();
endTime = that.newDate(that.endDate).getTime();
//标记范围样式
lay.each(tds, function(i, item){
var ymd = lay(item).attr('lay-ymd').split('-')
,thisTime = that.newDate({
year: ymd[0]
,month: ymd[1] - 1
,date: ymd[2]
}).getTime();
if(index == 0){
if(thisTime > startTime){
lay(item).addClass(ELEM_SELECTED);
}
} else {
if(thisTime < endTime){
lay(item).addClass(ELEM_SELECTED);
}
}
return;
if(thisTime === startTime || thisTime === endTime){
lay(item).addClass(
lay(item).hasClass(ELEM_PREV) || lay(item).hasClass(ELEM_NEXT)
? ELEM_SELECTED
: THIS
);
}
if(thisTime > startTime && thisTime < endTime){
lay(item).addClass(ELEM_SELECTED);
}
});
return;
if(options.range && !that.endDate) lay(that.footer).find(ELEM_CONFIRM).addClass(DISABLED);
if(!that.endDate) return;
startTime = that.newDate({
year: that.startDate.year
,month: that.startDate.month
,date: that.startDate.date
}).getTime();
endTime = that.newDate({
year: that.endDate.year
,month: that.endDate.month
,date: that.endDate.date
}).getTime();
if(startTime > endTime) return that.hint(TIPS_OUT);
lay.each(tds, function(i, item){
var ymd = lay(item).attr('lay-ymd').split('-')
,thisTime = that.newDate({
year: ymd[0]
,month: ymd[1] - 1
,date: ymd[2]
}).getTime();
lay(item).removeClass(ELEM_SELECTED + ' ' + THIS);
if(thisTime === startTime || thisTime === endTime){
lay(item).addClass(
lay(item).hasClass(ELEM_PREV) || lay(item).hasClass(ELEM_NEXT)
? ELEM_SELECTED
: THIS
);
}
if(thisTime > startTime && thisTime < endTime){
lay(item).addClass(ELEM_SELECTED);
}
});
};
//执行 done/change 回调
Class.prototype.done = function(param, type){
var that = this
,options = that.config

2
src/modules/layedit.js

@ -1,6 +1,6 @@
/**
@Namelayui.layedit 富文本编辑器
@Namelayedit 富文本编辑器
@LicenseMIT
*/

4
src/modules/layer.js

@ -905,6 +905,7 @@ layer.title = function(name, index){
//关闭layer总方法
layer.close = function(index){
layer.ready(function(){
var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
if(!layero[0]) return;
var WRAP = 'layui-layer-wrap', remove = function(){
@ -951,16 +952,19 @@ layer.close = function(index){
remove();
}, 200);
}
});
};
//关闭所有层
layer.closeAll = function(type){
layer.ready(function(){
$.each($('.'+doms[0]), function(){
var othis = $(this);
var is = type ? (othis.attr('type') === type) : 1;
is && layer.close(othis.attr('times'));
is = null;
});
});
};
/**

2
src/modules/laypage.js

@ -1,6 +1,6 @@
/**
@Name : layui.laypage 分页组件
@Name : laypage 分页组件
@LicenseMIT
*/

2
src/modules/laytpl.js

@ -1,6 +1,6 @@
/**
@Name : layui.laytpl 模板引擎
@Name : laytpl 模板引擎
@LicenseMIT
*/

13
src/modules/layui.all.js

@ -0,0 +1,13 @@
/**
@Name用于打包聚合版该文件不会存在于构建后的目录
*/
layui.define(function(exports){
var cache = layui.cache;
layui.config({
dir: cache.dir.replace(/lay\/dest\/$/, '')
});
exports('layui.all', layui.v);
});

2
src/modules/rate.js

@ -1,6 +1,6 @@
/**
@Title: layui.rate 评分评星组件
@Title: rate 评分评星组件
@LicenseMIT
*/

2
src/modules/slider.js

@ -1,6 +1,6 @@
/**
@Title: layui.slider 滑块组件
@Title: slider 滑块组件
@LicenseMIT
*/

15
src/modules/table.js

@ -1,6 +1,6 @@
/**
@Namelayui.table 表格操作组件
@Nametable 表格操作组件
@LicenseMIT
*/
@ -963,7 +963,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
that.eachCols(function(i3, item3){
var field = item3.field || i3;
//td内容
//td 内容
var content = function(){
var text = item3.totalRowText || ''
,thisTotalNum = parseFloat(totalNums[field]).toFixed(2)
@ -995,7 +995,16 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
var str = (options.index + '-' + item3.key);
return item3.type === 'normal' ? str
: (str + ' laytable-cell-' + item3.type);
}() +'">' + content
}() +'">' + function(){
var totalRow = item3.totalRow || options.totalRow;
//如果 totalRow 参数为字符类型,则解析为自定义模版
if(typeof totalRow === 'string'){
return laytpl(totalRow).render($.extend({
TOTAL_NUMS: content
}, item3))
}
return content;
}()
,'</div></td>'].join('');
item3.field && (that.dataTotal[field] = content);

2
src/modules/transfer.js

@ -1,6 +1,6 @@
/**
@Namelayui.transfer 穿梭框组件
@Nametransfer 穿梭框组件
@LicenseMIT
*/

2
src/modules/tree.js

@ -1,6 +1,6 @@
/**
@Namelayui.tree 树组件
@Nametree 树组件
@LicenseMIT
*/

2
src/modules/upload.js

@ -1,6 +1,6 @@
/**
@Title: layui.upload 文件上传组件
@Title: upload 文件上传组件
@LicenseMIT
*/

2
src/modules/util.js

@ -1,6 +1,6 @@
/**
@Namelayui.util 工具集组件
@Nameutil 工具集组件
@LicenseMIT
*/

Loading…
Cancel
Save