Browse Source

Pull request #2187: 无JIAR任务支持自动watch

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

* commit '2ee97f0291aa3d19b9e35c656706322f433baa56':
  支持自动watch
es6
guy 3 years ago
parent
commit
d05778a4bc
  1. 1
      changelog.md
  2. 178
      examples/dev.html
  3. 57
      examples/effect.html
  4. 66
      examples/style.html
  5. 3
      src/base/collection/collection.js
  6. 3
      src/base/combination/combo.js
  7. 5
      src/base/combination/expander.js
  8. 5
      src/base/combination/group.button.js
  9. 5
      src/base/combination/group.combo.js
  10. 3
      src/base/combination/loader.js
  11. 5
      src/base/combination/searcher.js
  12. 5
      src/base/combination/switcher.js
  13. 6
      src/base/combination/tree.button.js
  14. 3
      src/base/grid/grid.js
  15. 3
      src/base/layer/layer.popup.js
  16. 5
      src/base/layer/layer.searcher.js
  17. 6
      src/base/pager/pager.js
  18. 6
      src/base/single/a/a.js
  19. 6
      src/base/single/bar/bar.loading.js
  20. 3
      src/base/single/button/buttons/button.icon.js
  21. 5
      src/base/single/button/buttons/button.image.js
  22. 3
      src/base/single/button/buttons/button.js
  23. 5
      src/base/single/button/buttons/button.text.js
  24. 4
      src/base/single/button/listitem/blankiconicontextitem.js
  25. 4
      src/base/single/button/listitem/blankicontexticonitem.js
  26. 4
      src/base/single/button/listitem/blankicontextitem.js
  27. 4
      src/base/single/button/listitem/icontexticonitem.js
  28. 4
      src/base/single/button/listitem/icontextitem.js
  29. 4
      src/base/single/button/listitem/texticonitem.js
  30. 6
      src/base/single/button/listitem/textitem.js
  31. 6
      src/base/single/button/node/icontexticonnode.js
  32. 6
      src/base/single/button/node/icontextnode.js
  33. 6
      src/base/single/button/node/texticonnode.js
  34. 6
      src/base/single/button/node/textnode.js
  35. 3
      src/base/single/editor/editor.js
  36. 3
      src/base/single/editor/editor.multifile.js
  37. 6
      src/base/single/icon/icon.js
  38. 3
      src/base/single/iframe/iframe.js
  39. 3
      src/base/single/input/file.js
  40. 3
      src/base/single/input/input.js
  41. 6
      src/base/single/input/radio/radio.image.js
  42. 4
      src/base/single/label/abstract.label.js
  43. 3
      src/base/single/label/icon.label.js
  44. 4
      src/base/single/tip/tip.toast.js
  45. 6
      src/base/single/tip/tip.tooltip.js
  46. 6
      src/base/single/trigger/trigger.js
  47. 3
      src/case/combo/bubblecombo/popup.bubble.js
  48. 48
      src/core/4.widget.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2021-09) 2.0(2021-09)
- 支持自动watch
- 支持h函数传递left、right,优化left_right_vertical_adapt布局的jsx写法 - 支持h函数传递left、right,优化left_right_vertical_adapt布局的jsx写法
- 新增bi.virtual_group_list组件 - 新增bi.virtual_group_list组件

178
examples/dev.html

