Commit Graph

12 Commits

Author SHA1 Message Date
Andros Rosa Llop
e924b80709 Fix types of getRowID & getSubRows (#1651)
Closes: https://github.com/tannerlinsley/react-table/issues/1628
2019-11-25 12:25:09 -07:00
Andros Rosa Llop
461aa0df96 Types: getGroupByToggleProps was lost (#1654)
* There it was, on an unused UseGroupByHeaderProps interface, while it should have been on UseGroupByColumnProps.
2019-11-22 19:31:14 -07:00
Tanner Linsley
3187061041 Use effect dependency user call 2019-11-20 12:09:24 -07:00
Tanner Linsley
58028e45fc Rename disableGrouping, remove propTypes, update Readme 2019-11-20 10:23:52 -07:00
ggascoigne
3b03ea32f5 remove Record from HeaderProps and CellProps (#1601)
These definitions mask errors in the other definitions and there are better
ways of extending these.

See https://github.com/tannerlinsley/react-table/pull/1597 for an
example of an existing prototype that was missing but harder to find
because of these definitions.
2019-11-05 14:37:06 -07:00
Michael Stramel
4b7c85624b Add selectedFlatRows (#1597) 2019-10-14 16:17:37 -06:00
Christian Murphy
62924dea9b refactor: update complex types to use Array<> syntax (#1587)
re-enables dtslint array type rule
2019-10-10 15:39:32 -06:00
Michael Li
062a8c12b5 update selectedRows based on 7.0.beta.8 (#1586) 2019-10-10 15:37:26 -06:00
Michael Stramel
36ba233e27 Updating types (#1535)
* Attempt to bring into alignment

fix plugin hook definitions

Remove old prop

Format

fix Header and Cell props

Rename prop

Abstract props to definitions

fix bad generic

fix typo

Revert "fix typo"

This reverts commit 1ca58c5d8fb017bb0af79dd4aa4f0cd296e7a7e8.

fix

* Remove documented prop

* Tweaks

* Re-add comment

* Some updates

* more changes

* Convert to interfaces

* more fixes

* rename sortByFn params

* Fixes

* Fix setFilter

* Hopefully the last changes

* Bump TypeScript Version for declaration file

Co-Authored-By: Christian Murphy <christian.murphy.42@gmail.com>

* format

* Linting

* fix typo

* expose defaultState

* swap aggregatedValue

* Allow cellvalue for accessor function return

* modifications

* manually added changes from ggascoigne

* remove changes from examples folder
2019-10-09 15:15:00 -06:00
tannerlinsley
bbfc6428b7 refactor(usetable/usetablestate): integrate useTableState into useTable
useTableState was an early and hasty abstraction that hasn't proved useful in many ways. Anything
you could do with useTableState, you could easily do using the same options (assuming they exist) in
the useTable hook. For this reason, state is now a first class citizen of the useTable hook, along
with more sane properties and option locations for anything pertaining to state.
2019-10-05 20:48:28 -06:00
ggascoigne
7ab6385839 TypeScript updates (#1521)
* TypeScript updates

I've found that trying to get solid TypeScript typings for this library
are a bit of a challenge.  The composable nature of the library means
that the types for the builtin functions are by their nature somewhat
minimal, and that the user needs to be able to extend those interfaces
to reflect the specific plugins that are in use.

With that in mind I propose something like this.

To get the best out of them, you then need to extend those interfaces
using declaration merging, see
https://www.typescriptlang.org/docs/handbook/declaration-merging.html

e.g.

```ts
declare module 'react-table-hooks' {
  export interface TableInstance<D = any>
    extends UseFiltersValues<D>,
      UsePaginationValues<D>,
      UseExpandedValues,
      UseGroupByValues {}

  export interface TableState<D = any>
    extends UsePaginationState,
      UseGroupByState,
      UseSortbyState<D>,
      UseFiltersState<D> {}
}
```

This also puts the ability to extend those types with any user defined
hooks completely in the users hands.

This gives the greatest flexibility, but I'll admit that it isn't
particularly obvious.  Perhaps a typescript readme and example is needed.

* fix useExpanded type

* fix module name

* fix typo

* address review feedback

* add IdType, update Filters definition
2019-09-20 09:37:45 -06:00
Michael Stramel
670a92734e Add typings (#1511) 2019-09-12 09:39:53 -06:00