diff --git a/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationCell.tsx b/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationCell.tsx index fdce32e..5ef9852 100644 --- a/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationCell.tsx +++ b/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/components/ValidationCell.tsx @@ -1,6 +1,6 @@ import React from 'react' import { Field } from '../../../types' -import { Loader2, AlertCircle, CopyDown, ArrowDown } from 'lucide-react' +import { Loader2, AlertCircle, ArrowDown } from 'lucide-react' import { Tooltip, TooltipContent, diff --git a/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidationState.tsx b/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidationState.tsx index d5f4ea5..2a70e6c 100644 --- a/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidationState.tsx +++ b/inventory/src/lib/react-spreadsheet-import/src/steps/ValidationStepNew/hooks/useValidationState.tsx @@ -675,7 +675,7 @@ useEffect(() => { const errors: ErrorType[] = []; // Required field validation - improved to better handle various value types - if (field.validations?.some(v => v.type === 'required')) { + if (field.validations?.some(v => v.rule === 'required')) { // Handle different value types more carefully const isEmpty = value === undefined || @@ -698,32 +698,32 @@ useEffect(() => { if (field.validations) { for (const validation of field.validations) { // Skip required validation as we've already handled it - if (validation.type === 'required') continue; + if (validation.rule === 'required') continue; - if (validation.type === 'regex' && typeof value === 'string') { + if (validation.rule === 'regex' && typeof value === 'string') { // Implement regex validation - const regex = new RegExp(validation.pattern!); + const regex = new RegExp(validation.value!); if (!regex.test(value)) { errors.push({ - message: validation.message || 'Invalid format', + message: validation.errorMessage || 'Invalid format', level: validation.level || 'error', source: 'validation' }); } - } else if (validation.type === 'min' && typeof value === 'number') { + } else if (validation.rule === 'min' && typeof value === 'number') { // Implement min validation if (value < validation.value) { errors.push({ - message: validation.message || `Value must be at least ${validation.value}`, + message: validation.errorMessage || `Value must be at least ${validation.value}`, level: validation.level || 'error', source: 'validation' }); } - } else if (validation.type === 'max' && typeof value === 'number') { + } else if (validation.rule === 'max' && typeof value === 'number') { // Implement max validation if (value > validation.value) { errors.push({ - message: validation.message || `Value must be at most ${validation.value}`, + message: validation.errorMessage || `Value must be at most ${validation.value}`, level: validation.level || 'error', source: 'validation' });