Fix form type prompt (#6375)
* fix(FormITem): Change from ValidationRule to Rule * fix(FormI): from props typepull/6378/head
							parent
							
								
									e5e20cca5b
								
							
						
					
					
						commit
						d956eed086
					
				|  | @ -24,6 +24,7 @@ import type { | |||
|   Callbacks, | ||||
|   ValidateMessages, | ||||
|   Rule, | ||||
|   FormLabelAlign, | ||||
| } from './interface'; | ||||
| import { useInjectSize } from '../_util/hooks/useSize'; | ||||
| import useConfigInject from '../_util/hooks/useConfigInject'; | ||||
|  | @ -35,15 +36,12 @@ import { useInjectGlobalForm } from '../config-provider/context'; | |||
| export type RequiredMark = boolean | 'optional'; | ||||
| export type FormLayout = 'horizontal' | 'inline' | 'vertical'; | ||||
| 
 | ||||
| /** @deprecated Will warning in future branch. Pls use `Rule` instead. */ | ||||
| export type ValidationRule = Rule; | ||||
| 
 | ||||
| export const formProps = () => ({ | ||||
|   layout: PropTypes.oneOf(tuple('horizontal', 'inline', 'vertical')), | ||||
|   layout: PropTypes.oneOf(tuple('horizontal', 'inline', 'vertical') as FormLayout[]), | ||||
|   labelCol: { type: Object as PropType<ColProps & HTMLAttributes> }, | ||||
|   wrapperCol: { type: Object as PropType<ColProps & HTMLAttributes> }, | ||||
|   colon: { type: Boolean, default: undefined }, | ||||
|   labelAlign: PropTypes.oneOf(tuple('left', 'right')), | ||||
|   labelAlign: PropTypes.oneOf(tuple('left', 'right') as FormLabelAlign[]), | ||||
|   labelWrap: { type: Boolean, default: undefined }, | ||||
|   prefixCls: String, | ||||
|   requiredMark: { type: [String, Boolean] as PropType<RequiredMark | ''>, default: undefined }, | ||||
|  |  | |||
|  | @ -32,12 +32,11 @@ import useConfigInject from '../_util/hooks/useConfigInject'; | |||
| import { useInjectForm } from './context'; | ||||
| import FormItemLabel from './FormItemLabel'; | ||||
| import FormItemInput from './FormItemInput'; | ||||
| import type { ValidationRule } from './Form'; | ||||
| import { useProvideFormItemContext } from './FormItemContext'; | ||||
| import useDebounce from './utils/useDebounce'; | ||||
| 
 | ||||
| const ValidateStatuses = tuple('success', 'warning', 'error', 'validating', ''); | ||||
| export type ValidateStatus = typeof ValidateStatuses[number]; | ||||
| export type ValidateStatus = (typeof ValidateStatuses)[number]; | ||||
| 
 | ||||
| export interface FieldExpose { | ||||
|   fieldValue: Ref<any>; | ||||
|  | @ -46,7 +45,7 @@ export interface FieldExpose { | |||
|   resetField: () => void; | ||||
|   clearValidate: () => void; | ||||
|   namePath: ComputedRef<InternalNamePath>; | ||||
|   rules?: ComputedRef<ValidationRule[]>; | ||||
|   rules?: ComputedRef<Rule[]>; | ||||
|   validateRules: (options: ValidateOptions) => Promise<void> | Promise<RuleError[]>; | ||||
| } | ||||
| 
 | ||||
|  | @ -169,7 +168,7 @@ export default defineComponent({ | |||
|       validateTrigger = validateTrigger === undefined ? 'change' : validateTrigger; | ||||
|       return toArray(validateTrigger); | ||||
|     }); | ||||
|     const rulesRef = computed<ValidationRule[]>(() => { | ||||
|     const rulesRef = computed<Rule[]>(() => { | ||||
|       let formRules = formContext.rules.value; | ||||
|       const selfRules = props.rules; | ||||
|       const requiredRule = | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Cherry7
						Cherry7