@ -12,187 +12,31 @@
var Model = BI.inherit(Fix.Model, { var Model = BI.inherit(Fix.Model, {
state: function () { state: function () {
return { return {
expand: false, count: 0
showClearAll: false,
hasUndo: false,
hasRedo: false
}; };
},
computed: {
expandText: function () {
return this.model.expand ? "expand" : "not-expand";
},
clearAllText: function () {
return this.model.showClearAll ? "showClearAll" : "not-showClearAll";
},
undoText: function () {
return this.model.hasUndo ? "hasUndo" : "not-hasUndo";
},
redoText: function () {
return this.model.hasRedo ? "hasRedo" : "not-hasRedo";
}
},
actions: {
setExpand: function () {
this.model.expand = !this.model.expand;
},
setClearAll: function () {
this.model.showClearAll = !this.model.showClearAll;
},
setUndo: function () {
this.model.hasUndo = !this.model.hasUndo;
},
setRedo: function () {
this.model.hasRedo = !this.model.hasRedo;
}
} }
}); });
BI.model("demo.model", Model); BI.model("demo.model", Model);
function useExpand () {
var button;
var store = BI.useStore();
BI.onBeforeMount(function () {
});
BI.onMounted(function () {
});
BI.onBeforeUnmount(function () {
});
BI.onUnmounted(function () {
});
BI.watch("expandText", function (val) {
button.setText(val);
});
return function () {
return {
type: "bi.button",
ref: function (_ref) {
button = _ref;
},
text: store.model.expandText,
handler: function () {
store.setExpand();
}
};
};
}
function useClearAll () {
var button;
var store = BI.useStore();
BI.onBeforeMount(function () {
});
BI.onMounted(function () {
});
BI.onBeforeUnmount(function () {
});
BI.onUnmounted(function () {
});
BI.watch("clearAllText", function (val) {
button.setText(val);
});
return function () {
return {
type: "bi.button",
ref: function (_ref) {
button = _ref;
},
text: store.model.clearAllText,
handler: function () {
store.setClearAll();
}
};
};
}
function useUndo () {
var button;
var store = BI.useStore();
BI.onBeforeMount(function () {
});
BI.onMounted(function () {
});
BI.onBeforeUnmount(function () {
});
BI.onUnmounted(function () {
});
BI.watch("undoText", function (val) {
button.setText(val);
});
return function () {
return {
type: "bi.button",
ref: function (_ref) {
button = _ref;
},
text: store.model.undoText,
handler: function () {
store.setUndo();
}
};
};
}
function useRedo () {
var button;
var store = BI.useStore();
BI.onBeforeMount(function () {
});
BI.onMounted(function () {
});
BI.onBeforeUnmount(function () {
});
BI.onUnmounted(function () {
});
BI.watch("redoText", function (val) {
button.setText(val);
});
return function () {
return {
type: "bi.button",
ref: function (_ref) {
button = _ref;
},
text: store.model.redoText,
handler: function () {
store.setRedo();
}
};
};
}
var Widget = BI.inherit(BI.Widget, { var Widget = BI.inherit(BI.Widget, {
_store: function () { _store: function () {
return BI.Models.getModel("demo.model"); return BI.Models.getModel("demo.model");
}, },
setup: function () { setup: function () {
var expandComponent = useExpand(); var store = BI.useStore();
var clearAllComponent = useClearAll();
var undoComponent = useUndo();
var redoComponent = useRedo();
return function () { return function () {
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [expandComponent(), clearAllComponent(), undoComponent(), redoComponent()] items: [{
type: "bi.button",
effect: function () {
this.setText(store.model.count)
},
handler: function () {
store.model.count++;
}
}]
}; };
}; };
} }

57
examples/effect.html

@ -0,0 +1,57 @@
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
</head>
<body>
<div id="wrapper"></div>
<script>
var Model = BI.inherit(Fix.Model, {
state: function () {
return {
count: 0
};
}
});
BI.model("demo.model", Model);
var Widget = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model");
},
setup: function () {
var store = BI.useStore();
return function () {
return {
type: "bi.vertical",
items: [{
type: "bi.button",
effect: function () {
this.setText(store.model.count)
},
handler: function () {
store.model.count++;
}
}]
};
};
}
});
BI.shortcut("demo.hooks", Widget);
BI.createWidget({
type: "bi.absolute",
items: [{
el: {
type: "demo.hooks"
},
top: 100,
left: 100
}],
element: "#wrapper"
});
</script>
</body>
</html>

66
examples/style.html

