Исправлены проблемы с сохранением и убраны console.logs
This commit is contained in:
@@ -395,7 +395,7 @@ const ElementForm: React.FC<ElementFormProps> = ({ formData, setFormData }) => {
|
||||
value={formData.type}
|
||||
onValueChange={value => {
|
||||
const newType = value as ElementType
|
||||
console.log('Element type changed to:', newType)
|
||||
// console.log('Element type changed to:', newType)
|
||||
|
||||
setFormData(prev => {
|
||||
const updates: Partial<TemplateElement> = { type: newType }
|
||||
@@ -405,24 +405,24 @@ const ElementForm: React.FC<ElementFormProps> = ({ formData, setFormData }) => {
|
||||
newType === 'standards' ||
|
||||
newType === 'calibration-conditions'
|
||||
) {
|
||||
console.log(
|
||||
`${newType} type selected, getting element definition`
|
||||
)
|
||||
// console.log(
|
||||
// `${newType} type selected, getting element definition`
|
||||
// )
|
||||
const elementDefinition = getElementDefinition(newType)
|
||||
console.log('Element definition:', elementDefinition)
|
||||
// console.log('Element definition:', elementDefinition)
|
||||
|
||||
if (elementDefinition && elementDefinition.defaultConfig) {
|
||||
const defaultConfig =
|
||||
elementDefinition.defaultConfig as any
|
||||
console.log('Default config:', defaultConfig)
|
||||
// console.log('Default config:', defaultConfig)
|
||||
updates.targetCells =
|
||||
elementDefinition.mapToCells?.(defaultConfig) || []
|
||||
console.log('Generated targetCells:', updates.targetCells)
|
||||
// console.log('Generated targetCells:', updates.targetCells)
|
||||
}
|
||||
}
|
||||
|
||||
const newFormData = { ...prev, ...updates }
|
||||
console.log('New form data:', newFormData)
|
||||
// console.log('New form data:', newFormData)
|
||||
return newFormData
|
||||
})
|
||||
}}
|
||||
@@ -520,7 +520,7 @@ const ElementForm: React.FC<ElementFormProps> = ({ formData, setFormData }) => {
|
||||
value={formData.type}
|
||||
onValueChange={value => {
|
||||
const newType = value as ElementType
|
||||
console.log('Element type changed to (fallback):', newType)
|
||||
// console.log('Element type changed to (fallback):', newType)
|
||||
|
||||
setFormData(prev => {
|
||||
const updates: Partial<TemplateElement> = { type: newType }
|
||||
@@ -530,29 +530,29 @@ const ElementForm: React.FC<ElementFormProps> = ({ formData, setFormData }) => {
|
||||
newType === 'standards' ||
|
||||
newType === 'calibration-conditions'
|
||||
) {
|
||||
console.log(
|
||||
`${newType} type selected (fallback), getting element definition`
|
||||
)
|
||||
// console.log(
|
||||
// `${newType} type selected (fallback), getting element definition`
|
||||
// )
|
||||
const elementDefinition = getElementDefinition(newType)
|
||||
console.log(
|
||||
'Element definition (fallback):',
|
||||
elementDefinition
|
||||
)
|
||||
// console.log(
|
||||
// 'Element definition (fallback):',
|
||||
// elementDefinition
|
||||
// )
|
||||
|
||||
if (elementDefinition && elementDefinition.defaultConfig) {
|
||||
const defaultConfig = elementDefinition.defaultConfig as any
|
||||
console.log('Default config (fallback):', defaultConfig)
|
||||
// console.log('Default config (fallback):', defaultConfig)
|
||||
updates.targetCells =
|
||||
elementDefinition.mapToCells?.(defaultConfig) || []
|
||||
console.log(
|
||||
'Generated targetCells (fallback):',
|
||||
updates.targetCells
|
||||
)
|
||||
// console.log(
|
||||
// 'Generated targetCells (fallback):',
|
||||
// updates.targetCells
|
||||
// )
|
||||
}
|
||||
}
|
||||
|
||||
const newFormData = { ...prev, ...updates }
|
||||
console.log('New form data (fallback):', newFormData)
|
||||
// console.log('New form data (fallback):', newFormData)
|
||||
return newFormData
|
||||
})
|
||||
}}
|
||||
@@ -746,10 +746,10 @@ export const ElementConstructor: React.FC<ElementConstructorProps> = ({
|
||||
}
|
||||
|
||||
const handleAddElement = () => {
|
||||
console.log('handleAddElement called with formData:', formData)
|
||||
// console.log('handleAddElement called with formData:', formData)
|
||||
|
||||
if (!formData.label) {
|
||||
console.log('Validation failed: missing label')
|
||||
// console.log('Validation failed: missing label')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -760,9 +760,9 @@ export const ElementConstructor: React.FC<ElementConstructorProps> = ({
|
||||
formData.type !== 'button-group' &&
|
||||
!formData.targetCells?.length
|
||||
) {
|
||||
console.log(
|
||||
'Validation failed: missing targetCells for element that requires manual targetCells'
|
||||
)
|
||||
// console.log(
|
||||
// 'Validation failed: missing targetCells for element that requires manual targetCells'
|
||||
// )
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user