From f453f15b714b86f31f51a8dcfc2dbedf49aaa9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Wed, 9 Aug 2023 23:17:55 +0800 Subject: [PATCH 01/39] =?UTF-8?q?=E5=88=A0=E9=99=A4=20treeTable=20?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/treeTable.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/modules/treeTable.js b/src/modules/treeTable.js index dd033bd0..87cf5b62 100644 --- a/src/modules/treeTable.js +++ b/src/modules/treeTable.js @@ -1245,7 +1245,7 @@ layui.define(['table'], function (exports) { options.hasNumberCol && formatNumber(that); // 重新适配尺寸 - table.resize(id); + treeTable.resize(id); } /** @@ -1396,9 +1396,6 @@ layui.define(['table'], function (exports) { tableViewElem.find(ELEM_MAIN).find('tr[lay-data-index="' + newNodes[0][LAY_DATA_INDEX] + '"]').get(0).scrollIntoViewIfNeeded(); } - // 重新适配尺寸 - table.resize(id); - return newNodes; } From f7d1696ab1a3943d33236d5d666b55a83fbfb2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:32:35 +0800 Subject: [PATCH 02/39] =?UTF-8?q?=E4=BC=98=E5=8C=96=20layer=20=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E9=BB=98=E8=AE=A4=E5=8A=A8=E7=94=BB=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E5=B1=82=E5=90=8E=EF=BC=8C=E9=BC=A0=E6=A0=87=E7=A7=BB=E5=85=A5?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=87=BA=E7=8E=B0=E5=BE=80=E4=B8=8A=E5=81=8F?= =?UTF-8?q?=E7=A7=BB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/css/modules/layer.css | 10 +++++----- src/modules/layer.js | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/css/modules/layer.css b/src/css/modules/layer.css index 5b45dd7a..8052b8a1 100644 --- a/src/css/modules/layer.css +++ b/src/css/modules/layer.css @@ -13,7 +13,7 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;} .layui-layer-content{position:relative;} .layui-layer-border{border: 1px solid #B2B2B2; border: 1px solid rgba(0,0,0,.1); box-shadow: 1px 1px 5px rgba(0,0,0,.2);} .layui-layer-setwin span, -.layui-layer-btn a{display:inline-block; *display:inline; *zoom:1; vertical-align:top;} +.layui-layer-btn a{display: inline-block; vertical-align: middle; *display: inline; *zoom:1; } .layui-layer-move{display: none; position: fixed; *position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; cursor: move; opacity: 0; filter:alpha(opacity=0); background-color: #fff; z-index: 2147483647;} .layui-layer-resize{position: absolute; width: 15px; height: 15px; right: 0; bottom: 0; cursor: se-resize;} @@ -120,8 +120,8 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;} /* 标题栏 */ .layui-layer-title{padding: 0 81px 0 16px; height: 50px; line-height: 50px; border-bottom:1px solid #F0F0F0; font-size: 14px; color:#333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 2px 2px 0 0;} .layui-layer-setwin{position:absolute; right: 15px; *right:0; top: 16px; font-size:0; line-height: initial;} -.layui-layer-setwin span{position:relative; width: 16px; height: 16px; line-height: 18px; margin-left: 10px; text-align: center; font-size: 16px; cursor: pointer; color: #000; _overflow:hidden;} -.layui-layer-setwin .layui-layer-min:before{content: ''; position: absolute; width: 12px; height: 1px; left: 50%; top: 50%; margin: -0.5px 0 0 -6px; background-color: #2E2D3C; cursor: pointer; _overflow:hidden;} +.layui-layer-setwin span{position:relative; width: 16px; height: 16px; line-height: 18px; margin-left: 10px; text-align: center; font-size: 16px; cursor: pointer; color: #000; _overflow: hidden; box-sizing: border-box;} +.layui-layer-setwin .layui-layer-min:before{content: ''; position: absolute; width: 12px; border-bottom: 1px solid #2E2D3C; left: 50%; top: 50%; margin: -0.5px 0 0 -6px; cursor: pointer; _overflow:hidden;} .layui-layer-setwin .layui-layer-min:hover:before{background-color: #2D93CA} .layui-layer-setwin .layui-layer-max:before, .layui-layer-setwin .layui-layer-max:after{content: ''; position: absolute; left: 50%; top: 50%; z-index: 1; width: 9px; height: 9px; margin: -5px 0 0 -5px; border: 1px solid #2E2D3C;} @@ -138,10 +138,10 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;} /* 按钮栏 */ .layui-layer-btn{text-align: right; padding: 0 15px 12px; pointer-events: auto; user-select: none; -webkit-user-select: none;} -.layui-layer-btn a{height: 28px; line-height: 28px; margin: 5px 5px 0; padding: 0 15px; border: 1px solid #dedede; background-color:#fff; color: #333; border-radius: 2px; font-weight:400; cursor:pointer; text-decoration: none;} +.layui-layer-btn a{height: 30px; line-height: 30px; margin: 5px 5px 0; padding: 0 16px; border: 1px solid #dedede; background-color: #fff; color: #333; border-radius: 2px; font-weight: 400; cursor: pointer; text-decoration: none; box-sizing: border-box;} .layui-layer-btn a:hover{opacity: 0.9; text-decoration: none;} .layui-layer-btn a:active{opacity: 0.8;} -.layui-layer-btn .layui-layer-btn0{border-color: #1E9FFF; background-color: #1E9FFF; color:#fff;} +.layui-layer-btn .layui-layer-btn0{border-color: transparent; background-color: #1E9FFF; color:#fff;} .layui-layer-btn-l{text-align: left;} .layui-layer-btn-c{text-align: center;} diff --git a/src/modules/layer.js b/src/modules/layer.js index 4c0f4b5d..b3d774ac 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -377,7 +377,11 @@ Class.pt.vessel = function(conType, callback){ for(var i = 0, len = config.btn.length; i < len; i++){ button += ''+ config.btn[i] +'' } - return '
'+ button +'
' + return '
'+ button +'
' }() : '') + (config.resize ? '' : '') + '' From 2a60f6625a3735ba30963cad2c7659c686ee6403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:41:14 +0800 Subject: [PATCH 03/39] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20dropdown=20=E5=9C=A8?= =?UTF-8?q?=E6=9F=90=E4=BA=9B=E7=89=B9=E6=AE=8A=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B5=8F=E8=A7=88=E5=99=A8=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E6=97=B6=E5=87=BA=E7=8E=B0=E7=9A=84=20`resiz?= =?UTF-8?q?e`=20=E4=BA=8B=E4=BB=B6=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/dropdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index 8681d4d8..2099296b 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -455,7 +455,7 @@ layui.define(['jquery', 'laytpl', 'lay', 'util'], function(exports){ var that = thisModule.getThis(dropdown.thisId); if(!that) return; - if(!that.elemView[0] || !$('.'+ STR_ELEM)[0]){ + if((that.elemView && !that.elemView[0]) || !$('.'+ STR_ELEM)[0]){ return false; } From fe735b84df5fc985d33a42e0bc8efd2f9cc49c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:50:17 +0800 Subject: [PATCH 04/39] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=8F=8F=E8=BF=B0=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/versions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/versions.md b/docs/versions.md index 1294741e..5f720335 100644 --- a/docs/versions.md +++ b/docs/versions.md @@ -19,7 +19,7 @@ toc: true - #### table - 优化 在自定义模板中放置 `checkbox` 时对应的文字显示异常问题 # I7LQNO - - 调整 `totalRow` 属性在 `table.reloadData()` 数据重载时的支持 # I7R6VY + - 优化 `totalRow` 属性在 `table.reloadData()` 数据重载时的支持 # I7R6VY - #### treeTable - 修复 执行 `treeTable.addNodes()` 增加节点导致当前节点选中状态丢失的问题 # I7Q6IP - 优化 增加和删除节点时,对容器尺寸重新进行自动适配 @@ -334,7 +334,7 @@ toc: true --- -

+

2.8.0 2023-04-24

From ef1b952068720f73df102b3d6c33631ba4d284bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:50:24 +0800 Subject: [PATCH 05/39] =?UTF-8?q?=E4=BC=98=E5=8C=96=20`table.reload()`=20?= =?UTF-8?q?=E9=80=A0=E6=88=90=20`window=20resize`=20=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=BB=91=E5=AE=9A=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/table.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/modules/table.js b/src/modules/table.js index 30b7b83b..8dd1def4 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -2494,21 +2494,23 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ layer.close(that.tipsIndex); }); - - // 适应 - _WIN.on('resize', function(){ - that.resize(); - }); }; - //一次性事件 - ;(function(){ - //全局点击 + // 全局事件 + (function(){ + // 自适应尺寸 + _WIN.on('resize', function(){ + layui.each(thisTable.that, function(){ + this.resize(); + }); + }); + + // 全局点击 _DOC.on('click', function(){ _DOC.trigger('table.remove.tool.panel'); }); - //工具面板移除事件 + // 工具面板移除事件 _DOC.on('table.remove.tool.panel', function(){ $('.' + ELEM_TOOL_PANEL).remove(); }); From da711a38cc9f03421b300512e6791554cbc15c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=81=AB=E7=83=88=E9=B8=9F?= <250023777@qq.com> Date: Thu, 10 Aug 2023 22:16:08 +0800 Subject: [PATCH 06/39] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/code.js | 2 +- src/modules/colorpicker.js | 2 +- src/modules/flow.js | 66 +++++++++++++++++++------------------- src/modules/laydate.js | 10 +++--- 4 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/modules/code.js b/src/modules/code.js index 6408077c..4dd034db 100644 --- a/src/modules/code.js +++ b/src/modules/code.js @@ -294,7 +294,7 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){ // header var headerElem = $('
'); - // 添加组件 clasName + // 添加组件 className othis.addClass('layui-code-view layui-box'); // 自定义风格 diff --git a/src/modules/colorpicker.js b/src/modules/colorpicker.js index 514e35bd..c88427f4 100644 --- a/src/modules/colorpicker.js +++ b/src/modules/colorpicker.js @@ -214,7 +214,7 @@ layui.define(['jquery', 'lay'], function(exports){ ,'
'].join('')) //初始化颜色选择框 - var elem = options.elem = $(options.elem); + elem = options.elem = $(options.elem); options.size && elemColorBox.addClass('layui-colorpicker-'+ options.size); //初始化颜色选择框尺寸 // 插入颜色选择框 diff --git a/src/modules/flow.js b/src/modules/flow.js index bb4a4bcd..ae63f2c7 100644 --- a/src/modules/flow.js +++ b/src/modules/flow.js @@ -1,11 +1,11 @@ /** - * flow 流加载组件 + * flow 流加载组件 */ - - + + layui.define('jquery', function(exports){ "use strict"; - + var $ = layui.$, Flow = function(options){} ,ELEM_MORE = 'layui-flow-more' ,ELEM_LOAD = ''; @@ -14,26 +14,26 @@ layui.define('jquery', function(exports){ Flow.prototype.load = function(options){ var that = this, page = 0, lock, isOver, lazyimg, timer; options = options || {}; - + var elem = $(options.elem); if(!elem[0]) return; var scrollElem = $(options.scrollElem || document); //滚动条所在元素 var mb = options.mb || 50; //与底部的临界距离 var isAuto = 'isAuto' in options ? options.isAuto : true; //是否自动滚动加载 var end = options.end || '没有更多了'; //“末页”显示文案 - + //滚动条所在元素是否为document var notDocument = options.scrollElem && options.scrollElem !== document; - + //加载更多 var ELEM_TEXT = '加载更多' ,more = $('
'+ ELEM_TEXT +'
'); - + if(!elem.find('.layui-flow-more')[0]){ elem.append(more); } - + //加载下一个元素 - var next = function(html, over){ + var next = function(html, over){ html = $(html); more.before(html); over = over == 0 ? true : null; @@ -42,43 +42,43 @@ layui.define('jquery', function(exports){ lock = null; lazyimg && lazyimg(); }; - + //触发请求 var done = function(){ lock = true; more.find('a').html(ELEM_LOAD); typeof options.done === 'function' && options.done(++page, next); }; - + done(); - + //不自动滚动加载 more.find('a').on('click', function(){ var othis = $(this); if(isOver) return; lock || done(); }); - + //如果允许图片懒加载 if(options.isLazyimg){ - var lazyimg = that.lazyimg({ + lazyimg = that.lazyimg({ elem: options.elem + ' img' ,scrollElem: options.scrollElem }); } - + if(!isAuto) return that; - + scrollElem.on('scroll', function(){ var othis = $(this), top = othis.scrollTop(); - + if(timer) clearTimeout(timer); if(isOver || !elem.width()) return; //如果已经结束,或者元素处于隐藏状态,则不执行滚动加载 - + timer = setTimeout(function(){ //计算滚动所在容器的可视高度 var height = notDocument ? othis.height() : $(window).height(); - + //计算滚动所在容器的实际高度 var scrollHeight = notDocument ? othis.prop('scrollHeight') @@ -90,21 +90,21 @@ layui.define('jquery', function(exports){ } }, 100); }); - + return that; }; - + //图片懒加载 Flow.prototype.lazyimg = function(options){ var that = this, index = 0, haveScroll; options = options || {}; - + var scrollElem = $(options.scrollElem || document); //滚动条所在元素 var elem = options.elem || 'img'; - + //滚动条所在元素是否为document var notDocument = options.scrollElem && options.scrollElem !== document; - + //显示图片 var show = function(item, height){ var start = scrollElem.scrollTop(), end = start + height; @@ -119,7 +119,7 @@ layui.define('jquery', function(exports){ layui.img(src, function(){ var next = that.lazyimg.elem.eq(index); item.attr('src', src).removeAttr('lay-src'); - + /* 当前图片加载就绪后,检测下一个图片是否在当前屏 */ next[0] && render(next); index++; @@ -130,7 +130,7 @@ layui.define('jquery', function(exports){ } } }, render = function(othis, scroll){ - + //计算滚动所在容器的可视高度 var height = notDocument ? (scroll||scrollElem).height() : $(window).height(); var start = scrollElem.scrollTop(), end = start + height; @@ -145,18 +145,18 @@ layui.define('jquery', function(exports){ var item = that.lazyimg.elem.eq(i), elemTop = notDocument ? function(){ return item.offset().top - scrollElem.offset().top + start; }() : item.offset().top; - + show(item, height); index = i; - + //如果图片的top坐标,超出了当前屏,则终止后续图片的遍历 if(elemTop > end) break; } } }; - + render(); - + if(!haveScroll){ var timer; scrollElem.on('scroll', function(){ @@ -165,12 +165,12 @@ layui.define('jquery', function(exports){ timer = setTimeout(function(){ render(null, othis); }, 50); - }); + }); haveScroll = true; } return render; }; - + //暴露接口 exports('flow', new Flow()); }); diff --git a/src/modules/laydate.js b/src/modules/laydate.js index 0725bfb2..3da065fe 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -1128,9 +1128,9 @@ //日历表 Class.prototype.calendar = function(value, index, type){ + index = index ? 1 : 0; var that = this ,options = that.config - ,index = index ? 1 : 0 ,dateTime = value || that.thisDateTime(index) ,thisDate = new Date(), startWeek, prevMaxDate, thisMaxDate ,lang = that.lang() @@ -1156,7 +1156,7 @@ //赋值日 lay.each(tds, function(index_, item){ - var YMD = [dateTime.year, dateTime.month], st = 0; + var YMD = [dateTime.year, dateTime.month], st; item = lay(item); item.removeAttr("class"); if(index_ < startWeek){ @@ -1971,7 +1971,7 @@ ,elemCont = that.elemCont[index || 0] ,listYM = that.listYM[index] - ,addSubYeay = function(type){ + ,addSubYear = function(type){ var isYear = lay(elemCont).find('.laydate-year-list')[0] ,isMonth = lay(elemCont).find('.laydate-month-list')[0]; @@ -2006,7 +2006,7 @@ return { prevYear: function(){ - if(addSubYeay('sub')) return; + if(addSubYear('sub')) return; if (that.rangeLinked) { options.dateTime.year--; that.checkDate('limit').calendar(null, null, 'init'); @@ -2048,7 +2048,7 @@ } } ,nextYear: function(){ - if(addSubYeay()) return; + if(addSubYear()) return; if (that.rangeLinked) { options.dateTime.year++; that.checkDate('limit').calendar(null, 0, 'init'); From ea6d2e4fb53939d463341e9f79eeca8bc3a7630b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Fri, 11 Aug 2023 23:14:10 +0800 Subject: [PATCH 07/39] =?UTF-8?q?=E5=BE=AE=E8=B0=83=202.8.13=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=A5=E5=BF=97=E6=8F=8F=E8=BF=B0=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/versions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/versions.md b/docs/versions.md index 5f720335..fcdf23b1 100644 --- a/docs/versions.md +++ b/docs/versions.md @@ -22,7 +22,7 @@ toc: true - 优化 `totalRow` 属性在 `table.reloadData()` 数据重载时的支持 # I7R6VY - #### treeTable - 修复 执行 `treeTable.addNodes()` 增加节点导致当前节点选中状态丢失的问题 # I7Q6IP - - 优化 增加和删除节点时,对容器尺寸重新进行自动适配 + - 优化 删除节点时,对容器尺寸重新进行自动适配 - #### tree - 优化 容器样式,以解决用于其他组件内部可能造成的样式异常问题 # I7QAO3 - #### dropdown From 0e4cca4e3e1b6865bb4952d9c7a05a994e9fceeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Sat, 12 Aug 2023 19:53:06 +0800 Subject: [PATCH 08/39] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20`layui.config()`=20?= =?UTF-8?q?=E7=9A=84=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/base.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/base.md b/docs/base.md index fabab0d3..f7d872f7 100644 --- a/docs/base.md +++ b/docs/base.md @@ -15,10 +15,10 @@ toc: true ``` layui.config({ - base: '' // 设定 Layui 扩展模块的所在目录,一般与 extend 方法搭配使用 + base: '', // 设定 Layui 扩展模块的所在目录,一般与 extend 方法搭配使用 version: false, // 用于更新模块缓存,默认 false。若设为 true,即让浏览器不缓存。也可设为一个任意数值 dir: 'layui/', // layui 基础目录,用于动态导入 src/layui.js 时的内置模块的加载。一般无需设置 - debug: false, // 用于开启调试模式,默认 false。若设为 true,则模块的引入节点会保留在页面 + debug: false // 用于开启调试模式,默认 false。若设为 true,则模块的引入节点会保留在页面 }); ``` From d598c8de841bf5a816c3b254c802e108f39ba0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Tue, 15 Aug 2023 11:25:56 +0800 Subject: [PATCH 09/39] =?UTF-8?q?=E4=BC=98=E5=8C=96=20table=20=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/table/examples/editModes.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/table/examples/editModes.md b/docs/table/examples/editModes.md index 9c87cf7c..c721c30a 100644 --- a/docs/table/examples/editModes.md +++ b/docs/table/examples/editModes.md @@ -3,7 +3,7 @@ - - From f428eceb6c94596b1923e28bdd4fcf136471b75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Fri, 18 Aug 2023 17:58:39 +0800 Subject: [PATCH 37/39] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20carousel=20=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E4=B8=AD=E7=9A=84=20`autoplay`=20=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=8F=AF=E9=80=89=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/carousel/detail/options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/carousel/detail/options.md b/docs/carousel/detail/options.md index d347040a..d4b0908a 100644 --- a/docs/carousel/detail/options.md +++ b/docs/carousel/detail/options.md @@ -92,7 +92,7 @@ - `true` 自动滚动,鼠标移入会暂停、移出重新恢复 - `false` 不自动滚动 -- `alway` 始终自动滚动,不受鼠标移入移出影响 2.7+ +- `always` 始终自动滚动,不受鼠标移入移出影响 2.7+ From 0dc95b4ee96bc263c254b2d544bc88e9db253ecb Mon Sep 17 00:00:00 2001 From: sight <1453017105@qq.com> Date: Sat, 19 Aug 2023 07:02:32 +0800 Subject: [PATCH 38/39] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20laydate=20=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E9=80=89=E6=8B=A9=20`shortcuts.value=20`=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E5=87=BD=E6=95=B0=E7=B1=BB=E5=9E=8B=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/laydate.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/laydate.js b/src/modules/laydate.js index 3da065fe..36973a07 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -591,7 +591,9 @@ return shortcutBtns.join(''); }()).find('li').on('click', function (event) { var btnSetting = options.shortcuts[this.dataset['index']] || {}; - var value = btnSetting.value || []; + var value = (typeof btnSetting.value === 'function' + ? btnSetting.value() + : btnSetting.value) || []; if (!layui.isArray(value)) { value = [value]; } From d1bc0468a566d22f45ff542b20a5389d9366c111 Mon Sep 17 00:00:00 2001 From: sight <1453017105@qq.com> Date: Sat, 19 Aug 2023 07:44:51 +0800 Subject: [PATCH 39/39] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20laydate=20=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/laydate/detail/options.md | 3 +- docs/laydate/examples/shortcut.md | 76 +++++++++++++++++-------------- 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/docs/laydate/detail/options.md b/docs/laydate/detail/options.md index 564e0ca7..1be45c1a 100644 --- a/docs/laydate/detail/options.md +++ b/docs/laydate/detail/options.md @@ -249,11 +249,12 @@ shortcuts: [ - 若为 `string` 类型,必须和 `format` 设置的格式对应; - 若为 `date` 对象类型,则可通过操作 `new Date()` 来对选项值进行相应的返回计算; - 若为 `array` 类型,则数组成员可填写开始日期和结束日期。 +- 若为 `function` 类型,返回值同上。2.8.16+ 详细用法可参考: [#示例](#demo-shortcut) -string
date
array +string
date
array
function - diff --git a/docs/laydate/examples/shortcut.md b/docs/laydate/examples/shortcut.md index a1d31207..86676922 100644 --- a/docs/laydate/examples/shortcut.md +++ b/docs/laydate/examples/shortcut.md @@ -90,16 +90,21 @@ layui.use(function(){ var now = new Date(); now.setDate(now.getDate() - 1); return now; - }() + } + }, + { + text: "今天", + value: function(){ + return Date.now(); + } }, - { text: "今天", value: Date.now() }, { text: "明天", value: function(){ var now = new Date(); now.setDate(now.getDate() + 1); return now; - }() + } }, { text: "上个月", @@ -108,7 +113,7 @@ layui.use(function(){ // now.setDate(now.getDate() - 1); now.setMonth(now.getMonth() - 1); return [now]; - }() + } }, { text: "上个月的前一天", @@ -117,7 +122,7 @@ layui.use(function(){ now.setMonth(now.getMonth() - 1); now.setDate(now.getDate() - 1); return [now]; - }() + } }, { text: "某一天", @@ -137,7 +142,7 @@ layui.use(function(){ var now = new Date(); now.setFullYear(now.getFullYear() - 1); return now; - }() + } }, { text: "明年", @@ -145,7 +150,7 @@ layui.use(function(){ var now = new Date(); now.setFullYear(now.getFullYear() + 1); return now; - }() + } } ] }); @@ -161,7 +166,7 @@ layui.use(function(){ var now = new Date(); now.setMonth(now.getMonth() - 1); return now; - }() + } }, { text: "下个月", @@ -169,7 +174,7 @@ layui.use(function(){ var now = new Date(); now.setMonth(now.getMonth() + 1); return now; - }() + } }, { text: "去年12月", @@ -178,7 +183,7 @@ layui.use(function(){ now.setMonth(11); now.setFullYear(now.getFullYear() - 1); return now; - }() + } } ] }); @@ -214,16 +219,21 @@ layui.use(function(){ var now = new Date(); now.setDate(now.getDate() - 1); return now; - }() + } + }, + { + text: "今天", + value: function(){ + return Date.now(); + } }, - { text: "今天", value: Date.now() }, { text: "明天", value: function(){ var now = new Date(); now.setDate(now.getDate() + 1); return now; - }() + } }, { text: "上个月", @@ -232,7 +242,7 @@ layui.use(function(){ // now.setDate(now.getDate() - 1); now.setMonth(now.getMonth() - 1); return [now]; - }() + } }, { text: "上个月的前一天", @@ -241,7 +251,7 @@ layui.use(function(){ now.setMonth(now.getMonth() - 1); now.setDate(now.getDate() - 1); return [now]; - }() + } }, { text: "某一天", @@ -263,7 +273,7 @@ layui.use(function(){ var now = new Date(); now.setDate(now.getDate() - 1); return now; - }() + } }, { text: "今天", value: Date.now() }, { @@ -272,7 +282,7 @@ layui.use(function(){ var now = new Date(); now.setDate(now.getDate() + 1); return now; - }() + } }, { text: "上个月", @@ -281,7 +291,7 @@ layui.use(function(){ // now.setDate(now.getDate() - 1); now.setMonth(now.getMonth() - 1); return [now]; - }() + } }, { text: "上个月的前一天", @@ -290,7 +300,7 @@ layui.use(function(){ now.setMonth(now.getMonth() - 1); now.setDate(now.getDate() - 1); return [now]; - }() + } }, { text: "某一天", @@ -323,7 +333,7 @@ layui.use(function(){ value.push(new Date(date2)); return value; - }() + } }, { text: "这个月", @@ -344,7 +354,7 @@ layui.use(function(){ value.push(new Date(date2)); return value; - }() + } }, { text: "下个月", @@ -365,7 +375,7 @@ layui.use(function(){ value.push(new Date(date2)); return value; - }() + } } ] }); @@ -383,7 +393,7 @@ layui.use(function(){ var now = new Date(); now.setFullYear(now.getFullYear() - 1); return [now, new Date()]; - }() + } }, { text: "未来一年", @@ -391,7 +401,7 @@ layui.use(function(){ var now = new Date(); now.setFullYear(now.getFullYear() + 1); return [new Date(), now]; - }() + } }, { text: "近三年", @@ -399,7 +409,7 @@ layui.use(function(){ var now = new Date(); now.setFullYear(now.getFullYear() - 3); return [now, new Date()]; - }() + } } ] }); @@ -420,7 +430,7 @@ layui.use(function(){ date2.setMonth(0, 1); date2.setHours(0, 0, 0, 0); return [date1, date2.getTime() - 1]; - }() + } }, { text: "明年", @@ -428,7 +438,7 @@ layui.use(function(){ var now = new Date(); now.setFullYear(now.getFullYear() + 1); return [now, now]; - }() + } }, { text: "近三年", @@ -436,7 +446,7 @@ layui.use(function(){ var now = new Date(); now.setFullYear(now.getFullYear() - 3); return [now, new Date()]; - }() + } } ] }); @@ -457,7 +467,7 @@ layui.use(function(){ date2.setHours(11, 30, 0, 0); return [date1, date2]; - })() + }) }, { text: '13:00

15:00', @@ -469,7 +479,7 @@ layui.use(function(){ date2.setHours(15, 0, 0, 0); return [date1, date2]; - })() + }) } ] }); @@ -498,7 +508,7 @@ layui.use(function(){ value.push(new Date(date2)); return value; - }() + } }, { text: "这个月", @@ -519,7 +529,7 @@ layui.use(function(){ value.push(new Date(date2)); return value; - }() + } }, { text: "下个月", @@ -540,7 +550,7 @@ layui.use(function(){ value.push(new Date(date2)); return value; - }() + } } ] });