summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorKoza <[email protected]>2022-07-11 10:17:27 +0200
committerStefan Daschek <[email protected]>2022-07-12 13:11:24 +0200
commite975a2451ae3c5f6eb62bfbfea33be3bb9f2cb14 (patch)
tree963e91ace302a893188d1e1a79d91958e5d11996 /lib
parentb9b59ab3e115cde48252fb7f7eec741c20a31ea4 (diff)
downloadcaxlsx-e975a2451ae3c5f6eb62bfbfea33be3bb9f2cb14.tar.gz
caxlsx-e975a2451ae3c5f6eb62bfbfea33be3bb9f2cb14.zip
Add `hideDropDown` alias for `showDropDown` setting, as the latter is confusing to use (because its logic seems inverted).
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/workbook/worksheet/data_validation.rb29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/axlsx/workbook/worksheet/data_validation.rb b/lib/axlsx/workbook/worksheet/data_validation.rb
index 835b5b33..71f9bbe6 100644
--- a/lib/axlsx/workbook/worksheet/data_validation.rb
+++ b/lib/axlsx/workbook/worksheet/data_validation.rb
@@ -13,11 +13,12 @@ module Axlsx
# @option options [Boolean] allowBlank - A boolean value indicating whether the data validation allows the use of empty or blank entries.
# @option options [String] error - Message text of error alert.
# @option options [Symbol] errorStyle - The style of error alert used for this data validation.
- # @option options [String] errorTitle - itle bar text of error alert.
+ # @option options [String] errorTitle - Title bar text of error alert.
# @option options [Symbol] operator - The relational operator used with this data validation.
# @option options [String] prompt - Message text of input prompt.
# @option options [String] promptTitle - Title bar text of input prompt.
- # @option options [Boolean] showDropDown - A boolean value indicating whether to display a dropdown combo box for a list type data validation
+ # @option options [Boolean] showDropDown - A boolean value indicating whether to display a dropdown combo box for a list type data validation. Be careful: It has an inverted logic, false shows the dropdown list! You should use hideDropDown instead.
+ # @option options [Boolean] hideDropDown - A boolean value indicating whether to hide the dropdown combo box for a list type data validation. Defaults to `false` (meaning the dropdown is visible by default).
# @option options [Boolean] showErrorMessage - A boolean value indicating whether to display the error alert message when an invalid value has been entered, according to the criteria specified.
# @option options [Boolean] showInputMessage - A boolean value indicating whether to display the input prompt message.
# @option options [String] sqref - Range over which data validation is applied, in "A1:B2" format.
@@ -121,13 +122,22 @@ module Axlsx
# Show drop down
# A boolean value indicating whether to display a dropdown combo box for a list type data
- # validation. Be careful: false shows the dropdown list!
+ # validation. Be careful: It has an inverted logic, false shows the dropdown list!
# Available for type list
# @see type
# @return [Boolean]
# default false
attr_reader :showDropDown
+ # Hide drop down
+ # A boolean value indicating whether to hide a dropdown combo box for a list type data
+ # validation. Defaults to `false` (meaning the dropdown is visible by default).
+ # Available for type list
+ # @see type
+ # @return [Boolean]
+ # default false
+ alias :hideDropDown :showDropDown
+
# Show error message
# A boolean value indicating whether to display the error alert message when an invalid
# value has been entered, according to the criteria specified.
@@ -195,7 +205,18 @@ module Axlsx
def promptTitle=(v); Axlsx::validate_string(v); @promptTitle = v end
# @see showDropDown
- def showDropDown=(v); Axlsx::validate_boolean(v); @showDropDown = v end
+ def showDropDown=(v)
+ warn 'The `showDropDown` has an inverted logic, false shows the dropdown list! You should use `hideDropDown` instead.'
+ Axlsx::validate_boolean(v)
+ @showDropDown = v
+ end
+
+ # @see hideDropDown
+ def hideDropDown=(v)
+ Axlsx::validate_boolean(v)
+ # It's just an alias for the showDropDown attribute, hideDropDown should set the value of the original showDropDown.
+ @showDropDown = v
+ end
# @see showErrorMessage
def showErrorMessage=(v); Axlsx::validate_boolean(v); @showErrorMessage = v end