Browse Source

Merge pull request #228 in FUI/fineui from ~GUY/fineui:master to master

* commit 'b4e1ac8e0721c6fd9b88b280d092ef783628d094':
  表格populate时empty除resize相关元素外的所有子元素
  tree加value状态
es6
guy 7 years ago
parent
commit
b5b3d00f7d
  1. 54
      demo/js/case/tree/demo.simple_tree.js
  2. 3
      demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js
  3. 3
      demo/js/widget/selecttree/demo.select_tree_combo.js
  4. 5
      demo/js/widget/singletree/demo.single_tree_combo.js
  5. 23
      demo/js/widget/table/demo.responsive_table.js
  6. 3
      demo/js/widget/tree/demo.multilayer_select_level_tree.js
  7. 3
      demo/js/widget/tree/demo.multilayer_single_level_tree.js
  8. 5
      demo/js/widget/tree/demo.select_level_tree.js
  9. 5
      demo/js/widget/tree/demo.single_level_tree.js
  10. 3
      demo/js/widget/tree/demo.switchtree.js
  11. 104
      dist/base.js
  12. 250
      dist/bundle.js
  13. 78
      dist/case.js
  14. 107
      dist/demo.js
  15. 240
      dist/fineui.js
  16. 68
      dist/widget.js
  17. 23
      src/base/combination/combo.js
  18. 23
      src/base/combination/expander.js
  19. 10
      src/base/combination/searcher.js
  20. 21
      src/base/combination/switcher.js
  21. 2
      src/base/layer/layer.popup.js
  22. 6
      src/base/layer/layer.searcher.js
  23. 10
      src/base/table/table.js
  24. 3
      src/base/tree/customtree.js
  25. 6
      src/base/tree/treeview.js
  26. 50
      src/case/colorchooser/colorchooser.js
  27. 9
      src/case/colorchooser/colorchooser.popup.js
  28. 3
      src/case/colorchooser/colorpicker/colorpicker.js
  29. 4
      src/case/tree/tree.level.js
  30. 10
      src/case/tree/tree.simple.js
  31. 2
      src/case/trigger/trigger.text.select.js
  32. 9
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  33. 4
      src/widget/multilayerselecttree/multilayerselecttree.leveltree.js
  34. 4
      src/widget/multilayerselecttree/multilayerselecttree.popup.js
  35. 9
      src/widget/multilayersingletree/multilayersingletree.combo.js
  36. 1
      src/widget/multilayersingletree/multilayersingletree.leveltree.js
  37. 3
      src/widget/multilayersingletree/multilayersingletree.popup.js
  38. 9
      src/widget/selecttree/selecttree.combo.js
  39. 4
      src/widget/selecttree/selecttree.popup.js
  40. 9
      src/widget/singletree/singletree.combo.js
  41. 4
      src/widget/singletree/singletree.popup.js
  42. 6
      src/widget/singletree/singletree.trigger.js
  43. 6
      src/widget/switchtree/switchtree.js

54
demo/js/case/tree/demo.simple_tree.js

@ -7,10 +7,7 @@ Demo.Func = BI.inherit(BI.Widget, {
// value值一定要是字符串 // value值一定要是字符串
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.simple_tree", type: "bi.simple_tree",
items: [] items: [{
});
tree.populate([{
id: 1, id: 1,
text: "第一项", text: "第一项",
value: "1" value: "1"
@ -53,7 +50,54 @@ Demo.Func = BI.inherit(BI.Widget, {
pId: 3, pId: 3,
text: "子项3", text: "子项3",
value: "33" value: "33"
}], "z"); }],
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({ BI.createWidget({
type: "bi.vtape", type: "bi.vtape",
element: this, element: this,

3
demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js

@ -18,7 +18,8 @@ Demo.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
}, },
text: "默认值", text: "默认值",
items: items, items: items,
width: 300 width: 300,
value: ["第五级文件1"]
}, { }, {
type: "bi.button", type: "bi.button",
text: "getVlaue", text: "getVlaue",

3
demo/js/widget/selecttree/demo.select_tree_combo.js

@ -16,6 +16,7 @@ Demo.SelectTreeCombo = BI.inherit(BI.Widget, {
ref: function (_ref) { ref: function (_ref) {
self.tree = _ref; self.tree = _ref;
}, },
value: "11",
text: "默认值", text: "默认值",
items: items, items: items,
width: 300 width: 300
@ -30,7 +31,7 @@ Demo.SelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.button", type: "bi.button",
text: "setVlaue (第二级文件1)", text: "setVlaue (第二级文件1)",
handler: function () { handler: function () {
self.tree.setValue(["第二级文件1"]); self.tree.setValue(["2"]);
}, },
width: 300 width: 300
}], }],

5
demo/js/widget/singletree/demo.single_tree_combo.js

@ -18,7 +18,8 @@ Demo.SingleTreeCombo = BI.inherit(BI.Widget, {
}, },
text: "默认值", text: "默认值",
items: items, items: items,
width: 300 width: 300,
value: "11"
}, { }, {
type: "bi.button", type: "bi.button",
text: "getVlaue", text: "getVlaue",
@ -30,7 +31,7 @@ Demo.SingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.button", type: "bi.button",
text: "setVlaue (第二级文件1)", text: "setVlaue (第二级文件1)",
handler: function () { handler: function () {
self.tree.setValue(["第二级文件1"]); self.tree.setValue(["2"]);
}, },
width: 300 width: 300
}], }],

23
demo/js/widget/table/demo.responsive_table.js

