Browse Source

Merge pull request #295 in ~GUY/fineui from ~WINDY/fineui:master to master

* commit 'b68f3890e77dacac8629135941084dcb8ca2adcf':
  tree加value状态
es6
windy 7 years ago
parent
commit
c3952639e8
  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. 242
      dist/bundle.js
  12. 78
      dist/case.js
  13. 168
      dist/demo.js
  14. 242
      dist/fineui.js
  15. 70
      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. 6
      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);

242
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);
@ -65898,25 +65938,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 () {
@ -65929,15 +65986,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") || ""));
});
@ -65964,7 +66012,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.colorPicker.getValue();
return this.combo.getValue();
}
});
BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
@ -65989,7 +66037,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 () {
@ -66025,7 +66074,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]);
@ -66035,7 +66085,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 () {
@ -66448,7 +66499,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);
@ -75569,7 +75621,8 @@ BI.LevelTree = BI.inherit(BI.Widget, {
chooseType: 0
},
expander: {},
items: []
items: [],
value: ""
});
},
@ -75638,6 +75691,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",
@ -75729,6 +75783,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) {
@ -75740,7 +75797,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
});
},
setValue: function (v) {
_digest: function (v) {
v || (v = []);
var self = this, map = {};
var selected = [];
@ -75768,8 +75825,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 () {
@ -76149,7 +76209,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)
});
},
@ -84039,7 +84099,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
isDefaultInit: false,
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -84051,13 +84112,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({
@ -84108,7 +84171,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
baseCls: "bi-multilayer-select-level-tree",
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn
itemsCreator: BI.emptyFn,
value: ""
});
},
@ -84180,6 +84244,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",
@ -84238,7 +84303,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
tipText: BI.i18nText("BI-No_Selected_Item"),
isDefaultInit: false,
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -84251,6 +84317,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
});
@ -84579,7 +84646,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
height: 30,
text: "",
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -84591,13 +84659,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({
@ -84719,6 +84789,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);
@ -84796,7 +84867,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({
@ -92393,7 +92465,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
baseCls: "bi-select-tree-combo",
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -92405,12 +92478,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({
@ -92532,7 +92607,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: ""
});
},
@ -92581,6 +92657,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true
},
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
value: o.value,
chooseType: BI.Selection.Single
});
@ -96499,7 +96576,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
trigger: {},
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -96511,12 +96589,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({
@ -96571,7 +96651,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: ""
});
},
@ -96579,13 +96660,14 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
BI.SingleTreePopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.tree = BI.createWidget({
type: "bi.level_tree",
expander: {
isDefaultInit: true
},
items: o.items,
value: o.value,
chooseType: BI.Selection.Single
});
@ -96634,7 +96716,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
baseCls: "bi-single-tree-trigger",
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -96648,7 +96731,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
element: this,
text: o.text,
items: o.items,
height: o.height
height: o.height,
value: o.value
});
},
@ -96715,7 +96799,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);
@ -96724,7 +96809,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

