[all] refactoring for disabled state of radiobox
This commit is contained in:
parent
bd7fb9a4f0
commit
ef34139e9b
|
@ -121,7 +121,8 @@ define([
|
||||||
this.$label.on('keydown', this.onKeyDown.bind(this));
|
this.$label.on('keydown', this.onKeyDown.bind(this));
|
||||||
|
|
||||||
this.$label.find('svg, span').on('click', function(e) {
|
this.$label.find('svg, span').on('click', function(e) {
|
||||||
this.setValue(true);
|
if ( !this.disabled )
|
||||||
|
this.setValue(true);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
this.rendered = true;
|
this.rendered = true;
|
||||||
|
@ -163,12 +164,10 @@ define([
|
||||||
|
|
||||||
setValue: function(value, suspendchange) {
|
setValue: function(value, suspendchange) {
|
||||||
if (this.rendered) {
|
if (this.rendered) {
|
||||||
if ( !this.disabled ) {
|
var lastValue = this.$radio.hasClass('checked');
|
||||||
var lastValue = this.$radio.hasClass('checked');
|
this.setRawValue(value);
|
||||||
this.setRawValue(value);
|
if (suspendchange !== true && lastValue !== value)
|
||||||
if (suspendchange !== true && lastValue !== value)
|
this.trigger('change', this, this.$radio.is(':checked'));
|
||||||
this.trigger('change', this, this.$radio.is(':checked'));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.options.checked = value;
|
this.options.checked = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
&.disabled, &:disabled {
|
&.disabled, &:disabled {
|
||||||
svg, span {
|
svg, span {
|
||||||
opacity: @component-disabled-opacity;
|
opacity: @component-disabled-opacity;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue