mirror of
https://github.com/gosticks/react-table.git
synced 2025-10-16 11:55:36 +00:00
28 KiB
28 KiB
| name | route |
|---|---|
| Changelog | /changelog |
React Table Changelog
7.0.4
- Fixed a regression where @scarf/scarf was somehow removed from the package dependencies
7.0.3
- Fixed an issue where unnecessary documentation dependencies were added when installing the library
- Fixed an issue where the
scriptsdirectory was not added to the npm package on build
7.0.2
- Fixed an issue where the internal flexRenderer would not work correctly in production due to the strangest friggin' minification bug I've ever encountered. 🤷♂️
7.0.1
- Added the
valueproperty to cell renderers so that destructurin the value from thecellproperty is now not necessary. This should help with people migrating from v6 and also just to cut down on noise in cell renderers - Fixed an issue where rollup would not build correctly
- Fixed an issue where a page index of
-1would result in an error
7.0.0 🎉
- Fixed an issue where page options array could be empty
- Fixed an issue where duplicate columns would be silently deduped. There is now a warning when duplicate columns are found based on their IDs
- Moved some functions around so they will get treeshaked with their respective plugins that use them.
- Fixed an issue where filters, sorting, or grouping changes would not reset pagination
- Added table and column level options for disabling global filters
- Fixed an issue where row selection was not deselecting rows
- Fixed an issue where flex table rendering was not giving the table a minimum width with necessary
- Fixed an issue where row selection would not work when using other row-transformative plugins like filters or grouping
- Fixed an issue where header groups were not memoized correctly
7.0.0-rc.16
- Moved away from snapshot tests. No more testing implementation details.
- Added
visibleColumnsandvisibleColumnsDepshooks to manipulate columns after all data is processed. Further visibility processing may result in these columns not being visible, such ashiddenColumnstate - The
useRowshook has been deprecated due to its dangerous nature 💀 - Added the
instance.rowsByIdobject - Renamed
instance.flatColumnstoinstance.allColumnswhich now accumulates ALL columns created for the table, visible or not. - Added the
instance.visibleColumnsobject - Fix an issue where
useAsyncDebouncewould crash when passed arguments - Started development on the
usePivotColumnsplugin, which can be tested currently using the_UNSTABLE_usePivotColumnsexport. - Renamed
cell.isRepeatedValuetocell.isPlaceholder - Removed
useConsumeHookGetteras it was inefficient most of the time and noisy - All hooks are now "consumed" right after main plugin functions are run. This means that any attempt to add a plugin after that will result in a runtime error (for good reason, since using hook points should not be a conditional or async operation)
- Added
instance.getHooksfor getting the list of hooks that was captured after plugins are run - Normalized all "toggle" actions to use an optional
valueproperty to set the value instead of toggle. Previously properties likeselected,groupBy, etc. were used, but not any more! - Undocument
instance.dispatch. Both plugins and users should be interacting with the table via methods assigned to the instance and other structures on the table. This should both reduce the surface API that React Table needs to expose and also the amount of documentation that is needed to understand how to use the API. useRowState'sinitialRowStateAccessorandinitialCellStateAccessoroptions now have a default ofrow => ({})andcell => ({})respectively.- Removed the concept of complex aggregations (eg.
column.aggregate = ['sum', 'count']). Instead, a better aggregation function signature is now used to allow for leaf node aggregation when needed. - Added the
column.aggregateValueoption which allows resolving (or pre-aggregating) a cell's value before it is grouped and aggregated across rows. This is useful for cell values that are not primitive, eg. an array of values that you may want to unique and count before summing that count across your groupings - The function signature for aggregation functions has changed to be
(leafValues, aggregatedValues) => aggregatedValuewhereleafValuesis a flat array containing all leaf rows currently grouped at the aggregation level andaggregatedValuesis an array containing the aggregated values from the immediate child sub rows. Each has purpose in the types of aggregations they power where optimizations are made for either accuracy or performance. - Fixed an issue where
setGlobalFilterwas not a stable callback - Added a Bootstrap UI example
- Added fixed with column support for useFlexLayout
- Fixed an issue where
manualGlobalFilterwas not resetting pagination properly - Fixed an issue where
useGlobalFiltercould be placed afterusePagination - Added the sort order direction as a parameter to the sortMethod function
- Fixed an issue where user filter types were not being referenced correctly
- Renamed the
row.getExpandedTogglePropstorow.getToggleRowExpandedProps - Renamed the
row.toggleExpandedmethod torow.toggleRowExpanded - Added the
instance.toggleRowExpandedandinstance.toggleAllRowsExpandedmethods - Added the
instance.getToggleAllRowsExpandedPropsprop getter - Added the
instance.filteredRowsByIdproperty - Added the
instance.preFilteredRowsByIdproperty - useFilters now properly updates the
instance.rowsByIdproperty - Added the
instance.globalFilteredRowsByIdproperty - Added the
instance.preGlobalFilteredRowsByIdproperty - useGlobalFilter now properly updates the
instance.rowsByIdproperty - Added the
instance.nonGroupedFlatRowsproperty - Added the
instance.nonGroupedRowsByIdproperty - Added the
instance.onlyGroupedFlatRowsproperty - Added the
instance.onlyGroupedRowsByIdproperty - Improved the api around ensuring plugin ordering
- Added more plugin order rules to avoid strange plugin integration results
7.0.0-rc.15
- Added
useGlobalFilterhook for performing table-wide filtering - Filter function signature has changed to supply an array of column IDs (to support both the tranditional single column style and the new multi-column search style introduced with
useGlobalFilter). - Removed the
columnparameter from the filter function signature as it was unused and no longer made sense with the array of IDs change above. - Updated the
filteringexample to use a global filter in addition to the column filters
7.0.0-rc.14
- Changed the function signature for all propGetter hooks to accept a single object of named meta properties instead of a variable length of meta arguments. The user props object has also been added as a property to all prop getters. For example,
hooks.getRowProps.push((props, instance, row) => [...])is now writtenhooks.getRowProps.push((props, { instance, row, userProps }) => [...]) - Changed the function signature for all reduceHooks accept a single object of named meta properties instead of a variable length of meta arguments. For example,
hooks.flatColumns.push((flatColumns, instance) => flatColumns)is now writtenhooks.flatColumns.push((flatColumns, { instance }) => flatColumns) - Changed the function signature for all loopHooks accept a single object of named meta properties instead of a variable length of meta arguments. For example,
hooks.prepareRow.push((row, instance) => void)is now writtenhooks.prepareRow.push((row, { instance }) => void)
7.0.0-rc.13
- Added the
useControlledStatehook for plugins to manipulate the final state of the table similar to how users can - Fixed an issue where column hiding wasn't working properly.
7.0.0-rc.12
- Fixed an issue where removing a grouped column would result in a crash
7.0.0-rc.11
- Fixed an issue where plugins using the
columnshook were not getting decorated properly - Added back a new rendition of the
useFlexLayoutplugin and accompanying example. - Fixed all reset actions to use the initial state passed into the table, then fall back to the default initial state for the hook
7.0.0-rc.10
- Optimizations made to make accessors, prop getters and other internals much faster. 10x in some cases!
- Fixed docs for
usePaginationto havepageIndexandpageSizeonly available on the state object, not the instance - Added a plugin order restriction to make sure
useResizeColumnsalways comes beforeuseAbsoluteLayout - Fixed the
useFinalInstancehook to not have an empty array as the first meta argument passed. - Fixed an issue where memoized or ref-forwarded components could not be used as cell renderers
- The
toggleExpandedByIdaction has been renamed totoggleExpanded - Added the
toggleAllExpandedaction - Added the
setExpandedaction - Changed
row.isAggregatedtorow.isGrouped state.expandedandstate.selectedRowIdsare now objects ({[rowId]: Bool}), not arrays. This should help with mid-to-large size datasets while also being serializable (instead of a Set(), which is not as reliable)state.filtersis now an array of objects ({id, value}). Since filters do have order and can be applied incrementally, it should be an array to ensure correct order.- Moved the
flatColumnsandflatColumnsDepshooks to be after row/data materialization. These hooks can then manipulate theflatColumnsobject after all data has been accessed without triggering row materialization again. - Added the
row.allCellsproperty and thecellColumnsreducer hook to determine which cells to create for each row. These cells are placed intorow.allCells. The resulting cell array is not meant to be used for display in templating and is only made available for convenience and/or advanced templating. - Added the
cellsreducer hook to determine which cells from therow.allCellsarray that should be placed intorow.cells. The resulting cell array is the one that is intended for display in templating. - Reducers are now passed the actual instance variable, not the instanceRef
- Added the
makeRendererutility (also exported) - Removed
column.groupByBoundaryfunctionality. If needed, use theflatColumnshook to decorate, reorganize or re-order groupBy columns - Fixed grouped row.id's to be truly unique
7.0.0-rc.9
- Fixed an issue where dependency hooks were not being reduced properly, thus the table would rerender unnecessarily
- Renamed
toggleRowSelectedAlltotoggleAllRowsSelected. Duh... - Added an
indeterminateboolean prop to the default props for row selection toggle prop getters - Renamed
selectedRowPathstoselectedRowIds, which also no longer contains paths, but row IDs - Grouped or nested row selection actions and state are now derived, instead of tracked in state.
- Rows now have a new property called
id, which existed before and was derived from thegetRowIdoption - Rows now also have an
isSomeSelectedprop when using theuseRowSelecthook, which denotes that at least one subRow is selected (if applicable) - Rows'
pathproperty has been deprecated in favor ofid - Expanded state is now tracked with row IDs instead of paths
- RowState is now tracked with row IDs instead of paths
toggleExpandedByPathhas been renamed totoggleExpandedById, and thus accepts a row ID now, instead of a row path
7.0.0-rc.8
- Fix an issue where
useResizeColumnswould crash when using the resizer prop getter - Fix an issue where
useBlockLayoutwas clobbering props sent to headers
7.0.0-rc.7
Removed:
applyHooks(exported but undocumented) function has been deprecated. Please use eitherreduceHooksorloopHooksutilities in your custom plugins now.applyPropHooks(exported but undocumented) function has been deprecated. Please use themakePropGetterutility in your custom plugins now.
Added:
reduceHooksexported utility which is used to reduce a value through a collection of hooks. Each hook must return a value (mutation is discouraged)loopHooksexported utility which is used to loop over a collection of hooks. Hooks are not allowed to return a value (mutation is encouraged)makePropGetterexported utility which is used to create prop getters from a prop getter hook.useOptionsplugin hook, which allows a plugin to reduce/modify the initial options being passed to the tableuseFinalInstanceplugin hook, which allows a plugin access to the final table instance before it is returned to the user.
Modified:
- Prop-getter hook functions now support returning an array (in addition to the typical object of props). When an array is returned, each item in the array is smart-merged into a new props object (meaning it will intelligently compose and override styles and className)
- Prop-getter function supplied to the table have 2 new overloaded options (in addition to the typical object of props):
Function(props, instance, ...row/col/context) => Array<props> | props- If a function is passed to a prop getter function, it will receive the previous props, the table instance, and potentially more context arguments. It is then be expected to return either an array of new props (to be smart-merged with styles and classes, the latest values taking priority over the previous values) or a props object (which will replace all previous props)Array<props>- If an array is passed to a prop getter function, each prop object in the array will be smart-merged with styles and classes into the props from previous hooks (with the latest values taking priority over the previous values).
- Extracted default hooks into separate file.
- Converted almost all usages of
instanceRef.currentto useuseGetLatest(instanceRef.current)to help with avoiding memory leaks and to be more terse. - Converted all previous prop-getter definitions to use the new
makePropGetter - Reorganized plugin hooks to declare as many hooks in the main plugin function as opposed to in the
useInstancehook. - Changed the
useInstanceBeforeDimensionshook to be aloopHookscall instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the instance) - Changed the
useInstancehook to be aloopHookscall instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the instance) - Change the
prepareRowhook to be aloopHookscall instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the row)
7.0.0-rc.6
- The
columnsBeforeHeaderGroupsandcolumnsBeforeHeaderGroupsDepshooks have been renamed toflatColumnsandflatColumnsDepsrespectively, which better reflects what they are used for, rather than their order, which can remain implicit. - Added
headerGroupsandheaderGroupDepshooks, which, similar toflatColumns, allow you to decorate (and trigger) the memoized header group generation. - Added
columnsandcolumnsDepshooks, which, similar toflatColumnsandheaderGroups, allow you to decorate (and trigger) the memoized column generation/decoration. - The new hook order is as follows:
columns/columnsDeps=>flatColumns/flatColumnsDeps=>headerGroups/headerGroupsDeps useColumnVisibilitynow uses the newheaderGroupsDepshook to trigger header group regeneration when visibility changes
7.0.0-rc.5
- Fixed an issue where the exported
useAsyncDebouncemethod would crash if its promise throw an error.
7.0.0-rc.4
- A maintenance release, purely intended to update the @latest tag (which was overwritten by a v6 publish)
7.0.0-rc.3
- Fixed an issue where
column.clearSortBywould crash
7.0.0-rc.2
reducerHandlershas been deprecated in favor of the newstateReducershook.- The
previousStateandinstanceRefare now both generally available in state reducers for convenience. - The global action property
action.instanceRefhas been deprecated.
- The
- The
reduceroption has been renamed tostateReducerand in addition to passing a single reducer function now also supports passing an array of reducers - Renamed
manualSortingto bemanualSortByto be consistent with other naming conventions - Removed the
getResetPageDepsoption in favor of the newautoResetPageoption. - Removed the
getResetFilterDepsoption in favor of the newautoResetFiltersoption. - Removed the
getResetSortByDepsoption in favor of the newautoResetSortByoption. - Removed the
getResetGroupByDepsoption in favor of the newautoResetGroupByoption. - Removed the
getResetExpandedDepsoption in favor of the newautoResetExpandedoption. - Added a new exported utility called
useAsyncDebounceto aid with external async side-effects. - A new
useGetLatesthook is used internally to track latest instances in a less ref-driven and verbose way. - A new
useMountedLayoutEffecthooks is now used internally to handle post-mount side-effects, mostly dealing with autoReset functionality - Plugin hooks are now "consumed" using an internal
useConsumeHookGetterhook. When they are consumed, they can no longer be manipulated past that point in the table lifecycle. This should help ensure people are using them in a relatively safe order with consistent expectations. - Drastically "reduced" the reducer logic itself to be easier to understand and to be a stable reference for the life of the table. This change also means that the reducer must no longer be double-run/back-compared by React for changes in closure, thus actions and stateReducers (including user state reducers) will only fire once per action.
- Removed
debugand related logging. It has been somewhat useful during development, but is now very noisy in the code. We can debug lifecycle and performance as needed from here on out. - Removed unnecessary exports from
./utils.jsand moved all intentionally exported utilities to a new./publicUtils.jsfile.
7.0.0-rc.1
- Minor regex optimizations during row path creation
7.0.0-rc.0
- Added the support for the
Footerrenderer,column.getFooterProps,footerGroupsandfooterGroup.getFooterProps
7.0.0-beta.28
- Added the
useColumnVisibilityplugin as a core plugin along with several new instance and column-level methods to control column visibility - Added the "column-hiding" example
7.0.0-beta.27
- Added the
useControlledStateoption, which allows for hook-context control of the resolved internal table state
7.0.0-beta.26
- Fixed an issue where the table would crash if useSortBy was reset via the resetSortBy action
- Updated all of the examples to use the "react-table@latest" tag.
utilsis no longer an exported variable and instead, all of the individual util methods are exported at the root level of the library.
7.0.0-beta.25
- Fixed an issue where
useRowStatewould crash due to invalid initial state of previous cell state oncolumnIdlookup
7.0.0-beta.24
- Changed
selectedRowIdsto use aSet()instead of an array for performance. - Removed types and related files from the repo. The community will now maintain types externally on Definitely Typed
7.0.0-beta.23
- The internal
useMainhook has been renamed touseInstance - The internal
useBeforeDimensionshook has been renamed touseInstanceBeforeDimensions - Fixed an issue where
useResizeColumnswasn't working properly
7.0.0-beta.22
- Fixed an issue where
useRowStatewould crash due to invalid initial state attempting to spread into the new state
7.0.0-beta.21
- Removed deprecated
defaultStateexport
7.0.0-beta.20
- Internals have been reworked to use
useReducerinstead ofuseStatefor stability and architecture - The
stateoption has been removed in favor of using a custom reducer - The
reduceroption has been changed to a new function signature:function (newState, action, oldState) => newState - The
setStatetable instance method is no longer supported - The
dispatchtable instanced method was added - The
ReactTable.actionsexport is now a plain object of action types mapped to identically named action strings - The
ReactTable.reducerHandlersexport was added, which is a plain object of plugin hook names mapped to their respective reducer functions
7.0.0-beta.19
- Added an
isAggregatedboolean parameter to theaggregatefunction signature
7.0.0-beta.16
- Removed service workers from examples
- Fixed a memory leak when
instancewas 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
defaultGetResetPageDepswas usingdatainstead ofrows
7.0.0-beta.14
- Removed
disablePageResetOnDataChangeoption. use thegetResetPageDepsoption now.
- Added
getResetPageDepsoptiongetResetFilterDepsoptiongetResetSortByDepsoptiongetResetGroupByDepsoptiongetResetExpandedDepsoption
7.0.0-beta.13
- Added options
defaultCanSortdefaultCanFilterdefaultCanGroupBycolumn.defaultCanSortcolumn.defaultCanFiltercolumn.defaultCanGroupBy
- Renamed
disableGroupingtodisableGroupBydisableSortingtodisableSortBydisableGroupBytodisableGroupBycolumn.disableGroupingtocolumn.disableGroupBycolumn.disableSortingtocolumn.disableSortBycolumn.disableGroupBytocolumn.disableGroupBy
- Removed propType definitions. Since types are now being maintained, it makes little sense to also maintain these. Cooincidentally, this also saves some bundle size in some scenarios where they may not be removed properly by a developer's bundler.
7.0.0-beta.0
- Massive changes to the entire project and library. Please consult the README and documentation for more information regarding these changes.
6.8.6
Fixes & Optimizations
- Since
resolveDatais now capable of materializing data on it's own, thedataprop is no longer required as a prop-type.
6.8.4
Fixes & Optimizations
- Only run
resolveDataprop whendataprop has changed, not any others.
6.8.3
Fixes & Optimizations
- Allow the
resolveDataprop to alter or materialize new data when thedataprop changes.
6.8.1
Fixes & Optimizations
- Updated eslint and code formatting
6.7.5
Fixes & Optimizations
- Now passes
columntogetResizerProps(#667) - NOTE:
getResizerPropsis now only called if the column is resizable - Fixes the
classNameordering in defaultProps for ThComponent (#673) - NOTE: user supplied classNames now come at the end so they can extend the defaults
6.7.4
Fixes & Optimizations
- Fix Prop types for columns
6.7.3
Fixes & Optimizations
- Fix the rest of the proptypes
6.7.2
Fixes & Optimizations
getPropTypesproptype check
6.7.1
Fixes & Optimizations
eslint-configmoved to dev deps
6.7.0
6.7.0-alpha-0
New Features
- Expose page/pageSize to rows/cells
- Supply sort direction to custom sort methods
Fixes & Optimizations
- README updates
- Linter cleanup
- Added PropTypes node module
- Deps, linting and style upgrades
6.6.0
Fixes & Optimizations
- moved repo to react-tools
- Doc examples moved to codesandbox.io
- README updates
- CSS refacting for rt-tfoot to match rt-thead
- CSS more specific for input and select
6.5.3
Fixes & Optimizations
onClickproxying and eslint
6.5.2
New Features
- Provide onClick handleOriginal function - #406
Fixes & Optimizations
- README updates
makePathArrayin utils - #326- Various fixes: #294, #376, #398, #415,
6.5.1
Fixes & Optimizations
defaultExpandednow works correctly - #372column.getProps().restprops are now applied correctlymakeTemplateComponentnow supportsdisplayName- #289
6.5.0
New Features
column.filterAll- defaults tofalse, but when set totruewill provide the entire array of rows tofilterMethodas opposed to one row at a time. This allows for more fine-grained filtering using any method you can dream up. See the Custom Filtering example for more info.
6.4.0
New Features
PadRowComponent- the content rendered inside of a padding row. Defaults to a react component that renders
6.3.0
New Features
defaultSortDesc- allows you to set the default sorting direction for all columns to descending.column.defaultSortDesc- allows you to set the default sorting direction for a specific column. Falls back to the globaldefaultSortDescwhen not set at all.
6.0.0
New Features
- New Renderers:
Aggregated- Custom renderer for aggregated cellsPivot- Custom renderer for Pivoted Cells (utilizesExpanderandPivotValue)PivotValue- Custom renderer for Pivot cell values (deprecates the undocumentedpivotRenderoption)Expander- Custom renderer for Pivot cell Expander
- Added custom sorting methods per table via
defaultSortMethodand per column viacolumn.sortMethod - Pivot columns are now visibly separate and sorted/filtered independently.
- Added
column.resizableto override global tableresizableoption for specific columns. - Added
column.sortableto override global tablesortableoption for specific columns. - Added
column.filterableto override global tablefilterableoption for specific columns. - Added
defaultExpandedtable option. - All callbacks can now be utilized without needing to hoist and manage the piece of state they export. That is what their prop counterparts are for, so now the corresponding prop is used instead of the callback to detect a "fully controlled" state.
- Prevent transitions while column resizing for a smoother resize effect.
- Disable text selection while resizing columns.
Breaking API Changes
- New Renderers:
Cell- deprecates and replacesrenderHeader- deprecates and replacesheaderFooter- deprecates and replacesfooterFilter- deprecates and replacesfilterRender
- Callbacks now provide the destination state as the primary parameter(s). This makes hoisting and controlling the state in redux or component state much easier. eg.
onSortingno longer requires you to build your own toggle logiconResizeno longer requires you to build your own resize logic
- Renamed
onChangecallback ->onFetchDatawhich will always fire when a new data model needs to be fetched (or if not usingmanual, when new data is materialized internally). - Renamed
filtering->filtered - Renamed
sorting->sorted - Renamed
expandedRows->expanded - Renamed
resizing->resized - Renamed
defaultResizing->defaultResized - Renamed
defaultFiltering->defaultFiltered - Renamed
defaultSorting->defaultSorted - Renamed
onSortingChange->onSortedChange - Renamed
onFilteringChange->onFilteredChange - Renamed
onResize->onResizedChange - Renamed
onExpandRow->onExpandedChange - Renamed
showFilters->filterable - Renamed
hideFilter->filterable(Column option. Note the true/false value is now flipped.) cellInfo.rowandrowInfo.rownow reference the materialize data for the table. To reference the original row, usecellInfo.originalandrowInfo.original- Removed
pivotRendercolumn option. You can now control how the value is displayed by overriding thePivotValueComponentor the individual column'sPivotValuerenderer. See Pivoting Options Story for a reference on how to customize pivot column rendering.