From ef34139e9b34b971e8bfa530973063f18d4be249 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Fri, 1 Oct 2021 12:13:41 +0300 Subject: [PATCH] [all] refactoring for disabled state of radiobox --- apps/common/main/lib/component/RadioBox.js | 13 ++++++------- apps/common/main/resources/less/radiobox.less | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/common/main/lib/component/RadioBox.js b/apps/common/main/lib/component/RadioBox.js index 54e0d6253..e528a59f9 100644 --- a/apps/common/main/lib/component/RadioBox.js +++ b/apps/common/main/lib/component/RadioBox.js @@ -121,7 +121,8 @@ define([ this.$label.on('keydown', this.onKeyDown.bind(this)); this.$label.find('svg, span').on('click', function(e) { - this.setValue(true); + if ( !this.disabled ) + this.setValue(true); }.bind(this)); this.rendered = true; @@ -163,12 +164,10 @@ define([ setValue: function(value, suspendchange) { if (this.rendered) { - if ( !this.disabled ) { - var lastValue = this.$radio.hasClass('checked'); - this.setRawValue(value); - if (suspendchange !== true && lastValue !== value) - this.trigger('change', this, this.$radio.is(':checked')); - } + var lastValue = this.$radio.hasClass('checked'); + this.setRawValue(value); + if (suspendchange !== true && lastValue !== value) + this.trigger('change', this, this.$radio.is(':checked')); } else { this.options.checked = value; } diff --git a/apps/common/main/resources/less/radiobox.less b/apps/common/main/resources/less/radiobox.less index 5c876ef59..6aebe8c2f 100644 --- a/apps/common/main/resources/less/radiobox.less +++ b/apps/common/main/resources/less/radiobox.less @@ -33,6 +33,7 @@ &.disabled, &:disabled { svg, span { opacity: @component-disabled-opacity; + pointer-events: none; } }