Merge pull request #43 from YuanHeDx/fix/form-default-values

fix: typo & defaultValues func context missing
This commit is contained in:
xiamidaxia 2025-03-11 15:32:16 +08:00 committed by GitHub
commit e6268727b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -200,7 +200,7 @@ export class FormModelV2 extends FormModel implements Disposable {
// 计算初始值: defaultValues 是默认表单值不需要被format, 而rawInitialValues 是用户创建form 时传入的初始值可能不同于表单数据格式需要被format
const defaultValues =
typeof formMeta.defaultValues === 'function'
? formMeta.defaultValues()
? formMeta.defaultValues(this.nodeContext)
: formMeta.defaultValues;
const initialValues = formMeta.formatOnInit

View File

@ -95,7 +95,7 @@ export interface FormMeta<TValues = any> {
/**
* Form data's complete default value. it will not be sent to formatOnInit, but used directly as form's value when needed.
*/
defaultValues?: TValues | ((contest: NodeContext) => TValues);
defaultValues?: TValues | ((context: NodeContext) => TValues);
/**
* This function is to format the value when initiate the form, the returned value will be used as the initial value of the form.
* @param value value input to node as initialValue.