|
|
|
@ -1,8 +1,9 @@ |
|
|
|
import { isArray, isFunction, isObject, isString } from '/@/utils/is'; |
|
|
|
import moment from 'moment'; |
|
|
|
import { unref } from 'vue'; |
|
|
|
import { unref, nextTick } from 'vue'; |
|
|
|
import type { Ref, ComputedRef } from 'vue'; |
|
|
|
import type { FieldMapToTime, FormSchema } from '../types/form'; |
|
|
|
import { useModalContext } from '/@/components/Modal'; |
|
|
|
|
|
|
|
interface UseFormValuesContext { |
|
|
|
transformDateFuncRef: Ref<Fn>; |
|
|
|
@ -18,6 +19,7 @@ export function useFormValues({ |
|
|
|
getSchema, |
|
|
|
formModel, |
|
|
|
}: UseFormValuesContext) { |
|
|
|
const modalFn = useModalContext(); |
|
|
|
// Processing form values
|
|
|
|
function handleFormValues(values: Recordable) { |
|
|
|
if (!isObject(values)) { |
|
|
|
@ -81,6 +83,10 @@ export function useFormValues({ |
|
|
|
} |
|
|
|
}); |
|
|
|
defaultValueRef.value = obj; |
|
|
|
nextTick(() => { |
|
|
|
// Solve the problem of modal adaptive height calculation when the form is placed in the modal
|
|
|
|
modalFn?.redoModalHeight?.(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
return { handleFormValues, initDefault }; |
|
|
|
|