From 5f57d620da58de85e7b38883c3e1ad0087a9760a Mon Sep 17 00:00:00 2001 From: roymondchen Date: Wed, 7 Jan 2026 18:33:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(form):=20daterange=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/form/src/utils/form.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/form/src/utils/form.ts b/packages/form/src/utils/form.ts index ba44ffb1..a4b69929 100644 --- a/packages/form/src/utils/form.ts +++ b/packages/form/src/utils/form.ts @@ -43,6 +43,7 @@ interface DefaultItem { type: string; filter: string; multiple: boolean; + names?: string[]; } const isTableSelect = (type?: string | TypeFunction) => @@ -174,7 +175,10 @@ export const createValues = function ( return value; }; -const getDefaultValue = function (mForm: FormState | undefined, { defaultValue, type, filter, multiple }: DefaultItem) { +const getDefaultValue = function ( + mForm: FormState | undefined, + { defaultValue, type, filter, multiple, names }: DefaultItem, +) { if (typeof defaultValue === 'function') { return defaultValue(mForm); } @@ -200,6 +204,10 @@ const getDefaultValue = function (mForm: FormState | undefined, { defaultValue, return []; } + if (type === 'daterange' && !names) { + return []; + } + return ''; };