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图标按钮 |
* 统一的trigger图标按钮 |
||||||
* |
* |
||||||
* Created by GUY on 2015/9/16. |
* Created by GUY on 2015/9/16. |
||||||
* @class BI.TriggerIconButton |
* @class TriggerIconButton |
||||||
* @extends BI.IconButton |
* @extends IconButton |
||||||
*/ |
*/ |
||||||
BI.TriggerIconButton = BI.inherit(BI.IconButton, { |
@shortcut() |
||||||
|
export class TriggerIconButton extends IconButton { |
||||||
|
static xtype = "bi.trigger_icon_button"; |
||||||
|
EVENT_CHANGE = IconButton.EVENT_CHANGE; |
||||||
|
|
||||||
|
_defaultConfig() { |
||||||
|
const conf = super._defaultConfig(arguments); |
||||||
|
|
||||||
_defaultConfig: function () { |
return extend(conf, { |
||||||
var conf = BI.TriggerIconButton.superclass._defaultConfig.apply(this, arguments); |
baseCls: `${conf.baseCls || ""} bi-trigger-icon-button overflow-hidden`, |
||||||
return BI.extend(conf, { |
extraCls: "pull-down-font", |
||||||
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 |
* guy |
||||||
* @extends BI.Single |
* @extends BI.Single |
||||||
* @type {*|void|Object} |
* @type {*|void|Object} |
||||||
*/ |
*/ |
||||||
BI.HalfIconButton = BI.inherit(BI.IconButton, { |
@shortcut() |
||||||
_defaultConfig: function () { |
export class HalfIconButton extends IconButton { |
||||||
var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this, arguments); |
static xtype = "bi.half_icon_button"; |
||||||
return BI.extend(conf, { |
static EVENT_CHANGE = IconButton.EVENT_CHANGE |
||||||
|
|
||||||
|
_defaultConfig() { |
||||||
|
const conf = super._defaultConfig(arguments); |
||||||
|
|
||||||
|
return extend(conf, { |
||||||
extraCls: "bi-half-icon-button check-half-select-icon", |
extraCls: "bi-half-icon-button check-half-select-icon", |
||||||
height: 16, |
height: 16, |
||||||
width: 16, |
width: 16, |
||||||
iconWidth: 16, |
iconWidth: 16, |
||||||
iconHeight: 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. |
* Created by Windy on 2018/2/1. |
||||||
*/ |
*/ |
||||||
BI.Switch = BI.inherit(BI.BasicButton, { |
|
||||||
|
|
||||||
constants: { |
import { BasicButton } from "../../base/single/button/button.basic"; |
||||||
CIRCLE_SIZE: 12 |
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", |
extraCls: "bi-switch", |
||||||
attributes: { |
attributes: { |
||||||
tabIndex: 1 |
tabIndex: 1, |
||||||
}, |
}, |
||||||
height: 20, |
height: 20, |
||||||
width: 44, |
width: 44, |
||||||
showTip: false |
showTip: false, |
||||||
}, |
}; |
||||||
|
|
||||||
|
render() { |
||||||
|
const o = this.options, |
||||||
|
c = this.constants; |
||||||
|
const tgap = (o.height - c.CIRCLE_SIZE) / 2; |
||||||
|
|
||||||
render: function () { |
|
||||||
var self = this, o = this.options, c = this.constants; |
|
||||||
var tgap = (o.height - c.CIRCLE_SIZE) / 2; |
|
||||||
return { |
return { |
||||||
type: "bi.absolute", |
type: "bi.absolute", |
||||||
ref: function () { |
ref: _ref => { |
||||||
self.layout = this; |
this.layout = _ref; |
||||||
}, |
}, |
||||||
items: [{ |
items: [ |
||||||
el: { |
{ |
||||||
type: "bi.text_button", |
el: { |
||||||
cls: "circle-button" |
type: "bi.text_button", |
||||||
|
cls: "circle-button", |
||||||
|
}, |
||||||
|
width: 12, |
||||||
|
height: 12, |
||||||
|
top: tgap, |
||||||
|
left: o.selected ? 28 : 4, |
||||||
}, |
}, |
||||||
width: 12, |
{ |
||||||
height: 12, |
type: "bi.label", |
||||||
top: tgap, |
text: BI.i18nText("BI-Basic_Simple_Open"), |
||||||
left: o.selected ? 28 : 4 |
cls: "content-tip", |
||||||
}, { |
left: 8, |
||||||
type: "bi.label", |
top: tgap - 2, |
||||||
text: BI.i18nText("BI-Basic_Simple_Open"), |
invisible: !(o.showTip && o.selected), |
||||||
cls: "content-tip", |
ref: _ref => { |
||||||
left: 8, |
this.openTip = _ref; |
||||||
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", |
||||||
type: "bi.label", |
right: 8, |
||||||
text: BI.i18nText("BI-Basic_Simple_Close"), |
top: tgap - 2, |
||||||
cls: "content-tip", |
invisible: !(o.showTip && !o.selected), |
||||||
right: 8, |
ref: _ref => { |
||||||
top: tgap - 2, |
this.closeTip = _ref; |
||||||
invisible: !(o.showTip && !o.selected), |
}, |
||||||
ref: function (ref) { |
|
||||||
self.closeTip = ref; |
|
||||||
} |
} |
||||||
}] |
], |
||||||
}; |
}; |
||||||
}, |
} |
||||||
|
|
||||||
_setEnable: function (enable) { |
_setEnable(enable) { |
||||||
BI.Switch.superclass._setEnable.apply(this, arguments); |
super._setEnable.apply(this, arguments); |
||||||
if (enable === true) { |
if (enable === true) { |
||||||
this.element.attr("tabIndex", 1); |
this.element.attr("tabIndex", 1); |
||||||
} else if (enable === false) { |
} else if (enable === false) { |
||||||
this.element.removeAttr("tabIndex"); |
this.element.removeAttr("tabIndex"); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
setSelected: function (v) { |
setSelected(v) { |
||||||
BI.Switch.superclass.setSelected.apply(this, arguments); |
super.setSelected.apply(this, arguments); |
||||||
this.layout.attr("items")[0].left = v ? 28 : 4; |
this.layout.attr("items")[0].left = v ? 28 : 4; |
||||||
this.layout.resize(); |
this.layout.resize(); |
||||||
this.options.showTip && this.openTip.setVisible(v); |
this.options.showTip && this.openTip.setVisible(v); |
||||||
this.options.showTip && this.closeTip.setVisible(!v); |
this.options.showTip && this.closeTip.setVisible(!v); |
||||||
}, |
} |
||||||
|
|
||||||
doClick: function () { |
doClick() { |
||||||
BI.Switch.superclass.doClick.apply(this, arguments); |
super.doClick.apply(this, arguments); |
||||||
this.fireEvent(BI.Switch.EVENT_CHANGE, this.isSelected()); |
this.fireEvent(Switch.EVENT_CHANGE, this.isSelected()); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.Switch.EVENT_CHANGE = "EVENT_CHANGE"; |
|
||||||
BI.shortcut("bi.switch", BI.Switch); |
|
||||||
|
Loading…
Reference in new issue