Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
webloopbox committed Jan 17, 2025
2 parents e1a37a5 + f296b7e commit 907ea34
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@silevis/reactgrid",
"description": "Add spreadsheet-like behavior to your React app.",
"version": "4.1.13",
"version": "4.1.14",
"homepage": "https://reactgrid.com",
"license": "MIT",
"author": "Silevis Software",
Expand Down Expand Up @@ -91,4 +91,4 @@
"sass": "^1.62.1",
"tslib": "^2.5.2"
}
}
}
2 changes: 1 addition & 1 deletion src/lib/Components/RowRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const MappedColumns: React.FC<RowRendererProps> = ({ columns, row, cellRenderer,
borders={{
...borders,
left: borders.left && column.left === 0,
right: (borders.right && column.idx === lastColIdx) || !(state.cellMatrix.scrollableRange.last.column.idx === location.column.idx)
right: (borders.right && column.idx === lastColIdx) || !(state.cellMatrix.scrollableRange.last.column?.idx === location.column.idx)
}}
state={state}
location={location}
Expand Down
11 changes: 9 additions & 2 deletions src/lib/Functions/handlePaste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ export function handlePaste(event: ClipboardEvent, state: State): State {
.getData("text/plain")
.replace(/(\r\n)$/, '')
.split("\n")
.map((line: string) => line.split("\t").map((t) => ({ type: "text", text: t, value: parseLocaleNumber(t) })));
.map((line: string) => line.split("\t").map((t) => {
const parsedDate = parseExcelDate(t);
return parsedDate ? { type: "date", text: t, value: parsedDate.getTime() } : { type: "text", text: t, value: parseLocaleNumber(t) };
}));
}
event.preventDefault();
return { ...pasteData(state, pastedRows) };
}


function parseExcelDate(excelDate: string): Date | null {
const timestamp = Date.parse(excelDate);
return isNaN(timestamp) ? null : new Date(timestamp);
}

0 comments on commit 907ea34

Please sign in to comment.