@ -129,23 +129,24 @@ Demo.Func = BI.inherit(BI.Widget, {
isNeedMerge: true, isNeedMerge: true,
isNeedFreeze: true, isNeedFreeze: true,
mergeCols: [0, 1], mergeCols: [0, 1],
columnSize: ["", "", ""], items: [],
items: items, header: []
header: header
}); });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [{
el: { el: {
type: "bi.grid", type: "bi.tab",
columns: 2, defaultShowIndex: 1,
rows: 2, cardCreator: function (v) {
items: [{ switch (v) {
column: 0, case 1:
row: 0, table1.attr("columnSize", ["", "", ""]);
el: table1 table1.populate(items, header);
}] return table1;
}
}
}, },
left: 10, left: 10,
right: 10, right: 10,

3
demo/js/widget/tree/demo.multilayer_select_level_tree.js

@ -9,7 +9,8 @@ Demo.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
var self = this; var self = this;
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.multilayer_select_level_tree", type: "bi.multilayer_select_level_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE) items: BI.deepClone(Demo.CONSTANTS.TREE),
value: "第五级文件1"
}); });
return { return {

3
demo/js/widget/tree/demo.multilayer_single_level_tree.js

@ -9,7 +9,8 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
var self = this; var self = this;
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE) items: BI.deepClone(Demo.CONSTANTS.TREE),
value: "第五级文件1"
}); });
return { return {

5
demo/js/widget/tree/demo.select_level_tree.js

@ -9,7 +9,8 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, {
var self = this; var self = this;
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.select_level_tree", type: "bi.select_level_tree",
items: BI.deepClone(Demo.CONSTANTS.LEVELTREE) items: BI.deepClone(Demo.CONSTANTS.LEVELTREE),
value: "11"
}); });
return { return {
@ -32,7 +33,7 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, {
height: 25, height: 25,
text: "setValue (第二级文件1)", text: "setValue (第二级文件1)",
handler: function () { handler: function () {
tree.setValue(["第二级文件1"]); tree.setValue(["2"]);
} }
}, },
height: 25 height: 25

5
demo/js/widget/tree/demo.single_level_tree.js

@ -9,7 +9,8 @@ Demo.SingleLevelTree = BI.inherit(BI.Widget, {
var self = this; var self = this;
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.single_level_tree", type: "bi.single_level_tree",
items: BI.deepClone(Demo.CONSTANTS.LEVELTREE) items: BI.deepClone(Demo.CONSTANTS.LEVELTREE),
value: "11"
}); });
return { return {
@ -32,7 +33,7 @@ Demo.SingleLevelTree = BI.inherit(BI.Widget, {
height: 25, height: 25,
text: "setValue (第二级文件1)", text: "setValue (第二级文件1)",
handler: function () { handler: function () {
tree.setValue(["第二级文件1"]); tree.setValue(["2"]);
} }
}, },
height: 25 height: 25

3
demo/js/widget/tree/demo.switchtree.js

@ -9,7 +9,8 @@ Demo.SwitchTree = BI.inherit(BI.Widget, {
var self = this; var self = this;
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.switch_tree", type: "bi.switch_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE) items: BI.deepClone(Demo.CONSTANTS.TREE),
value: "第五级文件1"
}); });
return { return {

104
dist/base.js vendored

@ -1963,11 +1963,15 @@ BI.TreeView = BI.inherit(BI.Pane, {
}); });
} }
if (!this.nodes) {
return;
}
BI.each(this.nodes.getNodes(), function (i, node) { BI.each(this.nodes.getNodes(), function (i, node) {
node.halfCheck = false; node.halfCheck = false;
setNode(node.children); setNode(node.children);
}); });
this.nodes && this.nodes.checkAllNodes(checked); this.nodes.checkAllNodes(checked);
}, },
expandAll: function (flag) { expandAll: function (flag) {
@ -3129,14 +3133,17 @@ BI.Combo = BI.inherit(BI.Widget, {
}, },
_initCombo: function () { _initCombo: function () {
this.combo = BI.createWidget(this.options.el); this.combo = BI.createWidget(this.options.el, {
value: this.options.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
var self = this; var self = this, o = this.options;
if (this.popupView == null) { if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, { 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) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
@ -3327,14 +3334,20 @@ BI.Combo = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView();
this.combo.setValue(v); 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 () { getValue: function () {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView && this.popupView.getValue(); return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
isViewVisible: function () { isViewVisible: function () {
@ -3513,11 +3526,13 @@ BI.Expander = BI.inherit(BI.Widget, {
}, },
_initExpander: function () { _initExpander: function () {
this.expander = BI.createWidget(this.options.el); this.expander = BI.createWidget(this.options.el, {
value: this.options.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
var self = this; var self = this, o = this.options;
if (this.popupView == null) { if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, { this.popupView = BI.createWidget(this.options.popup, {
type: "bi.button_group", type: "bi.button_group",
@ -3526,7 +3541,8 @@ BI.Expander = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
hgap: 0, hgap: 0,
vgap: 0 vgap: 0
}] }],
value: o.value
}); });
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -3590,14 +3606,20 @@ BI.Expander = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
// this._assertPopupView();
this.expander.setValue(v); 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 () { getValue: function () {
// this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView ? this.popupView.getValue() : []; return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
isViewVisible: function () { isViewVisible: function () {
@ -4489,8 +4511,11 @@ BI.Searcher = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
this.popupView && this.popupView.setValue(v); this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
}, },
getKeyword: function () { getKeyword: function () {
@ -4511,6 +4536,9 @@ BI.Searcher = BI.inherit(BI.Widget, {
} else if (o.adapter && o.adapter.getValue) { } else if (o.adapter && o.adapter.getValue) {
return o.adapter.getValue(); return o.adapter.getValue();
} }
if (BI.isNull(this.popupView)) {
return o.popup.value;
}
return this.popupView.getValue(); return this.popupView.getValue();
}, },
@ -4665,7 +4693,9 @@ BI.Switcher = BI.inherit(BI.Widget, {
}, },
_initSwitcher: function () { _initSwitcher: function () {
this.switcher = BI.createWidget(this.options.el); this.switcher = BI.createWidget(this.options.el, {
value: o.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
@ -4679,7 +4709,8 @@ BI.Switcher = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
hgap: 0, hgap: 0,
vgap: 0 vgap: 0
}] }],
value: o.value
}); });
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -4739,14 +4770,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView();
this.switcher.setValue(v); 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 () { getValue: function () {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView ? this.popupView.getValue() : []; return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
setAdapter: function (adapter) { setAdapter: function (adapter) {
@ -15377,7 +15414,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () { _createView: function () {
var o = this.options; 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"}); this.button_group.element.css({"min-height": o.minHeight + "px"});
return this.button_group; return this.button_group;
}, },
@ -15509,7 +15546,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
}, },
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -15537,7 +15575,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
}, },
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -33376,12 +33415,20 @@ BI.Table = BI.inherit(BI.Widget, {
}, },
_empty: function () {
this.scrollBottomRight && this.scrollBottomRight.destroy();
this.topLeft && this.topLeft.destroy();
this.topRight && this.topRight.destroy();
this.bottomLeft && this.bottomLeft.destroy();
this.bottomRight && this.bottomRight.destroy();
},
populate: function (items, header) { populate: function (items, header) {
this.options.items = items || []; this.options.items = items || [];
if (header) { if (header) {
this.options.header = header; this.options.header = header;
} }
this.empty(); this._empty();
if (this.options.isNeedFreeze) { if (this.options.isNeedFreeze) {
this._createFreezeTable(); this._createFreezeTable();
} else { } else {
@ -33971,7 +34018,8 @@ BI.CustomTree = BI.inherit(BI.Widget, {
args[0] = self._formatItems(items); args[0] = self._formatItems(items);
callback.apply(null, args); callback.apply(null, args);
}]); }]);
} },
value: o.value
}); });
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);

250
dist/bundle.js vendored

@ -27836,11 +27836,15 @@ BI.TreeView = BI.inherit(BI.Pane, {
}); });
} }
if (!this.nodes) {
return;
}
BI.each(this.nodes.getNodes(), function (i, node) { BI.each(this.nodes.getNodes(), function (i, node) {
node.halfCheck = false; node.halfCheck = false;
setNode(node.children); setNode(node.children);
}); });
this.nodes && this.nodes.checkAllNodes(checked); this.nodes.checkAllNodes(checked);
}, },
expandAll: function (flag) { expandAll: function (flag) {
@ -29002,14 +29006,17 @@ BI.Combo = BI.inherit(BI.Widget, {
}, },
_initCombo: function () { _initCombo: function () {
this.combo = BI.createWidget(this.options.el); this.combo = BI.createWidget(this.options.el, {
value: this.options.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
var self = this; var self = this, o = this.options;
if (this.popupView == null) { if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, { 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) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
@ -29200,14 +29207,20 @@ BI.Combo = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView();
this.combo.setValue(v); 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 () { getValue: function () {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView && this.popupView.getValue(); return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
isViewVisible: function () { isViewVisible: function () {
@ -29386,11 +29399,13 @@ BI.Expander = BI.inherit(BI.Widget, {
}, },
_initExpander: function () { _initExpander: function () {
this.expander = BI.createWidget(this.options.el); this.expander = BI.createWidget(this.options.el, {
value: this.options.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
var self = this; var self = this, o = this.options;
if (this.popupView == null) { if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, { this.popupView = BI.createWidget(this.options.popup, {
type: "bi.button_group", type: "bi.button_group",
@ -29399,7 +29414,8 @@ BI.Expander = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
hgap: 0, hgap: 0,
vgap: 0 vgap: 0
}] }],
value: o.value
}); });
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -29463,14 +29479,20 @@ BI.Expander = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
// this._assertPopupView();
this.expander.setValue(v); 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 () { getValue: function () {
// this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView ? this.popupView.getValue() : []; return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
isViewVisible: function () { isViewVisible: function () {
@ -30362,8 +30384,11 @@ BI.Searcher = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
this.popupView && this.popupView.setValue(v); this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
}, },
getKeyword: function () { getKeyword: function () {
@ -30384,6 +30409,9 @@ BI.Searcher = BI.inherit(BI.Widget, {
} else if (o.adapter && o.adapter.getValue) { } else if (o.adapter && o.adapter.getValue) {
return o.adapter.getValue(); return o.adapter.getValue();
} }
if (BI.isNull(this.popupView)) {
return o.popup.value;
}
return this.popupView.getValue(); return this.popupView.getValue();
}, },
@ -30538,7 +30566,9 @@ BI.Switcher = BI.inherit(BI.Widget, {
}, },
_initSwitcher: function () { _initSwitcher: function () {
this.switcher = BI.createWidget(this.options.el); this.switcher = BI.createWidget(this.options.el, {
value: o.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
@ -30552,7 +30582,8 @@ BI.Switcher = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
hgap: 0, hgap: 0,
vgap: 0 vgap: 0
}] }],
value: o.value
}); });
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -30612,14 +30643,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView();
this.switcher.setValue(v); 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 () { getValue: function () {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView ? this.popupView.getValue() : []; return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
setAdapter: function (adapter) { setAdapter: function (adapter) {
@ -41250,7 +41287,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () { _createView: function () {
var o = this.options; 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"}); this.button_group.element.css({"min-height": o.minHeight + "px"});
return this.button_group; return this.button_group;
}, },
@ -41382,7 +41419,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
}, },
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -41410,7 +41448,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
}, },
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -59249,12 +59288,20 @@ BI.Table = BI.inherit(BI.Widget, {
}, },
_empty: function () {
this.scrollBottomRight && this.scrollBottomRight.destroy();
this.topLeft && this.topLeft.destroy();
this.topRight && this.topRight.destroy();
this.bottomLeft && this.bottomLeft.destroy();
this.bottomRight && this.bottomRight.destroy();
},
populate: function (items, header) { populate: function (items, header) {
this.options.items = items || []; this.options.items = items || [];
if (header) { if (header) {
this.options.header = header; this.options.header = header;
} }
this.empty(); this._empty();
if (this.options.isNeedFreeze) { if (this.options.isNeedFreeze) {
this._createFreezeTable(); this._createFreezeTable();
} else { } else {
@ -59844,7 +59891,8 @@ BI.CustomTree = BI.inherit(BI.Widget, {
args[0] = self._formatItems(items); args[0] = self._formatItems(items);
callback.apply(null, args); callback.apply(null, args);
}]); }]);
} },
value: o.value
}); });
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -65898,25 +65946,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.ColorChooser.superclass._init.apply(this, arguments); BI.ColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options; 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({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this, element: this,
adjustLength: 1, 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: { 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, stopPropagation: false,
minWidth: 202 minWidth: 202
} },
value: o.value
}); });
var fn = function () { var fn = function () {
@ -65929,15 +65994,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
que.unshift(color); que.unshift(color);
BI.Cache.setItem("colors", BI.array2String(que.toArray())); 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 () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || "")); self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || ""));
}); });
@ -65964,7 +66020,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
}, },
getValue: function () { getValue: function () {
return this.colorPicker.getValue(); return this.combo.getValue();
} }
}); });
BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE"; BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
@ -65989,7 +66045,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
BI.ColorChooserPopup.superclass._init.apply(this, arguments); BI.ColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.colorEditor = BI.createWidget({ 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 () { this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
@ -66025,7 +66082,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
disabled: true disabled: true
}]], }]],
width: 190, width: 190,
height: 25 height: 25,
value: o.value
}); });
this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () { this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () {
self.setValue(this.getValue()[0]); self.setValue(this.getValue()[0]);
@ -66035,7 +66093,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
this.colorPicker = BI.createWidget({ this.colorPicker = BI.createWidget({
type: "bi.color_picker", type: "bi.color_picker",
width: 190, width: 190,
height: 50 height: 50,
value: o.value
}); });
this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () { this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () {
@ -66448,7 +66507,8 @@ BI.ColorPicker = BI.inherit(BI.Widget, {
}), }),
layouts: [{ layouts: [{
type: "bi.grid" type: "bi.grid"
}] }],
value: o.value
}); });
this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () { this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () {
self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments); self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments);
@ -75569,7 +75629,8 @@ BI.LevelTree = BI.inherit(BI.Widget, {
chooseType: 0 chooseType: 0
}, },
expander: {}, expander: {},
items: [] items: [],
value: ""
}); });
}, },
@ -75638,6 +75699,7 @@ BI.LevelTree = BI.inherit(BI.Widget, {
}, o.expander), }, o.expander),
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
el: BI.extend({ el: BI.extend({
type: "bi.button_tree", type: "bi.button_tree",
@ -75729,6 +75791,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
if (BI.isNotEmptyArray(o.items)) { if (BI.isNotEmptyArray(o.items)) {
this.populate(); this.populate();
} }
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
}
}, },
populate: function (items, keyword) { populate: function (items, keyword) {
@ -75740,7 +75805,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
}); });
}, },
setValue: function (v) { _digest: function (v) {
v || (v = []); v || (v = []);
var self = this, map = {}; var self = this, map = {};
var selected = []; var selected = [];
@ -75768,8 +75833,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 () { _getValue: function () {
@ -76149,7 +76217,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
text: this._digest(o.text, o.items) text: this._digest(o.value, o.items)
}); });
}, },
@ -84039,7 +84107,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
isDefaultInit: false, isDefaultInit: false,
height: 30, height: 30,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -84051,13 +84120,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup", type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -84108,7 +84179,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
baseCls: "bi-multilayer-select-level-tree", baseCls: "bi-multilayer-select-level-tree",
isDefaultInit: false, isDefaultInit: false,
items: [], items: [],
itemsCreator: BI.emptyFn itemsCreator: BI.emptyFn,
value: ""
}); });
}, },
@ -84180,6 +84252,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
value: o.value,
el: { el: {
type: "bi.button_tree", type: "bi.button_tree",
@ -84238,7 +84311,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
isDefaultInit: false, isDefaultInit: false,
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
items: [] items: [],
value: ""
}); });
}, },
@ -84251,6 +84325,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree", type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items, items: o.items,
value: o.value,
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator
}); });
@ -84579,7 +84654,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
height: 30, height: 30,
text: "", text: "",
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
items: [] items: [],
value: ""
}); });
}, },
@ -84591,13 +84667,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup", type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -84719,6 +84797,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
}, },
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) { o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0); callback(BI.Tree.transformToTreeFormat(items), 0);
@ -84796,7 +84875,8 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items, items: o.items,
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator,
value: o.value
}); });
BI.createWidget({ BI.createWidget({
@ -92393,7 +92473,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
baseCls: "bi-select-tree-combo", baseCls: "bi-select-tree-combo",
height: 30, height: 30,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -92405,12 +92486,14 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.select_level_tree", type: "bi.select_level_tree",
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -92532,7 +92615,8 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-level-tree", baseCls: "bi-select-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
items: [] items: [],
value: ""
}); });
}, },
@ -92581,6 +92665,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true isDefaultInit: true
}, },
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)), items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
value: o.value,
chooseType: BI.Selection.Single chooseType: BI.Selection.Single
}); });
@ -96499,7 +96584,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
trigger: {}, trigger: {},
height: 24, height: 24,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -96511,12 +96597,14 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}, o.trigger)); }, o.trigger));
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.single_level_tree", type: "bi.single_level_tree",
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -96571,7 +96659,8 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-level-tree", baseCls: "bi-single-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
items: [] items: [],
value: ""
}); });
}, },
@ -96586,6 +96675,7 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true isDefaultInit: true
}, },
items: o.items, items: o.items,
value: o.value,
chooseType: BI.Selection.Single chooseType: BI.Selection.Single
}); });
@ -96634,7 +96724,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
baseCls: "bi-single-tree-trigger", baseCls: "bi-single-tree-trigger",
height: 24, height: 24,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -96648,7 +96739,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
element: this, element: this,
text: o.text, text: o.text,
items: o.items, items: o.items,
height: o.height height: o.height,
value: o.value
}); });
}, },
@ -96715,7 +96807,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
this.levelTree = BI.createWidget({ this.levelTree = BI.createWidget({
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
isDefaultInit: true, isDefaultInit: true,
items: BI.deepClone(o.items) items: BI.deepClone(o.items),
value: o.value
}); });
this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () { this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);
@ -96724,7 +96817,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
case BI.SwitchTree.SelectType.MultiSelect: case BI.SwitchTree.SelectType.MultiSelect:
this.tree = BI.createWidget({ this.tree = BI.createWidget({
type: "bi.simple_tree", 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 () { this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);

78
dist/case.js vendored

@ -3658,25 +3658,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.ColorChooser.superclass._init.apply(this, arguments); BI.ColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options; 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({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this, element: this,
adjustLength: 1, 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: { 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, stopPropagation: false,
minWidth: 202 minWidth: 202
} },
value: o.value
}); });
var fn = function () { var fn = function () {
@ -3689,15 +3706,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
que.unshift(color); que.unshift(color);
BI.Cache.setItem("colors", BI.array2String(que.toArray())); 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 () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || "")); self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || ""));
}); });
@ -3724,7 +3732,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
}, },
getValue: function () { getValue: function () {
return this.colorPicker.getValue(); return this.combo.getValue();
} }
}); });
BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE"; BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
@ -3749,7 +3757,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
BI.ColorChooserPopup.superclass._init.apply(this, arguments); BI.ColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.colorEditor = BI.createWidget({ 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 () { this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
@ -3785,7 +3794,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
disabled: true disabled: true
}]], }]],
width: 190, width: 190,
height: 25 height: 25,
value: o.value
}); });
this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () { this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () {
self.setValue(this.getValue()[0]); self.setValue(this.getValue()[0]);
@ -3795,7 +3805,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
this.colorPicker = BI.createWidget({ this.colorPicker = BI.createWidget({
type: "bi.color_picker", type: "bi.color_picker",
width: 190, width: 190,
height: 50 height: 50,
value: o.value
}); });
this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () { this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () {
@ -4208,7 +4219,8 @@ BI.ColorPicker = BI.inherit(BI.Widget, {
}), }),
layouts: [{ layouts: [{
type: "bi.grid" type: "bi.grid"
}] }],
value: o.value
}); });
this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () { this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () {
self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments); self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments);
@ -13329,7 +13341,8 @@ BI.LevelTree = BI.inherit(BI.Widget, {
chooseType: 0 chooseType: 0
}, },
expander: {}, expander: {},
items: [] items: [],
value: ""
}); });
}, },
@ -13398,6 +13411,7 @@ BI.LevelTree = BI.inherit(BI.Widget, {
}, o.expander), }, o.expander),
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
el: BI.extend({ el: BI.extend({
type: "bi.button_tree", type: "bi.button_tree",
@ -13489,6 +13503,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
if (BI.isNotEmptyArray(o.items)) { if (BI.isNotEmptyArray(o.items)) {
this.populate(); this.populate();
} }
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
}
}, },
populate: function (items, keyword) { populate: function (items, keyword) {
@ -13500,7 +13517,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
}); });
}, },
setValue: function (v) { _digest: function (v) {
v || (v = []); v || (v = []);
var self = this, map = {}; var self = this, map = {};
var selected = []; var selected = [];
@ -13528,8 +13545,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 () { _getValue: function () {
@ -13909,7 +13929,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
text: this._digest(o.text, o.items) text: this._digest(o.value, o.items)
}); });
}, },

