Browse Source

tree加value状态

es6
windy 7 years ago
parent
commit
e1272d4606
  1. 134
      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. 3
      demo/js/widget/tree/demo.multilayer_select_level_tree.js
  6. 3
      demo/js/widget/tree/demo.multilayer_single_level_tree.js
  7. 5
      demo/js/widget/tree/demo.select_level_tree.js
  8. 5
      demo/js/widget/tree/demo.single_level_tree.js
  9. 3
      demo/js/widget/tree/demo.switchtree.js
  10. 94
      dist/base.js
  11. 240
      dist/bundle.js
  12. 78
      dist/case.js
  13. 168
      dist/demo.js
  14. 240
      dist/fineui.js
  15. 68
      dist/widget.js
  16. 23
      src/base/combination/combo.js
  17. 23
      src/base/combination/expander.js
  18. 10
      src/base/combination/searcher.js
  19. 21
      src/base/combination/switcher.js
  20. 2
      src/base/layer/layer.popup.js
  21. 6
      src/base/layer/layer.searcher.js
  22. 3
      src/base/tree/customtree.js
  23. 6
      src/base/tree/treeview.js
  24. 50
      src/case/colorchooser/colorchooser.js
  25. 9
      src/case/colorchooser/colorchooser.popup.js
  26. 3
      src/case/colorchooser/colorpicker/colorpicker.js
  27. 4
      src/case/tree/tree.level.js
  28. 10
      src/case/tree/tree.simple.js
  29. 2
      src/case/trigger/trigger.text.select.js
  30. 9
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  31. 4
      src/widget/multilayerselecttree/multilayerselecttree.leveltree.js
  32. 4
      src/widget/multilayerselecttree/multilayerselecttree.popup.js
  33. 9
      src/widget/multilayersingletree/multilayersingletree.combo.js
  34. 1
      src/widget/multilayersingletree/multilayersingletree.leveltree.js
  35. 3
      src/widget/multilayersingletree/multilayersingletree.popup.js
  36. 9
      src/widget/selecttree/selecttree.combo.js
  37. 4
      src/widget/selecttree/selecttree.popup.js
  38. 9
      src/widget/singletree/singletree.combo.js
  39. 4
      src/widget/singletree/singletree.popup.js
  40. 6
      src/widget/singletree/singletree.trigger.js
  41. 6
      src/widget/switchtree/switchtree.js

134
demo/js/case/tree/demo.simple_tree.js

