mirror of
https://github.com/langgenius/dify.git
synced 2026-04-28 03:36:36 +08:00
refactor: Simplify type checks for form field rendering and correct comment grammar
This commit is contained in:
parent
3f8b0b937c
commit
b1fbaaed95
@ -36,7 +36,7 @@ const Field = <T,>({
|
|||||||
if (!isAllConditionsMet)
|
if (!isAllConditionsMet)
|
||||||
return <></>
|
return <></>
|
||||||
|
|
||||||
if ([BaseVarType.textInput].includes(type)) {
|
if (type === BaseVarType.textInput) {
|
||||||
return (
|
return (
|
||||||
<form.AppField
|
<form.AppField
|
||||||
name={variable}
|
name={variable}
|
||||||
@ -51,7 +51,7 @@ const Field = <T,>({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([BaseVarType.numberInput].includes(type)) {
|
if (type === BaseVarType.numberInput) {
|
||||||
return (
|
return (
|
||||||
<form.AppField
|
<form.AppField
|
||||||
name={variable}
|
name={variable}
|
||||||
@ -68,7 +68,7 @@ const Field = <T,>({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([BaseVarType.checkbox].includes(type)) {
|
if (type === BaseVarType.checkbox) {
|
||||||
return (
|
return (
|
||||||
<form.AppField
|
<form.AppField
|
||||||
name={variable}
|
name={variable}
|
||||||
@ -81,7 +81,7 @@ const Field = <T,>({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([BaseVarType.select].includes(type)) {
|
if (type === BaseVarType.select) {
|
||||||
return (
|
return (
|
||||||
<form.AppField
|
<form.AppField
|
||||||
name={variable}
|
name={variable}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ export type BaseConfiguration<T> = {
|
|||||||
maxLength?: number // Max length for text input
|
maxLength?: number // Max length for text input
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
required: boolean
|
required: boolean
|
||||||
showConditions: ShowCondition<T>[] // Show this field only when the all conditions are met
|
showConditions: ShowCondition<T>[] // Show this field only when all conditions are met
|
||||||
type: BaseVarType
|
type: BaseVarType
|
||||||
tooltip?: string // Tooltip for this field
|
tooltip?: string // Tooltip for this field
|
||||||
} & NumberConfiguration & SelectConfiguration
|
} & NumberConfiguration & SelectConfiguration
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user