-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new column pinning, sizing, ordering APIs for easier sticky pin…
…ning (#5344) * improved memo method to accept depArgs getMemoOptions method to reduce memo boilerplate new ColumnSizing getAfter API (similar to getStart) added memoization to column.getStart method new Ordering column.getIndex API new Ordering column.getIsFirstColumn API new Ordering column.getIsLastColumn API improved table._getPinnedRows memo performance * update column pinning example and docs * update lock file * even better column sizing performance * smaller code
- Loading branch information
1 parent
3aa9da9
commit de1a715
Showing
38 changed files
with
873 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
.DS_Store | ||
dist | ||
dist-ssr | ||
*.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Example | ||
|
||
To run this example: | ||
|
||
- `npm install` or `yarn` | ||
- `npm run start` or `yarn start` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite App</title> | ||
<script type="module" src="https://cdn.skypack.dev/twind/shim"></script> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "tanstack-table-example-column-pinning-sticky", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"serve": "vite preview --port 3000", | ||
"start": "vite" | ||
}, | ||
"dependencies": { | ||
"@faker-js/faker": "^8.3.1", | ||
"@tanstack/react-table": "^8.11.8", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-replace": "^5.0.5", | ||
"@types/react": "^18.2.48", | ||
"@types/react-dom": "^18.2.18", | ||
"@vitejs/plugin-react": "^4.2.1", | ||
"vite": "^5.0.11" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
html { | ||
font-family: sans-serif; | ||
font-size: 14px; | ||
} | ||
|
||
.table-container { | ||
border: 1px solid lightgray; | ||
overflow-x: scroll; | ||
width: 100%; | ||
max-width: 960px; | ||
position: relative; | ||
} | ||
|
||
table { | ||
/* box-shadow and borders will not work with positon: sticky otherwise */ | ||
border-collapse: separate !important; | ||
border-spacing: 0; | ||
} | ||
|
||
th { | ||
background-color: lightgray; | ||
border-bottom: 1px solid lightgray; | ||
font-weight: bold; | ||
height: 30px; | ||
padding: 2px 4px; | ||
position: relative; | ||
text-align: center; | ||
} | ||
|
||
td { | ||
background-color: white; | ||
padding: 2px 4px; | ||
} | ||
|
||
.resizer { | ||
background: rgba(0, 0, 0, 0.5); | ||
cursor: col-resize; | ||
height: 100%; | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
touch-action: none; | ||
user-select: none; | ||
width: 5px; | ||
} | ||
|
||
.resizer.isResizing { | ||
background: blue; | ||
opacity: 1; | ||
} |
Oops, something went wrong.