Sha256: 8ec69d23b2637ff70a17ab4c880f2c877e12413558a0419c03fad06410734bd4

Contents?: true

Size: 1.33 KB

Versions: 10

Compression:

Stored size: 1.33 KB

Contents

module ForestAdminDatasourceToolkit
  module Components
    module Actions
      class ActionField
        attr_accessor :value, :watch_changes
        attr_reader :type, :label, :description, :is_required, :is_read_only, :enum_values, :collection_name, :widget,
                    :placeholder, :id

        def initialize(
          type:,
          label: nil,
          id: nil,
          description: nil,
          is_required: false,
          is_read_only: false,
          value: nil,
          enum_values: nil,
          collection_name: nil,
          watch_changes: false,
          placeholder: nil,
          **_kwargs
        )
          @type = type
          @label = label
          @id = id
          @description = description
          @is_required = is_required
          @is_read_only = is_read_only
          @value = value
          @enum_values = enum_values
          @collection_name = collection_name
          @watch_changes = watch_changes
          @widget = nil
          @placeholder = placeholder
        end

        def watch_changes?
          @watch_changes
        end

        def to_h
          result = {}
          instance_variables.each do |attribute|
            result[attribute.to_s.delete('@').to_sym] = instance_variable_get(attribute)
          end

          result
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
forest_admin_datasource_toolkit-1.0.0.pre.beta.81 lib/forest_admin_datasource_toolkit/components/actions/action_field.rb
forest_admin_datasource_toolkit-1.0.0.pre.beta.80 lib/forest_admin_datasource_toolkit/components/actions/action_field.rb
forest_admin_datasource_toolkit-1.0.0.pre.beta.79 lib/forest_admin_datasource_toolkit/components/actions/action_field.rb
forest_admin_datasource_toolkit-1.0.0.pre.beta.78 lib/forest_admin_datasource_toolkit/components/actions/action_field.rb
forest_admin_datasource_toolkit-1.0.0.pre.beta.77 lib/forest_admin_datasource_toolkit/components/actions/action_field.rb
forest_admin_datasource_toolkit-1.0.0.pre.beta.76 lib/forest_admin_datasource_toolkit/components/actions/action_field.rb
forest_admin_datasource_toolkit-1.0.0.pre.beta.75 lib/forest_admin_datasource_toolkit/components/actions/action_field.rb
forest_admin_datasource_toolkit-1.0.0.pre.beta.74 lib/forest_admin_datasource_toolkit/components/actions/action_field.rb
forest_admin_datasource_toolkit-1.0.0.pre.beta.73 lib/forest_admin_datasource_toolkit/components/actions/action_field.rb
forest_admin_datasource_toolkit-1.0.0.pre.beta.72 lib/forest_admin_datasource_toolkit/components/actions/action_field.rb