@ -7,53 +7,97 @@ Demo.Func = BI.inherit(BI.Widget, {
// value值一定要是字符串
var tree = BI.createWidget({
type: "bi.simple_tree",
items: []
items: [{
id: 1,
text: "第一项",
value: "1"
}, {
id: 2,
text: "第二项",
value: "2"
}, {
id: 3,
text: "第三项",
value: "3",
open: true
}, {
id: 11,
pId: 1,
text: "子项1",
value: "11"
}, {
id: 12,
pId: 1,
text: "子项2",
value: "12"
}, {
id: 13,
pId: 1,
text: "子项3",
value: "13"
}, {
id: 31,
pId: 3,
text: "子项1",
value: "31"
}, {
id: 32,
pId: 3,
text: "子项2",
value: "32"
}, {
id: 33,
pId: 3,
text: "子项3",
value: "33"
}],
value: ["31", "32", "33"]
});
tree.populate([{
id: 1,
text: "第一项",
value: "1"
}, {
id: 2,
text: "第二项",
value: "2"
}, {
id: 3,
text: "第三项",
value: "3",
open: true
}, {
id: 11,
pId: 1,
text: "子项1",
value: "11"
}, {
id: 12,
pId: 1,
text: "子项2",
value: "12"
}, {
id: 13,
pId: 1,
text: "子项3",
value: "13"
}, {
id: 31,
pId: 3,
text: "子项1",
value: "31"
}, {
id: 32,
pId: 3,
text: "子项2",
value: "32"
}, {
id: 33,
pId: 3,
text: "子项3",
value: "33"
}], "z");
// tree.populate([{
// id: 1,
// text: "第一项",
// value: "1"
// }, {
// id: 2,
// text: "第二项",
// value: "2"
// }, {
// id: 3,
// text: "第三项",
// value: "3",
// open: true
// }, {
// id: 11,
// pId: 1,
// text: "子项1",
// value: "11"
// }, {
// id: 12,
// pId: 1,
// text: "子项2",
// value: "12"
// }, {
// id: 13,
// pId: 1,
// text: "子项3",
// value: "13"
// }, {
// id: 31,
// pId: 3,
// text: "子项1",
// value: "31"
// }, {
// id: 32,
// pId: 3,
// text: "子项2",
// value: "32"
// }, {
// id: 33,
// pId: 3,
// text: "子项3",
// value: "33"
// }], "z");
BI.createWidget({
type: "bi.vtape",
element: this,

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

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

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

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

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

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

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 tree = BI.createWidget({
type: "bi.multilayer_select_level_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE)
items: BI.deepClone(Demo.CONSTANTS.TREE),
value: "第五级文件1"
});
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 tree = BI.createWidget({
type: "bi.multilayer_single_level_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE)
items: BI.deepClone(Demo.CONSTANTS.TREE),
value: "第五级文件1"
});
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 tree = BI.createWidget({
type: "bi.select_level_tree",
items: BI.deepClone(Demo.CONSTANTS.LEVELTREE)
items: BI.deepClone(Demo.CONSTANTS.LEVELTREE),
value: "11"
});
return {
@ -32,7 +33,7 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, {
height: 25,
text: "setValue (第二级文件1)",
handler: function () {
tree.setValue(["第二级文件1"]);
tree.setValue(["2"]);
}
},
height: 25

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

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

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

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

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

240
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) {
node.halfCheck = false;
setNode(node.children);
});
this.nodes && this.nodes.checkAllNodes(checked);
this.nodes.checkAllNodes(checked);
},
expandAll: function (flag) {
@ -29002,14 +29006,17 @@ BI.Combo = BI.inherit(BI.Widget, {
},
_initCombo: function () {
this.combo = BI.createWidget(this.options.el);
this.combo = BI.createWidget(this.options.el, {
value: this.options.value
});
},
_assertPopupView: function () {
var self = this;
var self = this, o = this.options;
if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, {
type: "bi.popup_view"
type: "bi.popup_view",
value: o.value
});
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) {
@ -29200,14 +29207,20 @@ BI.Combo = BI.inherit(BI.Widget, {
},
setValue: function (v) {
this._assertPopupView();
this.combo.setValue(v);
this.popupView && this.popupView.setValue(v);
if (BI.isNull(this.popupView)) {
this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
},
getValue: function () {
this._assertPopupView();
return this.popupView && this.popupView.getValue();
if (BI.isNull(this.popupView)) {
return this.options.popup.value;
} else {
return this.popupView.getValue();
}
},
isViewVisible: function () {
@ -29386,11 +29399,13 @@ BI.Expander = BI.inherit(BI.Widget, {
},
_initExpander: function () {
this.expander = BI.createWidget(this.options.el);
this.expander = BI.createWidget(this.options.el, {
value: this.options.value
});
},
_assertPopupView: function () {
var self = this;
var self = this, o = this.options;
if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, {
type: "bi.button_group",
@ -29399,7 +29414,8 @@ BI.Expander = BI.inherit(BI.Widget, {
type: "bi.vertical",
hgap: 0,
vgap: 0
}]
}],
value: o.value
});
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -29463,14 +29479,20 @@ BI.Expander = BI.inherit(BI.Widget, {
},
setValue: function (v) {
// this._assertPopupView();
this.expander.setValue(v);
this.popupView && this.popupView.setValue(v);
if (BI.isNull(this.popupView)) {
this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
},
getValue: function () {
// this._assertPopupView();
return this.popupView ? this.popupView.getValue() : [];
if (BI.isNull(this.popupView)) {
return this.options.popup.value;
} else {
return this.popupView.getValue();
}
},
isViewVisible: function () {
@ -30362,8 +30384,11 @@ BI.Searcher = BI.inherit(BI.Widget, {
},
setValue: function (v) {
this._assertPopupView();
this.popupView && this.popupView.setValue(v);
if (BI.isNull(this.popupView)) {
this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
},
getKeyword: function () {
@ -30384,6 +30409,9 @@ BI.Searcher = BI.inherit(BI.Widget, {
} else if (o.adapter && o.adapter.getValue) {
return o.adapter.getValue();
}
if (BI.isNull(this.popupView)) {
return o.popup.value;
}
return this.popupView.getValue();
},
@ -30538,7 +30566,9 @@ BI.Switcher = BI.inherit(BI.Widget, {
},
_initSwitcher: function () {
this.switcher = BI.createWidget(this.options.el);
this.switcher = BI.createWidget(this.options.el, {
value: o.value
});
},
_assertPopupView: function () {
@ -30552,7 +30582,8 @@ BI.Switcher = BI.inherit(BI.Widget, {
type: "bi.vertical",
hgap: 0,
vgap: 0
}]
}],
value: o.value
});
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -30612,14 +30643,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
},
setValue: function (v) {
this._assertPopupView();
this.switcher.setValue(v);
this.popupView && this.popupView.setValue(v);
if (BI.isNull(this.popupView)) {
this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
},
getValue: function () {
this._assertPopupView();
return this.popupView ? this.popupView.getValue() : [];
if (BI.isNull(this.popupView)) {
return this.options.popup.value;
} else {
return this.popupView.getValue();
}
},
setAdapter: function (adapter) {
@ -41250,7 +41287,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () {
var o = this.options;
this.button_group = BI.createWidget(o.el, {type: "bi.button_group"});
this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value});
this.button_group.element.css({"min-height": o.minHeight + "px"});
return this.button_group;
},
@ -41382,7 +41419,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -41410,7 +41448,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -59844,7 +59883,8 @@ BI.CustomTree = BI.inherit(BI.Widget, {
args[0] = self._formatItems(items);
callback.apply(null, args);
}]);
}
},
value: o.value
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -65899,25 +65939,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_init: function () {
BI.ColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget(BI.extend({
type: "bi.color_chooser_trigger",
width: o.width,
height: o.height
}, o.el));
this.colorPicker = BI.createWidget({
type: "bi.color_chooser_popup"
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
adjustLength: 1,
el: this.trigger,
el: BI.extend({
type: "bi.color_chooser_trigger",
ref: function (_ref) {
self.trigger = _ref;
},
width: o.width,
height: o.height
}, o.el),
popup: {
el: this.colorPicker,
el: {
type: "bi.color_chooser_popup",
ref: function (_ref) {
self.colorPicker = _ref;
},
listeners: [{
eventName: BI.ColorChooserPopup.EVENT_VALUE_CHANGE,
action: function () {
fn();
}
}, {
eventName: BI.ColorChooserPopup.EVENT_CHANGE,
action: function () {
fn();
self.combo.hideView();
}
}]
},
stopPropagation: false,
minWidth: 202
}
},
value: o.value
});
var fn = function () {
@ -65930,15 +65987,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
que.unshift(color);
BI.Cache.setItem("colors", BI.array2String(que.toArray()));
};
this.colorPicker.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () {
fn();
});
this.colorPicker.on(BI.ColorChooserPopup.EVENT_CHANGE, function () {
fn();
self.combo.hideView();
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || ""));
});
@ -65965,7 +66013,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.colorPicker.getValue();
return this.combo.getValue();
}
});
BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
@ -65990,7 +66038,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
BI.ColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.colorEditor = BI.createWidget({
type: "bi.color_picker_editor"
type: "bi.color_picker_editor",
value: o.value
});
this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
@ -66026,7 +66075,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
disabled: true
}]],
width: 190,
height: 25
height: 25,
value: o.value
});
this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () {
self.setValue(this.getValue()[0]);
@ -66036,7 +66086,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
this.colorPicker = BI.createWidget({
type: "bi.color_picker",
width: 190,
height: 50
height: 50,
value: o.value
});
this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () {
@ -66449,7 +66500,8 @@ BI.ColorPicker = BI.inherit(BI.Widget, {
}),
layouts: [{
type: "bi.grid"
}]
}],
value: o.value
});
this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () {
self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments);
@ -75570,7 +75622,8 @@ BI.LevelTree = BI.inherit(BI.Widget, {
chooseType: 0
},
expander: {},
items: []
items: [],
value: ""
});
},
@ -75639,6 +75692,7 @@ BI.LevelTree = BI.inherit(BI.Widget, {
}, o.expander),
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
el: BI.extend({
type: "bi.button_tree",
@ -75730,6 +75784,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
if (BI.isNotEmptyArray(o.items)) {
this.populate();
}
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
}
},
populate: function (items, keyword) {
@ -75741,7 +75798,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
});
},
setValue: function (v) {
_digest: function (v) {
v || (v = []);
var self = this, map = {};
var selected = [];
@ -75769,8 +75826,11 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
}
}
});
return BI.makeObject(v.concat(selected));
},
this.tree.setValue(BI.makeObject(v.concat(selected)));
setValue: function (v) {
this.tree.setValue(this._digest(v));
},
_getValue: function () {
@ -76150,7 +76210,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.text_trigger",
element: this,
height: o.height,
text: this._digest(o.text, o.items)
text: this._digest(o.value, o.items)
});
},
@ -84041,7 +84101,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
isDefaultInit: false,
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -84053,13 +84114,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
});
this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -84110,7 +84173,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
baseCls: "bi-multilayer-select-level-tree",
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn
itemsCreator: BI.emptyFn,
value: ""
});
},
@ -84182,6 +84246,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
value: o.value,
el: {
type: "bi.button_tree",
@ -84240,7 +84305,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
tipText: BI.i18nText("BI-No_Selected_Item"),
isDefaultInit: false,
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -84253,6 +84319,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
value: o.value,
itemsCreator: o.itemsCreator
});
@ -84581,7 +84648,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
height: 30,
text: "",
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -84593,13 +84661,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
});
this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -84721,6 +84791,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0);
@ -84798,7 +84869,8 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator
itemsCreator: o.itemsCreator,
value: o.value
});
BI.createWidget({
@ -92395,7 +92467,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
baseCls: "bi-select-tree-combo",
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -92407,12 +92480,14 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
});
this.popup = BI.createWidget({
type: "bi.select_level_tree",
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -92534,7 +92609,8 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"),
items: []
items: [],
value: ""
});
},
@ -92583,6 +92659,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true
},
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
value: o.value,
chooseType: BI.Selection.Single
});
@ -96501,7 +96578,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
trigger: {},
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -96513,12 +96591,14 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
}, o.trigger));
this.popup = BI.createWidget({
type: "bi.single_level_tree",
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -96573,7 +96653,8 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"),
items: []
items: [],
value: ""
});
},
@ -96588,6 +96669,7 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true
},
items: o.items,
value: o.value,
chooseType: BI.Selection.Single
});
@ -96636,7 +96718,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
baseCls: "bi-single-tree-trigger",
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -96650,7 +96733,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
element: this,
text: o.text,
items: o.items,
height: o.height
height: o.height,
value: o.value
});
},
@ -96717,7 +96801,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
this.levelTree = BI.createWidget({
type: "bi.multilayer_single_level_tree",
isDefaultInit: true,
items: BI.deepClone(o.items)
items: BI.deepClone(o.items),
value: o.value
});
this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);
@ -96726,7 +96811,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
case BI.SwitchTree.SelectType.MultiSelect:
this.tree = BI.createWidget({
type: "bi.simple_tree",
items: this._removeIsParent(BI.deepClone(o.items))
items: this._removeIsParent(BI.deepClone(o.items)),
value: o.value
});
this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);

