From cb9e5e086fc2897563dc169f620b4c66c31fce77 Mon Sep 17 00:00:00 2001 From: Kobi Date: Thu, 14 May 2020 18:16:54 +0800 Subject: [PATCH 01/12] =?UTF-8?q?KERNEL-3882=20test:=20=E5=8D=95=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../button/node/__test__/node.arrow.test.js | 79 +++++++++++ .../node/__test__/node.first.plus.test.js | 66 +++++++++ .../node/__test__/node.icon.arrow.test.js | 66 +++++++++ .../node/__test__/node.last.plus.test.js | 66 +++++++++ .../node/__test__/node.mid.plus.test.js | 66 +++++++++ .../node.multilayer.icon.arrow.test.js | 73 ++++++++++ .../button/node/__test__/node.plus.test.js | 66 +++++++++ src/core/__test__/alias.test.js | 101 ++++++++++++++ src/core/__test__/base.test.js | 131 +++++++++++++++++- src/core/alias.js | 2 +- src/core/base.js | 2 +- 11 files changed, 713 insertions(+), 5 deletions(-) create mode 100644 src/case/button/node/__test__/node.arrow.test.js create mode 100644 src/case/button/node/__test__/node.first.plus.test.js create mode 100644 src/case/button/node/__test__/node.icon.arrow.test.js create mode 100644 src/case/button/node/__test__/node.last.plus.test.js create mode 100644 src/case/button/node/__test__/node.mid.plus.test.js create mode 100644 src/case/button/node/__test__/node.multilayer.icon.arrow.test.js create mode 100644 src/case/button/node/__test__/node.plus.test.js diff --git a/src/case/button/node/__test__/node.arrow.test.js b/src/case/button/node/__test__/node.arrow.test.js new file mode 100644 index 000000000..4b2a08ef5 --- /dev/null +++ b/src/case/button/node/__test__/node.arrow.test.js @@ -0,0 +1,79 @@ +/** + * @author Kobi + * @date 2020/5/12 + */ + +describe("test node.arrow", function () { + + /** + * test_author_kobi + **/ + it("doRedMark 和 unRedMark", function () { + var widget = BI.Test.createWidget({ + type: "bi.arrow_group_node", + text: "要标红的AAA", + }); + widget.doRedMark("AAA"); + expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + widget.unRedMark(); + expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0); + widget.destroy(); + }); + + /** + * test_author_kobi + **/ + it("doClick", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.arrow_group_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.element.click(); + expect(widget.element.find(".expander-down-font").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".expander-right-font").length).to.not.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); + + /** + * test_author_kobi + **/ + it("点击图标", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.arrow_group_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".expander-down-font").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".expander-right-font").length).to.not.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); + + /** + * test_author_kobi + **/ + it("setText", function () { + var widget = BI.Test.createWidget({ + type: "bi.arrow_group_node", + text: "AAA", + }); + widget.setText("BBB"); + expect(widget.element.find(".bi-text").text()).to.equal("BBB"); + widget.destroy(); + }); +}); diff --git a/src/case/button/node/__test__/node.first.plus.test.js b/src/case/button/node/__test__/node.first.plus.test.js new file mode 100644 index 000000000..28912a1ca --- /dev/null +++ b/src/case/button/node/__test__/node.first.plus.test.js @@ -0,0 +1,66 @@ +/** + * @author Kobi + * @date 2020/5/12 + */ + +describe("test node.first.plus", function () { + + /** + * test_author_kobi + **/ + it("doRedMark 和 unRedMark", function () { + var widget = BI.Test.createWidget({ + type: "bi.first_plus_group_node", + text: "要标红的AAA", + }); + widget.doRedMark("AAA"); + expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + widget.unRedMark(); + expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0); + widget.destroy(); + }); + + /** + * test_author_kobi + **/ + it("doClick", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.first_plus_group_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.element.click(); + expect(widget.element.find(".tree-expand-icon-type2").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.element.click(); + expect(widget.element.find(".tree-expand-icon-type2").length).to.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); + + /** + * test_author_kobi + **/ + it("点击图标", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.first_plus_group_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".tree-expand-icon-type2").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".tree-expand-icon-type2").length).to.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); +}); diff --git a/src/case/button/node/__test__/node.icon.arrow.test.js b/src/case/button/node/__test__/node.icon.arrow.test.js new file mode 100644 index 000000000..d5bd74dbb --- /dev/null +++ b/src/case/button/node/__test__/node.icon.arrow.test.js @@ -0,0 +1,66 @@ +/** + * @author Kobi + * @date 2020/5/12 + */ + +describe("test node.icon.arrow", function () { + + /** + * test_author_kobi + **/ + it("doRedMark 和 unRedMark", function () { + var widget = BI.Test.createWidget({ + type: "bi.icon_arrow_node", + text: "要标红的AAA", + }); + widget.doRedMark("AAA"); + expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + widget.unRedMark(); + expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0); + widget.destroy(); + }); + + /** + * test_author_kobi + **/ + it("doClick", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.icon_arrow_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.element.click(); + expect(widget.element.find(".expander-down-font").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".expander-right-font").length).to.not.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); + + /** + * test_author_kobi + **/ + it("点击图标", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.icon_arrow_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".expander-down-font").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".expander-right-font").length).to.not.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); +}); diff --git a/src/case/button/node/__test__/node.last.plus.test.js b/src/case/button/node/__test__/node.last.plus.test.js new file mode 100644 index 000000000..53fab71d9 --- /dev/null +++ b/src/case/button/node/__test__/node.last.plus.test.js @@ -0,0 +1,66 @@ +/** + * @author Kobi + * @date 2020/5/12 + */ + +describe("test node.last.plus", function () { + + /** + * test_author_kobi + **/ + it("doRedMark 和 unRedMark", function () { + var widget = BI.Test.createWidget({ + type: "bi.last_plus_group_node", + text: "要标红的AAA", + }); + widget.doRedMark("AAA"); + expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + widget.unRedMark(); + expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0); + widget.destroy(); + }); + + /** + * test_author_kobi + **/ + it("doClick", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.last_plus_group_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.element.click(); + expect(widget.element.find(".tree-expand-icon-type4").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.element.click(); + expect(widget.element.find(".tree-expand-icon-type4").length).to.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); + + /** + * test_author_kobi + **/ + it("点击图标", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.last_plus_group_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".tree-expand-icon-type4").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".tree-expand-icon-type4").length).to.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); +}); diff --git a/src/case/button/node/__test__/node.mid.plus.test.js b/src/case/button/node/__test__/node.mid.plus.test.js new file mode 100644 index 000000000..d5c899c28 --- /dev/null +++ b/src/case/button/node/__test__/node.mid.plus.test.js @@ -0,0 +1,66 @@ +/** + * @author Kobi + * @date 2020/5/12 + */ + +describe("test node.mid.plus", function () { + + /** + * test_author_kobi + **/ + it("doRedMark 和 unRedMark", function () { + var widget = BI.Test.createWidget({ + type: "bi.mid_plus_group_node", + text: "要标红的AAA", + }); + widget.doRedMark("AAA"); + expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + widget.unRedMark(); + expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0); + widget.destroy(); + }); + + /** + * test_author_kobi + **/ + it("doClick", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.mid_plus_group_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.element.click(); + expect(widget.element.find(".tree-expand-icon-type3").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.element.click(); + expect(widget.element.find(".tree-expand-icon-type3").length).to.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); + + /** + * test_author_kobi + **/ + it("点击图标", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.mid_plus_group_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".tree-expand-icon-type3").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".tree-expand-icon-type3").length).to.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); +}); diff --git a/src/case/button/node/__test__/node.multilayer.icon.arrow.test.js b/src/case/button/node/__test__/node.multilayer.icon.arrow.test.js new file mode 100644 index 000000000..c060e5499 --- /dev/null +++ b/src/case/button/node/__test__/node.multilayer.icon.arrow.test.js @@ -0,0 +1,73 @@ +/** + * @author Kobi + * @date 2020/5/12 + */ + +describe("test node.multilayer.icon.arrow", function () { + + /** + * test_author_kobi + **/ + it("doRedMark 和 unRedMark", function () { + var widget = BI.Test.createWidget({ + type: "bi.multilayer_icon_arrow_node", + text: "要标红的AAA", + layer: 3, + }); + expect(widget.isOnce()).to.equal(true); + widget.doRedMark("AAA"); + expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + widget.unRedMark(); + expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0); + widget.destroy(); + }); + + /** + * test_author_kobi + **/ + it("isSelected 和 setSelected", function () { + var widget = BI.Test.createWidget({ + type: "bi.multilayer_icon_arrow_node", + text: "AAA", + layer: 3, + }); + widget.setSelected(true); + expect(widget.element.find(".active").length).to.not.equal(0); + expect(widget.isSelected()).to.equal(true); + widget.destroy(); + }); + + /** + * test_author_kobi + **/ + it("doClick", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.multilayer_icon_arrow_node", + text: "AAA", + layer: 3, + }); + BI.nextTick(function () { + widget.element.click(); + expect(widget.isSelected()).to.equal(true); + widget.destroy(); + done(); + }); + }); + + /** + * test_author_kobi + **/ + it("点击图标", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.multilayer_icon_arrow_node", + text: "AAA", + layer: 3, + }); + BI.nextTick(function () { + widget.node.element.click(); + expect(widget.element.find(".expander-down-font").length).to.not.equal(0); + widget.destroy(); + done(); + }); + }); +}); diff --git a/src/case/button/node/__test__/node.plus.test.js b/src/case/button/node/__test__/node.plus.test.js new file mode 100644 index 000000000..aebcf46bf --- /dev/null +++ b/src/case/button/node/__test__/node.plus.test.js @@ -0,0 +1,66 @@ +/** + * @author Kobi + * @date 2020/5/12 + */ + +describe("test node.plus", function () { + + /** + * test_author_kobi + **/ + it("doRedMark 和 unRedMark", function () { + var widget = BI.Test.createWidget({ + type: "bi.plus_group_node", + text: "要标红的AAA", + }); + widget.doRedMark("AAA"); + expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + widget.unRedMark(); + expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0); + widget.destroy(); + }); + + /** + * test_author_kobi + **/ + it("doClick", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.plus_group_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.element.click(); + expect(widget.element.find(".tree-expand-icon-type1").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.element.click(); + expect(widget.element.find(".tree-expand-icon-type1").length).to.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); + + /** + * test_author_kobi + **/ + it("点击图标", function (done) { + var widget = BI.Test.createWidget({ + type: "bi.plus_group_node", + text: "AAA", + }); + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".tree-expand-icon-type1").length).to.not.equal(0); + BI.delay(function () { + BI.nextTick(function () { + widget.checkbox.element.click(); + expect(widget.element.find(".tree-expand-icon-type1").length).to.equal(0); + widget.destroy(); + done(); + }); + }, 300); + }); + }); +}); diff --git a/src/core/__test__/alias.test.js b/src/core/__test__/alias.test.js index 51297986d..e97395a42 100644 --- a/src/core/__test__/alias.test.js +++ b/src/core/__test__/alias.test.js @@ -31,4 +31,105 @@ describe("aliasFunctionTest", function () { expect(encodeString).to.equal("tableName120"); expect(BI.decodeURIComponent(encodeString)).to.equal(targetString); }); + + /** + * test_author_kobi + **/ + it("cjkEncode 和 cjkDecode ", function () { + expect(BI.cjkEncode("测试")).to.eql("[6d4b][8bd5]"); + expect(BI.cjkEncode(123)).to.eql(123); + expect(BI.cjkDecode("[6d4b][8bd5]")).to.eql("测试"); + expect(BI.cjkDecode("6d4b 8bd5")).to.eql("6d4b 8bd5"); + expect(BI.cjkDecode(null)).to.eql(""); + }); + + /** + * test_author_kobi + **/ + it("jsonEncode 和 jsonDecode", function () { + var jsonString = '{"a":1,"b":"测\\"试","c":[5,6],"d":null,"e":false}'; + var obj = { + a: 1, + b: '测"试', + c: [5, 6], + d: null, + e: false, + }; + expect(BI.jsonEncode(obj)).to.eql(jsonString); + expect(BI.jsonDecode(jsonString)).to.eql(obj); + + expect(BI.jsonEncode({ a: function(){return 1} })).to.eql('{"a":function(){return 1}}'); + expect(BI.jsonDecode("{__time__:878313600000}")).to.eql(new Date(878313600000)); + }); + + /** + * test_author_kobi + **/ + it("getEncodeURL", function () { + expect(BI.getEncodeURL("design/{tableName}/{fieldName}",{tableName: "A", fieldName: "a"})).to.eql("design/A/a"); + }); + + /** + * test_author_kobi + **/ + it("contentFormat", function () { + expect(BI.contentFormat("", "DTyyyy-MM-dd")).to.eql(""); + expect(BI.contentFormat(878313600000, "")).to.eql("878313600000"); + expect(BI.contentFormat("test", "T")).to.eql("test"); + expect(BI.contentFormat(878313600000, "E")).to.eql("9E11"); + expect(BI.contentFormat(1000.23456789, "0,000.####")).to.eql("1,000.2346"); + expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd")).to.eql("1997-11-09"); + expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd HH:mm:ss a z")).to.eql("1997-11-09 13:00:00 pm "); + expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd hh:mm:ss a z")).to.eql("1997-11-09 01:00:00 pm "); + expect(BI.contentFormat(879051600000, "DTyyy-M-d H:m:s a z")).to.eql("97-11-9 13:0:0 pm "); + expect(BI.contentFormat(879048000000, "DTyyy-M-d h:m:s a z")).to.eql("97-11-9 12:0:0 pm "); + }); + + /** + * test_author_kobi + **/ + it("parseFmt", function () { + expect(BI.parseFmt("yyyy-MM-dd HH:mm:ss")).to.eql("%Y-%X-%d %H:%M:%S"); + expect(BI.parseFmt("yyyy-MM-d hh:mm:ss")).to.eql("%Y-%X-%e %I:%M:%S"); + expect(BI.parseFmt("")).to.eql(""); + }); + + /** + * test_author_kobi + **/ + it("str2Date", function () { + expect(BI.str2Date('2013-12-12', 'yyyy-MM-dd')).to.eql(new Date(2013, 11, 12)); + expect(BI.str2Date('2013-12-12', 123)).to.eql(null); + }); + + /** + * test_author_kobi + **/ + it("object2Number", function () { + expect(BI.object2Number(null)).to.eql(0); + expect(BI.object2Number(123)).to.eql(123); + expect(BI.object2Number("1.23")).to.eql(1.23); + expect(BI.object2Number({ a: 2 })).to.eql(NaN); + }); + + /** + * test_author_kobi + **/ + it("object2Date", function () { + expect(BI.object2Date(null)).to.eql(new Date()); + expect(BI.object2Date(new Date(1997, 10, 9))).to.eql(new Date(1997, 10, 9)); + expect(BI.object2Date(879051600000)).to.eql(new Date(879051600000)); + expect(BI.object2Time("1997-11-09")).to.eql(new Date(1997, 10, 9)); + expect(BI.object2Date({ a: 2 })).to.eql(new Date()); + }); + + /** + * test_author_kobi + **/ + it("object2Time", function () { + expect(BI.object2Time(null)).to.eql(new Date()); + expect(BI.object2Time(new Date(1997, 11, 9))).to.eql(new Date(1997, 11, 9)); + expect(BI.object2Time("1997-11-09 13:00:00")).to.eql(new Date(1997, 10, 9, 13, 0, 0)); + expect(BI.object2Time("13:00:00")).to.eql(new Date(1970, 0, 1, 13, 0, 0)); + }); }); diff --git a/src/core/__test__/base.test.js b/src/core/__test__/base.test.js index df933bae7..ddc3fd130 100644 --- a/src/core/__test__/base.test.js +++ b/src/core/__test__/base.test.js @@ -285,7 +285,7 @@ describe("baseFunctionTest", function () { it("number", function () { expect(BI.parseSafeInt(9007199254740992)).to.equal(9007199254740991); expect(BI.isNegativeInteger(-3)).to.equal(true); - expect(BI.isFloat(1.2)).to.equal(false); + expect(BI.isFloat(1.2)).to.equal(true); expect(BI.isOdd(1)).to.equal(true); expect(BI.isOdd("a")).to.equal(false); expect(BI.isEven("a")).to.equal(false); @@ -304,7 +304,132 @@ describe("baseFunctionTest", function () { expect(BI.camelize("background-color")).to.equal("backgroundColor"); expect(BI.escape("'\\")).to.equal("\\'\\\\"); expect(BI.leftPad("123", 5, "0")).to.equal("00123"); - var cls = 'my-class', text = 'Some text'; - expect(BI.format('
{1}
', cls, text)).to.equal('
Some text
'); + const cls = "my-class", text = "Some text"; + expect(BI.format("
{1}
", cls, text)).to.equal("
Some text
"); + }); + + /** + * test_author_kobi + **/ + it("checkDateVoid", function () { + const minDate = "1900-02-02"; + const maxDate = "2099-11-29"; + expect(BI.checkDateVoid(1899, 2, 2, minDate, maxDate)).to.eql(["y"]); + expect(BI.checkDateVoid(2100, 2, 2, minDate, maxDate)).to.eql(["y", 1]); + expect(BI.checkDateVoid(1900, 1, 2, minDate, maxDate)).to.eql(["m"]); + expect(BI.checkDateVoid(2099, 12, 2, minDate, maxDate)).to.eql(["m", 1]); + expect(BI.checkDateVoid(1900, 2, 1, minDate, maxDate)).to.eql(["d"]); + expect(BI.checkDateVoid(2099, 11, 30, minDate, maxDate)).to.eql(["d", 1]); + }); + + /** + * test_author_kobi + **/ + it("parseDateTime", function () { + expect(BI.parseDateTime("19971109", "%y%x%d")).to.eql(BI.getDate(1997, 10, 9)); + expect(BI.parseDateTime("12:34:56", "%H:%M:%S")).to.eql(BI.getDate(1935, 0, 25, 12, 34, 56)); + expect(BI.parseDateTime("1997-11-09 3:23:23 pm", "%y-%x-%d %H:%M:%S %P")).to.eql(BI.getDate(1997, 10, 9, 15, 23, 23)); + expect(BI.parseDateTime("1997-11-09 15:23:23 am", "%y-%x-%d %H:%M:%S %P")).to.eql(BI.getDate(1997, 10, 9, 3, 23, 23)); + expect(BI.parseDateTime("a-b-c d:e:f", "%y-%x-%d %H:%M:%S").toString()).to.eql(BI.getDate().toString()); + }); + + /** + * test_author_kobi + **/ + it("getDate 和 getTime", function () { + expect(BI.getDate().toString()).to.eql(new Date().toString()); + expect(BI.getDate(1997)).to.eql(new Date(1997)); + expect(BI.getDate(1997, 10)).to.eql(new Date(1997, 10)); + expect(BI.getDate(1997, 10, 9)).to.eql(new Date(1997, 10, 9)); + expect(BI.getDate(1997, 10, 9, 12)).to.eql(new Date(1997, 10, 9, 12)); + expect(BI.getDate(1997, 10, 9, 12, 34)).to.eql(new Date(1997, 10, 9, 12, 34)); + expect(BI.getDate(1997, 10, 9, 12, 34, 56)).to.eql(new Date(1997, 10, 9, 12, 34, 56)); + expect(BI.getDate(1997, 10, 9, 12, 34, 56, 78)).to.eql(new Date(1997, 10, 9, 12, 34, 56, 78)); + expect(BI.getTime()).to.eql(new Date().getTime()); + expect(BI.getTime(1997)).to.eql(new Date(1997).getTime()); + expect(BI.getTime(1997, 10)).to.eql(new Date(1997, 10).getTime()); + expect(BI.getTime(1997, 10, 9)).to.eql(new Date(1997, 10, 9).getTime()); + expect(BI.getTime(1997, 10, 9, 12)).to.eql(new Date(1997, 10, 9, 12).getTime()); + expect(BI.getTime(1997, 10, 9, 12, 34)).to.eql(new Date(1997, 10, 9, 12, 34).getTime()); + expect(BI.getTime(1997, 10, 9, 12, 34, 56)).to.eql(new Date(1997, 10, 9, 12, 34, 56).getTime()); + expect(BI.getTime(1997, 10, 9, 12, 34, 56, 78)).to.eql(new Date(1997, 10, 9, 12, 34, 56, 78).getTime()); + }); + + /** + * test_author_kobi + **/ + it("数字相关方法补充", function () { + const iteratee = function (a, b) { + return a > b ? a : b; + }; + expect(BI.isNaturalNumber(1.25)).to.eql(false); + expect(BI.isPositiveInteger(-15)).to.eql(false); + expect(BI.isNegativeInteger(+15)).to.eql(false); + expect(BI.isFloat(15)).to.eql(false); + expect(BI.sum([4, 3, 2, 1], iteratee)).to.eql(12); + }); + + /** + * test_author_kobi + **/ + it("集合相关方法补充", function () { + const array = [{ + user: "barney", + active: true, + }, { + user: "fred", + active: false, + }, { + user: "pebbles", + active: false, + }]; + expect(BI.backEvery(array, (index, value) => value.user === "kobi")).to.eql(false); + expect(BI.backFind(array, ["active", false])).to.eql(array[2]); + expect(BI.abc2Int("ABCD999")).to.eql(0); + expect(BI.int2Abc(0)).to.eql(""); + expect(BI.int2Abc(26)).to.eql("Z"); + }); + + /** + * test_author_kobi + **/ + it("数组相关方法补充", function () { + expect(BI.makeArrayByArray([], 5)).to.eql([]); + expect(BI.uniq(null, true, (a, b) => a > b)).to.eql([]); + }); + + /** + * test_author_kobi + **/ + it("对象相关方法补充", function () { + var obj = { + a: 1, + b: 2, + c: 3, + }; + expect(BI.has(obj, [])).to.eql(false); + expect(BI.has(obj, ["a", "b"])).to.eql(true); + expect(BI.freeze("1")).to.eql("1"); + }); + + /** + * test_author_kobi + **/ + it("deep方法补充", function () { + var obj = { + a: 1, + b: 2, + c: { + d: 3, + e: { + f: 4, + }, + }, + }; + expect(BI.isDeepMatch(null, { d: 3, e: { f: 4 } })).to.eql(false); + expect(BI.isDeepMatch(obj, { d: 3, e: { f: 5 } })).to.eql(false); + expect(BI.deepIndexOf(obj, { d: 3, e: { f: 5 } })).to.eql(-1); + expect(BI.deepRemove(obj, { d: 3, e: { f: 4 } })).to.eql(true); + expect(BI.deepWithout(obj, { d: 3, e: { f: 4 } })).to.eql({ a: 1, b: 2 }); }); }); diff --git a/src/core/alias.js b/src/core/alias.js index a41d967a4..d1e3231e5 100644 --- a/src/core/alias.js +++ b/src/core/alias.js @@ -617,7 +617,7 @@ * BI.getEncodeURL("design/{tableName}/{fieldName}",{tableName: "A", fieldName: "a"}) // design/A/a */ BI.getEncodeURL = function (urlTemplate, param) { - return urlTemplate.replaceAll("\\{(.*?)\\}", function (ori, str) { + return BI.replaceAll(urlTemplate, "\\{(.*?)\\}", function (ori, str) { return BI.encodeURIComponent(BI.isObject(param) ? param[str] : param); }); }; diff --git a/src/core/base.js b/src/core/base.js index 5b30e1c3f..df0c6017a 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -825,7 +825,7 @@ if (!_global.BI) { }, isFloat: function (number) { - if (/^([+-]?)\\d*\\.\\d+$/.test(number)) { + if (/^([+-]?)\d*\.\d+$/.test(number)) { return true; } return false; From 6c78bf6846b6e81a956e5df5f459307f2e819009 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 15 May 2020 12:45:40 +0800 Subject: [PATCH 02/12] =?UTF-8?q?BI-65448=20fix:=20=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E5=B7=B2=E9=80=89=E4=B8=8D=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E8=AE=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multiselect/multiselect.combo.js | 8 ++++++-- src/widget/multiselect/multiselect.combo.nobar.js | 8 ++++++-- src/widget/multiselect/multiselect.insert.combo.js | 8 ++++++-- src/widget/multiselect/multiselect.insert.combo.nobar.js | 8 ++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index 8e1f8b2ef..c591fcef4 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -189,7 +189,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.setValue(self.storeValue); BI.nextTick(function () { - self.populate(); + self._populate(); }); }); // 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件 @@ -421,6 +421,10 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { this.popup.setStartValue(value); }, + _populate: function () { + this.combo.populate.apply(this.combo, arguments); + }, + setValue: function (v) { this.storeValue = v || {}; this._assertValue(this.storeValue); @@ -433,7 +437,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }, populate: function () { - this.combo.populate.apply(this.combo, arguments); + this._populate.apply(this, arguments); this.numberCounter.populateSwitcher.apply(this.numberCounter, arguments); } }); diff --git a/src/widget/multiselect/multiselect.combo.nobar.js b/src/widget/multiselect/multiselect.combo.nobar.js index fbc70a66a..41fb79faf 100644 --- a/src/widget/multiselect/multiselect.combo.nobar.js +++ b/src/widget/multiselect/multiselect.combo.nobar.js @@ -178,7 +178,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.setValue(self.storeValue); BI.nextTick(function () { - self.populate(); + self._populate(); }); }); // 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件 @@ -414,6 +414,10 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { this.popup.setStartValue(value); }, + _populate: function () { + this.combo.populate.apply(this.combo, arguments); + }, + setValue: function (v) { this.storeValue = { type: BI.Selection.Multi, @@ -428,7 +432,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { }, populate: function () { - this.combo.populate.apply(this.combo, arguments); + this._populate.apply(this, arguments); this.numberCounter.populateSwitcher.apply(this.numberCounter, arguments); } }); diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index a08f590ad..eb54fc2c8 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -185,7 +185,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.setValue(self.storeValue); BI.nextTick(function () { - self.populate(); + self._populate(); }); }); // 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件 @@ -439,6 +439,10 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { this.popup.setStartValue(value); }, + _populate: function () { + this.combo.populate.apply(this.combo, arguments); + }, + setValue: function (v) { this.storeValue = v || {}; this._assertValue(this.storeValue); @@ -451,7 +455,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { }, populate: function () { - this.combo.populate.apply(this.combo, arguments); + this._populate.apply(this, arguments); this.numberCounter.populateSwitcher.apply(this.numberCounter, arguments); } }); diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js index 52fbbb4ff..ce1522820 100644 --- a/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -180,7 +180,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.setValue(self.storeValue); BI.nextTick(function () { - self.populate(); + self._populate(); }); }); // 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件 @@ -434,6 +434,10 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { this.popup.setStartValue(value); }, + _populate: function () { + this.combo.populate.apply(this.combo, arguments); + }, + setValue: function (v) { this.storeValue = { type: BI.Selection.Multi, @@ -448,7 +452,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { }, populate: function () { - this.combo.populate.apply(this.combo, arguments); + this._populate.apply(this, arguments); this.numberCounter.populateSwitcher.apply(this.numberCounter, arguments); } }); From ffc4ddfb774310c26227558d22947cb6f43230c2 Mon Sep 17 00:00:00 2001 From: Kira Date: Fri, 15 May 2020 13:53:19 +0800 Subject: [PATCH 03/12] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9BI.sum?= =?UTF-8?q?=E5=92=8Caverage=E6=96=B9=E6=B3=95=E5=8F=82=E6=95=B0=E5=A3=B0?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/core/base.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typescript/core/base.ts b/typescript/core/base.ts index c6702d2ef..e72decc91 100644 --- a/typescript/core/base.ts +++ b/typescript/core/base.ts @@ -329,9 +329,9 @@ export interface _base { isEven: (value: string|number) => boolean; - sum: (array: any[], iteratee: Function, context: any) => number; + sum: (array: any[], iteratee?: Function, context?: any) => number; - average: (array: any[], iteratee: Function, context: any) => number; + average: (array: any[], iteratee?: Function, context?: any) => number; trim: (string?: string, chars?: string) => string; From cf7d2441dc066f1a1aa37afa94a405d3089fe5f4 Mon Sep 17 00:00:00 2001 From: Kobi Date: Fri, 15 May 2020 13:59:03 +0800 Subject: [PATCH 04/12] =?UTF-8?q?KERNEL-3882=20test:=20=E5=8D=95=E6=B5=8B?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/__test__/alias.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/__test__/alias.test.js b/src/core/__test__/alias.test.js index e97395a42..9c2a1920e 100644 --- a/src/core/__test__/alias.test.js +++ b/src/core/__test__/alias.test.js @@ -79,10 +79,10 @@ describe("aliasFunctionTest", function () { expect(BI.contentFormat(878313600000, "E")).to.eql("9E11"); expect(BI.contentFormat(1000.23456789, "0,000.####")).to.eql("1,000.2346"); expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd")).to.eql("1997-11-09"); - expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd HH:mm:ss a z")).to.eql("1997-11-09 13:00:00 pm "); - expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd hh:mm:ss a z")).to.eql("1997-11-09 01:00:00 pm "); - expect(BI.contentFormat(879051600000, "DTyyy-M-d H:m:s a z")).to.eql("97-11-9 13:0:0 pm "); - expect(BI.contentFormat(879048000000, "DTyyy-M-d h:m:s a z")).to.eql("97-11-9 12:0:0 pm "); + expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd HH:mm:ss a")).to.eql("1997-11-09 13:00:00 pm"); + expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd hh:mm:ss a")).to.eql("1997-11-09 01:00:00 pm"); + expect(BI.contentFormat(879051600000, "DTyyy-M-d H:m:s a")).to.eql("97-11-9 13:0:0 pm"); + expect(BI.contentFormat(879048000000, "DTyyy-M-d h:m:s a")).to.eql("97-11-9 12:0:0 pm"); }); /** From 5bdead746d4d8cd8b64cff1993ea965260ffd944 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Mon, 18 May 2020 14:36:15 +0800 Subject: [PATCH 05/12] =?UTF-8?q?DEC-13337=20=E6=8F=90=E4=BE=9Buser-select?= =?UTF-8?q?-enable=20=E5=92=8C=20user-select-diable=20common=20=E7=B1=BB?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + src/less/core/utils/common.less | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/changelog.md b/changelog.md index 2d898fca1..ee554b769 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-05) +- 填加bi-user-select-enable和bi-user-select-disable通用类名 - 修复上传控件多个title问题 2.0(2020-04) diff --git a/src/less/core/utils/common.less b/src/less/core/utils/common.less index b6ec053b8..3fda04804 100644 --- a/src/less/core/utils/common.less +++ b/src/less/core/utils/common.less @@ -1218,3 +1218,11 @@ textarea { } } } + +.bi-user-select-enable { + .user-select-enable(); +} + +.bi-user-select-disable { + .user-select-disable(); +} From dc7ae89908e88013da7381ac7e50659f4e448327 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 18 May 2020 15:37:31 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20clear?= =?UTF-8?q?=5Feditor=E4=B9=9F=E6=94=B9=E5=8F=96=E5=80=BC=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/editor/__test__/editor.clear.test.js | 18 ++++++++++++++++++ src/case/editor/editor.clear.js | 3 +-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/case/editor/__test__/editor.clear.test.js b/src/case/editor/__test__/editor.clear.test.js index 1eea576e8..7181a769e 100644 --- a/src/case/editor/__test__/editor.clear.test.js +++ b/src/case/editor/__test__/editor.clear.test.js @@ -89,4 +89,22 @@ describe("clear_editor", function () { editor.destroy(); }); + /** + * test_author_windy + */ + it("getValue1", function () { + var editor = BI.Test.createWidget({ + type: "bi.clear_editor", + width: 300, + value: "12346 7890", + watermark: "添加合法性判断", + errorText: "长度必须大于4", + validationChecker: function () { + return this.getValue().length > 4; + } + }); + expect(editor.getValue()).to.equal("12346 7890"); + editor.destroy(); + }); + }); \ No newline at end of file diff --git a/src/case/editor/editor.clear.js b/src/case/editor/editor.clear.js index 8c6c0f591..372d31bdd 100644 --- a/src/case/editor/editor.clear.js +++ b/src/case/editor/editor.clear.js @@ -144,8 +144,7 @@ BI.ClearEditor = BI.inherit(BI.Widget, { getValue: function () { if (this.isValid()) { - var res = this.editor.getValue().match(/[\S]+/g); - return BI.isNull(res) ? "" : res[res.length - 1]; + return this.editor.getValue(); } }, From 6ce899d4f739ff0d6f7f40749c255823b173a835 Mon Sep 17 00:00:00 2001 From: qcc Date: Mon, 18 May 2020 15:45:08 +0800 Subject: [PATCH 07/12] =?UTF-8?q?DEC-13302=20fix=EF=BC=9A=20linear=5Fsegme?= =?UTF-8?q?nt=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AElayouts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/linersegment/linear.segment.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/case/linersegment/linear.segment.js b/src/case/linersegment/linear.segment.js index c43bf2cc6..22cc5fcd9 100644 --- a/src/case/linersegment/linear.segment.js +++ b/src/case/linersegment/linear.segment.js @@ -3,6 +3,9 @@ BI.LinearSegment = BI.inherit(BI.Widget, { props: { baseCls: "bi-linear-segment bi-split-bottom", items: [], + layouts: [{ + type: "bi.center" + }], height: 29 }, @@ -14,9 +17,7 @@ BI.LinearSegment = BI.inherit(BI.Widget, { type: "bi.linear_segment_button", height: o.height - 1 }), - layout: [{ - type: "bi.center" - }], + layouts: o.layouts, listeners: [{ eventName: "__EVENT_CHANGE__", action: function () { From d7dd4ba89d9f9f8af6882459fef8325b228727c7 Mon Sep 17 00:00:00 2001 From: iapyang Date: Tue, 19 May 2020 16:37:19 +0800 Subject: [PATCH 08/12] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/base/combination/group.button.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/base/combination/group.button.ts b/typescript/base/combination/group.button.ts index 639568de0..4eb186f38 100644 --- a/typescript/base/combination/group.button.ts +++ b/typescript/base/combination/group.button.ts @@ -9,7 +9,7 @@ export interface _ButtonGroup extends _Widget { removeItems(values: any): void; - populate(items?: any): void; + populate(items?: any, ...args: any[]): void; setNotSelectedValue(v: any): void; From ac0559c6fad527ab00d9009a42919701fb6e0b83 Mon Sep 17 00:00:00 2001 From: iapyang Date: Tue, 19 May 2020 16:40:47 +0800 Subject: [PATCH 09/12] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/base/pane.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/typescript/base/pane.ts b/typescript/base/pane.ts index 75c3fc9f0..c5e2f0b87 100644 --- a/typescript/base/pane.ts +++ b/typescript/base/pane.ts @@ -5,6 +5,7 @@ export interface _Pane extends _Widget { loading: (..._args: any[]) => void; loaded: (..._args: any[]) => void; check: (..._args: any[]) => void; + populate: (items: any[]) => void; } export interface _PaneStatic { From bc7220f7950821ac63fb3907bbe6d63119597214 Mon Sep 17 00:00:00 2001 From: iapyang Date: Tue, 19 May 2020 17:07:53 +0800 Subject: [PATCH 10/12] =?UTF-8?q?refactor:=20=E7=B1=BB=E5=9E=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/base/pane.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/typescript/base/pane.ts b/typescript/base/pane.ts index c5e2f0b87..bb042a767 100644 --- a/typescript/base/pane.ts +++ b/typescript/base/pane.ts @@ -1,11 +1,11 @@ import { _Widget } from "../core/widget"; export interface _Pane extends _Widget { - _assertTip: (..._args: any[]) => void; - loading: (..._args: any[]) => void; - loaded: (..._args: any[]) => void; - check: (..._args: any[]) => void; - populate: (items: any[]) => void; + _assertTip(..._args: any[]): void; + loading(..._args: any[]): void; + loaded(..._args: any[]): void; + check(..._args: any[]): void; + populate(...args: any[]): void; } export interface _PaneStatic { From 94e6b4c79553aecee0d11b2429635b4f12586903 Mon Sep 17 00:00:00 2001 From: iapyang Date: Mon, 25 May 2020 17:05:37 +0800 Subject: [PATCH 11/12] =?UTF-8?q?REPORT-31462=20refactor:=20=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=80=BC=E4=B8=8A=E6=8A=9B=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/treevaluechooser/combo.listtreevaluechooser.js | 4 ++-- .../treevaluechooser/combo.treevaluechooser.insert.js | 4 ++-- src/component/treevaluechooser/combo.treevaluechooser.js | 4 ++-- src/widget/multitree/multi.tree.combo.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/component/treevaluechooser/combo.listtreevaluechooser.js b/src/component/treevaluechooser/combo.listtreevaluechooser.js index 076849dcb..4286b9cd7 100644 --- a/src/component/treevaluechooser/combo.listtreevaluechooser.js +++ b/src/component/treevaluechooser/combo.listtreevaluechooser.js @@ -52,8 +52,8 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, } }, { eventName: BI.MultiTreeListCombo.EVENT_CLICK_ITEM, - action: function () { - self.fireEvent(BI.ListTreeValueChooserInsertCombo.EVENT_CLICK_ITEM); + action: function (v) { + self.fireEvent(BI.ListTreeValueChooserInsertCombo.EVENT_CLICK_ITEM, v); } }, { eventName: BI.MultiTreeListCombo.EVENT_SEARCHING, diff --git a/src/component/treevaluechooser/combo.treevaluechooser.insert.js b/src/component/treevaluechooser/combo.treevaluechooser.insert.js index f89032c92..3527c5d3a 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.insert.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.insert.js @@ -51,8 +51,8 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { } }, { eventName: BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, - action: function () { - self.fireEvent(BI.TreeValueChooserInsertCombo.EVENT_CLICK_ITEM); + action: function (v) { + self.fireEvent(BI.TreeValueChooserInsertCombo.EVENT_CLICK_ITEM, v); } }, { eventName: BI.MultiTreeInsertCombo.EVENT_SEARCHING, diff --git a/src/component/treevaluechooser/combo.treevaluechooser.js b/src/component/treevaluechooser/combo.treevaluechooser.js index 32e8fac3e..a859fed0f 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.js @@ -51,8 +51,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { } }, { eventName: BI.MultiTreeCombo.EVENT_CLICK_ITEM, - action: function () { - self.fireEvent(BI.TreeValueChooserCombo.EVENT_CLICK_ITEM); + action: function (v) { + self.fireEvent(BI.TreeValueChooserCombo.EVENT_CLICK_ITEM, v); } }, { eventName: BI.MultiTreeCombo.EVENT_SEARCHING, diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index e62da553c..97b28d492 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/src/widget/multitree/multi.tree.combo.js @@ -181,7 +181,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { }; this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); self.numberCounter.setButtonChecked(val); - self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM); + self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue()); }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { From e34a320913d29292bce991466c8fb0646a523646 Mon Sep 17 00:00:00 2001 From: iapyang Date: Tue, 26 May 2020 14:42:09 +0800 Subject: [PATCH 12/12] =?UTF-8?q?REPORT-31989=20refactor:=20=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/date/calendar/picker.year.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/widget/date/calendar/picker.year.js b/src/widget/date/calendar/picker.year.js index fafbe40dc..fef2ba069 100644 --- a/src/widget/date/calendar/picker.year.js +++ b/src/widget/date/calendar/picker.year.js @@ -50,7 +50,8 @@ BI.YearPicker = BI.inherit(BI.Widget, { type: "bi.year_date_combo", min: o.min, behaviors: o.behaviors, - max: o.max + max: o.max, + width: 50 }); this.year.on(BI.YearDateCombo.EVENT_CHANGE, function () { self.setValue(self.year.getValue()); @@ -69,13 +70,7 @@ BI.YearPicker = BI.inherit(BI.Widget, { }, { type: "bi.center_adapt", items: [{ - el: { - type: "bi.horizontal_float", - width: 50, - items: [{ - el: this.year - }] - } + el: this.year }] }, { el: {