@ -0,0 +1,66 @@
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
</head>
<body>
<div id="wrapper"></div>
<script>
var Model = BI.inherit(Fix.Model, {
state: function () {
return {
cls: "my-cls",
background: "red",
count: 0
};
}
});
BI.model("demo.model", Model);
var Widget = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model");
},
setup: function () {
var store = BI.useStore();
return function () {
return {
type: "bi.vertical",
items: [{
type: "bi.button",
cls: function () {
return store.model.cls;
},
css: function () {
return {
background: store.model.background
}
},
text: "按钮",
handler: function () {
store.model.cls = "my-cls" + store.model.count++;
store.model.background = "blue";
}
}]
};
};
}
});
BI.shortcut("demo.hooks", Widget);
BI.createWidget({
type: "bi.absolute",
items: [{
el: {
type: "demo.hooks"
},
top: 100,
left: 100
}],
element: "#wrapper"
});
</script>
</body>
</html>

3
src/base/collection/collection.js

@ -22,8 +22,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
}); });
}, },
_init: function () { render: function () {
BI.CollectionView.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.renderedCells = []; this.renderedCells = [];
this.renderedKeys = []; this.renderedKeys = [];

3
src/base/combination/combo.js

@ -39,8 +39,7 @@
}); });
}, },
_init: function () { render: function () {
BI.Combo.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this._initCombo(); this._initCombo();
this._initPullDownAction(); this._initPullDownAction();

5
src/base/combination/expander.js

@ -21,8 +21,7 @@ BI.Expander = BI.inherit(BI.Widget, {
}); });
}, },
_init: function () { render: function () {
BI.Expander.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this._expanded = !!o.el.open; this._expanded = !!o.el.open;
this._initExpander(); this._initExpander();
@ -279,4 +278,4 @@ BI.Expander.EVENT_AFTER_POPUPVIEW = "EVENT_AFTER_POPUPVIEW";
BI.Expander.EVENT_BEFORE_HIDEVIEW = "EVENT_BEFORE_HIDEVIEW"; BI.Expander.EVENT_BEFORE_HIDEVIEW = "EVENT_BEFORE_HIDEVIEW";
BI.Expander.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; BI.Expander.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW";
BI.shortcut("bi.expander", BI.Expander); BI.shortcut("bi.expander", BI.Expander);

5
src/base/combination/group.button.js

@ -20,8 +20,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
}); });
}, },
_init: function () { render: function () {
BI.ButtonGroup.superclass._init.apply(this, arguments);
var o = this.options; var o = this.options;
var behaviors = {}; var behaviors = {};
BI.each(o.behaviors, function (key, rule) { BI.each(o.behaviors, function (key, rule) {
@ -327,4 +326,4 @@ BI.extend(BI.ButtonGroup, {
}); });
BI.ButtonGroup.EVENT_CHANGE = "EVENT_CHANGE"; BI.ButtonGroup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.button_group", BI.ButtonGroup); BI.shortcut("bi.button_group", BI.ButtonGroup);

5
src/base/combination/group.combo.js

@ -30,8 +30,7 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
}); });
}, },
_init: function () { render: function () {
BI.ComboGroup.superclass._init.apply(this, arguments);
this._populate(this.options.el); this._populate(this.options.el);
}, },
@ -94,4 +93,4 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
}); });
BI.ComboGroup.EVENT_CHANGE = "EVENT_CHANGE"; BI.ComboGroup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.combo_group", BI.ComboGroup); BI.shortcut("bi.combo_group", BI.ComboGroup);

3
src/base/combination/loader.js

