Class: HakumiComponents::Table::Configs::Expandable
- Inherits:
-
Object
- Object
- HakumiComponents::Table::Configs::Expandable
- Extended by:
- T::Sig
- Defined in:
- app/components/hakumi_components/table/configs.rb
Constant Summary collapse
- Input =
T.type_alias { T.nilable(InputHash) }
- RowRenderer =
T.type_alias { T.nilable(Proc) }
Instance Attribute Summary collapse
-
#expanded_row_keys ⇒ Object
readonly
Returns the value of attribute expanded_row_keys.
-
#expanded_row_render ⇒ Object
readonly
Returns the value of attribute expanded_row_render.
-
#show_expand_column ⇒ Object
readonly
Returns the value of attribute show_expand_column.
Class Method Summary collapse
Instance Method Summary collapse
- #expanded_row?(row_key) ⇒ Boolean
-
#initialize(show_expand_column:, expanded_row_keys:, expanded_row_render:) ⇒ Expandable
constructor
A new instance of Expandable.
Constructor Details
#initialize(show_expand_column:, expanded_row_keys:, expanded_row_render:) ⇒ Expandable
Returns a new instance of Expandable.
204 205 206 207 208 |
# File 'app/components/hakumi_components/table/configs.rb', line 204 def initialize(show_expand_column:, expanded_row_keys:, expanded_row_render:) @show_expand_column = T.let(, T::Boolean) @expanded_row_keys = T.let(, T::Array[String]) @expanded_row_render = T.let(, RowRenderer) end |
Instance Attribute Details
#expanded_row_keys ⇒ Object (readonly)
Returns the value of attribute expanded_row_keys.
214 215 216 |
# File 'app/components/hakumi_components/table/configs.rb', line 214 def @expanded_row_keys end |
#expanded_row_render ⇒ Object (readonly)
Returns the value of attribute expanded_row_render.
217 218 219 |
# File 'app/components/hakumi_components/table/configs.rb', line 217 def @expanded_row_render end |
#show_expand_column ⇒ Object (readonly)
Returns the value of attribute show_expand_column.
211 212 213 |
# File 'app/components/hakumi_components/table/configs.rb', line 211 def @show_expand_column end |
Class Method Details
.coerce(value) ⇒ Object
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'app/components/hakumi_components/table/configs.rb', line 225 def self.coerce(value) return nil unless value.is_a?(Hash) normalized = value.deep_symbolize_keys = Array( normalized[:expanded_row_keys] || normalized[:expandedRowKeys] || normalized[:default_expanded_row_keys] || normalized[:defaultExpandedRowKeys] ).map(&:to_s) = normalized[:expanded_row_render] = nil unless .is_a?(Proc) new( show_expand_column: normalized[:show_expand_column] != false, expanded_row_keys: , expanded_row_render: ) end |
Instance Method Details
#expanded_row?(row_key) ⇒ Boolean
220 221 222 |
# File 'app/components/hakumi_components/table/configs.rb', line 220 def (row_key) @expanded_row_keys.include?(row_key.to_s) end |