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

View File

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

View File

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

View File

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