@ -53,8 +53,7 @@ BI.Loader = BI.inherit(BI.Widget, {
}]); }]);
}, },
_init: function () { render: function () {
BI.Loader.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
if (o.itemsCreator === false) { if (o.itemsCreator === false) {
o.prev = false; o.prev = false;

5
src/base/combination/searcher.js

@ -42,8 +42,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
}); });
}, },
_init: function () { render: function () {
BI.Searcher.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.editor = BI.createWidget(o.el, { this.editor = BI.createWidget(o.el, {
@ -317,4 +316,4 @@ BI.Searcher.EVENT_PAUSE = "EVENT_PAUSE";
BI.Searcher.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.Searcher.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.Searcher.EVENT_AFTER_INIT = "EVENT_AFTER_INIT"; BI.Searcher.EVENT_AFTER_INIT = "EVENT_AFTER_INIT";
BI.shortcut("bi.searcher", BI.Searcher); BI.shortcut("bi.searcher", BI.Searcher);

5
src/base/combination/switcher.js

@ -22,8 +22,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
}); });
}, },
_init: function () { render: function () {
BI.Switcher.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this._initSwitcher(); this._initSwitcher();
this._initPullDownAction(); this._initPullDownAction();
@ -289,4 +288,4 @@ BI.Switcher.EVENT_AFTER_POPUPVIEW = "EVENT_AFTER_POPUPVIEW";
BI.Switcher.EVENT_BEFORE_HIDEVIEW = "EVENT_BEFORE_HIDEVIEW"; BI.Switcher.EVENT_BEFORE_HIDEVIEW = "EVENT_BEFORE_HIDEVIEW";
BI.Switcher.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; BI.Switcher.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW";
BI.shortcut("bi.switcher", BI.Switcher); BI.shortcut("bi.switcher", BI.Switcher);

6
src/base/combination/tree.button.js

@ -11,10 +11,6 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
}); });
}, },
_init: function () {
BI.ButtonTree.superclass._init.apply(this, arguments);
},
setNotSelectedValue: function (v) { setNotSelectedValue: function (v) {
v = BI.isArray(v) ? v : [v]; v = BI.isArray(v) ? v : [v];
BI.each(this.buttons, function (i, item) { BI.each(this.buttons, function (i, item) {
@ -179,4 +175,4 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
}); });
BI.ButtonTree.EVENT_CHANGE = "EVENT_CHANGE"; BI.ButtonTree.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.button_tree", BI.ButtonTree); BI.shortcut("bi.button_tree", BI.ButtonTree);

3
src/base/grid/grid.js

@ -25,8 +25,7 @@ BI.GridView = BI.inherit(BI.Widget, {
}); });
}, },
_init: function () { render: function () {
BI.GridView.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.renderedCells = []; this.renderedCells = [];
this.renderedKeys = []; this.renderedKeys = [];

3
src/base/layer/layer.popup.js

@ -42,8 +42,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
}); });
}, },
_init: function () { render: function () {
BI.PopupView.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var fn = function (e) { var fn = function (e) {
e.stopPropagation(); e.stopPropagation();

5
src/base/layer/layer.searcher.js

@ -41,8 +41,7 @@ BI.SearcherView = BI.inherit(BI.Pane, {
}); });
}, },
_init: function () { render: function () {
BI.SearcherView.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.matcher = BI.createWidget(o.matcher, { this.matcher = BI.createWidget(o.matcher, {
@ -138,4 +137,4 @@ BI.SearcherView = BI.inherit(BI.Pane, {
}); });
BI.SearcherView.EVENT_CHANGE = "EVENT_CHANGE"; BI.SearcherView.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.searcher_view", BI.SearcherView); BI.shortcut("bi.searcher_view", BI.SearcherView);

6
src/base/pager/pager.js

@ -40,8 +40,8 @@ BI.Pager = BI.inherit(BI.Widget, {
hasNext: BI.emptyFn // pages不可用时有效 hasNext: BI.emptyFn // pages不可用时有效
}); });
}, },
_init: function () {
BI.Pager.superclass._init.apply(this, arguments); render: function () {
var self = this; var self = this;
this.currPage = BI.result(this.options, "curr"); this.currPage = BI.result(this.options, "curr");
// 翻页太灵敏 // 翻页太灵敏
@ -286,4 +286,4 @@ BI.Pager = BI.inherit(BI.Widget, {
}); });
BI.Pager.EVENT_CHANGE = "EVENT_CHANGE"; BI.Pager.EVENT_CHANGE = "EVENT_CHANGE";
BI.Pager.EVENT_AFTER_POPULATE = "EVENT_AFTER_POPULATE"; BI.Pager.EVENT_AFTER_POPULATE = "EVENT_AFTER_POPULATE";
BI.shortcut("bi.pager", BI.Pager); BI.shortcut("bi.pager", BI.Pager);

6
src/base/single/a/a.js

