[all] fix bug 50356
This commit is contained in:
parent
29a065c3bd
commit
bd7fb9a4f0
|
@ -71,8 +71,13 @@ define([
|
||||||
disabled : false,
|
disabled : false,
|
||||||
rendered : false,
|
rendered : false,
|
||||||
|
|
||||||
template : _.template('<label class="radiobox" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>"><input type="radio" name="<%= name %>" id="<%= id %>" class="button__radiobox">' +
|
template : _.template('<div class="radiobox" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>">' +
|
||||||
'<label for="<%= id %>" class="radiobox__shape"></label><span></span></label>'),
|
'<input type="radio" name="<%= name %>" id="<%= id %>" class="button__radiobox">' +
|
||||||
|
'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">' +
|
||||||
|
'<circle class="rb-circle" cx="8" cy="8" r="6.5" />' +
|
||||||
|
'<circle class="rb-check-mark" cx="8" cy="8" r="4" />' +
|
||||||
|
'</svg>' +
|
||||||
|
'<span></span></div>'),
|
||||||
|
|
||||||
initialize : function(options) {
|
initialize : function(options) {
|
||||||
Common.UI.BaseView.prototype.initialize.call(this, options);
|
Common.UI.BaseView.prototype.initialize.call(this, options);
|
||||||
|
@ -111,9 +116,14 @@ define([
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.$radio = el.find('input[type=radio]');
|
this.$radio = el.find('input[type=radio]');
|
||||||
this.$label = el.find('label.radiobox');
|
this.$label = el.find('div.radiobox');
|
||||||
this.$span = this.$label.find('span');
|
this.$span = this.$label.find('span');
|
||||||
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.setValue(true);
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
this.rendered = true;
|
this.rendered = true;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
@ -153,10 +163,12 @@ define([
|
||||||
|
|
||||||
setValue: function(value, suspendchange) {
|
setValue: function(value, suspendchange) {
|
||||||
if (this.rendered) {
|
if (this.rendered) {
|
||||||
var lastValue = this.$radio.hasClass('checked');
|
if ( !this.disabled ) {
|
||||||
this.setRawValue(value);
|
var lastValue = this.$radio.hasClass('checked');
|
||||||
if (suspendchange !== true && lastValue !== value)
|
this.setRawValue(value);
|
||||||
this.trigger('change', this, this.$radio.is(':checked'));
|
if (suspendchange !== true && lastValue !== value)
|
||||||
|
this.trigger('change', this, this.$radio.is(':checked'));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.options.checked = value;
|
this.options.checked = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,72 +1,52 @@
|
||||||
.radiobox {
|
.radiobox {
|
||||||
padding-left: 22px;
|
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
.font-size-normal();
|
.font-size-normal();
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 1em;
|
min-height: 1em;
|
||||||
|
|
||||||
input[type=radio] {
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
margin-right: 8px;
|
||||||
|
.rb-circle {
|
||||||
|
fill: @background-normal;
|
||||||
|
stroke: @border-regular-control;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rb-check-mark {
|
||||||
|
fill: @text-normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=radio] {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
+ label {
|
&:not(:checked) + svg {
|
||||||
position: absolute;
|
.rb-check-mark {
|
||||||
left: 0;
|
display: none;
|
||||||
margin-top: auto;
|
|
||||||
padding-bottom: 4px;
|
|
||||||
width: 14px;
|
|
||||||
height: 14px;
|
|
||||||
|
|
||||||
background: @background-normal-ie;
|
|
||||||
background: @background-normal;
|
|
||||||
border: @scaled-one-px-value-ie solid @border-regular-control-ie;
|
|
||||||
border: @scaled-one-px-value solid @border-regular-control;
|
|
||||||
border-radius: 50%;
|
|
||||||
|
|
||||||
+ span {
|
|
||||||
outline: @scaled-one-px-value-ie dotted transparent;
|
|
||||||
outline: @scaled-one-px-value dotted transparent;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&:checked {
|
&.disabled, &:disabled {
|
||||||
+ label {
|
svg, span {
|
||||||
&::before {
|
opacity: @component-disabled-opacity;
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
background: @text-normal-ie;
|
|
||||||
background: @text-normal;
|
|
||||||
border-radius: 50%;
|
|
||||||
width: 8px;
|
|
||||||
height: 8px;
|
|
||||||
left: 2px;
|
|
||||||
top: 2px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.disabled, &:disabled {
|
|
||||||
|
|
||||||
+ label {
|
|
||||||
&::before {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:focus:not(.disabled) {
|
&:focus:not(.disabled) {
|
||||||
input[type=radio] {
|
svg {
|
||||||
+ label {
|
.rb-circle {
|
||||||
border-color: @border-control-focus-ie;
|
stroke: @border-control-focus-ie;
|
||||||
border-color: @border-control-focus;
|
stroke: @border-control-focus;
|
||||||
|
|
||||||
+ span {
|
|
||||||
outline-color: @border-control-focus-ie;
|
|
||||||
outline-color: @border-control-focus;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
outline: @scaled-one-px-value-ie dotted @border-control-focus-ie;
|
||||||
|
outline: @scaled-one-px-value dotted @border-control-focus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue