guy 8 years ago
parent
commit
828d4b04fc
  1. 2
      demo.html
  2. 11
      dist/base.js
  3. 16
      dist/core.js
  4. 10
      src/base/combination/tab.js
  5. 1
      src/base/single/bar/bar.loading.js
  6. 1
      src/core/controller/controller.layer.js
  7. 5
      src/core/widget.js
  8. 10
      src/core/wrapper/layout/layout.card.js

2
demo.html

@ -22,7 +22,5 @@
<body> <body>
<div id="wrapper"></div> <div id="wrapper"></div>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900italic,900&subset=latin,greek,greek-ext,vietnamese,cyrillic-ext,latin-ext,cyrillic'
rel='stylesheet' type='text/css'>
</body> </body>
</html> </html>

11
dist/base.js vendored

@ -24962,9 +24962,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 (o.defaultShowIndex !== false) {
this.setSelect(o.defaultShowIndex);
}
}, },
_assertCard: function (v) { _assertCard: function (v) {
@ -24975,6 +24972,13 @@ BI.Tab = BI.inherit(BI.Widget, {
} }
}, },
mounted: function () {
var o = this.options;
if (o.defaultShowIndex !== false) {
this.setSelect(o.defaultShowIndex);
}
},
setSelect: function (v) { setSelect: function (v) {
this.tab && this.tab.setValue(v); this.tab && this.tab.setValue(v);
this._assertCard(v); this._assertCard(v);
@ -36274,6 +36278,7 @@ BI.LoadingBar = BI.inherit(BI.Single, {
this.loading = BI.createWidget({ this.loading = BI.createWidget({
type: "bi.layout", type: "bi.layout",
width: this.options.height,
height:this.options.height, height:this.options.height,
cls: "loading-background cursor-default" cls: "loading-background cursor-default"
}) })

16
dist/core.js vendored

@ -14434,7 +14434,7 @@ BI.Widget = BI.inherit(BI.OB, {
}) })
}) })
} }
if (this._isRoot === true) { if (this._isRoot === true || (!(this instanceof BI.Layout) && (this._parent && this._parent._isMounted))) {
this._mount(); this._mount();
} }
}, },
@ -14446,7 +14446,7 @@ BI.Widget = BI.inherit(BI.OB, {
_mount: function () { _mount: function () {
var self = this; var self = this;
var isMounted = this._isMounted; var isMounted = this._isMounted;
if (isMounted) { if (isMounted || !this.isVisible()) {
return; return;
} }
if (this._isRoot === true) { if (this._isRoot === true) {
@ -14515,6 +14515,7 @@ BI.Widget = BI.inherit(BI.OB, {
if (visible === true) { if (visible === true) {
this.options.invisible = false; this.options.invisible = false;
this.element.show(); this.element.show();
this._mount();
} else if (visible === false) { } else if (visible === false) {
this.options.invisible = true; this.options.invisible = true;
this.element.hide(); this.element.hide();
@ -20831,6 +20832,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
return this; return this;
} }
this._getLayout(name).visible(); this._getLayout(name).visible();
this._getLayout(name)._mount();
this._getLayout(name).element.css("z-index", this.zindex++).show(0, callback).trigger("__resize__"); this._getLayout(name).element.css("z-index", this.zindex++).show(0, callback).trigger("__resize__");
return this; return this;
}, },
@ -26629,7 +26631,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
return widget; return widget;
}, },
showCardByName: function (name, action, callback) { showCardByName: function (name, action) {
var self = this; var self = this;
//name不存在的时候全部隐藏 //name不存在的时候全部隐藏
var exist = this.hasWidget(this._getCardName(name)); var exist = this.hasWidget(this._getCardName(name));
@ -26641,12 +26643,9 @@ BI.CardLayout = BI.inherit(BI.Layout, {
BI.each(this._children, function (i, el) { BI.each(this._children, function (i, el) {
if (self._getCardName(name) != i) { if (self._getCardName(name) != i) {
//动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了 //动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了
!flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.element.hide(); !flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible();
} else { } else {
(BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : el.element.show(0, function () { (BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : (el.visible(), el._mount())
el._mount();
callback && callback();
});
} }
}); });
}, },
@ -26659,6 +26658,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
el.element.hide(); el.element.hide();
} else { } else {
el.element.show(); el.element.show();
el._mount();
} }
}) })
}, },

