mirror of
https://github.com/langgenius/dify.git
synced 2025-11-21 23:43:08 +00:00
feat: enhance field list functionality by adding chosen and selected properties to SortableItem
This commit is contained in:
parent
0a2c569b3b
commit
ecb07a5d0d
@ -33,6 +33,7 @@ const BaseField = ({
|
|||||||
allowedFileTypes,
|
allowedFileTypes,
|
||||||
allowedFileUploadMethods,
|
allowedFileUploadMethods,
|
||||||
maxLength,
|
maxLength,
|
||||||
|
unit,
|
||||||
} = config
|
} = config
|
||||||
|
|
||||||
const isAllConditionsMet = useStore(form.store, (state) => {
|
const isAllConditionsMet = useStore(form.store, (state) => {
|
||||||
@ -101,6 +102,7 @@ const BaseField = ({
|
|||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
max={max}
|
max={max}
|
||||||
min={min}
|
min={min}
|
||||||
|
unit={unit}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -30,6 +30,8 @@ const FieldListContainer = ({
|
|||||||
return inputFields.map((content) => {
|
return inputFields.map((content) => {
|
||||||
return ({
|
return ({
|
||||||
id: content.variable,
|
id: content.variable,
|
||||||
|
chosen: false,
|
||||||
|
selected: false,
|
||||||
...content,
|
...content,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export const useFieldList = (
|
|||||||
|
|
||||||
const handleListSortChange = useCallback((list: SortableItem[]) => {
|
const handleListSortChange = useCallback((list: SortableItem[]) => {
|
||||||
const newInputFields = list.map((item) => {
|
const newInputFields = list.map((item) => {
|
||||||
const { id, ...filed } = item
|
const { id, chosen, selected, ...filed } = item
|
||||||
return filed
|
return filed
|
||||||
})
|
})
|
||||||
handleInputFieldsChange(newInputFields)
|
handleInputFieldsChange(newInputFields)
|
||||||
|
|||||||
@ -2,4 +2,6 @@ import type { InputVar } from '@/models/pipeline'
|
|||||||
|
|
||||||
export type SortableItem = {
|
export type SortableItem = {
|
||||||
id: string
|
id: string
|
||||||
|
chosen: boolean,
|
||||||
|
selected: boolean,
|
||||||
} & InputVar
|
} & InputVar
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user