Sha256: 909d2668fe9659ca9e94fdc3327853db5c0665c36f6456269876137b57b212d7

Contents?: true

Size: 1001 Bytes

Versions: 2

Compression:

Stored size: 1001 Bytes

Contents

require 'glimmer/opal/element_proxy'

module Glimmer
  module Opal
    class TableColumn < ElementProxy
      include Glimmer
      attr_reader :text, :width      
      
      def text=(value)
        @text = value
        redraw
      end
    
      def width=(value)
        @width = value
        redraw
      end
      
      def css
        <<~CSS
          width: #{width};
        CSS
      end
    
      def name
        'th'
      end
      
      def observation_request_to_event_mapping
        {
          'on_widget_selected' => {
            event: 'click'
          },
        }
      end      
      
      def dom
        table_column_text = text
        table_column_id = id
        table_column_id_style = css
        table_column_css_classes = css_classes
        @dom ||= DOM {
          th(id: table_column_id, style: table_column_id_style, class: table_column_css_classes.to_a.join(' ')) {
            table_column_text
          }
        }
      end      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
glimmer-dsl-opal-0.0.9 lib/glimmer/opal/table_column.rb
glimmer-dsl-opal-0.0.8 lib/glimmer/opal/table_column.rb