|
|
|
|
@ -22,12 +22,13 @@ interface Options {
@@ -22,12 +22,13 @@ interface Options {
|
|
|
|
|
handleEdit?: (value) => Promise<void>; |
|
|
|
|
handleCancel?: () => Promise<void>; |
|
|
|
|
handleError?: (kind: "validation" | "internal", err?) => void; |
|
|
|
|
handleClose?: () => void; |
|
|
|
|
init?: any; |
|
|
|
|
extraProps?: string[] | "any" | ((code: string) => boolean); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function useModifyForm(options: Options) { |
|
|
|
|
const { formRef, handleAdd, handleEdit, handleCancel, init, extraProps } = options; |
|
|
|
|
const { formRef, handleAdd, handleEdit, handleCancel, handleClose, init, extraProps } = options; |
|
|
|
|
const initValue = init ?? {}; |
|
|
|
|
const props = options.props ?? []; |
|
|
|
|
const propMap = Object.fromEntries(props.map((prop) => [prop.code, prop])); |
|
|
|
|
@ -106,6 +107,7 @@ export function useModifyForm(options: Options) {
@@ -106,6 +107,7 @@ export function useModifyForm(options: Options) {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
close() { |
|
|
|
|
handleClose?.(); |
|
|
|
|
this.data.dialog = this.flagOnClose; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|