@ -17,9 +17,9 @@ BI.A = BI.inherit(BI.Text, {
tagName: "a" tagName: "a"
}); });
}, },
_init: function () {
render: function () {
var o = this.options; var o = this.options;
BI.A.superclass._init.apply(this, arguments);
this.element.attr({href: o.href, target: o.target}); this.element.attr({href: o.href, target: o.target});
if (o.el) { if (o.el) {
BI.createWidget(o.el, { BI.createWidget(o.el, {
@ -29,4 +29,4 @@ BI.A = BI.inherit(BI.Text, {
} }
}); });
BI.shortcut("bi.a", BI.A); BI.shortcut("bi.a", BI.A);

6
src/base/single/bar/bar.loading.js

@ -12,8 +12,8 @@ BI.LoadingBar = BI.inherit(BI.Single, {
handler: BI.emptyFn handler: BI.emptyFn
}); });
}, },
_init: function () {
BI.LoadingBar.superclass._init.apply(this, arguments); render: function () {
var self = this; var self = this;
this.loaded = BI.createWidget({ this.loaded = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
@ -77,4 +77,4 @@ BI.LoadingBar = BI.inherit(BI.Single, {
} }
}); });
BI.shortcut("bi.loading_bar", BI.LoadingBar); BI.shortcut("bi.loading_bar", BI.LoadingBar);

3
src/base/single/button/buttons/button.icon.js

@ -13,8 +13,7 @@ BI.IconButton = BI.inherit(BI.BasicButton, {
}); });
}, },
_init: function () { render: function () {
BI.IconButton.superclass._init.apply(this, arguments);
var o = this.options; var o = this.options;
this.element.css({ this.element.css({
textAlign: "center" textAlign: "center"

5
src/base/single/button/buttons/button.image.js

@ -16,8 +16,7 @@ BI.ImageButton = BI.inherit(BI.BasicButton, {
}); });
}, },
_init: function () { render: function () {
BI.ImageButton.superclass._init.apply(this, arguments);
var o = this.options; var o = this.options;
this.image = BI.createWidget({ this.image = BI.createWidget({
type: "bi.img", type: "bi.img",
@ -84,4 +83,4 @@ BI.ImageButton = BI.inherit(BI.BasicButton, {
} }
}); });
BI.ImageButton.EVENT_CHANGE = "EVENT_CHANGE"; BI.ImageButton.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.image_button", BI.ImageButton); BI.shortcut("bi.image_button", BI.ImageButton);

3
src/base/single/button/buttons/button.js

@ -39,8 +39,7 @@ BI.Button = BI.inherit(BI.BasicButton, {
}); });
}, },
_init: function () { render: function () {
BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this; var o = this.options, self = this;
if (BI.isKey(o.iconCls)) { if (BI.isKey(o.iconCls)) {
this.icon = BI.createWidget({ this.icon = BI.createWidget({

5
src/base/single/button/buttons/button.text.js

@ -22,8 +22,7 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
}); });
}, },
_init: function () { render: function () {
BI.TextButton.superclass._init.apply(this, arguments);
var o = this.options; var o = this.options;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
@ -87,4 +86,4 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
} }
}); });
BI.TextButton.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextButton.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_button", BI.TextButton); BI.shortcut("bi.text_button", BI.TextButton);

4
src/base/single/button/listitem/blankiconicontextitem.js

