mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-05 05:29:01 +08:00
24 lines
772 B
Vue
24 lines
772 B
Vue
|
import type { ValidateStatus } from '../form/FormItem';
|
||
|
import classNames from './classNames';
|
||
|
|
||
|
const InputStatuses = ['warning', 'error', ''] as const;
|
||
|
|
||
|
export type InputStatus = (typeof InputStatuses)[number];
|
||
|
|
||
|
export function getStatusClassNames(
|
||
|
prefixCls: string,
|
||
|
status?: ValidateStatus,
|
||
|
hasFeedback?: boolean,
|
||
|
) {
|
||
|
return classNames({
|
||
|
[`${prefixCls}-status-success`]: status === 'success',
|
||
|
[`${prefixCls}-status-warning`]: status === 'warning',
|
||
|
[`${prefixCls}-status-error`]: status === 'error',
|
||
|
[`${prefixCls}-status-validating`]: status === 'validating',
|
||
|
[`${prefixCls}-has-feedback`]: hasFeedback,
|
||
|
});
|
||
|
}
|
||
|
|
||
|
export const getMergedStatus = (contextStatus?: ValidateStatus, customStatus?: InputStatus) =>
|
||
|
customStatus || contextStatus;
|