|
|
|
@ -1,15 +1,24 @@
|
|
|
|
|
import { Single } from "../0.single" |
|
|
|
|
import { emptyFn, shortcut, extend, isFunction, createWidget, Widget, isObject, Controller } from "../../../core" |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* guy |
|
|
|
|
* @class BI.BasicButton |
|
|
|
|
* @extends BI.Single |
|
|
|
|
* @class BasicButton |
|
|
|
|
* @extends Single |
|
|
|
|
* |
|
|
|
|
* 一般的button父级 |
|
|
|
|
*/ |
|
|
|
|
BI.BasicButton = BI.inherit(BI.Single, { |
|
|
|
|
_defaultConfig: function () { |
|
|
|
|
var conf = BI.BasicButton.superclass._defaultConfig.apply(this, arguments); |
|
|
|
|
@shortcut() |
|
|
|
|
export class BasicButton extends Single { |
|
|
|
|
|
|
|
|
|
static xtype = "bi.basic_button"; |
|
|
|
|
|
|
|
|
|
static EVENT_CHANGE = "BasicButton.EVENT_CHANGE"; |
|
|
|
|
|
|
|
|
|
return BI.extend(conf, { |
|
|
|
|
_defaultConfig() { |
|
|
|
|
const conf = super._defaultConfig(arguments); |
|
|
|
|
|
|
|
|
|
return extend(conf, { |
|
|
|
|
_baseCls: (conf._baseCls || "") + " bi-basic-button" + (conf.invalid ? "" : " cursor-pointer") + ((BI.isIE() && BI.getIEVersion() < 10) ? " hack" : ""), |
|
|
|
|
// el: {} // 可以通过el来创建button元素
|
|
|
|
|
value: "", |
|
|
|
@ -24,19 +33,18 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
shadow: false, |
|
|
|
|
isShadowShowingOnSelected: false, // 选中状态下是否显示阴影
|
|
|
|
|
trigger: null, |
|
|
|
|
handler: BI.emptyFn, |
|
|
|
|
handler: emptyFn, |
|
|
|
|
bubble: null, |
|
|
|
|
debounce: true |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
|
var self = this; |
|
|
|
|
var opts = this.options; |
|
|
|
|
opts.selected = BI.isFunction(opts.selected) ? this.__watch(opts.selected, function (context, newValue) { |
|
|
|
|
self.setSelected(newValue); |
|
|
|
|
_init() { |
|
|
|
|
const opts = this.options; |
|
|
|
|
opts.selected = isFunction(opts.selected) ? this.__watch(opts.selected, (context, newValue) => { |
|
|
|
|
this.setSelected(newValue); |
|
|
|
|
}) : opts.selected; |
|
|
|
|
BI.BasicButton.superclass._init.apply(this, arguments); |
|
|
|
|
super._init(arguments); |
|
|
|
|
|
|
|
|
|
if (opts.shadow) { |
|
|
|
|
this._createShadow(); |
|
|
|
@ -44,9 +52,9 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
if (opts.level) { |
|
|
|
|
this.element.addClass("button-" + opts.level); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_initRef: function () { |
|
|
|
|
_initRef() { |
|
|
|
|
if (this.options.selected === true) { |
|
|
|
|
this.setSelected(true); |
|
|
|
|
} |
|
|
|
@ -54,29 +62,29 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
BI.nextTick(() => { |
|
|
|
|
!this.isDestroyed() && this.bindEvent(); |
|
|
|
|
}); |
|
|
|
|
BI.BasicButton.superclass._initRef.apply(this, arguments); |
|
|
|
|
}, |
|
|
|
|
super._initRef.apply(this, arguments); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 默认render方法
|
|
|
|
|
render: function () { |
|
|
|
|
render() { |
|
|
|
|
return this.options.el; |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_createShadow: function () { |
|
|
|
|
var self = this, o = this.options; |
|
|
|
|
_createShadow() { |
|
|
|
|
const o = this.options; |
|
|
|
|
|
|
|
|
|
function assertMask() { |
|
|
|
|
if (!self.$mask) { |
|
|
|
|
self.$mask = BI.createWidget(BI.isObject(o.shadow) ? o.shadow : {}, { |
|
|
|
|
const assertMask = () => { |
|
|
|
|
if (!this.$mask) { |
|
|
|
|
this.$mask = createWidget(isObject(o.shadow) ? o.shadow : {}, { |
|
|
|
|
type: "bi.layout", |
|
|
|
|
cls: "bi-button-mask", |
|
|
|
|
}); |
|
|
|
|
self.$mask.invisible(); |
|
|
|
|
BI.createWidget({ |
|
|
|
|
this.$mask.invisible(); |
|
|
|
|
createWidget({ |
|
|
|
|
type: "bi.absolute", |
|
|
|
|
element: self, |
|
|
|
|
element: this, |
|
|
|
|
items: [{ |
|
|
|
|
el: self.$mask, |
|
|
|
|
el: this.$mask, |
|
|
|
|
left: 0, |
|
|
|
|
right: 0, |
|
|
|
|
top: 0, |
|
|
|
@ -86,48 +94,129 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.element.mouseup(function () { |
|
|
|
|
if (!self._hover && !o.isShadowShowingOnSelected) { |
|
|
|
|
this.element.mouseup(() => { |
|
|
|
|
if (!this._hover && !o.isShadowShowingOnSelected) { |
|
|
|
|
assertMask(); |
|
|
|
|
self.$mask.invisible(); |
|
|
|
|
this.$mask.invisible(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.element.on("mouseenter." + this.getName(), function (e) { |
|
|
|
|
if (self.element.__isMouseInBounds__(e)) { |
|
|
|
|
if (self.isEnabled() && !self._hover && (o.isShadowShowingOnSelected || !self.isSelected())) { |
|
|
|
|
this.element.on("mouseenter." + this.getName(), (e) => { |
|
|
|
|
if (this.element.__isMouseInBounds__(e)) { |
|
|
|
|
if (this.isEnabled() && !this._hover && (o.isShadowShowingOnSelected || !this.isSelected())) { |
|
|
|
|
assertMask(); |
|
|
|
|
self.$mask.visible(); |
|
|
|
|
this.$mask.visible(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.element.on("mousemove." + this.getName(), function (e) { |
|
|
|
|
if (!self.element.__isMouseInBounds__(e)) { |
|
|
|
|
if (self.isEnabled() && !self._hover) { |
|
|
|
|
this.element.on("mousemove." + this.getName(), (e) => { |
|
|
|
|
if (!this.element.__isMouseInBounds__(e)) { |
|
|
|
|
if (this.isEnabled() && !this._hover) { |
|
|
|
|
assertMask(); |
|
|
|
|
self.$mask.invisible(); |
|
|
|
|
this.$mask.invisible(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.element.on("mouseleave." + this.getName(), function () { |
|
|
|
|
if (self.isEnabled() && !self._hover) { |
|
|
|
|
this.element.on("mouseleave." + this.getName(), () => { |
|
|
|
|
if (this.isEnabled() && !this._hover) { |
|
|
|
|
assertMask(); |
|
|
|
|
self.$mask.invisible(); |
|
|
|
|
this.$mask.invisible(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bindEvent: function () { |
|
|
|
|
var self = this; |
|
|
|
|
var o = this.options, hand = this.handle(); |
|
|
|
|
bindEvent() { |
|
|
|
|
const o = this.options; |
|
|
|
|
let hand = this.handle(); |
|
|
|
|
if (!hand) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
hand = hand.element; |
|
|
|
|
var triggerArr = (o.trigger || "").split(","); |
|
|
|
|
BI.each(triggerArr, function (idx, trigger) { |
|
|
|
|
|
|
|
|
|
const getBubble = () => { |
|
|
|
|
const bubble = o.bubble; |
|
|
|
|
if (isFunction(bubble)) { |
|
|
|
|
return bubble(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return bubble; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const clk = (e) => { |
|
|
|
|
ev(e); |
|
|
|
|
if (!this.isEnabled() || !this.isValid()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (this.isOnce() && this.isSelected()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (BI.isKey(o.bubble) || isFunction(o.bubble)) { |
|
|
|
|
if (BI.isNull(this.combo)) { |
|
|
|
|
let popup; |
|
|
|
|
createWidget({ |
|
|
|
|
type: "bi.absolute", |
|
|
|
|
element: this, |
|
|
|
|
items: [{ |
|
|
|
|
el: { |
|
|
|
|
type: "bi.bubble_combo", |
|
|
|
|
trigger: "", |
|
|
|
|
// bubble的提示不需要一直存在在界面上
|
|
|
|
|
destroyWhenHide: true, |
|
|
|
|
ref: (_ref) => { |
|
|
|
|
this.combo = _ref; |
|
|
|
|
}, |
|
|
|
|
el: { |
|
|
|
|
type: "bi.layout", |
|
|
|
|
height: "100%", |
|
|
|
|
}, |
|
|
|
|
popup: { |
|
|
|
|
type: "bi.text_bubble_bar_popup_view", |
|
|
|
|
text: getBubble(), |
|
|
|
|
ref: (_ref) => { |
|
|
|
|
popup = _ref; |
|
|
|
|
}, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, |
|
|
|
|
action: (...args) => { |
|
|
|
|
const [v] = args; |
|
|
|
|
this.combo.hideView(); |
|
|
|
|
if (v) { |
|
|
|
|
onClick.apply(this, args); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}], |
|
|
|
|
}, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW, |
|
|
|
|
action: function () { |
|
|
|
|
popup.populate(getBubble()); |
|
|
|
|
}, |
|
|
|
|
}], |
|
|
|
|
}, |
|
|
|
|
left: 0, |
|
|
|
|
right: 0, |
|
|
|
|
bottom: 0, |
|
|
|
|
top: 0, |
|
|
|
|
}], |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
if (this.combo.isViewVisible()) { |
|
|
|
|
this.combo.hideView(); |
|
|
|
|
} else { |
|
|
|
|
this.combo.showView(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
onClick.apply(this, arguments); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const triggerArr = (o.trigger || "").split(","); |
|
|
|
|
triggerArr.forEach((trigger) => { |
|
|
|
|
let mouseDown = false; |
|
|
|
|
switch (trigger) { |
|
|
|
|
case "mouseup": |
|
|
|
|
var mouseDown = false; |
|
|
|
|
hand.mousedown(function () { |
|
|
|
|
mouseDown = true; |
|
|
|
|
}); |
|
|
|
@ -140,24 +229,24 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
case "mousedown": |
|
|
|
|
var mouseDown = false; |
|
|
|
|
var selected = false; |
|
|
|
|
hand.mousedown(function (e) { |
|
|
|
|
// let mouseDown = false;
|
|
|
|
|
let selected = false; |
|
|
|
|
hand.mousedown((e) => { |
|
|
|
|
// if (e.button === 0) {
|
|
|
|
|
BI.Widget._renderEngine.createElement(document).bind("mouseup." + self.getName(), function (e) { |
|
|
|
|
Widget._renderEngine.createElement(document).bind("mouseup." + this.getName(), (e) => { |
|
|
|
|
// if (e.button === 0) {
|
|
|
|
|
if (BI.DOM.isExist(self) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) { |
|
|
|
|
if (BI.DOM.isExist(this) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) { |
|
|
|
|
// self.setSelected(!self.isSelected());
|
|
|
|
|
self._trigger(); |
|
|
|
|
this._trigger(); |
|
|
|
|
} |
|
|
|
|
mouseDown = false; |
|
|
|
|
BI.Widget._renderEngine.createElement(document).unbind("mouseup." + self.getName()); |
|
|
|
|
Widget._renderEngine.createElement(document).unbind("mouseup." + this.getName()); |
|
|
|
|
// }
|
|
|
|
|
}); |
|
|
|
|
if (mouseDown === true) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (self.isSelected()) { |
|
|
|
|
if (this.isSelected()) { |
|
|
|
|
selected = true; |
|
|
|
|
} else { |
|
|
|
|
clk(e); |
|
|
|
@ -166,14 +255,14 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
ev(e); |
|
|
|
|
// }
|
|
|
|
|
}); |
|
|
|
|
hand.mouseup(function (e) { |
|
|
|
|
hand.mouseup((e) => { |
|
|
|
|
// if (e.button === 0) {
|
|
|
|
|
if (BI.DOM.isExist(self) && mouseDown === true && selected === true) { |
|
|
|
|
if (BI.DOM.isExist(this) && mouseDown === true && selected === true) { |
|
|
|
|
clk(e); |
|
|
|
|
} |
|
|
|
|
mouseDown = false; |
|
|
|
|
selected = false; |
|
|
|
|
BI.Widget._renderEngine.createElement(document).unbind("mouseup." + self.getName()); |
|
|
|
|
Widget._renderEngine.createElement(document).unbind("mouseup." + this.getName()); |
|
|
|
|
// }
|
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
@ -181,22 +270,21 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
hand.dblclick(clk); |
|
|
|
|
break; |
|
|
|
|
case "lclick": |
|
|
|
|
var mouseDown = false; |
|
|
|
|
var interval; |
|
|
|
|
hand.mousedown(function (e) { |
|
|
|
|
BI.Widget._renderEngine.createElement(document).bind("mouseup." + self.getName(), function () { |
|
|
|
|
let interval; |
|
|
|
|
hand.mousedown((e) => { |
|
|
|
|
Widget._renderEngine.createElement(document).bind("mouseup." + this.getName(), () => { |
|
|
|
|
interval && clearInterval(interval); |
|
|
|
|
interval = null; |
|
|
|
|
mouseDown = false; |
|
|
|
|
BI.Widget._renderEngine.createElement(document).unbind("mouseup." + self.getName()); |
|
|
|
|
Widget._renderEngine.createElement(document).unbind("mouseup." + this.getName()); |
|
|
|
|
}); |
|
|
|
|
if (mouseDown === true) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!self.isEnabled() || !self.isValid()) { |
|
|
|
|
if (!this.isEnabled() || !this.isValid()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (self.isOnce() && self.isSelected()) { |
|
|
|
|
if (this.isOnce() && this.isSelected()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
interval = setInterval(function () { |
|
|
|
@ -224,7 +312,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 之后的300ms点击无效
|
|
|
|
|
var onClick = o.debounce ? BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, { |
|
|
|
|
let onClick = o.debounce ? BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, { |
|
|
|
|
"leading": true, |
|
|
|
|
"trailing": false, |
|
|
|
|
}) : this._doClick; |
|
|
|
@ -238,86 +326,13 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function clk(e) { |
|
|
|
|
ev(e); |
|
|
|
|
if (!self.isEnabled() || !self.isValid()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (self.isOnce() && self.isSelected()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (BI.isKey(o.bubble) || BI.isFunction(o.bubble)) { |
|
|
|
|
if (BI.isNull(self.combo)) { |
|
|
|
|
var popup; |
|
|
|
|
BI.createWidget({ |
|
|
|
|
type: "bi.absolute", |
|
|
|
|
element: self, |
|
|
|
|
items: [{ |
|
|
|
|
el: { |
|
|
|
|
type: "bi.bubble_combo", |
|
|
|
|
trigger: "", |
|
|
|
|
// bubble的提示不需要一直存在在界面上
|
|
|
|
|
destroyWhenHide: true, |
|
|
|
|
ref: function () { |
|
|
|
|
self.combo = this; |
|
|
|
|
}, |
|
|
|
|
el: { |
|
|
|
|
type: "bi.layout", |
|
|
|
|
height: "100%", |
|
|
|
|
}, |
|
|
|
|
popup: { |
|
|
|
|
type: "bi.text_bubble_bar_popup_view", |
|
|
|
|
text: getBubble(), |
|
|
|
|
ref: function () { |
|
|
|
|
popup = this; |
|
|
|
|
}, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, |
|
|
|
|
action: function (v) { |
|
|
|
|
self.combo.hideView(); |
|
|
|
|
if (v) { |
|
|
|
|
onClick.apply(self, arguments); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}], |
|
|
|
|
}, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW, |
|
|
|
|
action: function () { |
|
|
|
|
popup.populate(getBubble()); |
|
|
|
|
}, |
|
|
|
|
}], |
|
|
|
|
}, |
|
|
|
|
left: 0, |
|
|
|
|
right: 0, |
|
|
|
|
bottom: 0, |
|
|
|
|
top: 0, |
|
|
|
|
}], |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
if (self.combo.isViewVisible()) { |
|
|
|
|
self.combo.hideView(); |
|
|
|
|
} else { |
|
|
|
|
self.combo.showView(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
onClick.apply(self, arguments); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getBubble() { |
|
|
|
|
var bubble = self.options.bubble; |
|
|
|
|
if (BI.isFunction(bubble)) { |
|
|
|
|
return bubble(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return bubble; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_trigger: function (e) { |
|
|
|
|
var o = this.options; |
|
|
|
|
_trigger(e) { |
|
|
|
|
const o = this.options; |
|
|
|
|
if (!this.isEnabled()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -327,22 +342,22 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
this.setSelected(!this.isSelected())); |
|
|
|
|
} |
|
|
|
|
if (this.isValid()) { |
|
|
|
|
var v = this.getValue(); |
|
|
|
|
const v = this.getValue(); |
|
|
|
|
o.handler.call(this, v, this, e); |
|
|
|
|
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CLICK, v, this, e); |
|
|
|
|
this.fireEvent(BI.BasicButton.EVENT_CHANGE, v, this); |
|
|
|
|
this.fireEvent(Controller.EVENT_CHANGE, BI.Events.CLICK, v, this, e); |
|
|
|
|
this.fireEvent(BasicButton.EVENT_CHANGE, v, this); |
|
|
|
|
if (o.action) { |
|
|
|
|
BI.Actions.runAction(o.action, "click", o, this); |
|
|
|
|
} |
|
|
|
|
BI.Actions.runGlobalAction("click", o, this); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_doClick: function (e) { |
|
|
|
|
_doClick(e) { |
|
|
|
|
if (!this.isEnabled() || !this.isValid()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
var isIntercepted = this.beforeClick(e); |
|
|
|
|
const isIntercepted = this.beforeClick(e); |
|
|
|
|
// 如果事件已经被消费掉了,就不再触发点击事件
|
|
|
|
|
if (isIntercepted) { |
|
|
|
|
return; |
|
|
|
@ -352,41 +367,41 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
if (this.isEnabled() && this.isValid()) { |
|
|
|
|
this.doClick(e); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 子类可以得写这个方法,如果返回为 true,则可以阻止 handler 的触发 |
|
|
|
|
*/ |
|
|
|
|
beforeClick: function () { |
|
|
|
|
beforeClick() { |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
doClick: function () { |
|
|
|
|
doClick() { |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handle: function () { |
|
|
|
|
handle() { |
|
|
|
|
return this; |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hover: function () { |
|
|
|
|
hover() { |
|
|
|
|
this._hover = true; |
|
|
|
|
this.handle().element.addClass("hover"); |
|
|
|
|
if (this.options.shadow) { |
|
|
|
|
this.$mask && this.$mask.setVisible(true); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
dishover: function () { |
|
|
|
|
dishover() { |
|
|
|
|
this._hover = false; |
|
|
|
|
this.handle().element.removeClass("hover"); |
|
|
|
|
if (this.options.shadow) { |
|
|
|
|
this.$mask && this.$mask.setVisible(false); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setSelected: function (b) { |
|
|
|
|
var o = this.options; |
|
|
|
|
setSelected(b) { |
|
|
|
|
const o = this.options; |
|
|
|
|
o.selected = b; |
|
|
|
|
if (b) { |
|
|
|
|
this.handle().element.addClass("active"); |
|
|
|
@ -397,39 +412,39 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
this.$mask && this.$mask.setVisible(false); |
|
|
|
|
} |
|
|
|
|
this.options.setSelected && this.options.setSelected.call(this, b); |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isSelected: function () { |
|
|
|
|
isSelected() { |
|
|
|
|
return this.options.selected; |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isOnce: function () { |
|
|
|
|
isOnce() { |
|
|
|
|
return this.options.once; |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isForceSelected: function () { |
|
|
|
|
isForceSelected() { |
|
|
|
|
return this.options.forceSelected; |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isForceNotSelected: function () { |
|
|
|
|
isForceNotSelected() { |
|
|
|
|
return this.options.forceNotSelected; |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isDisableSelected: function () { |
|
|
|
|
isDisableSelected() { |
|
|
|
|
return this.options.disableSelected; |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setText: function (text) { |
|
|
|
|
setText(text) { |
|
|
|
|
this.options.text = text; |
|
|
|
|
this.options.setText && this.options.setText.call(this, text); |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getText: function () { |
|
|
|
|
getText() { |
|
|
|
|
return this.options.text; |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_setEnable: function (enable) { |
|
|
|
|
BI.BasicButton.superclass._setEnable.apply(this, arguments); |
|
|
|
|
_setEnable(enable) { |
|
|
|
|
super._setEnable.apply(this, arguments); |
|
|
|
|
if (enable === true) { |
|
|
|
|
this.element.removeClass("base-disabled disabled"); |
|
|
|
|
} else if (enable === false) { |
|
|
|
@ -440,12 +455,12 @@ BI.BasicButton = BI.inherit(BI.Single, {
|
|
|
|
|
this.$mask && this.$mask.setVisible(false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
empty() { |
|
|
|
|
Widget._renderEngine.createElement(document).unbind("mouseup." + this.getName()); |
|
|
|
|
super.empty.apply(this, arguments); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
empty: function () { |
|
|
|
|
BI.Widget._renderEngine.createElement(document).unbind("mouseup." + this.getName()); |
|
|
|
|
BI.BasicButton.superclass.empty.apply(this, arguments); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE"; |
|
|
|
|
BI.shortcut("bi.basic_button", BI.BasicButton); |
|
|
|
|