107
dist/demo.js vendored

@ -3735,10 +3735,7 @@ BI.shortcut("demo.level_tree", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
// value值一定要是字符串 // value值一定要是字符串
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.simple_tree", type: "bi.simple_tree",
items: [] items: [{
});
tree.populate([{
id: 1, id: 1,
text: "第一项", text: "第一项",
value: "1" value: "1"
@ -3781,7 +3778,54 @@ BI.shortcut("demo.level_tree", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
pId: 3, pId: 3,
text: "子项3", text: "子项3",
value: "33" value: "33"
}], "z"); }],
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({ BI.createWidget({
type: "bi.vtape", type: "bi.vtape",
element: this, element: this,
@ -13122,7 +13166,8 @@ Demo.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
}, },
text: "默认值", text: "默认值",
items: items, items: items,
width: 300 width: 300,
value: ["第五级文件1"]
}, { }, {
type: "bi.button", type: "bi.button",
text: "getVlaue", text: "getVlaue",
@ -13161,6 +13206,7 @@ Demo.SelectTreeCombo = BI.inherit(BI.Widget, {
ref: function (_ref) { ref: function (_ref) {
self.tree = _ref; self.tree = _ref;
}, },
value: "11",
text: "默认值", text: "默认值",
items: items, items: items,
width: 300 width: 300
@ -13175,7 +13221,7 @@ Demo.SelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.button", type: "bi.button",
text: "setVlaue (第二级文件1)", text: "setVlaue (第二级文件1)",
handler: function () { handler: function () {
self.tree.setValue(["第二级文件1"]); self.tree.setValue(["2"]);
}, },
width: 300 width: 300
}], }],
@ -13340,7 +13386,8 @@ Demo.SingleTreeCombo = BI.inherit(BI.Widget, {
}, },
text: "默认值", text: "默认值",
items: items, items: items,
width: 300 width: 300,
value: "11"
}, { }, {
type: "bi.button", type: "bi.button",
text: "getVlaue", text: "getVlaue",
@ -13352,7 +13399,7 @@ Demo.SingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.button", type: "bi.button",
text: "setVlaue (第二级文件1)", text: "setVlaue (第二级文件1)",
handler: function () { handler: function () {
self.tree.setValue(["第二级文件1"]); self.tree.setValue(["2"]);
}, },
width: 300 width: 300
}], }],
@ -14065,23 +14112,24 @@ BI.shortcut("demo.preview_table", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
isNeedMerge: true, isNeedMerge: true,
isNeedFreeze: true, isNeedFreeze: true,
mergeCols: [0, 1], mergeCols: [0, 1],
columnSize: ["", "", ""], items: [],
items: items, header: []
header: header
}); });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [{
el: { el: {
type: "bi.grid", type: "bi.tab",
columns: 2, defaultShowIndex: 1,
rows: 2, cardCreator: function (v) {
items: [{ switch (v) {
column: 0, case 1:
row: 0, table1.attr("columnSize", ["", "", ""]);
el: table1 table1.populate(items, header);
}] return table1;
}
}
}, },
left: 10, left: 10,
right: 10, right: 10,
@ -14292,7 +14340,8 @@ Demo.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
var self = this; var self = this;
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.multilayer_select_level_tree", type: "bi.multilayer_select_level_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE) items: BI.deepClone(Demo.CONSTANTS.TREE),
value: "第五级文件1"
}); });
return { return {
@ -14337,7 +14386,8 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
var self = this; var self = this;
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE) items: BI.deepClone(Demo.CONSTANTS.TREE),
value: "第五级文件1"
}); });
return { return {
@ -14382,7 +14432,8 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, {
var self = this; var self = this;
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.select_level_tree", type: "bi.select_level_tree",
items: BI.deepClone(Demo.CONSTANTS.LEVELTREE) items: BI.deepClone(Demo.CONSTANTS.LEVELTREE),
value: "11"
}); });
return { return {
@ -14405,7 +14456,7 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, {
height: 25, height: 25,
text: "setValue (第二级文件1)", text: "setValue (第二级文件1)",
handler: function () { handler: function () {
tree.setValue(["第二级文件1"]); tree.setValue(["2"]);
} }
}, },
height: 25 height: 25
@ -14427,7 +14478,8 @@ Demo.SingleLevelTree = BI.inherit(BI.Widget, {
var self = this; var self = this;
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.single_level_tree", type: "bi.single_level_tree",
items: BI.deepClone(Demo.CONSTANTS.LEVELTREE) items: BI.deepClone(Demo.CONSTANTS.LEVELTREE),
value: "11"
}); });
return { return {
@ -14450,7 +14502,7 @@ Demo.SingleLevelTree = BI.inherit(BI.Widget, {
height: 25, height: 25,
text: "setValue (第二级文件1)", text: "setValue (第二级文件1)",
handler: function () { handler: function () {
tree.setValue(["第二级文件1"]); tree.setValue(["2"]);
} }
}, },
height: 25 height: 25
@ -14472,7 +14524,8 @@ Demo.SwitchTree = BI.inherit(BI.Widget, {
var self = this; var self = this;
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.switch_tree", type: "bi.switch_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE) items: BI.deepClone(Demo.CONSTANTS.TREE),
value: "第五级文件1"
}); });
return { return {

240
dist/fineui.js vendored

@ -29530,11 +29530,15 @@ BI.TreeView = BI.inherit(BI.Pane, {
}); });
} }
if (!this.nodes) {
return;
}
BI.each(this.nodes.getNodes(), function (i, node) { BI.each(this.nodes.getNodes(), function (i, node) {
node.halfCheck = false; node.halfCheck = false;
setNode(node.children); setNode(node.children);
}); });
this.nodes && this.nodes.checkAllNodes(checked); this.nodes.checkAllNodes(checked);
}, },
expandAll: function (flag) { expandAll: function (flag) {
@ -30696,14 +30700,17 @@ BI.Combo = BI.inherit(BI.Widget, {
}, },
_initCombo: function () { _initCombo: function () {
this.combo = BI.createWidget(this.options.el); this.combo = BI.createWidget(this.options.el, {
value: this.options.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
var self = this; var self = this, o = this.options;
if (this.popupView == null) { if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, { 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) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
@ -30894,14 +30901,20 @@ BI.Combo = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView();
this.combo.setValue(v); 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 () { getValue: function () {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView && this.popupView.getValue(); return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
isViewVisible: function () { isViewVisible: function () {
@ -31080,11 +31093,13 @@ BI.Expander = BI.inherit(BI.Widget, {
}, },
_initExpander: function () { _initExpander: function () {
this.expander = BI.createWidget(this.options.el); this.expander = BI.createWidget(this.options.el, {
value: this.options.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
var self = this; var self = this, o = this.options;
if (this.popupView == null) { if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, { this.popupView = BI.createWidget(this.options.popup, {
type: "bi.button_group", type: "bi.button_group",
@ -31093,7 +31108,8 @@ BI.Expander = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
hgap: 0, hgap: 0,
vgap: 0 vgap: 0
}] }],
value: o.value
}); });
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -31157,14 +31173,20 @@ BI.Expander = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
// this._assertPopupView();
this.expander.setValue(v); 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 () { getValue: function () {
// this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView ? this.popupView.getValue() : []; return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
isViewVisible: function () { isViewVisible: function () {
@ -32056,8 +32078,11 @@ BI.Searcher = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
this.popupView && this.popupView.setValue(v); this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
}, },
getKeyword: function () { getKeyword: function () {
@ -32078,6 +32103,9 @@ BI.Searcher = BI.inherit(BI.Widget, {
} else if (o.adapter && o.adapter.getValue) { } else if (o.adapter && o.adapter.getValue) {
return o.adapter.getValue(); return o.adapter.getValue();
} }
if (BI.isNull(this.popupView)) {
return o.popup.value;
}
return this.popupView.getValue(); return this.popupView.getValue();
}, },
@ -32232,7 +32260,9 @@ BI.Switcher = BI.inherit(BI.Widget, {
}, },
_initSwitcher: function () { _initSwitcher: function () {
this.switcher = BI.createWidget(this.options.el); this.switcher = BI.createWidget(this.options.el, {
value: o.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
@ -32246,7 +32276,8 @@ BI.Switcher = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
hgap: 0, hgap: 0,
vgap: 0 vgap: 0
}] }],
value: o.value
}); });
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -32306,14 +32337,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView();
this.switcher.setValue(v); 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 () { getValue: function () {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView ? this.popupView.getValue() : []; return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
setAdapter: function (adapter) { setAdapter: function (adapter) {
@ -42944,7 +42981,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () { _createView: function () {
var o = this.options; 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"}); this.button_group.element.css({"min-height": o.minHeight + "px"});
return this.button_group; return this.button_group;
}, },
@ -43076,7 +43113,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
}, },
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -43104,7 +43142,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
}, },
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -61538,7 +61577,8 @@ BI.CustomTree = BI.inherit(BI.Widget, {
args[0] = self._formatItems(items); args[0] = self._formatItems(items);
callback.apply(null, args); callback.apply(null, args);
}]); }]);
} },
value: o.value
}); });
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -67592,25 +67632,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.ColorChooser.superclass._init.apply(this, arguments); BI.ColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options; 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({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this, element: this,
adjustLength: 1, 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: { 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, stopPropagation: false,
minWidth: 202 minWidth: 202
} },
value: o.value
}); });
var fn = function () { var fn = function () {
@ -67623,15 +67680,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
que.unshift(color); que.unshift(color);
BI.Cache.setItem("colors", BI.array2String(que.toArray())); 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 () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || "")); self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || ""));
}); });
@ -67658,7 +67706,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
}, },
getValue: function () { getValue: function () {
return this.colorPicker.getValue(); return this.combo.getValue();
} }
}); });
BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE"; BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
@ -67683,7 +67731,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
BI.ColorChooserPopup.superclass._init.apply(this, arguments); BI.ColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.colorEditor = BI.createWidget({ 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 () { this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
@ -67719,7 +67768,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
disabled: true disabled: true
}]], }]],
width: 190, width: 190,
height: 25 height: 25,
value: o.value
}); });
this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () { this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () {
self.setValue(this.getValue()[0]); self.setValue(this.getValue()[0]);
@ -67729,7 +67779,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
this.colorPicker = BI.createWidget({ this.colorPicker = BI.createWidget({
type: "bi.color_picker", type: "bi.color_picker",
width: 190, width: 190,
height: 50 height: 50,
value: o.value
}); });
this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () { this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () {
@ -68142,7 +68193,8 @@ BI.ColorPicker = BI.inherit(BI.Widget, {
}), }),
layouts: [{ layouts: [{
type: "bi.grid" type: "bi.grid"
}] }],
value: o.value
}); });
this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () { this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () {
self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments); self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments);
@ -77263,7 +77315,8 @@ BI.LevelTree = BI.inherit(BI.Widget, {
chooseType: 0 chooseType: 0
}, },
expander: {}, expander: {},
items: [] items: [],
value: ""
}); });
}, },
@ -77332,6 +77385,7 @@ BI.LevelTree = BI.inherit(BI.Widget, {
}, o.expander), }, o.expander),
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
el: BI.extend({ el: BI.extend({
type: "bi.button_tree", type: "bi.button_tree",
@ -77423,6 +77477,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
if (BI.isNotEmptyArray(o.items)) { if (BI.isNotEmptyArray(o.items)) {
this.populate(); this.populate();
} }
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
}
}, },
populate: function (items, keyword) { populate: function (items, keyword) {
@ -77434,7 +77491,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
}); });
}, },
setValue: function (v) { _digest: function (v) {
v || (v = []); v || (v = []);
var self = this, map = {}; var self = this, map = {};
var selected = []; var selected = [];
@ -77462,8 +77519,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 () { _getValue: function () {
@ -77843,7 +77903,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
text: this._digest(o.text, o.items) text: this._digest(o.value, o.items)
}); });
}, },
@ -85733,7 +85793,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
isDefaultInit: false, isDefaultInit: false,
height: 30, height: 30,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -85745,13 +85806,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup", type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -85802,7 +85865,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
baseCls: "bi-multilayer-select-level-tree", baseCls: "bi-multilayer-select-level-tree",
isDefaultInit: false, isDefaultInit: false,
items: [], items: [],
itemsCreator: BI.emptyFn itemsCreator: BI.emptyFn,
value: ""
}); });
}, },
@ -85874,6 +85938,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
value: o.value,
el: { el: {
type: "bi.button_tree", type: "bi.button_tree",
@ -85932,7 +85997,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
isDefaultInit: false, isDefaultInit: false,
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
items: [] items: [],
value: ""
}); });
}, },
@ -85945,6 +86011,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree", type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items, items: o.items,
value: o.value,
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator
}); });
@ -86273,7 +86340,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
height: 30, height: 30,
text: "", text: "",
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
items: [] items: [],
value: ""
}); });
}, },
@ -86285,13 +86353,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup", type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -86413,6 +86483,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
}, },
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) { o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0); callback(BI.Tree.transformToTreeFormat(items), 0);
@ -86490,7 +86561,8 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items, items: o.items,
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator,
value: o.value
}); });
BI.createWidget({ BI.createWidget({
@ -94087,7 +94159,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
baseCls: "bi-select-tree-combo", baseCls: "bi-select-tree-combo",
height: 30, height: 30,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -94099,12 +94172,14 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.select_level_tree", type: "bi.select_level_tree",
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -94226,7 +94301,8 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-level-tree", baseCls: "bi-select-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
items: [] items: [],
value: ""
}); });
}, },
@ -94275,6 +94351,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true isDefaultInit: true
}, },
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)), items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
value: o.value,
chooseType: BI.Selection.Single chooseType: BI.Selection.Single
}); });
@ -98193,7 +98270,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
trigger: {}, trigger: {},
height: 24, height: 24,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -98205,12 +98283,14 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}, o.trigger)); }, o.trigger));
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.single_level_tree", type: "bi.single_level_tree",
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -98265,7 +98345,8 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-level-tree", baseCls: "bi-single-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
items: [] items: [],
value: ""
}); });
}, },
@ -98280,6 +98361,7 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true isDefaultInit: true
}, },
items: o.items, items: o.items,
value: o.value,
chooseType: BI.Selection.Single chooseType: BI.Selection.Single
}); });
@ -98328,7 +98410,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
baseCls: "bi-single-tree-trigger", baseCls: "bi-single-tree-trigger",
height: 24, height: 24,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -98342,7 +98425,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
element: this, element: this,
text: o.text, text: o.text,
items: o.items, items: o.items,
height: o.height height: o.height,
value: o.value
}); });
}, },
@ -98409,7 +98493,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
this.levelTree = BI.createWidget({ this.levelTree = BI.createWidget({
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
isDefaultInit: true, isDefaultInit: true,
items: BI.deepClone(o.items) items: BI.deepClone(o.items),
value: o.value
}); });
this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () { this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);
@ -98418,7 +98503,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
case BI.SwitchTree.SelectType.MultiSelect: case BI.SwitchTree.SelectType.MultiSelect:
this.tree = BI.createWidget({ this.tree = BI.createWidget({
type: "bi.simple_tree", 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 () { this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);

68
dist/widget.js vendored

@ -7741,7 +7741,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
isDefaultInit: false, isDefaultInit: false,
height: 30, height: 30,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -7753,13 +7754,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup", type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -7810,7 +7813,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
baseCls: "bi-multilayer-select-level-tree", baseCls: "bi-multilayer-select-level-tree",
isDefaultInit: false, isDefaultInit: false,
items: [], items: [],
itemsCreator: BI.emptyFn itemsCreator: BI.emptyFn,
value: ""
}); });
}, },
@ -7882,6 +7886,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
value: o.value,
el: { el: {
type: "bi.button_tree", type: "bi.button_tree",
@ -7940,7 +7945,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
isDefaultInit: false, isDefaultInit: false,
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
items: [] items: [],
value: ""
}); });
}, },
@ -7953,6 +7959,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree", type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items, items: o.items,
value: o.value,
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator
}); });
@ -8281,7 +8288,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
height: 30, height: 30,
text: "", text: "",
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
items: [] items: [],
value: ""
}); });
}, },
@ -8293,13 +8301,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup", type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -8421,6 +8431,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
}, },
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) { o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0); callback(BI.Tree.transformToTreeFormat(items), 0);
@ -8498,7 +8509,8 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items, items: o.items,
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator,
value: o.value
}); });
BI.createWidget({ BI.createWidget({
@ -16095,7 +16107,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
baseCls: "bi-select-tree-combo", baseCls: "bi-select-tree-combo",
height: 30, height: 30,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -16107,12 +16120,14 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.select_level_tree", type: "bi.select_level_tree",
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -16234,7 +16249,8 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-level-tree", baseCls: "bi-select-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
items: [] items: [],
value: ""
}); });
}, },
@ -16283,6 +16299,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true isDefaultInit: true
}, },
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)), items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
value: o.value,
chooseType: BI.Selection.Single chooseType: BI.Selection.Single
}); });
@ -20201,7 +20218,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
trigger: {}, trigger: {},
height: 24, height: 24,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -20213,12 +20231,14 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}, o.trigger)); }, o.trigger));
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.single_level_tree", type: "bi.single_level_tree",
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -20273,7 +20293,8 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-level-tree", baseCls: "bi-single-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
items: [] items: [],
value: ""
}); });
}, },
@ -20288,6 +20309,7 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true isDefaultInit: true
}, },
items: o.items, items: o.items,
value: o.value,
chooseType: BI.Selection.Single chooseType: BI.Selection.Single
}); });
@ -20336,7 +20358,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
baseCls: "bi-single-tree-trigger", baseCls: "bi-single-tree-trigger",
height: 24, height: 24,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -20350,7 +20373,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
element: this, element: this,
text: o.text, text: o.text,
items: o.items, items: o.items,
height: o.height height: o.height,
value: o.value
}); });
}, },
@ -20417,7 +20441,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
this.levelTree = BI.createWidget({ this.levelTree = BI.createWidget({
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
isDefaultInit: true, isDefaultInit: true,
items: BI.deepClone(o.items) items: BI.deepClone(o.items),
value: o.value
}); });
this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () { this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);
@ -20426,7 +20451,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
case BI.SwitchTree.SelectType.MultiSelect: case BI.SwitchTree.SelectType.MultiSelect:
this.tree = BI.createWidget({ this.tree = BI.createWidget({
type: "bi.simple_tree", 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 () { this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);

23
src/base/combination/combo.js

@ -209,14 +209,17 @@ BI.Combo = BI.inherit(BI.Widget, {
}, },
_initCombo: function () { _initCombo: function () {
this.combo = BI.createWidget(this.options.el); this.combo = BI.createWidget(this.options.el, {
value: this.options.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
var self = this; var self = this, o = this.options;
if (this.popupView == null) { if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, { 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) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
@ -407,14 +410,20 @@ BI.Combo = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView();
this.combo.setValue(v); 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 () { getValue: function () {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView && this.popupView.getValue(); return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
isViewVisible: function () { isViewVisible: function () {

23
src/base/combination/expander.js

@ -126,11 +126,13 @@ BI.Expander = BI.inherit(BI.Widget, {
}, },
_initExpander: function () { _initExpander: function () {
this.expander = BI.createWidget(this.options.el); this.expander = BI.createWidget(this.options.el, {
value: this.options.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
var self = this; var self = this, o = this.options;
if (this.popupView == null) { if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, { this.popupView = BI.createWidget(this.options.popup, {
type: "bi.button_group", type: "bi.button_group",
@ -139,7 +141,8 @@ BI.Expander = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
hgap: 0, hgap: 0,
vgap: 0 vgap: 0
}] }],
value: o.value
}); });
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -203,14 +206,20 @@ BI.Expander = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
// this._assertPopupView();
this.expander.setValue(v); 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 () { getValue: function () {
// this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView ? this.popupView.getValue() : []; return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
isViewVisible: function () { isViewVisible: function () {

10
src/base/combination/searcher.js

@ -247,8 +247,11 @@ BI.Searcher = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
this.popupView && this.popupView.setValue(v); this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
}, },
getKeyword: function () { getKeyword: function () {
@ -269,6 +272,9 @@ BI.Searcher = BI.inherit(BI.Widget, {
} else if (o.adapter && o.adapter.getValue) { } else if (o.adapter && o.adapter.getValue) {
return o.adapter.getValue(); return o.adapter.getValue();
} }
if (BI.isNull(this.popupView)) {
return o.popup.value;
}
return this.popupView.getValue(); return this.popupView.getValue();
}, },

21
src/base/combination/switcher.js

@ -123,7 +123,9 @@ BI.Switcher = BI.inherit(BI.Widget, {
}, },
_initSwitcher: function () { _initSwitcher: function () {
this.switcher = BI.createWidget(this.options.el); this.switcher = BI.createWidget(this.options.el, {
value: o.value
});
}, },
_assertPopupView: function () { _assertPopupView: function () {
@ -137,7 +139,8 @@ BI.Switcher = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
hgap: 0, hgap: 0,
vgap: 0 vgap: 0
}] }],
value: o.value
}); });
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -197,14 +200,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
this._assertPopupView();
this.switcher.setValue(v); 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 () { getValue: function () {
this._assertPopupView(); if (BI.isNull(this.popupView)) {
return this.popupView ? this.popupView.getValue() : []; return this.options.popup.value;
} else {
return this.popupView.getValue();
}
}, },
setAdapter: function (adapter) { setAdapter: function (adapter) {

2
src/base/layer/layer.popup.js

@ -93,7 +93,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () { _createView: function () {
var o = this.options; 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"}); this.button_group.element.css({"min-height": o.minHeight + "px"});
return this.button_group; return this.button_group;
}, },

6
src/base/layer/layer.searcher.js

@ -55,7 +55,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
}, },
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -83,7 +84,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
}, },
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) { this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);

10
src/base/table/table.js

@ -1580,12 +1580,20 @@ BI.Table = BI.inherit(BI.Widget, {
}, },
_empty: function () {
this.scrollBottomRight && this.scrollBottomRight.destroy();
this.topLeft && this.topLeft.destroy();
this.topRight && this.topRight.destroy();
this.bottomLeft && this.bottomLeft.destroy();
this.bottomRight && this.bottomRight.destroy();
},
populate: function (items, header) { populate: function (items, header) {
this.options.items = items || []; this.options.items = items || [];
if (header) { if (header) {
this.options.header = header; this.options.header = header;
} }
this.empty(); this._empty();
if (this.options.isNeedFreeze) { if (this.options.isNeedFreeze) {
this._createFreezeTable(); this._createFreezeTable();
} else { } else {

3
src/base/tree/customtree.js

@ -90,7 +90,8 @@ BI.CustomTree = BI.inherit(BI.Widget, {
args[0] = self._formatItems(items); args[0] = self._formatItems(items);
callback.apply(null, args); callback.apply(null, args);
}]); }]);
} },
value: o.value
}); });
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);

