From 9c2f54c634aa679566db89f222cf9ffd7ef368b8 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, 24 Dec 2023 14:52:13 +0800 Subject: [PATCH 1/9] =?UTF-8?q?ci(issue):=20=E5=A2=9E=E5=8A=A0=20duplicate?= =?UTF-8?q?=20=E6=A0=87=E7=AD=BE=E7=9A=84=E5=AE=9A=E6=97=B6=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue-close-require.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/issue-close-require.yml b/.github/workflows/issue-close-require.yml index aaf5d0ea..31ff5338 100644 --- a/.github/workflows/issue-close-require.yml +++ b/.github/workflows/issue-close-require.yml @@ -22,9 +22,15 @@ jobs: inactive-day: 3 body: | 由于超过 3 天仍未收到相关重现或其他更多信息,该 issue 已被自动关闭。 + - name: Close issues with inactive days of 3 + uses: actions-cool/issues-helper@v3 + with: + actions: 'close-issues' + labels: 'duplicate' + inactive-day: 3 - name: Close issues with inactive days of 7 uses: actions-cool/issues-helper@v3 with: actions: 'close-issues' - labels: 'compatibility,resolved,unrelated,usage' + labels: 'compatibility,resolved,usage' inactive-day: 7 From 87c49a1a74b44a43a0d3e1228873b98d2526ce0b 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, 24 Dec 2023 14:53:01 +0800 Subject: [PATCH 2/9] =?UTF-8?q?docs(issue):=20=E4=BC=98=E5=8C=96=20discuss?= =?UTF-8?q?ion=20=E6=A0=87=E7=AD=BE=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue-labeled.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index 447e5649..7f7a8ce1 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -63,7 +63,7 @@ jobs: actions: 'create-comment,close-issue' token: ${{ secrets.GITHUB_TOKEN }} body: | - @${{ github.event.issue.user.login }} 你好,Issue 一般只接受「Bug 报告」和「功能请求」,而您的议题涉及到如何使用、功能疑惑或其他业务相关的问题,这并不适合作为 Issue 讨论。建议您通过以下方式寻求解决方案: + @${{ github.event.issue.user.login }} 你好,Issue 只接受「Bug 报告」和「功能请求」,而您的议题涉及到如何使用、功能疑惑或其他业务相关的问题,这并不适合作为 Issue 讨论。建议您通过以下方式寻求解决方案: - 仔细查阅 Layui 官方文档:https://layui.dev - 通过其他技术社区搜索相关资料、或充分利用当前主流的人工智能大模型 - [Discussions](https://github.com/layui/layui/discussions) From 67a242e00c8923f550c1bc664f6602a423d204bd 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, 24 Dec 2023 14:55:28 +0800 Subject: [PATCH 3/9] =?UTF-8?q?ci:=20=E4=BC=98=E5=8C=96=20issue=20?= =?UTF-8?q?=E8=A2=AB=E5=88=9B=E5=BB=BA=E5=92=8C=E8=A2=AB=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=97=B6=E7=9A=84=20action=20=E6=A0=A1=E9=AA=8C=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue-opened.yml | 33 +++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml index e439ed4c..e041aa99 100644 --- a/.github/workflows/issue-opened.yml +++ b/.github/workflows/issue-opened.yml @@ -1,4 +1,4 @@ -name: Issue opened +name: Issue Opened on: issues: @@ -31,24 +31,33 @@ jobs: issue_number: context.issue.number, }; - const issue = context.payload.issue; - const issueBody = issue.body; - const requiredString = "layui-issue-template"; - const isCreatedByBot = context.payload.sender.type === 'Bot'; - const isValid = issueBody.includes(requiredString); + const payload = context.payload; + const isCreatedByBot = payload.sender.type === 'Bot'; + const issue = payload.issue; + const isValid = issue.body && issue.body.includes('layui-issue-template'); // 跳过 closed 状态的 issues if (issue.state === 'closed') { return console.log('Issue is closed.'); } + // 若修改的不是内容,则不必校验 + if (payload.action === 'edited') { + if (payload.changes && !payload.changes.body.from) { + return console.log('Edited fields exclude "body".'); + } + } + // 不符合规则或由机器人创建 - if (!isValid || isCreatedByBot) { - github.rest.issues.createComment({ - ...config, - body: `@${context.payload.sender.login} 你好,为了提升沟通效率,我们对 Issue 制定了严格的要求,你的 Issue 因不符合规定而被自动关闭。 - 建议您在下次创建 Issue 时,遵循相应规范和社区行为准则。谢谢。\n > ${process.env.CONTRIBUTING}` - }); + if (isCreatedByBot || !isValid) { + if (!isCreatedByBot) { + github.rest.issues.createComment({ + ...config, + body: `@${payload.sender.login} 你好,为了提升沟通效率,我们对 Issue 制定了严格的要求,你的 Issue 因不符合规定而被自动关闭。 + 建议您在下次创建 Issue 时,遵循相应规范和社区行为准则。谢谢。\n > ${process.env.CONTRIBUTING}` + }); + } + // 给 issue 添加指定标签和关闭 github.rest.issues.addLabels({ ...config, labels: ['invalid'] From fe26e34359a3d34d8151c5c432d6974a645e979b 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, 24 Dec 2023 15:26:31 +0800 Subject: [PATCH 4/9] =?UTF-8?q?refactor(issue-opened):=20=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue-opened.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml index e041aa99..01c83ff0 100644 --- a/.github/workflows/issue-opened.yml +++ b/.github/workflows/issue-opened.yml @@ -34,7 +34,7 @@ jobs: const payload = context.payload; const isCreatedByBot = payload.sender.type === 'Bot'; const issue = payload.issue; - const isValid = issue.body && issue.body.includes('layui-issue-template'); + const isValid = issue.body?.includes('layui-issue-template'); // 跳过 closed 状态的 issues if (issue.state === 'closed') { From 4af1b5b7d6c2c25e3df2e6781050f70d95a69552 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, 26 Dec 2023 22:34:11 +0800 Subject: [PATCH 5/9] =?UTF-8?q?docs(issue):=20=E4=BC=98=E5=8C=96=20bot=20?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue-labeled.yml | 8 ++++---- .github/workflows/issue-opened.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index 7f7a8ce1..88433709 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -39,7 +39,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} body: | @${{ github.event.issue.user.login }} 你好,为了提升沟通效率,我们对 Issue 制定了严格的要求,你的 Issue 因不符合规定而被自动关闭。 - 建议您在下次创建 Issue 时,遵循相应规范和社区行为准则。谢谢。 + 建议你在下次创建 Issue 时,遵循相应规范和社区行为准则。谢谢。 > ${{ steps.template.outputs.CONTRIBUTING }} - name: need reproduce @@ -49,7 +49,7 @@ jobs: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} body: | - @${{ github.event.issue.user.login }} 您好,请提供一个最小化的重现,以便我们为您协助排查问题。良好的重现应当包括但不仅限于: + @${{ github.event.issue.user.login }} 你好,请提供一个最小化的重现,以便我们为你协助排查问题。良好的重现应当包括但不仅限于: - 产生问题的详细步骤 - 与问题相关的完整代码 - 在线 Demo (推荐通过 [stackblitz](https://stackblitz.com/) 或 [codepen](https://codepen.io/) 创建) @@ -63,7 +63,7 @@ jobs: actions: 'create-comment,close-issue' token: ${{ secrets.GITHUB_TOKEN }} body: | - @${{ github.event.issue.user.login }} 你好,Issue 只接受「Bug 报告」和「功能请求」,而您的议题涉及到如何使用、功能疑惑或其他业务相关的问题,这并不适合作为 Issue 讨论。建议您通过以下方式寻求解决方案: + @${{ github.event.issue.user.login }} 你好,Issue 只接受「Bug 报告」和「功能请求」,而你的议题涉及到如何使用、功能疑惑或其他业务相关的问题,这并不适合作为 Issue 讨论。建议你通过以下方式寻求解决方案: - 仔细查阅 Layui 官方文档:https://layui.dev - 通过其他技术社区搜索相关资料、或充分利用当前主流的人工智能大模型 - [Discussions](https://github.com/layui/layui/discussions) @@ -76,7 +76,7 @@ jobs: actions: 'create-comment,close-issue' token: ${{ secrets.GITHUB_TOKEN }} body: | - @${{ github.event.issue.user.login }} 您提出的问题与 Layui 可能不存在相关联。建议通过以下方式寻求解决方案: + @${{ github.event.issue.user.login }} 你提出的问题与 Layui 可能不存在相关联。建议通过以下方式寻求解决方案: - 通过其他技术社区搜索相关资料、或充分利用当前主流的人工智能大模型 - [Discussions](https://github.com/layui/layui/discussions) > ${{ steps.template.outputs.CONTRIBUTING }} diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml index 01c83ff0..6a14d9c7 100644 --- a/.github/workflows/issue-opened.yml +++ b/.github/workflows/issue-opened.yml @@ -54,7 +54,7 @@ jobs: github.rest.issues.createComment({ ...config, body: `@${payload.sender.login} 你好,为了提升沟通效率,我们对 Issue 制定了严格的要求,你的 Issue 因不符合规定而被自动关闭。 - 建议您在下次创建 Issue 时,遵循相应规范和社区行为准则。谢谢。\n > ${process.env.CONTRIBUTING}` + 建议你在下次创建 Issue 时,遵循相应规范和社区行为准则。谢谢。\n > ${process.env.CONTRIBUTING}` }); } // 给 issue 添加指定标签和关闭 From 5321441cdbb45cc65671669b4f78b93fe48bb029 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, 26 Dec 2023 22:45:36 +0800 Subject: [PATCH 6/9] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit e5aa6c3a877713ca65007b85191d01c864001d04 Author: morning-star <1453017105@qq.com> Date: Tue Dec 26 22:32:10 2023 +0800 feat(transfer): 新增 `dblclick` 选项 (#1491) * feat(transfer): 新增 `dblclick` 选项 * style(transfer): 优化代码书写风格 --------- Co-authored-by: 贤心 <3277200+sentsim@users.noreply.github.com> commit ed3bab52e56066dc2c6ec938cd3115be4483d4a0 Author: morning-star <1453017105@qq.com> Date: Mon Dec 25 14:53:55 2023 +0800 chore(select): 优化搜索面板打开逻辑 (#1498) commit 5db18c6f00fbee775ea466b24a4057ec7dea1a24 Author: 贤心 <3277200+sentsim@users.noreply.github.com> Date: Mon Dec 25 14:52:52 2023 +0800 docs: 优化 issue 模板提示文案 (#1500) commit 567a1e70c1da056eb7e5dfd583120098b0e3fd3a Author: morning-star <1453017105@qq.com> Date: Mon Dec 25 13:22:50 2023 +0800 feat(upload): 加强 data 选项的函数写法,支持获取文件相关数据 (#1494) close https://gitee.com/layui/layui/issues/I8JAC1 commit 6abb1eedd89313c7f1b6768b9bb6eca966010a53 Author: 贤心 <3277200+sentsim@users.noreply.github.com> Date: Mon Dec 25 12:15:51 2023 +0800 ci: 优化 issue 被创建和被编辑时的 action 校验逻辑 (#1496) * ci(issue): 增加 duplicate 标签的定时关闭任务 * docs(issue): 优化 discussion 标签文案 * ci: 优化 issue 被创建和被编辑时的 action 校验逻辑 * refactor(issue-opened): 简化语句 --- .github/ISSUE_TEMPLATE/bug-feature.yml | 2 +- docs/transfer/detail/options.md | 24 +++ docs/upload/detail/options.md | 5 + src/modules/form.js | 2 + src/modules/transfer.js | 240 +++++++++++++------------ src/modules/upload.js | 4 +- 6 files changed, 161 insertions(+), 116 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-feature.yml b/.github/ISSUE_TEMPLATE/bug-feature.yml index ec8be1e3..a0a48c56 100644 --- a/.github/ISSUE_TEMPLATE/bug-feature.yml +++ b/.github/ISSUE_TEMPLATE/bug-feature.yml @@ -37,7 +37,7 @@ body: - type: textarea attributes: label: 业务代码 - description: 请提供与该问题对应的业务代码片段,以便我们更好地排查问题。此处直接粘贴代码到文本框即可,无需书写 `Markdown` + description: 即你在调用组件时编写的代码片段。直接将你的代码粘贴到文本框即可,此处无需书写 `Markdown` render: auto validations: required: true diff --git a/docs/transfer/detail/options.md b/docs/transfer/detail/options.md index c35fd62e..71ee758f 100644 --- a/docs/transfer/detail/options.md +++ b/docs/transfer/detail/options.md @@ -163,6 +163,30 @@ onchange: function(data, index){ `false` + + + +dblclick 2.9.3+ + + +双击时的回调函数。返回的参数如下: + +``` +dblclick: function(obj){ + console.log(obj.elem); // 点击的元素 + console.log(obj.data); // 得到点击项的数据 + console.log(obj.index); // 如果数据来自左边,index 为 0,否则为 1 + + return false // 返回 false 会阻止穿梭 +} +``` + + +function + + + `null` + diff --git a/docs/upload/detail/options.md b/docs/upload/detail/options.md index 00974de7..590c46ae 100644 --- a/docs/upload/detail/options.md +++ b/docs/upload/detail/options.md @@ -74,6 +74,11 @@ data: { data: { id: function(){ return $('#id').val(); + }, + id2: function(index, file){ // 参数支持。2.9.3+ + // 注:当 unified:true 和 ie8/9 下,参数无效 + console.log(index); // 得到文件索引 + console.log(file); // 得到文件对象 } } ``` diff --git a/src/modules/form.js b/src/modules/form.js index 174c401b..604f4ff3 100644 --- a/src/modules/form.js +++ b/src/modules/form.js @@ -562,6 +562,8 @@ layui.define(['lay', 'layer', 'util'], function(exports){ e.preventDefault(); dl.children('dd.'+THIS).trigger('click'); } + }).on('paste', function(){ + showDown(); }); // 检测值是否不属于 select 项 diff --git a/src/modules/transfer.js b/src/modules/transfer.js index 844e4332..200eb283 100644 --- a/src/modules/transfer.js +++ b/src/modules/transfer.js @@ -73,39 +73,39 @@ layui.define(['laytpl', 'form'], function(exports){ // 穿梭框模板 var TPL_BOX = function(obj){ obj = obj || {}; - return ['
' - ,'
' - ,'' - ,'
' - ,'{{# if(d.data.showSearch){ }}' - ,'' - ,'{{# } }}' - ,'' - ,'
'].join(''); + return ['
', + '
', + '', + '
', + '{{# if(d.data.showSearch){ }}', + '', + '{{# } }}', + '', + '
'].join(''); }; // 主模板 - var TPL_MAIN = ['
' - ,TPL_BOX({ - index: 0 - ,checkAllName: 'layTransferLeftCheckAll' - }) - ,'
' - ,'' - ,'' - ,'
' - ,TPL_BOX({ - index: 1 - ,checkAllName: 'layTransferRightCheckAll' - }) - ,'
'].join(''); + var TPL_MAIN = ['
', + TPL_BOX({ + index: 0, + checkAllName: 'layTransferLeftCheckAll' + }), + '
', + '', + '', + '
', + TPL_BOX({ + index: 1, + checkAllName: 'layTransferRightCheckAll' + }), + '
'].join(''); // 构造器 var Class = function(options){ @@ -115,7 +115,7 @@ layui.define(['laytpl', 'form'], function(exports){ that.render(); }; - //默认配置 + // 默认配置 Class.prototype.config = { title: ['列表一', '列表二'], width: 200, @@ -130,31 +130,31 @@ layui.define(['laytpl', 'form'], function(exports){ } }; - //重载实例 + // 重载实例 Class.prototype.reload = function(options){ var that = this; that.config = $.extend({}, that.config, options); that.render(); }; - //渲染 + // 渲染 Class.prototype.render = function(){ var that = this; var options = that.config; - //解析模板 + // 解析模板 var thisElem = that.elem = $(laytpl(TPL_MAIN, { open: '{{', // 标签符前缀 close: '}}' // 标签符后缀 }).render({ - data: options - ,index: that.index //索引 + data: options, + index: that.index // 索引 })); var othis = options.elem = $(options.elem); if(!othis[0]) return; - //初始化属性 + // 初始化属性 options.data = options.data || []; options.value = options.value || []; @@ -164,20 +164,20 @@ layui.define(['laytpl', 'form'], function(exports){ ); that.key = options.id; - //插入组件结构 + // 插入组件结构 othis.html(that.elem); - //各级容器 + // 各级容器 that.layBox = that.elem.find('.'+ ELEM_BOX) that.layHeader = that.elem.find('.'+ ELEM_HEADER) that.laySearch = that.elem.find('.'+ ELEM_SEARCH) that.layData = thisElem.find('.'+ ELEM_DATA); that.layBtn = thisElem.find('.'+ ELEM_ACTIVE + ' .layui-btn'); - //初始化尺寸 + // 初始化尺寸 that.layBox.css({ - width: options.width - ,height: options.height + width: options.width, + height: options.height }); that.layData.css({ height: function(){ @@ -189,8 +189,8 @@ layui.define(['laytpl', 'form'], function(exports){ }() }); - that.renderData(); //渲染数据 - that.events(); //事件 + that.renderData(); // 渲染数据 + that.events(); // 事件 }; // 渲染数据 @@ -233,27 +233,28 @@ layui.define(['laytpl', 'form'], function(exports){ that.renderCheckBtn(); }; - //渲染表单 + // 渲染表单 Class.prototype.renderForm = function(type){ form.render(type, 'LAY-transfer-'+ this.index); }; - //同步复选框和按钮状态 + // 同步复选框和按钮状态 Class.prototype.renderCheckBtn = function(obj){ - var that = this - ,options = that.config; + var that = this; + var options = that.config; obj = obj || {}; that.layBox.each(function(_index){ - var othis = $(this) - ,thisDataElem = othis.find('.'+ ELEM_DATA) - ,allElemCheckbox = othis.find('.'+ ELEM_HEADER).find('input[type="checkbox"]') - ,listElemCheckbox = thisDataElem.find('input[type="checkbox"]'); + var othis = $(this); + var thisDataElem = othis.find('.'+ ELEM_DATA); + var allElemCheckbox = othis.find('.'+ ELEM_HEADER).find('input[type="checkbox"]'); + var listElemCheckbox = thisDataElem.find('input[type="checkbox"]'); - //同步复选框和按钮状态 - var nums = 0 - ,haveChecked = false; + // 同步复选框和按钮状态 + var nums = 0; + var haveChecked = false; + listElemCheckbox.each(function(){ var isHide = $(this).data('hide'); if(this.checked || this.disabled || isHide){ @@ -264,10 +265,10 @@ layui.define(['laytpl', 'form'], function(exports){ } }); - allElemCheckbox.prop('checked', haveChecked && nums === listElemCheckbox.length); //全选复选框状态 - that.layBtn.eq(_index)[haveChecked ? 'removeClass' : 'addClass'](DISABLED); //对应的按钮状态 + allElemCheckbox.prop('checked', haveChecked && nums === listElemCheckbox.length); // 全选复选框状态 + that.layBtn.eq(_index)[haveChecked ? 'removeClass' : 'addClass'](DISABLED); // 对应的按钮状态 - //无数据视图 + // 无数据视图 if(!obj.stopNone){ var isNone = thisDataElem.children('li:not(.'+ HIDE +')').length that.noneView(thisDataElem, isNone ? '' : options.text.none); @@ -277,7 +278,7 @@ layui.define(['laytpl', 'form'], function(exports){ that.renderForm('checkbox'); }; - //无数据视图 + // 无数据视图 Class.prototype.noneView = function(thisDataElem, text){ var createNoneElem = $('

'+ (text || '') +'

'); if(thisDataElem.find('.'+ NONE)[0]){ @@ -286,11 +287,12 @@ layui.define(['laytpl', 'form'], function(exports){ text.replace(/\s/g, '') && thisDataElem.append(createNoneElem); }; - //同步 value 属性值 + // 同步 value 属性值 Class.prototype.setValue = function(){ - var that = this - ,options = that.config - ,arr = []; + var that = this; + var options = that.config; + var arr = []; + that.layBox.eq(1).find('.'+ ELEM_DATA +' input[type="checkbox"]').each(function(){ var isHide = $(this).data('hide'); isHide || arr.push(this.value); @@ -300,14 +302,14 @@ layui.define(['laytpl', 'form'], function(exports){ return that; }; - //解析数据 + // 解析数据 Class.prototype.parseData = function(callback){ - var that = this - ,options = that.config - ,newData = []; + var that = this; + var options = that.config; + var newData = []; layui.each(options.data, function(index, item){ - //解析格式 + // 解析格式 item = (typeof options.parseData === 'function' ? options.parseData(item) : item) || item; @@ -326,11 +328,11 @@ layui.define(['laytpl', 'form'], function(exports){ return that; }; - //获得右侧面板数据 + // 获得右侧面板数据 Class.prototype.getData = function(value){ - var that = this - ,options = that.config - ,selectedData = []; + var that = this; + var options = that.config; + var selectedData = []; that.setValue(); @@ -345,30 +347,30 @@ layui.define(['laytpl', 'form'], function(exports){ return selectedData; }; - //执行穿梭 + // 执行穿梭 Class.prototype.transfer = function (_index, elem) { - var that = this - ,options = that.config - ,thisBoxElem = that.layBox.eq(_index) - ,arr = [] + var that = this; + var options = that.config; + var thisBoxElem = that.layBox.eq(_index); + var arr = []; if (!elem) { - //通过按钮触发找到选中的进行移动 + // 通过按钮触发找到选中的进行移动 thisBoxElem.each(function(_index){ - var othis = $(this) - ,thisDataElem = othis.find('.'+ ELEM_DATA); + var othis = $(this); + var thisDataElem = othis.find('.'+ ELEM_DATA); thisDataElem.children('li').each(function(){ - var thisList = $(this) - ,thisElemCheckbox = thisList.find('input[type="checkbox"]') - ,isHide = thisElemCheckbox.data('hide'); + var thisList = $(this); + var thisElemCheckbox = thisList.find('input[type="checkbox"]'); + var isHide = thisElemCheckbox.data('hide'); if(thisElemCheckbox[0].checked && !isHide){ thisElemCheckbox[0].checked = false; thisBoxElem.siblings('.'+ ELEM_BOX).find('.'+ ELEM_DATA).append(thisList.clone()); thisList.remove(); - //记录当前穿梭的数据 + // 记录当前穿梭的数据 arr.push(thisElemCheckbox[0].value); } @@ -376,15 +378,15 @@ layui.define(['laytpl', 'form'], function(exports){ }); }); } else { - //双击单条记录移动 - var thisList = elem - ,thisElemCheckbox = thisList.find('input[type="checkbox"]') + // 双击单条记录移动 + var thisList = elem; + var thisElemCheckbox = thisList.find('input[type="checkbox"]'); thisElemCheckbox[0].checked = false; thisBoxElem.siblings('.'+ ELEM_BOX).find('.'+ ELEM_DATA).append(thisList.clone()); thisList.remove(); - //记录当前穿梭的数据 + // 记录当前穿梭的数据 arr.push(thisElemCheckbox[0].value); that.setValue(); @@ -392,28 +394,28 @@ layui.define(['laytpl', 'form'], function(exports){ that.renderCheckBtn(); - //穿梭时,如果另外一个框正在搜索,则触发匹配 + // 穿梭时,如果另外一个框正在搜索,则触发匹配 var siblingInput = thisBoxElem.siblings('.'+ ELEM_BOX).find('.'+ ELEM_SEARCH +' input') siblingInput.val() === '' || siblingInput.trigger('keyup'); - //穿梭时的回调 + // 穿梭时的回调 options.onchange && options.onchange(that.getData(arr), _index); } - //事件 + // 事件 Class.prototype.events = function(){ - var that = this - ,options = that.config; + var that = this; + var options = that.config; - //左右复选框 + // 左右复选框 that.elem.on('click', 'input[lay-filter="layTransferCheckbox"]+', function(){ - var thisElemCheckbox = $(this).prev() - ,checked = thisElemCheckbox[0].checked - ,thisDataElem = thisElemCheckbox.parents('.'+ ELEM_BOX).eq(0).find('.'+ ELEM_DATA); + var thisElemCheckbox = $(this).prev(); + var checked = thisElemCheckbox[0].checked; + var thisDataElem = thisElemCheckbox.parents('.'+ ELEM_BOX).eq(0).find('.'+ ELEM_DATA); if(thisElemCheckbox[0].disabled) return; - //判断是否全选 + // 判断是否全选 if(thisElemCheckbox.attr('lay-type') === 'all'){ thisDataElem.find('input[type="checkbox"]').each(function(){ if(this.disabled) return; @@ -428,26 +430,36 @@ layui.define(['laytpl', 'form'], function(exports){ // 双击穿梭 that.elem.on('dblclick', '.' + ELEM_DATA + '>li', function(event){ - var elemThis = $(this) - ,thisElemCheckbox = elemThis.children('input[type="checkbox"]') - ,thisDataElem = elemThis.parent() - ,thisBoxElem = thisDataElem.parent() + var elemThis = $(this); + var thisElemCheckbox = elemThis.children('input[type="checkbox"]'); + var thisDataElem = elemThis.parent(); + var thisBoxElem = thisDataElem.parent(); + var index = thisBoxElem.data('index'); if(thisElemCheckbox[0].disabled) return; - that.transfer(thisBoxElem.data('index'), elemThis); + // 根据 dblclick 回调函数返回值决定是否执行穿梭 --- 2.9.3+ + var ret = typeof options.dblclick === 'function' ? options.dblclick({ + elem: elemThis, + data: that.getData([thisElemCheckbox[0].value])[0], + index: index + }) : null; + + if(ret === false) return; + + that.transfer(index, elemThis); }) // 穿梭按钮事件 that.layBtn.on('click', function(){ - var othis = $(this) - ,_index = othis.data('index') - if(othis.hasClass(DISABLED)) return; + var othis = $(this); + var _index = othis.data('index'); + if(othis.hasClass(DISABLED)) return; that.transfer(_index); }); - //搜索 + // 搜索 that.laySearch.find('input').on('keyup', function(){ var value = this.value; var thisDataElem = $(this).parents('.'+ ELEM_SEARCH).eq(0).siblings('.'+ ELEM_DATA); @@ -472,17 +484,17 @@ layui.define(['laytpl', 'form'], function(exports){ that.renderCheckBtn(); - //无匹配数据视图 + // 无匹配数据视图 var isNone = thisListElem.length === thisDataElem.children('li.'+ HIDE).length; that.noneView(thisDataElem, isNone ? options.text.searchNone : ''); }); }; - //记录所有实例 - thisModule.that = {}; //记录所有实例对象 - thisModule.config = {}; //记录所有实例配置项 + // 记录所有实例 + thisModule.that = {}; // 记录所有实例对象 + thisModule.config = {}; // 记录所有实例配置项 - //重载实例 + // 重载实例 transfer.reload = function(id, options){ var that = thisModule.that[id]; that.reload(options); @@ -490,13 +502,13 @@ layui.define(['laytpl', 'form'], function(exports){ return thisModule.call(that); }; - //获得选中的数据(右侧面板) + // 获得选中的数据(右侧面板) transfer.getData = function(id){ var that = thisModule.that[id]; return that.getData(); }; - //核心入口 + // 核心入口 transfer.render = function(options){ var inst = new Class(options); return thisModule.call(inst); diff --git a/src/modules/upload.js b/src/modules/upload.js index 24cc9e69..1ec113ff 100644 --- a/src/modules/upload.js +++ b/src/modules/upload.js @@ -279,7 +279,9 @@ layui.define(['lay', 'layer'], function(exports){ // 追加额外的参数 layui.each(options.data, function(key, value){ - value = typeof value === 'function' ? value() : value; + value = typeof value === 'function' + ? sets.unified ? value() : value(sets.index, sets.file) + : value; formData.append(key, value); }); From c15f466b996b69e29365be51863aa4d1780585c9 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, 28 Dec 2023 13:24:20 +0800 Subject: [PATCH 7/9] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/layui.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4ef3d17e..39c90057 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "layui", - "version": "2.9.2", + "version": "2.9.3", "description": "Classic modular Front-End UI library", "keywords": [ "layui", diff --git a/src/layui.js b/src/layui.js index 9c4f46de..a6228ffb 100644 --- a/src/layui.js +++ b/src/layui.js @@ -16,7 +16,7 @@ }; var Layui = function(){ - this.v = '2.9.2'; // Layui 版本号 + this.v = '2.9.3'; // Layui 版本号 }; // 识别预先可能定义的指定全局对象 From 53ae5bb204e7b5ea0f80a5935e92fb6ace6533cc 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 Dec 2023 23:29:50 +0800 Subject: [PATCH 8/9] =?UTF-8?q?style(laydate):=20=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=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 --- examples/laydate.html | 316 +++++++++++++++++++++++------------------- 1 file changed, 176 insertions(+), 140 deletions(-) diff --git a/examples/laydate.html b/examples/laydate.html index faa9fe7a..248a8eee 100644 --- a/examples/laydate.html +++ b/examples/laydate.html @@ -145,9 +145,7 @@ body{padding: 50px 100px;} From 9d9c2787c31b9a0b86b38d59931275595e57c007 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, 12 Jan 2024 00:05:55 +0800 Subject: [PATCH 9/9] =?UTF-8?q?ci(issue):=20=E4=BC=98=E5=8C=96=20issue=20?= =?UTF-8?q?=E8=A2=AB=E5=85=B3=E9=97=AD=E6=97=B6=E7=9A=84=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue-closed.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issue-closed.yml b/.github/workflows/issue-closed.yml index 4e03788d..b31c4ec3 100644 --- a/.github/workflows/issue-closed.yml +++ b/.github/workflows/issue-closed.yml @@ -22,11 +22,12 @@ jobs: }; const issue = await github.rest.issues.get(config); - // 是否带有 `bug` 标签 + // 是否带有 `bug`, `wontfix` 标签 const hasBugLabel = issue.data.labels.some(label => label.name === 'bug'); + const hasWontfixLabel = issue.data.labels.some(label => label.name === 'wontfix'); // 对带有 `bug` 标签的 issue 追加 `resolved` 标签,表示 bug 已解决。 - if (hasBugLabel) { + if (hasBugLabel && !hasWontfixLabel) { github.rest.issues.addLabels({ ...config, labels: ['resolved']