Sha256: 3456133024b76e89048da68c68617eaeca96e996fa4c164ba707f0e03e590d1d

Contents?: true

Size: 1.66 KB

Versions: 22

Compression:

Stored size: 1.66 KB

Contents

import React from 'react';
import CommonForm from 'foremanReact/components/common/forms/CommonForm';
import { InputGroup, Button } from 'patternfly-react';
import PropTypes from 'prop-types';

import FieldType from './FieldType';

const RenderField = ({
  input,
  label,
  className,
  inputClassName,
  fieldRequired,
  disabled,
  blank,
  item,
  fieldSelector,
  tooltipHelp,
  meta: { error, touched },
  buttonAttrs: { buttonText, buttonAction },
}) => (
  <CommonForm
    label={label}
    className={className}
    inputClassName={inputClassName}
    required={fieldRequired}
    error={error}
    touched={touched}
    tooltipHelp={tooltipHelp}
  >
    <InputGroup>
      <FieldType
        item={item}
        fieldSelector={fieldSelector}
        input={input}
        disabled={disabled}
        blank={blank}
      />
      <InputGroup.Button className="left-padded">
        <Button onClick={buttonAction} disabled={disabled}>
          {buttonText}
        </Button>
      </InputGroup.Button>
    </InputGroup>
  </CommonForm>
);

RenderField.propTypes = {
  input: PropTypes.object.isRequired,
  label: PropTypes.string.isRequired,
  className: PropTypes.string,
  inputClassName: PropTypes.string,
  fieldRequired: PropTypes.bool,
  disabled: PropTypes.bool.isRequired,
  blank: PropTypes.object,
  item: PropTypes.object.isRequired,
  fieldSelector: PropTypes.func,
  tooltipHelp: PropTypes.node,
  meta: PropTypes.object,
  buttonAttrs: PropTypes.object,
};

RenderField.defaultProps = {
  className: '',
  inputClassName: 'col-md-4',
  fieldRequired: false,
  blank: {},
  fieldSelector: null,
  tooltipHelp: null,
  meta: {},
  buttonAttrs: {},
};

export default RenderField;

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
foreman_templates-10.0.2 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-10.0.1 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-10.0.0 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.5.1 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.5.0 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.3.3 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.3.2 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.3.1 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.4.0 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.3.0 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.2.0 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.1.0 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.0.2 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.0.1 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-9.0.0 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-7.0.7 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-8.0.0 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-7.0.6 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-7.0.5 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js
foreman_templates-7.0.4 webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js