From 56a43c64b1977ed401083da581b22e726b603d58 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, 18 Jan 2024 00:07:39 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix(table):=20=E4=BF=AE=E5=A4=8D=20Chrome?= =?UTF-8?q?=20DevTools=20=E5=AE=A1=E6=9F=A5=20iframe=20=E4=B8=AD=20table?= =?UTF-8?q?=20=E5=85=83=E7=B4=A0=E6=97=B6=E5=AF=BC=E8=87=B4=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=B4=A9=E6=BA=83=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 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/modules/table.js b/src/modules/table.js index 94011e7c..ab427969 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -1750,7 +1750,24 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ lay.getStyleRules(style, function(item){ if (item.selectorText === ('.laytable-cell-'+ key)) { - return callback(item), true; + callback(item); + + /* 以下代码为防止 Chrome DevTools 审查 iframe 中的 table 元素时出现的页面崩溃 + * closes https://gitee.com/layui/layui/issues/I8N08M + * 具体原因不明,可能是初始操作 cssRules 触发了 DevTools inspect 的解析报错 + * 后续若浏览器本身修复了该问题,下述补丁也将会剔除 + */ + (function PatcheToCssRulesInDevTools(){ + if (self === parent) return; + var input = lay.elem('input', { + style: 'position: absolute; left: 0; top: 0; opacity: 0.01;' + }); + document.body.appendChild(input); + input.focus(); + document.body.removeChild(input); + })(); + + return true; } }); }; From a493cb5a7163581559611b9d4b0ca87f57a981a0 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, 23 Jan 2024 23:26:39 +0800 Subject: [PATCH 2/7] =?UTF-8?q?chore(table):=20=E7=A7=BB=E9=99=A4=E5=AF=B9?= =?UTF-8?q?=20DevTools=20=E7=9A=84=E4=B8=B4=E6=97=B6=E6=80=A7=E8=A1=A5?= =?UTF-8?q?=E4=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/table.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/modules/table.js b/src/modules/table.js index 871615b2..29cbe239 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -1758,22 +1758,6 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ lay.getStyleRules(style, function(item){ if (item.selectorText === ('.laytable-cell-'+ key)) { callback(item); - - /* 以下代码为防止 Chrome DevTools 审查 iframe 中的 table 元素时出现的页面崩溃 - * closes https://gitee.com/layui/layui/issues/I8N08M - * 具体原因不明,可能是初始操作 cssRules 触发了 DevTools inspect 的解析报错 - * 后续若浏览器本身修复了该问题,下述补丁也将会剔除 - */ - (function PatcheToCssRulesInDevTools(){ - if (self === parent) return; - var input = lay.elem('input', { - style: 'position: absolute; left: 0; top: 0; opacity: 0.01;' - }); - document.body.appendChild(input); - input.focus(); - document.body.removeChild(input); - })(); - return true; } }); From 209544f35167d3cfcaf9f3a36345b90480fbf8eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Sun, 4 Feb 2024 15:21:17 +0800 Subject: [PATCH 3/7] =?UTF-8?q?chore(upload):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=9B=BE=E7=89=87=20webp=20=E9=BB=98=E8=AE=A4=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/upload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/upload.js b/src/modules/upload.js index 1ec113ff..8ebcf718 100644 --- a/src/modules/upload.js +++ b/src/modules/upload.js @@ -510,7 +510,7 @@ layui.define(['lay', 'layer'], function(exports){ break; default: // 图片文件 layui.each(value, function(i, item){ - if(!RegExp('.\\.('+ (exts || 'jpg|png|gif|bmp|jpeg|svg') +')$', 'i').test(escape(item))){ + if(!RegExp('.\\.('+ (exts || 'jpg|png|gif|bmp|jpeg|svg|webp') +')$', 'i').test(escape(item))){ return check = true; } }); From 6d8f147cc126530751357cf5460df5b9b3711706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Sun, 31 Mar 2024 21:58:31 +0800 Subject: [PATCH 4/7] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=20form=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/form.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/form.html b/examples/form.html index 0bed4744..d05e3fef 100644 --- a/examples/form.html +++ b/examples/form.html @@ -121,7 +121,7 @@
- +
From fccccff983901fcef01a81e898cca4c0018ac1cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Sun, 31 Mar 2024 22:02:32 +0800 Subject: [PATCH 5/7] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20`input-number`?= =?UTF-8?q?=20=E7=BB=84=E4=BB=B6=E7=9A=84=20`lay-precision`=20=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=80=BC=E4=B8=BA=20`0`=20=E6=97=B6=E7=9A=84=E5=8F=96?= =?UTF-8?q?=E6=95=B4=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/form.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/modules/form.js b/src/modules/form.js index 9a4613fe..2047d24a 100644 --- a/src/modules/form.js +++ b/src/modules/form.js @@ -201,13 +201,19 @@ layui.define(['lay', 'layer', 'util'], function(exports){ precision = precision >= 0 ? precision : Math.max(decimals(step), decimals(rawValue)); - if(!noAction){ + // 初始化赋值 + if (!noAction) { // 初始渲染时只处理数字精度 - if(!isInit){ + if (!isInit) { if(value <= min) value = min; if(value >= max) value = max; } - if(precision) value = value.toFixed(precision); + // 若 `lay-precision` 为 0, 则表示只保留整数 + if (precision === 0) { + value = parseInt(value); + } else if(precision > 0) { // 小数位精度 + value = value.toFixed(precision); + } elem.val(value); } From d7104a37b34bff91f78c571edcb132b8edd6577c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Sun, 31 Mar 2024 22:05:11 +0800 Subject: [PATCH 6/7] =?UTF-8?q?docs(input):=20=E8=A1=A5=E5=85=85=20lay-pre?= =?UTF-8?q?cision=20=E5=B1=9E=E6=80=A7=E4=BB=8B=E7=BB=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/form/input.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/form/input.md b/docs/form/input.md index 7d6fc16e..e7cf5a3b 100644 --- a/docs/form/input.md +++ b/docs/form/input.md @@ -121,7 +121,7 @@ toc: true | step | 设置数字的加减间隔 | | min | 设置数字的最小值 | | max | 设置数字的最大值 | -| lay-precision 2.8.18+ | 设置数字的小数位精度 | +| lay-precision 2.8.18+ | 设置数字的小数位精度。注2.9.8+:若值为 `0`,则表示取整。 | ### 示例 From 23dfbcbbf04c33c833ad8eaf986c2416604b1413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Sun, 31 Mar 2024 22:11:20 +0800 Subject: [PATCH 7/7] =?UTF-8?q?chore(form):=20=E6=9B=B4=E6=AD=A3=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/form.js b/src/modules/form.js index 2047d24a..345bc0c0 100644 --- a/src/modules/form.js +++ b/src/modules/form.js @@ -201,7 +201,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){ precision = precision >= 0 ? precision : Math.max(decimals(step), decimals(rawValue)); - // 初始化赋值 + // 赋值 if (!noAction) { // 初始渲染时只处理数字精度 if (!isInit) {