@ -25,8 +25,8 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, {
textRgap: 0 textRgap: 0
}); });
}, },
_init: function () {
BI.BlankIconIconTextItem.superclass._init.apply(this, arguments); render: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var blank = BI.createWidget({ var blank = BI.createWidget({
type: "bi.layout", type: "bi.layout",

4
src/base/single/button/listitem/blankicontexticonitem.js

@ -26,8 +26,8 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, {
textRgap: 0 textRgap: 0
}); });
}, },
_init: function () {
BI.BlankIconTextIconItem.superclass._init.apply(this, arguments); render: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",

4
src/base/single/button/listitem/blankicontextitem.js

@ -24,8 +24,8 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, {
textRgap: 0 textRgap: 0
}); });
}, },
_init: function () {
BI.BlankIconTextItem.superclass._init.apply(this, arguments); render: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var blank = BI.createWidget({ var blank = BI.createWidget({
type: "bi.layout", type: "bi.layout",

4
src/base/single/button/listitem/icontexticonitem.js

@ -25,8 +25,8 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, {
textRgap: 0 textRgap: 0
}); });
}, },
_init: function () {
BI.IconTextIconItem.superclass._init.apply(this, arguments); render: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",

4
src/base/single/button/listitem/icontextitem.js

@ -25,8 +25,8 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, {
textRgap: 0 textRgap: 0
}); });
}, },
_init: function () {
BI.IconTextItem.superclass._init.apply(this, arguments); render: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",

4
src/base/single/button/listitem/texticonitem.js

@ -24,8 +24,8 @@ BI.TextIconItem = BI.inherit(BI.BasicButton, {
textRgap: 0 textRgap: 0
}); });
}, },
_init: function () {
BI.TextIconItem.superclass._init.apply(this, arguments); render: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",

6
src/base/single/button/listitem/textitem.js

@ -20,8 +20,8 @@ BI.TextItem = BI.inherit(BI.BasicButton, {
textRgap: 0 textRgap: 0
}); });
}, },
_init: function () {
BI.TextItem.superclass._init.apply(this, arguments); render: function () {
var o = this.options; var o = this.options;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
@ -83,4 +83,4 @@ BI.TextItem = BI.inherit(BI.BasicButton, {
} }
}); });
BI.TextItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_item", BI.TextItem); BI.shortcut("bi.text_item", BI.TextItem);

6
src/base/single/button/node/icontexticonnode.js

@ -23,8 +23,8 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
textRgap: 0 textRgap: 0
}); });
}, },
_init: function () {
BI.IconTextIconNode.superclass._init.apply(this, arguments); render: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
@ -110,4 +110,4 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
} }
}); });
BI.IconTextIconNode.EVENT_CHANGE = "EVENT_CHANGE"; BI.IconTextIconNode.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.icon_text_icon_node", BI.IconTextIconNode); BI.shortcut("bi.icon_text_icon_node", BI.IconTextIconNode);

6
src/base/single/button/node/icontextnode.js

@ -22,8 +22,8 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
textRgap: 0 textRgap: 0
}); });
}, },
_init: function () {
BI.IconTextNode.superclass._init.apply(this, arguments); render: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
@ -87,4 +87,4 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
} }
}); });
BI.IconTextNode.EVENT_CHANGE = "EVENT_CHANGE"; BI.IconTextNode.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.icon_text_node", BI.IconTextNode); BI.shortcut("bi.icon_text_node", BI.IconTextNode);

6
src/base/single/button/node/texticonnode.js

@ -21,8 +21,8 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
textRgap: 0 textRgap: 0
}); });
}, },
_init: function () {
BI.TextIconNode.superclass._init.apply(this, arguments); render: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
@ -86,4 +86,4 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
} }
}); });
BI.TextIconNode.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextIconNode.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_icon_node", BI.TextIconNode); BI.shortcut("bi.text_icon_node", BI.TextIconNode);

6
src/base/single/button/node/textnode.js

@ -19,8 +19,8 @@ BI.TextNode = BI.inherit(BI.NodeButton, {
textRgap: 0 textRgap: 0
}); });
}, },
_init: function () {
BI.TextNode.superclass._init.apply(this, arguments); render: function () {
var o = this.options; var o = this.options;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
@ -74,4 +74,4 @@ BI.TextNode = BI.inherit(BI.NodeButton, {
} }
}); });
BI.TextNode.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextNode.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_node", BI.TextNode); BI.shortcut("bi.text_node", BI.TextNode);

3
src/base/single/editor/editor.js

