Sha256: e8997525ad27b6a287b6fa887e74488b1710c56e1d8f375e22ef7c6295c6f545

Contents?: true

Size: 1.14 KB

Versions: 57

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 '../../components/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

57 entries across 57 versions & 1 rubygems

Version Path
katello-4.3.1 webpack/components/MultiSelect/index.js
katello-4.4.0.rc1 webpack/components/MultiSelect/index.js
katello-4.2.2 webpack/components/MultiSelect/index.js
katello-4.3.0 webpack/components/MultiSelect/index.js
katello-4.3.0.rc4 webpack/components/MultiSelect/index.js
katello-4.3.0.rc3 webpack/components/MultiSelect/index.js
katello-4.3.0.rc2.1 webpack/components/MultiSelect/index.js
katello-4.3.0.rc2 webpack/components/MultiSelect/index.js
katello-4.3.0.rc1 webpack/components/MultiSelect/index.js
katello-4.2.1 webpack/components/MultiSelect/index.js
katello-4.2.0.1 webpack/components/MultiSelect/index.js
katello-4.1.4 webpack/components/MultiSelect/index.js
katello-4.0.3 webpack/components/MultiSelect/index.js
katello-4.2.0.1.rc3 webpack/components/MultiSelect/index.js
katello-3.18.5 webpack/components/MultiSelect/index.js
katello-4.2.0.1.rc2 webpack/components/MultiSelect/index.js
katello-4.2.0.rc2 webpack/components/MultiSelect/index.js
katello-4.1.3 webpack/components/MultiSelect/index.js
katello-4.2.0.rc1 webpack/components/MultiSelect/index.js
katello-4.0.2.1 webpack/components/MultiSelect/index.js