Browse Source

Pull request #1798: 无JIRA任务 update

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '34666f397cb902697b8ed74132763183910f5c28':
  update
  update
  update
  update
es6
imp 4 years ago
parent
commit
0647ba8974
  1. 3
      dist/fix/fix.compact.js
  2. 12
      src/base/single/single.js
  3. 35
      src/core/widget.js
  4. 6
      src/core/wrapper/layout.js

3
dist/fix/fix.compact.js vendored

@ -195,6 +195,9 @@
if (rendered) {
var newEls = render && render.call(this);
BI.each(childComponents, function (i, childComponent) {
if (childComponent.component instanceof BI.Layout) {
return; // 布局的过滤掉
}
var nextProps = BI.get([newEls], childComponent.path);
if (nextProps) {
var shouldUpdate = childComponent.component.shouldUpdate && childComponent.component.shouldUpdate(nextProps);

12
src/base/single/single.js

@ -200,18 +200,6 @@ BI.Single = BI.inherit(BI.Widget, {
return this.options.value;
},
update: function (props, shouldUpdate) {
if (BI.isObject(shouldUpdate)) {
props = shouldUpdate;
}
if ("value" in props) {
this.setValue(props.value);
}
if ("text" in props) {
this.setText && this.setText(props.text);
}
},
destroyed: function () {
if (BI.isNotNull(this.showTimeout)) {
clearTimeout(this.showTimeout);

35
src/core/widget.js

@ -226,37 +226,40 @@
* @returns {boolean}
* @private
*/
_mount: function (force, deep, lifeHook, predicate) {
if (this.__beforeMount(force, deep, lifeHook, predicate)) {
this.__afterMount(lifeHook, predicate);
return true;
}
return false;
},
__beforeMount: function (force, deep, lifeHook, predicate) {
_mount: function (force, deep, lifeHook, predicate, layer, queue) {
var self = this;
if (!layer) {
layer = 0;
}
if (!queue) {
queue = [];
}
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false;
}
lifeHook !== false && callLifeHook(this, "beforeMount");
this._isMounted = true;
queue.push(this);
BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget.__beforeMount && widget.__beforeMount(deep ? force : false, deep, lifeHook, predicate);
widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate, layer + 1, queue);
});
this._mountChildren && this._mountChildren();
if (layer === 0) {
BI.each(queue, function (i, w) {
w.__afterMount(lifeHook, predicate);
});
}
return true;
},
__afterMount: function (lifeHook, predicate) {
BI.each(this._children, function (i, widget) {
widget.__afterMount && widget.__afterMount(lifeHook, predicate);
});
lifeHook !== false && callLifeHook(this, "mounted");
this.fireEvent(BI.Events.MOUNT);
predicate && predicate(this);
if (this._isMounted) {
lifeHook !== false && callLifeHook(this, "mounted");
this.fireEvent(BI.Events.MOUNT);
predicate && predicate(this);
}
},
_mountChildren: null,

6
src/core/wrapper/layout.js

@ -366,9 +366,9 @@ BI.Layout = BI.inherit(BI.Widget, {
return child._update(this._getOptions(vnode), shouldUpdate);
}
if (shouldUpdate === null && !this._compare(oldVnode, vnode)) {
if (child.update) {
return child.update(this._getOptions(vnode));
}
// if (child.update) {
// return child.update(this._getOptions(vnode));
// }
return this.updateItemAt(index, vnode);
}
},

Loading…
Cancel
Save