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

pull/21398/head
twwu 8 months ago
parent 0a2c569b3b
commit ecb07a5d0d

@ -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}
/>
)}
/>

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

@ -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)

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

Loading…
Cancel
Save