You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
768 B
24 lines
768 B
3 years ago
|
import classNames from 'classnames';
|
||
3 years ago
|
import type { ValidateStatus } from '../form/FormItem';
|
||
3 years ago
|
|
||
2 years ago
|
const InputStatuses = ['warning', 'error', ''] as const;
|
||
|
|
||
3 years ago
|
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,
|
||
|
});
|
||
|
}
|
||
3 years ago
|
|
||
|
export const getMergedStatus = (contextStatus?: ValidateStatus, customStatus?: InputStatus) =>
|
||
|
customStatus || contextStatus;
|