diff --git a/src/features/review/planning-protocol/components/common/inputs/text/AddTextTable/index.tsx b/src/features/review/planning-protocol/components/common/inputs/text/AddTextTable/index.tsx index 7ee2c1cd..828d8258 100644 --- a/src/features/review/planning-protocol/components/common/inputs/text/AddTextTable/index.tsx +++ b/src/features/review/planning-protocol/components/common/inputs/text/AddTextTable/index.tsx @@ -17,7 +17,10 @@ export default function AddTextTable({ text, placeholder, referencePrefix = "", return ( - {text} + + {" "} + {text}{" "} + handleAddText(value)} @@ -27,6 +30,7 @@ export default function AddTextTable({ text, placeholder, referencePrefix = "", placeholder={placeholder} referencePrefix={referencePrefix} enableReferenceCode={enableReferenceCode} + maxLength={7} /> diff --git a/src/features/review/planning-protocol/components/common/tables/InfosTable/index.tsx b/src/features/review/planning-protocol/components/common/tables/InfosTable/index.tsx index b87f7e3b..173e7351 100644 --- a/src/features/review/planning-protocol/components/common/tables/InfosTable/index.tsx +++ b/src/features/review/planning-protocol/components/common/tables/InfosTable/index.tsx @@ -16,6 +16,7 @@ interface InfosTableProps { placeholder: string; referencePrefix?: string; enableReferenceCode?: boolean; + maxLength?: number; } export default function InfosTable({ @@ -27,6 +28,7 @@ export default function InfosTable({ placeholder, referencePrefix = "", enableReferenceCode = true, + maxLength, }: InfosTableProps) { const { sendAddText } = useCreateProtocol(); @@ -134,6 +136,7 @@ export default function InfosTable({ placeholder={`${referencePrefix}-01`} value={referenceCode} onChange={(e) => setReferenceCode(e.target.value)} + maxLength={maxLength} onBlur={() => setReferenceCode((s) => s.trim().toUpperCase()) } @@ -173,6 +176,7 @@ export default function InfosTable({ setEditedCode(e.target.value)} + maxLength={maxLength} onBlur={() => setEditedCode((c) => c.trim().toUpperCase()) } diff --git a/src/features/review/planning-protocol/components/common/tables/InteractiveTable/index.tsx b/src/features/review/planning-protocol/components/common/tables/InteractiveTable/index.tsx index 7c59cea9..f85899b7 100644 --- a/src/features/review/planning-protocol/components/common/tables/InteractiveTable/index.tsx +++ b/src/features/review/planning-protocol/components/common/tables/InteractiveTable/index.tsx @@ -243,8 +243,9 @@ export default function InteractiveTable({ id, url, label }: Props) { } const handleIdChange = (index: number, newId: string) => { + const limitedId = newId.slice(0, 7); setRows((prevRows) => - prevRows.map((row, i) => (i === index ? { ...row, id: newId } : row)) + prevRows.map((row, i) => (i === index ? { ...row, id: limitedId } : row)) ); }; @@ -267,14 +268,12 @@ export default function InteractiveTable({ id, url, label }: Props) { handleIdChange(index, e.target.value)} - + maxLength={7} isReadOnly={!isEditing} - border={isEditing ? "solid 1px #303D50" : "transparent"} bg={isEditing ? "white" : "transparent"} cursor={isEditing ? "text" : "default"} _focus={{ boxShadow: isEditing ? "outline" : "none" }} - borderRadius="md" size="sm" />