From e1272d4606df516573fcc62693a211a2ee9095c8 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 17 Jan 2018 12:25:02 +0800 Subject: [PATCH] =?UTF-8?q?tree=E5=8A=A0value=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/case/tree/demo.simple_tree.js | 134 ++++++---- .../demo.multilayer_select_tree_combo.js | 3 +- .../selecttree/demo.select_tree_combo.js | 3 +- .../singletree/demo.single_tree_combo.js | 5 +- .../tree/demo.multilayer_select_level_tree.js | 3 +- .../tree/demo.multilayer_single_level_tree.js | 3 +- demo/js/widget/tree/demo.select_level_tree.js | 5 +- demo/js/widget/tree/demo.single_level_tree.js | 5 +- demo/js/widget/tree/demo.switchtree.js | 3 +- dist/base.js | 94 +++++-- dist/bundle.js | 242 ++++++++++++------ dist/case.js | 78 +++--- dist/demo.js | 168 +++++++----- dist/fineui.js | 242 ++++++++++++------ dist/widget.js | 70 +++-- src/base/combination/combo.js | 23 +- src/base/combination/expander.js | 23 +- src/base/combination/searcher.js | 10 +- src/base/combination/switcher.js | 21 +- src/base/layer/layer.popup.js | 2 +- src/base/layer/layer.searcher.js | 6 +- src/base/tree/customtree.js | 3 +- src/base/tree/treeview.js | 6 +- src/case/colorchooser/colorchooser.js | 50 ++-- src/case/colorchooser/colorchooser.popup.js | 9 +- .../colorchooser/colorpicker/colorpicker.js | 3 +- src/case/tree/tree.level.js | 4 +- src/case/tree/tree.simple.js | 10 +- src/case/trigger/trigger.text.select.js | 2 +- .../multilayerselecttree.combo.js | 9 +- .../multilayerselecttree.leveltree.js | 4 +- .../multilayerselecttree.popup.js | 4 +- .../multilayersingletree.combo.js | 9 +- .../multilayersingletree.leveltree.js | 1 + .../multilayersingletree.popup.js | 3 +- src/widget/selecttree/selecttree.combo.js | 9 +- src/widget/selecttree/selecttree.popup.js | 4 +- src/widget/singletree/singletree.combo.js | 9 +- src/widget/singletree/singletree.popup.js | 6 +- src/widget/singletree/singletree.trigger.js | 6 +- src/widget/switchtree/switchtree.js | 6 +- 41 files changed, 874 insertions(+), 426 deletions(-) diff --git a/demo/js/case/tree/demo.simple_tree.js b/demo/js/case/tree/demo.simple_tree.js index c8c420548..291700a34 100644 --- a/demo/js/case/tree/demo.simple_tree.js +++ b/demo/js/case/tree/demo.simple_tree.js @@ -7,53 +7,97 @@ Demo.Func = BI.inherit(BI.Widget, { // value值一定要是字符串 var tree = BI.createWidget({ type: "bi.simple_tree", - items: [] + items: [{ + id: 1, + text: "第一项", + value: "1" + }, { + id: 2, + text: "第二项", + value: "2" + }, { + id: 3, + text: "第三项", + value: "3", + open: true + }, { + id: 11, + pId: 1, + text: "子项1", + value: "11" + }, { + id: 12, + pId: 1, + text: "子项2", + value: "12" + }, { + id: 13, + pId: 1, + text: "子项3", + value: "13" + }, { + id: 31, + pId: 3, + text: "子项1", + value: "31" + }, { + id: 32, + pId: 3, + text: "子项2", + value: "32" + }, { + id: 33, + pId: 3, + text: "子项3", + value: "33" + }], + value: ["31", "32", "33"] }); - tree.populate([{ - id: 1, - text: "第一项", - value: "1" - }, { - id: 2, - text: "第二项", - value: "2" - }, { - id: 3, - text: "第三项", - value: "3", - open: true - }, { - id: 11, - pId: 1, - text: "子项1", - value: "11" - }, { - id: 12, - pId: 1, - text: "子项2", - value: "12" - }, { - id: 13, - pId: 1, - text: "子项3", - value: "13" - }, { - id: 31, - pId: 3, - text: "子项1", - value: "31" - }, { - id: 32, - pId: 3, - text: "子项2", - value: "32" - }, { - id: 33, - pId: 3, - text: "子项3", - value: "33" - }], "z"); + // tree.populate([{ + // id: 1, + // text: "第一项", + // value: "1" + // }, { + // id: 2, + // text: "第二项", + // value: "2" + // }, { + // id: 3, + // text: "第三项", + // value: "3", + // open: true + // }, { + // id: 11, + // pId: 1, + // text: "子项1", + // value: "11" + // }, { + // id: 12, + // pId: 1, + // text: "子项2", + // value: "12" + // }, { + // id: 13, + // pId: 1, + // text: "子项3", + // value: "13" + // }, { + // id: 31, + // pId: 3, + // text: "子项1", + // value: "31" + // }, { + // id: 32, + // pId: 3, + // text: "子项2", + // value: "32" + // }, { + // id: 33, + // pId: 3, + // text: "子项3", + // value: "33" + // }], "z"); BI.createWidget({ type: "bi.vtape", element: this, diff --git a/demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js b/demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js index a5e146746..645c28fcd 100644 --- a/demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js +++ b/demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js @@ -18,7 +18,8 @@ Demo.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }, text: "默认值", items: items, - width: 300 + width: 300, + value: ["第五级文件1"] }, { type: "bi.button", text: "getVlaue", diff --git a/demo/js/widget/selecttree/demo.select_tree_combo.js b/demo/js/widget/selecttree/demo.select_tree_combo.js index b18b2faf9..1862340ab 100644 --- a/demo/js/widget/selecttree/demo.select_tree_combo.js +++ b/demo/js/widget/selecttree/demo.select_tree_combo.js @@ -16,6 +16,7 @@ Demo.SelectTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, + value: "11", text: "默认值", items: items, width: 300 @@ -30,7 +31,7 @@ Demo.SelectTreeCombo = BI.inherit(BI.Widget, { type: "bi.button", text: "setVlaue (第二级文件1)", handler: function () { - self.tree.setValue(["第二级文件1"]); + self.tree.setValue(["2"]); }, width: 300 }], diff --git a/demo/js/widget/singletree/demo.single_tree_combo.js b/demo/js/widget/singletree/demo.single_tree_combo.js index 50c2a7d8a..087b28888 100644 --- a/demo/js/widget/singletree/demo.single_tree_combo.js +++ b/demo/js/widget/singletree/demo.single_tree_combo.js @@ -18,7 +18,8 @@ Demo.SingleTreeCombo = BI.inherit(BI.Widget, { }, text: "默认值", items: items, - width: 300 + width: 300, + value: "11" }, { type: "bi.button", text: "getVlaue", @@ -30,7 +31,7 @@ Demo.SingleTreeCombo = BI.inherit(BI.Widget, { type: "bi.button", text: "setVlaue (第二级文件1)", handler: function () { - self.tree.setValue(["第二级文件1"]); + self.tree.setValue(["2"]); }, width: 300 }], diff --git a/demo/js/widget/tree/demo.multilayer_select_level_tree.js b/demo/js/widget/tree/demo.multilayer_select_level_tree.js index 49e75fc85..ecded9c90 100644 --- a/demo/js/widget/tree/demo.multilayer_select_level_tree.js +++ b/demo/js/widget/tree/demo.multilayer_select_level_tree.js @@ -9,7 +9,8 @@ Demo.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { var self = this; var tree = BI.createWidget({ type: "bi.multilayer_select_level_tree", - items: BI.deepClone(Demo.CONSTANTS.TREE) + items: BI.deepClone(Demo.CONSTANTS.TREE), + value: "第五级文件1" }); return { diff --git a/demo/js/widget/tree/demo.multilayer_single_level_tree.js b/demo/js/widget/tree/demo.multilayer_single_level_tree.js index fcf6e7721..cb5c21da0 100644 --- a/demo/js/widget/tree/demo.multilayer_single_level_tree.js +++ b/demo/js/widget/tree/demo.multilayer_single_level_tree.js @@ -9,7 +9,8 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { var self = this; var tree = BI.createWidget({ type: "bi.multilayer_single_level_tree", - items: BI.deepClone(Demo.CONSTANTS.TREE) + items: BI.deepClone(Demo.CONSTANTS.TREE), + value: "第五级文件1" }); return { diff --git a/demo/js/widget/tree/demo.select_level_tree.js b/demo/js/widget/tree/demo.select_level_tree.js index 8ddd81848..04ee65fb6 100644 --- a/demo/js/widget/tree/demo.select_level_tree.js +++ b/demo/js/widget/tree/demo.select_level_tree.js @@ -9,7 +9,8 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, { var self = this; var tree = BI.createWidget({ type: "bi.select_level_tree", - items: BI.deepClone(Demo.CONSTANTS.LEVELTREE) + items: BI.deepClone(Demo.CONSTANTS.LEVELTREE), + value: "11" }); return { @@ -32,7 +33,7 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, { height: 25, text: "setValue (第二级文件1)", handler: function () { - tree.setValue(["第二级文件1"]); + tree.setValue(["2"]); } }, height: 25 diff --git a/demo/js/widget/tree/demo.single_level_tree.js b/demo/js/widget/tree/demo.single_level_tree.js index ff18405aa..c64a9445f 100644 --- a/demo/js/widget/tree/demo.single_level_tree.js +++ b/demo/js/widget/tree/demo.single_level_tree.js @@ -9,7 +9,8 @@ Demo.SingleLevelTree = BI.inherit(BI.Widget, { var self = this; var tree = BI.createWidget({ type: "bi.single_level_tree", - items: BI.deepClone(Demo.CONSTANTS.LEVELTREE) + items: BI.deepClone(Demo.CONSTANTS.LEVELTREE), + value: "11" }); return { @@ -32,7 +33,7 @@ Demo.SingleLevelTree = BI.inherit(BI.Widget, { height: 25, text: "setValue (第二级文件1)", handler: function () { - tree.setValue(["第二级文件1"]); + tree.setValue(["2"]); } }, height: 25 diff --git a/demo/js/widget/tree/demo.switchtree.js b/demo/js/widget/tree/demo.switchtree.js index 28156304d..38f94a273 100644 --- a/demo/js/widget/tree/demo.switchtree.js +++ b/demo/js/widget/tree/demo.switchtree.js @@ -9,7 +9,8 @@ Demo.SwitchTree = BI.inherit(BI.Widget, { var self = this; var tree = BI.createWidget({ type: "bi.switch_tree", - items: BI.deepClone(Demo.CONSTANTS.TREE) + items: BI.deepClone(Demo.CONSTANTS.TREE), + value: "第五级文件1" }); return { diff --git a/dist/base.js b/dist/base.js index c616285d2..959b1d493 100644 --- a/dist/base.js +++ b/dist/base.js @@ -1963,11 +1963,15 @@ BI.TreeView = BI.inherit(BI.Pane, { }); } + if (!this.nodes) { + return; + } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); }); - this.nodes && this.nodes.checkAllNodes(checked); + this.nodes.checkAllNodes(checked); }, expandAll: function (flag) { @@ -3129,14 +3133,17 @@ BI.Combo = BI.inherit(BI.Widget, { }, _initCombo: function () { - this.combo = BI.createWidget(this.options.el); + this.combo = BI.createWidget(this.options.el, { + value: this.options.value + }); }, _assertPopupView: function () { - var self = this; + var self = this, o = this.options; if (this.popupView == null) { this.popupView = BI.createWidget(this.options.popup, { - type: "bi.popup_view" + type: "bi.popup_view", + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { if (type === BI.Events.CLICK) { @@ -3327,14 +3334,20 @@ BI.Combo = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); this.combo.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - this._assertPopupView(); - return this.popupView && this.popupView.getValue(); + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, isViewVisible: function () { @@ -3513,11 +3526,13 @@ BI.Expander = BI.inherit(BI.Widget, { }, _initExpander: function () { - this.expander = BI.createWidget(this.options.el); + this.expander = BI.createWidget(this.options.el, { + value: this.options.value + }); }, _assertPopupView: function () { - var self = this; + var self = this, o = this.options; if (this.popupView == null) { this.popupView = BI.createWidget(this.options.popup, { type: "bi.button_group", @@ -3526,7 +3541,8 @@ BI.Expander = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -3590,14 +3606,20 @@ BI.Expander = BI.inherit(BI.Widget, { }, setValue: function (v) { - // this._assertPopupView(); this.expander.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - // this._assertPopupView(); - return this.popupView ? this.popupView.getValue() : []; + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, isViewVisible: function () { @@ -4489,8 +4511,11 @@ BI.Searcher = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getKeyword: function () { @@ -4511,6 +4536,9 @@ BI.Searcher = BI.inherit(BI.Widget, { } else if (o.adapter && o.adapter.getValue) { return o.adapter.getValue(); } + if (BI.isNull(this.popupView)) { + return o.popup.value; + } return this.popupView.getValue(); }, @@ -4665,7 +4693,9 @@ BI.Switcher = BI.inherit(BI.Widget, { }, _initSwitcher: function () { - this.switcher = BI.createWidget(this.options.el); + this.switcher = BI.createWidget(this.options.el, { + value: o.value + }); }, _assertPopupView: function () { @@ -4679,7 +4709,8 @@ BI.Switcher = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -4739,14 +4770,20 @@ BI.Switcher = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); this.switcher.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - this._assertPopupView(); - return this.popupView ? this.popupView.getValue() : []; + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, setAdapter: function (adapter) { @@ -15377,7 +15414,7 @@ BI.PopupView = BI.inherit(BI.Widget, { _createView: function () { var o = this.options; - this.button_group = BI.createWidget(o.el, {type: "bi.button_group"}); + this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}); this.button_group.element.css({"min-height": o.minHeight + "px"}); return this.button_group; }, @@ -15509,7 +15546,8 @@ BI.SearcherView = BI.inherit(BI.Pane, { }, layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -15537,7 +15575,8 @@ BI.SearcherView = BI.inherit(BI.Pane, { }, layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -33971,7 +34010,8 @@ BI.CustomTree = BI.inherit(BI.Widget, { args[0] = self._formatItems(items); callback.apply(null, args); }]); - } + }, + value: o.value }); this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); diff --git a/dist/bundle.js b/dist/bundle.js index a3e130c7d..cd5c249f0 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -27836,11 +27836,15 @@ BI.TreeView = BI.inherit(BI.Pane, { }); } + if (!this.nodes) { + return; + } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); }); - this.nodes && this.nodes.checkAllNodes(checked); + this.nodes.checkAllNodes(checked); }, expandAll: function (flag) { @@ -29002,14 +29006,17 @@ BI.Combo = BI.inherit(BI.Widget, { }, _initCombo: function () { - this.combo = BI.createWidget(this.options.el); + this.combo = BI.createWidget(this.options.el, { + value: this.options.value + }); }, _assertPopupView: function () { - var self = this; + var self = this, o = this.options; if (this.popupView == null) { this.popupView = BI.createWidget(this.options.popup, { - type: "bi.popup_view" + type: "bi.popup_view", + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { if (type === BI.Events.CLICK) { @@ -29200,14 +29207,20 @@ BI.Combo = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); this.combo.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - this._assertPopupView(); - return this.popupView && this.popupView.getValue(); + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, isViewVisible: function () { @@ -29386,11 +29399,13 @@ BI.Expander = BI.inherit(BI.Widget, { }, _initExpander: function () { - this.expander = BI.createWidget(this.options.el); + this.expander = BI.createWidget(this.options.el, { + value: this.options.value + }); }, _assertPopupView: function () { - var self = this; + var self = this, o = this.options; if (this.popupView == null) { this.popupView = BI.createWidget(this.options.popup, { type: "bi.button_group", @@ -29399,7 +29414,8 @@ BI.Expander = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -29463,14 +29479,20 @@ BI.Expander = BI.inherit(BI.Widget, { }, setValue: function (v) { - // this._assertPopupView(); this.expander.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - // this._assertPopupView(); - return this.popupView ? this.popupView.getValue() : []; + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, isViewVisible: function () { @@ -30362,8 +30384,11 @@ BI.Searcher = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getKeyword: function () { @@ -30384,6 +30409,9 @@ BI.Searcher = BI.inherit(BI.Widget, { } else if (o.adapter && o.adapter.getValue) { return o.adapter.getValue(); } + if (BI.isNull(this.popupView)) { + return o.popup.value; + } return this.popupView.getValue(); }, @@ -30538,7 +30566,9 @@ BI.Switcher = BI.inherit(BI.Widget, { }, _initSwitcher: function () { - this.switcher = BI.createWidget(this.options.el); + this.switcher = BI.createWidget(this.options.el, { + value: o.value + }); }, _assertPopupView: function () { @@ -30552,7 +30582,8 @@ BI.Switcher = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -30612,14 +30643,20 @@ BI.Switcher = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); this.switcher.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - this._assertPopupView(); - return this.popupView ? this.popupView.getValue() : []; + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, setAdapter: function (adapter) { @@ -41250,7 +41287,7 @@ BI.PopupView = BI.inherit(BI.Widget, { _createView: function () { var o = this.options; - this.button_group = BI.createWidget(o.el, {type: "bi.button_group"}); + this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}); this.button_group.element.css({"min-height": o.minHeight + "px"}); return this.button_group; }, @@ -41382,7 +41419,8 @@ BI.SearcherView = BI.inherit(BI.Pane, { }, layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -41410,7 +41448,8 @@ BI.SearcherView = BI.inherit(BI.Pane, { }, layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -59844,7 +59883,8 @@ BI.CustomTree = BI.inherit(BI.Widget, { args[0] = self._formatItems(items); callback.apply(null, args); }]); - } + }, + value: o.value }); this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -65899,25 +65939,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, { _init: function () { BI.ColorChooser.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(BI.extend({ - type: "bi.color_chooser_trigger", - width: o.width, - height: o.height - }, o.el)); - this.colorPicker = BI.createWidget({ - type: "bi.color_chooser_popup" - }); this.combo = BI.createWidget({ type: "bi.combo", element: this, adjustLength: 1, - el: this.trigger, + el: BI.extend({ + type: "bi.color_chooser_trigger", + ref: function (_ref) { + self.trigger = _ref; + }, + width: o.width, + height: o.height + }, o.el), popup: { - el: this.colorPicker, + el: { + type: "bi.color_chooser_popup", + ref: function (_ref) { + self.colorPicker = _ref; + }, + listeners: [{ + eventName: BI.ColorChooserPopup.EVENT_VALUE_CHANGE, + action: function () { + fn(); + } + }, { + eventName: BI.ColorChooserPopup.EVENT_CHANGE, + action: function () { + fn(); + self.combo.hideView(); + } + }] + }, stopPropagation: false, minWidth: 202 - } + }, + value: o.value }); var fn = function () { @@ -65930,15 +65987,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, { que.unshift(color); BI.Cache.setItem("colors", BI.array2String(que.toArray())); }; - - this.colorPicker.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () { - fn(); - }); - - this.colorPicker.on(BI.ColorChooserPopup.EVENT_CHANGE, function () { - fn(); - self.combo.hideView(); - }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || "")); }); @@ -65965,7 +66013,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, { }, getValue: function () { - return this.colorPicker.getValue(); + return this.combo.getValue(); } }); BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE"; @@ -65990,7 +66038,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { BI.ColorChooserPopup.superclass._init.apply(this, arguments); var self = this, o = this.options; this.colorEditor = BI.createWidget({ - type: "bi.color_picker_editor" + type: "bi.color_picker_editor", + value: o.value }); this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () { @@ -66026,7 +66075,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { disabled: true }]], width: 190, - height: 25 + height: 25, + value: o.value }); this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () { self.setValue(this.getValue()[0]); @@ -66036,7 +66086,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { this.colorPicker = BI.createWidget({ type: "bi.color_picker", width: 190, - height: 50 + height: 50, + value: o.value }); this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () { @@ -66449,7 +66500,8 @@ BI.ColorPicker = BI.inherit(BI.Widget, { }), layouts: [{ type: "bi.grid" - }] + }], + value: o.value }); this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () { self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments); @@ -75570,7 +75622,8 @@ BI.LevelTree = BI.inherit(BI.Widget, { chooseType: 0 }, expander: {}, - items: [] + items: [], + value: "" }); }, @@ -75639,6 +75692,7 @@ BI.LevelTree = BI.inherit(BI.Widget, { }, o.expander), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + value: o.value, el: BI.extend({ type: "bi.button_tree", @@ -75730,6 +75784,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { if (BI.isNotEmptyArray(o.items)) { this.populate(); } + if (BI.isNotNull(o.value)) { + this.setValue(o.value); + } }, populate: function (items, keyword) { @@ -75741,7 +75798,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { }); }, - setValue: function (v) { + _digest: function (v) { v || (v = []); var self = this, map = {}; var selected = []; @@ -75769,8 +75826,11 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { } } }); + return BI.makeObject(v.concat(selected)); + }, - this.tree.setValue(BI.makeObject(v.concat(selected))); + setValue: function (v) { + this.tree.setValue(this._digest(v)); }, _getValue: function () { @@ -76150,7 +76210,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { type: "bi.text_trigger", element: this, height: o.height, - text: this._digest(o.text, o.items) + text: this._digest(o.value, o.items) }); }, @@ -84041,7 +84101,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { isDefaultInit: false, height: 30, text: "", - items: [] + items: [], + value: "" }); }, @@ -84053,13 +84114,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.multilayer_select_tree_popup", isDefaultInit: o.isDefaultInit, - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -84110,7 +84173,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { baseCls: "bi-multilayer-select-level-tree", isDefaultInit: false, items: [], - itemsCreator: BI.emptyFn + itemsCreator: BI.emptyFn, + value: "" }); }, @@ -84182,6 +84246,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: o.itemsCreator, + value: o.value, el: { type: "bi.button_tree", @@ -84240,7 +84305,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { tipText: BI.i18nText("BI-No_Selected_Item"), isDefaultInit: false, itemsCreator: BI.emptyFn, - items: [] + items: [], + value: "" }); }, @@ -84253,6 +84319,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, + value: o.value, itemsCreator: o.itemsCreator }); @@ -84581,7 +84648,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { height: 30, text: "", itemsCreator: BI.emptyFn, - items: [] + items: [], + value: "" }); }, @@ -84593,13 +84661,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.multilayer_single_tree_popup", isDefaultInit: o.isDefaultInit, - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -84721,6 +84791,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }, items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + value: o.value, itemsCreator: function (op, callback) { o.itemsCreator(op, function (items) { callback(BI.Tree.transformToTreeFormat(items), 0); @@ -84798,7 +84869,8 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: o.itemsCreator + itemsCreator: o.itemsCreator, + value: o.value }); BI.createWidget({ @@ -92395,7 +92467,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { baseCls: "bi-select-tree-combo", height: 30, text: "", - items: [] + items: [], + value: "" }); }, @@ -92407,12 +92480,14 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.select_level_tree", - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -92534,7 +92609,8 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, { return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-select-level-tree", tipText: BI.i18nText("BI-No_Selected_Item"), - items: [] + items: [], + value: "" }); }, @@ -92583,6 +92659,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, { isDefaultInit: true }, items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)), + value: o.value, chooseType: BI.Selection.Single }); @@ -96501,7 +96578,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { trigger: {}, height: 24, text: "", - items: [] + items: [], + value: "" }); }, @@ -96513,12 +96591,14 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }, o.trigger)); this.popup = BI.createWidget({ type: "bi.single_level_tree", - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -96573,7 +96653,8 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, { return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-single-level-tree", tipText: BI.i18nText("BI-No_Selected_Item"), - items: [] + items: [], + value: "" }); }, @@ -96581,13 +96662,14 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, { BI.SingleTreePopup.superclass._init.apply(this, arguments); var self = this, o = this.options; - + this.tree = BI.createWidget({ type: "bi.level_tree", expander: { isDefaultInit: true }, items: o.items, + value: o.value, chooseType: BI.Selection.Single }); @@ -96636,7 +96718,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { baseCls: "bi-single-tree-trigger", height: 24, text: "", - items: [] + items: [], + value: "" }); }, @@ -96650,7 +96733,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { element: this, text: o.text, items: o.items, - height: o.height + height: o.height, + value: o.value }); }, @@ -96717,7 +96801,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, { this.levelTree = BI.createWidget({ type: "bi.multilayer_single_level_tree", isDefaultInit: true, - items: BI.deepClone(o.items) + items: BI.deepClone(o.items), + value: o.value }); this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); @@ -96726,7 +96811,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, { case BI.SwitchTree.SelectType.MultiSelect: this.tree = BI.createWidget({ type: "bi.simple_tree", - items: this._removeIsParent(BI.deepClone(o.items)) + items: this._removeIsParent(BI.deepClone(o.items)), + value: o.value }); this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () { self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); diff --git a/dist/case.js b/dist/case.js index 3a0a835c0..5a4089d31 100644 --- a/dist/case.js +++ b/dist/case.js @@ -3659,25 +3659,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, { _init: function () { BI.ColorChooser.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(BI.extend({ - type: "bi.color_chooser_trigger", - width: o.width, - height: o.height - }, o.el)); - this.colorPicker = BI.createWidget({ - type: "bi.color_chooser_popup" - }); this.combo = BI.createWidget({ type: "bi.combo", element: this, adjustLength: 1, - el: this.trigger, + el: BI.extend({ + type: "bi.color_chooser_trigger", + ref: function (_ref) { + self.trigger = _ref; + }, + width: o.width, + height: o.height + }, o.el), popup: { - el: this.colorPicker, + el: { + type: "bi.color_chooser_popup", + ref: function (_ref) { + self.colorPicker = _ref; + }, + listeners: [{ + eventName: BI.ColorChooserPopup.EVENT_VALUE_CHANGE, + action: function () { + fn(); + } + }, { + eventName: BI.ColorChooserPopup.EVENT_CHANGE, + action: function () { + fn(); + self.combo.hideView(); + } + }] + }, stopPropagation: false, minWidth: 202 - } + }, + value: o.value }); var fn = function () { @@ -3690,15 +3707,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, { que.unshift(color); BI.Cache.setItem("colors", BI.array2String(que.toArray())); }; - - this.colorPicker.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () { - fn(); - }); - - this.colorPicker.on(BI.ColorChooserPopup.EVENT_CHANGE, function () { - fn(); - self.combo.hideView(); - }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || "")); }); @@ -3725,7 +3733,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, { }, getValue: function () { - return this.colorPicker.getValue(); + return this.combo.getValue(); } }); BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE"; @@ -3750,7 +3758,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { BI.ColorChooserPopup.superclass._init.apply(this, arguments); var self = this, o = this.options; this.colorEditor = BI.createWidget({ - type: "bi.color_picker_editor" + type: "bi.color_picker_editor", + value: o.value }); this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () { @@ -3786,7 +3795,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { disabled: true }]], width: 190, - height: 25 + height: 25, + value: o.value }); this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () { self.setValue(this.getValue()[0]); @@ -3796,7 +3806,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { this.colorPicker = BI.createWidget({ type: "bi.color_picker", width: 190, - height: 50 + height: 50, + value: o.value }); this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () { @@ -4209,7 +4220,8 @@ BI.ColorPicker = BI.inherit(BI.Widget, { }), layouts: [{ type: "bi.grid" - }] + }], + value: o.value }); this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () { self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments); @@ -13330,7 +13342,8 @@ BI.LevelTree = BI.inherit(BI.Widget, { chooseType: 0 }, expander: {}, - items: [] + items: [], + value: "" }); }, @@ -13399,6 +13412,7 @@ BI.LevelTree = BI.inherit(BI.Widget, { }, o.expander), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + value: o.value, el: BI.extend({ type: "bi.button_tree", @@ -13490,6 +13504,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { if (BI.isNotEmptyArray(o.items)) { this.populate(); } + if (BI.isNotNull(o.value)) { + this.setValue(o.value); + } }, populate: function (items, keyword) { @@ -13501,7 +13518,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { }); }, - setValue: function (v) { + _digest: function (v) { v || (v = []); var self = this, map = {}; var selected = []; @@ -13529,8 +13546,11 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { } } }); + return BI.makeObject(v.concat(selected)); + }, - this.tree.setValue(BI.makeObject(v.concat(selected))); + setValue: function (v) { + this.tree.setValue(this._digest(v)); }, _getValue: function () { @@ -13910,7 +13930,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { type: "bi.text_trigger", element: this, height: o.height, - text: this._digest(o.text, o.items) + text: this._digest(o.value, o.items) }); }, diff --git a/dist/demo.js b/dist/demo.js index 116824ddf..76d871499 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -3735,53 +3735,97 @@ BI.shortcut("demo.level_tree", Demo.Func);Demo.Func = BI.inherit(BI.Widget, { // value值一定要是字符串 var tree = BI.createWidget({ type: "bi.simple_tree", - items: [] - }); - - tree.populate([{ - id: 1, - text: "第一项", - value: "1" - }, { - id: 2, - text: "第二项", - value: "2" - }, { - id: 3, - text: "第三项", - value: "3", - open: true - }, { - id: 11, - pId: 1, - text: "子项1", - value: "11" - }, { - id: 12, - pId: 1, - text: "子项2", - value: "12" - }, { - id: 13, - pId: 1, - text: "子项3", - value: "13" - }, { - id: 31, - pId: 3, - text: "子项1", - value: "31" - }, { - id: 32, - pId: 3, - text: "子项2", - value: "32" - }, { - id: 33, - pId: 3, - text: "子项3", - value: "33" - }], "z"); + items: [{ + id: 1, + text: "第一项", + value: "1" + }, { + id: 2, + text: "第二项", + value: "2" + }, { + id: 3, + text: "第三项", + value: "3", + open: true + }, { + id: 11, + pId: 1, + text: "子项1", + value: "11" + }, { + id: 12, + pId: 1, + text: "子项2", + value: "12" + }, { + id: 13, + pId: 1, + text: "子项3", + value: "13" + }, { + id: 31, + pId: 3, + text: "子项1", + value: "31" + }, { + id: 32, + pId: 3, + text: "子项2", + value: "32" + }, { + id: 33, + pId: 3, + text: "子项3", + value: "33" + }], + value: ["31", "32", "33"] + }); + + // tree.populate([{ + // id: 1, + // text: "第一项", + // value: "1" + // }, { + // id: 2, + // text: "第二项", + // value: "2" + // }, { + // id: 3, + // text: "第三项", + // value: "3", + // open: true + // }, { + // id: 11, + // pId: 1, + // text: "子项1", + // value: "11" + // }, { + // id: 12, + // pId: 1, + // text: "子项2", + // value: "12" + // }, { + // id: 13, + // pId: 1, + // text: "子项3", + // value: "13" + // }, { + // id: 31, + // pId: 3, + // text: "子项1", + // value: "31" + // }, { + // id: 32, + // pId: 3, + // text: "子项2", + // value: "32" + // }, { + // id: 33, + // pId: 3, + // text: "子项3", + // value: "33" + // }], "z"); BI.createWidget({ type: "bi.vtape", element: this, @@ -13177,7 +13221,8 @@ Demo.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }, text: "默认值", items: items, - width: 300 + width: 300, + value: ["第五级文件1"] }, { type: "bi.button", text: "getVlaue", @@ -13216,6 +13261,7 @@ Demo.SelectTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, + value: "11", text: "默认值", items: items, width: 300 @@ -13230,7 +13276,7 @@ Demo.SelectTreeCombo = BI.inherit(BI.Widget, { type: "bi.button", text: "setVlaue (第二级文件1)", handler: function () { - self.tree.setValue(["第二级文件1"]); + self.tree.setValue(["2"]); }, width: 300 }], @@ -13395,7 +13441,8 @@ Demo.SingleTreeCombo = BI.inherit(BI.Widget, { }, text: "默认值", items: items, - width: 300 + width: 300, + value: "11" }, { type: "bi.button", text: "getVlaue", @@ -13407,7 +13454,7 @@ Demo.SingleTreeCombo = BI.inherit(BI.Widget, { type: "bi.button", text: "setVlaue (第二级文件1)", handler: function () { - self.tree.setValue(["第二级文件1"]); + self.tree.setValue(["2"]); }, width: 300 }], @@ -14347,7 +14394,8 @@ Demo.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { var self = this; var tree = BI.createWidget({ type: "bi.multilayer_select_level_tree", - items: BI.deepClone(Demo.CONSTANTS.TREE) + items: BI.deepClone(Demo.CONSTANTS.TREE), + value: "第五级文件1" }); return { @@ -14392,7 +14440,8 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { var self = this; var tree = BI.createWidget({ type: "bi.multilayer_single_level_tree", - items: BI.deepClone(Demo.CONSTANTS.TREE) + items: BI.deepClone(Demo.CONSTANTS.TREE), + value: "第五级文件1" }); return { @@ -14437,7 +14486,8 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, { var self = this; var tree = BI.createWidget({ type: "bi.select_level_tree", - items: BI.deepClone(Demo.CONSTANTS.LEVELTREE) + items: BI.deepClone(Demo.CONSTANTS.LEVELTREE), + value: "11" }); return { @@ -14460,7 +14510,7 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, { height: 25, text: "setValue (第二级文件1)", handler: function () { - tree.setValue(["第二级文件1"]); + tree.setValue(["2"]); } }, height: 25 @@ -14482,7 +14532,8 @@ Demo.SingleLevelTree = BI.inherit(BI.Widget, { var self = this; var tree = BI.createWidget({ type: "bi.single_level_tree", - items: BI.deepClone(Demo.CONSTANTS.LEVELTREE) + items: BI.deepClone(Demo.CONSTANTS.LEVELTREE), + value: "11" }); return { @@ -14505,7 +14556,7 @@ Demo.SingleLevelTree = BI.inherit(BI.Widget, { height: 25, text: "setValue (第二级文件1)", handler: function () { - tree.setValue(["第二级文件1"]); + tree.setValue(["2"]); } }, height: 25 @@ -14527,7 +14578,8 @@ Demo.SwitchTree = BI.inherit(BI.Widget, { var self = this; var tree = BI.createWidget({ type: "bi.switch_tree", - items: BI.deepClone(Demo.CONSTANTS.TREE) + items: BI.deepClone(Demo.CONSTANTS.TREE), + value: "第五级文件1" }); return { diff --git a/dist/fineui.js b/dist/fineui.js index df9584968..ecfdc0785 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -29530,11 +29530,15 @@ BI.TreeView = BI.inherit(BI.Pane, { }); } + if (!this.nodes) { + return; + } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); }); - this.nodes && this.nodes.checkAllNodes(checked); + this.nodes.checkAllNodes(checked); }, expandAll: function (flag) { @@ -30696,14 +30700,17 @@ BI.Combo = BI.inherit(BI.Widget, { }, _initCombo: function () { - this.combo = BI.createWidget(this.options.el); + this.combo = BI.createWidget(this.options.el, { + value: this.options.value + }); }, _assertPopupView: function () { - var self = this; + var self = this, o = this.options; if (this.popupView == null) { this.popupView = BI.createWidget(this.options.popup, { - type: "bi.popup_view" + type: "bi.popup_view", + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { if (type === BI.Events.CLICK) { @@ -30894,14 +30901,20 @@ BI.Combo = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); this.combo.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - this._assertPopupView(); - return this.popupView && this.popupView.getValue(); + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, isViewVisible: function () { @@ -31080,11 +31093,13 @@ BI.Expander = BI.inherit(BI.Widget, { }, _initExpander: function () { - this.expander = BI.createWidget(this.options.el); + this.expander = BI.createWidget(this.options.el, { + value: this.options.value + }); }, _assertPopupView: function () { - var self = this; + var self = this, o = this.options; if (this.popupView == null) { this.popupView = BI.createWidget(this.options.popup, { type: "bi.button_group", @@ -31093,7 +31108,8 @@ BI.Expander = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -31157,14 +31173,20 @@ BI.Expander = BI.inherit(BI.Widget, { }, setValue: function (v) { - // this._assertPopupView(); this.expander.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - // this._assertPopupView(); - return this.popupView ? this.popupView.getValue() : []; + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, isViewVisible: function () { @@ -32056,8 +32078,11 @@ BI.Searcher = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getKeyword: function () { @@ -32078,6 +32103,9 @@ BI.Searcher = BI.inherit(BI.Widget, { } else if (o.adapter && o.adapter.getValue) { return o.adapter.getValue(); } + if (BI.isNull(this.popupView)) { + return o.popup.value; + } return this.popupView.getValue(); }, @@ -32232,7 +32260,9 @@ BI.Switcher = BI.inherit(BI.Widget, { }, _initSwitcher: function () { - this.switcher = BI.createWidget(this.options.el); + this.switcher = BI.createWidget(this.options.el, { + value: o.value + }); }, _assertPopupView: function () { @@ -32246,7 +32276,8 @@ BI.Switcher = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -32306,14 +32337,20 @@ BI.Switcher = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); this.switcher.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - this._assertPopupView(); - return this.popupView ? this.popupView.getValue() : []; + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, setAdapter: function (adapter) { @@ -42944,7 +42981,7 @@ BI.PopupView = BI.inherit(BI.Widget, { _createView: function () { var o = this.options; - this.button_group = BI.createWidget(o.el, {type: "bi.button_group"}); + this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}); this.button_group.element.css({"min-height": o.minHeight + "px"}); return this.button_group; }, @@ -43076,7 +43113,8 @@ BI.SearcherView = BI.inherit(BI.Pane, { }, layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -43104,7 +43142,8 @@ BI.SearcherView = BI.inherit(BI.Pane, { }, layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -61538,7 +61577,8 @@ BI.CustomTree = BI.inherit(BI.Widget, { args[0] = self._formatItems(items); callback.apply(null, args); }]); - } + }, + value: o.value }); this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -67593,25 +67633,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, { _init: function () { BI.ColorChooser.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(BI.extend({ - type: "bi.color_chooser_trigger", - width: o.width, - height: o.height - }, o.el)); - this.colorPicker = BI.createWidget({ - type: "bi.color_chooser_popup" - }); this.combo = BI.createWidget({ type: "bi.combo", element: this, adjustLength: 1, - el: this.trigger, + el: BI.extend({ + type: "bi.color_chooser_trigger", + ref: function (_ref) { + self.trigger = _ref; + }, + width: o.width, + height: o.height + }, o.el), popup: { - el: this.colorPicker, + el: { + type: "bi.color_chooser_popup", + ref: function (_ref) { + self.colorPicker = _ref; + }, + listeners: [{ + eventName: BI.ColorChooserPopup.EVENT_VALUE_CHANGE, + action: function () { + fn(); + } + }, { + eventName: BI.ColorChooserPopup.EVENT_CHANGE, + action: function () { + fn(); + self.combo.hideView(); + } + }] + }, stopPropagation: false, minWidth: 202 - } + }, + value: o.value }); var fn = function () { @@ -67624,15 +67681,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, { que.unshift(color); BI.Cache.setItem("colors", BI.array2String(que.toArray())); }; - - this.colorPicker.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () { - fn(); - }); - - this.colorPicker.on(BI.ColorChooserPopup.EVENT_CHANGE, function () { - fn(); - self.combo.hideView(); - }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || "")); }); @@ -67659,7 +67707,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, { }, getValue: function () { - return this.colorPicker.getValue(); + return this.combo.getValue(); } }); BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE"; @@ -67684,7 +67732,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { BI.ColorChooserPopup.superclass._init.apply(this, arguments); var self = this, o = this.options; this.colorEditor = BI.createWidget({ - type: "bi.color_picker_editor" + type: "bi.color_picker_editor", + value: o.value }); this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () { @@ -67720,7 +67769,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { disabled: true }]], width: 190, - height: 25 + height: 25, + value: o.value }); this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () { self.setValue(this.getValue()[0]); @@ -67730,7 +67780,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { this.colorPicker = BI.createWidget({ type: "bi.color_picker", width: 190, - height: 50 + height: 50, + value: o.value }); this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () { @@ -68143,7 +68194,8 @@ BI.ColorPicker = BI.inherit(BI.Widget, { }), layouts: [{ type: "bi.grid" - }] + }], + value: o.value }); this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () { self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments); @@ -77264,7 +77316,8 @@ BI.LevelTree = BI.inherit(BI.Widget, { chooseType: 0 }, expander: {}, - items: [] + items: [], + value: "" }); }, @@ -77333,6 +77386,7 @@ BI.LevelTree = BI.inherit(BI.Widget, { }, o.expander), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + value: o.value, el: BI.extend({ type: "bi.button_tree", @@ -77424,6 +77478,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { if (BI.isNotEmptyArray(o.items)) { this.populate(); } + if (BI.isNotNull(o.value)) { + this.setValue(o.value); + } }, populate: function (items, keyword) { @@ -77435,7 +77492,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { }); }, - setValue: function (v) { + _digest: function (v) { v || (v = []); var self = this, map = {}; var selected = []; @@ -77463,8 +77520,11 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { } } }); + return BI.makeObject(v.concat(selected)); + }, - this.tree.setValue(BI.makeObject(v.concat(selected))); + setValue: function (v) { + this.tree.setValue(this._digest(v)); }, _getValue: function () { @@ -77844,7 +77904,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { type: "bi.text_trigger", element: this, height: o.height, - text: this._digest(o.text, o.items) + text: this._digest(o.value, o.items) }); }, @@ -85735,7 +85795,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { isDefaultInit: false, height: 30, text: "", - items: [] + items: [], + value: "" }); }, @@ -85747,13 +85808,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.multilayer_select_tree_popup", isDefaultInit: o.isDefaultInit, - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -85804,7 +85867,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { baseCls: "bi-multilayer-select-level-tree", isDefaultInit: false, items: [], - itemsCreator: BI.emptyFn + itemsCreator: BI.emptyFn, + value: "" }); }, @@ -85876,6 +85940,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: o.itemsCreator, + value: o.value, el: { type: "bi.button_tree", @@ -85934,7 +85999,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { tipText: BI.i18nText("BI-No_Selected_Item"), isDefaultInit: false, itemsCreator: BI.emptyFn, - items: [] + items: [], + value: "" }); }, @@ -85947,6 +86013,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, + value: o.value, itemsCreator: o.itemsCreator }); @@ -86275,7 +86342,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { height: 30, text: "", itemsCreator: BI.emptyFn, - items: [] + items: [], + value: "" }); }, @@ -86287,13 +86355,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.multilayer_single_tree_popup", isDefaultInit: o.isDefaultInit, - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -86415,6 +86485,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }, items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + value: o.value, itemsCreator: function (op, callback) { o.itemsCreator(op, function (items) { callback(BI.Tree.transformToTreeFormat(items), 0); @@ -86492,7 +86563,8 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: o.itemsCreator + itemsCreator: o.itemsCreator, + value: o.value }); BI.createWidget({ @@ -94089,7 +94161,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { baseCls: "bi-select-tree-combo", height: 30, text: "", - items: [] + items: [], + value: "" }); }, @@ -94101,12 +94174,14 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.select_level_tree", - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -94228,7 +94303,8 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, { return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-select-level-tree", tipText: BI.i18nText("BI-No_Selected_Item"), - items: [] + items: [], + value: "" }); }, @@ -94277,6 +94353,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, { isDefaultInit: true }, items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)), + value: o.value, chooseType: BI.Selection.Single }); @@ -98195,7 +98272,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { trigger: {}, height: 24, text: "", - items: [] + items: [], + value: "" }); }, @@ -98207,12 +98285,14 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }, o.trigger)); this.popup = BI.createWidget({ type: "bi.single_level_tree", - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -98267,7 +98347,8 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, { return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-single-level-tree", tipText: BI.i18nText("BI-No_Selected_Item"), - items: [] + items: [], + value: "" }); }, @@ -98275,13 +98356,14 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, { BI.SingleTreePopup.superclass._init.apply(this, arguments); var self = this, o = this.options; - + this.tree = BI.createWidget({ type: "bi.level_tree", expander: { isDefaultInit: true }, items: o.items, + value: o.value, chooseType: BI.Selection.Single }); @@ -98330,7 +98412,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { baseCls: "bi-single-tree-trigger", height: 24, text: "", - items: [] + items: [], + value: "" }); }, @@ -98344,7 +98427,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { element: this, text: o.text, items: o.items, - height: o.height + height: o.height, + value: o.value }); }, @@ -98411,7 +98495,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, { this.levelTree = BI.createWidget({ type: "bi.multilayer_single_level_tree", isDefaultInit: true, - items: BI.deepClone(o.items) + items: BI.deepClone(o.items), + value: o.value }); this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); @@ -98420,7 +98505,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, { case BI.SwitchTree.SelectType.MultiSelect: this.tree = BI.createWidget({ type: "bi.simple_tree", - items: this._removeIsParent(BI.deepClone(o.items)) + items: this._removeIsParent(BI.deepClone(o.items)), + value: o.value }); this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () { self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); diff --git a/dist/widget.js b/dist/widget.js index 5a690135c..48d3ed630 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -7742,7 +7742,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { isDefaultInit: false, height: 30, text: "", - items: [] + items: [], + value: "" }); }, @@ -7754,13 +7755,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.multilayer_select_tree_popup", isDefaultInit: o.isDefaultInit, - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -7811,7 +7814,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { baseCls: "bi-multilayer-select-level-tree", isDefaultInit: false, items: [], - itemsCreator: BI.emptyFn + itemsCreator: BI.emptyFn, + value: "" }); }, @@ -7883,6 +7887,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: o.itemsCreator, + value: o.value, el: { type: "bi.button_tree", @@ -7941,7 +7946,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { tipText: BI.i18nText("BI-No_Selected_Item"), isDefaultInit: false, itemsCreator: BI.emptyFn, - items: [] + items: [], + value: "" }); }, @@ -7954,6 +7960,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, + value: o.value, itemsCreator: o.itemsCreator }); @@ -8282,7 +8289,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { height: 30, text: "", itemsCreator: BI.emptyFn, - items: [] + items: [], + value: "" }); }, @@ -8294,13 +8302,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.multilayer_single_tree_popup", isDefaultInit: o.isDefaultInit, - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -8422,6 +8432,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }, items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + value: o.value, itemsCreator: function (op, callback) { o.itemsCreator(op, function (items) { callback(BI.Tree.transformToTreeFormat(items), 0); @@ -8499,7 +8510,8 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: o.itemsCreator + itemsCreator: o.itemsCreator, + value: o.value }); BI.createWidget({ @@ -16096,7 +16108,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { baseCls: "bi-select-tree-combo", height: 30, text: "", - items: [] + items: [], + value: "" }); }, @@ -16108,12 +16121,14 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.select_level_tree", - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -16235,7 +16250,8 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, { return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-select-level-tree", tipText: BI.i18nText("BI-No_Selected_Item"), - items: [] + items: [], + value: "" }); }, @@ -16284,6 +16300,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, { isDefaultInit: true }, items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)), + value: o.value, chooseType: BI.Selection.Single }); @@ -20202,7 +20219,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { trigger: {}, height: 24, text: "", - items: [] + items: [], + value: "" }); }, @@ -20214,12 +20232,14 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }, o.trigger)); this.popup = BI.createWidget({ type: "bi.single_level_tree", - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ @@ -20274,7 +20294,8 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, { return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-single-level-tree", tipText: BI.i18nText("BI-No_Selected_Item"), - items: [] + items: [], + value: "" }); }, @@ -20282,13 +20303,14 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, { BI.SingleTreePopup.superclass._init.apply(this, arguments); var self = this, o = this.options; - + this.tree = BI.createWidget({ type: "bi.level_tree", expander: { isDefaultInit: true }, items: o.items, + value: o.value, chooseType: BI.Selection.Single }); @@ -20337,7 +20359,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { baseCls: "bi-single-tree-trigger", height: 24, text: "", - items: [] + items: [], + value: "" }); }, @@ -20351,7 +20374,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { element: this, text: o.text, items: o.items, - height: o.height + height: o.height, + value: o.value }); }, @@ -20418,7 +20442,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, { this.levelTree = BI.createWidget({ type: "bi.multilayer_single_level_tree", isDefaultInit: true, - items: BI.deepClone(o.items) + items: BI.deepClone(o.items), + value: o.value }); this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); @@ -20427,7 +20452,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, { case BI.SwitchTree.SelectType.MultiSelect: this.tree = BI.createWidget({ type: "bi.simple_tree", - items: this._removeIsParent(BI.deepClone(o.items)) + items: this._removeIsParent(BI.deepClone(o.items)), + value: o.value }); this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () { self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 6f98e55bf..e6ac9d0a3 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -209,14 +209,17 @@ BI.Combo = BI.inherit(BI.Widget, { }, _initCombo: function () { - this.combo = BI.createWidget(this.options.el); + this.combo = BI.createWidget(this.options.el, { + value: this.options.value + }); }, _assertPopupView: function () { - var self = this; + var self = this, o = this.options; if (this.popupView == null) { this.popupView = BI.createWidget(this.options.popup, { - type: "bi.popup_view" + type: "bi.popup_view", + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { if (type === BI.Events.CLICK) { @@ -407,14 +410,20 @@ BI.Combo = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); this.combo.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - this._assertPopupView(); - return this.popupView && this.popupView.getValue(); + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, isViewVisible: function () { diff --git a/src/base/combination/expander.js b/src/base/combination/expander.js index eb824b3af..e9d91cc8a 100644 --- a/src/base/combination/expander.js +++ b/src/base/combination/expander.js @@ -126,11 +126,13 @@ BI.Expander = BI.inherit(BI.Widget, { }, _initExpander: function () { - this.expander = BI.createWidget(this.options.el); + this.expander = BI.createWidget(this.options.el, { + value: this.options.value + }); }, _assertPopupView: function () { - var self = this; + var self = this, o = this.options; if (this.popupView == null) { this.popupView = BI.createWidget(this.options.popup, { type: "bi.button_group", @@ -139,7 +141,8 @@ BI.Expander = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -203,14 +206,20 @@ BI.Expander = BI.inherit(BI.Widget, { }, setValue: function (v) { - // this._assertPopupView(); this.expander.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - // this._assertPopupView(); - return this.popupView ? this.popupView.getValue() : []; + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, isViewVisible: function () { diff --git a/src/base/combination/searcher.js b/src/base/combination/searcher.js index 1cf4f66b5..e14c4409d 100644 --- a/src/base/combination/searcher.js +++ b/src/base/combination/searcher.js @@ -247,8 +247,11 @@ BI.Searcher = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getKeyword: function () { @@ -269,6 +272,9 @@ BI.Searcher = BI.inherit(BI.Widget, { } else if (o.adapter && o.adapter.getValue) { return o.adapter.getValue(); } + if (BI.isNull(this.popupView)) { + return o.popup.value; + } return this.popupView.getValue(); }, diff --git a/src/base/combination/switcher.js b/src/base/combination/switcher.js index d199430c7..9cb23243f 100644 --- a/src/base/combination/switcher.js +++ b/src/base/combination/switcher.js @@ -123,7 +123,9 @@ BI.Switcher = BI.inherit(BI.Widget, { }, _initSwitcher: function () { - this.switcher = BI.createWidget(this.options.el); + this.switcher = BI.createWidget(this.options.el, { + value: o.value + }); }, _assertPopupView: function () { @@ -137,7 +139,8 @@ BI.Switcher = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -197,14 +200,20 @@ BI.Switcher = BI.inherit(BI.Widget, { }, setValue: function (v) { - this._assertPopupView(); this.switcher.setValue(v); - this.popupView && this.popupView.setValue(v); + if (BI.isNull(this.popupView)) { + this.options.popup.value = v; + } else { + this.popupView.setValue(v); + } }, getValue: function () { - this._assertPopupView(); - return this.popupView ? this.popupView.getValue() : []; + if (BI.isNull(this.popupView)) { + return this.options.popup.value; + } else { + return this.popupView.getValue(); + } }, setAdapter: function (adapter) { diff --git a/src/base/layer/layer.popup.js b/src/base/layer/layer.popup.js index 9a3722d31..f84b378b1 100644 --- a/src/base/layer/layer.popup.js +++ b/src/base/layer/layer.popup.js @@ -93,7 +93,7 @@ BI.PopupView = BI.inherit(BI.Widget, { _createView: function () { var o = this.options; - this.button_group = BI.createWidget(o.el, {type: "bi.button_group"}); + this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}); this.button_group.element.css({"min-height": o.minHeight + "px"}); return this.button_group; }, diff --git a/src/base/layer/layer.searcher.js b/src/base/layer/layer.searcher.js index 9e6073e39..88e01fd4f 100644 --- a/src/base/layer/layer.searcher.js +++ b/src/base/layer/layer.searcher.js @@ -55,7 +55,8 @@ BI.SearcherView = BI.inherit(BI.Pane, { }, layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -83,7 +84,8 @@ BI.SearcherView = BI.inherit(BI.Pane, { }, layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); diff --git a/src/base/tree/customtree.js b/src/base/tree/customtree.js index 4698b7d18..fb9eb1346 100644 --- a/src/base/tree/customtree.js +++ b/src/base/tree/customtree.js @@ -90,7 +90,8 @@ BI.CustomTree = BI.inherit(BI.Widget, { args[0] = self._formatItems(items); callback.apply(null, args); }]); - } + }, + value: o.value }); this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); diff --git a/src/base/tree/treeview.js b/src/base/tree/treeview.js index ece8ef0bc..9a7dbe5bd 100644 --- a/src/base/tree/treeview.js +++ b/src/base/tree/treeview.js @@ -442,11 +442,15 @@ BI.TreeView = BI.inherit(BI.Pane, { }); } + if (!this.nodes) { + return; + } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); }); - this.nodes && this.nodes.checkAllNodes(checked); + this.nodes.checkAllNodes(checked); }, expandAll: function (flag) { diff --git a/src/case/colorchooser/colorchooser.js b/src/case/colorchooser/colorchooser.js index 6025e2631..ed1cfcae8 100644 --- a/src/case/colorchooser/colorchooser.js +++ b/src/case/colorchooser/colorchooser.js @@ -17,25 +17,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, { _init: function () { BI.ColorChooser.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(BI.extend({ - type: "bi.color_chooser_trigger", - width: o.width, - height: o.height - }, o.el)); - this.colorPicker = BI.createWidget({ - type: "bi.color_chooser_popup" - }); this.combo = BI.createWidget({ type: "bi.combo", element: this, adjustLength: 1, - el: this.trigger, + el: BI.extend({ + type: "bi.color_chooser_trigger", + ref: function (_ref) { + self.trigger = _ref; + }, + width: o.width, + height: o.height + }, o.el), popup: { - el: this.colorPicker, + el: { + type: "bi.color_chooser_popup", + ref: function (_ref) { + self.colorPicker = _ref; + }, + listeners: [{ + eventName: BI.ColorChooserPopup.EVENT_VALUE_CHANGE, + action: function () { + fn(); + } + }, { + eventName: BI.ColorChooserPopup.EVENT_CHANGE, + action: function () { + fn(); + self.combo.hideView(); + } + }] + }, stopPropagation: false, minWidth: 202 - } + }, + value: o.value }); var fn = function () { @@ -48,15 +65,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, { que.unshift(color); BI.Cache.setItem("colors", BI.array2String(que.toArray())); }; - - this.colorPicker.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () { - fn(); - }); - - this.colorPicker.on(BI.ColorChooserPopup.EVENT_CHANGE, function () { - fn(); - self.combo.hideView(); - }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || "")); }); @@ -83,7 +91,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, { }, getValue: function () { - return this.colorPicker.getValue(); + return this.combo.getValue(); } }); BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE"; diff --git a/src/case/colorchooser/colorchooser.popup.js b/src/case/colorchooser/colorchooser.popup.js index 773e554cc..fbd413b60 100644 --- a/src/case/colorchooser/colorchooser.popup.js +++ b/src/case/colorchooser/colorchooser.popup.js @@ -19,7 +19,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { BI.ColorChooserPopup.superclass._init.apply(this, arguments); var self = this, o = this.options; this.colorEditor = BI.createWidget({ - type: "bi.color_picker_editor" + type: "bi.color_picker_editor", + value: o.value }); this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () { @@ -55,7 +56,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { disabled: true }]], width: 190, - height: 25 + height: 25, + value: o.value }); this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () { self.setValue(this.getValue()[0]); @@ -65,7 +67,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { this.colorPicker = BI.createWidget({ type: "bi.color_picker", width: 190, - height: 50 + height: 50, + value: o.value }); this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () { diff --git a/src/case/colorchooser/colorpicker/colorpicker.js b/src/case/colorchooser/colorpicker/colorpicker.js index 44c7592c1..a35b88dd0 100644 --- a/src/case/colorchooser/colorpicker/colorpicker.js +++ b/src/case/colorchooser/colorpicker/colorpicker.js @@ -161,7 +161,8 @@ BI.ColorPicker = BI.inherit(BI.Widget, { }), layouts: [{ type: "bi.grid" - }] + }], + value: o.value }); this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () { self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments); diff --git a/src/case/tree/tree.level.js b/src/case/tree/tree.level.js index 017c02d46..0c30351f4 100644 --- a/src/case/tree/tree.level.js +++ b/src/case/tree/tree.level.js @@ -12,7 +12,8 @@ BI.LevelTree = BI.inherit(BI.Widget, { chooseType: 0 }, expander: {}, - items: [] + items: [], + value: "" }); }, @@ -81,6 +82,7 @@ BI.LevelTree = BI.inherit(BI.Widget, { }, o.expander), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + value: o.value, el: BI.extend({ type: "bi.button_tree", diff --git a/src/case/tree/tree.simple.js b/src/case/tree/tree.simple.js index 0bf1346fe..690a445a7 100644 --- a/src/case/tree/tree.simple.js +++ b/src/case/tree/tree.simple.js @@ -40,6 +40,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { if (BI.isNotEmptyArray(o.items)) { this.populate(); } + if (BI.isNotNull(o.value)) { + this.setValue(o.value); + } }, populate: function (items, keyword) { @@ -51,7 +54,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { }); }, - setValue: function (v) { + _digest: function (v) { v || (v = []); var self = this, map = {}; var selected = []; @@ -79,8 +82,11 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, { } } }); + return BI.makeObject(v.concat(selected)); + }, - this.tree.setValue(BI.makeObject(v.concat(selected))); + setValue: function (v) { + this.tree.setValue(this._digest(v)); }, _getValue: function () { diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js index 44ca9f837..206fbbb48 100644 --- a/src/case/trigger/trigger.text.select.js +++ b/src/case/trigger/trigger.text.select.js @@ -22,7 +22,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { type: "bi.text_trigger", element: this, height: o.height, - text: this._digest(o.text, o.items) + text: this._digest(o.value, o.items) }); }, diff --git a/src/widget/multilayerselecttree/multilayerselecttree.combo.js b/src/widget/multilayerselecttree/multilayerselecttree.combo.js index 9cc8ed908..91950867c 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.combo.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.combo.js @@ -10,7 +10,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { isDefaultInit: false, height: 30, text: "", - items: [] + items: [], + value: "" }); }, @@ -22,13 +23,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.multilayer_select_tree_popup", isDefaultInit: o.isDefaultInit, - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ diff --git a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js index 4c15b4959..ca1f3d46a 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js @@ -10,7 +10,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { baseCls: "bi-multilayer-select-level-tree", isDefaultInit: false, items: [], - itemsCreator: BI.emptyFn + itemsCreator: BI.emptyFn, + value: "" }); }, @@ -82,6 +83,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: o.itemsCreator, + value: o.value, el: { type: "bi.button_tree", diff --git a/src/widget/multilayerselecttree/multilayerselecttree.popup.js b/src/widget/multilayerselecttree/multilayerselecttree.popup.js index c70f783bb..1b92e3c09 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.popup.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.popup.js @@ -13,7 +13,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { tipText: BI.i18nText("BI-No_Selected_Item"), isDefaultInit: false, itemsCreator: BI.emptyFn, - items: [] + items: [], + value: "" }); }, @@ -26,6 +27,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, + value: o.value, itemsCreator: o.itemsCreator }); diff --git a/src/widget/multilayersingletree/multilayersingletree.combo.js b/src/widget/multilayersingletree/multilayersingletree.combo.js index 3763ea9a7..c0b2c032d 100644 --- a/src/widget/multilayersingletree/multilayersingletree.combo.js +++ b/src/widget/multilayersingletree/multilayersingletree.combo.js @@ -14,7 +14,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { height: 30, text: "", itemsCreator: BI.emptyFn, - items: [] + items: [], + value: "" }); }, @@ -26,13 +27,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.multilayer_single_tree_popup", isDefaultInit: o.isDefaultInit, - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ diff --git a/src/widget/multilayersingletree/multilayersingletree.leveltree.js b/src/widget/multilayersingletree/multilayersingletree.leveltree.js index 34be01704..d7548c6d7 100644 --- a/src/widget/multilayersingletree/multilayersingletree.leveltree.js +++ b/src/widget/multilayersingletree/multilayersingletree.leveltree.js @@ -80,6 +80,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }, items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + value: o.value, itemsCreator: function (op, callback) { o.itemsCreator(op, function (items) { callback(BI.Tree.transformToTreeFormat(items), 0); diff --git a/src/widget/multilayersingletree/multilayersingletree.popup.js b/src/widget/multilayersingletree/multilayersingletree.popup.js index 9c09aed39..098c47f39 100644 --- a/src/widget/multilayersingletree/multilayersingletree.popup.js +++ b/src/widget/multilayersingletree/multilayersingletree.popup.js @@ -26,7 +26,8 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: o.itemsCreator + itemsCreator: o.itemsCreator, + value: o.value }); BI.createWidget({ diff --git a/src/widget/selecttree/selecttree.combo.js b/src/widget/selecttree/selecttree.combo.js index 77e7e1dc7..9d8e79449 100644 --- a/src/widget/selecttree/selecttree.combo.js +++ b/src/widget/selecttree/selecttree.combo.js @@ -9,7 +9,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { baseCls: "bi-select-tree-combo", height: 30, text: "", - items: [] + items: [], + value: "" }); }, @@ -21,12 +22,14 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }); this.popup = BI.createWidget({ type: "bi.select_level_tree", - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ diff --git a/src/widget/selecttree/selecttree.popup.js b/src/widget/selecttree/selecttree.popup.js index 63170e5cf..75e6daed0 100644 --- a/src/widget/selecttree/selecttree.popup.js +++ b/src/widget/selecttree/selecttree.popup.js @@ -9,7 +9,8 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, { return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-select-level-tree", tipText: BI.i18nText("BI-No_Selected_Item"), - items: [] + items: [], + value: "" }); }, @@ -58,6 +59,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, { isDefaultInit: true }, items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)), + value: o.value, chooseType: BI.Selection.Single }); diff --git a/src/widget/singletree/singletree.combo.js b/src/widget/singletree/singletree.combo.js index afe83ed61..978586ac8 100644 --- a/src/widget/singletree/singletree.combo.js +++ b/src/widget/singletree/singletree.combo.js @@ -10,7 +10,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { trigger: {}, height: 24, text: "", - items: [] + items: [], + value: "" }); }, @@ -22,12 +23,14 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { type: "bi.single_tree_trigger", text: o.text, height: o.height, - items: o.items + items: o.items, + value: o.value }, o.trigger)); this.popup = BI.createWidget({ type: "bi.single_level_tree", - items: o.items + items: o.items, + value: o.value }); this.combo = BI.createWidget({ diff --git a/src/widget/singletree/singletree.popup.js b/src/widget/singletree/singletree.popup.js index acc4c49b7..8adfa9598 100644 --- a/src/widget/singletree/singletree.popup.js +++ b/src/widget/singletree/singletree.popup.js @@ -9,7 +9,8 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, { return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-single-level-tree", tipText: BI.i18nText("BI-No_Selected_Item"), - items: [] + items: [], + value: "" }); }, @@ -17,13 +18,14 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, { BI.SingleTreePopup.superclass._init.apply(this, arguments); var self = this, o = this.options; - + this.tree = BI.createWidget({ type: "bi.level_tree", expander: { isDefaultInit: true }, items: o.items, + value: o.value, chooseType: BI.Selection.Single }); diff --git a/src/widget/singletree/singletree.trigger.js b/src/widget/singletree/singletree.trigger.js index 33af21c90..82bb443a9 100644 --- a/src/widget/singletree/singletree.trigger.js +++ b/src/widget/singletree/singletree.trigger.js @@ -10,7 +10,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { baseCls: "bi-single-tree-trigger", height: 24, text: "", - items: [] + items: [], + value: "" }); }, @@ -24,7 +25,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { element: this, text: o.text, items: o.items, - height: o.height + height: o.height, + value: o.value }); }, diff --git a/src/widget/switchtree/switchtree.js b/src/widget/switchtree/switchtree.js index 6e74ee0ff..f27ccd128 100644 --- a/src/widget/switchtree/switchtree.js +++ b/src/widget/switchtree/switchtree.js @@ -33,7 +33,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, { this.levelTree = BI.createWidget({ type: "bi.multilayer_single_level_tree", isDefaultInit: true, - items: BI.deepClone(o.items) + items: BI.deepClone(o.items), + value: o.value }); this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); @@ -42,7 +43,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, { case BI.SwitchTree.SelectType.MultiSelect: this.tree = BI.createWidget({ type: "bi.simple_tree", - items: this._removeIsParent(BI.deepClone(o.items)) + items: this._removeIsParent(BI.deepClone(o.items)), + value: o.value }); this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () { self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);