@ -3658,25 +3658,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 () {
@ -3689,15 +3706,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") || ""));
});
@ -3724,7 +3732,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.colorPicker.getValue();
return this.combo.getValue();
}
});
BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
@ -3749,7 +3757,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 () {
@ -3785,7 +3794,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]);
@ -3795,7 +3805,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 () {
@ -4208,7 +4219,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);
@ -13329,7 +13341,8 @@ BI.LevelTree = BI.inherit(BI.Widget, {
chooseType: 0
},
expander: {},
items: []
items: [],
value: ""
});
},
@ -13398,6 +13411,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",
@ -13489,6 +13503,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) {
@ -13500,7 +13517,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
});
},
setValue: function (v) {
_digest: function (v) {
v || (v = []);
var self = this, map = {};
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 () {
@ -13909,7 +13929,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,
@ -13122,7 +13166,8 @@ Demo.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
},
text: "默认值",
items: items,
width: 300
width: 300,
value: ["第五级文件1"]
}, {
type: "bi.button",
text: "getVlaue",
@ -13161,6 +13206,7 @@ Demo.SelectTreeCombo = BI.inherit(BI.Widget, {
ref: function (_ref) {
self.tree = _ref;
},
value: "11",
text: "默认值",
items: items,
width: 300
@ -13175,7 +13221,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
}],
@ -13340,7 +13386,8 @@ Demo.SingleTreeCombo = BI.inherit(BI.Widget, {
},
text: "默认值",
items: items,
width: 300
width: 300,
value: "11"
}, {
type: "bi.button",
text: "getVlaue",
@ -13352,7 +13399,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
}],
@ -14292,7 +14339,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 {
@ -14337,7 +14385,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 {
@ -14382,7 +14431,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 {
@ -14405,7 +14455,7 @@ Demo.SelectLevelTree = BI.inherit(BI.Widget, {
height: 25,
text: "setValue (第二级文件1)",
handler: function () {
tree.setValue(["第二级文件1"]);
tree.setValue(["2"]);
}
},
height: 25
@ -14427,7 +14477,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 {
@ -14450,7 +14501,7 @@ Demo.SingleLevelTree = BI.inherit(BI.Widget, {
height: 25,
text: "setValue (第二级文件1)",
handler: function () {
tree.setValue(["第二级文件1"]);
tree.setValue(["2"]);
}
},
height: 25
@ -14472,7 +14523,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 {

242
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);
@ -67592,25 +67632,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 () {
@ -67623,15 +67680,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") || ""));
});
@ -67658,7 +67706,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.colorPicker.getValue();
return this.combo.getValue();
}
});
BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
@ -67683,7 +67731,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 () {
@ -67719,7 +67768,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]);
@ -67729,7 +67779,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 () {
@ -68142,7 +68193,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);
@ -77263,7 +77315,8 @@ BI.LevelTree = BI.inherit(BI.Widget, {
chooseType: 0
},
expander: {},
items: []
items: [],
value: ""
});
},
@ -77332,6 +77385,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",
@ -77423,6 +77477,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) {
@ -77434,7 +77491,7 @@ BI.SimpleTreeView = BI.inherit(BI.Widget, {
});
},
setValue: function (v) {
_digest: function (v) {
v || (v = []);
var self = this, map = {};
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 () {
@ -77843,7 +77903,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)
});
},
@ -85733,7 +85793,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
isDefaultInit: false,
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -85745,13 +85806,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({
@ -85802,7 +85865,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
baseCls: "bi-multilayer-select-level-tree",
isDefaultInit: false,
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),
itemsCreator: o.itemsCreator,
value: o.value,
el: {
type: "bi.button_tree",
@ -85932,7 +85997,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
tipText: BI.i18nText("BI-No_Selected_Item"),
isDefaultInit: false,
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -85945,6 +86011,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
});
@ -86273,7 +86340,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
height: 30,
text: "",
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -86285,13 +86353,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({
@ -86413,6 +86483,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);
@ -86490,7 +86561,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({
@ -94087,7 +94159,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
baseCls: "bi-select-tree-combo",
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -94099,12 +94172,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({
@ -94226,7 +94301,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: ""
});
},
@ -94275,6 +94351,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true
},
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
value: o.value,
chooseType: BI.Selection.Single
});
@ -98193,7 +98270,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
trigger: {},
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -98205,12 +98283,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({
@ -98265,7 +98345,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: ""
});
},
@ -98273,13 +98354,14 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
BI.SingleTreePopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.tree = BI.createWidget({
type: "bi.level_tree",
expander: {
isDefaultInit: true
},
items: o.items,
value: o.value,
chooseType: BI.Selection.Single
});
@ -98328,7 +98410,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
baseCls: "bi-single-tree-trigger",
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -98342,7 +98425,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
element: this,
text: o.text,
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({
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);
@ -98418,7 +98503,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);

70
dist/widget.js vendored

@ -7741,7 +7741,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
isDefaultInit: false,
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -7753,13 +7754,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({
@ -7810,7 +7813,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
baseCls: "bi-multilayer-select-level-tree",
isDefaultInit: false,
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),
itemsCreator: o.itemsCreator,
value: o.value,
el: {
type: "bi.button_tree",
@ -7940,7 +7945,8 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
tipText: BI.i18nText("BI-No_Selected_Item"),
isDefaultInit: false,
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -7953,6 +7959,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
});
@ -8281,7 +8288,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
height: 30,
text: "",
itemsCreator: BI.emptyFn,
items: []
items: [],
value: ""
});
},
@ -8293,13 +8301,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({
@ -8421,6 +8431,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);
@ -8498,7 +8509,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({
@ -16095,7 +16107,8 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, {
baseCls: "bi-select-tree-combo",
height: 30,
text: "",
items: []
items: [],
value: ""
});
},
@ -16107,12 +16120,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({
@ -16234,7 +16249,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: ""
});
},
@ -16283,6 +16299,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
isDefaultInit: true
},
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
value: o.value,
chooseType: BI.Selection.Single
});
@ -20201,7 +20218,8 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, {
trigger: {},
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -20213,12 +20231,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({
@ -20273,7 +20293,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: ""
});
},
@ -20281,13 +20302,14 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
BI.SingleTreePopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.tree = BI.createWidget({
type: "bi.level_tree",
expander: {
isDefaultInit: true
},
items: o.items,
value: o.value,
chooseType: BI.Selection.Single
});
@ -20336,7 +20358,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
baseCls: "bi-single-tree-trigger",
height: 24,
text: "",
items: []
items: [],
value: ""
});
},
@ -20350,7 +20373,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, {
element: this,
text: o.text,
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({
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);
@ -20426,7 +20451,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({

6
src/widget/singletree/singletree.popup.js

@ -9,7 +9,8 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-level-tree",
tipText: BI.i18nText("BI-No_Selected_Item"),
items: []
items: [],
value: ""
});
},
@ -17,13 +18,14 @@ BI.SingleTreePopup = BI.inherit(BI.Pane, {
BI.SingleTreePopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.tree = BI.createWidget({
type: "bi.level_tree",
expander: {
isDefaultInit: true
},
items: o.items,
value: o.value,
chooseType: BI.Selection.Single
});

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