10
src/base/combination/tab.js

@ -53,9 +53,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 (o.defaultShowIndex !== false) {
this.setSelect(o.defaultShowIndex);
}
}, },
_assertCard: function (v) { _assertCard: function (v) {
@ -66,6 +63,13 @@ BI.Tab = BI.inherit(BI.Widget, {
} }
}, },
mounted: function () {
var o = this.options;
if (o.defaultShowIndex !== false) {
this.setSelect(o.defaultShowIndex);
}
},
setSelect: function (v) { setSelect: function (v) {
this.tab && this.tab.setValue(v); this.tab && this.tab.setValue(v);
this._assertCard(v); this._assertCard(v);

1
src/base/single/bar/bar.loading.js

@ -32,6 +32,7 @@ BI.LoadingBar = BI.inherit(BI.Single, {
this.loading = BI.createWidget({ this.loading = BI.createWidget({
type: "bi.layout", type: "bi.layout",
width: this.options.height,
height:this.options.height, height:this.options.height,
cls: "loading-background cursor-default" cls: "loading-background cursor-default"
}) })

1
src/core/controller/controller.layer.js

@ -127,6 +127,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
return this; return this;
} }
this._getLayout(name).visible(); this._getLayout(name).visible();
this._getLayout(name)._mount();
this._getLayout(name).element.css("z-index", this.zindex++).show(0, callback).trigger("__resize__"); this._getLayout(name).element.css("z-index", this.zindex++).show(0, callback).trigger("__resize__");
return this; return this;
}, },

5
src/core/widget.js

@ -135,7 +135,7 @@ BI.Widget = BI.inherit(BI.OB, {
}) })
}) })
} }
if (this._isRoot === true) { if (this._isRoot === true || (!(this instanceof BI.Layout) && (this._parent && this._parent._isMounted))) {
this._mount(); this._mount();
} }
}, },
@ -147,7 +147,7 @@ BI.Widget = BI.inherit(BI.OB, {
_mount: function () { _mount: function () {
var self = this; var self = this;
var isMounted = this._isMounted; var isMounted = this._isMounted;
if (isMounted) { if (isMounted || !this.isVisible()) {
return; return;
} }
if (this._isRoot === true) { if (this._isRoot === true) {
@ -216,6 +216,7 @@ BI.Widget = BI.inherit(BI.OB, {
if (visible === true) { if (visible === true) {
this.options.invisible = false; this.options.invisible = false;
this.element.show(); this.element.show();
this._mount();
} else if (visible === false) { } else if (visible === false) {
this.options.invisible = true; this.options.invisible = true;
this.element.hide(); this.element.hide();

10
src/core/wrapper/layout/layout.card.js

@ -86,7 +86,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
return widget; return widget;
}, },
showCardByName: function (name, action, callback) { showCardByName: function (name, action) {
var self = this; var self = this;
//name不存在的时候全部隐藏 //name不存在的时候全部隐藏
var exist = this.hasWidget(this._getCardName(name)); var exist = this.hasWidget(this._getCardName(name));
@ -98,12 +98,9 @@ BI.CardLayout = BI.inherit(BI.Layout, {
BI.each(this._children, function (i, el) { BI.each(this._children, function (i, el) {
if (self._getCardName(name) != i) { if (self._getCardName(name) != i) {
//动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了 //动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了
!flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.element.hide(); !flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible();
} else { } else {
(BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : el.element.show(0, function () { (BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : (el.visible(), el._mount())
el._mount();
callback && callback();
});
} }
}); });
}, },
@ -116,6 +113,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
el.element.hide(); el.element.hide();
} else { } else {
el.element.show(); el.element.show();
el._mount();
} }
}) })
}, },

Loading…
Cancel
Save