import React, { useMemo } from 'react'; import Wrap from '../wrap/Wrap'; import Icon from '../Icons/index'; import { Select } from 'antd'; import { CaretDownOutlined } from '@ant-design/icons'; import { returnClass } from '../unit'; import '../g.scss'; const { Option } = Select; function SelectBtn(props: ILabelSelect) { const { title, disabled, selectList = [], change, size = 'normal', value, paddingSize = 'small', selectLoading, suffixIcon, wrapStyle = { padding: '6px 20px 6px 20px' }, btnText, isEdit } = props; const returnOption = (rest: ISelectList, index: number) => { if (rest.type === 'one') { return ( ); } else { return ( ); } }; const Redio = useMemo(() => { return ( {title ? (
{title}
) : ( <> )}
{typeof selectList !== 'string' ? ( ) : (
{selectList}
)} {btnText ? ( change?.('selectBtn', btnText)} className={ disabled || isEdit ? 'select-btns select-btns-disabled' : 'select-btns' } > {btnText} ) : ( <> )}
); }, [selectList, value, title, disabled]); return Redio; } export default SelectBtn; export interface ILabelSelect { title: string | number; selectList: ISelectList[]; change: Function; size: string; value?: string | number; paddingSize?: string; selectLoading?: boolean; suffixIcon?: any; wrapStyle?: React.CSSProperties; btnText?: string; disabled?: boolean; isEdit?: boolean; } export interface ISelectList { key: number | string; name: string | number; type: string; names?: string; }