guy 7 years ago
parent
commit
eee2958b55
  1. 27
      bi/base.js
  2. 26
      bi/case.js
  3. 38
      bi/core.js
  4. 1
      bi/widget.css
  5. 136
      bi/widget.js
  6. 27
      docs/base.js
  7. 26
      docs/case.js
  8. 38
      docs/core.js
  9. 1
      docs/widget.css
  10. 136
      docs/widget.js
  11. 5
      src/base/combination/combo.js
  12. 5
      src/base/combination/expander.js
  13. 4
      src/base/combination/loader.js
  14. 5
      src/base/combination/switcher.js
  15. 4
      src/base/single/label/label.js
  16. 4
      src/base/tree/customtree.js
  17. 2
      src/case/calendar/calendar.year.js
  18. 4
      src/case/layer/pane.list.js
  19. 4
      src/case/list/list.select.js
  20. 4
      src/case/loader/loader.lazy.js
  21. 4
      src/case/loader/loader.list.js
  22. 4
      src/case/loader/sort.list.js
  23. 4
      src/case/tree/tree.level.js
  24. 30
      src/core/behavior/behavior.highlight.js
  25. 8
      src/core/widget.js
  26. 1
      src/css/widget/year/popup.year.css
  27. 1
      src/less/widget/year/popup.year.less
  28. 14
      src/widget/month/combo.month.js
  29. 6
      src/widget/month/popup.month.js
  30. 4
      src/widget/multilayerselecttree/multilayerselecttree.leveltree.js
  31. 4
      src/widget/multilayersingletree/multilayersingletree.leveltree.js
  32. 16
      src/widget/quarter/combo.quarter.js
  33. 6
      src/widget/quarter/popup.quarter.js
  34. 43
      src/widget/year/combo.year.js
  35. 5
      src/widget/year/popup.year.js
  36. 19
      src/widget/yearmonth/combo.yearmonth.js
  37. 19
      src/widget/yearquarter/combo.yearquarter.js

27
bi/base.js

