Browse Source

Merge branch 'master' of http://cloud.finedevelop.com:2015/scm/visual/fineui

# Conflicts:
#	dist/bundle.min.js
#	dist/fineui.min.js
#	dist/utils.min.js
es6
windy 6 years ago
parent
commit
76c9800fcb
  1. 1
      Gruntfile.js
  2. 46
      dist/bundle.js
  3. 29
      dist/core.js
  4. 29
      dist/fineui.js
  5. 23
      dist/fineui_without_jquery_polyfill.js
  6. 188
      dist/utils.js
  7. 1274
      package-lock.json
  8. 17
      public/js/fineui.i18n.js
  9. 6
      src/core/platform/web/dom.js
  10. 2
      src/core/shortcut.js
  11. 21
      src/core/widget.js

1
Gruntfile.js

@ -188,6 +188,7 @@ module.exports = function (grunt) {
"src/core/utils/*.js", "src/core/utils/*.js",
"utils/date.i18n.js", "utils/date.i18n.js",
"public/js/fineui.i18n.js",
"src/data/data.js", "src/data/data.js",
"src/data/**/*.js" "src/data/**/*.js"
], ],

46
dist/bundle.js vendored

@ -12123,15 +12123,18 @@ _.extend(BI.OB.prototype, {
}); });
BI.mount = function (widget, container, predicate, hydrate) { BI.mount = function (widget, container, predicate, hydrate) {
if(hydrate === true){ if (hydrate === true) {
// 将widget的element元素都挂载好,并建立相互关系 // 将widget的element元素都挂载好,并建立相互关系
var res = widget._mount(true, false, false, function(w){ widget.element.data("__widgets", [widget]);
var ws = w.element.data("__widgets"); var res = widget._mount(true, false, false, function (w) {
if(!ws) { BI.each(w._children, function (i, child) {
ws = []; var ws = child.element.data("__widgets");
} if (!ws) {
ws.push(w); ws = [];
w.element.data("__widgets", ws); }
ws.push(child);
child.element.data("__widgets", ws);
});
predicate && predicate.apply(this, arguments); predicate && predicate.apply(this, arguments);
}); });
// 将新的dom树属性(事件等)patch到已存在的dom上 // 将新的dom树属性(事件等)patch到已存在的dom上
@ -12145,7 +12148,7 @@ _.extend(BI.OB.prototype, {
triggerLifeHook(child); triggerLifeHook(child);
}); });
}; };
//最后触发组件树生命周期函数 // 最后触发组件树生命周期函数
triggerLifeHook(widget); triggerLifeHook(widget);
return res; return res;
} }
@ -12175,7 +12178,7 @@ _.extend(BI.OB.prototype, {
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
// 先把准备环境准备好 // 先把准备环境准备好
while(BI.prepares && BI.prepares.length > 0) { while (BI.prepares && BI.prepares.length > 0) {
BI.prepares.shift()(); BI.prepares.shift()();
} }
var el, w; var el, w;
@ -19148,12 +19151,10 @@ BI.prepares.push(function () {
var elemData = jQuery._data(fromElement[0]); var elemData = jQuery._data(fromElement[0]);
var events = elemData.events; var events = elemData.events;
BI.each(events, function (eventKey, event) { BI.each(events, function (eventKey, event) {
var handlers = event.handlers; BI.each(event, function (i, handler) {
BI.each(handlers, function (i, handler) { toElement.on(eventKey + (handler.namespace ? ("." + handler.namespace) : ""), handler);
toElement.on(eventKey, handler);
}); });
}); });
toElement.data(fromElement.data());
var fromChildren = fromElement.children(), toChildren = toElement.children(); var fromChildren = fromElement.children(), toChildren = toElement.children();
if(fromChildren.length !== toChildren.length) { if(fromChildren.length !== toChildren.length) {
throw new Error("不匹配"); throw new Error("不匹配");
@ -82536,5 +82537,20 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
"BI-Basic_Please_Select": "请选择", "BI-Basic_Please_Select": "请选择",
"BI-Basic_Font_Color": "文字颜色", "BI-Basic_Font_Color": "文字颜色",
"BI-Basic_Background_Color": "背景色", "BI-Basic_Background_Color": "背景色",
"BI-Basic_Underline": "下划线" "BI-Basic_Underline": "下划线",
"BI-Basic_Param_Month": "{R1}月",
"BI-Basic_Param_Day": "{R1}日",
"BI-Basic_Param_Quarter": "{R1}季度",
"BI-Basic_Param_Week_Count": "第{R1}周",
"BI-Basic_Param_Hour": "{R1}时",
"BI-Basic_Param_Minute": "{R1}分",
"BI-Basic_Param_Second": "{R1}秒",
"BI-Basic_Param_Year": "{R1}年",
"BI-Basic_Date_Day": "日",
"BI-Basic_Hour_Sin": "时",
"BI-Basic_Seconds": "秒",
"BI-Basic_Minute": "分",
"BI-Basic_Wan": "万",
"BI-Basic_Million": "百万",
"BI-Basic_Billion": "亿"
};BI.resourceURL = "https://fanruan.coding.me/fineui/dist/resource/"; };BI.resourceURL = "https://fanruan.coding.me/fineui/dist/resource/";

29
dist/core.js vendored

@ -12123,15 +12123,18 @@ _.extend(BI.OB.prototype, {
}); });
BI.mount = function (widget, container, predicate, hydrate) { BI.mount = function (widget, container, predicate, hydrate) {
if(hydrate === true){ if (hydrate === true) {
// 将widget的element元素都挂载好,并建立相互关系 // 将widget的element元素都挂载好,并建立相互关系
var res = widget._mount(true, false, false, function(w){ widget.element.data("__widgets", [widget]);
var ws = w.element.data("__widgets"); var res = widget._mount(true, false, false, function (w) {
if(!ws) { BI.each(w._children, function (i, child) {
ws = []; var ws = child.element.data("__widgets");
} if (!ws) {
ws.push(w); ws = [];
w.element.data("__widgets", ws); }
ws.push(child);
child.element.data("__widgets", ws);
});
predicate && predicate.apply(this, arguments); predicate && predicate.apply(this, arguments);
}); });
// 将新的dom树属性(事件等)patch到已存在的dom上 // 将新的dom树属性(事件等)patch到已存在的dom上
@ -12145,7 +12148,7 @@ _.extend(BI.OB.prototype, {
triggerLifeHook(child); triggerLifeHook(child);
}); });
}; };
//最后触发组件树生命周期函数 // 最后触发组件树生命周期函数
triggerLifeHook(widget); triggerLifeHook(widget);
return res; return res;
} }
@ -12175,7 +12178,7 @@ _.extend(BI.OB.prototype, {
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
// 先把准备环境准备好 // 先把准备环境准备好
while(BI.prepares && BI.prepares.length > 0) { while (BI.prepares && BI.prepares.length > 0) {
BI.prepares.shift()(); BI.prepares.shift()();
} }
var el, w; var el, w;
@ -19148,12 +19151,10 @@ BI.prepares.push(function () {
var elemData = jQuery._data(fromElement[0]); var elemData = jQuery._data(fromElement[0]);
var events = elemData.events; var events = elemData.events;
BI.each(events, function (eventKey, event) { BI.each(events, function (eventKey, event) {
var handlers = event.handlers; BI.each(event, function (i, handler) {
BI.each(handlers, function (i, handler) { toElement.on(eventKey + (handler.namespace ? ("." + handler.namespace) : ""), handler);
toElement.on(eventKey, handler);
}); });
}); });
toElement.data(fromElement.data());
var fromChildren = fromElement.children(), toChildren = toElement.children(); var fromChildren = fromElement.children(), toChildren = toElement.children();
if(fromChildren.length !== toChildren.length) { if(fromChildren.length !== toChildren.length) {
throw new Error("不匹配"); throw new Error("不匹配");

29
dist/fineui.js vendored

@ -12365,15 +12365,18 @@ _.extend(BI.OB.prototype, {
}); });
BI.mount = function (widget, container, predicate, hydrate) { BI.mount = function (widget, container, predicate, hydrate) {
if(hydrate === true){ if (hydrate === true) {
// 将widget的element元素都挂载好,并建立相互关系 // 将widget的element元素都挂载好,并建立相互关系
var res = widget._mount(true, false, false, function(w){ widget.element.data("__widgets", [widget]);
var ws = w.element.data("__widgets"); var res = widget._mount(true, false, false, function (w) {
if(!ws) { BI.each(w._children, function (i, child) {
ws = []; var ws = child.element.data("__widgets");
} if (!ws) {
ws.push(w); ws = [];
w.element.data("__widgets", ws); }
ws.push(child);
child.element.data("__widgets", ws);
});
predicate && predicate.apply(this, arguments); predicate && predicate.apply(this, arguments);
}); });
// 将新的dom树属性(事件等)patch到已存在的dom上 // 将新的dom树属性(事件等)patch到已存在的dom上
@ -12387,7 +12390,7 @@ _.extend(BI.OB.prototype, {
triggerLifeHook(child); triggerLifeHook(child);
}); });
}; };
//最后触发组件树生命周期函数 // 最后触发组件树生命周期函数
triggerLifeHook(widget); triggerLifeHook(widget);
return res; return res;
} }
@ -12417,7 +12420,7 @@ _.extend(BI.OB.prototype, {
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
// 先把准备环境准备好 // 先把准备环境准备好
while(BI.prepares && BI.prepares.length > 0) { while (BI.prepares && BI.prepares.length > 0) {
BI.prepares.shift()(); BI.prepares.shift()();
} }
var el, w; var el, w;
@ -19390,12 +19393,10 @@ BI.prepares.push(function () {
var elemData = jQuery._data(fromElement[0]); var elemData = jQuery._data(fromElement[0]);
var events = elemData.events; var events = elemData.events;
BI.each(events, function (eventKey, event) { BI.each(events, function (eventKey, event) {
var handlers = event.handlers; BI.each(event, function (i, handler) {
BI.each(handlers, function (i, handler) { toElement.on(eventKey + (handler.namespace ? ("." + handler.namespace) : ""), handler);
toElement.on(eventKey, handler);
}); });
}); });
toElement.data(fromElement.data());
var fromChildren = fromElement.children(), toChildren = toElement.children(); var fromChildren = fromElement.children(), toChildren = toElement.children();
if(fromChildren.length !== toChildren.length) { if(fromChildren.length !== toChildren.length) {
throw new Error("不匹配"); throw new Error("不匹配");

23
dist/fineui_without_jquery_polyfill.js vendored

@ -12123,15 +12123,18 @@ _.extend(BI.OB.prototype, {
}); });
BI.mount = function (widget, container, predicate, hydrate) { BI.mount = function (widget, container, predicate, hydrate) {
if(hydrate === true){ if (hydrate === true) {
// 将widget的element元素都挂载好,并建立相互关系 // 将widget的element元素都挂载好,并建立相互关系
var res = widget._mount(true, false, false, function(w){ widget.element.data("__widgets", [widget]);
var ws = w.element.data("__widgets"); var res = widget._mount(true, false, false, function (w) {
if(!ws) { BI.each(w._children, function (i, child) {
ws = []; var ws = child.element.data("__widgets");
} if (!ws) {
ws.push(w); ws = [];
w.element.data("__widgets", ws); }
ws.push(child);
child.element.data("__widgets", ws);
});
predicate && predicate.apply(this, arguments); predicate && predicate.apply(this, arguments);
}); });
// 将新的dom树属性(事件等)patch到已存在的dom上 // 将新的dom树属性(事件等)patch到已存在的dom上
@ -12145,7 +12148,7 @@ _.extend(BI.OB.prototype, {
triggerLifeHook(child); triggerLifeHook(child);
}); });
}; };
//最后触发组件树生命周期函数 // 最后触发组件树生命周期函数
triggerLifeHook(widget); triggerLifeHook(widget);
return res; return res;
} }
@ -12175,7 +12178,7 @@ _.extend(BI.OB.prototype, {
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
// 先把准备环境准备好 // 先把准备环境准备好
while(BI.prepares && BI.prepares.length > 0) { while (BI.prepares && BI.prepares.length > 0) {
BI.prepares.shift()(); BI.prepares.shift()();
} }
var el, w; var el, w;

188
dist/utils.js vendored

@ -15239,7 +15239,193 @@ BI.Date._QN = ["", "第1季度",
BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以 // 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以
BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];/** BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];BI.i18n = {
"BI-Multi_Date_Quarter_End": "季度末",
"BI-Multi_Date_Month_Begin": "月初",
"BI-Multi_Date_YMD": "年/月/日",
"BI-Custom_Color": "自定义颜色",
"BI-Numerical_Interval_Input_Data": "请输入数值",
"BI-Please_Input_Natural_Number": "请输入非负整数",
"BI-No_More_Data": "无更多数据",
"BI-Basic_Altogether": "共",
"BI-Basic_Sunday": "星期日",
"BI-Widget_Background_Colour": "组件背景",
"BI-Color_Picker_Error_Text": "请输入0~255的正整数",
"BI-Multi_Date_Month": "月",
"BI-No_Selected_Item": "没有可选项",
"BI-Multi_Date_Year_Begin": "年初",
"BI-Quarter_1": "第1季度",
"BI-Quarter_2": "第2季度",
"BI-Quarter_3": "第3季度",
"BI-Quarter_4": "第4季度",
"BI-Multi_Date_Year_Next": "年后",
"BI-Multi_Date_Month_Prev": "个月前",
"BI-Month_Trigger_Error_Text": "请输入1~12的正整数",
"BI-Less_And_Equal": "小于等于",
"BI-Year_Trigger_Invalid_Text": "请输入有效时间",
"BI-Multi_Date_Week_Next": "周后",
"BI-Font_Size": "字号",
"BI-Basic_Total": "共",
"BI-Already_Selected": "已选择",
"BI-Formula_Insert": "插入",
"BI-Select_All": "全选",
"BI-Basic_Tuesday": "星期二",
"BI-Multi_Date_Month_End": "月末",
"BI-Load_More": "点击加载更多数据",
"BI-Basic_September": "九月",
"BI-Current_Is_Last_Page": "当前已是最后一页",
"BI-Basic_Auto": "自动",
"BI-Basic_Count": "个",
"BI-Basic_Value": "值",
"BI-Basic_Unrestricted": "无限制",
"BI-Quarter_Trigger_Error_Text": "请输入1~4的正整数",
"BI-Basic_More": "更多",
"BI-Basic_Wednesday": "星期三",
"BI-Basic_Bold": "加粗",
"BI-Basic_Simple_Saturday": "六",
"BI-Multi_Date_Month_Next": "个月后",
"BI-Basic_March": "三月",
"BI-Current_Is_First_Page": "当前已是第一页",
"BI-Basic_Thursday": "星期四",
"BI-Basic_Prompt": "提示",
"BI-Multi_Date_Today": "今天",
"BI-Multi_Date_Quarter_Prev": "个季度前",
"BI-Row_Header": "行表头",
"BI-Date_Trigger_Error_Text": "日期格式示例:2015-3-11",
"BI-Basic_Cancel": "取消",
"BI-Basic_January": "一月",
"BI-Basic_June": "六月",
"BI-Basic_July": "七月",
"BI-Basic_April": "四月",
"BI-Multi_Date_Quarter_Begin": "季度初",
"BI-Multi_Date_Week": "周",
"BI-Click_Blank_To_Select": "点击\"空格键\"选中完全匹配项",
"BI-Basic_August": "八月",
"BI-Word_Align_Left": "文字居左",
"BI-Basic_November": "十一月",
"BI-Font_Colour": "字体颜色",
"BI-Multi_Date_Day_Prev": "天前",
"BI-Select_Part": "部分选择",
"BI-Multi_Date_Day_Next": "天后",
"BI-Less_Than": "小于",
"BI-Basic_February": "二月",
"BI-Multi_Date_Year": "年",
"BI-Number_Index": "序号",
"BI-Multi_Date_Week_Prev": "周前",
"BI-Next_Page": "下一页",
"BI-Right_Page": "向右翻页",
"BI-Numerical_Interval_Signal_Value": "前后值相等,请将操作符改为“≤”",
"BI-Basic_December": "十二月",
"BI-Basic_Saturday": "星期六",
"BI-Basic_Simple_Wednesday": "三",
"BI-Multi_Date_Quarter_Next": "个季度后",
"BI-Basic_October": "十月",
"BI-Basic_Simple_Friday": "五",
"BI-Basic_Save": "保存",
"BI-Numerical_Interval_Number_Value": "请保证前面的数值小于/等于后面的数值",
"BI-Previous_Page": "上一页",
"BI-No_Select": "搜索结果为空",
"BI-Basic_Clears": "清空",
"BI-Created_By_Me": "我创建的",
"BI-Basic_Simple_Tuesday": "二",
"BI-Word_Align_Right": "文字居右",
"BI-Summary_Values": "汇总",
"BI-Basic_Clear": "清除",
"BI-Upload_File_Size_Error": "文件大小不支",
"BI-Up_Page": "向上翻页",
"BI-Basic_Simple_Sunday": "日",
"BI-Multi_Date_Relative_Current_Time": "相对当前时间",
"BI-Selected_Data": "已选数据:",
"BI-Multi_Date_Quarter": "季度",
"BI-Check_Selected": "查看已选",
"BI-Basic_Search": "搜索",
"BI-Basic_May": "五月",
"BI-Continue_Select": "继续选择",
"BI-Please_Input_Positive_Integer": "请输入正整数",
"BI-Upload_File_Type_Error": "文件类型不支持",
"BI-Basic_Friday": "星期五",
"BI-Down_Page": "向下翻页",
"BI-Basic_Monday": "星期一",
"BI-Left_Page": "向左翻页",
"BI-Transparent_Color": "透明",
"BI-Basic_Simple_Monday": "一",
"BI-Multi_Date_Year_End": "年末",
"BI-Time_Interval_Error_Text": "请保证开始时间早于/等于结束时间",
"BI-Basic_Time": "时间",
"BI-Basic_OK": "确定",
"BI-Basic_Sure": "确定",
"BI-Basic_Simple_Thursday": "四",
"BI-Multi_Date_Year_Prev": "年前",
"BI-Tiao_Data": "条数据",
"BI-Basic_Italic": "斜体",
"BI-Basic_Dynamic_Title": "动态时间",
"BI-Basic_Year": "年",
"BI-Basic_Single_Quarter": "季",
"BI-Basic_Month": "月",
"BI-Basic_Week": "周",
"BI-Basic_Day": "天",
"BI-Basic_Work_Day": "工作日",
"BI-Basic_Front": "前",
"BI-Basic_Behind": "后",
"BI-Basic_Empty": "空",
"BI-Basic_Month_End": "月末",
"BI-Basic_Month_Begin": "月初",
"BI-Basic_Year_End": "年末",
"BI-Basic_Year_Begin": "年初",
"BI-Basic_Quarter_End": "季末",
"BI-Basic_Quarter_Begin": "季初",
"BI-Basic_Week_End": "周末",
"BI-Basic_Week_Begin": "周初",
"BI-Basic_Current_Day": "当天",
"BI-Basic_Begin_Start": "初",
"BI-Basic_End_Stop": "末",
"BI-Basic_Current_Year": "今年",
"BI-Basic_Year_Fen": "年份",
"BI-Basic_Current_Month": "本月",
"BI-Basic_Current_Quarter": "本季度",
"BI-Basic_Year_Month": "年月",
"BI-Basic_Year_Quarter": "年季度",
"BI-Basic_Input_From_To_Number": "请输入{R1}的数值",
"BI-Basic_Input_Can_Not_Null": "输入框不能为空",
"BI-Basic_Date_Time_Error_Text": "日期格式示例:2015-3-11 00:00:00",
"BI-Basic_Or": "或",
"BI-Basic_And": "且",
"BI-Conf_Add_Formula": "添加公式",
"BI-Conf_Add_Condition": "添加条件",
"BI-Conf_Formula_And": "且公式条件",
"BI-Conf_Formula_Or": "或公式条件",
"BI-Conf_Condition_And": "且条件",
"BI-Conf_Condition_Or": "或条件",
"BI-Microsoft_YaHei": "微软雅黑",
"BI-Apple_Light": "苹方-light",
"BI-Font_Family": "字体",
"BI-Basic_Please_Input_Content": "请输入内容",
"BI-Word_Align_Center": "文字居中",
"BI-Basic_Please_Enter_Number_Between": "请输入{R1}-{R2}的值",
"BI-More_Than": "大于",
"BI-More_And_Equal": "大于等于",
"BI-Please_Enter_SQL": "请输入SQL",
"BI-Basic_Click_To_Add_Text": "+点击新增\"{R1}\"",
"BI-Basic_Please_Select": "请选择",
"BI-Basic_Font_Color": "文字颜色",
"BI-Basic_Background_Color": "背景色",
"BI-Basic_Underline": "下划线",
"BI-Basic_Param_Month": "{R1}月",
"BI-Basic_Param_Day": "{R1}日",
"BI-Basic_Param_Quarter": "{R1}季度",
"BI-Basic_Param_Week_Count": "第{R1}周",
"BI-Basic_Param_Hour": "{R1}时",
"BI-Basic_Param_Minute": "{R1}分",
"BI-Basic_Param_Second": "{R1}秒",
"BI-Basic_Param_Year": "{R1}年",
"BI-Basic_Date_Day": "日",
"BI-Basic_Hour_Sin": "时",
"BI-Basic_Seconds": "秒",
"BI-Basic_Minute": "分",
"BI-Basic_Wan": "万",
"BI-Basic_Million": "百万",
"BI-Basic_Billion": "亿"
};/**
* 缓冲池 * 缓冲池
* @type {{Buffer: {}}} * @type {{Buffer: {}}}
*/ */

1274
package-lock.json generated

File diff suppressed because it is too large Load Diff

17
public/js/fineui.i18n.js

@ -168,5 +168,20 @@ BI.i18n = {
"BI-Basic_Please_Select": "请选择", "BI-Basic_Please_Select": "请选择",
"BI-Basic_Font_Color": "文字颜色", "BI-Basic_Font_Color": "文字颜色",
"BI-Basic_Background_Color": "背景色", "BI-Basic_Background_Color": "背景色",
"BI-Basic_Underline": "下划线" "BI-Basic_Underline": "下划线",
"BI-Basic_Param_Month": "{R1}月",
"BI-Basic_Param_Day": "{R1}日",
"BI-Basic_Param_Quarter": "{R1}季度",
"BI-Basic_Param_Week_Count": "第{R1}周",
"BI-Basic_Param_Hour": "{R1}时",
"BI-Basic_Param_Minute": "{R1}分",
"BI-Basic_Param_Second": "{R1}秒",
"BI-Basic_Param_Year": "{R1}年",
"BI-Basic_Date_Day": "日",
"BI-Basic_Hour_Sin": "时",
"BI-Basic_Seconds": "秒",
"BI-Basic_Minute": "分",
"BI-Basic_Wan": "万",
"BI-Basic_Million": "百万",
"BI-Basic_Billion": "亿"
}; };

6
src/core/platform/web/dom.js

@ -10,12 +10,10 @@
var elemData = jQuery._data(fromElement[0]); var elemData = jQuery._data(fromElement[0]);
var events = elemData.events; var events = elemData.events;
BI.each(events, function (eventKey, event) { BI.each(events, function (eventKey, event) {
var handlers = event.handlers; BI.each(event, function (i, handler) {
BI.each(handlers, function (i, handler) { toElement.on(eventKey + (handler.namespace ? ("." + handler.namespace) : ""), handler);
toElement.on(eventKey, handler);
}); });
}); });
toElement.data(fromElement.data());
var fromChildren = fromElement.children(), toChildren = toElement.children(); var fromChildren = fromElement.children(), toChildren = toElement.children();
if(fromChildren.length !== toChildren.length) { if(fromChildren.length !== toChildren.length) {
throw new Error("不匹配"); throw new Error("不匹配");

2
src/core/shortcut.js

@ -19,7 +19,7 @@
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
// 先把准备环境准备好 // 先把准备环境准备好
while(BI.prepares && BI.prepares.length > 0) { while (BI.prepares && BI.prepares.length > 0) {
BI.prepares.shift()(); BI.prepares.shift()();
} }
var el, w; var el, w;

21
src/core/widget.js

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

Loading…
Cancel
Save