Skip to content

Commit

Permalink
Updates Glide Data Grid (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristineguadelupe authored Aug 31, 2023
1 parent 4c72a93 commit 7d21b01
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 96 deletions.
23 changes: 1 addition & 22 deletions assets/data_table/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,27 +393,6 @@ function App({ ctx, data }) {
[hoverRows]
);

const getCellsForSelection = useCallback(
({ x, y, width, height }) => {
const selected = [];
const max = content.columns.length;
const offSet = width >= max ? 0 : x + width >= max ? 0 : rowMarkerOffset;
const rows = [...Array.from({ length: height }, (_, index) => index + y)];
const cols = [
...Array.from({ length: width + offSet }, (_, index) => index + x),
];
rows.forEach((i) => {
const row = [];
cols.forEach((j) => {
row.push(getCellContent([j, i]));
});
selected.push(row);
});
return selected;
},
[rowMarkerOffset, getCellContent]
);

useEffect(() => {
selection.rows?.items.length > 0
? setRowMarkerOffset(1)
Expand Down Expand Up @@ -514,7 +493,7 @@ function App({ ctx, data }) {
onHeaderMenuClick={onHeaderMenuClick}
onHeaderClicked={onHeaderClicked}
showSearch={showSearch}
getCellsForSelection={getCellsForSelection}
getCellsForSelection={true}
onSearchClose={toggleSearch}
headerIcons={customHeaderIcons}
overscrollX={100}
Expand Down
14 changes: 7 additions & 7 deletions assets/data_table/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/data_table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dev": "esbuild main.js --bundle --minify --outfile=../../lib/assets/data_table/build/main.js --format=esm --loader:.js=jsx --watch"
},
"dependencies": {
"@glideapps/glide-data-grid": "^5.2.0",
"@glideapps/glide-data-grid": "^5.3.0",
"lodash": "^4.17.21",
"marked": "^4.2.2",
"react": "^18.2.0",
Expand Down
Loading

0 comments on commit 7d21b01

Please sign in to comment.