mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-04 13:59:09 +00:00
fix: edit custom fields with type image (#1997)
This commit is contained in:
committed by
GitHub
parent
1849b4d39f
commit
ceb490c60a
+1
@@ -39,6 +39,7 @@ export default function CustomFieldEntry(props: CustomFieldEntryProps) {
|
|||||||
initialColour={colour}
|
initialColour={colour}
|
||||||
initialLabel={label}
|
initialLabel={label}
|
||||||
initialKey={fieldKey}
|
initialKey={fieldKey}
|
||||||
|
initialType={type}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
+3
-1
@@ -21,6 +21,7 @@ interface CustomFieldsFormProps {
|
|||||||
initialColour?: string;
|
initialColour?: string;
|
||||||
initialLabel?: string;
|
initialLabel?: string;
|
||||||
initialKey?: string;
|
initialKey?: string;
|
||||||
|
initialType?: CustomField['type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
type CustomFieldFormData = CustomField & { key: string };
|
type CustomFieldFormData = CustomField & { key: string };
|
||||||
@@ -31,6 +32,7 @@ export default function CustomFieldForm({
|
|||||||
initialColour,
|
initialColour,
|
||||||
initialLabel,
|
initialLabel,
|
||||||
initialKey,
|
initialKey,
|
||||||
|
initialType,
|
||||||
}: CustomFieldsFormProps) {
|
}: CustomFieldsFormProps) {
|
||||||
const { data } = useCustomFields();
|
const { data } = useCustomFields();
|
||||||
|
|
||||||
@@ -47,7 +49,7 @@ export default function CustomFieldForm({
|
|||||||
watch,
|
watch,
|
||||||
formState: { errors, isSubmitting, isValid, isDirty },
|
formState: { errors, isSubmitting, isValid, isDirty },
|
||||||
} = useForm<CustomFieldFormData>({
|
} = useForm<CustomFieldFormData>({
|
||||||
defaultValues: { type: 'text', label: initialLabel || '', colour: initialColour || '' },
|
defaultValues: { type: initialType ?? 'text', label: initialLabel || '', colour: initialColour || '' },
|
||||||
resetOptions: {
|
resetOptions: {
|
||||||
keepDirtyValues: true,
|
keepDirtyValues: true,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user