6
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) { BI.each(this.nodes.getNodes(), function (i, node) {
node.halfCheck = false; node.halfCheck = false;
setNode(node.children); setNode(node.children);
}); });
this.nodes && this.nodes.checkAllNodes(checked); this.nodes.checkAllNodes(checked);
}, },
expandAll: function (flag) { expandAll: function (flag) {

50
src/case/colorchooser/colorchooser.js

@ -17,25 +17,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.ColorChooser.superclass._init.apply(this, arguments); BI.ColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options; 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({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this, element: this,
adjustLength: 1, 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: { 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, stopPropagation: false,
minWidth: 202 minWidth: 202
} },
value: o.value
}); });
var fn = function () { var fn = function () {
@ -48,15 +65,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
que.unshift(color); que.unshift(color);
BI.Cache.setItem("colors", BI.array2String(que.toArray())); 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 () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || "")); self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || ""));
}); });
@ -83,7 +91,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
}, },
getValue: function () { getValue: function () {
return this.colorPicker.getValue(); return this.combo.getValue();
} }
}); });
BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE"; BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";

9
src/case/colorchooser/colorchooser.popup.js

@ -19,7 +19,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
BI.ColorChooserPopup.superclass._init.apply(this, arguments); BI.ColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.colorEditor = BI.createWidget({ 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 () { this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
@ -55,7 +56,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
disabled: true disabled: true
}]], }]],
width: 190, width: 190,
height: 25 height: 25,
value: o.value
}); });
this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () { this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () {
self.setValue(this.getValue()[0]); self.setValue(this.getValue()[0]);
@ -65,7 +67,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
this.colorPicker = BI.createWidget({ this.colorPicker = BI.createWidget({
type: "bi.color_picker", type: "bi.color_picker",
width: 190, width: 190,
height: 50 height: 50,
value: o.value
}); });
this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () { this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () {

3
src/case/colorchooser/colorpicker/colorpicker.js

@ -161,7 +161,8 @@ BI.ColorPicker = BI.inherit(BI.Widget, {
}), }),
layouts: [{ layouts: [{
type: "bi.grid" type: "bi.grid"
}] }],
value: o.value
}); });
this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () { this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () {
self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments); self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments);

