mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-28 05:39:34 +08:00
fix: some error
This commit is contained in:
@@ -4,8 +4,9 @@ import { isInSetup } from '/@/utils/helper/vueHelper';
|
||||
import { isProdMode } from '/@/utils/env';
|
||||
|
||||
import type { FormProps, FormActionType, UseFormReturnType, FormSchema } from '../types/form';
|
||||
import type { NamePath } from 'ant-design-vue/types/form/form-item';
|
||||
import type { ValidateFields } from 'ant-design-vue/types/form/form';
|
||||
import type { NamePath } from 'ant-design-vue/lib/form/interface';
|
||||
|
||||
export declare type ValidateFields = (nameList?: NamePath[]) => Promise<any>;
|
||||
|
||||
export function useForm(props?: Partial<FormProps>): UseFormReturnType {
|
||||
isInSetup();
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import type { ComputedRef, Ref } from 'vue';
|
||||
import type { FormProps, FormSchema } from '../types/form';
|
||||
import type { Form as FormType } from 'ant-design-vue/types/form/form';
|
||||
import type { NamePath } from 'ant-design-vue/types/form/form-item';
|
||||
import type { FormProps, FormSchema, FormActionType } from '../types/form';
|
||||
import type { NamePath } from 'ant-design-vue/lib/form/interface';
|
||||
|
||||
import { unref, toRaw } from 'vue';
|
||||
|
||||
@@ -17,7 +16,7 @@ interface UseFormActionContext {
|
||||
getSchema: ComputedRef<FormSchema[]>;
|
||||
formModel: any;
|
||||
defaultValueRef: Ref<any>;
|
||||
formElRef: Ref<FormType>;
|
||||
formElRef: Ref<FormActionType>;
|
||||
schemaRef: Ref<FormSchema[]>;
|
||||
handleFormValues: Fn;
|
||||
actionState: {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import type { Form, NamePath, ValidationRule } from 'ant-design-vue/types/form/form';
|
||||
import type { NamePath, RuleObject } from 'ant-design-vue/lib/form/interface';
|
||||
import type { VNode } from 'vue';
|
||||
import type { BasicButtonProps } from '/@/components/Button/types';
|
||||
import type { FormItem } from './formItem';
|
||||
@@ -17,7 +17,7 @@ export interface ButtonProps extends BasicButtonProps {
|
||||
text?: string;
|
||||
}
|
||||
|
||||
export interface FormActionType extends Form {
|
||||
export interface FormActionType {
|
||||
submit: () => Promise<void>;
|
||||
setFieldsValue: <T>(values: T) => void;
|
||||
resetFields: () => Promise<any>;
|
||||
@@ -29,6 +29,7 @@ export interface FormActionType extends Form {
|
||||
appendSchemaByField: (schema: FormSchema, prefixField?: string) => void;
|
||||
validateFields: (nameList?: NamePath[]) => Promise<any>;
|
||||
validate: (nameList?: NamePath[]) => Promise<any>;
|
||||
scrollToField: (name: NamePath, options?: ScrollOptions) => void;
|
||||
}
|
||||
export type RegisterFn = (formInstance: FormActionType) => void;
|
||||
|
||||
@@ -113,7 +114,7 @@ export interface FormSchema {
|
||||
componentProps?: any;
|
||||
|
||||
// 校验规则
|
||||
rules?: ValidationRule[];
|
||||
rules?: RuleObject[];
|
||||
// 校验信息是否加入label
|
||||
rulesMessageJoinLabel?: boolean;
|
||||
|
||||
@@ -150,7 +151,7 @@ export interface FormSchema {
|
||||
|
||||
dynamicDisabled?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean);
|
||||
|
||||
dynamicRules?: (renderCallbackParams: RenderCallbackParams) => ValidationRule[];
|
||||
dynamicRules?: (renderCallbackParams: RenderCallbackParams) => RuleObject[];
|
||||
}
|
||||
export interface HelpComponentProps {
|
||||
maxWidth: string;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import type { NamePath } from 'ant-design-vue/types/form/form-item';
|
||||
import type { Col } from 'ant-design-vue/types/grid/col';
|
||||
import type { NamePath } from 'ant-design-vue/lib/form/interface';
|
||||
import type { ColProps } from 'ant-design-vue/lib/grid/Col';
|
||||
import type { VNodeChild } from 'vue';
|
||||
|
||||
export interface FormItem {
|
||||
@@ -39,7 +39,7 @@ export interface FormItem {
|
||||
* The layout of label. You can set span offset to something like {span: 3, offset: 12} or sm: {span: 3, offset: 12} same as with <Col>
|
||||
* @type Col
|
||||
*/
|
||||
labelCol?: Col;
|
||||
labelCol?: ColProps;
|
||||
|
||||
/**
|
||||
* Whether provided or not, it will be generated by the validation rule.
|
||||
@@ -58,7 +58,7 @@ export interface FormItem {
|
||||
* The layout for input controls, same as labelCol
|
||||
* @type Col
|
||||
*/
|
||||
wrapperCol?: Col;
|
||||
wrapperCol?: ColProps;
|
||||
/**
|
||||
* Set sub label htmlFor.
|
||||
*/
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { ColSpanType } from 'ant-design-vue/types/grid/col';
|
||||
|
||||
type ColSpanType = number | string;
|
||||
export interface ColEx {
|
||||
style?: any;
|
||||
/**
|
||||
|
Reference in New Issue
Block a user