Skip to content

Commit

Permalink
fix(next): fix mapStatus takeState
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Aug 5, 2021
1 parent c1e5b0f commit 576c9b5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/next/src/__builtins__/mapStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ import { GeneralField } from '@formily/core'
export const mapStatus = (props: any, field: GeneralField) => {
const takeStatus = () => {
if (!field) return
if (field['loading'] || field?.['validating']) return 'loading'
if (field['loading'] || field['validating']) return 'loading'
if (field['invalid']) return 'error'
if (field['warnings']?.length) return 'warning'
return field.decoratorProps?.feedbackStatus
}
const takeState = (state: string) => {
if (state === 'validating' || state === 'pending') return 'loading'
return state
}
return {
...props,
state: props.state || takeStatus(),
state: takeState(props.state) || takeStatus(),
}
}

0 comments on commit 576c9b5

Please sign in to comment.