Browse Source

Merge pull request #657 in VISUAL/fineui from ~GUY/fineui:master to master

* commit '105b0a1574652c7210197f89947fba09a972c3b7':
  add
  update
  update
master
guy 6 years ago
parent
commit
3e84aed153
  1. 56
      dist/bundle.js
  2. 2
      dist/bundle.min.css
  3. 70
      dist/bundle.min.js
  4. 52
      dist/core.js
  5. 56
      dist/fineui.js
  6. 2
      dist/fineui.min.css
  7. 70
      dist/fineui.min.js
  8. 32
      dist/fineui_without_jquery_polyfill.js
  9. 2
      dist/utils.min.js
  10. 22
      src/core/platform/dom/dom.js
  11. 28
      src/core/widget.js

56
dist/bundle.js vendored

@ -12122,7 +12122,33 @@ _.extend(BI.OB.prototype, {
} }
}); });
BI.mount = function (widget, container, predicate) { BI.mount = function (widget, container, predicate, hydrate) {
if(hydrate === true){
// 将widget的element元素都挂载好,并建立相互关系
var res = widget._mount(true, false, false, function(w){
var ws = w.element.data("__widgets");
if(!ws) {
ws = [];
}
ws.push(w);
w.element.data("__widgets", ws);
predicate && predicate.apply(this, arguments);
});
// 将新的dom树属性(事件等)patch到已存在的dom上
var c = BI.Widget._renderEngine.createElement;
BI.DOM.patchProps(widget.element, c(c(container).children()[0]));
var triggerLifeHook = function (w) {
w.beforeMount && w.beforeMount();
w.mounted && w.mounted();
BI.each(w._children, function (i, child) {
triggerLifeHook(child);
});
};
//最后触发组件树生命周期函数
triggerLifeHook(widget);
return res;
}
if (container) { if (container) {
BI.Widget._renderEngine.createElement(container).append(widget.element); BI.Widget._renderEngine.createElement(container).append(widget.element);
} }
@ -18497,9 +18523,30 @@ BI.prepares.push(function () {
* 对DOM操作的通用函数 * 对DOM操作的通用函数
* @type {{}} * @type {{}}
*/ */
!(function () {
BI.DOM = {}; BI.DOM = {};
BI.extend(BI.DOM, { BI.extend(BI.DOM, {
patchProps: function (fromElement, toElement) {
var elemData = jQuery._data(fromElement[0]);
var events = elemData.events;
BI.each(events, function (eventKey, event) {
var handlers = event.handlers;
BI.each(handlers, function (i, handler) {
toElement.on(eventKey, handler);
});
});
var fromChildren = fromElement.children(), toChildren = toElement.children();
if(fromChildren.length !== toChildren.length) {
throw new Error("不匹配");
}
BI.each(fromChildren, function (i, child) {
BI.DOM.patchProps(jQuery(child), jQuery(toChildren[i]));
});
BI.each(fromElement.data("__widgets"), function (i, widget) {
widget.element = toElement;
});
},
/** /**
* 把dom数组或元素悬挂起来,使其不对html产生影响 * 把dom数组或元素悬挂起来,使其不对html产生影响
* @param dom * @param dom
@ -18746,7 +18793,8 @@ BI.extend(BI.DOM, {
param: param param: param
}; };
} }
});BI.EventListener = { });
})();BI.EventListener = {
listen: function listen (target, eventType, callback) { listen: function listen (target, eventType, callback) {
if (target.addEventListener) { if (target.addEventListener) {
target.addEventListener(eventType, callback, false); target.addEventListener(eventType, callback, false);
@ -35216,12 +35264,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
defineProps(this, keys); defineProps(this, keys);
childContext && defineContext(this, childContext); childContext && defineContext(this, childContext);
this.$$model && (this.model.__ob__ = this.$$model.__ob__); this.$$model && (this.model.__ob__ = this.$$model.__ob__);
initMixins(this, mixins);
this._init(); this._init();
initState(this, state); initState(this, state);
initMixins(this, mixins);
initMethods(this, actions);
initComputed(this, computed); initComputed(this, computed);
initWatch(this, watch$$1); initWatch(this, watch$$1);
initMethods(this, actions);
this.created && this.created(); this.created && this.created();
if (this.$$model) { if (this.$$model) {
return this.model; return this.model;

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

70
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

52
dist/core.js vendored

@ -12122,7 +12122,33 @@ _.extend(BI.OB.prototype, {
} }
}); });
BI.mount = function (widget, container, predicate) { BI.mount = function (widget, container, predicate, hydrate) {
if(hydrate === true){
// 将widget的element元素都挂载好,并建立相互关系
var res = widget._mount(true, false, false, function(w){
var ws = w.element.data("__widgets");
if(!ws) {
ws = [];
}
ws.push(w);
w.element.data("__widgets", ws);
predicate && predicate.apply(this, arguments);
});
// 将新的dom树属性(事件等)patch到已存在的dom上
var c = BI.Widget._renderEngine.createElement;
BI.DOM.patchProps(widget.element, c(c(container).children()[0]));
var triggerLifeHook = function (w) {
w.beforeMount && w.beforeMount();
w.mounted && w.mounted();
BI.each(w._children, function (i, child) {
triggerLifeHook(child);
});
};
//最后触发组件树生命周期函数
triggerLifeHook(widget);
return res;
}
if (container) { if (container) {
BI.Widget._renderEngine.createElement(container).append(widget.element); BI.Widget._renderEngine.createElement(container).append(widget.element);
} }
@ -18497,9 +18523,30 @@ BI.prepares.push(function () {
* 对DOM操作的通用函数 * 对DOM操作的通用函数
* @type {{}} * @type {{}}
*/ */
!(function () {
BI.DOM = {}; BI.DOM = {};
BI.extend(BI.DOM, { BI.extend(BI.DOM, {
patchProps: function (fromElement, toElement) {
var elemData = jQuery._data(fromElement[0]);
var events = elemData.events;
BI.each(events, function (eventKey, event) {
var handlers = event.handlers;
BI.each(handlers, function (i, handler) {
toElement.on(eventKey, handler);
});
});
var fromChildren = fromElement.children(), toChildren = toElement.children();
if(fromChildren.length !== toChildren.length) {
throw new Error("不匹配");
}
BI.each(fromChildren, function (i, child) {
BI.DOM.patchProps(jQuery(child), jQuery(toChildren[i]));
});
BI.each(fromElement.data("__widgets"), function (i, widget) {
widget.element = toElement;
});
},
/** /**
* 把dom数组或元素悬挂起来,使其不对html产生影响 * 把dom数组或元素悬挂起来,使其不对html产生影响
* @param dom * @param dom
@ -18746,7 +18793,8 @@ BI.extend(BI.DOM, {
param: param param: param
}; };
} }
});BI.EventListener = { });
})();BI.EventListener = {
listen: function listen (target, eventType, callback) { listen: function listen (target, eventType, callback) {
if (target.addEventListener) { if (target.addEventListener) {
target.addEventListener(eventType, callback, false); target.addEventListener(eventType, callback, false);

56
dist/fineui.js vendored

@ -12364,7 +12364,33 @@ _.extend(BI.OB.prototype, {
} }
}); });
BI.mount = function (widget, container, predicate) { BI.mount = function (widget, container, predicate, hydrate) {
if(hydrate === true){
// 将widget的element元素都挂载好,并建立相互关系
var res = widget._mount(true, false, false, function(w){
var ws = w.element.data("__widgets");
if(!ws) {
ws = [];
}
ws.push(w);
w.element.data("__widgets", ws);
predicate && predicate.apply(this, arguments);
});
// 将新的dom树属性(事件等)patch到已存在的dom上
var c = BI.Widget._renderEngine.createElement;
BI.DOM.patchProps(widget.element, c(c(container).children()[0]));
var triggerLifeHook = function (w) {
w.beforeMount && w.beforeMount();
w.mounted && w.mounted();
BI.each(w._children, function (i, child) {
triggerLifeHook(child);
});
};
//最后触发组件树生命周期函数
triggerLifeHook(widget);
return res;
}
if (container) { if (container) {
BI.Widget._renderEngine.createElement(container).append(widget.element); BI.Widget._renderEngine.createElement(container).append(widget.element);
} }
@ -18739,9 +18765,30 @@ BI.prepares.push(function () {
* 对DOM操作的通用函数 * 对DOM操作的通用函数
* @type {{}} * @type {{}}
*/ */
!(function () {
BI.DOM = {}; BI.DOM = {};
BI.extend(BI.DOM, { BI.extend(BI.DOM, {
patchProps: function (fromElement, toElement) {
var elemData = jQuery._data(fromElement[0]);
var events = elemData.events;
BI.each(events, function (eventKey, event) {
var handlers = event.handlers;
BI.each(handlers, function (i, handler) {
toElement.on(eventKey, handler);
});
});
var fromChildren = fromElement.children(), toChildren = toElement.children();
if(fromChildren.length !== toChildren.length) {
throw new Error("不匹配");
}
BI.each(fromChildren, function (i, child) {
BI.DOM.patchProps(jQuery(child), jQuery(toChildren[i]));
});
BI.each(fromElement.data("__widgets"), function (i, widget) {
widget.element = toElement;
});
},
/** /**
* 把dom数组或元素悬挂起来,使其不对html产生影响 * 把dom数组或元素悬挂起来,使其不对html产生影响
* @param dom * @param dom
@ -18988,7 +19035,8 @@ BI.extend(BI.DOM, {
param: param param: param
}; };
} }
});BI.EventListener = { });
})();BI.EventListener = {
listen: function listen (target, eventType, callback) { listen: function listen (target, eventType, callback) {
if (target.addEventListener) { if (target.addEventListener) {
target.addEventListener(eventType, callback, false); target.addEventListener(eventType, callback, false);
@ -35458,12 +35506,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
defineProps(this, keys); defineProps(this, keys);
childContext && defineContext(this, childContext); childContext && defineContext(this, childContext);
this.$$model && (this.model.__ob__ = this.$$model.__ob__); this.$$model && (this.model.__ob__ = this.$$model.__ob__);
initMixins(this, mixins);
this._init(); this._init();
initState(this, state); initState(this, state);
initMixins(this, mixins);
initMethods(this, actions);
initComputed(this, computed); initComputed(this, computed);
initWatch(this, watch$$1); initWatch(this, watch$$1);
initMethods(this, actions);
this.created && this.created(); this.created && this.created();
if (this.$$model) { if (this.$$model) {
return this.model; return this.model;

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

70
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

32
dist/fineui_without_jquery_polyfill.js vendored

@ -12122,7 +12122,33 @@ _.extend(BI.OB.prototype, {
} }
}); });
BI.mount = function (widget, container, predicate) { BI.mount = function (widget, container, predicate, hydrate) {
if(hydrate === true){
// 将widget的element元素都挂载好,并建立相互关系
var res = widget._mount(true, false, false, function(w){
var ws = w.element.data("__widgets");
if(!ws) {
ws = [];
}
ws.push(w);
w.element.data("__widgets", ws);
predicate && predicate.apply(this, arguments);
});
// 将新的dom树属性(事件等)patch到已存在的dom上
var c = BI.Widget._renderEngine.createElement;
BI.DOM.patchProps(widget.element, c(c(container).children()[0]));
var triggerLifeHook = function (w) {
w.beforeMount && w.beforeMount();
w.mounted && w.mounted();
BI.each(w._children, function (i, child) {
triggerLifeHook(child);
});
};
//最后触发组件树生命周期函数
triggerLifeHook(widget);
return res;
}
if (container) { if (container) {
BI.Widget._renderEngine.createElement(container).append(widget.element); BI.Widget._renderEngine.createElement(container).append(widget.element);
} }
@ -24249,12 +24275,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
defineProps(this, keys); defineProps(this, keys);
childContext && defineContext(this, childContext); childContext && defineContext(this, childContext);
this.$$model && (this.model.__ob__ = this.$$model.__ob__); this.$$model && (this.model.__ob__ = this.$$model.__ob__);
initMixins(this, mixins);
this._init(); this._init();
initState(this, state); initState(this, state);
initMixins(this, mixins);
initMethods(this, actions);
initComputed(this, computed); initComputed(this, computed);
initWatch(this, watch$$1); initWatch(this, watch$$1);
initMethods(this, actions);
this.created && this.created(); this.created && this.created();
if (this.$$model) { if (this.$$model) {
return this.model; return this.model;

2
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

22
src/core/platform/dom/dom.js

@ -2,9 +2,30 @@
* 对DOM操作的通用函数 * 对DOM操作的通用函数
* @type {{}} * @type {{}}
*/ */
!(function () {
BI.DOM = {}; BI.DOM = {};
BI.extend(BI.DOM, { BI.extend(BI.DOM, {
patchProps: function (fromElement, toElement) {
var elemData = jQuery._data(fromElement[0]);
var events = elemData.events;
BI.each(events, function (eventKey, event) {
var handlers = event.handlers;
BI.each(handlers, function (i, handler) {
toElement.on(eventKey, handler);
});
});
var fromChildren = fromElement.children(), toChildren = toElement.children();
if(fromChildren.length !== toChildren.length) {
throw new Error("不匹配");
}
BI.each(fromChildren, function (i, child) {
BI.DOM.patchProps(jQuery(child), jQuery(toChildren[i]));
});
BI.each(fromElement.data("__widgets"), function (i, widget) {
widget.element = toElement;
});
},
/** /**
* 把dom数组或元素悬挂起来,使其不对html产生影响 * 把dom数组或元素悬挂起来,使其不对html产生影响
* @param dom * @param dom
@ -252,3 +273,4 @@ BI.extend(BI.DOM, {
}; };
} }
}); });
})();

28
src/core/widget.js

@ -491,7 +491,33 @@
} }
}); });
BI.mount = function (widget, container, predicate) { BI.mount = function (widget, container, predicate, hydrate) {
if(hydrate === true){
// 将widget的element元素都挂载好,并建立相互关系
var res = widget._mount(true, false, false, function(w){
var ws = w.element.data("__widgets");
if(!ws) {
ws = [];
}
ws.push(w);
w.element.data("__widgets", ws);
predicate && predicate.apply(this, arguments);
});
// 将新的dom树属性(事件等)patch到已存在的dom上
var c = BI.Widget._renderEngine.createElement;
BI.DOM.patchProps(widget.element, c(c(container).children()[0]));
var triggerLifeHook = function (w) {
w.beforeMount && w.beforeMount();
w.mounted && w.mounted();
BI.each(w._children, function (i, child) {
triggerLifeHook(child);
});
};
//最后触发组件树生命周期函数
triggerLifeHook(widget);
return res;
}
if (container) { if (container) {
BI.Widget._renderEngine.createElement(container).append(widget.element); BI.Widget._renderEngine.createElement(container).append(widget.element);
} }

Loading…
Cancel
Save