mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +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:
@@ -215,9 +215,9 @@ const RenderUserFormInteractive = React.memo(function RenderFormInput({
|
||||
<Flex flexDirection={'column'} gap={2} w={'250px'}>
|
||||
{interactive.params.inputForm?.map((input) => (
|
||||
<Box key={input.label}>
|
||||
<Flex mb={1}>
|
||||
<Flex mb={1} alignItems={'center'}>
|
||||
<FormLabel required={input.required}>{input.label}</FormLabel>
|
||||
<QuestionTip ml={1} label={input.description} />
|
||||
{input.description && <QuestionTip ml={1} label={input.description} />}
|
||||
</Flex>
|
||||
{input.type === FlowNodeInputTypeEnum.input && (
|
||||
<Input
|
||||
@@ -247,6 +247,7 @@ const RenderUserFormInteractive = React.memo(function RenderFormInput({
|
||||
max={input.max}
|
||||
isDisabled={interactive.params.submitted}
|
||||
bg={'white'}
|
||||
rounded={'md'}
|
||||
>
|
||||
<NumberInputField
|
||||
bg={'white'}
|
||||
|
@@ -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