Browse Source

BI-48176 refactor: widget的_setEnable和_setValid的调用时机修改

es6
windy 6 years ago
parent
commit
3c1d3dc5a5
  1. 4
      src/case/list/list.select.js
  2. 7
      src/core/widget.js

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

@ -52,7 +52,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
callback.apply(self, arguments);
if (op.times === 1) {
self.toolbar.setVisible(items && items.length > 0);
self.toolbar.setEnable(items && items.length > 0);
self.toolbar.setEnable(!o.disabled && items && items.length > 0);
}
self._checkAllSelected();
});
@ -160,7 +160,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
populate: function (items) {
this.toolbar.setVisible(!BI.isEmptyArray(items));
this.toolbar.setEnable(!BI.isEmptyArray(items));
this.toolbar.setEnable(!this.options.disabled && !BI.isEmptyArray(items));
this.list.populate.apply(this.list, arguments);
this._checkAllSelected();
},

7
src/core/widget.js

@ -185,16 +185,17 @@
* @private
*/
_mount: function (force, deep, lifeHook, predicate) {
var self = this;
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false;
}
lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true;
this._mountChildren && this._mountChildren();
if(BI.isNotNull(this._parent)) {
!this._parent.isEnabled() && this._setEnable(false);
!this._parent.isValid() && this._setValid(false);
}
BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate);
});
lifeHook !== false && this.mounted && this.mounted();

Loading…
Cancel
Save