Sha256: 33f1fa95291bb3500393aec55aff40546147874cf8e01cc056d7becac47ca950

Contents?: true

Size: 1.14 KB

Versions: 60

Compression:

Stored size: 1.14 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { translate as __ } from 'foremanReact/common/I18n';
import { FormGroup, ControlLabel } from 'react-bootstrap';
import BootstrapSelect from '../../move_to_pf/react-bootstrap-select';

function MultiSelect(props) {
  const {
    options,
    onChange,
    defaultValues,
    ...otherProps
  } = props;

  const optionComponents = options.map(option => (
    <option key={`option-${option.value}`} value={option.value}>
      {option.label}
    </option>
  ));

  return (
    <FormGroup controlId="formControlsSelectMultiple">
      <ControlLabel srOnly>{__('Select Value')}</ControlLabel>
      <BootstrapSelect
        defaultValues={defaultValues}
        {...otherProps}
        multiple
        onChange={evt => onChange(evt)}
      >
        {optionComponents}
      </BootstrapSelect>
    </FormGroup>
  );
}

MultiSelect.defaultProps = {
  onChange: () => {},
  defaultValues: null,
};

MultiSelect.propTypes = {
  options: PropTypes.arrayOf(PropTypes.object).isRequired,
  onChange: PropTypes.func,
  defaultValues: PropTypes.arrayOf(PropTypes.string),
};

export default MultiSelect;

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
katello-3.16.2 webpack/components/MultiSelect/index.js
katello-3.16.1.2 webpack/components/MultiSelect/index.js
katello-3.16.1.1 webpack/components/MultiSelect/index.js
katello-3.16.1 webpack/components/MultiSelect/index.js
katello-3.16.0 webpack/components/MultiSelect/index.js
katello-3.16.0.rc5.1 webpack/components/MultiSelect/index.js
katello-3.16.0.rc5 webpack/components/MultiSelect/index.js
katello-3.16.0.rc4.1 webpack/components/MultiSelect/index.js
katello-3.15.3.1 webpack/components/MultiSelect/index.js
katello-3.15.3 webpack/components/MultiSelect/index.js
katello-3.16.0.rc4 webpack/components/MultiSelect/index.js
katello-3.16.0.rc3.1 webpack/components/MultiSelect/index.js
katello-3.15.2 webpack/components/MultiSelect/index.js
katello-3.16.0.rc3 webpack/components/MultiSelect/index.js
katello-3.16.0.rc2.1 webpack/components/MultiSelect/index.js
katello-3.16.0.rc2 webpack/components/MultiSelect/index.js
katello-3.15.1.1 webpack/components/MultiSelect/index.js
katello-3.16.0.rc1.1 webpack/components/MultiSelect/index.js
katello-3.15.1 webpack/components/MultiSelect/index.js
katello-3.16.0.rc1 webpack/components/MultiSelect/index.js