From e257455c9c06ee111378c67b78bf79a1aee6b43f Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 25 Jul 2025 16:59:09 +0800 Subject: [PATCH] feat: input filed form --- .../components/base/prompt-editor/index.tsx | 4 +- .../plugins/hitl-input-block/input-field.tsx | 62 +++++++++++++------ .../plugins/hitl-input-block/tag-label.tsx | 24 +++++++ .../plugins/hitl-input-block/test-page.tsx | 15 ----- 4 files changed, 70 insertions(+), 35 deletions(-) create mode 100644 web/app/components/base/prompt-editor/plugins/hitl-input-block/tag-label.tsx delete mode 100644 web/app/components/base/prompt-editor/plugins/hitl-input-block/test-page.tsx diff --git a/web/app/components/base/prompt-editor/index.tsx b/web/app/components/base/prompt-editor/index.tsx index a87a51cd50..6ad832b595 100644 --- a/web/app/components/base/prompt-editor/index.tsx +++ b/web/app/components/base/prompt-editor/index.tsx @@ -1,7 +1,7 @@ 'use client' import type { FC } from 'react' -import { useEffect } from 'react' +import React, { useEffect } from 'react' import type { EditorState, } from 'lexical' @@ -66,7 +66,7 @@ export type PromptEditorProps = { compact?: boolean wrapperClassName?: string className?: string - placeholder?: string | JSX.Element + placeholder?: string | React.JSX.Element placeholderClassName?: string style?: React.CSSProperties value?: string diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx index 972982cacb..d716fe5880 100644 --- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx +++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx @@ -1,29 +1,55 @@ import React from 'react' import Input from '@/app/components/base/input' -import Button from '@/app/components/base/button' -import Tooltip from '@/app/components/base/tooltip' -import { RiSendPlaneLine } from '@remixicon/react' +import PromptEditor from '@/app/components/base/prompt-editor' +import TagLabel from './tag-label' +import Button from '../../../button' +import { useTranslation } from 'react-i18next' +import { getKeyboardKeyNameBySystem } from '@/app/components/workflow/utils' const InputField: React.FC = () => { + const { t } = useTranslation() return ( -
- {/* Input Field */} -
+
+
Insert input field
+
+
+ Save response as* +
- - -
- - {/* Additional Info */} -

- Please provide the required information. -

+
+
+ Pre-populate field +
+ +
+ Add + + or + + users +
+
will see initially, or leave empty.
+
} + /> +
+
+ + +
) } diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/tag-label.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/tag-label.tsx new file mode 100644 index 0000000000..01c19155f4 --- /dev/null +++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/tag-label.tsx @@ -0,0 +1,24 @@ +'use client' +import { RiEditLine } from '@remixicon/react' +import type { FC } from 'react' +import React from 'react' +import { Variable02 } from '../../../icons/src/vender/solid/development' + +type Props = { + type: 'edit' | 'variable' + text: string +} + +const TagLabel: FC = ({ + type, + text, +}) => { + const Icon = type === 'edit' ? RiEditLine : Variable02 + return ( +
+ +
{text}
+
+ ) +} +export default React.memo(TagLabel) diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/test-page.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/test-page.tsx deleted file mode 100644 index 7fdcc935b3..0000000000 --- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/test-page.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react' -import InputField from './input-field' - -const TestPage: React.FC = () => { - return ( -
-
-

Test Input Field

- -
-
- ) -} - -export default TestPage