@ -26,8 +26,7 @@ BI.Editor = BI.inherit(BI.Single, {
}); });
}, },
_init: function () { render: function () {
BI.Editor.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
// 密码输入框设置autocomplete="new-password"的情况下Firefox和chrome不会自动填充密码 // 密码输入框设置autocomplete="new-password"的情况下Firefox和chrome不会自动填充密码
var autocomplete = o.autocomplete ? " autocomplete=" + o.autocomplete : ""; var autocomplete = o.autocomplete ? " autocomplete=" + o.autocomplete : "";

3
src/base/single/editor/editor.multifile.js

@ -18,8 +18,7 @@ BI.MultifileEditor = BI.inherit(BI.Widget, {
}); });
}, },
_init: function () { render: function () {
var self = this, o = this.options;
BI.MultifileEditor.superclass._init.apply(this, arguments); BI.MultifileEditor.superclass._init.apply(this, arguments);
this.file = BI.createWidget({ this.file = BI.createWidget({
type: "bi.file", type: "bi.file",

6
src/base/single/icon/icon.js

@ -11,11 +11,11 @@ BI.Icon = BI.inherit(BI.Single, {
baseCls: (conf.baseCls || "") + " x-icon b-font horizon-center display-block" baseCls: (conf.baseCls || "") + " x-icon b-font horizon-center display-block"
}); });
}, },
_init: function () {
BI.Icon.superclass._init.apply(this, arguments); render: function () {
if (BI.isIE9Below && BI.isIE9Below()) { if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack"); this.element.addClass("hack");
} }
} }
}); });
BI.shortcut("bi.icon", BI.Icon); BI.shortcut("bi.icon", BI.Icon);

3
src/base/single/iframe/iframe.js

@ -18,9 +18,8 @@ BI.Iframe = BI.inherit(BI.Single, {
}); });
}, },
_init: function () { render: function () {
var self = this; var self = this;
BI.Iframe.superclass._init.apply(this, arguments);
this.element.on("load", function () { this.element.on("load", function () {
self.fireEvent("EVENT_LOADED"); self.fireEvent("EVENT_LOADED");
}); });

3
src/base/single/input/file.js

@ -451,9 +451,8 @@
}); });
}, },
_init: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
BI.File.superclass._init.apply(this, arguments);
if (o.multiple === true) { if (o.multiple === true) {
this.element.attr("multiple", "multiple"); this.element.attr("multiple", "multiple");
} }

3
src/base/single/input/input.js

@ -16,8 +16,7 @@ BI.Input = BI.inherit(BI.Single, {
}); });
}, },
_init: function () { render: function () {
BI.Input.superclass._init.apply(this, arguments);
var self = this; var self = this;
var ctrlKey = false; var ctrlKey = false;
var keyCode = null; var keyCode = null;

6
src/base/single/input/radio/radio.image.js

@ -17,10 +17,6 @@ BI.ImageRadio = BI.inherit(BI.IconButton, {
}); });
}, },
_init: function () {
BI.ImageRadio.superclass._init.apply(this, arguments);
},
doClick: function () { doClick: function () {
BI.ImageRadio.superclass.doClick.apply(this, arguments); BI.ImageRadio.superclass.doClick.apply(this, arguments);
if(this.isValid()) { if(this.isValid()) {
@ -30,4 +26,4 @@ BI.ImageRadio = BI.inherit(BI.IconButton, {
}); });
BI.ImageRadio.EVENT_CHANGE = BI.IconButton.EVENT_CHANGE; BI.ImageRadio.EVENT_CHANGE = BI.IconButton.EVENT_CHANGE;
BI.shortcut("bi.image_radio", BI.ImageRadio); BI.shortcut("bi.image_radio", BI.ImageRadio);

4
src/base/single/label/abstract.label.js

@ -38,9 +38,7 @@
}; };
}, },
_init: function () { render: function () {
BI.AbstractLabel.superclass._init.apply(this, arguments);
if (this.options.textAlign === "center") { if (this.options.textAlign === "center") {
this._createCenterEl(); this._createCenterEl();
} else { } else {

3
src/base/single/label/icon.label.js

@ -11,8 +11,7 @@ BI.IconLabel = BI.inherit(BI.Single, {
iconHeight: null iconHeight: null
}, },
_init: function () { render: function () {
BI.IconLabel.superclass._init.apply(this, arguments);
var o = this.options; var o = this.options;
this.element.css({ this.element.css({
textAlign: "center" textAlign: "center"

4
src/base/single/tip/tip.toast.js

@ -18,8 +18,8 @@ BI.Toast = BI.inherit(BI.Tip, {
level: "success" // success或warning level: "success" // success或warning
}); });
}, },
_init: function () {
BI.Toast.superclass._init.apply(this, arguments); render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.element.css({ this.element.css({
minWidth: this._const.minWidth / BI.pixRatio + BI.pixUnit minWidth: this._const.minWidth / BI.pixRatio + BI.pixUnit

6
src/base/single/tip/tip.tooltip.js

@ -20,8 +20,8 @@ BI.Tooltip = BI.inherit(BI.Tip, {
stopPropagation: false stopPropagation: false
}); });
}, },
_init: function () {
BI.Tooltip.superclass._init.apply(this, arguments); render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.element.addClass("tooltip-" + o.level); this.element.addClass("tooltip-" + o.level);
var fn = function (e) { var fn = function (e) {
@ -81,4 +81,4 @@ BI.Tooltip = BI.inherit(BI.Tip, {
} }
}); });
BI.shortcut("bi.tooltip", BI.Tooltip); BI.shortcut("bi.tooltip", BI.Tooltip);

6
src/base/single/trigger/trigger.js

@ -13,10 +13,6 @@ BI.Trigger = BI.inherit(BI.Single, {
}); });
}, },
_init: function () {
BI.Trigger.superclass._init.apply(this, arguments);
},
setKey: function () { setKey: function () {
}, },
@ -24,4 +20,4 @@ BI.Trigger = BI.inherit(BI.Single, {
getKey: function () { getKey: function () {
}, },
}); });

