|
|
|
@ -13,6 +13,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
|
|
|
|
|
items: [] |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
render: function () { |
|
|
|
|
BI.CardLayout.superclass.render.apply(this, arguments); |
|
|
|
|
this.populate(this.options.items); |
|
|
|
@ -37,9 +38,9 @@ BI.CardLayout = BI.inherit(BI.Layout, {
|
|
|
|
|
o.items.splice(index, 1); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
self.addWidget(item.cardName, w); |
|
|
|
|
self.addWidget(self._getChildName(item.cardName), w); |
|
|
|
|
} else { |
|
|
|
|
var w = self.getWidgetByName(item.cardName); |
|
|
|
|
var w = self.getWidgetByName(self._getChildName(item.cardName)); |
|
|
|
|
} |
|
|
|
|
w.element.css({position: "absolute", top: "0", right: "0", bottom: "0", left: "0"}); |
|
|
|
|
w.setVisible(false); |
|
|
|
@ -71,11 +72,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
|
|
|
|
|
if (!this.isCardExisted(cardName)) { |
|
|
|
|
throw new Error("cardName is not exist"); |
|
|
|
|
} |
|
|
|
|
return this._children[cardName]; |
|
|
|
|
return this._children[this._getChildName(cardName)]; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_deleteCardByName: function (cardName) { |
|
|
|
|
delete this._children[cardName]; |
|
|
|
|
delete this._children[this.getName() + "_" + cardName]; |
|
|
|
|
var index = BI.findIndex(this.options.items, function (i, item) { |
|
|
|
|
return item.cardName == cardName; |
|
|
|
|
}); |
|
|
|
@ -89,7 +90,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
|
|
|
|
|
throw new Error("cardName is not exist"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var child = this._children[cardName]; |
|
|
|
|
var child = this._children[this._getChildName(cardName)]; |
|
|
|
|
this._deleteCardByName(cardName); |
|
|
|
|
child && child._destroy(); |
|
|
|
|
}, |
|
|
|
@ -107,7 +108,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
|
|
|
|
|
height: "100%" |
|
|
|
|
}).appendTo(this.element); |
|
|
|
|
widget.invisible(); |
|
|
|
|
this.addWidget(cardName, widget); |
|
|
|
|
this.addWidget(this._getChildName(cardName), widget); |
|
|
|
|
this.options.items.push({el: cardItem, cardName: cardName}); |
|
|
|
|
return widget; |
|
|
|
|
}, |
|
|
|
@ -122,7 +123,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
|
|
|
|
|
this.showIndex = name; |
|
|
|
|
var flag = false; |
|
|
|
|
BI.each(this.options.items, function (i, item) { |
|
|
|
|
var el = self._children[item.cardName]; |
|
|
|
|
var el = self._children[self._getChildName(item.cardName)]; |
|
|
|
|
if (el) { |
|
|
|
|
if (name != item.cardName) { |
|
|
|
|
// 动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了
|
|
|
|
@ -138,7 +139,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
|
|
|
|
|
var self = this; |
|
|
|
|
this.showIndex = this.lastShowIndex; |
|
|
|
|
BI.each(this.options.items, function (i, item) { |
|
|
|
|
self._children[item.cardName].setVisible(self.showIndex == i); |
|
|
|
|
self._children[self._getChildName(item.cardName)].setVisible(self.showIndex == i); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -161,7 +162,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
|
|
|
|
|
if (!BI.isKey(this.showIndex)) { |
|
|
|
|
return void 0; |
|
|
|
|
} |
|
|
|
|
return this.getWidgetByName(this.showIndex); |
|
|
|
|
return this.getWidgetByName(this._getChildName(this.showIndex)); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
deleteAllCard: function () { |
|
|
|
@ -174,7 +175,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
|
|
|
|
|
hideAllCard: function () { |
|
|
|
|
var self = this; |
|
|
|
|
BI.each(this.options.items, function (i, item) { |
|
|
|
|
self._children[item.cardName].invisible(); |
|
|
|
|
self._children[self._getChildName(item.cardName)].invisible(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -182,7 +183,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
|
|
|
|
|
var self = this; |
|
|
|
|
var flag = true; |
|
|
|
|
BI.some(this.options.items, function (i, item) { |
|
|
|
|
if (self._children[item.cardName].isVisible()) { |
|
|
|
|
if (self._children[self._getChildName(item.cardName)].isVisible()) { |
|
|
|
|
flag = false; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -191,11 +192,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
removeWidget: function (nameOrWidget) { |
|
|
|
|
var removeName; |
|
|
|
|
var removeName, self = this; |
|
|
|
|
if (BI.isWidget(nameOrWidget)) { |
|
|
|
|
BI.each(this._children, function (name, child) { |
|
|
|
|
if (child === nameOrWidget) { |
|
|
|
|
removeName = name; |
|
|
|
|
removeName = name.replace(self.getName() + "_", ""); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|