{"size": 3587, "ext": "js", "max_stars_repo_path": "app/components/component-formbuilder/src/components/config/Elements.js", "max_stars_repo_name": "Coko-Foundation/Kotahi", "max_stars_repo_stars_event_min_datetime": "2021-05-10T16:35:07.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T13:08:23.000Z", "max_issues_repo_path": "app/components/component-formbuilder/src/components/config/Elements.js", "max_issues_repo_name": "Coko-Foundation/Kotahi", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/components/component-formbuilder/src/components/config/Elements.js", "max_forks_repo_name": "Coko-Foundation/Kotahi", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 18.2081218274, "max_line_length": 78, "alphanum_fraction": 0.5536660162}
import config from 'config'

const extendComponents = (config['pubsweet-component-xpub-formbuilder'] || {})
  .components

const textfield = {
  component: 'TextField',
}

const orderfield = {
  component: 'TextField',
}

const optionfield = {
  component: 'OptionsField',
}

const editorfield = {
  component: 'AbstractField',
}

const textarea = {
  component: 'TextArea',
  props: {
    cols: 55,
    rows: 5,
  },
}

const validate = {
  component: 'Menu',
  props: {
    isMulti: true,
    isClearable: true,
    options: [
      {
        value: 'required',
        label: 'Required',
      },
      {
        value: 'minSize',
        label: 'minSize',
      },
      {
        value: 'minChars',
        label: 'minimum Characters',
      },
      {
        value: 'maxChars',
        label: 'maximum Characters',
      },
    ],
  },
}

const radiofield = {
  component: 'RadioBox',
  props: {
    inline: true,
    options: [
      {
        value: 'true',
        label: 'Yes',
      },
      {
        value: 'false',
        label: 'No',
      },
    ],
    label: 'Inline',
  },
}

const elements = {
  SupplementaryFiles: {
    id: textfield,
    title: textfield,
    name: textfield,
    description: editorfield,
    shortDescription: textfield,
    order: orderfield,
    validate,
  },
  VisualAbstract: {
    id: textfield,
    title: textfield,
    name: textfield,
    description: editorfield,
    shortDescription: textfield,
    order: orderfield,
    validate,
  },
  AuthorsInput: {
    id: textfield,
    title: textfield,
    name: textfield,
    order: orderfield,
    shortDescription: textfield,
    validate,
  },
  LinksInput: {
    id: textfield,
    title: textfield,
    name: textfield,
    order: orderfield,
    shortDescription: textfield,
    validate,
  },
  AbstractEditor: {
    id: textfield,
    title: textfield,
    name: textfield,
    placeholder: textfield,
    description: editorfield,
    order: orderfield,
    validate,
    shortDescription: textfield,
  },
  TextField: {
    id: textfield,
    title: textfield,
    name: textfield,
    placeholder: textfield,
    description: editorfield,
    shortDescription: textfield,
    order: orderfield,
    validate,
    parse: {
      component: 'Menu',
      props: {
        label: 'Split with Comma Seperate',
        options: [
          {
            value: 'false',
            label: 'None',
          },
          {
            value: 'split',
            label: 'Split',
          },
        ],
      },
    },
    format: {
      component: 'Menu',
      props: {
        label: 'Join with Comma',
        options: [
          {
            value: 'false',
            label: 'None',
          },
          {
            value: 'join',
            label: 'Join',
          },
        ],
      },
    },
  },
  CheckboxGroup: {
    id: textfield,
    title: textfield,
    name: textfield,
    description: editorfield,
    options: optionfield,
    order: orderfield,
    shortDescription: textfield,
    validate,
  },
  Select: {
    id: textfield,
    title: textfield,
    name: textfield,
    placeholder: textfield,
    description: editorfield,
    options: optionfield,
    order: orderfield,
    shortDescription: textfield,
    validate,
  },
  RadioGroup: {
    id: textfield,
    title: textfield,
    name: textfield,
    description: editorfield,
    options: optionfield,
    order: orderfield,
    inline: radiofield,
    sectioncss: textarea,
    shortDescription: textfield,
    validate,
  },
}

export default Object.assign(elements, extendComponents)
