Skip to content

Commit 0c805a7

Browse files
authored
feat(useGridLayout): Add functionality for proposed useGridLayout (#2525)
Add functionality for a new hook called usGridLayout. other Layout hooks require the layout to be driven by the individual cells and row wrappers. This hook allows for a more stripped down markup
1 parent b4ac812 commit 0c805a7

File tree

22 files changed

+11706
-1
lines changed

22 files changed

+11706
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# `useGridLayout`
2+
3+
- Plugin Hook
4+
- Optional
5+
6+
`useGridLayout` is a plugin hook that adds support for headers and cells to be rendered as `div`s (or other non-table elements) with the immediate parent (table) controlling the layout using CSS Grid. This hook becomes useful when implementing both virtualized and resizable tables that must also be able to stretch to fill all available space. Uses a minimal amount of html to give greater control of styling. Works with `useResizeColumns`.
7+
8+
### Table Properties
9+
10+
- `getTableProps`
11+
- **Usage Required**
12+
- This core prop getter is required to get the correct stying for the layout

docs/src/pages/docs/api/useResizeColumns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- Plugin Hook
44
- Optional
55

6-
`useResizeColumns` is a plugin hook that adds support for resizing headers and cells when using non-table elements for layout eg. the `useBlockLayout` and `useAbsoluteLayout` hooks. It even supports resizing column groups!
6+
`useResizeColumns` is a plugin hook that adds support for resizing headers and cells when using non-table elements for layout eg. the `useBlockLayout`, `useAbsoluteLayout`, and `useGridLayout` hooks. It even supports resizing column groups!
77

88
### Table Options
99

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["react-app"],
3+
"plugins": ["styled-components"]
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SKIP_PREFLIGHT_CHECK=true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": ["react-app", "prettier"],
3+
"rules": {
4+
// "eqeqeq": 0,
5+
// "jsx-a11y/anchor-is-valid": 0
6+
}
7+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const path = require('path')
2+
const resolveFrom = require('resolve-from')
3+
4+
const fixLinkedDependencies = config => {
5+
config.resolve = {
6+
...config.resolve,
7+
alias: {
8+
...config.resolve.alias,
9+
react$: resolveFrom(path.resolve('node_modules'), 'react'),
10+
'react-dom$': resolveFrom(path.resolve('node_modules'), 'react-dom'),
11+
},
12+
}
13+
return config
14+
}
15+
16+
const includeSrcDirectory = config => {
17+
config.resolve = {
18+
...config.resolve,
19+
modules: [path.resolve('src'), ...config.resolve.modules],
20+
}
21+
return config
22+
}
23+
24+
module.exports = [
25+
['use-babel-config', '.babelrc'],
26+
['use-eslint-config', '.eslintrc'],
27+
fixLinkedDependencies,
28+
// includeSrcDirectory,
29+
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Full Width Resizable Table (via useGridLayout)
2+
3+
- `yarn` and `yarn start` to run and edit the example
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"start": "rescripts start",
5+
"build": "rescripts build",
6+
"test": "rescripts test",
7+
"eject": "rescripts eject"
8+
},
9+
"dependencies": {
10+
"namor": "^1.1.2",
11+
"react": "^16.8.6",
12+
"react-dom": "^16.8.6",
13+
"react-scripts": "^3.4.1",
14+
"react-table": "latest",
15+
"styled-components": "^4.3.2"
16+
},
17+
"devDependencies": {
18+
"@rescripts/cli": "^0.0.11",
19+
"@rescripts/rescript-use-babel-config": "^0.0.8",
20+
"@rescripts/rescript-use-eslint-config": "^0.0.9",
21+
"babel-eslint": "10.0.1"
22+
},
23+
"browserslist": {
24+
"production": [
25+
">0.2%",
26+
"not dead",
27+
"not op_mini all"
28+
],
29+
"development": [
30+
"last 1 chrome version",
31+
"last 1 firefox version",
32+
"last 1 safari version"
33+
]
34+
}
35+
}
Binary file not shown.

0 commit comments

Comments
 (0)