Browse Source

Pull request #2587: 无jira任务 tab showIndex function

Merge in VISUAL/fineui from ~IMP/fineui_fui:master to master

* commit '957adca2484bb6b6295a0eea2b0489d7000bfae3':
  无jira任务 tab showIndex function v3
  无jira任务 tab showIndex function v2
  无jira任务 tab showIndex function v1
  无jira任务 tab showIndex function
es6
imp 3 years ago
parent
commit
dac25f65c7
  1. 24
      src/base/combination/tab.js

24
src/base/combination/tab.js

@ -23,7 +23,7 @@ BI.Tab = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
if (BI.isObject(o.tab)) { if (BI.isObject(o.tab)) {
this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"}); this.tab = BI.createWidget(this.options.tab, { type: "bi.button_group" });
this.tab.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.tab.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}); });
@ -45,6 +45,7 @@ BI.Tab = BI.inherit(BI.Widget, {
cardCreator: function (v) { cardCreator: function (v) {
var card = o.cardCreator.apply(self, arguments); var card = o.cardCreator.apply(self, arguments);
self.cardMap[v] = card; self.cardMap[v] = card;
return card; return card;
}, },
afterCardShow: function (v) { afterCardShow: function (v) {
@ -55,12 +56,6 @@ BI.Tab = BI.inherit(BI.Widget, {
listener.on(BI.ShowListener.EVENT_CHANGE, function (value) { listener.on(BI.ShowListener.EVENT_CHANGE, function (value) {
self.fireEvent(BI.Tab.EVENT_CHANGE, value, self); self.fireEvent(BI.Tab.EVENT_CHANGE, value, self);
}); });
if (BI.isFunction(o.showIndex)) {
this.__watch(o.showIndex, function (context, newValue) {
self.setSelect(newValue);
})
}
}, },
_deleteOtherCards: function (currCardName) { _deleteOtherCards: function (currCardName) {
@ -85,15 +80,22 @@ BI.Tab = BI.inherit(BI.Widget, {
_keepAlive: function (v) { _keepAlive: function (v) {
var o = this.options; var o = this.options;
return BI.isFunction(o.keepAlives) ? o.keepAlives(v) : BI.contains(o.keepAlives, v);
return BI.isFunction(o.keepAlives) ? o.keepAlives(v) : BI.contains(o.keepAlives, v);
}, },
created: function () { created: function () {
var o = this.options; var self = this, o = this.options;
if (o.showIndex !== false) { if (o.showIndex !== false) {
if (BI.isFunction(o.showIndex)) {
var v = this.__watch(o.showIndex, function (context, newValue) {
self.setSelect(newValue);
});
this.setSelect(v);
} else {
this.setSelect(o.showIndex); this.setSelect(o.showIndex);
} }
}
}, },
setSelect: function (v, action, callback) { setSelect: function (v, action, callback) {
@ -112,6 +114,7 @@ BI.Tab = BI.inherit(BI.Widget, {
if (BI.isEqual(name, (cardname + ""))) { if (BI.isEqual(name, (cardname + ""))) {
self.layout.deleteCardByName(name); self.layout.deleteCardByName(name);
delete self.cardMap[name]; delete self.cardMap[name];
return true; return true;
} }
}); });
@ -131,7 +134,8 @@ BI.Tab = BI.inherit(BI.Widget, {
getTab: function (v) { getTab: function (v) {
this._assertCard(v); this._assertCard(v);
return this.layout.getCardByName(v);
return this.layout.getCardByName(v);
}, },
setValue: function (v) { setValue: function (v) {

Loading…
Cancel
Save