4
src/case/tree/tree.level.js

@ -12,7 +12,8 @@ BI.LevelTree = BI.inherit(BI.Widget, {
chooseType: 0 chooseType: 0
}, },
expander: {}, expander: {},
items: [] items: [],
value: ""
}); });
}, },
@ -81,6 +82,7 @@ BI.LevelTree = BI.inherit(BI.Widget, {
}, o.expander), }, o.expander),
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
el: BI.extend({ el: BI.extend({
type: "bi.button_tree", type: "bi.button_tree",

10
src/case/tree/tree.simple.js

@ -40,6 +40,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
if (BI.isNotEmptyArray(o.items)) { if (BI.isNotEmptyArray(o.items)) {
this.populate(); this.populate();
} }
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
}
}, },
populate: function (items, keyword) { populate: function (items, keyword) {
@ -51,7 +54,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
}); });
}, },
setValue: function (v) { _digest: function (v) {
v || (v = []); v || (v = []);
var self = this, map = {}; var self = this, map = {};
var selected = []; 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 () { _getValue: function () {

2
src/case/trigger/trigger.text.select.js

@ -22,7 +22,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
text: this._digest(o.text, o.items) text: this._digest(o.value, o.items)
}); });
}, },

9
src/widget/multilayerselecttree/multilayerselecttree.combo.js

