From 419224bb6945bc636ec30789632d6ce4604711ed Mon Sep 17 00:00:00 2001 From: chaos0156 <429018715@qq.com> Date: Tue, 16 Aug 2022 10:00:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?KERNEL-12408:base=E4=B8=ADeslint=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/combo.js | 4 +- src/base/combination/switcher.js | 6 +- src/base/pager/pager.js | 6 +- src/base/single/__test__/text.test.js | 27 ++- src/base/single/a/__test__/a.test.js | 11 +- src/base/single/a/a.js | 9 +- src/base/single/bar/bar.loading.js | 21 +-- .../button/buttons/__test__/button.test.js | 18 +- src/base/single/button/buttons/button.icon.js | 13 +- .../single/button/buttons/button.image.js | 11 +- src/base/single/button/buttons/button.js | 24 +-- src/base/single/button/buttons/button.text.js | 7 +- .../button/listitem/blankiconicontextitem.js | 17 +- .../button/listitem/blankicontexticonitem.js | 17 +- .../button/listitem/blankicontextitem.js | 15 +- .../button/listitem/icontexticonitem.js | 15 +- .../single/button/listitem/icontextitem.js | 13 +- .../single/button/listitem/texticonitem.js | 13 +- src/base/single/button/listitem/textitem.js | 9 +- src/base/single/editor/editor.textarea.js | 14 +- src/base/single/input/file.js | 156 ++++++++++-------- 21 files changed, 224 insertions(+), 202 deletions(-) diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 23e05c8b8..5fc2f8008 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -95,7 +95,7 @@ element: this, }, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, { items: [ - { el: this.combo, } + { el: this.combo } ], })))); o.isDefaultInit && (this._assertPopupView()); @@ -160,7 +160,7 @@ this._assertPopupViewRender(); this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW); // popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下 - this.popupView.css({ left: -999999999, top: -99999999, }); + this.popupView.css({ left: -999999999, top: -99999999 }); this.popupView.visible(); BI.each(needHideWhenAnotherComboOpen, function (i, combo) { if (i !== self.getName()) { diff --git a/src/base/combination/switcher.js b/src/base/combination/switcher.js index 3f5bd4936..419711595 100644 --- a/src/base/combination/switcher.js +++ b/src/base/combination/switcher.js @@ -65,7 +65,7 @@ BI.Switcher = BI.inherit(BI.Widget, { scrolly: false, element: this, items: [ - { el: this.switcher, } + { el: this.switcher } ], }); o.isDefaultInit && (this._assertPopupView()); @@ -138,7 +138,7 @@ BI.Switcher = BI.inherit(BI.Widget, { if (!this._created) { this.popupView = BI.createWidget(o.popup, { type: "bi.button_group", - element: o.adapter && BI.Maskers.create(this.getName(), o.adapter, BI.extend({ container: this, }, o.masker)), + element: o.adapter && BI.Maskers.create(this.getName(), o.adapter, BI.extend({ container: this }, o.masker)), cls: "switcher-popup", layouts: [{ type: "bi.vertical", @@ -159,7 +159,7 @@ BI.Switcher = BI.inherit(BI.Widget, { scrolly: false, element: this, items: [ - { el: this.popupView, } + { el: this.popupView } ], }); } diff --git a/src/base/pager/pager.js b/src/base/pager/pager.js index 757d5632b..129db1b8d 100644 --- a/src/base/pager/pager.js +++ b/src/base/pager/pager.js @@ -158,14 +158,14 @@ BI.Pager = BI.inherit(BI.Widget, { view.push((function () { if (BI.isKey(next)) { if (pages === false) { - return { text: next, value: "next", disabled: o.hasNext(curr) === false, }; + return { text: next, value: "next", disabled: o.hasNext(curr) === false }; } return (dict.flow && curr === pages) ? - { text: next, value: "next", disabled: true, } + { text: next, value: "next", disabled: true } : - { text: next, value: "next", disabled: !(curr !== pages && next || dict.flow), }; + { text: next, value: "next", disabled: !(curr !== pages && next || dict.flow) }; } return { diff --git a/src/base/single/__test__/text.test.js b/src/base/single/__test__/text.test.js index 9549b2d7e..bea099e8d 100644 --- a/src/base/single/__test__/text.test.js +++ b/src/base/single/__test__/text.test.js @@ -2,13 +2,12 @@ * Created by windy on 2018/01/23. */ describe("TextTest", function () { - /** * test_author_windy */ it("setText", function () { var text = BI.Test.createWidget({ - type: "bi.text" + type: "bi.text", }); text.setText("AAA"); expect(text.element.text()).to.equal("AAA"); @@ -20,9 +19,9 @@ describe("TextTest", function () { */ it("setStyle", function () { var text = BI.Test.createWidget({ - type: "bi.text" + type: "bi.text", }); - text.setStyle({"color": "red"}); + text.setStyle({ "color": "red" }); expect(text.element.getStyle("color")).to.equal("rgb(255, 0, 0)"); text.destroy(); }); @@ -34,7 +33,7 @@ describe("TextTest", function () { var text = BI.Test.createWidget({ type: "bi.text", text: "AAA", - highLight: true + highLight: true, }); expect(text.element.getStyle("color")).to.equal("rgb(54, 133, 242)"); text.destroy(); @@ -47,7 +46,7 @@ describe("TextTest", function () { var text = BI.Test.createWidget({ type: "bi.text", text: "我是要标红的A", - keyword: "A" + keyword: "A", }); expect(text.element.children(".bi-keyword-red-mark").length).to.not.equal(0); text.destroy(); @@ -61,7 +60,7 @@ describe("TextTest", function () { var text = BI.Test.createWidget({ type: "bi.text", text: "AAA", - highLight: true + highLight: true, }); text.unHighLight(); expect(text.element.getStyle("color")).to.not.equal("rgb(54, 133, 242)"); @@ -75,7 +74,7 @@ describe("TextTest", function () { var text = BI.Test.createWidget({ type: "bi.text", text: "我是要标红的A", - keyword: "A" + keyword: "A", }); text.unRedMark(); expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); @@ -103,7 +102,7 @@ describe("TextTest", function () { type: "bi.text", text: "我是要标红的A", vgap: 10, - hgap: 10 + hgap: 10, }); expect(text.element.css("padding")).to.equal("10px"); text.destroy(); @@ -129,7 +128,7 @@ describe("TextTest", function () { type: "bi.text", text: "我是A", lineHeight: 12, - height: 24 + height: 24, }); expect(text.element.css("height")).to.equal("24px"); expect(text.element.css("line-height")).to.equal("12px"); @@ -145,7 +144,7 @@ describe("TextTest", function () { text: "我是A", handler: function () { text.setText("handler"); - } + }, }); BI.nextTick(function () { text.text.element.click(); @@ -162,7 +161,7 @@ describe("TextTest", function () { var text = BI.Test.createWidget({ type: "bi.text", text: "", - value: "aaaa" + value: "aaaa", }); expect(text.element.text()).to.equal(""); text.destroy(); @@ -174,7 +173,7 @@ describe("TextTest", function () { it("text的value属性1", function () { var text = BI.Test.createWidget({ type: "bi.text", - value: "aaaa" + value: "aaaa", }); expect(text.element.text()).to.equal("aaaa"); text.destroy(); @@ -187,7 +186,7 @@ describe("TextTest", function () { var text = BI.Test.createWidget({ type: "bi.text", text: null, - value: "aaaa" + value: "aaaa", }); expect(text.element.text()).to.equal(""); text.destroy(); diff --git a/src/base/single/a/__test__/a.test.js b/src/base/single/a/__test__/a.test.js index 6a78187c2..77cdd5f40 100644 --- a/src/base/single/a/__test__/a.test.js +++ b/src/base/single/a/__test__/a.test.js @@ -2,16 +2,15 @@ * Created by windy on 2018/01/23. */ describe("ALinkTest", function () { - /** * test_author_windy */ it("A初始化测试", function () { var a = BI.Test.createWidget({ type: "bi.a", - text: "CCC" + text: "CCC", }); - expect(a.element.is('a')).to.equal(true); + expect(a.element.is("a")).to.equal(true); a.destroy(); }); @@ -23,10 +22,10 @@ describe("ALinkTest", function () { type: "bi.a", text: "DDD", el: { - type: "bi.label" - } + type: "bi.label", + }, }); - expect(a.element.is('a') && a.element.hasClass("bi-label")).to.equal(true); + expect(a.element.is("a") && a.element.hasClass("bi-label")).to.equal(true); a.destroy(); }); }); diff --git a/src/base/single/a/a.js b/src/base/single/a/a.js index 2bab1ea6d..9159f0a46 100644 --- a/src/base/single/a/a.js +++ b/src/base/single/a/a.js @@ -9,25 +9,26 @@ BI.A = BI.inherit(BI.Text, { _defaultConfig: function () { var conf = BI.A.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-a display-block", href: "", target: "_blank", el: null, - tagName: "a" + tagName: "a", }); }, render: function () { var o = this.options; BI.A.superclass.render.apply(this, arguments); - this.element.attr({href: o.href, target: o.target}); + this.element.attr({ href: o.href, target: o.target }); if (o.el) { BI.createWidget(o.el, { - element: this + element: this, }); } - } + }, }); BI.shortcut("bi.a", BI.A); diff --git a/src/base/single/bar/bar.loading.js b/src/base/single/bar/bar.loading.js index 27b54cd69..801331b15 100644 --- a/src/base/single/bar/bar.loading.js +++ b/src/base/single/bar/bar.loading.js @@ -6,10 +6,11 @@ BI.LoadingBar = BI.inherit(BI.Single, { _defaultConfig: function () { var conf = BI.LoadingBar.superclass._defaultConfig.apply(this, arguments); - return BI.extend( conf, { + + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-loading-bar bi-tips", height: 30, - handler: BI.emptyFn + handler: BI.emptyFn, }); }, @@ -20,7 +21,7 @@ BI.LoadingBar = BI.inherit(BI.Single, { cls: "loading-text bi-list-item-simple", text: BI.i18nText("BI-Load_More"), width: 120, - handler: this.options.handler + handler: this.options.handler, }); this.loaded.on(BI.Controller.EVENT_CHANGE, function (type) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -30,26 +31,26 @@ BI.LoadingBar = BI.inherit(BI.Single, { type: "bi.layout", width: this.options.height, height: this.options.height, - cls: "loading-background cursor-default" + cls: "loading-background cursor-default", }); var loaded = BI.createWidget({ type: "bi.center_adapt", - items: [this.loaded] + items: [this.loaded], }); var loading = BI.createWidget({ type: "bi.center_adapt", - items: [this.loading] + items: [this.loading], }); this.cardLayout = BI.createWidget({ type: "bi.card", element: this, items: [{ el: loaded, - cardName: "loaded" + cardName: "loaded", }, { el: loading, - cardName: "loading" - }] + cardName: "loading", + }], }); this.invisible(); }, @@ -74,7 +75,7 @@ BI.LoadingBar = BI.inherit(BI.Single, { setLoading: function () { this._reset(); this.cardLayout.showCardByName("loading"); - } + }, }); BI.shortcut("bi.loading_bar", BI.LoadingBar); diff --git a/src/base/single/button/buttons/__test__/button.test.js b/src/base/single/button/buttons/__test__/button.test.js index 2ef4e0c82..b5d9865d2 100644 --- a/src/base/single/button/buttons/__test__/button.test.js +++ b/src/base/single/button/buttons/__test__/button.test.js @@ -2,7 +2,6 @@ * Created by windy on 2018/01/23. */ describe("ButtonTest", function () { - /** * test_author_windy */ @@ -12,7 +11,7 @@ describe("ButtonTest", function () { text: "CCC", handler: function () { this.setText("click"); - } + }, }); BI.nextTick(function () { button.element.click(); @@ -20,7 +19,6 @@ describe("ButtonTest", function () { button.destroy(); done(); }); - }); @@ -34,7 +32,7 @@ describe("ButtonTest", function () { trigger: "mousedown", handler: function () { this.setText("click"); - } + }, }); BI.nextTick(function () { button.element.mousedown(); @@ -42,7 +40,6 @@ describe("ButtonTest", function () { button.destroy(); done(); }); - }); /** @@ -55,7 +52,7 @@ describe("ButtonTest", function () { trigger: "mouseup", handler: function () { this.setText("click"); - } + }, }); BI.nextTick(function () { button.element.mousedown(); @@ -64,7 +61,6 @@ describe("ButtonTest", function () { button.destroy(); done(); }); - }); /** @@ -77,7 +73,7 @@ describe("ButtonTest", function () { trigger: "dblclick", handler: function () { this.setText("click"); - } + }, }); BI.nextTick(function () { button.element.dblclick(); @@ -85,7 +81,6 @@ describe("ButtonTest", function () { button.destroy(); done(); }); - }); /** @@ -101,8 +96,8 @@ describe("ButtonTest", function () { eventName: BI.Button.EVENT_CHANGE, action: function () { clickNum++; - } - }] + }, + }], }); BI.nextTick(function () { button.element.mousedown(); @@ -112,6 +107,5 @@ describe("ButtonTest", function () { done(); }, 360); }); - }); }); diff --git a/src/base/single/button/buttons/button.icon.js b/src/base/single/button/buttons/button.icon.js index 3def60551..82048a029 100644 --- a/src/base/single/button/buttons/button.icon.js +++ b/src/base/single/button/buttons/button.icon.js @@ -6,6 +6,7 @@ BI.IconButton = BI.inherit(BI.BasicButton, { _defaultConfig: function () { var conf = BI.IconButton.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { _baseCls: (conf._baseCls || "") + " bi-icon-button horizon-center", hgap: 0, @@ -15,19 +16,19 @@ BI.IconButton = BI.inherit(BI.BasicButton, { lgap: 0, rgap: 0, iconWidth: null, - iconHeight: null + iconHeight: null, }); }, render: function () { var o = this.options; this.element.css({ - textAlign: "center" + textAlign: "center", }); this.icon = BI.createWidget({ type: "bi.icon", width: o.iconWidth, - height: o.iconHeight + height: o.iconHeight, }); if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) { this.element.css("lineHeight", o.height / BI.pixRatio + BI.pixUnit); @@ -40,7 +41,7 @@ BI.IconButton = BI.inherit(BI.BasicButton, { rgap: o.rgap, tgap: o.tgap, bgap: o.bgap, - items: [this.icon] + items: [this.icon], }); } else { this.element.css("lineHeight", "1"); @@ -53,7 +54,7 @@ BI.IconButton = BI.inherit(BI.BasicButton, { rgap: o.rgap, tgap: o.tgap, bgap: o.bgap, - items: [this.icon] + items: [this.icon], }); } }, @@ -63,7 +64,7 @@ BI.IconButton = BI.inherit(BI.BasicButton, { if (this.isValid()) { this.fireEvent(BI.IconButton.EVENT_CHANGE, this); } - } + }, }); BI.IconButton.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.icon_button", BI.IconButton); diff --git a/src/base/single/button/buttons/button.image.js b/src/base/single/button/buttons/button.image.js index 58be4351e..6eeeffbf1 100644 --- a/src/base/single/button/buttons/button.image.js +++ b/src/base/single/button/buttons/button.image.js @@ -8,11 +8,12 @@ BI.ImageButton = BI.inherit(BI.BasicButton, { _defaultConfig: function () { var conf = BI.ImageButton.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-image-button", src: "", iconWidth: "100%", - iconHeight: "100%" + iconHeight: "100%", }); }, @@ -22,20 +23,20 @@ BI.ImageButton = BI.inherit(BI.BasicButton, { type: "bi.img", width: o.iconWidth, height: o.iconHeight, - src: o.src + src: o.src, }); if (BI.isNumber(o.iconWidth) || BI.isNumber(o.iconHeight)) { BI.createWidget({ type: "bi.center_adapt", element: this, - items: [this.image] + items: [this.image], }); } else { BI.createWidget({ type: "bi.adaptive", element: this, items: [this.image], - scrollable: false + scrollable: false, }); } }, @@ -80,7 +81,7 @@ BI.ImageButton = BI.inherit(BI.BasicButton, { if (this.isValid()) { this.fireEvent(BI.ImageButton.EVENT_CHANGE, this); } - } + }, }); BI.ImageButton.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.image_button", BI.ImageButton); diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js index 8f46112ca..63b667aaa 100644 --- a/src/base/single/button/buttons/button.js +++ b/src/base/single/button/buttons/button.js @@ -16,7 +16,7 @@ BI.Button = BI.inherit(BI.BasicButton, { _const: { - iconWidth: 18 + iconWidth: 18, }, _defaultConfig: function (props) { @@ -37,7 +37,7 @@ return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-button" + ((BI.isIE() && BI.isIE9Below()) ? " hack" : ""), attributes: { - tabIndex: 1 + tabIndex: 1, }, minWidth: clearMinWidth ? 0 : 80, height: isVertical(props.iconPosition) ? adaptiveHeight : 24, @@ -63,7 +63,7 @@ lgap: 0, rgap: 0, iconGap: 0, - iconPosition: "left" + iconPosition: "left", }); }, @@ -99,7 +99,7 @@ // 不设置,自定义按钮无法居中 iconWidth: o.iconWidth, iconHeight: o.iconHeight, - invisible: iconInvisible + invisible: iconInvisible, }); // 用于 whiteSpace var textWidth = iconInvisible && o.width ? o.width - o.hgap * 2 : null; @@ -116,21 +116,21 @@ textHeight: textHeight, height: lineHeight, value: o.value, - title: null + title: null, }); var layoutType = "bi.horizontal"; var gapContainer = { lgap: o.iconPosition === "left" && o.text ? o.iconGap : 0, rgap: o.iconPosition === "right" ? o.iconGap : 0, tgap: o.iconPosition === "top" ? o.iconGap : 0, - bgap: o.iconPosition === "bottom" ? o.iconGap : 0 + bgap: o.iconPosition === "bottom" ? o.iconGap : 0, }; - var items = [this.icon, BI.extend({el: this.text}, gapContainer)]; + var items = [this.icon, BI.extend({ el: this.text }, gapContainer)]; if (isVertical(o.iconPosition)) { layoutType = "bi.vertical"; } if (o.iconPosition === "right" || o.iconPosition === "bottom") { - items = [BI.extend({el: this.text}, gapContainer), this.icon]; + items = [BI.extend({ el: this.text }, gapContainer), this.icon]; } // bi.center_adapt 作用:让 hgap 不影响 iconGap。 BI.createWidget({ @@ -142,8 +142,8 @@ type: layoutType, horizontalAlign: "center", verticalAlign: "middle", - items: items - }] + items: items, + }], }); var classArr = ["block", "clear", "ghost", "plain", "loading", "light"]; @@ -155,7 +155,7 @@ }); if (o.minWidth > 0) { - this.element.css({"min-width": o.minWidth / BI.pixRatio + BI.pixUnit}); + this.element.css({ "min-width": o.minWidth / BI.pixRatio + BI.pixUnit }); } }, @@ -232,7 +232,7 @@ unHighLight: function () { this.text.unHighLight.apply(this.text, arguments); - } + }, }); BI.shortcut("bi.button", BI.Button); BI.Button.EVENT_CHANGE = "EVENT_CHANGE"; diff --git a/src/base/single/button/buttons/button.text.js b/src/base/single/button/buttons/button.text.js index bbb3e0e50..38470c291 100644 --- a/src/base/single/button/buttons/button.text.js +++ b/src/base/single/button/buttons/button.text.js @@ -8,6 +8,7 @@ BI.TextButton = BI.inherit(BI.BasicButton, { _defaultConfig: function () { var conf = BI.TextButton.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-button", textAlign: "center", @@ -18,7 +19,7 @@ BI.TextButton = BI.inherit(BI.BasicButton, { lgap: 0, rgap: 0, vgap: 0, - py: "" + py: "", }); }, @@ -40,7 +41,7 @@ BI.TextButton = BI.inherit(BI.BasicButton, { text: o.text, value: o.value, py: o.py, - keyword: o.keyword + keyword: o.keyword, }); }, @@ -83,7 +84,7 @@ BI.TextButton = BI.inherit(BI.BasicButton, { text = BI.isArray(text) ? text.join(",") : text; this.text.setValue(text); } - } + }, }); BI.TextButton.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.text_button", BI.TextButton); diff --git a/src/base/single/button/listitem/blankiconicontextitem.js b/src/base/single/button/listitem/blankiconicontextitem.js index 2f1531835..1f6419008 100644 --- a/src/base/single/button/listitem/blankiconicontextitem.js +++ b/src/base/single/button/listitem/blankiconicontextitem.js @@ -9,6 +9,7 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, { _defaultConfig: function () { var conf = BI.BlankIconIconTextItem.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-blank-icon-icon-text-item", iconCls1: "", @@ -19,7 +20,7 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, { textHgap: 0, textVgap: 0, textLgap: 0, - textRgap: 0 + textRgap: 0, }); }, @@ -31,21 +32,21 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, { columnSize: [o.blankWidth, o.leftIconWrapperWidth || o.height, o.rightIconWrapperWidth || o.height, "fill"], items: [{ type: "bi.layout", - width: o.blankWidth + width: o.blankWidth, }, { type: "bi.icon_label", cls: o.iconCls1, width: o.leftIconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight + iconHeight: o.iconHeight, }, { type: "bi.icon_label", cls: o.iconCls2, width: o.rightIconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight + iconHeight: o.iconHeight, }, { el: { type: "bi.label", @@ -60,9 +61,9 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, { text: o.text, value: o.value, keyword: o.keyword, - height: o.height - } - }] + height: o.height, + }, + }], }; }, @@ -111,7 +112,7 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, { unHighLight: function () { this.text.unHighLight.apply(this.text, arguments); - } + }, }); BI.BlankIconIconTextItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.blank_icon_icon_text_item", BI.BlankIconIconTextItem); diff --git a/src/base/single/button/listitem/blankicontexticonitem.js b/src/base/single/button/listitem/blankicontexticonitem.js index aeb876e9c..34dc9e7d8 100644 --- a/src/base/single/button/listitem/blankicontexticonitem.js +++ b/src/base/single/button/listitem/blankicontexticonitem.js @@ -10,6 +10,7 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, { _defaultConfig: function () { var conf = BI.BlankIconTextIconItem.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-blank-icon-text-icon-item", iconCls1: "", @@ -20,7 +21,7 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, { textHgap: 0, textVgap: 0, textLgap: 0, - textRgap: 0 + textRgap: 0, }); }, @@ -32,14 +33,14 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, { columnSize: [o.blankWidth, o.leftIconWrapperWidth || o.height, "fill", o.rightIconWrapperWidth || o.height], items: [{ type: "bi.layout", - width: o.blankWidth + width: o.blankWidth, }, { type: "bi.icon_label", cls: o.iconCls1, width: o.leftIconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight + iconHeight: o.iconHeight, }, { el: { type: "bi.label", @@ -54,16 +55,16 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, { text: o.text, value: o.value, keyword: o.keyword, - height: o.height - } + height: o.height, + }, }, { type: "bi.icon_label", cls: o.iconCls2, width: o.rightIconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight - }] + iconHeight: o.iconHeight, + }], }; }, @@ -106,7 +107,7 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, { getText: function () { return this.text.getText(); - } + }, }); BI.BlankIconTextIconItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.blank_icon_text_icon_item", BI.BlankIconTextIconItem); diff --git a/src/base/single/button/listitem/blankicontextitem.js b/src/base/single/button/listitem/blankicontextitem.js index 158d05bf6..08f13d22d 100644 --- a/src/base/single/button/listitem/blankicontextitem.js +++ b/src/base/single/button/listitem/blankicontextitem.js @@ -9,6 +9,7 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, { _defaultConfig: function () { var conf = BI.BlankIconTextItem.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-blank-icon-text-item", blankWidth: 0, @@ -18,7 +19,7 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, { textHgap: 0, textVgap: 0, textLgap: 0, - textRgap: 0 + textRgap: 0, }); }, @@ -30,14 +31,14 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, { columnSize: [o.blankWidth, o.iconWrapperWidth || o.height, "fill"], items: [{ type: "bi.layout", - width: o.blankWidth + width: o.blankWidth, }, { type: "bi.icon_label", cls: o.iconCls, width: o.iconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight + iconHeight: o.iconHeight, }, { el: { type: "bi.label", @@ -53,9 +54,9 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, { text: o.text, value: o.value, keyword: o.keyword, - height: o.height - } - }] + height: o.height, + }, + }], }; }, @@ -98,7 +99,7 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, { unHighLight: function () { this.text.unHighLight.apply(this.text, arguments); - } + }, }); BI.BlankIconTextItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.blank_icon_text_item", BI.BlankIconTextItem); diff --git a/src/base/single/button/listitem/icontexticonitem.js b/src/base/single/button/listitem/icontexticonitem.js index 4658bc471..425f47d90 100644 --- a/src/base/single/button/listitem/icontexticonitem.js +++ b/src/base/single/button/listitem/icontexticonitem.js @@ -10,6 +10,7 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, { _defaultConfig: function () { var conf = BI.IconTextIconItem.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-icon-text-icon-item", iconCls1: "", @@ -19,7 +20,7 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, { textHgap: 0, textVgap: 0, textLgap: 0, - textRgap: 0 + textRgap: 0, }); }, @@ -35,7 +36,7 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, { width: o.leftIconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight + iconHeight: o.iconHeight, }, { el: { type: "bi.label", @@ -50,16 +51,16 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, { text: o.text, value: o.value, keyword: o.keyword, - height: o.height - } + height: o.height, + }, }, { type: "bi.icon_label", cls: o.iconCls2, width: o.rightIconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight - }] + iconHeight: o.iconHeight, + }], }; }, @@ -102,7 +103,7 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, { getText: function () { return this.text.getText(); - } + }, }); BI.IconTextIconItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.icon_text_icon_item", BI.IconTextIconItem); diff --git a/src/base/single/button/listitem/icontextitem.js b/src/base/single/button/listitem/icontextitem.js index a54da86f4..8fff16335 100644 --- a/src/base/single/button/listitem/icontextitem.js +++ b/src/base/single/button/listitem/icontextitem.js @@ -9,6 +9,7 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, { _defaultConfig: function () { var conf = BI.IconTextItem.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-icon-text-item", direction: BI.Direction.Left, @@ -19,7 +20,7 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, { textHgap: 0, textVgap: 0, textLgap: 0, - textRgap: 0 + textRgap: 0, }); }, @@ -35,7 +36,7 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, { width: o.iconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight + iconHeight: o.iconHeight, }, { el: { type: "bi.label", @@ -51,9 +52,9 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, { text: o.text, value: o.value, keyword: o.keyword, - height: o.height - } - }] + height: o.height, + }, + }], }; }, @@ -96,7 +97,7 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, { unHighLight: function () { this.text.unHighLight.apply(this.text, arguments); - } + }, }); BI.IconTextItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.icon_text_item", BI.IconTextItem); diff --git a/src/base/single/button/listitem/texticonitem.js b/src/base/single/button/listitem/texticonitem.js index a423195d4..a0ece74e6 100644 --- a/src/base/single/button/listitem/texticonitem.js +++ b/src/base/single/button/listitem/texticonitem.js @@ -10,6 +10,7 @@ BI.TextIconItem = BI.inherit(BI.BasicButton, { _defaultConfig: function () { var conf = BI.TextIconItem.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-icon-item", iconWrapperWidth: null, @@ -19,7 +20,7 @@ BI.TextIconItem = BI.inherit(BI.BasicButton, { textHgap: 0, textVgap: 0, textLgap: 0, - textRgap: 0 + textRgap: 0, }); }, @@ -44,16 +45,16 @@ BI.TextIconItem = BI.inherit(BI.BasicButton, { text: o.text, value: o.value, keyword: o.keyword, - height: o.height - } + height: o.height, + }, }, { type: "bi.icon_label", cls: o.iconCls, width: o.iconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight - }] + iconHeight: o.iconHeight, + }], }; }, @@ -96,7 +97,7 @@ BI.TextIconItem = BI.inherit(BI.BasicButton, { unHighLight: function () { this.text.unHighLight.apply(this.text, arguments); - } + }, }); BI.TextIconItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.text_icon_item", BI.TextIconItem); diff --git a/src/base/single/button/listitem/textitem.js b/src/base/single/button/listitem/textitem.js index ffbcc1efd..c4c810295 100644 --- a/src/base/single/button/listitem/textitem.js +++ b/src/base/single/button/listitem/textitem.js @@ -10,6 +10,7 @@ BI.TextItem = BI.inherit(BI.BasicButton, { _defaultConfig: function () { var conf = BI.TextItem.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-item", textAlign: "left", @@ -17,7 +18,7 @@ BI.TextItem = BI.inherit(BI.BasicButton, { textHgap: 0, textVgap: 0, textLgap: 0, - textRgap: 0 + textRgap: 0, }); }, @@ -28,7 +29,7 @@ BI.TextItem = BI.inherit(BI.BasicButton, { element: this, textAlign: o.textAlign, whiteSpace: o.whiteSpace, - textHeight: o.whiteSpace == "nowrap" ? o.height : o.textHeight, + textHeight: o.whiteSpace === "nowrap" ? o.height : o.textHeight, height: o.height, hgap: o.textHgap, vgap: o.textVgap, @@ -37,7 +38,7 @@ BI.TextItem = BI.inherit(BI.BasicButton, { text: o.text, value: o.value, keyword: o.keyword, - py: o.py + py: o.py, }); }, @@ -80,7 +81,7 @@ BI.TextItem = BI.inherit(BI.BasicButton, { getText: function () { return this.text.getText(); - } + }, }); BI.TextItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.text_item", BI.TextItem); diff --git a/src/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js index 67a197ddd..9f91b0ce4 100644 --- a/src/base/single/editor/editor.textarea.js +++ b/src/base/single/editor/editor.textarea.js @@ -39,13 +39,13 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [{ el: { type: "bi.adaptive", - items: [this.content] + items: [this.content], }, left: 4, right: 4, top: 2, - bottom: 2 - }] + bottom: 2, + }], }); this.content.element.on("input propertychange", function (e) { @@ -139,8 +139,8 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { el: this.watermark, left: 0, top: 0, - right: 0 - }] + right: 0, + }], }); } else { this.watermark.setText(o.watermark); @@ -221,7 +221,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { this.style = style; this.element.css(style); this.content.element.css(BI.extend({}, style, { - color: style.color || BI.DOM.getContrastColor(BI.DOM.isRGBColor(style.backgroundColor) ? BI.DOM.rgb2hex(style.backgroundColor) : style.backgroundColor) + color: style.color || BI.DOM.getContrastColor(BI.DOM.isRGBColor(style.backgroundColor) ? BI.DOM.rgb2hex(style.backgroundColor) : style.backgroundColor), })); }, @@ -243,7 +243,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { _setEnable: function (b) { BI.TextAreaEditor.superclass._setEnable.apply(this, [b]); this.content && (this.content.element[0].disabled = !b); - } + }, }); BI.TextAreaEditor.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextAreaEditor.EVENT_BLUR = "EVENT_BLUR"; diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index ff211e6f1..5de5309c3 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -6,24 +6,24 @@ * @extends BI.Single * @abstract */ -(function (document) { - +((function (document) { /** * @description normalize input.files. create if not present, add item method if not present * @param Object generated wrap object * @return Object the wrap object itself */ - var F = (function (item) { + var F = ((function (item) { return function (input) { var files = input.files || [input]; if (!files.item) { files.item = item; } + return files; }; })(function (i) { return this[i]; - }); + })); var event = { @@ -37,10 +37,12 @@ add: document.addEventListener ? function (node, name, callback) { node.addEventListener(name, callback, false); + return this; } : function (node, name, callback) { node.attachEvent("on" + name, callback); + return this; }, @@ -54,10 +56,12 @@ del: document.removeEventListener ? function (node, name, callback) { node.removeEventListener(name, callback, false); + return this; } : function (node, name, callback) { node.detachEvent("on" + name, callback); + return this; }, @@ -77,11 +81,16 @@ } return false; - } + }, }; var sendFile = (function (toString) { - var multipart = function (boundary, name, file) { + var split = "onabort.onerror.onloadstart.onprogress".split("."), + length = split.length, + CRLF = "\r\n", + xhr = XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP"), + sendFile; + function multipart(boundary, name, file) { return "--".concat( boundary, CRLF, "Content-Disposition: form-data; name=\"", name, "\"; filename=\"", _global.encodeURIComponent(file.fileName), "\"", CRLF, @@ -90,15 +99,11 @@ file.getAsBinary(), CRLF, "--", boundary, "--", CRLF ); - }, - isFunction = function (Function) { + } + function isFunction (Function) { return toString.call(Function) === "[object Function]"; - }, - split = "onabort.onerror.onloadstart.onprogress".split("."), - length = split.length, - CRLF = "\r\n", - xhr = XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP"), - sendFile; + } + // FireFox 3+, Safari 4 beta (Chrome 2 beta file is buggy and will not work) if (xhr.upload || xhr.sendAsBinary) { @@ -108,14 +113,15 @@ if (isFunction(handler.onerror)) { handler.onerror(); } - return; + +return; } for (var xhr = new XMLHttpRequest, upload = xhr.upload || { addEventListener: function (event, callback) { this["on" + event] = callback; - } + }, }, i = 0; i < length; @@ -129,7 +135,7 @@ handler[event](rpe, xhr); } }; - })(split[i]), + }(split[i])), false ); } @@ -174,49 +180,53 @@ }; xhr.onreadystatechange = function () { switch (xhr.readyState) { - case 2: - case 3: + case 2: + case 3: if (rpe.total <= rpe.loaded) { rpe.loaded = rpe.total; } upload.onprogress(rpe); break; - case 4: + case 4: clearInterval(rpe.interval); rpe.interval = 0; rpe.loaded = rpe.total; upload.onprogress(rpe); if (199 < xhr.status && xhr.status < 400) { - upload["onload"]({}); + upload.onload({}); var attachO = BI.jsonDecode(xhr.responseText); attachO.filename = handler.file.fileName; - if (handler.file.type.indexOf("image") != -1) { + if (handler.file.type.indexOf("image") !== -1) { attachO.attach_type = "image"; } handler.attach_array[current] = attachO; } else { - upload["onerror"]({}); + upload.onerror({}); } break; + default: + break; } }; upload.onloadstart(rpe); } else { xhr.onreadystatechange = function () { switch (xhr.readyState) { - case 4: + case 4: var attachO = BI.jsonDecode(xhr.responseText); - if (handler.file.type.indexOf("image") != -1) { + if (handler.file.type.indexOf("image") !== -1) { attachO.attach_type = "image"; } attachO.filename = handler.file.fileName; - if (handler.maxLength == 1) { + if (handler.maxLength === 1) { handler.attach_array[0] = attachO; // handler.attach_array.push(attachO); } else { handler.attach_array[current] = attachO; } break; + default: + break; } }; if (isFunction(upload.onloadstart)) { @@ -235,11 +245,11 @@ form.append("FileData", handler.file); xhr.send(form); } - return handler; + +return handler; }; - } - // Internet Explorer, Opera, others - else { + } else { + // Internet Explorer, Opera, others sendFile = function (handler, maxSize, width, height) { var current = handler.current; var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"), @@ -251,9 +261,10 @@ if (isFunction(handler.onprogress)) { handler.onprogress(rpe, {}); } - }, 100) + }, 100), }, - onload = function () { + target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_"); + function onload() { iframe.onreadystatechange = iframe.onload = iframe.onerror = null; form.parentNode.removeChild(form); form = null; @@ -262,7 +273,7 @@ try { var responseText = (iframe.contentWindow.document || iframe.contentWindow.contentDocument).body.innerHTML; var attachO = BI.jsonDecode(responseText); - if (handler.file.type.indexOf("image") != -1) { + if (handler.file.type.indexOf("image") !== -1) { attachO.attach_type = "image"; } @@ -273,7 +284,7 @@ } catch (e) { attachO.filename = handler.file.fileName; } - if (handler.maxLength == 1) { + if (handler.maxLength === 1) { handler.attach_array[0] = attachO; } else { handler.attach_array[current] = attachO; @@ -286,8 +297,8 @@ if (isFunction(handler.onload)) { handler.onload(rpe, { responseText: responseText }); } - }, - target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_"); + } + try { // IE < 8 does not accept enctype attribute ... var form = document.createElement("
"), iframe = handler.iframe || (handler.iframe = document.createElement("")); @@ -320,8 +331,8 @@ loading: 2, interactive: 3, loaded: 4, - complete: 4 - }[iframe.readyState] || 1 + complete: 4, + }[iframe.readyState] || 1, }); } }; @@ -342,13 +353,12 @@ }; } xhr = null; - return sendFile; - })(Object.prototype.toString); - - var sendFiles = function (handler, maxSize, width, height) { + +return sendFile; + }(Object.prototype.toString)); + function sendFiles(handler, maxSize, width, height) { var length = handler.files.length, - i = 0, onload = handler.onload, onloadstart = handler.onloadstart; handler.current = 0; @@ -401,11 +411,12 @@ } }; } + return handler; - }; + } - var r1 = /\.([^.]+)$/; // .png - var r2 = /\/([^/]+)$/; // image/png + var r1 = /\.([^.]+)$/; // .png + var r2 = /\/([^/]+)$/; // image/png /** * 校验文件类型是否合法,同时兼容旧版形式 @@ -413,7 +424,7 @@ * @param fileType * @returns {boolean} */ - var fileTypeValidate = function (fileName, fileType) { + function fileTypeValidate(fileName, fileType) { if (!fileType) { return true; } @@ -421,25 +432,29 @@ if (mimes[0] === fileType) { mimes = (fileType + "").split(";"); } + return BI.some(mimes, function (index, mime) { var matches; - if (matches = mime.match(r1)) { + matches = mime.match(r1); + if (matches) { return fileName.toLowerCase().indexOf(matches[1]) > -1; } - if (matches = mime.match(r2)) { + matches = mime.match(r2); + if (matches) { return matches[1] === "*" ? true : fileName.toLowerCase().indexOf(matches[1]) > -1; } }); - }; + } BI.File = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.File.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-file display-block", tagName: "input", attributes: { - type: "file" + type: "file", }, name: "", url: "", @@ -452,7 +467,7 @@ }, render: function () { - var self = this, o = this.options; + var o = this.options; if (o.multiple === true) { this.element.attr("multiple", "multiple"); } @@ -498,7 +513,7 @@ file: this.file, total: rpe.total, loaded: rpe.loaded, - simulation: rpe.simulation + simulation: rpe.simulation, }); }; @@ -522,19 +537,21 @@ if (200 > xhr.status || xhr.status > 399) { BI.Msg.toast(BI.i18nText("BI-Upload_File_Error"), { level: "error" }); self.fireEvent(BI.File.EVENT_ERROR); + return; } var error = BI.some(_wrap.attach_array, function (index, attach) { if (attach.errorCode) { BI.Msg.toast(BI.i18nText(attach.errorMsg), { level: "error" }); self.fireEvent(BI.File.EVENT_ERROR, attach); + return true; } }); !error && self.fireEvent(BI.File.EVENT_UPLOADED); }; _wrap.url = o.url; - _wrap.fileType = o.accept; // 文件类型限制 + _wrap.fileType = o.accept; // 文件类型限制 _wrap.attach_array = []; _wrap.attach_names = []; _wrap.attachNum = 0; @@ -548,35 +565,34 @@ var files = F(wrap.dom.input); if (o.maxLength !== -1 && o.maxLength < files.length) { self.fireEvent(BI.File.EVENT_ERROR, { - errorType: 2 + errorType: 2, }); } else { for (var i = 0; i < files.length; i++) { var item = files.item(i); var tempFile = item.value || item.name; var value = item.fileName || (item.fileName = tempFile.split("\\").pop()), - ext = -1 !== value.indexOf(".") ? value.split(".").pop().toLowerCase() : "unknown", size = item.fileSize || item.size; var validateFileType = fileTypeValidate(value, wrap.fileType); if (!validateFileType) { // 文件类型不支持 BI.Msg.toast(o.errorText({ errorType: 0, - file: item + file: item, }) || BI.i18nText("BI-Upload_File_Type_Error", wrap.fileType), { level: "error" }); self.fireEvent(BI.File.EVENT_ERROR, { errorType: 0, - file: item + file: item, }); } else if (wrap.maxSize !== -1 && size && wrap.maxSize < size) { // 文件大小不支持 BI.Msg.toast(o.errorText({ errorType: 1, - file: item + file: item, }) || BI.i18nText("BI-Upload_File_Size_Error", Math.ceil(wrap.maxSize / 1024 / 1024)), { level: "error" }); self.fireEvent(BI.File.EVENT_ERROR, { errorType: 1, - file: item + file: item, }); } else { wrap.files.unshift(item); @@ -584,18 +600,19 @@ } } wrap.files.length > 0 && self.fireEvent(BI.File.EVENT_CHANGE, { - files: wrap.files + files: wrap.files, }); input.value = ""; wrap.dom.input.parentNode.replaceChild(input, wrap.dom.input); wrap.dom.input = input; event.add(wrap.dom.input, "change", arguments.callee); }); + return wrap; }, _wrap: function () { - var self = this, o = this.options; + var o = this.options; // be sure input accept multiple files var input = this.element[0]; if (o.multiple === true) { @@ -608,14 +625,14 @@ // DOM namespace dom: { - input: input, // input file - disabled: false // internal use, checks input file state + input: input, // input file + disabled: false, // internal use, checks input file state }, - name: input.name, // name to send for each file ($_FILES[{name}] in the server) + name: input.name, // name to send for each file ($_FILES[{name}] in the server) // maxSize is the maximum amount of bytes for each file maxSize: o.maxSize ? o.maxSize >> 0 : -1, maxLength: o.maxLength, - files: [], // file list + files: [], // file list // remove every file from the noswfupload component clean: function () { @@ -632,6 +649,7 @@ } } sendFiles(this, this.maxSize); + return this; }, @@ -651,7 +669,7 @@ this.dom.disabled = true; this.dom.input.setAttribute("disabled", "disabled"); } - } + }, }); }, @@ -710,7 +728,7 @@ } else { this.element.attr("disabled", "disabled"); } - } + }, }); BI.File.EVENT_CHANGE = "EVENT_CHANGE"; BI.File.EVENT_UPLOADSTART = "EVENT_UPLOADSTART"; @@ -718,4 +736,4 @@ BI.File.EVENT_PROGRESS = "EVENT_PROGRESS"; BI.File.EVENT_UPLOADED = "EVENT_UPLOADED"; BI.shortcut("bi.file", BI.File); -})(_global.document || {}); +})(_global.document || {})); From c7650ce8bcce7303a4a8e0a3e3c6f4b5371e8ec4 Mon Sep 17 00:00:00 2001 From: chaos0156 <429018715@qq.com> Date: Tue, 16 Aug 2022 14:10:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?KERNEL-12408:base=E4=B8=ADeslint=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/input/file.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index 5de5309c3..4ea51047e 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -114,7 +114,7 @@ handler.onerror(); } -return; + return; } for (var xhr = new XMLHttpRequest, @@ -246,7 +246,7 @@ return; xhr.send(form); } -return handler; + return handler; }; } else { // Internet Explorer, Opera, others @@ -354,7 +354,7 @@ return handler; } xhr = null; -return sendFile; + return sendFile; }(Object.prototype.toString)); function sendFiles(handler, maxSize, width, height) {