Disable dev pages; FolderViewer table view; CustomTable type safety;

This commit is contained in:
cracklesparkle
2024-12-19 17:37:01 +09:00
parent 65b7e275fe
commit b54c2f0e20
3 changed files with 165 additions and 180 deletions

View File

@ -32,7 +32,7 @@ const CustomTable = () => {
{ id: 2, name: 'Jane Smith', age: 30 },
{ id: 3, name: 'Sam Green', age: 22 },
]);
const [editingCell, setEditingCell] = useState({ rowIndex: null, columnId: null });
const [editingCell, setEditingCell] = useState<{ rowIndex: string | number | null, columnId: string | number | null }>({ rowIndex: null, columnId: null });
const tableColumns = useMemo<ColumnDef<typeof data[0]>[]>(() => columns, []);
@ -50,7 +50,7 @@ const CustomTable = () => {
value: DataType[keyof DataType]
) => {
const updatedData = [...data];
updatedData[rowIndex][columnId] = value;
(updatedData[rowIndex][columnId] as DataType[keyof DataType]) = value;
setData(updatedData);
//setEditingCell({ rowIndex: null, columnId: null });
};
@ -90,8 +90,8 @@ const CustomTable = () => {
{isEditing ? (
<Input
type='text'
value={data[rowIndex][cell.column.id]}
onChange={(e) => handleEditCell(rowIndex, cell.column.id, e.target.value)}
value={data[rowIndex][cell.column.id as keyof DataType]}
onChange={(e) => handleEditCell(rowIndex, (cell.column.id as keyof DataType), e.target.value)}
onBlur={() => setEditingCell({ rowIndex: null, columnId: null })}
autoFocus
/>