@ -10,7 +10,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
isDefaultInit: false, isDefaultInit: false,
height: 30, height: 30,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -22,13 +23,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup", type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({

4
src/widget/multilayerselecttree/multilayerselecttree.leveltree.js

@ -10,7 +10,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
baseCls: "bi-multilayer-select-level-tree", baseCls: "bi-multilayer-select-level-tree",
isDefaultInit: false, isDefaultInit: false,
items: [], 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), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
value: o.value,
el: { el: {
type: "bi.button_tree", type: "bi.button_tree",

4
src/widget/multilayerselecttree/multilayerselecttree.popup.js

@ -13,7 +13,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
isDefaultInit: false, isDefaultInit: false,
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
items: [] items: [],
value: ""
}); });
}, },
@ -26,6 +27,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree", type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items, items: o.items,
value: o.value,
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator
}); });

9
src/widget/multilayersingletree/multilayersingletree.combo.js

@ -14,7 +14,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
height: 30, height: 30,
text: "", text: "",
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
items: [] items: [],
value: ""
}); });
}, },
@ -26,13 +27,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup", type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({

1
src/widget/multilayersingletree/multilayersingletree.leveltree.js

@ -80,6 +80,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
}, },
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) { o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0); callback(BI.Tree.transformToTreeFormat(items), 0);

