From f39535420c69fdc950e3f5b2c499a96d1b40a6da Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 15 Dec 2020 10:49:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E5=A4=9A?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + src/base/single/editor/editor.multifile.js | 4 ++++ src/base/single/input/file.js | 11 +++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 5f8e085be6..b3ccc306ba 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-12) +- 文件上传控件新增API(setMaxFileLength)以动态设置最大上传文件数量 - Pane系列提供small和big两种大小的加载动画 - 同步树列表系列支持不显示节点连接线和展开收起图标 - 规范了下拉树trigger中显示值的显示顺序 diff --git a/src/base/single/editor/editor.multifile.js b/src/base/single/editor/editor.multifile.js index 3a8db85ae4..f9577f3739 100644 --- a/src/base/single/editor/editor.multifile.js +++ b/src/base/single/editor/editor.multifile.js @@ -71,6 +71,10 @@ BI.MultifileEditor = BI.inherit(BI.Widget, { this.file.reset(); }, + setMaxFileLength: function (v) { + this.file.setMaxFileLength(v); + }, + select: function () { this.file.select(); }, diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index 98918bd3d7..ea5024e9be 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -545,12 +545,12 @@ }, _events: function (wrap) { - var self = this; + var self = this, o = this.options; event.add(wrap.dom.input, "change", function () { event.del(wrap.dom.input, "change", arguments.callee); var input = wrap.dom.input.cloneNode(true); var files = F(wrap.dom.input); - if (wrap.maxLength !== -1 && wrap.maxLength < files.length) { + if (o.maxLength !== -1 && o.maxLength < files.length) { self.fireEvent(BI.File.EVENT_ERROR, { errorType: 2 }); @@ -654,6 +654,13 @@ }); }, + setMaxFileLength: function(v) { + this.options.maxLength = v; + if (this.wrap) { + this.wrap.maxLength = v; + } + }, + select: function () { this.wrap && BI.Widget._renderEngine.createElement(this.wrap.dom.input).click(); },