0 : value) &&
(mode === 'multiple'
? !selectValue?.every((num) =>
selectList.some((obj) => obj.key === num)
)
: !selectList?.some((item) => item?.key === value))) ||
(isError && !value)
? { alignItems: 'start', ...wrapStyle }
: wrapStyle
}
>
{title ? (
0 : value) &&
(mode === 'multiple'
? !selectValue?.every((num) =>
selectList.some((obj) => obj.key === num)
)
: !selectList?.some((item) => item?.key === value))) ||
(isError && !value)
? { marginRight: paddingSize ? '' : padding, marginTop: 5 }
: { marginRight: paddingSize ? '' : padding }
}
>
{title}
) : (
<>>
)}
0 : value) &&
(mode === 'multiple'
? !selectValue?.every((num) =>
selectList.some((obj) => obj.key === num)
)
: !selectList?.some((item) => item?.key === value))) ||
(isError && !value)
? {
flexDirection: 'column',
overflow: 'visible',
alignItems: 'start'
}
: {}
}
className={
size === 'normal'
? 'zl-large-screen-setting-unit-content'
: 'zl-large-screen-setting-unit-content-large'
}
>
{isError ? (
{isError &&
(mode === 'multiple' ? selectValue?.length > 0 : value) &&
(mode === 'multiple'
? !selectValue?.every((num) =>
selectList.some((obj) => obj.key === num)
)
: !selectList?.some((item) => item?.key === value))
? '字段失效请重新选择'
: isError && !value && isRequired
? '该字段是必填字段'
: ''}
) : (
<>>
)}
);
}, [selectList, value, title, allowClear, selectValue]);
return Redio;
}
export default LabelSelect;
export interface ILabelSelect {
title: string | number;
selectList: ISelectList[];
change: Function;
size: string;
value?: any;
paddingSize?: string;
selectLoading?: boolean;
suffixIcon?: any;
wrapStyle?: React.CSSProperties;
padding?: number;
customStyle?: React.CSSProperties;
dropdownMatchSelectWidth?: boolean;
placement?: string;
isError?: boolean;
placeholder?: string;
allowClear?: boolean;
clearIcon?: string;
mode?: string;
isRequired?: boolean;
}
export interface ISelectList {
key: number | string;
name: string | number;
type: string;
names?: string;
img?: string;
nameType?: string;
nameColor?: string;
}