78
dist/case.js vendored

@ -3659,25 +3659,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_init: function () {
BI.ColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget(BI.extend({
type: "bi.color_chooser_trigger",
width: o.width,
height: o.height
}, o.el));
this.colorPicker = BI.createWidget({
type: "bi.color_chooser_popup"
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
adjustLength: 1,
el: this.trigger,
el: BI.extend({
type: "bi.color_chooser_trigger",
ref: function (_ref) {
self.trigger = _ref;
},
width: o.width,
height: o.height
}, o.el),
popup: {
el: this.colorPicker,
el: {
type: "bi.color_chooser_popup",
ref: function (_ref) {
self.colorPicker = _ref;
},
listeners: [{
eventName: BI.ColorChooserPopup.EVENT_VALUE_CHANGE,
action: function () {
fn();
}
}, {
eventName: BI.ColorChooserPopup.EVENT_CHANGE,
action: function () {
fn();
self.combo.hideView();
}
}]
},
stopPropagation: false,
minWidth: 202
}
},
value: o.value
});
var fn = function () {
@ -3690,15 +3707,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
que.unshift(color);
BI.Cache.setItem("colors", BI.array2String(que.toArray()));
};
this.colorPicker.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () {
fn();
});
this.colorPicker.on(BI.ColorChooserPopup.EVENT_CHANGE, function () {
fn();
self.combo.hideView();
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || ""));
});
@ -3725,7 +3733,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.colorPicker.getValue();
return this.combo.getValue();
}
});
BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
@ -3750,7 +3758,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
BI.ColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.colorEditor = BI.createWidget({
type: "bi.color_picker_editor"
type: "bi.color_picker_editor",
value: o.value
});
this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
@ -3786,7 +3795,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
disabled: true
}]],
width: 190,
height: 25
height: 25,
value: o.value
});
this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () {
self.setValue(this.getValue()[0]);
@ -3796,7 +3806,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
this.colorPicker = BI.createWidget({
type: "bi.color_picker",
width: 190,
height: 50
height: 50,
value: o.value
});
this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () {
@ -4209,7 +4220,8 @@ BI.ColorPicker = BI.inherit(BI.Widget, {
}),
layouts: [{
type: "bi.grid"
}]
}],
value: o.value
});
this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () {
self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments);
@ -13330,7 +13342,8 @@ BI.LevelTree = BI.inherit(BI.Widget, {
chooseType: 0
},
expander: {},
items: []
items: [],
value: ""
});
},
@ -13399,6 +13412,7 @@ BI.LevelTree = BI.inherit(BI.Widget, {
}, o.expander),
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
el: BI.extend({
type: "bi.button_tree",
@ -13490,6 +13504,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
if (BI.isNotEmptyArray(o.items)) {
this.populate();
}
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
}
},
populate: function (items, keyword) {
@ -13501,7 +13518,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
});
},
setValue: function (v) {
_digest: function (v) {
v || (v = []);
var self = this, map = {};
var selected = [];
@ -13529,8 +13546,11 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
}
}
});
return BI.makeObject(v.concat(selected));
},
this.tree.setValue(BI.makeObject(v.concat(selected)));
setValue: function (v) {
this.tree.setValue(this._digest(v));
},
_getValue: function () {
@ -13910,7 +13930,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.text_trigger",
element: this,
height: o.height,
text: this._digest(o.text, o.items)
text: this._digest(o.value, o.items)
});
},

