import React, { FunctionComponent } from 'react';
import { Cascader as AntdCascader } from 'antd';
import { IReactOptionsComponent } from '@wowpic/xform-types';

const Cascader: FunctionComponent<IReactOptionsComponent> = ({
    options,
    ...props
}) => {
    const tmp = options.map((item) => {
        const { value, ...other } = item;
        return {
            value: value.toString(),
            ...other
        };
    });
    const Component = AntdCascader as any;
    return (
        <Component options={tmp} {...props} />
    );
};

export default Cascader;
