From 2fba280516b52f5c39886769f4c5241e8d4b9ddf Mon Sep 17 00:00:00 2001 From: sunxiaobin89 <470459819@qq.com> Date: Mon, 12 Dec 2022 12:20:57 +0800 Subject: [PATCH 1/3] =?UTF-8?q?laydate=E4=BF=AE=E5=A4=8D=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=97=A5=E5=8E=86=E9=9D=A2=E6=9D=BF=E5=A4=B4=E9=83=A8=E7=9A=84?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E6=9C=88=E4=B8=8A=E4=B8=8B=E5=B9=B4=E6=88=96?= =?UTF-8?q?=E8=80=85=E9=80=89=E6=8B=A9=E5=B9=B4=E6=9C=88=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E6=97=A5=E5=8E=86=E7=9B=B4=E6=8E=A5=E7=A1=AE=E8=AE=A4=E8=80=8C?= =?UTF-8?q?=E4=B8=8D=E6=98=AF=E8=B7=B3=E8=BD=AC=E5=88=B0=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=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/laydate.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/modules/laydate.js b/src/modules/laydate.js index 73f8f297..68566abf 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -977,7 +977,7 @@ that.startDate = that.startDate || value && lay.extend({}, options.dateTime); // 有默认值才初始化startDate that.autoCalendarModel.auto && that.autoCalendarModel(); - that.endState = !that.rangeLinked || !!(that.startDate && that.endDate); // 初始化选中范围状态 + that.endState = !options.range || !that.rangeLinked || !!(that.startDate && that.endDate); // 初始化选中范围状态 fn && fn(); return that; @@ -1401,7 +1401,6 @@ } } else { that.checkDate('limit').calendar(dateTime, index, 'init'); // 重新渲染一下两个面板 - that.rangeLinked || that.choose(lay(elemCont).find('td.layui-this'), index); that.closeList(); } @@ -1415,8 +1414,8 @@ that.setValue(that.parse()).done().remove(); } } - - that.done(null, 'change'); + + (that.autoCalendarModel.auto && !that.rangeLinked) ? that.choose(lay(elemCont).find('td.layui-this'), index) : (that.endState && that.done(null, 'change')); lay(that.footer).find('.'+ ELEM_TIME_BTN).removeClass(DISABLED); }); } else { //时间选择面板 - 选择事件 @@ -1946,8 +1945,8 @@ } else { dateTime.year--; that.checkDate('limit').calendar(null, index); - that.choose(lay(elemCont).find('td.layui-this'), index); - that.done(null, 'change'); + // 面板自动切换的模式下重新判定是否发生模式转换等细节处理 + that.autoCalendarModel.auto ? that.choose(lay(elemCont).find('td.layui-this'), index) : that.done(null, 'change'); } } ,prevMonth: function(){ @@ -1962,8 +1961,7 @@ that.checkDate('limit').calendar(null, null, 'init'); if (!that.rangeLinked) { - that.choose(lay(elemCont).find('td.layui-this'), index); - that.done(null, 'change'); + that.autoCalendarModel.auto ? that.choose(lay(elemCont).find('td.layui-this'), index) : that.done(null, 'change'); } } ,nextMonth: function(){ @@ -1978,8 +1976,7 @@ that.checkDate('limit').calendar(null, null, 'init'); if (!that.rangeLinked) { - that.choose(lay(elemCont).find('td.layui-this'), index); - that.done(null, 'change'); + that.autoCalendarModel.auto ? that.choose(lay(elemCont).find('td.layui-this'), index) : that.done(null, 'change'); } } ,nextYear: function(){ @@ -1990,8 +1987,7 @@ } else { dateTime.year++; that.checkDate('limit').calendar(null, index); - that.choose(lay(elemCont).find('td.layui-this'), index); - that.done(null, 'change'); + that.autoCalendarModel.auto ? that.choose(lay(elemCont).find('td.layui-this'), index) : that.done(null, 'change'); } } }; From b2766cae72f53bdf7c08fbb0e5eb56b584150fe7 Mon Sep 17 00:00:00 2001 From: sunxiaobin89 <470459819@qq.com> Date: Mon, 12 Dec 2022 12:48:41 +0800 Subject: [PATCH 2/3] =?UTF-8?q?laydate=E8=B0=83=E6=95=B4=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E8=AE=A9=E4=BB=8E=E6=97=A0?= =?UTF-8?q?=E5=88=B0=E6=9C=89=E5=86=85=E5=AE=B9=E5=8F=98=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E6=96=87=E6=9C=AC=E9=A2=9C=E8=89=B2=E4=B8=8D=E8=A6=81?= =?UTF-8?q?=E6=9C=89=E4=B8=80=E4=B8=AA=E5=8F=98=E5=8C=96=E8=BF=87=E7=A8=8B?= =?UTF-8?q?=EF=BC=8C=E5=8F=AA=E6=9C=89=E5=9C=A8=E5=8E=9F=E5=85=88=E6=9C=89?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E7=84=B6=E5=90=8E=E6=8D=A2=E6=88=90=E5=8F=A6?= =?UTF-8?q?=E5=A4=96=E7=9A=84=E5=86=85=E5=AE=B9=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E6=89=8D=E4=BC=9A=E6=9C=89=E5=8F=98=E5=8C=96=E8=BF=87=E7=A8=8B?= =?UTF-8?q?=E8=AE=A9=E7=94=A8=E6=88=B7=E5=AF=B9=E4=BA=8E=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E6=9B=B4=E6=9C=89=E6=84=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/laydate.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/laydate.js b/src/modules/laydate.js index 68566abf..57b23f87 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -1602,9 +1602,12 @@ ,value = options.range ? ((that.rangeLinked ? that.endState : that.endDate) ? that.parse() : '') : that.parse(); //显示预览 - elemPreview.html(value).css({ + var oldValue = elemPreview.html(); + elemPreview.html(value); + oldValue && // 如果一开始有内容的时候才需要有一个变化过程 + elemPreview.css({ 'color': '#5FB878' - }); + }), setTimeout(function(){ elemPreview.css({ 'color': '#666' From a4c7269bad709d22aff496b1bc25ca0a3ac9acad Mon Sep 17 00:00:00 2001 From: sunxiaobin89 <470459819@qq.com> Date: Mon, 12 Dec 2022 14:15:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?laydate=E8=B0=83=E6=95=B4=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E8=AE=A9=E4=BB=8E=E6=97=A0?= =?UTF-8?q?=E5=88=B0=E6=9C=89=E5=86=85=E5=AE=B9=E5=8F=98=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E6=96=87=E6=9C=AC=E9=A2=9C=E8=89=B2=E4=B8=8D=E8=A6=81?= =?UTF-8?q?=E6=9C=89=E4=B8=80=E4=B8=AA=E5=8F=98=E5=8C=96=E8=BF=87=E7=A8=8B?= =?UTF-8?q?=EF=BC=8C=E5=8F=AA=E6=9C=89=E5=9C=A8=E5=8E=9F=E5=85=88=E6=9C=89?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E7=84=B6=E5=90=8E=E6=8D=A2=E6=88=90=E5=8F=A6?= =?UTF-8?q?=E5=A4=96=E7=9A=84=E5=86=85=E5=AE=B9=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E6=89=8D=E4=BC=9A=E6=9C=89=E5=8F=98=E5=8C=96=E8=BF=87=E7=A8=8B?= =?UTF-8?q?=E8=AE=A9=E7=94=A8=E6=88=B7=E5=AF=B9=E4=BA=8E=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E6=9B=B4=E6=9C=89=E6=84=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/laydate.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/laydate.js b/src/modules/laydate.js index 57b23f87..935b3d42 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -1605,14 +1605,14 @@ var oldValue = elemPreview.html(); elemPreview.html(value); oldValue && // 如果一开始有内容的时候才需要有一个变化过程 - elemPreview.css({ + (elemPreview.css({ 'color': '#5FB878' }), setTimeout(function(){ elemPreview.css({ 'color': '#666' }); - }, 300); + }, 300)); }; // 附加的渲染处理,在 ready 和 change 的时候调用