Skip to content

Commit

Permalink
fix(element): update type of IFormDialog (#3360)
Browse files Browse the repository at this point in the history
1. 经检查下面的函数实现,IFormDialog中forConfirm、forCancel的参数middleware的类型IMiddleware泛型应为Form而不是IFormProps
2. 更正对应的文档,并参照antd/FormDialog优化,使文档中的类型定义更清晰。
  • Loading branch information
Zhhanou committed Aug 31, 2022
1 parent 936cfa0 commit 9233d5e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 12 additions & 3 deletions packages/element/docs/guide/form-dialog.md
Expand Up @@ -51,9 +51,18 @@ type IFormDialogProps = Omit<DialogProps, 'title'> & {
}

interface IFormDialog {
forOpen(middleware: IMiddleware<IFormProps>): IFormDialog
forConfirm(middleware: IMiddleware<IFormProps>): IFormDialog
forCancel(middleware: IMiddleware<IFormProps>): IFormDialog
forOpen(
middleware: (
props: IFormProps,
next: (props?: IFormProps) => Promise<any>
) => any
): IFormDialog
forConfirm(
middleware: (props: Form, next: (props?: Form) => Promise<any>) => any
): IFormDialog
forCancel(
middleware: (props: Form, next: (props?: Form) => Promise<any>) => any
): IFormDialog
open(props?: IFormProps): Promise<any>
close(): void
}
Expand Down
4 changes: 2 additions & 2 deletions packages/element/src/form-dialog/index.ts
Expand Up @@ -65,8 +65,8 @@ const getDialogProps = (props: any): IFormDialogProps => {

export interface IFormDialog {
forOpen(middleware: IMiddleware<IFormProps>): IFormDialog
forConfirm(middleware: IMiddleware<IFormProps>): IFormDialog
forCancel(middleware: IMiddleware<IFormProps>): IFormDialog
forConfirm(middleware: IMiddleware<Form>): IFormDialog
forCancel(middleware: IMiddleware<Form>): IFormDialog
open(props?: IFormProps): Promise<any>
close(): void
}
Expand Down

0 comments on commit 9233d5e

Please sign in to comment.