Browse Source

Composition API

es6
guy 4 years ago
parent
commit
64ee148a66
  1. 12
      src/base/single/iframe/iframe.js
  2. 10
      src/base/single/img/img.js
  3. 6
      src/base/single/link/link.js
  4. 6
      src/base/tree/ztree/parttree.js
  5. 6
      src/case/layer/layer.multipopup.js
  6. 6
      src/case/layer/layer.panel.js
  7. 9
      src/case/tree/ztree/tree.display.js
  8. 6
      src/core/action/action.show.js
  9. 9
      src/core/controller.js
  10. 18
      src/core/logic/logic.layout.js
  11. 6
      src/core/shortcut.js

12
src/base/single/iframe/iframe.js

@ -5,24 +5,24 @@
* Created by GameJian on 2016/3/2. * Created by GameJian on 2016/3/2.
*/ */
BI.Iframe = BI.inherit(BI.Single, { BI.Iframe = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function (config) {
var conf = BI.Iframe.superclass._defaultConfig.apply(this, arguments); var conf = BI.Iframe.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
tagName: "iframe", tagName: "iframe",
baseCls: (conf.baseCls || "") + " bi-iframe", baseCls: (conf.baseCls || "") + " bi-iframe",
src: "", src: "",
name: "", name: "",
attributes: {}, attributes: {
frameborder: 0,
src: config.src,
name: config.name
},
width: "100%", width: "100%",
height: "100%" height: "100%"
}); });
}, },
_init: function () { _init: function () {
var self = this, o = this.options;
o.attributes.frameborder = "0";
o.attributes.src = o.src;
o.attributes.name = o.name;
BI.Iframe.superclass._init.apply(this, arguments); 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");

10
src/base/single/img/img.js

@ -7,24 +7,18 @@
* @abstract * @abstract
*/ */
BI.Img = BI.inherit(BI.Single, { BI.Img = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function (config) {
var conf = BI.Img.superclass._defaultConfig.apply(this, arguments); var conf = BI.Img.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
tagName: "img", tagName: "img",
baseCls: (conf.baseCls || "") + " bi-img display-block", baseCls: (conf.baseCls || "") + " bi-img display-block",
src: "", src: "",
attributes: {}, attributes: config.src ? {src: config.src} : {},
width: "100%", width: "100%",
height: "100%" height: "100%"
}); });
}, },
_init: function () {
var o = this.options;
o.attributes.src = o.src;
BI.Img.superclass._init.apply(this, arguments);
},
setSrc: function (src) { setSrc: function (src) {
this.options.src = src; this.options.src = src;
this.element.attr("src", src); this.element.attr("src", src);

6
src/base/single/link/link.js

@ -28,11 +28,7 @@ BI.Link = BI.inherit(BI.Label, {
href: o.href, href: o.href,
target: o.target target: o.target
}; };
},
_init: function () {
BI.Link.superclass._init.apply(this, arguments);
} }
}); });
BI.shortcut("bi.link", BI.Link); BI.shortcut("bi.link", BI.Link);

6
src/base/tree/ztree/parttree.js

@ -9,10 +9,6 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
return BI.extend(BI.PartTree.superclass._defaultConfig.apply(this, arguments), {}); return BI.extend(BI.PartTree.superclass._defaultConfig.apply(this, arguments), {});
}, },
_init: function () {
BI.PartTree.superclass._init.apply(this, arguments);
},
_loadMore: function () { _loadMore: function () {
var self = this, o = this.options; var self = this, o = this.options;
var op = BI.extend({}, o.paras, { var op = BI.extend({}, o.paras, {
@ -201,4 +197,4 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
} }
}); });
BI.shortcut("bi.part_tree", BI.PartTree); BI.shortcut("bi.part_tree", BI.PartTree);

6
src/case/layer/layer.multipopup.js