168
dist/demo.js vendored

@ -3735,53 +3735,97 @@ BI.shortcut("demo.level_tree", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
// value值一定要是字符串
var tree = BI.createWidget({
type: "bi.simple_tree",
items: []
});
tree.populate([{
id: 1,
text: "第一项",
value: "1"
}, {
id: 2,
text: "第二项",
value: "2"
}, {
id: 3,
text: "第三项",
value: "3",
open: true
}, {
id: 11,
pId: 1,
text: "子项1",
value: "11"
}, {
id: 12,
pId: 1,
text: "子项2",
value: "12"
}, {
id: 13,
pId: 1,
text: "子项3",
value: "13"
}, {
id: 31,
pId: 3,
text: "子项1",
value: "31"
}, {
id: 32,
pId: 3,
text: "子项2",
value: "32"
}, {
id: 33,
pId: 3,
text: "子项3",
value: "33"
}], "z");
items: [{
id: 1,
text: "第一项",
value: "1"
}, {
id: 2,
text: "第二项",
value: "2"
}, {
id: 3,
text: "第三项",
value: "3",
open: true
}, {
id: 11,
pId: 1,
text: "子项1",
value: "11"
}, {
id: 12,
pId: 1,
text: "子项2",
value: "12"
}, {
id: 13,
pId: 1,
text: "子项3",
value: "13"
}, {
id: 31,
pId: 3,
text: "子项1",
value: "31"
}, {
id: 32,
pId: 3,
text: "子项2",
value: "32"
}, {
id: 33,
pId: 3,
text: "子项3",
value: "33"
}],
value: ["31", "32", "33"]
});
// tree.populate([{
// id: 1,
// text: "第一项",
// value: "1"
// }, {
// id: 2,
// text: "第二项",
// value: "2"
// }, {
// id: 3,
// text: "第三项",
// value: "3",
// open: true
// }, {
// id: 11,
// pId: 1,
// text: "子项1",
// value: "11"
// }, {
// id: 12,
// pId: 1,
// text: "子项2",
// value: "12"
// }, {
// id: 13,
// pId: 1,
// text: "子项3",
// value: "13"
// }, {
// id: 31,
// pId: 3,
// text: "子项1",
// value: "31"
// }, {
// id: 32,
// pId: 3,
// text: "子项2",
// value: "32"
// }, {
// id: 33,
// pId: 3,
// text: "子项3",
// value: "33"
// }], "z");
BI.createWidget({
type: "bi.vtape",
element: this,
@ -13177,7 +13221,8 @@ Demo.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
},
text: "默认值",
items: items,
width: 300
width: 300,
value: ["第五级文件1"]
}, {
type: "bi.button",
text: "getVlaue",
@ -13216,6 +13261,7 @@ Demo.SelectTreeCombo = BI.inherit(BI.Widget, {
ref: function (_ref) {
self.tree = _ref;
},
value: "11",
text: "默认值",
items: items,
width: 300
@ -13230,7 +13276,7 @@ Demo.SelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.button",
text: "setVlaue (第二级文件1)",
handler: function () {
self.tree.setValue(["第二级文件1"]);
self.tree.setValue(["2"]);
},
width: 300
}],
@ -13395,7 +13441,8 @@ Demo.SingleTreeCombo = BI.inherit(BI.Widget, {
},
text: "默认值",
items: items,
width: 300
width: 300,
value: "11"
}, {
type: "bi.button",
text: "getVlaue",
@ -13407,7 +13454,7 @@ Demo.SingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.button",
text: "setVlaue (第二级文件1)",
handler: function () {
self.tree.setValue(["第二级文件1"]);
self.tree.setValue(["2"]);
},
width: 300
}],
@ -14347,7 +14394,8 @@ Demo.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
var self = this;
var tree = BI.createWidget({
type: "bi.multilayer_select_level_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE)
items: BI.deepClone(Demo.CONSTANTS.TREE),
value: "第五级文件1"
});
return {
@ -14392,7 +14440,8 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
var self = this;
var tree = BI.createWidget({
type: "bi.multilayer_single_level_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE)
items: BI.deepClone(Demo.CONSTANTS.TREE),
value: "第五级文件1"
});
return {
@ -14437,7 +14486,8 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, {
var self = this;
var tree = BI.createWidget({
type: "bi.select_level_tree",
items: BI.deepClone(Demo.CONSTANTS.LEVELTREE)
items: BI.deepClone(Demo.CONSTANTS.LEVELTREE),
value: "11"
});
return {
@ -14460,7 +14510,7 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, {
height: 25,
text: "setValue (第二级文件1)",
handler: function () {
tree.setValue(["第二级文件1"]);
tree.setValue(["2"]);
}
},
height: 25
@ -14482,7 +14532,8 @@ Demo.SingleLevelTree = BI.inherit(BI.Widget, {
var self = this;
var tree = BI.createWidget({
type: "bi.single_level_tree",
items: BI.deepClone(Demo.CONSTANTS.LEVELTREE)
items: BI.deepClone(Demo.CONSTANTS.LEVELTREE),
value: "11"
});
return {
@ -14505,7 +14556,7 @@ Demo.SingleLevelTree = BI.inherit(BI.Widget, {
height: 25,
text: "setValue (第二级文件1)",
handler: function () {
tree.setValue(["第二级文件1"]);
tree.setValue(["2"]);
}
},
height: 25
@ -14527,7 +14578,8 @@ Demo.SwitchTree = BI.inherit(BI.Widget, {
var self = this;
var tree = BI.createWidget({
type: "bi.switch_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE)
items: BI.deepClone(Demo.CONSTANTS.TREE),
value: "第五级文件1"
});
return {

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) {
node.halfCheck = false;
setNode(node.children);
});
this.nodes && this.nodes.checkAllNodes(checked);
this.nodes.checkAllNodes(checked);
},
expandAll: function (flag) {
@ -30696,14 +30700,17 @@ BI.Combo = BI.inherit(BI.Widget, {
},
_initCombo: function () {
this.combo = BI.createWidget(this.options.el);
this.combo = BI.createWidget(this.options.el, {
value: this.options.value
});
},
_assertPopupView: function () {
var self = this;
var self = this, o = this.options;
if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, {
type: "bi.popup_view"
type: "bi.popup_view",
value: o.value
});
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) {
@ -30894,14 +30901,20 @@ BI.Combo = BI.inherit(BI.Widget, {
},
setValue: function (v) {
this._assertPopupView();
this.combo.setValue(v);
this.popupView && this.popupView.setValue(v);
if (BI.isNull(this.popupView)) {
this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
},
getValue: function () {
this._assertPopupView();
return this.popupView && this.popupView.getValue();
if (BI.isNull(this.popupView)) {
return this.options.popup.value;
} else {
return this.popupView.getValue();
}
},
isViewVisible: function () {
@ -31080,11 +31093,13 @@ BI.Expander = BI.inherit(BI.Widget, {
},
_initExpander: function () {
this.expander = BI.createWidget(this.options.el);
this.expander = BI.createWidget(this.options.el, {
value: this.options.value
});
},
_assertPopupView: function () {
var self = this;
var self = this, o = this.options;
if (this.popupView == null) {
this.popupView = BI.createWidget(this.options.popup, {
type: "bi.button_group",
@ -31093,7 +31108,8 @@ BI.Expander = BI.inherit(BI.Widget, {
type: "bi.vertical",
hgap: 0,
vgap: 0
}]
}],
value: o.value
});
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -31157,14 +31173,20 @@ BI.Expander = BI.inherit(BI.Widget, {
},
setValue: function (v) {
// this._assertPopupView();
this.expander.setValue(v);
this.popupView && this.popupView.setValue(v);
if (BI.isNull(this.popupView)) {
this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
},
getValue: function () {
// this._assertPopupView();
return this.popupView ? this.popupView.getValue() : [];
if (BI.isNull(this.popupView)) {
return this.options.popup.value;
} else {
return this.popupView.getValue();
}
},
isViewVisible: function () {
@ -32056,8 +32078,11 @@ BI.Searcher = BI.inherit(BI.Widget, {
},
setValue: function (v) {
this._assertPopupView();
this.popupView && this.popupView.setValue(v);
if (BI.isNull(this.popupView)) {
this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
},
getKeyword: function () {
@ -32078,6 +32103,9 @@ BI.Searcher = BI.inherit(BI.Widget, {
} else if (o.adapter && o.adapter.getValue) {
return o.adapter.getValue();
}
if (BI.isNull(this.popupView)) {
return o.popup.value;
}
return this.popupView.getValue();
},
@ -32232,7 +32260,9 @@ BI.Switcher = BI.inherit(BI.Widget, {
},
_initSwitcher: function () {
this.switcher = BI.createWidget(this.options.el);
this.switcher = BI.createWidget(this.options.el, {
value: o.value
});
},
_assertPopupView: function () {
@ -32246,7 +32276,8 @@ BI.Switcher = BI.inherit(BI.Widget, {
type: "bi.vertical",
hgap: 0,
vgap: 0
}]
}],
value: o.value
});
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -32306,14 +32337,20 @@ BI.Switcher = BI.inherit(BI.Widget, {
},
setValue: function (v) {
this._assertPopupView();
this.switcher.setValue(v);
this.popupView && this.popupView.setValue(v);
if (BI.isNull(this.popupView)) {
this.options.popup.value = v;
} else {
this.popupView.setValue(v);
}
},
getValue: function () {
this._assertPopupView();
return this.popupView ? this.popupView.getValue() : [];
if (BI.isNull(this.popupView)) {
return this.options.popup.value;
} else {
return this.popupView.getValue();
}
},
setAdapter: function (adapter) {
@ -42944,7 +42981,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () {
var o = this.options;
this.button_group = BI.createWidget(o.el, {type: "bi.button_group"});
this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value});
this.button_group.element.css({"min-height": o.minHeight + "px"});
return this.button_group;
},
@ -43076,7 +43113,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.matcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -43104,7 +43142,8 @@ BI.SearcherView = BI.inherit(BI.Pane, {
},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.searcher.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -61538,7 +61577,8 @@ BI.CustomTree = BI.inherit(BI.Widget, {
args[0] = self._formatItems(items);
callback.apply(null, args);
}]);
}
},
value: o.value
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -67593,25 +67633,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_init: function () {
BI.ColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget(BI.extend({
type: "bi.color_chooser_trigger",
width: o.width,
height: o.height
}, o.el));
this.colorPicker = BI.createWidget({
type: "bi.color_chooser_popup"
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
adjustLength: 1,
el: this.trigger,
el: BI.extend({
type: "bi.color_chooser_trigger",
ref: function (_ref) {
self.trigger = _ref;
},
width: o.width,
height: o.height
}, o.el),
popup: {
el: this.colorPicker,
el: {
type: "bi.color_chooser_popup",
ref: function (_ref) {
self.colorPicker = _ref;
},
listeners: [{
eventName: BI.ColorChooserPopup.EVENT_VALUE_CHANGE,
action: function () {
fn();
}
}, {
eventName: BI.ColorChooserPopup.EVENT_CHANGE,
action: function () {
fn();
self.combo.hideView();
}
}]
},
stopPropagation: false,
minWidth: 202
}
},
value: o.value
});
var fn = function () {
@ -67624,15 +67681,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
que.unshift(color);
BI.Cache.setItem("colors", BI.array2String(que.toArray()));
};
this.colorPicker.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () {
fn();
});
this.colorPicker.on(BI.ColorChooserPopup.EVENT_CHANGE, function () {
fn();
self.combo.hideView();
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || ""));
});
@ -67659,7 +67707,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.colorPicker.getValue();
return this.combo.getValue();
}
});
BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
@ -67684,7 +67732,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
BI.ColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.colorEditor = BI.createWidget({
type: "bi.color_picker_editor"
type: "bi.color_picker_editor",
value: o.value
});
this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
@ -67720,7 +67769,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
disabled: true
}]],
width: 190,
height: 25
height: 25,
value: o.value
});
this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () {
self.setValue(this.getValue()[0]);
@ -67730,7 +67780,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
this.colorPicker = BI.createWidget({
type: "bi.color_picker",
width: 190,
height: 50
height: 50,
value: o.value
});
this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () {
@ -68143,7 +68194,8 @@ BI.ColorPicker = BI.inherit(BI.Widget, {
}),
layouts: [{
type: "bi.grid"
}]
}],
value: o.value
});
this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () {
self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments);
@ -77264,7 +77316,8 @@ BI.LevelTree = BI.inherit(BI.Widget, {
chooseType: 0
},
expander: {},
items: []
items: [],
value: ""
});
},
@ -77333,6 +77386,7 @@ BI.LevelTree = BI.inherit(BI.Widget, {
}, o.expander),
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
el: BI.extend({
type: "bi.button_tree",
@ -77424,6 +77478,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
if (BI.isNotEmptyArray(o.items)) {
this.populate();
}
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
}
},
populate: function (items, keyword) {
@ -77435,7 +77492,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
});
},
setValue: function (v) {
_digest: function (v) {
v || (v = []);
var self = this, map = {};
var selected = [];
@ -77463,8 +77520,11 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
}
}
});
return BI.makeObject(v.concat(selected));
},
this.tree.setValue(BI.makeObject(v.concat(selected)));
setValue: function (v) {
this.tree.setValue(this._digest(v));
},
_getValue: function () {
@ -77844,7 +77904,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.text_trigger",
element: this,
height: o.height,
text: this._digest(o.text, o.items)
text: this._digest(o.value, o.items)
});
},
@ -85735,7 +85795,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
isDefaultInit: false,
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -85747,13 +85808,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
});
this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -85804,7 +85867,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
baseCls: "bi-multilayer-select-level-tree",
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn
itemsCreator: BI.emptyFn,
value: ""
});
},
@ -85876,6 +85940,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
value: o.value,
el: {
type: "bi.button_tree",
@ -85934,7 +85999,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
tipText: BI.i18nText("BI-No_Selected_Item"),
isDefaultInit: false,
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -85947,6 +86013,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
value: o.value,
itemsCreator: o.itemsCreator
});
@ -86275,7 +86342,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
height: 30,
text: "",
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -86287,13 +86355,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
});
this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -86415,6 +86485,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0);
@ -86492,7 +86563,8 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator
itemsCreator: o.itemsCreator,
value: o.value
});
BI.createWidget({
@ -94089,7 +94161,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
baseCls: "bi-select-tree-combo",
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -94101,12 +94174,14 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
});
this.popup = BI.createWidget({
type: "bi.select_level_tree",
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -94228,7 +94303,8 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"),
items: []
items: [],
value: ""
});
},
@ -94277,6 +94353,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true
},
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
value: o.value,
chooseType: BI.Selection.Single
});
@ -98195,7 +98272,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
trigger: {},
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -98207,12 +98285,14 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
}, o.trigger));
this.popup = BI.createWidget({
type: "bi.single_level_tree",
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -98267,7 +98347,8 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"),
items: []
items: [],
value: ""
});
},
@ -98282,6 +98363,7 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true
},
items: o.items,
value: o.value,
chooseType: BI.Selection.Single
});
@ -98330,7 +98412,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
baseCls: "bi-single-tree-trigger",
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -98344,7 +98427,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
element: this,
text: o.text,
items: o.items,
height: o.height
height: o.height,
value: o.value
});
},
@ -98411,7 +98495,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
this.levelTree = BI.createWidget({
type: "bi.multilayer_single_level_tree",
isDefaultInit: true,
items: BI.deepClone(o.items)
items: BI.deepClone(o.items),
value: o.value
});
this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);
@ -98420,7 +98505,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
case BI.SwitchTree.SelectType.MultiSelect:
this.tree = BI.createWidget({
type: "bi.simple_tree",
items: this._removeIsParent(BI.deepClone(o.items))
items: this._removeIsParent(BI.deepClone(o.items)),
value: o.value
});
this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);

