Class: Polaris::IndexTableComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/polaris/index_table_component.rb

Constant Summary

Constants included from ViewHelper

ViewHelper::POLARIS_HELPERS, ViewHelper::POLARIS_TEXT_STYLES

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Instance Method Summary collapse

Methods included from ViewHelper

#polaris_body_styles, #polaris_html_classes, #polaris_html_styles, #polaris_icon_source

Methods included from StylesListHelper

#styles_list

Methods included from OptionHelper

#append_option, #prepend_option

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #fetch_or_fallback_nested

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(data, **system_arguments) ⇒ IndexTableComponent

Returns a new instance of IndexTableComponent.



7
8
9
10
# File 'app/components/polaris/index_table_component.rb', line 7

def initialize(data, **system_arguments)
  @data = data
  @system_arguments = system_arguments
end

Instance Method Details

#render_cell(**arguments, &block) ⇒ Object



31
32
33
# File 'app/components/polaris/index_table_component.rb', line 31

def render_cell(**arguments, &block)
  render(IndexTable::CellComponent.new(**arguments), &block)
end

#row_arguments(row) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'app/components/polaris/index_table_component.rb', line 21

def row_arguments(row)
  {tag: "tr"}.tap do |args|
    args[:classes] = class_names(
      "Polaris-IndexTable__TableRow",
      "Polaris-IndexTable__TableRow--unclickable"
    )
    args[:id] = dom_id(row) if row.respond_to?(:to_key)
  end
end

#system_argumentsObject



12
13
14
15
16
17
18
19
# File 'app/components/polaris/index_table_component.rb', line 12

def system_arguments
  {tag: "div"}.deep_merge(@system_arguments).tap do |args|
    args[:classes] = class_names(
      args[:classes],
      "Polaris-IndexTable"
    )
  end
end