forked from fanruan/fineui
Treecat
2 years ago
45 changed files with 1330 additions and 1152 deletions
@ -1,19 +1,24 @@
|
||||
import { IconButton } from "../../../base/single/button/buttons/button.icon"; |
||||
import { shortcut, extend } from "../../../core"; |
||||
|
||||
/** |
||||
* 统一的trigger图标按钮 |
||||
* |
||||
* Created by GUY on 2015/9/16. |
||||
* @class BI.TriggerIconButton |
||||
* @extends BI.IconButton |
||||
* @class TriggerIconButton |
||||
* @extends IconButton |
||||
*/ |
||||
BI.TriggerIconButton = BI.inherit(BI.IconButton, { |
||||
|
||||
_defaultConfig: function () { |
||||
var conf = BI.TriggerIconButton.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
baseCls: (conf.baseCls || "") + " bi-trigger-icon-button overflow-hidden", |
||||
extraCls: "pull-down-font" |
||||
@shortcut() |
||||
export class TriggerIconButton extends IconButton { |
||||
static xtype = "bi.trigger_icon_button"; |
||||
EVENT_CHANGE = IconButton.EVENT_CHANGE; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(arguments); |
||||
|
||||
return extend(conf, { |
||||
baseCls: `${conf.baseCls || ""} bi-trigger-icon-button overflow-hidden`, |
||||
extraCls: "pull-down-font", |
||||
}); |
||||
} |
||||
}); |
||||
BI.TriggerIconButton.EVENT_CHANGE = BI.IconButton.EVENT_CHANGE; |
||||
BI.shortcut("bi.trigger_icon_button", BI.TriggerIconButton); |
||||
} |
||||
|
@ -1,21 +1,28 @@
|
||||
import { IconButton } from "../../../../base/single/button/buttons/button.icon"; |
||||
import { shortcut, extend } from "../../../../core"; |
||||
|
||||
|
||||
/** |
||||
* guy |
||||
* @extends BI.Single |
||||
* @type {*|void|Object} |
||||
*/ |
||||
BI.HalfIconButton = BI.inherit(BI.IconButton, { |
||||
_defaultConfig: function () { |
||||
var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
@shortcut() |
||||
export class HalfIconButton extends IconButton { |
||||
static xtype = "bi.half_icon_button"; |
||||
static EVENT_CHANGE = IconButton.EVENT_CHANGE |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(arguments); |
||||
|
||||
return extend(conf, { |
||||
extraCls: "bi-half-icon-button check-half-select-icon", |
||||
height: 16, |
||||
width: 16, |
||||
iconWidth: 16, |
||||
iconHeight: 16, |
||||
selected: false |
||||
selected: false, |
||||
}); |
||||
} |
||||
}); |
||||
BI.HalfIconButton.EVENT_CHANGE = BI.IconButton.EVENT_CHANGE; |
||||
} |
||||
|
||||
BI.shortcut("bi.half_icon_button", BI.HalfIconButton); |
@ -0,0 +1,29 @@
|
||||
export { MultiSelectItem } from "./item.multiselect"; |
||||
export { SingleSelectIconTextItem } from "./item.singleselect.icontext"; |
||||
export { SingleSelectItem } from "./item.singleselect"; |
||||
export { SingleSelectRadioItem } from "./item.singleselect.radio"; |
||||
export { Switch } from "./switch"; |
||||
|
||||
export { IconChangeButton } from "./icon/icon.change"; |
||||
export { TriggerIconButton } from "./icon/icon.trigger"; |
||||
export { HalfIconButton } from "./icon/iconhalf/icon.half.image"; |
||||
export { HalfButton } from "./icon/iconhalf/icon.half"; |
||||
|
||||
export { ArrowNode } from "./node/node.arrow"; |
||||
export { FirstPlusGroupNode } from "./node/node.first.plus"; |
||||
export { IconArrowNode } from "./node/node.icon.arrow"; |
||||
export { LastPlusGroupNode } from "./node/node.last.plus"; |
||||
export { MidPlusGroupNode } from "./node/node.mid.plus"; |
||||
export { MultiLayerIconArrowNode } from "./node/node.multilayer.icon.arrow"; |
||||
export { PlusGroupNode } from "./node/node.plus"; |
||||
export { TreeNodeSwitcher } from "./node/siwtcher.tree.node"; |
||||
export { BasicTreeNode } from "./node/treenode"; |
||||
|
||||
export { FirstTreeLeafItem } from "./treeitem/item.first.treeleaf"; |
||||
export { IconTreeLeafItem } from "./treeitem/item.icon.treeleaf"; |
||||
export { LastTreeLeafItem } from "./treeitem/item.last.treeleaf"; |
||||
export { MidTreeLeafItem } from "./treeitem/item.mid.treeleaf"; |
||||
export { MultiLayerIconTreeLeafItem } from "./treeitem/item.multilayer.icon.treeleaf"; |
||||
export { RootTreeLeafItem } from "./treeitem/item.root.treeleaf"; |
||||
export { TreeTextLeafItem } from "./treeitem/item.treetextleaf"; |
||||
export { BasicTreeItem } from "./treeitem/treeitem"; |
@ -1,84 +1,95 @@
|
||||
/** |
||||
* Created by Windy on 2018/2/1. |
||||
*/ |
||||
BI.Switch = BI.inherit(BI.BasicButton, { |
||||
|
||||
constants: { |
||||
CIRCLE_SIZE: 12 |
||||
}, |
||||
import { BasicButton } from "../../base/single/button/button.basic"; |
||||
import { shortcut } from "../../core"; |
||||
|
||||
props: { |
||||
@shortcut() |
||||
export class Switch extends BasicButton { |
||||
static xtype = "bi.switch"; |
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
constants = { |
||||
CIRCLE_SIZE: 12, |
||||
}; |
||||
|
||||
props = { |
||||
extraCls: "bi-switch", |
||||
attributes: { |
||||
tabIndex: 1 |
||||
tabIndex: 1, |
||||
}, |
||||
height: 20, |
||||
width: 44, |
||||
showTip: false |
||||
}, |
||||
showTip: false, |
||||
}; |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options, c = this.constants; |
||||
var tgap = (o.height - c.CIRCLE_SIZE) / 2; |
||||
render() { |
||||
const o = this.options, |
||||
c = this.constants; |
||||
const tgap = (o.height - c.CIRCLE_SIZE) / 2; |
||||
|
||||
return { |
||||
type: "bi.absolute", |
||||
ref: function () { |
||||
self.layout = this; |
||||
ref: _ref => { |
||||
this.layout = _ref; |
||||
}, |
||||
items: [{ |
||||
el: { |
||||
type: "bi.text_button", |
||||
cls: "circle-button" |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: "bi.text_button", |
||||
cls: "circle-button", |
||||
}, |
||||
width: 12, |
||||
height: 12, |
||||
top: tgap, |
||||
left: o.selected ? 28 : 4, |
||||
}, |
||||
width: 12, |
||||
height: 12, |
||||
top: tgap, |
||||
left: o.selected ? 28 : 4 |
||||
}, { |
||||
type: "bi.label", |
||||
text: BI.i18nText("BI-Basic_Simple_Open"), |
||||
cls: "content-tip", |
||||
left: 8, |
||||
top: tgap - 2, |
||||
invisible: !(o.showTip && o.selected), |
||||
ref: function (ref) { |
||||
self.openTip = ref; |
||||
} |
||||
}, { |
||||
type: "bi.label", |
||||
text: BI.i18nText("BI-Basic_Simple_Close"), |
||||
cls: "content-tip", |
||||
right: 8, |
||||
top: tgap - 2, |
||||
invisible: !(o.showTip && !o.selected), |
||||
ref: function (ref) { |
||||
self.closeTip = ref; |
||||
{ |
||||
type: "bi.label", |
||||
text: BI.i18nText("BI-Basic_Simple_Open"), |
||||
cls: "content-tip", |
||||
left: 8, |
||||
top: tgap - 2, |
||||
invisible: !(o.showTip && o.selected), |
||||
ref: _ref => { |
||||
this.openTip = _ref; |
||||
}, |
||||
}, |
||||
{ |
||||
type: "bi.label", |
||||
text: BI.i18nText("BI-Basic_Simple_Close"), |
||||
cls: "content-tip", |
||||
right: 8, |
||||
top: tgap - 2, |
||||
invisible: !(o.showTip && !o.selected), |
||||
ref: _ref => { |
||||
this.closeTip = _ref; |
||||
}, |
||||
} |
||||
}] |
||||
], |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
_setEnable: function (enable) { |
||||
BI.Switch.superclass._setEnable.apply(this, arguments); |
||||
_setEnable(enable) { |
||||
super._setEnable.apply(this, arguments); |
||||
if (enable === true) { |
||||
this.element.attr("tabIndex", 1); |
||||
} else if (enable === false) { |
||||
this.element.removeAttr("tabIndex"); |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setSelected: function (v) { |
||||
BI.Switch.superclass.setSelected.apply(this, arguments); |
||||
setSelected(v) { |
||||
super.setSelected.apply(this, arguments); |
||||
this.layout.attr("items")[0].left = v ? 28 : 4; |
||||
this.layout.resize(); |
||||
this.options.showTip && this.openTip.setVisible(v); |
||||
this.options.showTip && this.closeTip.setVisible(!v); |
||||
}, |
||||
} |
||||
|
||||
doClick: function () { |
||||
BI.Switch.superclass.doClick.apply(this, arguments); |
||||
this.fireEvent(BI.Switch.EVENT_CHANGE, this.isSelected()); |
||||
doClick() { |
||||
super.doClick.apply(this, arguments); |
||||
this.fireEvent(Switch.EVENT_CHANGE, this.isSelected()); |
||||
} |
||||
}); |
||||
BI.Switch.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.switch", BI.Switch); |
||||
} |
||||
|
Loading…
Reference in new issue