From b158450d17748a5cb173387337f6bb8b2d774c01 Mon Sep 17 00:00:00 2001 From: rlx Date: Sun, 21 Jan 2018 09:23:18 +0100 Subject: [PATCH] Ox.Range: add 'disabled' option; Ox.Label: support changing 'disabled' option --- source/UI/js/Form/Label.js | 5 +++++ source/UI/js/Form/Range.js | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/source/UI/js/Form/Label.js b/source/UI/js/Form/Label.js index e4cc8023..f8e836ad 100644 --- a/source/UI/js/Form/Label.js +++ b/source/UI/js/Form/Label.js @@ -21,6 +21,11 @@ Ox.Label = function(options, self) { }) .options(options || {}) .update({ + disabled: function() { + that[ + self.options.disabled ? 'addClass' : 'removeClass' + ]('OxDisabled'); + }, title: function() { that.html(self.options.title); }, diff --git a/source/UI/js/Form/Range.js b/source/UI/js/Form/Range.js index e1f3e9ef..b59b9f97 100644 --- a/source/UI/js/Form/Range.js +++ b/source/UI/js/Form/Range.js @@ -36,6 +36,7 @@ Ox.Range = function(options, self) { arrowSymbols: ['left', 'right'], arrowTooltips: ['', ''], changeOnDrag: false, + disabled: false, max: 100, min: 0, orientation: 'horizontal', @@ -53,6 +54,7 @@ Ox.Range = function(options, self) { }) .options(options || {}) .update({ + disabled: setDisabled, max: setSizes, min: setSizes, step: setSizes, @@ -86,6 +88,7 @@ Ox.Range = function(options, self) { self.$arrows = []; Ox.range(0, 2).forEach(function(i) { self.$arrows[i] = Ox.Button({ + disabled: self.options.disabled, overlap: i == 0 ? 'right' : 'left', title: self.options.arrowSymbols[i], tooltip: self.options.arrowTooltips[i], @@ -149,6 +152,7 @@ Ox.Range = function(options, self) { } self.$thumb = Ox.Button({ + disabled: self.options.disabled, id: self.options.id + 'Thumb', width: self.thumbSize }) @@ -218,6 +222,14 @@ Ox.Range = function(options, self) { return self.hasValues ? self.options.values[value] : value; } + function setDisabled() { + if (self.options.arrows) { + self.$arrows[0].options({disabled: self.options.disabled}); + self.$arrows[1].options({disabled: self.options.disabled}); + } + self.$thumb.options({disabled: self.options.disabled}); + } + function setSizes() { self.values = ( self.options.max - self.options.min + self.options.step