1
0

react-table-config.d.ts 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-table/Readme.md
  2. import {
  3. UseColumnOrderInstanceProps,
  4. UseColumnOrderState,
  5. UseExpandedHooks,
  6. UseExpandedInstanceProps,
  7. UseExpandedOptions,
  8. UseExpandedRowProps,
  9. UseExpandedState,
  10. UseFiltersColumnOptions,
  11. UseFiltersColumnProps,
  12. UseFiltersInstanceProps,
  13. UseFiltersOptions,
  14. UseFiltersState,
  15. UseGlobalFiltersColumnOptions,
  16. UseGlobalFiltersInstanceProps,
  17. UseGlobalFiltersOptions,
  18. UseGlobalFiltersState,
  19. UseGroupByCellProps,
  20. UseGroupByColumnOptions,
  21. UseGroupByColumnProps,
  22. UseGroupByHooks,
  23. UseGroupByInstanceProps,
  24. UseGroupByOptions,
  25. UseGroupByRowProps,
  26. UseGroupByState,
  27. UsePaginationInstanceProps,
  28. UsePaginationOptions,
  29. UsePaginationState,
  30. UseResizeColumnsColumnOptions,
  31. UseResizeColumnsColumnProps,
  32. UseResizeColumnsOptions,
  33. UseResizeColumnsState,
  34. UseRowSelectHooks,
  35. UseRowSelectInstanceProps,
  36. UseRowSelectOptions,
  37. UseRowSelectRowProps,
  38. UseRowSelectState,
  39. UseRowStateCellProps,
  40. UseRowStateInstanceProps,
  41. UseRowStateOptions,
  42. UseRowStateRowProps,
  43. UseRowStateState,
  44. UseSortByColumnOptions,
  45. UseSortByColumnProps,
  46. UseSortByHooks,
  47. UseSortByInstanceProps,
  48. UseSortByOptions,
  49. UseSortByState,
  50. } from 'react-table'
  51. declare module 'react-table' {
  52. // take this file as-is, or comment out the sections that don't apply to your plugin configuration
  53. export interface TableOptions<D extends Record<string, unknown>>
  54. extends UseExpandedOptions<D>,
  55. UseFiltersOptions<D>,
  56. UseGlobalFiltersOptions<D>,
  57. UseGroupByOptions<D>,
  58. UsePaginationOptions<D>,
  59. UseResizeColumnsOptions<D>,
  60. UseRowSelectOptions<D>,
  61. UseRowStateOptions<D>,
  62. UseSortByOptions<D>,
  63. // note that having Record here allows you to add anything to the options, this matches the spirit of the
  64. // underlying js library, but might be cleaner if it's replaced by a more specific type that matches your
  65. // feature set, this is a safe default.
  66. Record<string, unknown> {}
  67. export interface Hooks<D extends Record<string, unknown> = Record<string, unknown>>
  68. extends UseExpandedHooks<D>,
  69. UseGroupByHooks<D>,
  70. UseRowSelectHooks<D>,
  71. UseSortByHooks<D> {}
  72. export interface TableInstance<D extends Record<string, unknown> = Record<string, unknown>>
  73. extends UseColumnOrderInstanceProps<D>,
  74. UseExpandedInstanceProps<D>,
  75. UseFiltersInstanceProps<D>,
  76. UseGlobalFiltersInstanceProps<D>,
  77. UseGroupByInstanceProps<D>,
  78. UsePaginationInstanceProps<D>,
  79. UseRowSelectInstanceProps<D>,
  80. UseRowStateInstanceProps<D>,
  81. UseSortByInstanceProps<D> {}
  82. export interface TableState<D extends Record<string, unknown> = Record<string, unknown>>
  83. extends UseColumnOrderState<D>,
  84. UseExpandedState<D>,
  85. UseFiltersState<D>,
  86. UseGlobalFiltersState<D>,
  87. UseGroupByState<D>,
  88. UsePaginationState<D>,
  89. UseResizeColumnsState<D>,
  90. UseRowSelectState<D>,
  91. UseRowStateState<D>,
  92. UseSortByState<D> {}
  93. export interface ColumnInterface<D extends Record<string, unknown> = Record<string, unknown>>
  94. extends UseFiltersColumnOptions<D>,
  95. UseGlobalFiltersColumnOptions<D>,
  96. UseGroupByColumnOptions<D>,
  97. UseResizeColumnsColumnOptions<D>,
  98. UseSortByColumnOptions<D> {}
  99. export interface ColumnInstance<D extends Record<string, unknown> = Record<string, unknown>>
  100. extends UseFiltersColumnProps<D>,
  101. UseGroupByColumnProps<D>,
  102. UseResizeColumnsColumnProps<D>,
  103. UseSortByColumnProps<D> {}
  104. // eslint-disable-next-line unused-imports/no-unused-vars
  105. export interface Cell<D extends Record<string, unknown> = Record<string, unknown>, V = unknown>
  106. extends UseGroupByCellProps<D>,
  107. UseRowStateCellProps<D> {}
  108. export interface Row<D extends Record<string, unknown> = Record<string, unknown>>
  109. extends UseExpandedRowProps<D>,
  110. UseGroupByRowProps<D>,
  111. UseRowSelectRowProps<D>,
  112. UseRowStateRowProps<D> {}
  113. }