3
src/case/combo/bubblecombo/popup.bubble.js

@ -13,9 +13,6 @@ BI.BubblePopupView = BI.inherit(BI.PopupView, {
maxWidth: 300, maxWidth: 300,
minHeight: 90 minHeight: 90
}); });
},
_init: function () {
BI.BubblePopupView.superclass._init.apply(this, arguments);
} }
}); });

48
src/core/4.widget.js

@ -38,7 +38,7 @@
baseCls: "", baseCls: "",
extraCls: "", extraCls: "",
cls: "", cls: "",
css: null, css: null
// vdom: false // vdom: false
}); });
@ -157,9 +157,21 @@
}, },
_initCurrent: function () { _initCurrent: function () {
var o = this.options; var self = this, o = this.options;
if (o._baseCls || o.baseCls || o.extraCls || o.cls) { if (o._baseCls || o.baseCls || o.extraCls) {
this.element.addClass((o._baseCls || "") + " " + (o.baseCls || "") + " " + (o.extraCls || "") + " " + (o.cls || "")); this.element.addClass((o._baseCls || "") + " " + (o.baseCls || "") + " " + (o.extraCls || ""));
}
if (o.cls) {
if (BI.isFunction(o.cls)) {
var cls = this.__watch(o.cls, function (newValue) {
if (newValue !== cls) {
self.element.removeClass(cls).addClass(cls = newValue);
}
});
this.element.addClass(cls);
} else {
this.element.addClass(o.cls);
}
} }
if (o.key != null) { if (o.key != null) {
this.element.attr("key", o.key); this.element.attr("key", o.key);
@ -171,7 +183,30 @@
this.element.data(o.data); this.element.data(o.data);
} }
if (o.css) { if (o.css) {
this.element.css(o.css); if (BI.isFunction(o.css)) {
var css = this.__watch(o.css, function (newValue) {
for (var k in css) {
if (!newValue[k]) {
newValue[k] = "";
}
}
self.element.css(css = newValue);
});
this.element.css(css);
} else {
this.element.css(o.css);
}
}
},
__watch: function (getter, handler) {
if (Fix.Model.target) {
this._watchers = this._watchers || [];
var watcher = new Fix.Watcher(Fix.Model.target, BI.bind(getter, this), handler || BI.emptyFn);
this._watchers.push(watcher);
return watcher.value;
} else {
return getter();
} }
}, },
@ -233,6 +268,9 @@
this.setValid(false); this.setValid(false);
} }
} }
if (o.effect) {
this.__watch(o.effect);
}
}, },
_initState: function () { _initState: function () {

Loading…
Cancel
Save