68
dist/widget.js vendored

@ -7742,7 +7742,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
isDefaultInit: false,
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -7754,13 +7755,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
});
this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -7811,7 +7814,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
baseCls: "bi-multilayer-select-level-tree",
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn
itemsCreator: BI.emptyFn,
value: ""
});
},
@ -7883,6 +7887,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
value: o.value,
el: {
type: "bi.button_tree",
@ -7941,7 +7946,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
tipText: BI.i18nText("BI-No_Selected_Item"),
isDefaultInit: false,
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -7954,6 +7960,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
value: o.value,
itemsCreator: o.itemsCreator
});
@ -8282,7 +8289,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
height: 30,
text: "",
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -8294,13 +8302,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
});
this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -8422,6 +8432,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0);
@ -8499,7 +8510,8 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator
itemsCreator: o.itemsCreator,
value: o.value
});
BI.createWidget({
@ -16096,7 +16108,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
baseCls: "bi-select-tree-combo",
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -16108,12 +16121,14 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
});
this.popup = BI.createWidget({
type: "bi.select_level_tree",
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -16235,7 +16250,8 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"),
items: []
items: [],
value: ""
});
},
@ -16284,6 +16300,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true
},
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
value: o.value,
chooseType: BI.Selection.Single
});
@ -20202,7 +20219,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
trigger: {},
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -20214,12 +20232,14 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items
items: o.items,
value: o.value
}, o.trigger));
this.popup = BI.createWidget({
type: "bi.single_level_tree",
items: o.items
items: o.items,
value: o.value
});
this.combo = BI.createWidget({
@ -20274,7 +20294,8 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"),
items: []
items: [],
value: ""
});
},
@ -20289,6 +20310,7 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true
},
items: o.items,
value: o.value,
chooseType: BI.Selection.Single
});
@ -20337,7 +20359,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
baseCls: "bi-single-tree-trigger",
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -20351,7 +20374,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
element: this,
text: o.text,
items: o.items,
height: o.height
height: o.height,
value: o.value
});
},
@ -20418,7 +20442,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
this.levelTree = BI.createWidget({
type: "bi.multilayer_single_level_tree",
isDefaultInit: true,
items: BI.deepClone(o.items)
items: BI.deepClone(o.items),
value: o.value
});
this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);
@ -20427,7 +20452,8 @@ BI.SwitchTree = BI.inherit(BI.Widget, {
case BI.SwitchTree.SelectType.MultiSelect:
this.tree = BI.createWidget({
type: "bi.simple_tree",
items: this._removeIsParent(BI.deepClone(o.items))
items: this._removeIsParent(BI.deepClone(o.items)),
value: o.value
});
this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments);

23
src/base/combination/combo.js

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

23
src/base/combination/expander.js

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

10
src/base/combination/searcher.js

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

21
src/base/combination/switcher.js

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

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

@ -93,7 +93,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () {
var o = this.options;
this.button_group = BI.createWidget(o.el, {type: "bi.button_group"});
this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value});
this.button_group.element.css({"min-height": o.minHeight + "px"});
return this.button_group;
},

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

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

