feat: enhance field list functionality by adding chosen and selected properties to SortableItem

This commit is contained in:
twwu 2025-06-16 18:25:30 +08:00
parent 0a2c569b3b
commit ecb07a5d0d
4 changed files with 7 additions and 1 deletions

View File

@ -33,6 +33,7 @@ const BaseField = ({
allowedFileTypes,
allowedFileUploadMethods,
maxLength,
unit,
} = config
const isAllConditionsMet = useStore(form.store, (state) => {
@ -101,6 +102,7 @@ const BaseField = ({
placeholder={placeholder}
max={max}
min={min}
unit={unit}
/>
)}
/>

View File

@ -30,6 +30,8 @@ const FieldListContainer = ({
return inputFields.map((content) => {
return ({
id: content.variable,
chosen: false,
selected: false,
...content,
})
})

View File

@ -37,7 +37,7 @@ export const useFieldList = (
const handleListSortChange = useCallback((list: SortableItem[]) => {
const newInputFields = list.map((item) => {
const { id, ...filed } = item
const { id, chosen, selected, ...filed } = item
return filed
})
handleInputFieldsChange(newInputFields)

View File

@ -2,4 +2,6 @@ import type { InputVar } from '@/models/pipeline'
export type SortableItem = {
id: string
chosen: boolean,
selected: boolean,
} & InputVar