Browse Source

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

* commit '76909b78712e67adb93254bb0ec01bda0abab77c':
  combo设置状态value后的问题
  multiselectbar加上selected和halfSeleced
  sqleditor supportParam
  value传值 editor
es6
guy 7 years ago
parent
commit
1691b078da
  1. 22
      demo/js/base/button/demo.button.js
  2. 1
      demo/js/base/editor/demo.editor.js
  3. 1
      demo/js/base/editor/demo.sql_editor.js
  4. 3
      demo/js/case/combo/demo.icon_text_value_combo.js
  5. 23
      dist/base.js
  6. 57
      dist/bundle.js
  7. 34
      dist/case.js
  8. 27
      dist/demo.js
  9. 57
      dist/fineui.js
  10. 9
      src/base/combination/group.button.js
  11. 4
      src/base/single/editor/editor.js
  12. 3
      src/base/single/input/input.js
  13. 7
      src/base/sql/editor.sql.js
  14. 1
      src/case/combo/icontextvaluecombo/combo.icontextvalue.js
  15. 4
      src/case/combo/staticcombo/combo.static.js
  16. 3
      src/case/combo/textvaluecombo/popup.textvalue.js
  17. 24
      src/case/toolbar/toolbar.multiselect.js
  18. 2
      src/case/trigger/trigger.icon.text.select.js

22
demo/js/base/button/demo.button.js

