mirror of
https://github.com/gosticks/react-table.git
synced 2026-08-19 08:20:30 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
792c3ec392 |
+6
-6
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"dist/index.js": {
|
||||
"bundled": 90287,
|
||||
"minified": 43056,
|
||||
"gzipped": 11505
|
||||
"bundled": 90278,
|
||||
"minified": 43057,
|
||||
"gzipped": 11502
|
||||
},
|
||||
"dist/index.es.js": {
|
||||
"bundled": 89704,
|
||||
"minified": 42548,
|
||||
"gzipped": 11385,
|
||||
"bundled": 89695,
|
||||
"minified": 42549,
|
||||
"gzipped": 11382,
|
||||
"treeshaked": {
|
||||
"rollup": {
|
||||
"code": 450,
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
## 7.0.0-beta.19
|
||||
|
||||
- Added an `isAggregated` boolean parameter to the `aggregate` function signature
|
||||
|
||||
## 7.0.0-beta.16
|
||||
|
||||
- Removed service workers from examples
|
||||
- Fixed a memory leak when `instance` was referenced in function closures
|
||||
- Fixed an issue where the table would infinitely rerender due to incorrect effect dependencies
|
||||
- Fixed an issue where row grouping and row selection would not work properly together.
|
||||
|
||||
## 7.0.0-beta.15
|
||||
|
||||
- Fixed an issue where `defaultGetResetPageDeps` was using `data` instead of `rows`
|
||||
|
||||
@@ -601,12 +601,6 @@ The following options are supported on any `Column` object passed to the `column
|
||||
- Receives the table instance and cell model as props
|
||||
- Must return valid JSX
|
||||
- This function (or component) formats this column's value when it is being grouped and aggregated, eg. If this column was showing the number of visits for a user to a website and it was currently being grouped to show an **average** of the values, the `Aggregated` function for this column could format that value to `1,000 Avg. Visits`
|
||||
- `aggregate: String | [String, String] | Function(values, rows, isAggregated: Bool) => any`
|
||||
- If a single `String` is passed, it must be the key of either a user defined or predefined `aggregations` function.
|
||||
- If a tuple array of `[String, String]` is passed, both must be a key of either a user defined or predefined `aggregations` function.
|
||||
- The first is used to aggregate raw values, eg. `sum`-ing raw values together
|
||||
- The second is used to aggregate values that have already been aggregated, eg. `average`-ing the sums produced by the raw aggregation level
|
||||
- If a `Function` is passed, this function will receive the `values`, original `rows` of those values, and an `isAggregated` `Bool` of whether or not the values and rows have already been aggregated.
|
||||
- `disableGroupBy: Boolean`
|
||||
- Defaults to `false`
|
||||
- If `true`, will disable grouping for this column.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-table",
|
||||
"version": "7.0.0-beta.20",
|
||||
"version": "7.0.0-beta.19",
|
||||
"description": "A fast, lightweight, opinionated table and datagrid built on React",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/tannerlinsley/react-table#readme",
|
||||
|
||||
@@ -163,7 +163,7 @@ function useMain(instance) {
|
||||
// Find the columns that can or are aggregating
|
||||
|
||||
// Uses each column to aggregate rows into a single value
|
||||
const aggregateRowsToValues = (rows, isAggregated) => {
|
||||
const aggregateRowsToValues = (rows, isSourceRows) => {
|
||||
const values = {}
|
||||
|
||||
flatColumns.forEach(column => {
|
||||
@@ -184,7 +184,7 @@ function useMain(instance) {
|
||||
`React Table: Complex aggregators must have 2 values, eg. aggregate: ['sum', 'count']. More info above...`
|
||||
)
|
||||
}
|
||||
if (isAggregated) {
|
||||
if (isSourceRows) {
|
||||
aggregator = aggregator[1]
|
||||
} else {
|
||||
aggregator = aggregator[0]
|
||||
@@ -197,7 +197,7 @@ function useMain(instance) {
|
||||
: userAggregations[aggregator] || aggregations[aggregator]
|
||||
|
||||
if (aggregateFn) {
|
||||
values[column.id] = aggregateFn(columnValues, rows, isAggregated)
|
||||
values[column.id] = aggregateFn(columnValues, rows)
|
||||
} else if (aggregator) {
|
||||
console.info({ column })
|
||||
throw new Error(
|
||||
@@ -235,7 +235,10 @@ function useMain(instance) {
|
||||
|
||||
subRows = groupRecursively(subRows, depth + 1, path)
|
||||
|
||||
const values = aggregateRowsToValues(subRows, depth < groupBy.length)
|
||||
const values = aggregateRowsToValues(
|
||||
subRows,
|
||||
depth + 1 >= groupBy.length
|
||||
)
|
||||
|
||||
const row = {
|
||||
isAggregated: true,
|
||||
|
||||
Reference in New Issue
Block a user