diff --git a/src/components/filter/explicitNaming/ExplicitNamingFilterForm.tsx b/src/components/filter/explicitNaming/ExplicitNamingFilterForm.tsx index ae8e2fa6..90c045a1 100644 --- a/src/components/filter/explicitNaming/ExplicitNamingFilterForm.tsx +++ b/src/components/filter/explicitNaming/ExplicitNamingFilterForm.tsx @@ -99,7 +99,9 @@ interface ExplicitNamingFilterFormProps { sourceFilterForExplicitNamingConversion?: FilterForExplicitConversionProps; } -function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }: ExplicitNamingFilterFormProps) { +function ExplicitNamingFilterForm({ + sourceFilterForExplicitNamingConversion, +}: Readonly) { const intl = useIntl(); const { snackError } = useSnackMessage(); @@ -166,9 +168,9 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }: E return newCsvFileHeaders; }, [intl, forGeneratorOrLoad]); - const getDataFromCsvFile = useCallback((csvData: any) => { + const getDataFromCsvFile = useCallback((csvData: string[][]) => { if (csvData) { - return csvData.map((value: any) => { + return csvData.map((value) => { return { [FieldConstants.AG_GRID_ROW_UUID]: uuid4(), [FieldConstants.EQUIPMENT_ID]: value[0]?.trim(), diff --git a/src/components/inputs/reactHookForm/agGridTable/BottomRightButtons.tsx b/src/components/inputs/reactHookForm/agGridTable/BottomRightButtons.tsx index 1f68c472..f14e8109 100644 --- a/src/components/inputs/reactHookForm/agGridTable/BottomRightButtons.tsx +++ b/src/components/inputs/reactHookForm/agGridTable/BottomRightButtons.tsx @@ -50,6 +50,7 @@ function BottomRightButtons({ }: Readonly) { const [uploaderOpen, setUploaderOpen] = useState(false); const intl = useIntl(); + const onClose = useCallback(() => setUploaderOpen(false), []); return ( <> @@ -88,7 +89,7 @@ function BottomRightButtons({ setUploaderOpen(false), [])} + onClose={onClose} name={name} useFieldArrayOutput={useFieldArrayOutput} {...csvProps} diff --git a/src/components/inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.tsx b/src/components/inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.tsx index 8b3d6bde..d87996fb 100644 --- a/src/components/inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.tsx +++ b/src/components/inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.tsx @@ -19,7 +19,7 @@ import { useCSVReader } from 'react-papaparse'; import { ReactNode, useMemo, useState } from 'react'; import { FormattedMessage, useIntl } from 'react-intl'; import CsvDownloader from 'react-csv-downloader'; -import { FieldValues, UseFieldArrayReturn, useWatch } from 'react-hook-form'; +import { FieldValues, UseFieldArrayAppend, UseFieldArrayReturn, useWatch } from 'react-hook-form'; import { RECORD_SEP, UNIT_SEP } from 'papaparse'; import FieldConstants from '../../../../../utils/constants/fieldConstants'; import CancelButton from '../../utils/CancelButton'; @@ -33,7 +33,7 @@ export interface CsvUploaderProps { fileName: string; csvData?: Array>; validateData?: (rows: string[][]) => boolean; - getDataFromCsv: any; + getDataFromCsv: (csvData: string[][]) => Parameters>[0]; // keep generics in sync with useFieldArrayOutput field useFieldArrayOutput: UseFieldArrayReturn; }