3
src/widget/multilayersingletree/multilayersingletree.popup.js

@ -26,7 +26,8 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit, isDefaultInit: o.isDefaultInit,
items: o.items, items: o.items,
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator,
value: o.value
}); });
BI.createWidget({ BI.createWidget({

9
src/widget/selecttree/selecttree.combo.js

@ -9,7 +9,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
baseCls: "bi-select-tree-combo", baseCls: "bi-select-tree-combo",
height: 30, height: 30,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -21,12 +22,14 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.select_level_tree", type: "bi.select_level_tree",
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({

4
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), { return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-level-tree", baseCls: "bi-select-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
items: [] items: [],
value: ""
}); });
}, },
@ -58,6 +59,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true isDefaultInit: true
}, },
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)), items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
value: o.value,
chooseType: BI.Selection.Single chooseType: BI.Selection.Single
}); });

9
src/widget/singletree/singletree.combo.js

@ -10,7 +10,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
trigger: {}, trigger: {},
height: 24, height: 24,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -22,12 +23,14 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger", type: "bi.single_tree_trigger",
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items items: o.items,
value: o.value
}, o.trigger)); }, o.trigger));
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.single_level_tree", type: "bi.single_level_tree",
items: o.items items: o.items,
value: o.value
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({

4
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), { return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-level-tree", baseCls: "bi-single-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
items: [] items: [],
value: ""
}); });
}, },
@ -24,6 +25,7 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true isDefaultInit: true
}, },
items: o.items, items: o.items,
value: o.value,
chooseType: BI.Selection.Single chooseType: BI.Selection.Single
}); });

6
src/widget/singletree/singletree.trigger.js

@ -10,7 +10,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
baseCls: "bi-single-tree-trigger", baseCls: "bi-single-tree-trigger",
height: 24, height: 24,
text: "", text: "",
items: [] items: [],
value: ""
}); });
}, },
@ -24,7 +25,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
element: this, element: this,
text: o.text, text: o.text,
items: o.items, items: o.items,
height: o.height height: o.height,
value: o.value
}); });
}, },

6
src/widget/switchtree/switchtree.js

@ -33,7 +33,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
this.levelTree = BI.createWidget({ this.levelTree = BI.createWidget({
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
isDefaultInit: true, isDefaultInit: true,
items: BI.deepClone(o.items) items: BI.deepClone(o.items),
value: o.value
}); });
this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () { this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);
@ -42,7 +43,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
case BI.SwitchTree.SelectType.MultiSelect: case BI.SwitchTree.SelectType.MultiSelect:
this.tree = BI.createWidget({ this.tree = BI.createWidget({
type: "bi.simple_tree", 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 () { this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);

Loading…
Cancel
Save