@ -3264,11 +3264,6 @@ BI.Combo = BI.inherit(BI.Widget, {
return this.position;
},
doBehavior: function () {
this._assertPopupView();
this.popupView && this.popupView.doBehavior.apply(this.popupView, arguments);
},
toggle: function () {
this._toggle();
},
@ -3532,11 +3527,6 @@ BI.Expander = BI.inherit(BI.Widget, {
return this.popupView;
},
doBehavior: function () {
//this._assertPopupView();
this.popupView && this.popupView.doBehavior.apply(this.popupView, arguments);
},
getAllLeaves: function () {
return this.popupView && this.popupView.getAllLeaves();
},
@ -3946,10 +3936,6 @@ BI.Loader = BI.inherit(BI.Widget, {
this.button_group.populate.apply(this.button_group, arguments);
},
doBehavior: function () {
this.button_group.doBehavior.apply(this.button_group, arguments);
},
setNotSelectedValue: function () {
this.button_group.setNotSelectedValue.apply(this.button_group, arguments);
},
@ -4704,11 +4690,6 @@ BI.Switcher = BI.inherit(BI.Widget, {
this.isViewVisible() && BI.Maskers.show(this.getName());
},
doBehavior: function () {
this._assertPopupView();
this.popupView && this.popupView.doBehavior.apply(this.popupView, arguments);
},
getAllLeaves: function () {
return this.popupView && this.popupView.getAllLeaves();
},
@ -19638,7 +19619,7 @@ BI.Label = BI.inherit(BI.Single, {
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
this.text = BI.createWidget({
BI.createWidget({
type: "bi.center_adapt",
hgap: o.hgap,
vgap: o.vgap,
@ -19836,7 +19817,7 @@ BI.Label = BI.inherit(BI.Single, {
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json)
this.text = BI.createWidget({
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
@ -33019,10 +33000,6 @@ BI.CustomTree = BI.inherit(BI.Widget, {
this.tree.populate.apply(this.tree, args);
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree && this.tree.setValue(v);
},

26
bi/case.js

@ -1820,6 +1820,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
var conf = BI.YearCalendar.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-year-calendar",
behaviors: {},
logic: {
dynamic: false
},
@ -1884,6 +1885,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
this.years = BI.createWidget({
type: "bi.button_group",
behaviors: o.behaviors,
items: BI.createItems(items, {}),
layouts: [BI.LogicFactory.createLogic("table", BI.extend({}, o.logic, {
columns: 2,
@ -8360,10 +8362,6 @@ BI.ListPane = BI.inherit(BI.Pane, {
this.button_group.empty();
},
doBehavior: function () {
this.button_group.doBehavior.apply(this.button_group, arguments);
},
setNotSelectedValue: function () {
this.button_group.setNotSelectedValue.apply(this.button_group, arguments);
},
@ -8653,10 +8651,6 @@ BI.SelectList = BI.inherit(BI.Widget, {
this.list.element.css({"max-height": h - toolHeight + "px"})
},
doBehavior: function () {
this.list.doBehavior.apply(this.list, arguments);
},
setNotSelectedValue: function () {
this.list.setNotSelectedValue.apply(this.list, arguments);
this._checkAllSelected();
@ -8751,10 +8745,6 @@ BI.LazyLoader = BI.inherit(BI.Widget, {
this.loader.empty();
},
doBehavior: function () {
this.loader.doBehavior();
},
setNotSelectedValue: function () {
this.loader.setNotSelectedValue.apply(this.loader, arguments);
},
@ -8950,10 +8940,6 @@ BI.ListLoader = BI.inherit(BI.Widget, {
});
},
doBehavior: function () {
this.button_group.doBehavior.apply(this.button_group, arguments);
},
setNotSelectedValue: function () {
this.button_group.setNotSelectedValue.apply(this.button_group, arguments);
},
@ -9122,10 +9108,6 @@ BI.SortList = BI.inherit(BI.Widget, {
this.loader.empty();
},
doBehavior: function () {
this.loader.doBehavior.apply(this.loader, arguments);
},
setNotSelectedValue: function () {
this.loader.setNotSelectedValue.apply(this.loader, arguments);
},
@ -12126,10 +12108,6 @@ BI.LevelTree = BI.inherit(BI.Widget, {
this.tree.populate(items);
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree.setValue(v);
},

38
bi/core.js

@ -4577,6 +4577,14 @@ BI.Widget = BI.inherit(BI.OB, {
}
},
doBehavior: function () {
var args = arguments;
//递归将所有子组件使有效
BI.each(this._children, function (i, child) {
child.doBehavior && child.doBehavior.apply(child, args);
});
},
getWidth: function () {
return this.options.width;
},
@ -10973,26 +10981,34 @@ BI.Behavior = BI.inherit(BI.OB, {
* @extends BI.Behavior
*/
BI.HighlightBehavior = BI.inherit(BI.Behavior, {
_defaultConfig: function() {
return BI.extend(BI.HighlightBehavior.superclass._defaultConfig.apply(this, arguments), {
});
_defaultConfig: function () {
return BI.extend(BI.HighlightBehavior.superclass._defaultConfig.apply(this, arguments), {});
},
_init : function() {
_init: function () {
BI.HighlightBehavior.superclass._init.apply(this, arguments);
},
doBehavior: function(items){
doBehavior: function (items) {
var args = Array.prototype.slice.call(arguments, 1),
o = this.options;
BI.each(items, function(i, item){
if(item instanceof BI.Single) {
if (o.rule(item.getValue(), item)) {
item.doHighLight.apply(item, args);
BI.each(items, function (i, item) {
if (item instanceof BI.Single) {
var rule = o.rule(item.getValue(), item);
function doBe(run) {
if (run === true) {
item.doHighLight.apply(item, args);
} else {
item.unHighLight.apply(item, args);
}
}
if (BI.isFunction(rule)) {
rule(doBe);
} else {
item.unHighLight.apply(item, args);
doBe(rule);
}
} else {
item.doBehavior.apply(item, args);

1
bi/widget.css

@ -516,7 +516,6 @@
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-year-popup .year-popup-navigation {
line-height: 30px;
color: #3f8ce8;
}
.bi-year-popup .year-popup-navigation > .center-element {
border-left: 1px solid #d4dadd;

136
bi/widget.js

@ -7739,6 +7739,7 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MonthCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-month-combo",
behaviors: {},
height: 25
});
},
@ -7751,9 +7752,9 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
});
this.trigger.on(BI.MonthTrigger.EVENT_CONFIRM, function (v) {
if(this.getKey() && this.getKey() !== self.storeValue) {
if (this.getKey() && this.getKey() !== self.storeValue) {
self.setValue(this.getValue());
}else if(!this.getKey()){
} else if (!this.getKey()) {
self.setValue();
}
self.fireEvent(BI.MonthCombo.EVENT_CONFIRM);
@ -7774,7 +7775,8 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
});
this.popup = BI.createWidget({
type: "bi.month_popup"
type: "bi.month_popup",
behaviors: o.behaviors
});
this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
@ -7792,7 +7794,10 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
minWidth: 85,
el: this.popup
}
})
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW);
});
},
setValue: function (v) {
@ -7806,6 +7811,7 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
});
BI.MonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.MonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.month_combo', BI.MonthCombo);/**
* 月份展示面板
*
@ -7817,13 +7823,14 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MonthPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-month-popup"
baseCls: "bi-month-popup",
behaviors: {}
});
},
_init: function () {
BI.MonthPopup.superclass._init.apply(this, arguments);
var self = this;
var self = this, o = this.options;
//纵向排列月
var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11];
@ -7854,6 +7861,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
this.month = BI.createWidget({
type: "bi.button_group",
element: this,
behaviors: o.behaviors,
items: BI.createItems(items, {}),
layouts: [BI.LogicFactory.createLogic("table", BI.extend({
dynamic: true
@ -8170,10 +8178,6 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree.setValue(v);
},
@ -8715,10 +8719,6 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree.setValue(v);
},
@ -13976,6 +13976,7 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.QuarterCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-quarter-combo",
behaviors: {},
height: 25
});
},
@ -13996,24 +13997,25 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
this.trigger.on(BI.QuarterTrigger.EVENT_START, function () {
self.combo.isViewVisible() && self.combo.hideView();
});
this.trigger.on(BI.QuarterTrigger.EVENT_STOP, function(){
this.trigger.on(BI.QuarterTrigger.EVENT_STOP, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.trigger.on(BI.QuarterTrigger.EVENT_CONFIRM, function () {
if(self.combo.isViewVisible()) {
if (self.combo.isViewVisible()) {
return;
}
if(this.getKey() && this.getKey() !== self.storeValue) {
if (this.getKey() && this.getKey() !== self.storeValue) {
self.setValue(this.getKey());
}else if(!this.getKey()){
} else if (!this.getKey()) {
self.setValue();
}
self.fireEvent(BI.QuarterCombo.EVENT_CONFIRM);
});
this.popup = BI.createWidget({
type: "bi.quarter_popup"
type: "bi.quarter_popup",
behaviors: o.behaviors
});
this.popup.on(BI.QuarterPopup.EVENT_CHANGE, function () {
@ -14033,6 +14035,9 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
el: this.popup
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
},
setValue: function (v) {
@ -14046,6 +14051,7 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
});
BI.QuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.quarter_combo', BI.QuarterCombo);/**
* 季度展示面板
*
@ -14057,13 +14063,14 @@ BI.QuarterPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.QuarterPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-quarter-popup"
baseCls: "bi-quarter-popup",
behaviors: {}
});
},
_init: function () {
BI.QuarterPopup.superclass._init.apply(this, arguments);
var self = this;
var self = this, o = this.options;
var items = [{
text: Date._QN[01],
@ -14093,6 +14100,7 @@ BI.QuarterPopup = BI.inherit(BI.Widget, {
this.quarter = BI.createWidget({
type: "bi.button_group",
element: this,
behaviors: o.behaviors,
items: BI.createItems(items, {}),
layouts: [{
type: "bi.vertical"
@ -16581,6 +16589,7 @@ BI.YearCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-combo",
behaviors: {},
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
height: 25
@ -16608,7 +16617,7 @@ BI.YearCombo = BI.inherit(BI.Widget, {
self.combo.isViewVisible() && self.combo.hideView();
});
this.trigger.on(BI.YearTrigger.EVENT_CONFIRM, function () {
if(self.combo.isViewVisible()) {
if (self.combo.isViewVisible()) {
return;
}
if (this.getKey() && this.getKey() !== self.storeValue) {
@ -16619,45 +16628,50 @@ BI.YearCombo = BI.inherit(BI.Widget, {
self.fireEvent(BI.YearCombo.EVENT_CONFIRM);
});
this.popup = BI.createWidget({
type: "bi.year_popup",
min: o.min,
max: o.max
});
this.popup.on(BI.YearPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.YearCombo.EVENT_CONFIRM);
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
destroyWhenHide: true,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
popup: {
minWidth: 85,
stopPropagation: false,
el: this.popup
el: {
type: "bi.year_popup",
ref: function () {
self.popup = this;
},
listeners: [{
eventName: BI.YearPopup.EVENT_CHANGE,
action: function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.YearCombo.EVENT_CONFIRM);
}
}],
behaviors: o.behaviors,
min: o.min,
max: o.max
}
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
var value = self.trigger.getKey();
if (BI.isNotNull(value)) {
self.popup.setValue(value);
} else if(!value && value !== self.storeValue){
} else if (!value && value !== self.storeValue) {
self.popup.setValue(self.storeValue);
}else {
} else {
self.setValue();
}
self.fireEvent(BI.YearCombo.EVENT_BEFORE_POPUPVIEW);
});
},
setValue: function (v) {
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
@ -16665,6 +16679,7 @@ BI.YearCombo = BI.inherit(BI.Widget, {
}
});
BI.YearCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.YearCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.year_combo', BI.YearCombo);/**
* 年份展示面板
*
@ -16677,6 +16692,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-popup",
behaviors: {},
min: '1900-01-01', //最小日期
max: '2099-12-31' //最大日期
});
@ -16687,6 +16703,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
var calendar = BI.createWidget({
type: "bi.year_calendar",
behaviors: o.behaviors,
min: o.min,
max: o.max,
logic: {
@ -16723,11 +16740,12 @@ BI.YearPopup = BI.inherit(BI.Widget, {
this.navigation = BI.createWidget({
type: "bi.navigation",
element: this,
single: true,
logic: {
dynamic: true
},
tab: {
cls: "year-popup-navigation bi-border-top",
cls: "year-popup-navigation bi-high-light bi-border-top",
height: 25,
items: [backBtn, preBtn]
},
@ -16882,6 +16900,8 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearMonthCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-month-combo",
yearBehaviors: {},
monthBehaviors: {},
height: 25
});
},
@ -16890,20 +16910,28 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.year = BI.createWidget({
type: "bi.year_combo"
type: "bi.year_combo",
behaviors: o.yearBehaviors
});
this.month = BI.createWidget({
type: "bi.month_combo"
type: "bi.month_combo",
behaviors: o.monthBehaviors
});
this.year.on(BI.YearCombo.EVENT_CONFIRM, function(){
this.year.on(BI.YearCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM);
});
this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW);
});
this.month.on(BI.MonthCombo.EVENT_CONFIRM, function(){
this.month.on(BI.MonthCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM);
});
this.month.on(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW);
});
BI.createWidget({
type: "bi.center",
@ -16928,6 +16956,7 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, {
}
});
BI.YearMonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.year_month_combo', BI.YearMonthCombo);/**
* 年份 + 月份下拉框
*
@ -16938,6 +16967,8 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearQuarterCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-quarter-combo",
yearBehaviors: {},
quarterBehaviors: {},
height: 25
});
},
@ -16946,20 +16977,28 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.year = BI.createWidget({
type: "bi.year_combo"
type: "bi.year_combo",
behaviors: o.yearBehaviors
});
this.quarter = BI.createWidget({
type: "bi.quarter_combo"
type: "bi.quarter_combo",
behaviors: o.quarterBehaviors
});
this.year.on(BI.YearCombo.EVENT_CONFIRM, function(){
this.year.on(BI.YearCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM);
});
this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
this.quarter.on(BI.QuarterCombo.EVENT_CONFIRM, function(){
this.quarter.on(BI.QuarterCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM);
});
this.quarter.on(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
BI.createWidget({
type: "bi.center",
@ -16984,6 +17023,7 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
}
});
BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);/**
* 简单的复选下拉框控件, 适用于数据量少的情况 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值
* 封装了字段处理逻辑

27
docs/base.js

@ -3264,11 +3264,6 @@ BI.Combo = BI.inherit(BI.Widget, {
return this.position;
},
doBehavior: function () {
this._assertPopupView();
this.popupView && this.popupView.doBehavior.apply(this.popupView, arguments);
},
toggle: function () {
this._toggle();
},
@ -3532,11 +3527,6 @@ BI.Expander = BI.inherit(BI.Widget, {
return this.popupView;
},
doBehavior: function () {
//this._assertPopupView();
this.popupView && this.popupView.doBehavior.apply(this.popupView, arguments);
},
getAllLeaves: function () {
return this.popupView && this.popupView.getAllLeaves();
},
@ -3946,10 +3936,6 @@ BI.Loader = BI.inherit(BI.Widget, {
this.button_group.populate.apply(this.button_group, arguments);
},
doBehavior: function () {
this.button_group.doBehavior.apply(this.button_group, arguments);
},
setNotSelectedValue: function () {
this.button_group.setNotSelectedValue.apply(this.button_group, arguments);
},
@ -4704,11 +4690,6 @@ BI.Switcher = BI.inherit(BI.Widget, {
this.isViewVisible() && BI.Maskers.show(this.getName());
},
doBehavior: function () {
this._assertPopupView();
this.popupView && this.popupView.doBehavior.apply(this.popupView, arguments);
},
getAllLeaves: function () {
return this.popupView && this.popupView.getAllLeaves();
},
@ -19638,7 +19619,7 @@ BI.Label = BI.inherit(BI.Single, {
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
this.text = BI.createWidget({
BI.createWidget({
type: "bi.center_adapt",
hgap: o.hgap,
vgap: o.vgap,
@ -19836,7 +19817,7 @@ BI.Label = BI.inherit(BI.Single, {
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json)
this.text = BI.createWidget({
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
@ -33019,10 +33000,6 @@ BI.CustomTree = BI.inherit(BI.Widget, {
this.tree.populate.apply(this.tree, args);
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree && this.tree.setValue(v);
},

26
docs/case.js

@ -1820,6 +1820,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
var conf = BI.YearCalendar.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-year-calendar",
behaviors: {},
logic: {
dynamic: false
},
@ -1884,6 +1885,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
this.years = BI.createWidget({
type: "bi.button_group",
behaviors: o.behaviors,
items: BI.createItems(items, {}),
layouts: [BI.LogicFactory.createLogic("table", BI.extend({}, o.logic, {
columns: 2,
@ -8360,10 +8362,6 @@ BI.ListPane = BI.inherit(BI.Pane, {
this.button_group.empty();
},
doBehavior: function () {
this.button_group.doBehavior.apply(this.button_group, arguments);
},
setNotSelectedValue: function () {
this.button_group.setNotSelectedValue.apply(this.button_group, arguments);
},
@ -8653,10 +8651,6 @@ BI.SelectList = BI.inherit(BI.Widget, {
this.list.element.css({"max-height": h - toolHeight + "px"})
},
doBehavior: function () {
this.list.doBehavior.apply(this.list, arguments);
},
setNotSelectedValue: function () {
this.list.setNotSelectedValue.apply(this.list, arguments);
this._checkAllSelected();
@ -8751,10 +8745,6 @@ BI.LazyLoader = BI.inherit(BI.Widget, {
this.loader.empty();
},
doBehavior: function () {
this.loader.doBehavior();
},
setNotSelectedValue: function () {
this.loader.setNotSelectedValue.apply(this.loader, arguments);
},
@ -8950,10 +8940,6 @@ BI.ListLoader = BI.inherit(BI.Widget, {
});
},
doBehavior: function () {
this.button_group.doBehavior.apply(this.button_group, arguments);
},
setNotSelectedValue: function () {
this.button_group.setNotSelectedValue.apply(this.button_group, arguments);
},
@ -9122,10 +9108,6 @@ BI.SortList = BI.inherit(BI.Widget, {
this.loader.empty();
},
doBehavior: function () {
this.loader.doBehavior.apply(this.loader, arguments);
},
setNotSelectedValue: function () {
this.loader.setNotSelectedValue.apply(this.loader, arguments);
},
@ -12126,10 +12108,6 @@ BI.LevelTree = BI.inherit(BI.Widget, {
this.tree.populate(items);
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree.setValue(v);
},

38
docs/core.js

@ -14579,6 +14579,14 @@ BI.Widget = BI.inherit(BI.OB, {
}
},
doBehavior: function () {
var args = arguments;
//递归将所有子组件使有效
BI.each(this._children, function (i, child) {
child.doBehavior && child.doBehavior.apply(child, args);
});
},
getWidth: function () {
return this.options.width;
},
@ -20620,26 +20628,34 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () {
* @extends BI.Behavior
*/
BI.HighlightBehavior = BI.inherit(BI.Behavior, {
_defaultConfig: function() {
return BI.extend(BI.HighlightBehavior.superclass._defaultConfig.apply(this, arguments), {
});
_defaultConfig: function () {
return BI.extend(BI.HighlightBehavior.superclass._defaultConfig.apply(this, arguments), {});
},
_init : function() {
_init: function () {
BI.HighlightBehavior.superclass._init.apply(this, arguments);
},
doBehavior: function(items){
doBehavior: function (items) {
var args = Array.prototype.slice.call(arguments, 1),
o = this.options;
BI.each(items, function(i, item){
if(item instanceof BI.Single) {
if (o.rule(item.getValue(), item)) {
item.doHighLight.apply(item, args);
BI.each(items, function (i, item) {
if (item instanceof BI.Single) {
var rule = o.rule(item.getValue(), item);
function doBe(run) {
if (run === true) {
item.doHighLight.apply(item, args);
} else {
item.unHighLight.apply(item, args);
}
}
if (BI.isFunction(rule)) {
rule(doBe);
} else {
item.unHighLight.apply(item, args);
doBe(rule);
}
} else {
item.doBehavior.apply(item, args);

1
docs/widget.css

@ -516,7 +516,6 @@
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-year-popup .year-popup-navigation {
line-height: 30px;
color: #3f8ce8;
}
.bi-year-popup .year-popup-navigation > .center-element {
border-left: 1px solid #d4dadd;

136
docs/widget.js

@ -7739,6 +7739,7 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MonthCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-month-combo",
behaviors: {},
height: 25
});
},
@ -7751,9 +7752,9 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
});
this.trigger.on(BI.MonthTrigger.EVENT_CONFIRM, function (v) {
if(this.getKey() && this.getKey() !== self.storeValue) {
if (this.getKey() && this.getKey() !== self.storeValue) {
self.setValue(this.getValue());
}else if(!this.getKey()){
} else if (!this.getKey()) {
self.setValue();
}
self.fireEvent(BI.MonthCombo.EVENT_CONFIRM);
@ -7774,7 +7775,8 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
});
this.popup = BI.createWidget({
type: "bi.month_popup"
type: "bi.month_popup",
behaviors: o.behaviors
});
this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
@ -7792,7 +7794,10 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
minWidth: 85,
el: this.popup
}
})
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW);
});
},
setValue: function (v) {
@ -7806,6 +7811,7 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
});
BI.MonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.MonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.month_combo', BI.MonthCombo);/**
* 月份展示面板
*
@ -7817,13 +7823,14 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MonthPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-month-popup"
baseCls: "bi-month-popup",
behaviors: {}
});
},
_init: function () {
BI.MonthPopup.superclass._init.apply(this, arguments);
var self = this;
var self = this, o = this.options;
//纵向排列月
var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11];
@ -7854,6 +7861,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
this.month = BI.createWidget({
type: "bi.button_group",
element: this,
behaviors: o.behaviors,
items: BI.createItems(items, {}),
layouts: [BI.LogicFactory.createLogic("table", BI.extend({
dynamic: true
@ -8170,10 +8178,6 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree.setValue(v);
},
@ -8715,10 +8719,6 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree.setValue(v);
},
@ -13976,6 +13976,7 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.QuarterCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-quarter-combo",
behaviors: {},
height: 25
});
},
@ -13996,24 +13997,25 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
this.trigger.on(BI.QuarterTrigger.EVENT_START, function () {
self.combo.isViewVisible() && self.combo.hideView();
});
this.trigger.on(BI.QuarterTrigger.EVENT_STOP, function(){
this.trigger.on(BI.QuarterTrigger.EVENT_STOP, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.trigger.on(BI.QuarterTrigger.EVENT_CONFIRM, function () {
if(self.combo.isViewVisible()) {
if (self.combo.isViewVisible()) {
return;
}
if(this.getKey() && this.getKey() !== self.storeValue) {
if (this.getKey() && this.getKey() !== self.storeValue) {
self.setValue(this.getKey());
}else if(!this.getKey()){
} else if (!this.getKey()) {
self.setValue();
}
self.fireEvent(BI.QuarterCombo.EVENT_CONFIRM);
});
this.popup = BI.createWidget({
type: "bi.quarter_popup"
type: "bi.quarter_popup",
behaviors: o.behaviors
});
this.popup.on(BI.QuarterPopup.EVENT_CHANGE, function () {
@ -14033,6 +14035,9 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
el: this.popup
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
},
setValue: function (v) {
@ -14046,6 +14051,7 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
});
BI.QuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.quarter_combo', BI.QuarterCombo);/**
* 季度展示面板
*
@ -14057,13 +14063,14 @@ BI.QuarterPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.QuarterPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-quarter-popup"
baseCls: "bi-quarter-popup",
behaviors: {}
});
},
_init: function () {
BI.QuarterPopup.superclass._init.apply(this, arguments);
var self = this;
var self = this, o = this.options;
var items = [{
text: Date._QN[01],
@ -14093,6 +14100,7 @@ BI.QuarterPopup = BI.inherit(BI.Widget, {
this.quarter = BI.createWidget({
type: "bi.button_group",
element: this,
behaviors: o.behaviors,
items: BI.createItems(items, {}),
layouts: [{
type: "bi.vertical"
@ -16581,6 +16589,7 @@ BI.YearCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-combo",
behaviors: {},
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
height: 25
@ -16608,7 +16617,7 @@ BI.YearCombo = BI.inherit(BI.Widget, {
self.combo.isViewVisible() && self.combo.hideView();
});
this.trigger.on(BI.YearTrigger.EVENT_CONFIRM, function () {
if(self.combo.isViewVisible()) {
if (self.combo.isViewVisible()) {
return;
}
if (this.getKey() && this.getKey() !== self.storeValue) {
@ -16619,45 +16628,50 @@ BI.YearCombo = BI.inherit(BI.Widget, {
self.fireEvent(BI.YearCombo.EVENT_CONFIRM);
});
this.popup = BI.createWidget({
type: "bi.year_popup",
min: o.min,
max: o.max
});
this.popup.on(BI.YearPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.YearCombo.EVENT_CONFIRM);
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
destroyWhenHide: true,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
popup: {
minWidth: 85,
stopPropagation: false,
el: this.popup
el: {
type: "bi.year_popup",
ref: function () {
self.popup = this;
},
listeners: [{
eventName: BI.YearPopup.EVENT_CHANGE,
action: function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.YearCombo.EVENT_CONFIRM);
}
}],
behaviors: o.behaviors,
min: o.min,
max: o.max
}
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
var value = self.trigger.getKey();
if (BI.isNotNull(value)) {
self.popup.setValue(value);
} else if(!value && value !== self.storeValue){
} else if (!value && value !== self.storeValue) {
self.popup.setValue(self.storeValue);
}else {
} else {
self.setValue();
}
self.fireEvent(BI.YearCombo.EVENT_BEFORE_POPUPVIEW);
});
},
setValue: function (v) {
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
@ -16665,6 +16679,7 @@ BI.YearCombo = BI.inherit(BI.Widget, {
}
});
BI.YearCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.YearCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.year_combo', BI.YearCombo);/**
* 年份展示面板
*
@ -16677,6 +16692,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-popup",
behaviors: {},
min: '1900-01-01', //最小日期
max: '2099-12-31' //最大日期
});
@ -16687,6 +16703,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
var calendar = BI.createWidget({
type: "bi.year_calendar",
behaviors: o.behaviors,
min: o.min,
max: o.max,
logic: {
@ -16723,11 +16740,12 @@ BI.YearPopup = BI.inherit(BI.Widget, {
this.navigation = BI.createWidget({
type: "bi.navigation",
element: this,
single: true,
logic: {
dynamic: true
},
tab: {
cls: "year-popup-navigation bi-border-top",
cls: "year-popup-navigation bi-high-light bi-border-top",
height: 25,
items: [backBtn, preBtn]
},
@ -16882,6 +16900,8 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearMonthCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-month-combo",
yearBehaviors: {},
monthBehaviors: {},
height: 25
});
},
@ -16890,20 +16910,28 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.year = BI.createWidget({
type: "bi.year_combo"
type: "bi.year_combo",
behaviors: o.yearBehaviors
});
this.month = BI.createWidget({
type: "bi.month_combo"
type: "bi.month_combo",
behaviors: o.monthBehaviors
});
this.year.on(BI.YearCombo.EVENT_CONFIRM, function(){
this.year.on(BI.YearCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM);
});
this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW);
});
this.month.on(BI.MonthCombo.EVENT_CONFIRM, function(){
this.month.on(BI.MonthCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM);
});
this.month.on(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW);
});
BI.createWidget({
type: "bi.center",
@ -16928,6 +16956,7 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, {
}
});
BI.YearMonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.year_month_combo', BI.YearMonthCombo);/**
* 年份 + 月份下拉框
*
@ -16938,6 +16967,8 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearQuarterCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-quarter-combo",
yearBehaviors: {},
quarterBehaviors: {},
height: 25
});
},
@ -16946,20 +16977,28 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.year = BI.createWidget({
type: "bi.year_combo"
type: "bi.year_combo",
behaviors: o.yearBehaviors
});
this.quarter = BI.createWidget({
type: "bi.quarter_combo"
type: "bi.quarter_combo",
behaviors: o.quarterBehaviors
});
this.year.on(BI.YearCombo.EVENT_CONFIRM, function(){
this.year.on(BI.YearCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM);
});
this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
this.quarter.on(BI.QuarterCombo.EVENT_CONFIRM, function(){
this.quarter.on(BI.QuarterCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM);
});
this.quarter.on(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
BI.createWidget({
type: "bi.center",
@ -16984,6 +17023,7 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
}
});
BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);/**
* 简单的复选下拉框控件, 适用于数据量少的情况 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值
* 封装了字段处理逻辑

5
src/base/combination/combo.js

@ -375,11 +375,6 @@ BI.Combo = BI.inherit(BI.Widget, {
return this.position;
},
doBehavior: function () {
this._assertPopupView();
this.popupView && this.popupView.doBehavior.apply(this.popupView, arguments);
},
toggle: function () {
this._toggle();
},

5
src/base/combination/expander.js

@ -235,11 +235,6 @@ BI.Expander = BI.inherit(BI.Widget, {
return this.popupView;
},
doBehavior: function () {
//this._assertPopupView();
this.popupView && this.popupView.doBehavior.apply(this.popupView, arguments);
},
getAllLeaves: function () {
return this.popupView && this.popupView.getAllLeaves();
},

4
src/base/combination/loader.js

@ -195,10 +195,6 @@ BI.Loader = BI.inherit(BI.Widget, {
this.button_group.populate.apply(this.button_group, arguments);
},
doBehavior: function () {
this.button_group.doBehavior.apply(this.button_group, arguments);
},
setNotSelectedValue: function () {
this.button_group.setNotSelectedValue.apply(this.button_group, arguments);
},

5
src/base/combination/switcher.js

@ -239,11 +239,6 @@ BI.Switcher = BI.inherit(BI.Widget, {
this.isViewVisible() && BI.Maskers.show(this.getName());
},
doBehavior: function () {
this._assertPopupView();
this.popupView && this.popupView.doBehavior.apply(this.popupView, arguments);
},
getAllLeaves: function () {
return this.popupView && this.popupView.getAllLeaves();
},

4
src/base/single/label/label.js

@ -147,7 +147,7 @@ BI.Label = BI.inherit(BI.Single, {
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
this.text = BI.createWidget({
BI.createWidget({
type: "bi.center_adapt",
hgap: o.hgap,
vgap: o.vgap,
@ -345,7 +345,7 @@ BI.Label = BI.inherit(BI.Single, {
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json)
this.text = BI.createWidget({
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,

4
src/base/tree/customtree.js

@ -113,10 +113,6 @@ BI.CustomTree = BI.inherit(BI.Widget, {
this.tree.populate.apply(this.tree, args);
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree && this.tree.setValue(v);
},

2
src/case/calendar/calendar.year.js

@ -9,6 +9,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
var conf = BI.YearCalendar.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-year-calendar",
behaviors: {},
logic: {
dynamic: false
},
@ -73,6 +74,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
this.years = BI.createWidget({
type: "bi.button_group",
behaviors: o.behaviors,
items: BI.createItems(items, {}),
layouts: [BI.LogicFactory.createLogic("table", BI.extend({}, o.logic, {
columns: 2,

4
src/case/layer/pane.list.js

@ -127,10 +127,6 @@ BI.ListPane = BI.inherit(BI.Pane, {
this.button_group.empty();
},
doBehavior: function () {
this.button_group.doBehavior.apply(this.button_group, arguments);
},
setNotSelectedValue: function () {
this.button_group.setNotSelectedValue.apply(this.button_group, arguments);
},

4
src/case/list/list.select.js

@ -164,10 +164,6 @@ BI.SelectList = BI.inherit(BI.Widget, {
this.list.element.css({"max-height": h - toolHeight + "px"})
},
doBehavior: function () {
this.list.doBehavior.apply(this.list, arguments);
},
setNotSelectedValue: function () {
this.list.setNotSelectedValue.apply(this.list, arguments);
this._checkAllSelected();

4
src/case/loader/loader.lazy.js

@ -54,10 +54,6 @@ BI.LazyLoader = BI.inherit(BI.Widget, {
this.loader.empty();
},
doBehavior: function () {
this.loader.doBehavior();
},
setNotSelectedValue: function () {
this.loader.setNotSelectedValue.apply(this.loader, arguments);
},

4
src/case/loader/loader.list.js

@ -148,10 +148,6 @@ BI.ListLoader = BI.inherit(BI.Widget, {
});
},
doBehavior: function () {
this.button_group.doBehavior.apply(this.button_group, arguments);
},
setNotSelectedValue: function () {
this.button_group.setNotSelectedValue.apply(this.button_group, arguments);
},

4
src/case/loader/sort.list.js

@ -121,10 +121,6 @@ BI.SortList = BI.inherit(BI.Widget, {
this.loader.empty();
},
doBehavior: function () {
this.loader.doBehavior.apply(this.loader, arguments);
},
setNotSelectedValue: function () {
this.loader.setNotSelectedValue.apply(this.loader, arguments);
},

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

@ -108,10 +108,6 @@ BI.LevelTree = BI.inherit(BI.Widget, {
this.tree.populate(items);
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree.setValue(v);
},

30
src/core/behavior/behavior.highlight.js

@ -5,26 +5,34 @@
* @extends BI.Behavior
*/
BI.HighlightBehavior = BI.inherit(BI.Behavior, {
_defaultConfig: function() {
return BI.extend(BI.HighlightBehavior.superclass._defaultConfig.apply(this, arguments), {
});
_defaultConfig: function () {
return BI.extend(BI.HighlightBehavior.superclass._defaultConfig.apply(this, arguments), {});
},
_init : function() {
_init: function () {
BI.HighlightBehavior.superclass._init.apply(this, arguments);
},
doBehavior: function(items){
doBehavior: function (items) {
var args = Array.prototype.slice.call(arguments, 1),
o = this.options;
BI.each(items, function(i, item){
if(item instanceof BI.Single) {
if (o.rule(item.getValue(), item)) {
item.doHighLight.apply(item, args);
BI.each(items, function (i, item) {
if (item instanceof BI.Single) {
var rule = o.rule(item.getValue(), item);
function doBe(run) {
if (run === true) {
item.doHighLight.apply(item, args);
} else {
item.unHighLight.apply(item, args);
}
}
if (BI.isFunction(rule)) {
rule(doBe);
} else {
item.unHighLight.apply(item, args);
doBe(rule);
}
} else {
item.doBehavior.apply(item, args);

8
src/core/widget.js

@ -254,6 +254,14 @@ BI.Widget = BI.inherit(BI.OB, {
}
},
doBehavior: function () {
var args = arguments;
//递归将所有子组件使有效
BI.each(this._children, function (i, child) {
child.doBehavior && child.doBehavior.apply(child, args);
});
},
getWidth: function () {
return this.options.width;
},

1
src/css/widget/year/popup.year.css

@ -3,7 +3,6 @@
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-year-popup .year-popup-navigation {
line-height: 30px;
color: #3f8ce8;
}
.bi-year-popup .year-popup-navigation > .center-element {
border-left: 1px solid #d4dadd;

1
src/less/widget/year/popup.year.less

@ -3,7 +3,6 @@
.bi-year-popup {
& .year-popup-navigation {
line-height: 30px;
color: @color-bi-text-highlight;
& > .center-element {
border-left: 1px solid @color-bi-border-line;
}

14
src/widget/month/combo.month.js

@ -9,6 +9,7 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MonthCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-month-combo",
behaviors: {},
height: 25
});
},
@ -21,9 +22,9 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
});
this.trigger.on(BI.MonthTrigger.EVENT_CONFIRM, function (v) {
if(this.getKey() && this.getKey() !== self.storeValue) {
if (this.getKey() && this.getKey() !== self.storeValue) {
self.setValue(this.getValue());
}else if(!this.getKey()){
} else if (!this.getKey()) {
self.setValue();
}
self.fireEvent(BI.MonthCombo.EVENT_CONFIRM);
@ -44,7 +45,8 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
});
this.popup = BI.createWidget({
type: "bi.month_popup"
type: "bi.month_popup",
behaviors: o.behaviors
});
this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
@ -62,7 +64,10 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
minWidth: 85,
el: this.popup
}
})
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW);
});
},
setValue: function (v) {
@ -76,4 +81,5 @@ BI.MonthCombo = BI.inherit(BI.Widget, {
});
BI.MonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.MonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.month_combo', BI.MonthCombo);

6
src/widget/month/popup.month.js

@ -9,13 +9,14 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MonthPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-month-popup"
baseCls: "bi-month-popup",
behaviors: {}
});
},
_init: function () {
BI.MonthPopup.superclass._init.apply(this, arguments);
var self = this;
var self = this, o = this.options;
//纵向排列月
var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11];
@ -46,6 +47,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
this.month = BI.createWidget({
type: "bi.button_group",
element: this,
behaviors: o.behaviors,
items: BI.createItems(items, {}),
layouts: [BI.LogicFactory.createLogic("table", BI.extend({
dynamic: true

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

@ -103,10 +103,6 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree.setValue(v);
},

4
src/widget/multilayersingletree/multilayersingletree.leveltree.js

@ -106,10 +106,6 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree.setValue(v);
},

16
src/widget/quarter/combo.quarter.js

@ -9,6 +9,7 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.QuarterCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-quarter-combo",
behaviors: {},
height: 25
});
},
@ -29,24 +30,25 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
this.trigger.on(BI.QuarterTrigger.EVENT_START, function () {
self.combo.isViewVisible() && self.combo.hideView();
});
this.trigger.on(BI.QuarterTrigger.EVENT_STOP, function(){
this.trigger.on(BI.QuarterTrigger.EVENT_STOP, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.trigger.on(BI.QuarterTrigger.EVENT_CONFIRM, function () {
if(self.combo.isViewVisible()) {
if (self.combo.isViewVisible()) {
return;
}
if(this.getKey() && this.getKey() !== self.storeValue) {
if (this.getKey() && this.getKey() !== self.storeValue) {
self.setValue(this.getKey());
}else if(!this.getKey()){
} else if (!this.getKey()) {
self.setValue();
}
self.fireEvent(BI.QuarterCombo.EVENT_CONFIRM);
});
this.popup = BI.createWidget({
type: "bi.quarter_popup"
type: "bi.quarter_popup",
behaviors: o.behaviors
});
this.popup.on(BI.QuarterPopup.EVENT_CHANGE, function () {
@ -66,6 +68,9 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
el: this.popup
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
},
setValue: function (v) {
@ -79,4 +84,5 @@ BI.QuarterCombo = BI.inherit(BI.Widget, {
});
BI.QuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.quarter_combo', BI.QuarterCombo);

6
src/widget/quarter/popup.quarter.js

@ -9,13 +9,14 @@ BI.QuarterPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.QuarterPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-quarter-popup"
baseCls: "bi-quarter-popup",
behaviors: {}
});
},
_init: function () {
BI.QuarterPopup.superclass._init.apply(this, arguments);
var self = this;
var self = this, o = this.options;
var items = [{
text: Date._QN[01],
@ -45,6 +46,7 @@ BI.QuarterPopup = BI.inherit(BI.Widget, {
this.quarter = BI.createWidget({
type: "bi.button_group",
element: this,
behaviors: o.behaviors,
items: BI.createItems(items, {}),
layouts: [{
type: "bi.vertical"

43
src/widget/year/combo.year.js

@ -9,6 +9,7 @@ BI.YearCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-combo",
behaviors: {},
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
height: 25
@ -36,7 +37,7 @@ BI.YearCombo = BI.inherit(BI.Widget, {
self.combo.isViewVisible() && self.combo.hideView();
});
this.trigger.on(BI.YearTrigger.EVENT_CONFIRM, function () {
if(self.combo.isViewVisible()) {
if (self.combo.isViewVisible()) {
return;
}
if (this.getKey() && this.getKey() !== self.storeValue) {
@ -47,45 +48,50 @@ BI.YearCombo = BI.inherit(BI.Widget, {
self.fireEvent(BI.YearCombo.EVENT_CONFIRM);
});
this.popup = BI.createWidget({
type: "bi.year_popup",
min: o.min,
max: o.max
});
this.popup.on(BI.YearPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.YearCombo.EVENT_CONFIRM);
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
destroyWhenHide: true,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
popup: {
minWidth: 85,
stopPropagation: false,
el: this.popup
el: {
type: "bi.year_popup",
ref: function () {
self.popup = this;
},
listeners: [{
eventName: BI.YearPopup.EVENT_CHANGE,
action: function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.YearCombo.EVENT_CONFIRM);
}
}],
behaviors: o.behaviors,
min: o.min,
max: o.max
}
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
var value = self.trigger.getKey();
if (BI.isNotNull(value)) {
self.popup.setValue(value);
} else if(!value && value !== self.storeValue){
} else if (!value && value !== self.storeValue) {
self.popup.setValue(self.storeValue);
}else {
} else {
self.setValue();
}
self.fireEvent(BI.YearCombo.EVENT_BEFORE_POPUPVIEW);
});
},
setValue: function (v) {
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
@ -93,4 +99,5 @@ BI.YearCombo = BI.inherit(BI.Widget, {
}
});
BI.YearCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.YearCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.year_combo', BI.YearCombo);

5
src/widget/year/popup.year.js

@ -10,6 +10,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-popup",
behaviors: {},
min: '1900-01-01', //最小日期
max: '2099-12-31' //最大日期
});
@ -20,6 +21,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
var calendar = BI.createWidget({
type: "bi.year_calendar",
behaviors: o.behaviors,
min: o.min,
max: o.max,
logic: {
@ -56,11 +58,12 @@ BI.YearPopup = BI.inherit(BI.Widget, {
this.navigation = BI.createWidget({
type: "bi.navigation",
element: this,
single: true,
logic: {
dynamic: true
},
tab: {
cls: "year-popup-navigation bi-border-top",
cls: "year-popup-navigation bi-high-light bi-border-top",
height: 25,
items: [backBtn, preBtn]
},

19
src/widget/yearmonth/combo.yearmonth.js

@ -8,6 +8,8 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearMonthCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-month-combo",
yearBehaviors: {},
monthBehaviors: {},
height: 25
});
},
@ -16,20 +18,28 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.year = BI.createWidget({
type: "bi.year_combo"
type: "bi.year_combo",
behaviors: o.yearBehaviors
});
this.month = BI.createWidget({
type: "bi.month_combo"
type: "bi.month_combo",
behaviors: o.monthBehaviors
});
this.year.on(BI.YearCombo.EVENT_CONFIRM, function(){
this.year.on(BI.YearCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM);
});
this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW);
});
this.month.on(BI.MonthCombo.EVENT_CONFIRM, function(){
this.month.on(BI.MonthCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM);
});
this.month.on(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW);
});
BI.createWidget({
type: "bi.center",
@ -54,4 +64,5 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, {
}
});
BI.YearMonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.year_month_combo', BI.YearMonthCombo);

19
src/widget/yearquarter/combo.yearquarter.js

@ -8,6 +8,8 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearQuarterCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-quarter-combo",
yearBehaviors: {},
quarterBehaviors: {},
height: 25
});
},
@ -16,20 +18,28 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options;
this.year = BI.createWidget({
type: "bi.year_combo"
type: "bi.year_combo",
behaviors: o.yearBehaviors
});
this.quarter = BI.createWidget({
type: "bi.quarter_combo"
type: "bi.quarter_combo",
behaviors: o.quarterBehaviors
});
this.year.on(BI.YearCombo.EVENT_CONFIRM, function(){
this.year.on(BI.YearCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM);
});
this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
this.quarter.on(BI.QuarterCombo.EVENT_CONFIRM, function(){
this.quarter.on(BI.QuarterCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM);
});
this.quarter.on(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW);
});
BI.createWidget({
type: "bi.center",
@ -54,4 +64,5 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
}
});
BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);
Loading…
Cancel
Save