import { isString, map, uniq, flatten, filter, sortBy, keys } from 'lodash'; import React from 'react'; import PropTypes from 'prop-types'; import Select from 'antd/lib/select'; const MappingTypes = { x: { label: 'X Column' }, y: { label: 'Y Columns', multiple: true }, series: { label: 'Group by' }, yError: { label: 'Errors column' }, size: { label: 'Bubble size column' }, zVal: { label: 'Color Column' }, }; export default function ColumnMappingSelect({ value, availableColumns, type, onChange }) { const options = sortBy(filter( uniq(flatten([availableColumns, value])), v => isString(v) && (v !== ''), )); const { label, multiple } = MappingTypes[type]; return (