Add full-width-table example

This commit is contained in:
Tanner Linsley
2019-11-20 11:16:30 -07:00
parent c80dfabed4
commit e2728d0fdb
23 changed files with 10993 additions and 98 deletions

View File

@@ -1,13 +1,13 @@
{
"dist/index.js": {
"bundled": 88238,
"minified": 42315,
"gzipped": 11281
"bundled": 87904,
"minified": 41988,
"gzipped": 11252
},
"dist/index.es.js": {
"bundled": 87322,
"minified": 41477,
"gzipped": 11142,
"bundled": 87321,
"minified": 41480,
"gzipped": 11132,
"treeshaked": {
"rollup": {
"code": 428,

View File

@@ -0,0 +1,4 @@
{
"presets": ["react-app"],
"plugins": ["styled-components"]
}

1
examples/full-width-table/.env Executable file
View File

@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true

View File

@@ -0,0 +1,7 @@
{
"extends": ["react-app", "prettier"],
"rules": {
// "eqeqeq": 0,
// "jsx-a11y/anchor-is-valid": 0
}
}

23
examples/full-width-table/.gitignore vendored Executable file
View File

@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@@ -0,0 +1,29 @@
const path = require('path')
const resolveFrom = require('resolve-from')
const fixLinkedDependencies = config => {
config.resolve = {
...config.resolve,
alias: {
...config.resolve.alias,
react$: resolveFrom(path.resolve('node_modules'), 'react'),
'react-dom$': resolveFrom(path.resolve('node_modules'), 'react-dom'),
},
}
return config
}
const includeSrcDirectory = config => {
config.resolve = {
...config.resolve,
modules: [path.resolve('src'), ...config.resolve.modules],
}
return config
}
module.exports = [
['use-babel-config', '.babelrc'],
['use-eslint-config', '.eslintrc'],
fixLinkedDependencies,
// includeSrcDirectory,
]

View File

@@ -0,0 +1,4 @@
# Full Width Table (with collapsible cells)
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/full-width-table)
- `yarn` and `yarn start` to run and edit the example

View File

@@ -0,0 +1,35 @@
{
"private": true,
"scripts": {
"start": "rescripts start",
"build": "rescripts build",
"test": "rescripts test",
"eject": "rescripts eject"
},
"dependencies": {
"namor": "^1.1.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1",
"react-table": "next",
"styled-components": "^4.3.2"
},
"devDependencies": {
"@rescripts/cli": "^0.0.11",
"@rescripts/rescript-use-babel-config": "^0.0.8",
"@rescripts/rescript-use-eslint-config": "^0.0.9",
"babel-eslint": "10.0.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

View File

@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@@ -0,0 +1,3 @@
{
"infiniteLoopProtection": false
}

View File

@@ -0,0 +1,232 @@
import React from 'react'
import styled from 'styled-components'
import { useTable, usePagination } from 'react-table'
import makeData from './makeData'
const Styles = styled.div`
/* This is required to make the table full-width */
display: block;
max-width: 100%;
/* This will make the table scrollable when it gets too small */
.tableWrap {
display: block;
max-width: 100%;
overflow-x: scroll;
overflow-y: hidden;
border-bottom: 1px solid black;
}
table {
/* Make sure the inner table is always as wide as needed */
width: 100%;
border-spacing: 0;
tr {
:last-child {
td {
border-bottom: 0;
}
}
}
th,
td {
margin: 0;
padding: 0.5rem;
border-bottom: 1px solid black;
border-right: 1px solid black;
/* The secret sauce */
/* Each cell should grow equally */
width: 1%;
/* But "collapsed" cells should be as small as possible */
&.collapse {
width: 0.0000000001%;
}
:last-child {
border-right: 0;
}
}
}
.pagination {
padding: 0.5rem;
}
`
function Table({ columns, data }) {
// Use the state and functions returned from useTable to build your UI
const {
getTableProps,
getTableBodyProps,
headerGroups,
prepareRow,
page, // Instead of using 'rows', we'll use page,
// which has only the rows for the active page
// The rest of these things are super handy, too ;)
canPreviousPage,
canNextPage,
pageOptions,
pageCount,
gotoPage,
nextPage,
previousPage,
setPageSize,
state: { pageIndex, pageSize },
} = useTable(
{
columns,
data,
initialState: { pageIndex: 2 },
},
usePagination
)
// Render the UI for your table
return (
<Styles>
<div className="tableWrap">
<table {...getTableProps()}>
<thead>
{headerGroups.map(headerGroup => (
<tr {...headerGroup.getHeaderGroupProps()}>
{headerGroup.headers.map(column => (
<th
{...column.getHeaderProps({
className: column.collapse ? 'collapse' : '',
})}
>
{column.render('Header')}
</th>
))}
</tr>
))}
</thead>
<tbody {...getTableBodyProps()}>
{page.map((row, i) => {
prepareRow(row)
return (
<tr {...row.getRowProps()}>
{row.cells.map(cell => {
return (
<td
{...cell.getCellProps({
className: cell.column.collapse ? 'collapse' : '',
})}
>
{cell.render('Cell')}
</td>
)
})}
</tr>
)
})}
</tbody>
</table>
{/*
Pagination can be built however you'd like.
This is just a very basic UI implementation:
*/}
</div>
<div className="pagination">
<button onClick={() => gotoPage(0)} disabled={!canPreviousPage}>
{'<<'}
</button>{' '}
<button onClick={() => previousPage()} disabled={!canPreviousPage}>
{'<'}
</button>{' '}
<button onClick={() => nextPage()} disabled={!canNextPage}>
{'>'}
</button>{' '}
<button onClick={() => gotoPage(pageCount - 1)} disabled={!canNextPage}>
{'>>'}
</button>{' '}
<span>
Page{' '}
<strong>
{pageIndex + 1} of {pageOptions.length}
</strong>{' '}
</span>
<span>
| Go to page:{' '}
<input
type="number"
defaultValue={pageIndex + 1}
onChange={e => {
const page = e.target.value ? Number(e.target.value) - 1 : 0
gotoPage(page)
}}
style={{ width: '100px' }}
/>
</span>{' '}
<select
value={pageSize}
onChange={e => {
setPageSize(Number(e.target.value))
}}
>
{[10, 20, 30, 40, 50].map(pageSize => (
<option key={pageSize} value={pageSize}>
Show {pageSize}
</option>
))}
</select>
</div>
</Styles>
)
}
function App() {
const columns = React.useMemo(
() => [
{
Header: 'Name',
columns: [
{
Header: 'First Name',
accessor: 'firstName',
},
{
Header: 'Last Name',
accessor: 'lastName',
},
],
},
{
Header: 'Info',
columns: [
{
Header: 'Age',
accessor: 'age',
collapse: true,
},
{
Header: 'Visits',
accessor: 'visits',
collapse: true,
},
{
Header: 'Status',
accessor: 'status',
},
{
Header: 'Profile Progress',
accessor: 'progress',
collapse: true,
},
],
},
],
[]
)
const data = React.useMemo(() => makeData(100000), [])
return <Table columns={columns} data={data} />
}
export default App

View File

@@ -0,0 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
it('renders without crashing', () => {
const div = document.createElement('div')
ReactDOM.render(<App />, div)
ReactDOM.unmountComponentAtNode(div)
})

View File

@@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

View File

@@ -0,0 +1,12 @@
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import * as serviceWorker from './serviceWorker'
ReactDOM.render(<App />, document.getElementById('root'))
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister()

View File

@@ -0,0 +1,40 @@
import namor from 'namor'
const range = len => {
const arr = []
for (let i = 0; i < len; i++) {
arr.push(i)
}
return arr
}
const newPerson = () => {
const statusChance = Math.random()
return {
firstName: namor.generate({ words: 1, numbers: 0 }),
lastName: namor.generate({ words: 1, numbers: 0 }),
age: Math.floor(Math.random() * 30),
visits: Math.floor(Math.random() * 100),
progress: Math.floor(Math.random() * 100),
status:
statusChance > 0.66
? 'relationship'
: statusChance > 0.33
? 'complicated'
: 'single',
}
}
export default function makeData(...lens) {
const makeDataLevel = (depth = 0) => {
const len = lens[depth]
return range(len).map(d => {
return {
...newPerson(),
subRows: lens[depth + 1] ? makeDataLevel(depth + 1) : undefined,
}
})
}
return makeDataLevel()
}

View File

@@ -0,0 +1,135 @@
// This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
)
export function register(config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href)
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return
}
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config)
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://bit.ly/CRA-PWA'
)
})
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config)
}
})
}
}
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing
if (installingWorker == null) {
return
}
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
)
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration)
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.')
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration)
}
}
}
}
}
})
.catch(error => {
console.error('Error during service worker registration:', error)
})
}
function checkValidServiceWorker(swUrl, config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type')
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload()
})
})
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl, config)
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
)
})
}
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister()
})
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
import React from "react";
import styled from "styled-components";
import { useTable, usePagination } from "react-table";
import React from 'react'
import styled from 'styled-components'
import { useTable, usePagination } from 'react-table'
import makeData from "./makeData";
import makeData from './makeData'
const Styles = styled.div`
padding: 1rem;
@@ -35,7 +35,7 @@ const Styles = styled.div`
.pagination {
padding: 0.5rem;
}
`;
`
// Let's add a fetchData method to our Table component that will be used to fetch
// new data when pagination state changes
@@ -45,7 +45,7 @@ function Table({
data,
fetchData,
loading,
pageCount: controlledPageCount
pageCount: controlledPageCount,
}) {
const {
getTableProps,
@@ -63,7 +63,7 @@ function Table({
setPageSize,
rows,
// Get the state from the instance
state: { pageIndex, pageSize }
state: { pageIndex, pageSize },
} = useTable(
{
columns,
@@ -73,18 +73,18 @@ function Table({
// hook that we'll handle our own data fetching
// This means we'll also have to provide our own
// pageCount.
pageCount: controlledPageCount
pageCount: controlledPageCount,
},
usePagination
);
)
// Now we can get our table state from the hoisted table state tuple
// Listen for changes in pagination and use the state to fetch our new data
React.useEffect(() => {
console.log(pageIndex);
fetchData({ pageIndex, pageSize });
}, [fetchData, pageIndex, pageSize]);
console.log(pageIndex)
fetchData({ pageIndex, pageSize })
}, [fetchData, pageIndex, pageSize])
// Render the UI for your table
return (
@@ -97,7 +97,7 @@ function Table({
pageSize,
pageCount,
canNextPage,
canPreviousPage
canPreviousPage,
},
null,
2
@@ -109,32 +109,29 @@ function Table({
{headerGroups.map(headerGroup => (
<tr {...headerGroup.getHeaderGroupProps()}>
{headerGroup.headers.map(column => (
<th {...column.getHeaderProps()}>{column.render("Header")}</th>
<th {...column.getHeaderProps()}>{column.render('Header')}</th>
))}
</tr>
))}
</thead>
<tbody {...getTableBodyProps()}>
{page.map(
(row, i) => {
prepareRow(row);
return (
<tr {...row.getRowProps()}>
{row.cells.map(cell => {
return (
<td {...cell.getCellProps()}>{cell.render("Cell")}</td>
);
})}
</tr>
)}
)}
{page.map((row, i) => {
prepareRow(row)
return (
<tr {...row.getRowProps()}>
{row.cells.map(cell => {
return <td {...cell.getCellProps()}>{cell.render('Cell')}</td>
})}
</tr>
)
})}
<tr>
{loading ? (
// Use our custom loading state to show a loading indicator
<td>Loading...</td>
) : (
<td>
Showing {page.length} of ~{controlledPageCount * pageSize}{" "}
Showing {page.length} of ~{controlledPageCount * pageSize}{' '}
results
</td>
)}
@@ -147,39 +144,39 @@ function Table({
*/}
<div className="pagination">
<button onClick={() => gotoPage(0)} disabled={!canPreviousPage}>
{"<<"}
</button>{" "}
{'<<'}
</button>{' '}
<button onClick={() => previousPage()} disabled={!canPreviousPage}>
{"<"}
</button>{" "}
{'<'}
</button>{' '}
<button onClick={() => nextPage()} disabled={!canNextPage}>
{">"}
</button>{" "}
{'>'}
</button>{' '}
<button onClick={() => gotoPage(pageCount - 1)} disabled={!canNextPage}>
{">>"}
</button>{" "}
{'>>'}
</button>{' '}
<span>
Page{" "}
Page{' '}
<strong>
{pageIndex + 1} of {pageOptions.length}
</strong>{" "}
</strong>{' '}
</span>
<span>
| Go to page:{" "}
| Go to page:{' '}
<input
type="number"
defaultValue={pageIndex + 1}
onChange={e => {
const page = e.target.value ? Number(e.target.value) - 1 : 0;
gotoPage(page);
const page = e.target.value ? Number(e.target.value) - 1 : 0
gotoPage(page)
}}
style={{ width: "100px" }}
style={{ width: '100px' }}
/>
</span>{" "}
</span>{' '}
<select
value={pageSize}
onChange={e => {
setPageSize(Number(e.target.value));
setPageSize(Number(e.target.value))
}}
>
{[10, 20, 30, 40, 50].map(pageSize => (
@@ -190,58 +187,58 @@ function Table({
</select>
</div>
</>
);
)
}
// Let's simulate a large dataset on the server (outside of our component)
const serverData = makeData(10000);
const serverData = makeData(10000)
function App() {
const columns = React.useMemo(
() => [
{
Header: "Name",
Header: 'Name',
columns: [
{
Header: "First Name",
accessor: "firstName"
Header: 'First Name',
accessor: 'firstName',
},
{
Header: "Last Name",
accessor: "lastName"
}
]
Header: 'Last Name',
accessor: 'lastName',
},
],
},
{
Header: "Info",
Header: 'Info',
columns: [
{
Header: "Age",
accessor: "age"
Header: 'Age',
accessor: 'age',
},
{
Header: "Visits",
accessor: "visits"
Header: 'Visits',
accessor: 'visits',
},
{
Header: "Status",
accessor: "status"
Header: 'Status',
accessor: 'status',
},
{
Header: "Profile Progress",
accessor: "progress"
}
]
}
Header: 'Profile Progress',
accessor: 'progress',
},
],
},
],
[]
);
)
// We'll start our table without any data
const [data, setData] = React.useState([]);
const [loading, setLoading] = React.useState(false);
const [pageCount, setPageCount] = React.useState(0);
const fetchIdRef = React.useRef(0);
const [data, setData] = React.useState([])
const [loading, setLoading] = React.useState(false)
const [pageCount, setPageCount] = React.useState(0)
const fetchIdRef = React.useRef(0)
const fetchData = React.useCallback(({ pageSize, pageIndex }) => {
// This will get called when the table needs new data
@@ -249,27 +246,27 @@ function App() {
// even a server. But for this example, we'll just fake it.
// Give this fetch an ID
const fetchID = ++fetchIdRef.current;
const fetchID = ++fetchIdRef.current
// Set the loading state
setLoading(true);
setLoading(true)
// We'll even set a delay to simulate a server here
setTimeout(() => {
// Only update the data if this is the latest fetch
if (fetchID === fetchIdRef.current) {
const startRow = pageSize * pageIndex;
const endRow = startRow + pageSize;
setData(serverData.slice(startRow, endRow));
const startRow = pageSize * pageIndex
const endRow = startRow + pageSize
setData(serverData.slice(startRow, endRow))
// Your server could send back total page count.
// For now we'll just fake it, too
setPageCount(Math.ceil(serverData.length / pageSize));
setPageCount(Math.ceil(serverData.length / pageSize))
setLoading(false);
setLoading(false)
}
}, 1000);
}, []);
}, 1000)
}, [])
return (
<Styles>
@@ -281,7 +278,7 @@ function App() {
pageCount={pageCount}
/>
</Styles>
);
)
}
export default App;
export default App