@ -177,6 +177,28 @@ Demo.Button = BI.inherit(BI.Widget, {
iconClass: "close-font",
height: 30
}
}, {
el: {
type: "bi.multi_select_bar",
selected: true,
halfSelected: true
}
}, {
el: {
type: "bi.multi_select_bar",
selected: true,
halfSelected: false
}
}, {
el: {
type: "bi.multi_select_bar",
selected: false,
halfSelected: true
}
}, {
el: {
type: "bi.multi_select_bar"
}
}
];
BI.each(items, function (i, item) {

1
demo/js/base/editor/demo.editor.js

@ -35,6 +35,7 @@ Demo.Editor = BI.inherit(BI.Widget, {
cls: "mvc-border",
watermark: "输入'a'会有错误信息且回车键不能退出编辑",
errorText: "字段不可重名",
value: "a",
validationChecker: function (v) {
if (v == "a") {
return false;

1
demo/js/base/editor/demo.sql_editor.js

@ -9,6 +9,7 @@ Demo.SQLEditor = BI.inherit(BI.Widget, {
var self = this;
this.formula = BI.createWidget({
type : 'bi.sql_editor',
supportParam: true,
width : 300,
height : 200,
value : "select * from DEMO_CONTRACT where 合同类型 = ${长期协议} and 购买数量 = sum([1,2,3,4])"

3
demo/js/case/combo/demo.icon_text_value_combo.js

@ -11,7 +11,8 @@ Demo.IconTextValueCombo = BI.inherit(BI.Widget, {
type: "bi.horizontal_auto",
items: [{
type: "bi.icon_text_value_combo",
value: "默认值",
text: "默认值",
value: 1,
width: 300,
items: [{
text: "MVC-1",

23
dist/base.js vendored

@ -1021,6 +1021,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
baseCls: "bi-button-group",
behaviors: {},
items: [],
value: "",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.center",
@ -1032,14 +1033,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_init: function () {
BI.ButtonGroup.superclass._init.apply(this, arguments);
var o = this.options;
var behaviors = {};
BI.each(this.options.behaviors, function (key, rule) {
BI.each(o.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
rule: rule
});
});
this.behaviors = behaviors;
this.populate(this.options.items);
this.populate(o.items);
if(BI.isKey(o.value) || BI.isNotEmptyArray(o.value)){
this.setValue(o.value);
}
},
_createBtns: function (items) {
@ -18071,6 +18076,7 @@ BI.Editor = BI.inherit(BI.Single, {
type: "bi.input",
element: "<input type='" + o.inputType + "'/>",
root: true,
value: o.value,
watermark: o.watermark,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
@ -18213,7 +18219,8 @@ BI.Editor = BI.inherit(BI.Single, {
return false;
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
this.setValue(this.options.value);
this._checkError();
this._checkWaterMark();
} else {
this._checkWaterMark();
}
@ -19417,6 +19424,9 @@ BI.Input = BI.inherit(BI.Single, {
.focusout(function (e) {
self._blurDebounce();
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
this.setValue(this.options.value);
}
},
_focus: function () {
@ -21067,7 +21077,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
value: "",
lineHeight: 2,
showHint: true,
supportFunction: false
supportFunction: false,
supportParam: false
});
},
_init: function () {
@ -21191,14 +21202,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
},
setValue: function (v) {
var self = this, result;
var self = this, result, o = this.options;
this.refresh();
self.editor.setValue("");
result = this._analyzeContent(v || "");
BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(fieldRegx);
if (BI.isNotEmptyArray(str)) {
if (BI.isNotEmptyArray(str) && o.supportParam) {
self.insertParam(str[0].substring(2, item.length - 1));
} else {
self.insertString(item);

57
dist/bundle.js vendored

@ -26894,6 +26894,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
baseCls: "bi-button-group",
behaviors: {},
items: [],
value: "",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.center",
@ -26905,14 +26906,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_init: function () {
BI.ButtonGroup.superclass._init.apply(this, arguments);
var o = this.options;
var behaviors = {};
BI.each(this.options.behaviors, function (key, rule) {
BI.each(o.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
rule: rule
});
});
this.behaviors = behaviors;
this.populate(this.options.items);
this.populate(o.items);
if(BI.isKey(o.value) || BI.isNotEmptyArray(o.value)){
this.setValue(o.value);
}
},
_createBtns: function (items) {
@ -43944,6 +43949,7 @@ BI.Editor = BI.inherit(BI.Single, {
type: "bi.input",
element: "<input type='" + o.inputType + "'/>",
root: true,
value: o.value,
watermark: o.watermark,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
@ -44086,7 +44092,8 @@ BI.Editor = BI.inherit(BI.Single, {
return false;
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
this.setValue(this.options.value);
this._checkError();
this._checkWaterMark();
} else {
this._checkWaterMark();
}
@ -45290,6 +45297,9 @@ BI.Input = BI.inherit(BI.Single, {
.focusout(function (e) {
self._blurDebounce();
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
this.setValue(this.options.value);
}
},
_focus: function () {
@ -46940,7 +46950,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
value: "",
lineHeight: 2,
showHint: true,
supportFunction: false
supportFunction: false,
supportParam: false
});
},
_init: function () {
@ -47064,14 +47075,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
},
setValue: function (v) {
var self = this, result;
var self = this, result, o = this.options;
this.refresh();
self.editor.setValue("");
result = this._analyzeContent(v || "");
BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(fieldRegx);
if (BI.isNotEmptyArray(str)) {
if (BI.isNotEmptyArray(str) && o.supportParam) {
self.insertParam(str[0].substring(2, item.length - 1));
} else {
self.insertString(item);
@ -67687,6 +67698,7 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
type: "bi.select_icon_text_trigger",
items: o.items,
height: o.height,
text: o.text,
value: o.value
});
this.popup = BI.createWidget({
@ -67813,6 +67825,7 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_icon_item",
cls: "bi-select-text-trigger bi-border pull-down-font",
text: o.text,
value: o.value,
readonly: true,
textLgap: 5,
height: o.height - 2
@ -67821,7 +67834,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_value_combo_popup",
textAlign: o.textAlign,
chooseType: o.chooseType,
items: o.items
items: o.items,
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -68205,7 +68219,8 @@ BI.shortcut("bi.small_text_value_combo", BI.SmallTextValueCombo);BI.TextValueCom
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
@ -74636,25 +74651,31 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
disableSelected: true,
isHalfCheckedBySelectedValue: function (selectedValues) {
return selectedValues.length > 0;
}
},
halfSelected: false
});
},
_init: function () {
BI.MultiSelectBar.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var isSelect = o.selected === true;
var isHalfSelect = !o.selected && o.halfSelected;
this.checkbox = BI.createWidget({
type: "bi.checkbox",
stopPropagation: true,
handler: function () {
self.setSelected(self.isSelected());
}
},
selected: isSelect,
invisible: isHalfSelect
});
this.half = BI.createWidget({
type: "bi.half_icon_button",
stopPropagation: true,
handler: function () {
self.setSelected(true);
}
},
invisible: isSelect || !isHalfSelect
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CLICK, self.isSelected(), self);
@ -74693,7 +74714,10 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
el: this.text
}]
});
this.half.invisible();
},
_setSelected: function (v) {
this.checkbox.setSelected(!!v);
},
// 自己手动控制选中
@ -74712,8 +74736,9 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
},
setHalfSelected: function (b) {
this._half = !!b;
this.halfSelected = !!b;
if (b === true) {
this.checkbox.setSelected(false);
this.half.visible();
this.checkbox.invisible();
} else {
@ -74723,7 +74748,7 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
},
isHalfSelected: function () {
return !!this._half;
return !this.isSelected() && !!this.halfSelected;
},
isSelected: function () {
@ -74733,7 +74758,7 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
setValue: function (selectedValues) {
BI.MultiSelectBar.superclass.setValue.apply(this, arguments);
var isAllChecked = this.options.isAllCheckedBySelectedValue.apply(this, arguments);
this.setSelected(isAllChecked);
this._setSelected(isAllChecked);
!isAllChecked && this.setHalfSelected(this.options.isHalfCheckedBySelectedValue.apply(this, arguments));
}
});
@ -76027,7 +76052,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
};
} else {
return {
text: o.value,
text: o.text,
iconClass: ""
};
}

34
dist/case.js vendored

@ -5458,6 +5458,7 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
type: "bi.select_icon_text_trigger",
items: o.items,
height: o.height,
text: o.text,
value: o.value
});
this.popup = BI.createWidget({
@ -5584,6 +5585,7 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_icon_item",
cls: "bi-select-text-trigger bi-border pull-down-font",
text: o.text,
value: o.value,
readonly: true,
textLgap: 5,
height: o.height - 2
@ -5592,7 +5594,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_value_combo_popup",
textAlign: o.textAlign,
chooseType: o.chooseType,
items: o.items
items: o.items,
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -5976,7 +5979,8 @@ BI.shortcut("bi.small_text_value_combo", BI.SmallTextValueCombo);BI.TextValueCom
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
@ -12407,25 +12411,31 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
disableSelected: true,
isHalfCheckedBySelectedValue: function (selectedValues) {
return selectedValues.length > 0;
}
},
halfSelected: false
});
},
_init: function () {
BI.MultiSelectBar.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var isSelect = o.selected === true;
var isHalfSelect = !o.selected && o.halfSelected;
this.checkbox = BI.createWidget({
type: "bi.checkbox",
stopPropagation: true,
handler: function () {
self.setSelected(self.isSelected());
}
},
selected: isSelect,
invisible: isHalfSelect
});
this.half = BI.createWidget({
type: "bi.half_icon_button",
stopPropagation: true,
handler: function () {
self.setSelected(true);
}
},
invisible: isSelect || !isHalfSelect
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CLICK, self.isSelected(), self);
@ -12464,7 +12474,10 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
el: this.text
}]
});
this.half.invisible();
},
_setSelected: function (v) {
this.checkbox.setSelected(!!v);
},
// 自己手动控制选中
@ -12483,8 +12496,9 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
},
setHalfSelected: function (b) {
this._half = !!b;
this.halfSelected = !!b;
if (b === true) {
this.checkbox.setSelected(false);
this.half.visible();
this.checkbox.invisible();
} else {
@ -12494,7 +12508,7 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
},
isHalfSelected: function () {
return !!this._half;
return !this.isSelected() && !!this.halfSelected;
},
isSelected: function () {
@ -12504,7 +12518,7 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
setValue: function (selectedValues) {
BI.MultiSelectBar.superclass.setValue.apply(this, arguments);
var isAllChecked = this.options.isAllCheckedBySelectedValue.apply(this, arguments);
this.setSelected(isAllChecked);
this._setSelected(isAllChecked);
!isAllChecked && this.setHalfSelected(this.options.isHalfCheckedBySelectedValue.apply(this, arguments));
}
});
@ -13798,7 +13812,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
};
} else {
return {
text: o.value,
text: o.text,
iconClass: ""
};
}

27
dist/demo.js vendored

@ -196,6 +196,28 @@ $(function () {
iconClass: "close-font",
height: 30
}
}, {
el: {
type: "bi.multi_select_bar",
selected: true,
halfSelected: true
}
}, {
el: {
type: "bi.multi_select_bar",
selected: true,
halfSelected: false
}
}, {
el: {
type: "bi.multi_select_bar",
selected: false,
halfSelected: true
}
}, {
el: {
type: "bi.multi_select_bar"
}
}
];
BI.each(items, function (i, item) {
@ -704,6 +726,7 @@ BI.shortcut("demo.code_editor", Demo.CodeEditor);Demo.Editor = BI.inherit(BI.Wid
cls: "mvc-border",
watermark: "输入'a'会有错误信息且回车键不能退出编辑",
errorText: "字段不可重名",
value: "a",
validationChecker: function (v) {
if (v == "a") {
return false;
@ -842,6 +865,7 @@ Demo.SQLEditor = BI.inherit(BI.Widget, {
var self = this;
this.formula = BI.createWidget({
type : 'bi.sql_editor',
supportParam: true,
width : 300,
height : 200,
value : "select * from DEMO_CONTRACT where 合同类型 = ${长期协议} and 购买数量 = sum([1,2,3,4])"
@ -1808,7 +1832,8 @@ Demo.IconTextValueCombo = BI.inherit(BI.Widget, {
type: "bi.horizontal_auto",
items: [{
type: "bi.icon_text_value_combo",
value: "默认值",
text: "默认值",
value: 1,
width: 300,
items: [{
text: "MVC-1",

57
dist/fineui.js vendored

@ -28588,6 +28588,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
baseCls: "bi-button-group",
behaviors: {},
items: [],
value: "",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.center",
@ -28599,14 +28600,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_init: function () {
BI.ButtonGroup.superclass._init.apply(this, arguments);
var o = this.options;
var behaviors = {};
BI.each(this.options.behaviors, function (key, rule) {
BI.each(o.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
rule: rule
});
});
this.behaviors = behaviors;
this.populate(this.options.items);
this.populate(o.items);
if(BI.isKey(o.value) || BI.isNotEmptyArray(o.value)){
this.setValue(o.value);
}
},
_createBtns: function (items) {
@ -45638,6 +45643,7 @@ BI.Editor = BI.inherit(BI.Single, {
type: "bi.input",
element: "<input type='" + o.inputType + "'/>",
root: true,
value: o.value,
watermark: o.watermark,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
@ -45780,7 +45786,8 @@ BI.Editor = BI.inherit(BI.Single, {
return false;
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
this.setValue(this.options.value);
this._checkError();
this._checkWaterMark();
} else {
this._checkWaterMark();
}
@ -46984,6 +46991,9 @@ BI.Input = BI.inherit(BI.Single, {
.focusout(function (e) {
self._blurDebounce();
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
this.setValue(this.options.value);
}
},
_focus: function () {
@ -48634,7 +48644,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
value: "",
lineHeight: 2,
showHint: true,
supportFunction: false
supportFunction: false,
supportParam: false
});
},
_init: function () {
@ -48758,14 +48769,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
},
setValue: function (v) {
var self = this, result;
var self = this, result, o = this.options;
this.refresh();
self.editor.setValue("");
result = this._analyzeContent(v || "");
BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(fieldRegx);
if (BI.isNotEmptyArray(str)) {
if (BI.isNotEmptyArray(str) && o.supportParam) {
self.insertParam(str[0].substring(2, item.length - 1));
} else {
self.insertString(item);
@ -69381,6 +69392,7 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
type: "bi.select_icon_text_trigger",
items: o.items,
height: o.height,
text: o.text,
value: o.value
});
this.popup = BI.createWidget({
@ -69507,6 +69519,7 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_icon_item",
cls: "bi-select-text-trigger bi-border pull-down-font",
text: o.text,
value: o.value,
readonly: true,
textLgap: 5,
height: o.height - 2
@ -69515,7 +69528,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_value_combo_popup",
textAlign: o.textAlign,
chooseType: o.chooseType,
items: o.items
items: o.items,
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -69899,7 +69913,8 @@ BI.shortcut("bi.small_text_value_combo", BI.SmallTextValueCombo);BI.TextValueCom
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
@ -76330,25 +76345,31 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
disableSelected: true,
isHalfCheckedBySelectedValue: function (selectedValues) {
return selectedValues.length > 0;
}
},
halfSelected: false
});
},
_init: function () {
BI.MultiSelectBar.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var isSelect = o.selected === true;
var isHalfSelect = !o.selected && o.halfSelected;
this.checkbox = BI.createWidget({
type: "bi.checkbox",
stopPropagation: true,
handler: function () {
self.setSelected(self.isSelected());
}
},
selected: isSelect,
invisible: isHalfSelect
});
this.half = BI.createWidget({
type: "bi.half_icon_button",
stopPropagation: true,
handler: function () {
self.setSelected(true);
}
},
invisible: isSelect || !isHalfSelect
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CLICK, self.isSelected(), self);
@ -76387,7 +76408,10 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
el: this.text
}]
});
this.half.invisible();
},
_setSelected: function (v) {
this.checkbox.setSelected(!!v);
},
// 自己手动控制选中
@ -76406,8 +76430,9 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
},
setHalfSelected: function (b) {
this._half = !!b;
this.halfSelected = !!b;
if (b === true) {
this.checkbox.setSelected(false);
this.half.visible();
this.checkbox.invisible();
} else {
@ -76417,7 +76442,7 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
},
isHalfSelected: function () {
return !!this._half;
return !this.isSelected() && !!this.halfSelected;
},
isSelected: function () {
@ -76427,7 +76452,7 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
setValue: function (selectedValues) {
BI.MultiSelectBar.superclass.setValue.apply(this, arguments);
var isAllChecked = this.options.isAllCheckedBySelectedValue.apply(this, arguments);
this.setSelected(isAllChecked);
this._setSelected(isAllChecked);
!isAllChecked && this.setHalfSelected(this.options.isHalfCheckedBySelectedValue.apply(this, arguments));
}
});
@ -77721,7 +77746,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
};
} else {
return {
text: o.value,
text: o.text,
iconClass: ""
};
}

9
src/base/combination/group.button.js

@ -10,6 +10,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
baseCls: "bi-button-group",
behaviors: {},
items: [],
value: "",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.center",
@ -21,14 +22,18 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_init: function () {
BI.ButtonGroup.superclass._init.apply(this, arguments);
var o = this.options;
var behaviors = {};
BI.each(this.options.behaviors, function (key, rule) {
BI.each(o.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
rule: rule
});
});
this.behaviors = behaviors;
this.populate(this.options.items);
this.populate(o.items);
if(BI.isKey(o.value) || BI.isNotEmptyArray(o.value)){
this.setValue(o.value);
}
},
_createBtns: function (items) {

4
src/base/single/editor/editor.js

@ -32,6 +32,7 @@ BI.Editor = BI.inherit(BI.Single, {
type: "bi.input",
element: "<input type='" + o.inputType + "'/>",
root: true,
value: o.value,
watermark: o.watermark,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
@ -174,7 +175,8 @@ BI.Editor = BI.inherit(BI.Single, {
return false;
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
this.setValue(this.options.value);
this._checkError();
this._checkWaterMark();
} else {
this._checkWaterMark();
}

3
src/base/single/input/input.js

@ -57,6 +57,9 @@ BI.Input = BI.inherit(BI.Single, {
.focusout(function (e) {
self._blurDebounce();
});
if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) {
this.setValue(this.options.value);
}
},
_focus: function () {

7
src/base/sql/editor.sql.js

@ -8,7 +8,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
value: "",
lineHeight: 2,
showHint: true,
supportFunction: false
supportFunction: false,
supportParam: false
});
},
_init: function () {
@ -132,14 +133,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
},
setValue: function (v) {
var self = this, result;
var self = this, result, o = this.options;
this.refresh();
self.editor.setValue("");
result = this._analyzeContent(v || "");
BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(fieldRegx);
if (BI.isNotEmptyArray(str)) {
if (BI.isNotEmptyArray(str) && o.supportParam) {
self.insertParam(str[0].substring(2, item.length - 1));
} else {
self.insertString(item);

1
src/case/combo/icontextvaluecombo/combo.icontextvalue.js

@ -19,6 +19,7 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
type: "bi.select_icon_text_trigger",
items: o.items,
height: o.height,
text: o.text,
value: o.value
});
this.popup = BI.createWidget({

4
src/case/combo/staticcombo/combo.static.js

@ -23,6 +23,7 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_icon_item",
cls: "bi-select-text-trigger bi-border pull-down-font",
text: o.text,
value: o.value,
readonly: true,
textLgap: 5,
height: o.height - 2
@ -31,7 +32,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
type: "bi.text_value_combo_popup",
textAlign: o.textAlign,
chooseType: o.chooseType,
items: o.items
items: o.items,
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);

3
src/case/combo/textvaluecombo/popup.textvalue.js

@ -19,7 +19,8 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {

24
src/case/toolbar/toolbar.multiselect.js

@ -16,25 +16,31 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
disableSelected: true,
isHalfCheckedBySelectedValue: function (selectedValues) {
return selectedValues.length > 0;
}
},
halfSelected: false
});
},
_init: function () {
BI.MultiSelectBar.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var isSelect = o.selected === true;
var isHalfSelect = !o.selected && o.halfSelected;
this.checkbox = BI.createWidget({
type: "bi.checkbox",
stopPropagation: true,
handler: function () {
self.setSelected(self.isSelected());
}
},
selected: isSelect,
invisible: isHalfSelect
});
this.half = BI.createWidget({
type: "bi.half_icon_button",
stopPropagation: true,
handler: function () {
self.setSelected(true);
}
},
invisible: isSelect || !isHalfSelect
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CLICK, self.isSelected(), self);
@ -73,7 +79,10 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
el: this.text
}]
});
this.half.invisible();
},
_setSelected: function (v) {
this.checkbox.setSelected(!!v);
},
// 自己手动控制选中
@ -92,8 +101,9 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
},
setHalfSelected: function (b) {
this._half = !!b;
this.halfSelected = !!b;
if (b === true) {
this.checkbox.setSelected(false);
this.half.visible();
this.checkbox.invisible();
} else {
@ -103,7 +113,7 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
},
isHalfSelected: function () {
return !!this._half;
return !this.isSelected() && !!this.halfSelected;
},
isSelected: function () {
@ -113,7 +123,7 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
setValue: function (selectedValues) {
BI.MultiSelectBar.superclass.setValue.apply(this, arguments);
var isAllChecked = this.options.isAllCheckedBySelectedValue.apply(this, arguments);
this.setSelected(isAllChecked);
this._setSelected(isAllChecked);
!isAllChecked && this.setHalfSelected(this.options.isHalfCheckedBySelectedValue.apply(this, arguments));
}
});

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

@ -46,7 +46,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
};
} else {
return {
text: o.value,
text: o.text,
iconClass: ""
};
}

Loading…
Cancel
Save