Browse Source

update

master
guy 6 years ago
parent
commit
37339459df
  1. 51
      dist/bundle.js
  2. 70
      dist/bundle.min.js
  3. 51
      dist/core.js
  4. 51
      dist/fineui.js
  5. 70
      dist/fineui.min.js
  6. 27
      dist/fineui_without_jquery_polyfill.js
  7. 2
      dist/utils.min.js
  8. 22
      src/core/platform/dom/dom.js
  9. 27
      src/core/widget.js

51
dist/bundle.js vendored

@ -12122,7 +12122,32 @@ _.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);
});
// 将新的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 +18522,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 +18792,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);

70
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

51
dist/core.js vendored

@ -12122,7 +12122,32 @@ _.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);
});
// 将新的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 +18522,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 +18792,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);

51
dist/fineui.js vendored

@ -12364,7 +12364,32 @@ _.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);
});
// 将新的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 +18764,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 +19034,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);

70
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

27
dist/fineui_without_jquery_polyfill.js vendored

@ -12122,7 +12122,32 @@ _.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);
});
// 将新的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);
} }

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, {
}; };
} }
}); });
})();

27
src/core/widget.js

@ -491,7 +491,32 @@
} }
}); });
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);
});
// 将新的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