View File

@@ -1,4 +1,4 @@
import React, { useState, useMemo, useRef, useCallback } from 'react'
import React from 'react'
import styled from 'styled-components'
import { useTable } from 'react-table'
import { DndProvider, useDrag, useDrop } from 'react-dnd'
@@ -37,9 +37,9 @@ const Styles = styled.div`
`
const Table = ({ columns, data }) => {
const [records, setRecords] = useState(data)
const [records, setRecords] = React.useState(data)
const getRowID = useCallback(row => {
const getRowID = React.useCallback(row => {
return row.id
}, [])
@@ -59,7 +59,10 @@ const Table = ({ columns, data }) => {
const dragRecord = records[dragIndex]
setRecords(
update(records, {
$splice: [[dragIndex, 1], [hoverIndex, 0, dragRecord]],
$splice: [
[dragIndex, 1],
[hoverIndex, 0, dragRecord],
],
})
)
}
@@ -98,8 +101,8 @@ const Table = ({ columns, data }) => {
const DND_ITEM_TYPE = 'row'
const Row = ({ row, index, moveRow }) => {
const dropRef = useRef(null)
const dragRef = useRef(null)
const dropRef = React.useRef(null)
const dragRef = React.useRef(null)
const [, drop] = useDrop({
accept: DND_ITEM_TYPE,
@@ -166,7 +169,7 @@ const Row = ({ row, index, moveRow }) => {
}
const App = () => {
const columns = useMemo(
const columns = React.useMemo(
() => [
{
Header: 'ID',

View File

@@ -1,4 +1,4 @@
import { useMemo } from 'react'
import React from 'react'
import { mergeProps, applyPropHooks, expandRows } from '../utils'
import { addActions, actions } from '../actions'
@@ -71,7 +71,7 @@ function useMain(instance) {
return row
})
const expandedRows = useMemo(() => {
const expandedRows = React.useMemo(() => {
if (process.env.NODE_ENV === 'development' && debug)
console.info('getExpandedRows')

View File

@@ -1,4 +1,4 @@
import { useMemo } from 'react'
import React from 'react'
import * as aggregations from '../aggregations'
import { addActions, actions } from '../actions'
@@ -142,7 +142,7 @@ function useMain(instance) {
return row
})
const groupedRows = useMemo(() => {
const groupedRows = React.useMemo(() => {
if (manualGroupBy || !groupBy.length) {
return rows
}