chore: jsx to react.jsx

This commit is contained in:
Joel 2025-03-19 16:09:42 +08:00
parent 7a6eba70bf
commit 30ede50d74
40 changed files with 480 additions and 247 deletions

View File

@ -6,15 +6,15 @@ import useSWR from 'swr'
import Input from '@/app/components/base/input' import Input from '@/app/components/base/input'
import { fetchAnnotationsCount } from '@/service/log' import { fetchAnnotationsCount } from '@/service/log'
export interface QueryParam { export type QueryParam = {
keyword?: string keyword?: string
} }
interface IFilterProps { type IFilterProps = {
appId: string appId: string
queryParams: QueryParam queryParams: QueryParam
setQueryParams: (v: QueryParam) => void setQueryParams: (v: QueryParam) => void
children: JSX.Element children: React.JSX.Element
} }
const Filter: FC<IFilterProps> = ({ const Filter: FC<IFilterProps> = ({

View File

@ -9,8 +9,8 @@ type Props = {
height: number height: number
minHeight: number minHeight: number
onHeightChange: (height: number) => void onHeightChange: (height: number) => void
children: JSX.Element children: React.JSX.Element
footer?: JSX.Element footer?: React.JSX.Element
hideResize?: boolean hideResize?: boolean
} }

View File

@ -3,10 +3,10 @@ import type { FC } from 'react'
import React from 'react' import React from 'react'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
interface Props { type Props = {
className?: string className?: string
title: string title: string
children: JSX.Element children: React.JSX.Element
} }
const Field: FC<Props> = ({ const Field: FC<Props> = ({

View File

@ -5,10 +5,10 @@ import cn from '@/utils/classnames'
import Tooltip from '@/app/components/base/tooltip' import Tooltip from '@/app/components/base/tooltip'
type Props = { type Props = {
className?: string className?: string
icon: JSX.Element icon: React.JSX.Element
name: string name: string
description: string description: string
children: JSX.Element children: React.JSX.Element
} }
const ItemPanel: FC<Props> = ({ const ItemPanel: FC<Props> = ({

View File

@ -279,7 +279,7 @@ const CreateAppModal = ({ show, onClose, onSuccess, onCreateFromTemplate }: Crea
export default CreateAppModal export default CreateAppModal
type AppTypeCardProps = { type AppTypeCardProps = {
icon: JSX.Element icon: React.JSX.Element
beta?: boolean beta?: boolean
title: string title: string
description: string description: string

View File

@ -14,10 +14,10 @@ type Props = {
contentClassName?: string contentClassName?: string
headerClassName?: string headerClassName?: string
height?: number | string height?: number | string
title: string | JSX.Element title: string | React.JSX.Element
titleDescription?: string | JSX.Element titleDescription?: string | React.JSX.Element
body: JSX.Element body: React.JSX.Element
foot?: JSX.Element foot?: React.JSX.Element
isShowMask?: boolean isShowMask?: boolean
clickOutsideNotOpen?: boolean clickOutsideNotOpen?: boolean
positionCenter?: boolean positionCenter?: boolean

View File

@ -11,7 +11,7 @@ import {
export type Item = { export type Item = {
value: string | number value: string | number
text: string | JSX.Element text: string | React.JSX.Element
} }
type DropdownProps = { type DropdownProps = {
items: Item[] items: Item[]

View File

@ -3,7 +3,7 @@ import type { FC } from 'react'
import React from 'react' import React from 'react'
import Tooltip from '@/app/components/base/tooltip' import Tooltip from '@/app/components/base/tooltip'
export const Item: FC<{ title: string; tooltip: string; children: JSX.Element }> = ({ export const Item: FC<{ title: string; tooltip: string; children: React.JSX.Element }> = ({
title, title,
tooltip, tooltip,
children, children,

View File

@ -23,7 +23,7 @@ import { TransferMethod } from '@/types/app'
type Option = { type Option = {
value: string value: string
label: string label: string
icon: JSX.Element icon: React.JSX.Element
} }
type FileUploaderInAttachmentProps = { type FileUploaderInAttachmentProps = {
fileConfig: FileUpload fileConfig: FileUpload

View File

@ -5,7 +5,7 @@ import type { ImageFile } from '@/types/app'
import { ALLOW_FILE_EXTENSIONS } from '@/types/app' import { ALLOW_FILE_EXTENSIONS } from '@/types/app'
type UploaderProps = { type UploaderProps = {
children: (hovering: boolean) => JSX.Element children: (hovering: boolean) => React.JSX.Element
onUpload: (imageFile: ImageFile) => void onUpload: (imageFile: ImageFile) => void
closePopover?: () => void closePopover?: () => void
limit?: number limit?: number

View File

@ -19,7 +19,7 @@ export class PickerBlockMenuOption extends MenuOption {
key: string key: string
group?: string group?: string
onSelect?: () => void onSelect?: () => void
render: (menuRenderProps: MenuOptionRenderProps) => JSX.Element render: (menuRenderProps: MenuOptionRenderProps) => React.JSX.Element
}, },
) { ) {
super(data.key) super(data.key)

View File

@ -1,7 +1,7 @@
import { memo } from 'react' import { memo } from 'react'
type PromptMenuItemMenuItemProps = { type PromptMenuItemMenuItemProps = {
icon: JSX.Element icon: React.JSX.Element
title: string title: string
disabled?: boolean disabled?: boolean
isSelected: boolean isSelected: boolean

View File

@ -2,8 +2,8 @@ import { memo } from 'react'
type VariableMenuItemProps = { type VariableMenuItemProps = {
title: string title: string
icon?: JSX.Element icon?: React.JSX.Element
extraElement?: JSX.Element extraElement?: React.JSX.Element
isSelected: boolean isSelected: boolean
queryString: string | null queryString: string | null
onClick: () => void onClick: () => void

View File

@ -5,7 +5,7 @@ import type { Dataset } from './index'
export type SerializedNode = SerializedLexicalNode & { datasets: Dataset[]; onAddContext: () => void; canNotAddContext: boolean } export type SerializedNode = SerializedLexicalNode & { datasets: Dataset[]; onAddContext: () => void; canNotAddContext: boolean }
export class ContextBlockNode extends DecoratorNode<JSX.Element> { export class ContextBlockNode extends DecoratorNode<React.JSX.Element> {
__datasets: Dataset[] __datasets: Dataset[]
__onAddContext: () => void __onAddContext: () => void
__canNotAddContext: boolean __canNotAddContext: boolean
@ -40,7 +40,7 @@ export class ContextBlockNode extends DecoratorNode<JSX.Element> {
return false return false
} }
decorate(): JSX.Element { decorate(): React.JSX.Element {
return ( return (
<ContextBlockComponent <ContextBlockComponent
nodeKey={this.getKey()} nodeKey={this.getKey()}

View File

@ -5,7 +5,7 @@ import type { RoleName } from './index'
export type SerializedNode = SerializedLexicalNode & { roleName: RoleName; onEditRole: () => void } export type SerializedNode = SerializedLexicalNode & { roleName: RoleName; onEditRole: () => void }
export class HistoryBlockNode extends DecoratorNode<JSX.Element> { export class HistoryBlockNode extends DecoratorNode<React.JSX.Element> {
__roleName: RoleName __roleName: RoleName
__onEditRole: () => void __onEditRole: () => void
@ -38,7 +38,7 @@ export class HistoryBlockNode extends DecoratorNode<JSX.Element> {
return false return false
} }
decorate(): JSX.Element { decorate(): React.JSX.Element {
return ( return (
<HistoryBlockComponent <HistoryBlockComponent
nodeKey={this.getKey()} nodeKey={this.getKey()}

View File

@ -4,7 +4,7 @@ import QueryBlockComponent from './component'
export type SerializedNode = SerializedLexicalNode export type SerializedNode = SerializedLexicalNode
export class QueryBlockNode extends DecoratorNode<JSX.Element> { export class QueryBlockNode extends DecoratorNode<React.JSX.Element> {
static getType(): string { static getType(): string {
return 'query-block' return 'query-block'
} }
@ -27,7 +27,7 @@ export class QueryBlockNode extends DecoratorNode<JSX.Element> {
return false return false
} }
decorate(): JSX.Element { decorate(): React.JSX.Element {
return <QueryBlockComponent nodeKey={this.getKey()} /> return <QueryBlockComponent nodeKey={this.getKey()} />
} }

View File

@ -9,7 +9,7 @@ export type SerializedNode = SerializedLexicalNode & {
workflowNodesMap: WorkflowNodesMap workflowNodesMap: WorkflowNodesMap
} }
export class WorkflowVariableBlockNode extends DecoratorNode<JSX.Element> { export class WorkflowVariableBlockNode extends DecoratorNode<React.JSX.Element> {
__variables: string[] __variables: string[]
__workflowNodesMap: WorkflowNodesMap __workflowNodesMap: WorkflowNodesMap
@ -42,7 +42,7 @@ export class WorkflowVariableBlockNode extends DecoratorNode<JSX.Element> {
return false return false
} }
decorate(): JSX.Element { decorate(): React.JSX.Element {
return ( return (
<WorkflowVariableBlockComponent <WorkflowVariableBlockComponent
nodeKey={this.getKey()} nodeKey={this.getKey()}

View File

@ -6,12 +6,12 @@ import cn from '@/utils/classnames'
type Props = { type Props = {
className?: string className?: string
title: string | JSX.Element | null title: string | React.JSX.Element | null
description: string description: string
isChosen: boolean isChosen: boolean
onChosen: () => void onChosen: () => void
chosenConfig?: React.ReactNode chosenConfig?: React.ReactNode
icon?: JSX.Element icon?: React.JSX.Element
extra?: React.ReactNode extra?: React.ReactNode
} }

View File

@ -10,7 +10,7 @@ export type TRadioGroupProps = {
onChange?: (value: any) => void onChange?: (value: any) => void
} }
export default function Group({ children, value, onChange, className = '' }: TRadioGroupProps): JSX.Element { export default function Group({ children, value, onChange, className = '' }: TRadioGroupProps): React.JSX.Element {
const onRadioChange = (value: any) => { const onRadioChange = (value: any) => {
onChange?.(value) onChange?.(value)
} }

View File

@ -23,7 +23,7 @@ export default function Radio({
value, value,
disabled, disabled,
onChange, onChange,
}: IRadioProps): JSX.Element { }: IRadioProps): React.JSX.Element {
const groupContext = useContext(RadioGroupContext) const groupContext = useContext(RadioGroupContext)
const labelId = useId() const labelId = useId()
const handleChange = (e: IRadioProps['value']) => { const handleChange = (e: IRadioProps['value']) => {

View File

@ -31,7 +31,7 @@ export type Item = {
export type ISelectProps = { export type ISelectProps = {
className?: string className?: string
wrapperClassName?: string wrapperClassName?: string
renderTrigger?: (value: Item | null) => JSX.Element | null renderTrigger?: (value: Item | null) => React.JSX.Element | null
items?: Item[] items?: Item[]
defaultValue?: number | string defaultValue?: number | string
disabled?: boolean disabled?: boolean
@ -292,7 +292,7 @@ type PortalSelectProps = {
items: Item[] items: Item[]
placeholder?: string placeholder?: string
installedValue?: string | number installedValue?: string | number
renderTrigger?: (value?: Item) => JSX.Element | null renderTrigger?: (value?: Item) => React.JSX.Element | null
triggerClassName?: string triggerClassName?: string
triggerClassNameFn?: (open: boolean) => string triggerClassNameFn?: (open: boolean) => string
popupClassName?: string popupClassName?: string

View File

@ -5,7 +5,7 @@ import cn from '@/utils/classnames'
type Option = { type Option = {
value: string value: string
text: string | JSX.Element text: string | React.JSX.Element
} }
type ItemProps = { type ItemProps = {

View File

@ -45,8 +45,8 @@ type GroupItem = {
key: string key: string
name: string name: string
description?: string description?: string
icon: JSX.Element icon: React.JSX.Element
activeIcon: JSX.Element activeIcon: React.JSX.Element
} }
export default function AccountSetting({ export default function AccountSetting({

View File

@ -10,7 +10,7 @@ const PluginPage = () => {
const { t } = useTranslation() const { t } = useTranslation()
const { data: plugins, mutate } = useSWR('/workspaces/current/tool-providers', fetchPluginProviders) const { data: plugins, mutate } = useSWR('/workspaces/current/tool-providers', fetchPluginProviders)
const Plugin_MAP: Record<string, (plugin: PluginProvider) => JSX.Element> = { const Plugin_MAP: Record<string, (plugin: PluginProvider) => React.JSX.Element> = {
serpapi: (plugin: PluginProvider) => <SerpapiPlugin key='serpapi' plugin={plugin} onUpdate={() => mutate()} />, serpapi: (plugin: PluginProvider) => <SerpapiPlugin key='serpapi' plugin={plugin} onUpdate={() => mutate()} />,
} }

View File

@ -13,7 +13,7 @@ type ListProps = {
showInstallButton?: boolean showInstallButton?: boolean
locale: string locale: string
cardContainerClassName?: string cardContainerClassName?: string
cardRender?: (plugin: Plugin) => JSX.Element | null cardRender?: (plugin: Plugin) => React.JSX.Element | null
onMoreClick?: () => void onMoreClick?: () => void
emptyClassName?: string emptyClassName?: string
} }

View File

@ -15,7 +15,7 @@ type ListWithCollectionProps = {
showInstallButton?: boolean showInstallButton?: boolean
locale: string locale: string
cardContainerClassName?: string cardContainerClassName?: string
cardRender?: (plugin: Plugin) => JSX.Element | null cardRender?: (plugin: Plugin) => React.JSX.Element | null
onMoreClick?: (searchParams?: SearchParamsFromCollection) => void onMoreClick?: (searchParams?: SearchParamsFromCollection) => void
} }
const ListWithCollection = ({ const ListWithCollection = ({

View File

@ -32,7 +32,7 @@ type BeforeRunFormProps = {
onRun: (submitData: Record<string, any>) => void onRun: (submitData: Record<string, any>) => void
onStop: () => void onStop: () => void
runningStatus: NodeRunningStatus runningStatus: NodeRunningStatus
result?: JSX.Element result?: React.JSX.Element
forms: FormProps[] forms: FormProps[]
showSpecialResultPanel?: boolean showSpecialResultPanel?: boolean
} & Partial<SpecialResultPanelProps> } & Partial<SpecialResultPanelProps>

View File

@ -6,8 +6,8 @@ export { default as FieldCollapse } from './field-collapse'
type CollapseProps = { type CollapseProps = {
disabled?: boolean disabled?: boolean
trigger: JSX.Element trigger: React.JSX.Element
children: JSX.Element children: React.JSX.Element
collapsed?: boolean collapsed?: boolean
onCollapse?: (collapsed: boolean) => void onCollapse?: (collapsed: boolean) => void
} }

View File

@ -16,11 +16,11 @@ import useToggleExpend from '@/app/components/workflow/nodes/_base/hooks/use-tog
import type { FileEntity } from '@/app/components/base/file-uploader/types' import type { FileEntity } from '@/app/components/base/file-uploader/types'
import FileListInLog from '@/app/components/base/file-uploader/file-list-in-log' import FileListInLog from '@/app/components/base/file-uploader/file-list-in-log'
interface Props { type Props = {
className?: string className?: string
title: JSX.Element | string title: React.JSX.Element | string
headerRight?: JSX.Element headerRight?: React.JSX.Element
children: JSX.Element children: React.JSX.Element
minHeight?: number minHeight?: number
value: string value: string
isFocus: boolean isFocus: boolean
@ -33,7 +33,7 @@ interface Props {
}[] }[]
showFileList?: boolean showFileList?: boolean
showCodeGenerator?: boolean showCodeGenerator?: boolean
tip?: JSX.Element tip?: React.JSX.Element
} }
const Base: FC<Props> = ({ const Base: FC<Props> = ({
@ -85,7 +85,7 @@ const Base: FC<Props> = ({
{headerRight} {headerRight}
{showCodeGenerator && codeLanguages && ( {showCodeGenerator && codeLanguages && (
<div className='ml-1'> <div className='ml-1'>
<CodeGeneratorButton onGenerated={onGenerated} codeLanguages={codeLanguages}/> <CodeGeneratorButton onGenerated={onGenerated} codeLanguages={codeLanguages} />
</div> </div>
)} )}
{!isCopied {!isCopied

View File

@ -18,11 +18,11 @@ const CODE_EDITOR_LINE_HEIGHT = 18
export type Props = { export type Props = {
value?: string | object value?: string | object
placeholder?: JSX.Element | string placeholder?: React.JSX.Element | string
onChange?: (value: string) => void onChange?: (value: string) => void
title?: JSX.Element title?: React.JSX.Element
language: CodeLanguage language: CodeLanguage
headerRight?: JSX.Element headerRight?: React.JSX.Element
readOnly?: boolean readOnly?: boolean
isJSONStringifyBeauty?: boolean isJSONStringifyBeauty?: boolean
height?: number height?: number
@ -34,7 +34,7 @@ export type Props = {
onGenerated?: (value: string) => void onGenerated?: (value: string) => void
showCodeGenerator?: boolean showCodeGenerator?: boolean
className?: string className?: string
tip?: JSX.Element tip?: React.JSX.Element
} }
export const languageMap = { export const languageMap = {

View File

@ -7,8 +7,8 @@ import Base from './base'
type Props = { type Props = {
value: string value: string
onChange: (value: string) => void onChange: (value: string) => void
title: JSX.Element | string title: React.JSX.Element | string
headerRight?: JSX.Element headerRight?: React.JSX.Element
minHeight?: number minHeight?: number
onBlur?: () => void onBlur?: () => void
placeholder?: string placeholder?: string

View File

@ -14,8 +14,8 @@ type Props = {
tooltip?: ReactNode tooltip?: ReactNode
isSubTitle?: boolean isSubTitle?: boolean
supportFold?: boolean supportFold?: boolean
children?: JSX.Element | string | null children?: React.JSX.Element | string | null
operations?: JSX.Element operations?: React.JSX.Element
inline?: boolean inline?: boolean
} }

View File

@ -19,7 +19,7 @@ const Icon = () => {
type NodeResizerProps = { type NodeResizerProps = {
nodeId: string nodeId: string
nodeData: CommonNodeType nodeData: CommonNodeType
icon?: JSX.Element icon?: React.JSX.Element
minWidth?: number minWidth?: number
minHeight?: number minHeight?: number
maxWidth?: number maxWidth?: number

View File

@ -41,7 +41,7 @@ type Props = {
className?: string className?: string
headerClassName?: string headerClassName?: string
instanceId?: string instanceId?: string
title: string | JSX.Element title: string | React.JSX.Element
value: string value: string
onChange: (value: string) => void onChange: (value: string) => void
readOnly?: boolean readOnly?: boolean

View File

@ -35,7 +35,7 @@ const ReadonlyInputWithSelectVar: FC<Props> = ({
return VAR_PLACEHOLDER return VAR_PLACEHOLDER
}) })
const html: JSX.Element[] = strWithVarPlaceholder.split(VAR_PLACEHOLDER).map((str, index) => { const html: React.JSX.Element[] = strWithVarPlaceholder.split(VAR_PLACEHOLDER).map((str, index) => {
if (!vars[index]) if (!vars[index])
return <span className='relative top-[-3px] leading-[16px]' key={index}>{str}</span> return <span className='relative top-[-3px] leading-[16px]' key={index}>{str}</span>

View File

@ -11,7 +11,7 @@ type Item = {
} }
type Props = { type Props = {
className?: string className?: string
trigger?: JSX.Element trigger?: React.JSX.Element
DropDownIcon?: any DropDownIcon?: any
noLeft?: boolean noLeft?: boolean
options: Item[] options: Item[]

View File

@ -17,7 +17,7 @@ import cn from '@/utils/classnames'
const i18nPrefix = 'workflow.nodes.http.authorization' const i18nPrefix = 'workflow.nodes.http.authorization'
interface Props { type Props = {
nodeId: string nodeId: string
payload: AuthorizationPayloadType payload: AuthorizationPayloadType
onChange: (payload: AuthorizationPayloadType) => void onChange: (payload: AuthorizationPayloadType) => void
@ -25,7 +25,7 @@ interface Props {
onHide: () => void onHide: () => void
} }
const Field = ({ title, isRequired, children }: { title: string; isRequired?: boolean; children: JSX.Element }) => { const Field = ({ title, isRequired, children }: { title: string; isRequired?: boolean; children: React.JSX.Element }) => {
return ( return (
<div> <div>
<div className='leading-8 text-[13px] font-medium text-gray-700'> <div className='leading-8 text-[13px] font-medium text-gray-700'>

View File

@ -13,12 +13,12 @@ import { Edit03 } from '@/app/components/base/icons/src/vender/solid/general'
import Badge from '@/app/components/base/badge' import Badge from '@/app/components/base/badge'
import ConfigVarModal from '@/app/components/app/configuration/config-var/config-modal' import ConfigVarModal from '@/app/components/app/configuration/config-var/config-modal'
interface Props { type Props = {
readonly: boolean readonly: boolean
payload: InputVar payload: InputVar
onChange?: (item: InputVar, moreInfo?: MoreInfo) => void onChange?: (item: InputVar, moreInfo?: MoreInfo) => void
onRemove?: () => void onRemove?: () => void
rightContent?: JSX.Element rightContent?: React.JSX.Element
varKeys?: string[] varKeys?: string[]
showLegacyBadge?: boolean showLegacyBadge?: boolean
} }

View File

@ -19,13 +19,13 @@ const NoteEditorContext = createContext<NoteEditorStore | null>(null)
type NoteEditorContextProviderProps = { type NoteEditorContextProviderProps = {
value: string value: string
children: JSX.Element | string | (JSX.Element | string)[] children: React.JSX.Element | string | (React.JSX.Element | string)[]
} }
export const NoteEditorContextProvider = memo(({ export const NoteEditorContextProvider = memo(({
value, value,
children, children,
}: NoteEditorContextProviderProps) => { }: NoteEditorContextProviderProps) => {
const storeRef = useRef<NoteEditorStore>() const storeRef = useRef<NoteEditorStore | undefined>(undefined)
if (!storeRef.current) if (!storeRef.current)
storeRef.current = createNoteEditorStore() storeRef.current = createNoteEditorStore()

File diff suppressed because one or more lines are too long