1
0
mirror of synced 2026-02-04 18:47:57 +08:00

fix(form): daterange默认值

This commit is contained in:
roymondchen
2026-01-07 18:33:13 +08:00
parent cfaaaad66e
commit 5f57d620da

View File

@@ -43,6 +43,7 @@ interface DefaultItem {
type: string; type: string;
filter: string; filter: string;
multiple: boolean; multiple: boolean;
names?: string[];
} }
const isTableSelect = (type?: string | TypeFunction) => const isTableSelect = (type?: string | TypeFunction) =>
@@ -174,7 +175,10 @@ export const createValues = function (
return value; 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') { if (typeof defaultValue === 'function') {
return defaultValue(mForm); return defaultValue(mForm);
} }
@@ -200,6 +204,10 @@ const getDefaultValue = function (mForm: FormState | undefined, { defaultValue,
return []; return [];
} }
if (type === 'daterange' && !names) {
return [];
}
return ''; return '';
}; };