mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-28 17:29:44 +00:00
fix: form input value type & default form & ui (#2802)
* fix: form input value type & default form & ui * variables form ui
This commit is contained in:
@@ -14,7 +14,10 @@ export const defaultFormInput: UserInputFormItemType = {
|
||||
type: FlowNodeInputTypeEnum.input,
|
||||
key: '',
|
||||
label: '',
|
||||
description: '',
|
||||
value: '',
|
||||
maxLength: undefined,
|
||||
defaultValue: '',
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
required: false
|
||||
};
|
||||
@@ -76,6 +79,10 @@ const InputFormEditModal = ({
|
||||
}
|
||||
];
|
||||
|
||||
const defaultValueType = inputTypeList
|
||||
.flat()
|
||||
.find((item) => item.value === inputType)?.defaultValueType;
|
||||
|
||||
const onSubmitSuccess = useCallback(
|
||||
(data: UserInputFormItemType, action: 'confirm' | 'continue') => {
|
||||
const isChangeKey = defaultValue.key !== data.key;
|
||||
@@ -90,6 +97,7 @@ const InputFormEditModal = ({
|
||||
}
|
||||
|
||||
data.key = data.label;
|
||||
data.valueType = defaultValueType;
|
||||
|
||||
if (action === 'confirm') {
|
||||
onSubmit(data);
|
||||
@@ -103,7 +111,7 @@ const InputFormEditModal = ({
|
||||
reset(defaultFormInput);
|
||||
}
|
||||
},
|
||||
[toast, t, reset, onSubmit, onClose, defaultFormInput]
|
||||
[toast, t, reset, onSubmit, onClose, defaultFormInput, defaultValueType]
|
||||
);
|
||||
|
||||
const onSubmitError = useCallback(
|
||||
@@ -192,6 +200,7 @@ const InputFormEditModal = ({
|
||||
onClose={onClose}
|
||||
onSubmitSuccess={onSubmitSuccess}
|
||||
onSubmitError={onSubmitError}
|
||||
valueType={defaultValueType}
|
||||
/>
|
||||
</Flex>
|
||||
</MyModal>
|
||||
|
@@ -145,7 +145,7 @@ const NodeFormInput = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
|
||||
)}
|
||||
</HStack>
|
||||
|
||||
<TableContainer>
|
||||
<TableContainer borderWidth={'1px'} borderRadius={'md'} borderBottom="none">
|
||||
<Table bg={'white'}>
|
||||
<Thead>
|
||||
<Tr>
|
||||
@@ -187,7 +187,6 @@ const NodeFormInput = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
|
||||
w={'16px'}
|
||||
color={'myGray.600'}
|
||||
cursor={'pointer'}
|
||||
ml={2}
|
||||
_hover={{ color: 'red.500' }}
|
||||
onClick={() => {
|
||||
onDelete(item.key);
|
||||
|
@@ -149,7 +149,7 @@ const InputTypeConfig = ({
|
||||
</Flex>
|
||||
|
||||
{/* value type */}
|
||||
{valueType && (
|
||||
{type === 'plugin' && (
|
||||
<Flex alignItems={'center'}>
|
||||
<FormLabel flex={'0 0 100px'} fontWeight={'medium'}>
|
||||
{t('common:core.module.Data Type')}
|
||||
|
Reference in New Issue
Block a user