From 88f978aee36165cdbb41c963917d435ed9fbf599 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 5 Sep 2019 14:42:11 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=8A=BD=E4=B8=80=E4=B8=8B=E5=85=AC?= =?UTF-8?q?=E5=85=B1=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/2.0/fineui.ie.js | 26 +++++++++++++------ dist/2.0/fineui.js | 26 +++++++++++++------ dist/bundle.ie.js | 26 +++++++++++++------ dist/bundle.js | 26 +++++++++++++------ dist/fineui.ie.js | 26 +++++++++++++------ dist/fineui.js | 26 +++++++++++++------ dist/fineui_without_jquery_polyfill.js | 26 +++++++++++++------ dist/widget.js | 26 +++++++++++++------ .../__test__/dynamicdate.combo.test.js | 23 ++++++++++++++++ .../multilayerselecttree.trigger.js | 13 +++++++--- .../multilayersingletree.trigger.js | 13 +++++++--- 11 files changed, 185 insertions(+), 72 deletions(-) diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index f85f093356..4270cea0e0 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -69129,9 +69129,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -69238,6 +69236,13 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -69319,7 +69324,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(items); }, setValue: function (v) { @@ -70305,9 +70310,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -70414,6 +70417,13 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -70496,7 +70506,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(); }, setValue: function (v) { diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 5c832fa5c5..0e0ce3b381 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -69533,9 +69533,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -69642,6 +69640,13 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -69723,7 +69728,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(items); }, setValue: function (v) { @@ -70709,9 +70714,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -70818,6 +70821,13 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -70900,7 +70910,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(); }, setValue: function (v) { diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index f85f093356..4270cea0e0 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -69129,9 +69129,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -69238,6 +69236,13 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -69319,7 +69324,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(items); }, setValue: function (v) { @@ -70305,9 +70310,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -70414,6 +70417,13 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -70496,7 +70506,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(); }, setValue: function (v) { diff --git a/dist/bundle.js b/dist/bundle.js index 5c832fa5c5..0e0ce3b381 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -69533,9 +69533,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -69642,6 +69640,13 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -69723,7 +69728,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(items); }, setValue: function (v) { @@ -70709,9 +70714,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -70818,6 +70821,13 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -70900,7 +70910,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(); }, setValue: function (v) { diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 4fd2feb949..5230e323ea 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -69374,9 +69374,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -69483,6 +69481,13 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -69564,7 +69569,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(items); }, setValue: function (v) { @@ -70550,9 +70555,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -70659,6 +70662,13 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -70741,7 +70751,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(); }, setValue: function (v) { diff --git a/dist/fineui.js b/dist/fineui.js index 5b902a9c78..d986a75d8a 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -69778,9 +69778,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -69887,6 +69885,13 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -69968,7 +69973,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(items); }, setValue: function (v) { @@ -70954,9 +70959,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -71063,6 +71066,13 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -71145,7 +71155,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(); }, setValue: function (v) { diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 549d0671bc..80ff9b32d5 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -52077,9 +52077,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -52186,6 +52184,13 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -52267,7 +52272,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(items); }, setValue: function (v) { @@ -53253,9 +53258,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -53362,6 +53365,13 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -53444,7 +53454,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(); }, setValue: function (v) { diff --git a/dist/widget.js b/dist/widget.js index 180f82c97e..40fa954986 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -7187,9 +7187,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -7296,6 +7294,13 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -7377,7 +7382,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(items); }, setValue: function (v) { @@ -8363,9 +8368,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -8472,6 +8475,13 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -8554,7 +8564,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(); }, setValue: function (v) { diff --git a/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js b/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js index eb6ff40627..60804a89a4 100644 --- a/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js +++ b/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js @@ -82,6 +82,29 @@ describe("DateCombo", function () { }); + /** + * test_author_windy + */ + it("下拉后直接点击外部的触发的confirm", function (done) { + var dateCombo = BI.Test.createWidget({ + type: "bi.dynamic_date_combo", + width: 220, + height: 30 + }); + // 点击日期,是否收起下拉 + dateCombo.element.find(".bi-date-trigger .bi-basic-button").click(); + BI.nextTick(function () { + BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), null, BI.KeyCode.ENTER, function () { + BI.delay(function () { + expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").css("display")).to.equal("none"); + dateCombo.destroy(); + done(); + }, 300); + }); + }) + + }); + /** * test_author_windy diff --git a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js index f9312e384c..894957496d 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js @@ -19,9 +19,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -128,6 +126,13 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -209,7 +214,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(items); }, setValue: function (v) { diff --git a/src/widget/multilayersingletree/multilayersingletree.trigger.js b/src/widget/multilayersingletree/multilayersingletree.trigger.js index 819986c595..66c350231b 100644 --- a/src/widget/multilayersingletree/multilayersingletree.trigger.js +++ b/src/widget/multilayersingletree/multilayersingletree.trigger.js @@ -19,9 +19,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { - this.tree = new BI.Tree(); - this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); - this.tree.initTree(this.nodes); + this._initData(); } var content = { type: "bi.htape", @@ -128,6 +126,13 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _initData: function() { + var o = this.options; + this.tree = new BI.Tree(); + this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); + this.tree.initTree(this.nodes); + }, + _getSearchItems: function(keyword) { var o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 @@ -210,7 +215,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { populate: function (items) { this.options.items = items; - this.nodes = BI.Tree.treeFormat(BI.deepClone(items)); + this._initData(); }, setValue: function (v) { From 53a41e5044c929aba802eae63d141876c6b1a110 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 5 Sep 2019 19:42:56 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=B0=91=E6=94=B9=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/dynamicdatetime/dynamicdatetime.timeselect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js index dde68f6d97..adf6dfb4bf 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js @@ -72,7 +72,7 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, { }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], From 7cd74b998d5f38d4eea30b4d3305fc7ca589ec4b Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 5 Sep 2019 19:47:06 +0800 Subject: [PATCH 3/5] =?UTF-8?q?BI-51100=20=E5=8D=95=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo.multilayer_single_tree_combo.js | 10 +- dist/2.0/fineui.ie.js | 2 +- dist/2.0/fineui.js | 2 +- dist/bundle.ie.js | 2 +- dist/bundle.js | 2 +- dist/demo.js | 10 +- dist/fineui.ie.js | 2 +- dist/fineui.js | 2 +- dist/fineui_without_jquery_polyfill.js | 2 +- dist/widget.js | 2 +- .../__test__/dynamicdate.combo.test.js | 111 ++++++++++++++++-- 11 files changed, 130 insertions(+), 17 deletions(-) diff --git a/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js b/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js index 109d0c489c..466f1484d7 100644 --- a/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js +++ b/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js @@ -16,8 +16,16 @@ Demo.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, + allowEdit: true, text: "默认值", - items: items, + itemsCreator: function() { + return { + items: [{ + value: 1 + }], + hasNext: false + } + }, width: 300 }, { type: "bi.button", diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 4270cea0e0..f2c7d0c9bd 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -66206,7 +66206,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 0e0ce3b381..88bf428cb2 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -66610,7 +66610,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 4270cea0e0..f2c7d0c9bd 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -66206,7 +66206,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/bundle.js b/dist/bundle.js index 0e0ce3b381..88bf428cb2 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -66610,7 +66610,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/demo.js b/dist/demo.js index 543d484b63..24af8bc04b 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -10586,8 +10586,16 @@ Demo.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, + allowEdit: true, text: "默认值", - items: items, + itemsCreator: function() { + return { + items: [{ + value: 1 + }], + hasNext: false + } + }, width: 300 }, { type: "bi.button", diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 5230e323ea..4fb5de0f1f 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -66451,7 +66451,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/fineui.js b/dist/fineui.js index d986a75d8a..23dd71f5ed 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -66855,7 +66855,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 80ff9b32d5..a56d0b0914 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -49154,7 +49154,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/widget.js b/dist/widget.js index 40fa954986..225f143e39 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -4264,7 +4264,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js b/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js index 60804a89a4..c90c0c295d 100644 --- a/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js +++ b/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js @@ -89,20 +89,117 @@ describe("DateCombo", function () { var dateCombo = BI.Test.createWidget({ type: "bi.dynamic_date_combo", width: 220, - height: 30 + height: 30, }); // 点击日期,是否收起下拉 + BI.nextTick(function () { + dateCombo.element.find(".bi-date-trigger .bi-basic-button").click(); + BI.nextTick(function () { + var input = dateCombo.element.find(".bi-date-trigger .bi-input"); + BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () { + BI.delay(function () { + expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").css("display")).to.equal("none"); + dateCombo.destroy(); + done(); + }, 300); + }); + }) + }); + }); + + + /** + * test_author_windy + */ + it("点击清空", function (done) { + var dateCombo = BI.Test.createWidget({ + type: "bi.dynamic_date_combo", + width: 220, + height: 30, + value: { + type: 1, + value: { + year: 2018, + month: 2, + day: 23 + } + } + }); dateCombo.element.find(".bi-date-trigger .bi-basic-button").click(); BI.nextTick(function () { - BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), null, BI.KeyCode.ENTER, function () { - BI.delay(function () { - expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").css("display")).to.equal("none"); - dateCombo.destroy(); - done(); - }, 300); + dateCombo.element.find(".bi-dynamic-date-popup .bi-text:contains(清除)").parent().click(); + expect(BI.isNull(dateCombo.getValue())).to.equal(true); + dateCombo.destroy(); + done(); + }) + }); + + /** + * test_author_windy + */ + it("点击今天", function (done) { + var dateCombo = BI.Test.createWidget({ + type: "bi.dynamic_date_combo", + width: 220, + height: 30, + value: { + type: 1, + value: { + year: 2018, + month: 2, + day: 23 + } + } + }); + dateCombo.element.find(".bi-date-trigger .bi-basic-button").click(); + BI.nextTick(function () { + dateCombo.element.find(".bi-dynamic-date-popup .bi-text:contains(今天)").parent().click(); + var date = BI.getDate(); + expect(dateCombo.getValue()).to.equal({ + type: 1, + value: { + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate() + } }); + dateCombo.destroy(); + done(); }) + }); + + /** + * test_author_windy + */ + it("点击确定", function (done) { + var dateCombo = BI.Test.createWidget({ + type: "bi.dynamic_date_combo", + width: 220, + height: 30, + value: { + type: 1, + value: { + year: 2018, + month: 2, + day: 23 + } + } + }); + dateCombo.element.find(".bi-date-trigger .bi-basic-button").click(); + BI.nextTick(function () { + dateCombo.element.find(".bi-dynamic-date-popup .bi-text:contains(确定)").parent().click(); + expect(dateCombo.getValue()).to.deep.equal({ + type: 1, + value: { + year: 2018, + month: 2, + day: 23 + } + }); + dateCombo.destroy(); + done(); + }) }); From 5a3c804bbb9c3a1f6788067c45a4a7a8a9ce9557 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 5 Sep 2019 19:47:26 +0800 Subject: [PATCH 4/5] revert --- .../singletree/demo.multilayer_single_tree_combo.js | 10 +--------- dist/demo.js | 10 +--------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js b/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js index 466f1484d7..109d0c489c 100644 --- a/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js +++ b/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js @@ -16,16 +16,8 @@ Demo.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, - allowEdit: true, text: "默认值", - itemsCreator: function() { - return { - items: [{ - value: 1 - }], - hasNext: false - } - }, + items: items, width: 300 }, { type: "bi.button", diff --git a/dist/demo.js b/dist/demo.js index 24af8bc04b..543d484b63 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -10586,16 +10586,8 @@ Demo.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, - allowEdit: true, text: "默认值", - itemsCreator: function() { - return { - items: [{ - value: 1 - }], - hasNext: false - } - }, + items: items, width: 300 }, { type: "bi.button", From c2e1193e87a334571d37aea760348875f6ff8da2 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 5 Sep 2019 19:58:04 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/dynamicdate/__test__/dynamicdate.combo.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js b/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js index c90c0c295d..ff854c4ddf 100644 --- a/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js +++ b/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js @@ -155,7 +155,7 @@ describe("DateCombo", function () { BI.nextTick(function () { dateCombo.element.find(".bi-dynamic-date-popup .bi-text:contains(今天)").parent().click(); var date = BI.getDate(); - expect(dateCombo.getValue()).to.equal({ + expect(dateCombo.getValue()).to.deep.equal({ type: 1, value: { year: date.getFullYear(),