@ -14,10 +14,6 @@ BI.MultiPopupView = BI.inherit(BI.PopupView, {
}); });
}, },
_init: function () {
BI.MultiPopupView.superclass._init.apply(this, arguments);
},
_createToolBar: function () { _createToolBar: function () {
var o = this.options, self = this; var o = this.options, self = this;
if (o.buttons.length === 0) { if (o.buttons.length === 0) {
@ -61,4 +57,4 @@ BI.MultiPopupView = BI.inherit(BI.PopupView, {
BI.MultiPopupView.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiPopupView.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON";
BI.shortcut("bi.multi_popup_view", BI.MultiPopupView); BI.shortcut("bi.multi_popup_view", BI.MultiPopupView);

6
src/case/layer/layer.panel.js

@ -14,10 +14,6 @@ BI.PopupPanel = BI.inherit(BI.MultiPopupView, {
}); });
}, },
_init: function () {
BI.PopupPanel.superclass._init.apply(this, arguments);
},
_createTool: function () { _createTool: function () {
var self = this, o = this.options; var self = this, o = this.options;
var close = BI.createWidget({ var close = BI.createWidget({
@ -54,4 +50,4 @@ BI.PopupPanel.EVENT_CHANGE = "EVENT_CHANGE";
BI.PopupPanel.EVENT_CLOSE = "EVENT_CLOSE"; BI.PopupPanel.EVENT_CLOSE = "EVENT_CLOSE";
BI.PopupPanel.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; BI.PopupPanel.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON";
BI.shortcut("bi.popup_panel", BI.PopupPanel); BI.shortcut("bi.popup_panel", BI.PopupPanel);

9
src/case/tree/ztree/tree.display.js

@ -10,9 +10,6 @@ BI.DisplayTree = BI.inherit(BI.TreeView, {
extraCls: "bi-display-tree" extraCls: "bi-display-tree"
}); });
}, },
_init: function () {
BI.DisplayTree.superclass._init.apply(this, arguments);
},
// 配置属性 // 配置属性
_configSetting: function () { _configSetting: function () {
@ -62,12 +59,8 @@ BI.DisplayTree = BI.inherit(BI.TreeView, {
initTree: function (nodes, setting) { initTree: function (nodes, setting) {
var setting = setting || this._configSetting(); var setting = setting || this._configSetting();
this.nodes = BI.$.fn.zTree.init(this.tree.element, setting, nodes); this.nodes = BI.$.fn.zTree.init(this.tree.element, setting, nodes);
},
destroy: function () {
BI.DisplayTree.superclass.destroy.apply(this, arguments);
} }
}); });
BI.DisplayTree.EVENT_CHANGE = "EVENT_CHANGE"; BI.DisplayTree.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.display_tree", BI.DisplayTree); BI.shortcut("bi.display_tree", BI.DisplayTree);

6
src/core/action/action.show.js

@ -9,10 +9,6 @@ BI.ShowAction = BI.inherit(BI.Action, {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {}); return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {});
}, },
_init: function () {
BI.ShowAction.superclass._init.apply(this, arguments);
},
actionPerformed: function (src, tar, callback) { actionPerformed: function (src, tar, callback) {
tar = tar || this.options.tar; tar = tar || this.options.tar;
tar.setVisible(true); tar.setVisible(true);
@ -24,4 +20,4 @@ BI.ShowAction = BI.inherit(BI.Action, {
tar.setVisible(false); tar.setVisible(false);
callback && callback(); callback && callback();
} }
}); });

9
src/core/controller.js

@ -11,13 +11,6 @@ BI.Controller = BI.inherit(BI.OB, {
return BI.extend(BI.Controller.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.Controller.superclass._defaultConfig.apply(this, arguments), {
}); });
},
_init: function () {
BI.Controller.superclass._init.apply(this, arguments);
},
destroy: function () {
} }
}); });
BI.Controller.EVENT_CHANGE = "__EVENT_CHANGE__"; BI.Controller.EVENT_CHANGE = "__EVENT_CHANGE__";

18
src/core/logic/logic.layout.js

@ -43,10 +43,6 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap, bgap: o.bgap,
items: o.items items: o.items
}; };
},
_init: function () {
BI.VerticalLayoutLogic.superclass._init.apply(this, arguments);
} }
}); });
@ -96,10 +92,6 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap, bgap: o.bgap,
items: o.items items: o.items
}; };
},
_init: function () {
BI.HorizontalLayoutLogic.superclass._init.apply(this, arguments);
} }
}); });
@ -148,10 +140,6 @@ BI.TableLayoutLogic = BI.inherit(BI.Logic, {
vgap: o.vgap, vgap: o.vgap,
items: o.items items: o.items
}; };
},
_init: function () {
BI.TableLayoutLogic.superclass._init.apply(this, arguments);
} }
}); });
@ -204,9 +192,5 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap, bgap: o.bgap,
items: o.items items: o.items
}; };
},
_init: function () {
BI.HorizontalFillLayoutLogic.superclass._init.apply(this, arguments);
} }
}); });

6
src/core/shortcut.js

@ -23,9 +23,9 @@
widget._initProps(config); widget._initProps(config);
widget._initRoot(); widget._initRoot();
widget._initRef(); widget._initRef();
if (config.element || config.root) { // if (config.element || config.root) {
widget._lazyConstructor(); widget._lazyConstructor();
} // }
return widget; return widget;
}; };

Loading…
Cancel
Save