3
src/base/tree/customtree.js

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

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

50
src/case/colorchooser/colorchooser.js

@ -17,25 +17,42 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_init: function () {
BI.ColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget(BI.extend({
type: "bi.color_chooser_trigger",
width: o.width,
height: o.height
}, o.el));
this.colorPicker = BI.createWidget({
type: "bi.color_chooser_popup"
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
adjustLength: 1,
el: this.trigger,
el: BI.extend({
type: "bi.color_chooser_trigger",
ref: function (_ref) {
self.trigger = _ref;
},
width: o.width,
height: o.height
}, o.el),
popup: {
el: this.colorPicker,
el: {
type: "bi.color_chooser_popup",
ref: function (_ref) {
self.colorPicker = _ref;
},
listeners: [{
eventName: BI.ColorChooserPopup.EVENT_VALUE_CHANGE,
action: function () {
fn();
}
}, {
eventName: BI.ColorChooserPopup.EVENT_CHANGE,
action: function () {
fn();
self.combo.hideView();
}
}]
},
stopPropagation: false,
minWidth: 202
}
},
value: o.value
});
var fn = function () {
@ -48,15 +65,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
que.unshift(color);
BI.Cache.setItem("colors", BI.array2String(que.toArray()));
};
this.colorPicker.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () {
fn();
});
this.colorPicker.on(BI.ColorChooserPopup.EVENT_CHANGE, function () {
fn();
self.combo.hideView();
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || ""));
});
@ -83,7 +91,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.colorPicker.getValue();
return this.combo.getValue();
}
});
BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";

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

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

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

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

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

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

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

