From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001 From: wwf <yearningwang@iqtogether.com> Date: 星期三, 04 六月 2025 15:17:49 +0800 Subject: [PATCH] 初始化 --- app/components/workflow/nodes/_base/components/variable/constant-field.tsx | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/components/workflow/nodes/_base/components/variable/constant-field.tsx b/app/components/workflow/nodes/_base/components/variable/constant-field.tsx index 52d2675..802e778 100644 --- a/app/components/workflow/nodes/_base/components/variable/constant-field.tsx +++ b/app/components/workflow/nodes/_base/components/variable/constant-field.tsx @@ -15,10 +15,8 @@ onChange: (value: string | number, varKindType: VarKindType, varInfo?: Var) => void } -const DEFAULT_SCHEMA = {} as CredentialFormSchema - const ConstantField: FC<Props> = ({ - schema = DEFAULT_SCHEMA, + schema = {} as CredentialFormSchema, readonly, value, onChange, @@ -26,7 +24,7 @@ const language = useLanguage() const placeholder = (schema as CredentialFormSchemaSelect).placeholder const handleStaticChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => { - const value = e.target.value === '' ? '' : Number.parseFloat(e.target.value) + const value = e.target.value === '' ? '' : parseFloat(e.target.value) onChange(value, VarKindType.constant) }, [onChange]) const handleSelectChange = useCallback((value: string | number) => { @@ -41,7 +39,6 @@ wrapperClassName='w-full !h-8' className='flex items-center' disabled={readonly} - defaultValue={value} items={(schema as CredentialFormSchemaSelect).options.map(option => ({ value: option.value, name: option.label[language] || option.label.en_US }))} onSelect={item => handleSelectChange(item.value)} placeholder={placeholder?.[language] || placeholder?.en_US} @@ -50,7 +47,7 @@ {schema.type === FormTypeEnum.textNumber && ( <input type='number' - className='h-8 w-full overflow-hidden rounded-lg bg-gray-100 p-2 text-[13px] font-normal leading-8 text-gray-900 placeholder:text-gray-400 focus:outline-none' + className='w-full h-8 leading-8 p-2 rounded-lg bg-gray-100 text-[13px] font-normal text-gray-900 placeholder:text-gray-400 focus:outline-none overflow-hidden' value={value} onChange={handleStaticChange} readOnly={readonly} -- Gitblit v1.8.0