From 4868d7835fdc77c8d360c9875bf5cbb5d37b1e5a Mon Sep 17 00:00:00 2001 From: "size-plugin[bot]" <52573255+size-plugin[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2019 04:37:43 +0000 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=98=96=20=F0=9F=92=87=F0=9F=8F=BE?= =?UTF-8?q?=E2=80=8D=E2=99=80=EF=B8=8F=20update=20sizes-cjs.json=20?= =?UTF-8?q?=F0=9F=91=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sizes-cjs.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sizes-cjs.json b/sizes-cjs.json index e17915a..9a766c0 100644 --- a/sizes-cjs.json +++ b/sizes-cjs.json @@ -1,4 +1,14 @@ [ + { + "timestamp": 1575607054721, + "files": [ + { + "filename": "index.js", + "size": 21447, + "delta": 26 + } + ] + }, { "timestamp": 1575605755429, "files": [ From d1677dfebb20f82d56e9a9b40bc6727d75120be4 Mon Sep 17 00:00:00 2001 From: "size-plugin[bot]" <52573255+size-plugin[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2019 04:37:44 +0000 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=87=BB=F0=9F=87=A8=20=F0=9F=A4=B0?= =?UTF-8?q?=F0=9F=8F=BB=20update=20sizes-es.json=20=F0=9F=91=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sizes-es.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sizes-es.json b/sizes-es.json index 2e984af..dba698c 100644 --- a/sizes-es.json +++ b/sizes-es.json @@ -1,4 +1,14 @@ [ + { + "timestamp": 1575607059725, + "files": [ + { + "filename": "index.es.js", + "size": 21226, + "delta": 26 + } + ] + }, { "timestamp": 1575605764195, "files": [ From 546cb4e0769164fb3c192183dcb7d395bbdb3d3e Mon Sep 17 00:00:00 2001 From: ggascoigne Date: Thu, 5 Dec 2019 22:18:48 -0800 Subject: [PATCH 3/7] put useFilters docs in correct file (#1723) --- docs/api/useFilters.md | 96 +++++++++++++++++++++++++++++++++++++++++ docs/api/useSortBy.md | 97 ------------------------------------------ 2 files changed, 96 insertions(+), 97 deletions(-) create mode 100644 docs/api/useFilters.md diff --git a/docs/api/useFilters.md b/docs/api/useFilters.md new file mode 100644 index 0000000..b6e9f78 --- /dev/null +++ b/docs/api/useFilters.md @@ -0,0 +1,96 @@ +# `useFilters` + +- Plugin Hook +- Optional + +`useFilters` is the hook that implements **row filtering**. + +### Table Options + +The following options are supported via the main options object passed to `useTable(options)` + +- `state.filters: Object` + - Must be **memoized** + - An object of columnId's and their corresponding filter values. This information is stored in state since the table is allowed to manipulate the filter through user interaction. +- `initialState.filters` + - Identical to the `state.filters` option above +- `manualFilters: Bool` + - Enables filter detection functionality, but does not automatically perform row filtering. + - Turn this on if you wish to implement your own row filter outside of the table (eg. server-side or manual row grouping/nesting) +- `disableFilters: Bool` + - Disables filtering for every column in the entire table. +- `defaultCanFilter: Bool` + - Optional + - Defaults to `false` + - If set to `true`, all columns will be filterable, regardless if they have a valid `accessor` +- `filterTypes: Object` + - Must be **memoized** + - Allows overriding or adding additional filter types for columns to use. If a column's filter type isn't found on this object, it will default to using the built-in filter types. + - For more information on filter types, see Filtering +- `getResetFiltersDeps: Function(instance) => [...useEffectDependencies]` + - Optional + - Defaults to `false` + - If set, the dependencies returned from this function will be used to determine when the effect to reset the `filters` state is fired. + - To disable, set to `false` + - For more information see the FAQ ["How do I stop my table state from automatically resetting when my data changes?"](./faq#how-do-i-stop-my-table-state-from-automatically-resetting-when-my-data-changes) + +### Column Options + +The following options are supported on any `Column` object passed to the `columns` options in `useTable()` + +- `Filter: Function | React.Component => JSX` + - **Required** + - Receives the table instance and column model as props + - Must return valid JSX + - This function (or component) is used to render this column's filter UI, eg. +- `disableFilters: Bool` + - Optional + - If set to `true`, will disable filtering for this column +- `defaultCanFilter: Bool` + - Optional + - Defaults to `false` + - If set to `true`, this column will be filterable, regardless if it has a valid `accessor` +- `filter: String | Function` + - Optional + - Defaults to `text` + - The resolved function from the this string/function will be used to filter the this column's data. + - If a `string` is passed, the function with that name located on either the custom `filterTypes` option or the built-in filtering types object will be used. If + - If a `function` is passed, it will be used directly. + - For more information on filter types, see Filtering + - If a **function** is passed, it must be **memoized** + +### Instance Properties + +The following values are provided to the table `instance`: + +- `rows: Array` + - An array of **filtered** rows. +- `preFilteredRows: Array` + - The array of rows **used right before filtering**. + - Among many other use-cases, these rows are directly useful for building option lists in filters, since the resulting filtered `rows` do not contain every possible option. +- `setFilter: Function(columnId, filterValue) => void` + - An instance-level function used to update the filter value for a specific column. +- `setAllFilters: Function(filtersObject) => void` + - An instance-level function used to update the values for **all** filters on the table, all at once. + +### Column Properties + +The following properties are available on every `Column` object returned by the table instance. + +- `canFilter: Bool` + - Denotes whether a column is filterable or not depending on if it has a valid accessor/data model or is manually disabled via an option. +- `setFilter: Function(filterValue) => void` + - A column-level function used to update the filter value for this column +- `filterValue: any` + - The current filter value for this column, resolved from the table state's `filters` object +- `preFilteredRows: Array` + - The array of rows that were originally passed to this columns filter **before** they were filtered. + - This array of rows can be useful if building faceted filter options. +- `filteredRows: Array` + - The resulting array of rows received from this columns filter **after** they were filtered. + - This array of rows can be useful if building faceted filter options. + +### Example + +- [Source](https://github.com/tannerlinsley/react-table/tree/master/examples/filtering) +- [Open in CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/filtering) diff --git a/docs/api/useSortBy.md b/docs/api/useSortBy.md index c23b3a8..62c938c 100644 --- a/docs/api/useSortBy.md +++ b/docs/api/useSortBy.md @@ -125,100 +125,3 @@ The following properties are available on every `Column` object returned by the - [Source](https://github.com/tannerlinsley/react-table/tree/master/examples/sorting) - [Open in CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/sorting) - -# `useFilters` - -- Plugin Hook -- Optional - -`useFilters` is the hook that implements **row filtering**. - -### Table Options - -The following options are supported via the main options object passed to `useTable(options)` - -- `state.filters: Object` - - Must be **memoized** - - An object of columnId's and their corresponding filter values. This information is stored in state since the table is allowed to manipulate the filter through user interaction. -- `initialState.filters` - - Identical to the `state.filters` option above -- `manualFilters: Bool` - - Enables filter detection functionality, but does not automatically perform row filtering. - - Turn this on if you wish to implement your own row filter outside of the table (eg. server-side or manual row grouping/nesting) -- `disableFilters: Bool` - - Disables filtering for every column in the entire table. -- `defaultCanFilter: Bool` - - Optional - - Defaults to `false` - - If set to `true`, all columns will be filterable, regardless if they have a valid `accessor` -- `filterTypes: Object` - - Must be **memoized** - - Allows overriding or adding additional filter types for columns to use. If a column's filter type isn't found on this object, it will default to using the built-in filter types. - - For more information on filter types, see Filtering -- `getResetFiltersDeps: Function(instance) => [...useEffectDependencies]` - - Optional - - Defaults to `false` - - If set, the dependencies returned from this function will be used to determine when the effect to reset the `filters` state is fired. - - To disable, set to `false` - - For more information see the FAQ ["How do I stop my table state from automatically resetting when my data changes?"](./faq#how-do-i-stop-my-table-state-from-automatically-resetting-when-my-data-changes) - -### Column Options - -The following options are supported on any `Column` object passed to the `columns` options in `useTable()` - -- `Filter: Function | React.Component => JSX` - - **Required** - - Receives the table instance and column model as props - - Must return valid JSX - - This function (or component) is used to render this column's filter UI, eg. -- `disableFilters: Bool` - - Optional - - If set to `true`, will disable filtering for this column -- `defaultCanFilter: Bool` - - Optional - - Defaults to `false` - - If set to `true`, this column will be filterable, regardless if it has a valid `accessor` -- `filter: String | Function` - - Optional - - Defaults to `text` - - The resolved function from the this string/function will be used to filter the this column's data. - - If a `string` is passed, the function with that name located on either the custom `filterTypes` option or the built-in filtering types object will be used. If - - If a `function` is passed, it will be used directly. - - For more information on filter types, see Filtering - - If a **function** is passed, it must be **memoized** - -### Instance Properties - -The following values are provided to the table `instance`: - -- `rows: Array` - - An array of **filtered** rows. -- `preFilteredRows: Array` - - The array of rows **used right before filtering**. - - Among many other use-cases, these rows are directly useful for building option lists in filters, since the resulting filtered `rows` do not contain every possible option. -- `setFilter: Function(columnId, filterValue) => void` - - An instance-level function used to update the filter value for a specific column. -- `setAllFilters: Function(filtersObject) => void` - - An instance-level function used to update the values for **all** filters on the table, all at once. - -### Column Properties - -The following properties are available on every `Column` object returned by the table instance. - -- `canFilter: Bool` - - Denotes whether a column is filterable or not depending on if it has a valid accessor/data model or is manually disabled via an option. -- `setFilter: Function(filterValue) => void` - - A column-level function used to update the filter value for this column -- `filterValue: any` - - The current filter value for this column, resolved from the table state's `filters` object -- `preFilteredRows: Array` - - The array of rows that were originally passed to this columns filter **before** they were filtered. - - This array of rows can be useful if building faceted filter options. -- `filteredRows: Array` - - The resulting array of rows received from this columns filter **after** they were filtered. - - This array of rows can be useful if building faceted filter options. - -### Example - -- [Source](https://github.com/tannerlinsley/react-table/tree/master/examples/filtering) -- [Open in CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/filtering) From 3d5249b716bc1084894cdb51b62faf1eec24f0ff Mon Sep 17 00:00:00 2001 From: gargroh <42495927+gargroh@users.noreply.github.com> Date: Fri, 6 Dec 2019 13:49:28 +0530 Subject: [PATCH 4/7] [useSortBy] updating missed key rename (#1724) --- src/plugin-hooks/useSortBy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugin-hooks/useSortBy.js b/src/plugin-hooks/useSortBy.js index e433b69..d745e0f 100755 --- a/src/plugin-hooks/useSortBy.js +++ b/src/plugin-hooks/useSortBy.js @@ -40,7 +40,7 @@ reducerHandlers[pluginName] = (state, action) => { if (action.type === actions.clearSortBy) { const { sortBy } = state - const newSortBy = sortBy.filter(d => d.id !== action.columnID) + const newSortBy = sortBy.filter(d => d.id !== action.columnId) return { ...state, From ace8f56371280b68a2a4487af111d65b6be3d3c8 Mon Sep 17 00:00:00 2001 From: "size-plugin[bot]" <52573255+size-plugin[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2019 08:21:01 +0000 Subject: [PATCH 5/7] =?UTF-8?q?=F0=9F=87=A6=F0=9F=87=AA=20=F0=9F=92=A8=20u?= =?UTF-8?q?pdate=20sizes-cjs.json=20=F0=9F=91=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sizes-cjs.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sizes-cjs.json b/sizes-cjs.json index 9a766c0..56d4826 100644 --- a/sizes-cjs.json +++ b/sizes-cjs.json @@ -1,4 +1,14 @@ [ + { + "timestamp": 1575620433902, + "files": [ + { + "filename": "index.js", + "size": 21446, + "delta": -1 + } + ] + }, { "timestamp": 1575607054721, "files": [ From f824fea2ef00099bf6fb9714759fbdf304ffeaa2 Mon Sep 17 00:00:00 2001 From: "size-plugin[bot]" <52573255+size-plugin[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2019 08:21:02 +0000 Subject: [PATCH 6/7] =?UTF-8?q?=F0=9F=99=8D=F0=9F=8F=BF=20=E2=99=9F?= =?UTF-8?q?=EF=B8=8F=20update=20sizes-es.json=20=F0=9F=91=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sizes-es.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sizes-es.json b/sizes-es.json index dba698c..d96165b 100644 --- a/sizes-es.json +++ b/sizes-es.json @@ -1,4 +1,14 @@ [ + { + "timestamp": 1575620442742, + "files": [ + { + "filename": "index.es.js", + "size": 21225, + "delta": -1 + } + ] + }, { "timestamp": 1575607059725, "files": [ From 176986a07ad8b25907fff435e1246962dba18e47 Mon Sep 17 00:00:00 2001 From: Alberico <38522984+breizh24@users.noreply.github.com> Date: Fri, 6 Dec 2019 16:25:15 +0100 Subject: [PATCH 7/7] docs(docs/api/readme.md): fix to useTable link that was giving 404 (#1726) In the /docs/api/README.md the useTable link was linking to the file ./usetable.md that doesn't exist, now it links to ./useTable --- .size-snapshot.json | 4 ++-- docs/api/README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.size-snapshot.json b/.size-snapshot.json index 3b4b172..53440b4 100644 --- a/.size-snapshot.json +++ b/.size-snapshot.json @@ -2,12 +2,12 @@ "dist/index.js": { "bundled": 102847, "minified": 50399, - "gzipped": 12909 + "gzipped": 12905 }, "dist/index.es.js": { "bundled": 101791, "minified": 49456, - "gzipped": 12726, + "gzipped": 12722, "treeshaked": { "rollup": { "code": 78, diff --git a/docs/api/README.md b/docs/api/README.md index f076137..f5aee21 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -5,7 +5,7 @@ React Table uses React Hooks both internally and externally for almost all of it React Table is essentially a compatible collection of **custom React hooks**: - The primary React Table hook - - [`useTable`](./usetable.md) + - [`useTable`](./useTable.md) - Plugin Hooks - Core Plugin Hooks - [`useGroupBy`](./useGroupBy.md)