@ -40,6 +40,9 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
if (BI.isNotEmptyArray(o.items)) {
this.populate();
}
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
}
},
populate: function (items, keyword) {
@ -51,7 +54,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
});
},
setValue: function (v) {
_digest: function (v) {
v || (v = []);
var self = this, map = {};
var selected = [];
@ -79,8 +82,11 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
}
}
});
return BI.makeObject(v.concat(selected));
},
this.tree.setValue(BI.makeObject(v.concat(selected)));
setValue: function (v) {
this.tree.setValue(this._digest(v));
},
_getValue: function () {

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

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

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

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

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

@ -10,7 +10,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
baseCls: "bi-multilayer-select-level-tree",
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn
itemsCreator: BI.emptyFn,
value: ""
});
},
@ -82,6 +83,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
value: o.value,
el: {
type: "bi.button_tree",

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

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

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

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

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),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
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",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator
itemsCreator: o.itemsCreator,
value: o.value
});
BI.createWidget({

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

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

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

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

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

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), {
baseCls: "bi-single-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"),
items: []
items: [],
value: ""
});
},
@ -24,6 +25,7 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true
},
items: o.items,
value: o.value,
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",
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -24,7 +25,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
element: this,
text: o.text,
items: o.items,
height: o.height
height: o.height,
value: o.value
});
},

6
src/widget/switchtree/switchtree.js

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

Loading…
Cancel
Save