|
|
@ -1,11 +1,18 @@ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* guy |
|
|
|
* guy |
|
|
|
* @extends BI.Single |
|
|
|
* @extends Single |
|
|
|
* @type {*|void|Object} |
|
|
|
* @type {*|void|Object} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
BI.Checkbox = BI.inherit(BI.BasicButton, { |
|
|
|
import { shortcut } from "../../../../core"; |
|
|
|
|
|
|
|
import { BasicButton } from "../../button"; |
|
|
|
|
|
|
|
|
|
|
|
props: { |
|
|
|
@shortcut() |
|
|
|
|
|
|
|
export class Checkbox extends BasicButton { |
|
|
|
|
|
|
|
static xtype = "bi.checkbox"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
props = { |
|
|
|
baseCls: "bi-checkbox", |
|
|
|
baseCls: "bi-checkbox", |
|
|
|
selected: false, |
|
|
|
selected: false, |
|
|
|
handler: BI.emptyFn, |
|
|
|
handler: BI.emptyFn, |
|
|
@ -13,50 +20,47 @@ BI.Checkbox = BI.inherit(BI.BasicButton, { |
|
|
|
height: 14, |
|
|
|
height: 14, |
|
|
|
iconWidth: 14, |
|
|
|
iconWidth: 14, |
|
|
|
iconHeight: 14, |
|
|
|
iconHeight: 14, |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render: function () { |
|
|
|
render() { |
|
|
|
var self = this, o = this.options; |
|
|
|
const { iconWidth, iconHeight } = this.options; |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
type: "bi.center_adapt", |
|
|
|
type: "bi.center_adapt", |
|
|
|
items: [{ |
|
|
|
items: [{ |
|
|
|
type: "bi.default", |
|
|
|
type: "bi.default", |
|
|
|
ref: function (_ref) { |
|
|
|
ref: (_ref) => { |
|
|
|
self.checkbox = _ref; |
|
|
|
this.checkbox = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
|
cls: "checkbox-content", |
|
|
|
cls: "checkbox-content", |
|
|
|
width: o.iconWidth, |
|
|
|
width: iconWidth, |
|
|
|
height: o.iconHeight, |
|
|
|
height: iconHeight, |
|
|
|
}], |
|
|
|
}], |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_setEnable: function (enable) { |
|
|
|
_setEnable(enable) { |
|
|
|
BI.Checkbox.superclass._setEnable.apply(this, arguments); |
|
|
|
super._setEnable(enable); |
|
|
|
if (enable === true) { |
|
|
|
if (enable === true) { |
|
|
|
this.checkbox.element.removeClass("base-disabled disabled"); |
|
|
|
this.checkbox.element.removeClass("base-disabled disabled"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.checkbox.element.addClass("base-disabled disabled"); |
|
|
|
this.checkbox.element.addClass("base-disabled disabled"); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
doClick: function () { |
|
|
|
doClick() { |
|
|
|
BI.Checkbox.superclass.doClick.apply(this, arguments); |
|
|
|
super.doClick(arguments); |
|
|
|
if (this.isValid()) { |
|
|
|
if (this.isValid()) { |
|
|
|
this.fireEvent(BI.Checkbox.EVENT_CHANGE); |
|
|
|
this.fireEvent(Checkbox.EVENT_CHANGE); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setSelected: function (b) { |
|
|
|
setSelected(b) { |
|
|
|
BI.Checkbox.superclass.setSelected.apply(this, arguments); |
|
|
|
super.setSelected(b); |
|
|
|
if (b) { |
|
|
|
if (b) { |
|
|
|
this.checkbox.element.addClass("bi-high-light-background"); |
|
|
|
this.checkbox.element.addClass("bi-high-light-background"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.checkbox.element.removeClass("bi-high-light-background"); |
|
|
|
this.checkbox.element.removeClass("bi-high-light-background"); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
BI.Checkbox.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BI.shortcut("bi.checkbox", BI.Checkbox); |
|
|
|
|
|
|
|