diff --git a/src/components/Form/src/hooks/useForm.ts b/src/components/Form/src/hooks/useForm.ts index 824364a9..3906c0d7 100644 --- a/src/components/Form/src/hooks/useForm.ts +++ b/src/components/Form/src/hooks/useForm.ts @@ -101,7 +101,7 @@ export function useForm(props?: Props): UseFormReturnType { return form.submit() }, - validate: async (nameList?: NamePath[] | false): Promise => { + validate: async (nameList?: NamePath[] | false): Promise => { const form = await getForm() return form.validate(nameList) }, diff --git a/src/components/Form/src/types/form.ts b/src/components/Form/src/types/form.ts index 484c4c9a..ecce760c 100644 --- a/src/components/Form/src/types/form.ts +++ b/src/components/Form/src/types/form.ts @@ -35,7 +35,7 @@ export interface FormActionType { removeSchemaByField: (field: string | string[]) => Promise appendSchemaByField: (schema: FormSchema | FormSchema[], prefixField: string | undefined, first?: boolean | undefined) => Promise validateFields: (nameList?: NamePath[]) => Promise - validate: (nameList?: NamePath[] | false) => Promise + validate: (nameList?: NamePath[] | false) => Promise scrollToField: (name: NamePath, options?: ScrollOptions) => Promise } diff --git a/src/components/FormDesign/src/components/VFormCreate/index.vue b/src/components/FormDesign/src/components/VFormCreate/index.vue index a87621d4..873843d1 100644 --- a/src/components/FormDesign/src/components/VFormCreate/index.vue +++ b/src/components/FormDesign/src/components/VFormCreate/index.vue @@ -47,16 +47,23 @@ export default defineComponent({ const noHiddenList = computed(() => { return ( props.formConfig.schemas - && props.formConfig.schemas.filter(item => item.hidden !== true) + && props.formConfig.schemas.filter(item => item.hidden !== true) ) }) const fApi = useVModel(props, 'fApi', emit) const { submit, validate, clearValidate, resetFields, validateField } - = useFormInstanceMethods(props, formModelNew, context, eFormModel) + = useFormInstanceMethods<['submit', 'change', 'update:fApi', 'update:formModel']>( + props, + formModelNew, + context, + eFormModel, + ) - const { linkOn, ...methods } = useVFormMethods( + const { linkOn, ...methods } = useVFormMethods< + ['submit', 'change', 'update:fApi', 'update:formModel'] + >( { formConfig: props.formConfig, formData: props.formModel } as unknown as IProps, context, eFormModel, @@ -122,21 +129,12 @@ export default defineComponent({ diff --git a/src/components/FormDesign/src/hooks/useFormInstanceMethods.ts b/src/components/FormDesign/src/hooks/useFormInstanceMethods.ts index 461b319d..bce8846f 100644 --- a/src/components/FormDesign/src/hooks/useFormInstanceMethods.ts +++ b/src/components/FormDesign/src/hooks/useFormInstanceMethods.ts @@ -1,14 +1,14 @@ -import type { Ref, SetupContext } from 'vue' +import type { EmitsOptions, Ref, SetupContext } from 'vue' import { getCurrentInstance, toRaw } from 'vue' import { cloneDeep, forOwn, isFunction } from 'lodash-es' import { Form } from 'ant-design-vue' import type { AForm, IVFormComponent } from '../typings/v-form-component' import type { IAnyObject } from '../typings/base-type' -export function useFormInstanceMethods( +export function useFormInstanceMethods( props: IAnyObject, formdata, - context: Partial, + context: SetupContext, _formInstance: Ref, ) { /** @@ -44,7 +44,7 @@ export function useFormInstanceMethods( const submit = async () => { // const _result = await validate(); - const data = cloneDeep(toRaw(formdata.value)) + const data = await cloneDeep(toRaw(formdata.value)) emit?.('submit', data) props.formConfig.submit?.(data) return data diff --git a/src/components/FormDesign/src/hooks/useVFormMethods.ts b/src/components/FormDesign/src/hooks/useVFormMethods.ts index 3044fb23..59b2d13f 100644 --- a/src/components/FormDesign/src/hooks/useVFormMethods.ts +++ b/src/components/FormDesign/src/hooks/useVFormMethods.ts @@ -1,4 +1,4 @@ -import type { Ref, SetupContext } from 'vue' +import type { EmitsOptions, Ref, SetupContext } from 'vue' import { cloneDeep, isFunction } from 'lodash-es' import type { AForm, IFormConfig, IVFormComponent } from '../typings/v-form-component' import { findFormItem, formItemsForEach } from '../utils' @@ -52,9 +52,9 @@ export interface IVFormMethods extends Partial { getData: IGetData disable: IDisable } -export function useVFormMethods( +export function useVFormMethods( props: IProps, - _context: Partial, + _context: SetupContext, formInstance: Ref, formInstanceMethods: Partial, ): IVFormMethods { diff --git a/src/components/Table/src/components/settings/SizeSetting.vue b/src/components/Table/src/components/settings/SizeSetting.vue index dbea267b..34825577 100644 --- a/src/components/Table/src/components/settings/SizeSetting.vue +++ b/src/components/Table/src/components/settings/SizeSetting.vue @@ -1,5 +1,6 @@ diff --git a/src/components/Tree/src/hooks/useTree.ts b/src/components/Tree/src/hooks/useTree.ts index 92085975..7aaa4f6d 100644 --- a/src/components/Tree/src/hooks/useTree.ts +++ b/src/components/Tree/src/hooks/useTree.ts @@ -65,7 +65,7 @@ export function useTree(treeDataRef: Ref, getFieldNames: Compute } // Update node - function updateNodeByKey(key: string, node: TreeDataItem, list?: TreeDataItem[]) { + function updateNodeByKey(key: string, node: Omit, list?: TreeDataItem[]) { if (!key) return const treeData = list || unref(treeDataRef) @@ -192,7 +192,7 @@ export function useTree(treeDataRef: Ref, getFieldNames: Compute const treeData = treeList || unref(treeDataRef) const { key: keyField, children: childrenField } = unref(getFieldNames) if (!keyField) - return + return null treeData.forEach((item) => { if (selectedNode?.key || selectedNode?.key === 0) return selectedNode diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 5788c60d..71206b69 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -15,6 +15,12 @@ declare global { // __APP__: App; // } + interface Document { + mozFullScreenElement?: Element + msFullscreenElement?: Element + webkitFullscreenElement?: Element + } + // vue declare type PropType = VuePropType declare type VueNode = VNodeChild | JSX.Element