Browse Source
Merge in VISUAL/fineui from ~TREECAT/fineui:es6 to es6 * commit 'f29b6135173c313d6ab61139296b33f9e7195c95': KERNEL-13962 refact: es6按钮组es6
treecat-罗群
2 years ago
21 changed files with 1075 additions and 945 deletions
@ -1,54 +1,60 @@
|
||||
import { BasicButton } from "./button.basic" |
||||
import { shortcut, extend, Controller } from "../../../core" |
||||
|
||||
/** |
||||
* 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 |
||||
* |
||||
* Created by GUY on 2015/9/9. |
||||
* @class BI.NodeButton |
||||
* @extends BI.BasicButton |
||||
* @class NodeButton |
||||
* @extends BasicButton |
||||
* @abstract |
||||
*/ |
||||
BI.NodeButton = BI.inherit(BI.BasicButton, { |
||||
_defaultConfig: function () { |
||||
var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments); |
||||
@shortcut() |
||||
export class NodeButton extends BasicButton { |
||||
|
||||
static xtype = "bi.node_button"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(arguments); |
||||
|
||||
return BI.extend(conf, { |
||||
return extend(conf, { |
||||
_baseCls: (conf._baseCls || "") + " bi-node", |
||||
open: false, |
||||
once: false, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_initRef: function () { |
||||
_initRef() { |
||||
if (this.isOpened()) { |
||||
this.setOpened(this.isOpened()); |
||||
} |
||||
BI.NodeButton.superclass._initRef.apply(this, arguments); |
||||
}, |
||||
super._initRef.apply(this, arguments); |
||||
} |
||||
|
||||
doClick: function () { |
||||
BI.NodeButton.superclass.doClick.apply(this, arguments); |
||||
doClick() { |
||||
super.doClick.apply(this, arguments); |
||||
this.setOpened(!this.isOpened()); |
||||
}, |
||||
} |
||||
|
||||
isOpened: function () { |
||||
isOpened() { |
||||
return !!this.options.open; |
||||
}, |
||||
} |
||||
|
||||
setOpened: function (b) { |
||||
setOpened(b) { |
||||
this.options.open = !!b; |
||||
}, |
||||
} |
||||
|
||||
triggerCollapse: function () { |
||||
triggerCollapse() { |
||||
if (this.isOpened()) { |
||||
this.setOpened(false); |
||||
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this); |
||||
this.fireEvent(Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this); |
||||
} |
||||
}, |
||||
} |
||||
|
||||
triggerExpand: function () { |
||||
triggerExpand() { |
||||
if (!this.isOpened()) { |
||||
this.setOpened(true); |
||||
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this); |
||||
this.fireEvent(Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this); |
||||
} |
||||
}, |
||||
}); |
||||
BI.shortcut("bi.node_button", BI.NodeButton); |
||||
} |
||||
} |
@ -1,87 +1,94 @@
|
||||
import { BasicButton } from "../button.basic"; |
||||
import { shortcut, extend, isNumber, createWidget } from "../../../../core"; |
||||
|
||||
|
||||
/** |
||||
* 图片的button |
||||
* |
||||
* Created by GUY on 2016/1/27. |
||||
* @class BI.ImageButton |
||||
* @extends BI.BasicButton |
||||
* @class ImageButton |
||||
* @extends BasicButton |
||||
*/ |
||||
BI.ImageButton = BI.inherit(BI.BasicButton, { |
||||
_defaultConfig: function () { |
||||
var conf = BI.ImageButton.superclass._defaultConfig.apply(this, arguments); |
||||
@shortcut() |
||||
export class ImageButton extends BasicButton { |
||||
|
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
static xtype = "bi.image_button"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(arguments); |
||||
|
||||
return BI.extend(conf, { |
||||
return extend(conf, { |
||||
baseCls: (conf.baseCls || "") + " bi-image-button", |
||||
src: "", |
||||
iconWidth: "100%", |
||||
iconHeight: "100%", |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
render: function () { |
||||
var o = this.options; |
||||
this.image = BI.createWidget({ |
||||
render() { |
||||
const o = this.options; |
||||
this.image = createWidget({ |
||||
type: "bi.img", |
||||
width: o.iconWidth, |
||||
height: o.iconHeight, |
||||
src: o.src, |
||||
}); |
||||
if (BI.isNumber(o.iconWidth) || BI.isNumber(o.iconHeight)) { |
||||
BI.createWidget({ |
||||
if (isNumber(o.iconWidth) || isNumber(o.iconHeight)) { |
||||
createWidget({ |
||||
type: "bi.center_adapt", |
||||
element: this, |
||||
items: [this.image], |
||||
}); |
||||
} else { |
||||
BI.createWidget({ |
||||
createWidget({ |
||||
type: "bi.adaptive", |
||||
element: this, |
||||
items: [this.image], |
||||
scrollable: false, |
||||
}); |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setWidth: function (w) { |
||||
BI.ImageButton.superclass.setWidth.apply(this, arguments); |
||||
setWidth(w) { |
||||
super.setWidth.apply(this, arguments); |
||||
this.options.width = w; |
||||
}, |
||||
} |
||||
|
||||
setHeight: function (h) { |
||||
BI.ImageButton.superclass.setHeight.apply(this, arguments); |
||||
setHeight(h) { |
||||
super.setHeight.apply(this, arguments); |
||||
this.options.height = h; |
||||
}, |
||||
} |
||||
|
||||
setImageWidth: function (w) { |
||||
setImageWidth(w) { |
||||
this.image.setWidth(w); |
||||
}, |
||||
} |
||||
|
||||
setImageHeight: function (h) { |
||||
setImageHeight(h) { |
||||
this.image.setHeight(h); |
||||
}, |
||||
} |
||||
|
||||
getImageWidth: function () { |
||||
getImageWidth() { |
||||
return this.image.element.width(); |
||||
}, |
||||
} |
||||
|
||||
getImageHeight: function () { |
||||
getImageHeight() { |
||||
return this.image.element.height(); |
||||
}, |
||||
} |
||||
|
||||
setSrc: function (src) { |
||||
setSrc(src) { |
||||
this.options.src = src; |
||||
this.image.setSrc(src); |
||||
}, |
||||
} |
||||
|
||||
getSrc: function () { |
||||
getSrc() { |
||||
return this.image.getSrc(); |
||||
}, |
||||
} |
||||
|
||||
doClick: function () { |
||||
BI.ImageButton.superclass.doClick.apply(this, arguments); |
||||
doClick() { |
||||
super.doClick.apply(this, arguments); |
||||
if (this.isValid()) { |
||||
this.fireEvent(BI.ImageButton.EVENT_CHANGE, this); |
||||
this.fireEvent(ImageButton.EVENT_CHANGE, this); |
||||
} |
||||
}, |
||||
}); |
||||
BI.ImageButton.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.image_button", BI.ImageButton); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,17 @@
|
||||
export { BasicButton } from "./button.basic"; |
||||
export { NodeButton } from "./button.node"; |
||||
export { Button } from "./buttons/button"; |
||||
export { IconButton } from "./buttons/button.icon"; |
||||
export { ImageButton } from "./buttons/button.image"; |
||||
export { TextButton } from "./buttons/button.text"; |
||||
export { BlankIconIconTextItem } from "./listitem/blankiconicontextitem"; |
||||
export { BlankIconTextIconItem } from "./listitem/blankicontexticonitem"; |
||||
export { BlankIconTextItem } from "./listitem/blankicontextitem"; |
||||
export { IconTextIconItem } from "./listitem/icontexticonitem"; |
||||
export { IconTextItem } from "./listitem/icontextitem"; |
||||
export { TextIconItem } from "./listitem/texticonitem"; |
||||
export { TextItem } from "./listitem/textitem"; |
||||
export { IconTextIconNode } from "./node/icontexticonnode"; |
||||
export { IconTextNode } from "./node/icontextnode"; |
||||
export { TextIconNode } from "./node/texticonnode"; |
||||
export { TextNode } from "./node/textnode"; |
@ -1,4 +1,5 @@
|
||||
export { Single } from "./0.single"; |
||||
export { Text } from "./1.text"; |
||||
export { A } from "./a/a"; |
||||
export * from "./tip"; |
||||
export * from "./tip"; |
||||
export * from "./button" |
Loading…
Reference in new issue