@databiosphere/findable-ui 33.0.0 → 34.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +18 -0
  3. package/jest.config.js +4 -0
  4. package/lib/common/entities.d.ts +3 -1
  5. package/lib/components/DataDictionary/components/Entities/entities.d.ts +1 -1
  6. package/lib/components/DataDictionary/components/Entities/entities.js +3 -2
  7. package/lib/components/DataDictionary/components/Entities/types.d.ts +3 -4
  8. package/lib/components/DataDictionary/components/Entity/entity.d.ts +1 -1
  9. package/lib/components/DataDictionary/components/Entity/entity.js +12 -6
  10. package/lib/components/DataDictionary/components/Entity/entity.styles.js +7 -1
  11. package/lib/components/DataDictionary/components/Entity/types.d.ts +4 -4
  12. package/lib/components/DataDictionary/components/Entity/utils.d.ts +9 -0
  13. package/lib/components/DataDictionary/components/Entity/utils.js +18 -0
  14. package/lib/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.d.ts +4 -0
  15. package/lib/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.js +9 -0
  16. package/lib/components/DataDictionary/components/Filters/components/ColumnFilters/types.d.ts +5 -0
  17. package/lib/components/DataDictionary/components/Filters/components/ColumnFilters/types.js +1 -0
  18. package/lib/components/DataDictionary/components/Filters/filters.d.ts +4 -0
  19. package/lib/components/DataDictionary/components/Filters/filters.js +7 -0
  20. package/lib/components/DataDictionary/components/Filters/filters.styles.d.ts +7 -0
  21. package/lib/components/DataDictionary/components/Filters/filters.styles.js +13 -0
  22. package/lib/components/DataDictionary/components/Filters/stories/constants.d.ts +4 -0
  23. package/lib/components/DataDictionary/components/Filters/stories/constants.js +25 -0
  24. package/lib/components/DataDictionary/components/Filters/stories/filters.stories.d.ts +6 -0
  25. package/lib/components/DataDictionary/components/Filters/stories/filters.stories.js +31 -0
  26. package/lib/components/DataDictionary/components/Filters/stories/hook.d.ts +5 -0
  27. package/lib/components/DataDictionary/components/Filters/stories/hook.js +5 -0
  28. package/lib/components/DataDictionary/components/Filters/stories/types.d.ts +4 -0
  29. package/lib/components/DataDictionary/components/Filters/stories/types.js +1 -0
  30. package/lib/components/DataDictionary/components/Filters/types.d.ts +5 -0
  31. package/lib/components/DataDictionary/components/Filters/types.js +1 -0
  32. package/lib/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.js +3 -1
  33. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.d.ts +2 -0
  34. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.js +5 -0
  35. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.d.ts +5 -0
  36. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.js +24 -0
  37. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/types.d.ts +5 -0
  38. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/types.js +1 -0
  39. package/lib/components/DataDictionary/components/Layout/components/OutlineLayout/outlineLayout.styles.js +1 -1
  40. package/lib/components/DataDictionary/components/Layout/components/TitleLayout/titleLayout.styles.js +1 -0
  41. package/lib/components/DataDictionary/components/Layout/constants.d.ts +4 -0
  42. package/lib/components/DataDictionary/components/Layout/constants.js +4 -0
  43. package/lib/components/DataDictionary/components/Outline/utils.d.ts +5 -5
  44. package/lib/components/DataDictionary/components/Outline/utils.js +23 -6
  45. package/lib/components/DataDictionary/components/Table/hook.d.ts +3 -3
  46. package/lib/components/DataDictionary/components/Table/hook.js +11 -3
  47. package/lib/components/DataDictionary/components/Table/options/columnFilters/constants.d.ts +2 -0
  48. package/lib/components/DataDictionary/components/Table/options/columnFilters/constants.js +8 -0
  49. package/lib/components/DataDictionary/components/Table/options/columnFilters/hook.d.ts +6 -0
  50. package/lib/components/DataDictionary/components/Table/options/columnFilters/hook.js +14 -0
  51. package/lib/components/DataDictionary/components/Table/options/expanded/constants.d.ts +2 -0
  52. package/lib/components/DataDictionary/components/Table/options/expanded/constants.js +5 -0
  53. package/lib/components/DataDictionary/components/Table/options/faceted/constants.d.ts +2 -0
  54. package/lib/components/DataDictionary/components/Table/options/faceted/constants.js +6 -0
  55. package/lib/components/DataDictionary/components/Table/options/grouping/constants.d.ts +2 -0
  56. package/lib/components/DataDictionary/components/Table/options/grouping/constants.js +5 -0
  57. package/lib/components/DataDictionary/components/Table/options/hook.d.ts +1 -1
  58. package/lib/components/DataDictionary/components/Table/options/hook.js +17 -0
  59. package/lib/components/DataDictionary/components/Table/options/visibility/constants.d.ts +2 -0
  60. package/lib/components/DataDictionary/components/Table/options/visibility/constants.js +3 -0
  61. package/lib/components/DataDictionary/components/Table/table.d.ts +1 -1
  62. package/lib/components/DataDictionary/components/Table/table.js +2 -2
  63. package/lib/components/DataDictionary/components/Table/types.d.ts +4 -1
  64. package/lib/components/DataDictionary/components/Table/utils.d.ts +18 -0
  65. package/lib/components/DataDictionary/components/Table/utils.js +27 -0
  66. package/lib/components/DataDictionary/dataDictionary.d.ts +1 -1
  67. package/lib/components/DataDictionary/dataDictionary.js +8 -6
  68. package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.js +16 -5
  69. package/lib/components/DataDictionary/hooks/UseDataDictionary/types.d.ts +5 -4
  70. package/lib/components/DataDictionary/types.d.ts +1 -0
  71. package/lib/components/Detail/components/Table/components/TableBody/tableBody.d.ts +8 -2
  72. package/lib/components/Detail/components/Table/components/TableBody/tableBody.js +2 -2
  73. package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.d.ts +8 -2
  74. package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +2 -2
  75. package/lib/components/Detail/components/Table/components/TableRows/tableRows.d.ts +8 -2
  76. package/lib/components/Detail/components/Table/components/TableRows/tableRows.js +2 -2
  77. package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +1 -1
  78. package/lib/components/Filter/components/FilterList/filterList.styles.d.ts +2 -0
  79. package/lib/components/Filter/components/FilterList/filterList.styles.js +28 -15
  80. package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.d.ts +1 -1
  81. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.d.ts +1 -1
  82. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/Button/button.styles.d.ts +1 -1
  83. package/lib/components/Layout/components/Outline/components/ContentsTab/contentsTab.styles.d.ts +1 -1
  84. package/lib/components/Layout/components/Outline/outline.styles.d.ts +1 -1
  85. package/lib/components/Login/components/Button/button.styles.d.ts +1 -1
  86. package/lib/components/Table/common/utils.d.ts +6 -0
  87. package/lib/components/Table/common/utils.js +14 -0
  88. package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.d.ts +7 -0
  89. package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.js +33 -0
  90. package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.styles.d.ts +3 -0
  91. package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.styles.js +19 -0
  92. package/lib/components/Table/components/TableFeatures/ColumnFilter/constants.d.ts +2 -0
  93. package/lib/components/Table/components/TableFeatures/ColumnFilter/constants.js +14 -0
  94. package/lib/components/Table/components/TableFeatures/ColumnFilter/types.d.ts +7 -0
  95. package/lib/components/Table/components/TableFeatures/ColumnFilter/types.js +1 -0
  96. package/lib/components/Table/components/TableFeatures/ColumnFilter/utils.d.ts +6 -0
  97. package/lib/components/Table/components/TableFeatures/ColumnFilter/utils.js +23 -0
  98. package/lib/components/Table/featureOptions/facetedColumn/utils.d.ts +6 -0
  99. package/lib/components/Table/featureOptions/facetedColumn/utils.js +9 -0
  100. package/lib/components/common/ButtonGroup/constants.d.ts +2 -0
  101. package/lib/components/common/ButtonGroup/constants.js +11 -0
  102. package/lib/components/common/Tabs/tabs.styles.d.ts +1 -1
  103. package/lib/mocks/@storybook/addon-actions.d.ts +9 -0
  104. package/lib/mocks/@storybook/addon-actions.js +9 -0
  105. package/lib/providers/exploreState/entities.d.ts +1 -1
  106. package/lib/providers/exploreState.js +10 -10
  107. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/handlers.d.ts +10 -0
  108. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/handlers.js +18 -0
  109. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/hook.d.ts +1 -0
  110. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/hook.js +33 -0
  111. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/types.d.ts +11 -0
  112. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/types.js +5 -0
  113. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/utils.d.ts +34 -0
  114. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/utils.js +59 -0
  115. package/lib/providers/exploreStateSync/provider.d.ts +19 -0
  116. package/lib/providers/exploreStateSync/provider.js +22 -0
  117. package/lib/styles/common/mui/buttonGroup.d.ts +13 -0
  118. package/lib/styles/common/mui/buttonGroup.js +34 -0
  119. package/lib/styles/common/mui/typography.js +2 -0
  120. package/lib/tests/mui/constants.d.ts +1 -0
  121. package/lib/tests/mui/constants.js +1 -0
  122. package/lib/tests/utils.d.ts +6 -0
  123. package/lib/tests/utils.js +8 -0
  124. package/lib/theme/common/components.d.ts +0 -6
  125. package/lib/theme/common/components.js +17 -31
  126. package/lib/theme/components/index.d.ts +1 -0
  127. package/lib/theme/components/index.js +1 -0
  128. package/lib/theme/components/muiButtonGroup.d.ts +2 -0
  129. package/lib/theme/components/muiButtonGroup.js +76 -0
  130. package/lib/theme/theme.js +1 -1
  131. package/lib/views/ExploreView/exploreView.js +2 -1
  132. package/package.json +1 -1
  133. package/src/common/entities.ts +3 -1
  134. package/src/components/DataDictionary/components/Entities/entities.tsx +5 -9
  135. package/src/components/DataDictionary/components/Entities/types.ts +3 -4
  136. package/src/components/DataDictionary/components/Entity/entity.styles.ts +9 -1
  137. package/src/components/DataDictionary/components/Entity/entity.tsx +18 -8
  138. package/src/components/DataDictionary/components/Entity/types.ts +4 -4
  139. package/src/components/DataDictionary/components/Entity/utils.ts +25 -0
  140. package/src/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.tsx +21 -0
  141. package/src/components/DataDictionary/components/Filters/components/ColumnFilters/types.ts +6 -0
  142. package/src/components/DataDictionary/components/Filters/filters.styles.ts +14 -0
  143. package/src/components/DataDictionary/components/Filters/filters.tsx +16 -0
  144. package/src/components/DataDictionary/components/Filters/stories/constants.ts +31 -0
  145. package/src/components/DataDictionary/components/Filters/stories/filters.stories.tsx +42 -0
  146. package/src/components/DataDictionary/components/Filters/stories/hook.ts +9 -0
  147. package/src/components/DataDictionary/components/Filters/stories/types.ts +3 -0
  148. package/src/components/DataDictionary/components/Filters/types.ts +6 -0
  149. package/src/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.ts +4 -1
  150. package/src/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.ts +27 -0
  151. package/src/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.tsx +10 -0
  152. package/src/components/DataDictionary/components/Layout/components/FiltersLayout/types.ts +6 -0
  153. package/src/components/DataDictionary/components/Layout/components/OutlineLayout/outlineLayout.styles.ts +1 -1
  154. package/src/components/DataDictionary/components/Layout/components/TitleLayout/titleLayout.styles.ts +1 -0
  155. package/src/components/DataDictionary/components/Layout/constants.ts +4 -0
  156. package/src/components/DataDictionary/components/Outline/utils.ts +35 -13
  157. package/src/components/DataDictionary/components/Table/hook.ts +17 -5
  158. package/src/components/DataDictionary/components/Table/options/columnFilters/constants.ts +16 -0
  159. package/src/components/DataDictionary/components/Table/options/columnFilters/hook.ts +32 -0
  160. package/src/components/DataDictionary/components/Table/options/expanded/constants.ts +13 -0
  161. package/src/components/DataDictionary/components/Table/options/faceted/constants.ts +14 -0
  162. package/src/components/DataDictionary/components/Table/options/grouping/constants.ts +9 -0
  163. package/src/components/DataDictionary/components/Table/options/hook.ts +26 -3
  164. package/src/components/DataDictionary/components/Table/options/visibility/constants.ts +5 -0
  165. package/src/components/DataDictionary/components/Table/table.tsx +2 -0
  166. package/src/components/DataDictionary/components/Table/types.ts +8 -1
  167. package/src/components/DataDictionary/components/Table/utils.ts +40 -0
  168. package/src/components/DataDictionary/dataDictionary.tsx +9 -5
  169. package/src/components/DataDictionary/hooks/UseDataDictionary/hook.ts +19 -5
  170. package/src/components/DataDictionary/hooks/UseDataDictionary/types.ts +5 -4
  171. package/src/components/DataDictionary/types.ts +1 -0
  172. package/src/components/Detail/components/Table/components/TableBody/tableBody.tsx +14 -3
  173. package/src/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +9 -2
  174. package/src/components/Detail/components/Table/components/TableRows/tableRows.tsx +9 -2
  175. package/src/components/Filter/components/FilterList/filterList.styles.ts +34 -15
  176. package/src/components/Table/common/utils.ts +16 -0
  177. package/src/components/Table/components/TableFeatures/ColumnFilter/columnFilter.styles.ts +23 -0
  178. package/src/components/Table/components/TableFeatures/ColumnFilter/columnFilter.tsx +98 -0
  179. package/src/components/Table/components/TableFeatures/ColumnFilter/constants.ts +16 -0
  180. package/src/components/Table/components/TableFeatures/ColumnFilter/types.ts +10 -0
  181. package/src/components/Table/components/TableFeatures/ColumnFilter/utils.ts +27 -0
  182. package/src/components/Table/featureOptions/facetedColumn/utils.ts +14 -0
  183. package/src/components/common/ButtonGroup/constants.ts +13 -0
  184. package/src/mocks/@storybook/addon-actions.ts +10 -0
  185. package/src/providers/exploreState/entities.ts +1 -1
  186. package/src/providers/exploreState.tsx +10 -11
  187. package/src/providers/exploreStateSync/hooks/UseMetaCommands/handlers.ts +25 -0
  188. package/src/providers/exploreStateSync/hooks/UseMetaCommands/hook.ts +38 -0
  189. package/src/providers/exploreStateSync/hooks/UseMetaCommands/types.ts +13 -0
  190. package/src/providers/exploreStateSync/hooks/UseMetaCommands/utils.ts +69 -0
  191. package/src/providers/exploreStateSync/provider.tsx +29 -0
  192. package/src/styles/common/mui/buttonGroup.ts +46 -0
  193. package/src/styles/common/mui/typography.ts +2 -0
  194. package/src/tests/mui/constants.ts +1 -0
  195. package/src/tests/utils.ts +9 -0
  196. package/src/theme/common/components.ts +17 -32
  197. package/src/theme/components/index.ts +1 -0
  198. package/src/theme/components/muiButtonGroup.ts +79 -0
  199. package/src/theme/theme.ts +1 -1
  200. package/src/views/ExploreView/exploreView.tsx +3 -2
  201. package/tests/dataDictionaryColumnFilters.test.tsx +101 -0
  202. package/lib/providers/exploreState/hooks/UseMetaCommands/actions.d.ts +0 -13
  203. package/lib/providers/exploreState/hooks/UseMetaCommands/actions.js +0 -24
  204. package/lib/providers/exploreState/hooks/UseMetaCommands/types.d.ts +0 -4
  205. package/lib/providers/exploreState/hooks/UseMetaCommands/types.js +0 -5
  206. package/lib/providers/exploreState/hooks/UseMetaCommands/useMetaCommands.d.ts +0 -2
  207. package/lib/providers/exploreState/hooks/UseMetaCommands/useMetaCommands.js +0 -21
  208. package/lib/providers/exploreState/hooks/UseMetaCommands/utils.d.ts +0 -9
  209. package/lib/providers/exploreState/hooks/UseMetaCommands/utils.js +0 -25
  210. package/src/providers/exploreState/hooks/UseMetaCommands/actions.ts +0 -29
  211. package/src/providers/exploreState/hooks/UseMetaCommands/types.ts +0 -4
  212. package/src/providers/exploreState/hooks/UseMetaCommands/useMetaCommands.ts +0 -27
  213. package/src/providers/exploreState/hooks/UseMetaCommands/utils.ts +0 -33
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "33.0.0"
2
+ ".": "34.1.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [34.1.0](https://github.com/DataBiosphere/findable-ui/compare/v34.0.0...v34.1.0) (2025-05-29)
4
+
5
+
6
+ ### Features
7
+
8
+ * entity lists do not load when page refreshes ([#506](https://github.com/DataBiosphere/findable-ui/issues/506)) ([#507](https://github.com/DataBiosphere/findable-ui/issues/507)) ([05ba8a1](https://github.com/DataBiosphere/findable-ui/commit/05ba8a17d5c94b35e35056a51d06066f337a276a))
9
+
10
+ ## [34.0.0](https://github.com/DataBiosphere/findable-ui/compare/v33.0.0...v34.0.0) (2025-05-27)
11
+
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ * implement required filter on data dictionary ([#497](https://github.com/DataBiosphere/findable-ui/issues/497)) (#503)
16
+
17
+ ### Features
18
+
19
+ * implement required filter on data dictionary ([#497](https://github.com/DataBiosphere/findable-ui/issues/497)) ([#503](https://github.com/DataBiosphere/findable-ui/issues/503)) ([5087d0c](https://github.com/DataBiosphere/findable-ui/commit/5087d0cd0f0bab0071dc87a7e9d7894735b69512))
20
+
3
21
  ## [33.0.0](https://github.com/DataBiosphere/findable-ui/compare/v32.1.1...v33.0.0) (2025-05-23)
4
22
 
5
23
 
package/jest.config.js CHANGED
@@ -1,5 +1,9 @@
1
1
  /** @type {import('ts-jest').JestConfigWithTsJest} */
2
2
  module.exports = {
3
+ moduleNameMapper: {
4
+ "^@storybook/addon-actions$":
5
+ "<rootDir>/src/mocks/@storybook/addon-actions.ts",
6
+ },
3
7
  preset: "ts-jest/presets/js-with-ts-esm",
4
8
  setupFiles: ["<rootDir>/tests/setup.ts"],
5
9
  testEnvironment: "jest-environment-jsdom",
@@ -1,9 +1,10 @@
1
- import { ColumnDef, RowData } from "@tanstack/react-table";
1
+ import { ColumnDef, RowData, TableOptions } from "@tanstack/react-table";
2
2
  /**
3
3
  * Model of a value of a metadata class.
4
4
  */
5
5
  export interface Attribute {
6
6
  annotations?: Record<string, string | string[] | undefined>;
7
+ classKey?: string;
7
8
  description: string;
8
9
  example?: string;
9
10
  multivalued: boolean;
@@ -64,6 +65,7 @@ export interface DataDictionary<T extends RowData = Attribute> {
64
65
  export interface DataDictionaryConfig<T extends RowData = Attribute> {
65
66
  columnDefs: ColumnDef<T, T[keyof T]>[];
66
67
  dataDictionary: DataDictionary<T>;
68
+ tableOptions?: Omit<TableOptions<T>, "columns" | "data" | "getCoreRowModel">;
67
69
  }
68
70
  /**
69
71
  * Label and description values from a data dictionary that are added to a site
@@ -1,4 +1,4 @@
1
1
  import { RowData } from "@tanstack/react-table";
2
2
  import { Attribute } from "../../../../common/entities";
3
3
  import { ClassesProps } from "./types";
4
- export declare const Entities: <T extends RowData = Attribute>({ classes, columnDefs, spacing, }: ClassesProps<T>) => JSX.Element;
4
+ export declare const Entities: <T extends RowData = Attribute>({ spacing, table, }: ClassesProps<T>) => JSX.Element;
@@ -2,6 +2,7 @@ import { Grid } from "@mui/material";
2
2
  import React from "react";
3
3
  import { Entity } from "../Entity/entity";
4
4
  import { GRID_PROPS } from "./constants";
5
- export const Entities = ({ classes, columnDefs, spacing, }) => {
6
- return (React.createElement(Grid, { ...GRID_PROPS }, classes.map((cls) => (React.createElement(Entity, { key: cls.name, class: cls, columnDefs: columnDefs, spacing: spacing })))));
5
+ export const Entities = ({ spacing, table, }) => {
6
+ const { getGroupedRowModel } = table;
7
+ return (React.createElement(Grid, { ...GRID_PROPS }, getGroupedRowModel().rows.map((row) => (React.createElement(Entity, { key: row.id, row: row, spacing: spacing, table: table })))));
7
8
  };
@@ -1,8 +1,7 @@
1
- import { ColumnDef, RowData } from "@tanstack/react-table";
2
- import { Attribute, Class } from "../../../../common/entities";
1
+ import { RowData, Table } from "@tanstack/react-table";
2
+ import { Attribute } from "../../../../common/entities";
3
3
  import { LayoutSpacing } from "../../hooks/UseLayoutSpacing/types";
4
4
  export interface ClassesProps<T extends RowData = Attribute> {
5
- classes: Class<T>[];
6
- columnDefs: ColumnDef<T, T[keyof T]>[];
7
5
  spacing?: LayoutSpacing;
6
+ table: Table<T>;
8
7
  }
@@ -1,4 +1,4 @@
1
1
  import { RowData } from "@tanstack/react-table";
2
2
  import { Attribute } from "../../../../common/entities";
3
3
  import { EntityProps } from "./types";
4
- export declare const Entity: <T extends RowData = Attribute>({ class: cls, columnDefs, spacing, }: EntityProps<T>) => JSX.Element;
4
+ export declare const Entity: <T extends RowData = Attribute>({ row, spacing, table, }: EntityProps<T>) => JSX.Element | null;
@@ -2,18 +2,24 @@ import { Grid, Typography } from "@mui/material";
2
2
  import React from "react";
3
3
  import { TYPOGRAPHY_PROPS } from "../../../../styles/common/mui/typography";
4
4
  import { AnchorLink } from "../../../common/AnchorLink/anchorLink";
5
- import { useTable } from "../Table/hook";
6
5
  import { Table } from "../Table/table";
7
6
  import { GRID_PROPS } from "./constants";
8
7
  import { StyledTypography } from "./entity.styles";
9
- export const Entity = ({ class: cls, columnDefs, spacing, }) => {
10
- const table = useTable(cls.attributes, columnDefs);
8
+ import { getClassMeta } from "./utils";
9
+ export const Entity = ({ row, spacing, table, }) => {
10
+ // Get class key from row.
11
+ const classKey = row.getValue("classKey");
12
+ // Get class metadata from table options.
13
+ const cls = getClassMeta(classKey, table);
14
+ // Class not found in table meta - return null.
15
+ if (!cls)
16
+ return null;
11
17
  return (React.createElement(Grid, { ...GRID_PROPS, rowGap: 4 },
12
18
  React.createElement(Grid, { ...GRID_PROPS, rowGap: 1 },
13
- React.createElement(StyledTypography, { component: "h3", id: cls.name, variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_HEADING_SMALL, ...spacing },
19
+ React.createElement(StyledTypography, { component: "h3", id: classKey, variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_HEADING_SMALL, ...spacing },
14
20
  cls.title,
15
21
  " ",
16
- React.createElement(AnchorLink, { anchorLink: cls.name })),
22
+ React.createElement(AnchorLink, { anchorLink: classKey })),
17
23
  React.createElement(Typography, { color: TYPOGRAPHY_PROPS.COLOR.INK_LIGHT, component: "div", variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_BODY_400_2_LINES }, cls.description)),
18
- React.createElement(Table, { table: table })));
24
+ React.createElement(Table, { row: row, table: table })));
19
25
  };
@@ -1,8 +1,14 @@
1
1
  import styled from "@emotion/styled";
2
2
  import { Typography } from "@mui/material";
3
3
  import { ENTITIES_ROW_GAP } from "../Entities/constants";
4
+ import { LAYOUT_SPACING } from "../Layout/constants";
5
+ const TOP = ENTITIES_ROW_GAP +
6
+ LAYOUT_SPACING.TITLE_HEIGHT +
7
+ LAYOUT_SPACING.FILTERS_HEIGHT +
8
+ LAYOUT_SPACING.FILTERS_PADDING_TOP +
9
+ LAYOUT_SPACING.CONTENT_PADDING_TOP;
4
10
  export const StyledTypography = styled(Typography) `
5
- scroll-margin-top: ${({ top = 0 }) => top + ENTITIES_ROW_GAP}px;
11
+ scroll-margin-top: ${({ top = 0 }) => top + TOP}px;
6
12
 
7
13
  &:hover a {
8
14
  opacity: 1;
@@ -1,8 +1,8 @@
1
- import { ColumnDef, RowData } from "@tanstack/react-table";
2
- import { Attribute, Class } from "../../../../common/entities";
1
+ import { Row, RowData, Table } from "@tanstack/react-table";
2
+ import { Attribute } from "../../../../common/entities";
3
3
  import { LayoutSpacing } from "../../hooks/UseLayoutSpacing/types";
4
4
  export interface EntityProps<T extends RowData = Attribute> {
5
- class: Class<T>;
6
- columnDefs: ColumnDef<T, T[keyof T]>[];
5
+ row: Row<T>;
7
6
  spacing?: LayoutSpacing;
7
+ table: Table<T>;
8
8
  }
@@ -0,0 +1,9 @@
1
+ import { RowData, Table } from "@tanstack/react-table";
2
+ import { Attribute, Class } from "../../../../common/entities";
3
+ /**
4
+ * Retrieves class metadata from the table options meta.
5
+ * @param classKey - Class key.
6
+ * @param table - Table instance.
7
+ * @returns Class metadata or undefined.
8
+ */
9
+ export declare function getClassMeta<T extends RowData = Attribute>(classKey: string | undefined, table: Table<T>): Pick<Class<T>, "description" | "title"> | undefined;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Retrieves class metadata from the table options meta.
3
+ * @param classKey - Class key.
4
+ * @param table - Table instance.
5
+ * @returns Class metadata or undefined.
6
+ */
7
+ export function getClassMeta(classKey, table) {
8
+ if (!classKey)
9
+ return;
10
+ // Grab the table meta and return if not defined.
11
+ const meta = table.options.meta;
12
+ if (!meta)
13
+ return;
14
+ // Return class metadata if defined.
15
+ if ("classMeta" in meta) {
16
+ return meta.classMeta?.[classKey];
17
+ }
18
+ }
@@ -0,0 +1,4 @@
1
+ import { RowData } from "@tanstack/react-table";
2
+ import { Attribute } from "../../../../../../common/entities";
3
+ import { ColumnFiltersProps } from "./types";
4
+ export declare const ColumnFilters: <T extends RowData = Attribute>({ table, }: ColumnFiltersProps<T>) => JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { ButtonGroup } from "@mui/material";
2
+ import React from "react";
3
+ import { BUTTON_GROUP_PROPS } from "../../../../../common/ButtonGroup/constants";
4
+ import { ColumnFilter } from "../../../../../Table/components/TableFeatures/ColumnFilter/columnFilter";
5
+ export const ColumnFilters = ({ table, }) => {
6
+ const columns = table.getAllColumns();
7
+ const columnFilters = columns.filter((column) => column.getCanFilter());
8
+ return (React.createElement(ButtonGroup, { ...BUTTON_GROUP_PROPS.SECONDARY_OUTLINED }, columnFilters.map((column) => (React.createElement(ColumnFilter, { key: column.id, column: column })))));
9
+ };
@@ -0,0 +1,5 @@
1
+ import { RowData, Table } from "@tanstack/react-table";
2
+ import { Attribute } from "../../../../../../common/entities";
3
+ export interface ColumnFiltersProps<T extends RowData = Attribute> {
4
+ table: Table<T>;
5
+ }
@@ -0,0 +1,4 @@
1
+ import { RowData } from "@tanstack/react-table";
2
+ import { Attribute } from "../../../../common/entities";
3
+ import { FiltersProps } from "./types";
4
+ export declare const Filters: <T extends RowData = Attribute>({ table, }: FiltersProps<T>) => JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { ColumnFilters } from "./components/ColumnFilters/columnFilters";
3
+ import { StyledGrid } from "./filters.styles";
4
+ export const Filters = ({ table, }) => {
5
+ return (React.createElement(StyledGrid, null,
6
+ React.createElement(ColumnFilters, { table: table })));
7
+ };
@@ -0,0 +1,7 @@
1
+ export declare const StyledGrid: import("@emotion/styled").StyledComponent<import("@mui/material").GridBaseProps & {
2
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme>;
3
+ } & import("@mui/system").SystemProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
4
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
5
+ }, ("p" | "fontSize" | "fontWeight" | "lineHeight" | "letterSpacing" | "textTransform" | "color" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontStyle" | "textAlign") | "sx" | keyof import("@mui/material").GridBaseProps> & {
6
+ theme?: import("@emotion/react").Theme;
7
+ }, {}, {}>;
@@ -0,0 +1,13 @@
1
+ import styled from "@emotion/styled";
2
+ import { Grid } from "@mui/material";
3
+ import { BUTTON_GROUP_PROPS } from "../../../../styles/common/mui/buttonGroup";
4
+ export const StyledGrid = styled(Grid) `
5
+ align-items: center;
6
+ display: grid;
7
+ gap: 16px;
8
+ grid-template-columns: 1fr auto;
9
+
10
+ .${BUTTON_GROUP_PROPS.CLASSES.ROOT} {
11
+ grid-column: 2;
12
+ }
13
+ `;
@@ -0,0 +1,4 @@
1
+ import { PartialColumn } from "./types";
2
+ export declare const BIONETWORK: PartialColumn;
3
+ export declare const EXAMPLE: PartialColumn;
4
+ export declare const REQUIRED: PartialColumn;
@@ -0,0 +1,25 @@
1
+ export const BIONETWORK = {
2
+ columnDef: { header: "BioNetwork" },
3
+ getCanFilter: () => true,
4
+ getFacetedUniqueValues: () => new Map([
5
+ ["Nervous System", 3],
6
+ ["Brain", 2],
7
+ ["Lung", 1],
8
+ ]),
9
+ id: "bioNetwork",
10
+ };
11
+ export const EXAMPLE = {
12
+ columnDef: { header: "Example" },
13
+ getCanFilter: () => false,
14
+ getFacetedUniqueValues: () => new Map([["EFO:0008563", 1]]),
15
+ id: "example",
16
+ };
17
+ export const REQUIRED = {
18
+ columnDef: { header: "Required" },
19
+ getCanFilter: () => true,
20
+ getFacetedUniqueValues: () => new Map([
21
+ ["Required", 16],
22
+ ["Not Required", 30],
23
+ ]),
24
+ id: "required",
25
+ };
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Filters } from "../filters";
3
+ declare const meta: Meta<typeof Filters>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
@@ -0,0 +1,31 @@
1
+ import { action } from "@storybook/addon-actions";
2
+ import { functionalUpdate } from "@tanstack/react-table";
3
+ import React from "react";
4
+ import { Filters } from "../filters";
5
+ import { BIONETWORK, EXAMPLE, REQUIRED } from "./constants";
6
+ import { useFilterStore } from "./hook";
7
+ const meta = {
8
+ component: Filters,
9
+ };
10
+ export default meta;
11
+ const DefaultStory = () => {
12
+ const { filterStore, setFilterStore } = useFilterStore();
13
+ const makeColumn = (column) => ({
14
+ ...column,
15
+ getFilterValue: () => filterStore[column.id],
16
+ getIsFiltered: () => !!filterStore[column.id],
17
+ setFilterValue: (updaterOrValue) => {
18
+ const next = functionalUpdate(updaterOrValue, filterStore[column.id]);
19
+ setFilterStore({ ...filterStore, [column.id]: next });
20
+ action("setFilterValue")(next);
21
+ return next;
22
+ },
23
+ });
24
+ const table = {
25
+ getAllColumns: () => [REQUIRED, BIONETWORK, EXAMPLE].map(makeColumn),
26
+ };
27
+ return React.createElement(Filters, { table: table });
28
+ };
29
+ export const Default = {
30
+ render: () => React.createElement(DefaultStory, null),
31
+ };
@@ -0,0 +1,5 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ export declare function useFilterStore(): {
3
+ filterStore: Record<string, unknown>;
4
+ setFilterStore: Dispatch<SetStateAction<Record<string, unknown>>>;
5
+ };
@@ -0,0 +1,5 @@
1
+ import { useState } from "react";
2
+ export function useFilterStore() {
3
+ const [filterStore, setFilterStore] = useState({});
4
+ return { filterStore, setFilterStore };
5
+ }
@@ -0,0 +1,4 @@
1
+ import { Column } from "@tanstack/react-table";
2
+ export type PartialColumn = Partial<Column<unknown>> & {
3
+ id: string;
4
+ };
@@ -0,0 +1,5 @@
1
+ import { RowData, Table } from "@tanstack/react-table";
2
+ import { Attribute } from "../../../../common/entities";
3
+ export interface FiltersProps<T extends RowData = Attribute> {
4
+ table: Table<T>;
5
+ }
@@ -3,12 +3,14 @@ import { mediaTabletDown } from "../../../../../../styles/common/mixins/breakpoi
3
3
  import { LAYOUT_SPACING } from "../../constants";
4
4
  const PB = LAYOUT_SPACING.CONTENT_PADDING_BOTTOM; /* bottom padding */
5
5
  const PT = LAYOUT_SPACING.CONTENT_PADDING_TOP; /* top padding */
6
+ const FILTERS_HEIGHT = LAYOUT_SPACING.FILTERS_HEIGHT +
7
+ LAYOUT_SPACING.FILTERS_PADDING_TOP; /* filters height */
6
8
  const TITLE_HEIGHT = LAYOUT_SPACING.TITLE_HEIGHT; /* title height */
7
9
  export const Layout = styled("div") `
8
10
  grid-column: 2;
9
11
  grid-row: 1;
10
12
  padding-bottom: ${PB}px;
11
- padding-top: ${({ top }) => top + TITLE_HEIGHT + PT}px;
13
+ padding-top: ${({ top }) => top + TITLE_HEIGHT + FILTERS_HEIGHT + PT}px;
12
14
  z-index: 1; /* not required, but helpful in that the entities are always on top */
13
15
 
14
16
  ${mediaTabletDown} {
@@ -0,0 +1,2 @@
1
+ import { FiltersLayoutProps } from "./types";
2
+ export declare const FiltersLayout: ({ children, ...props }: FiltersLayoutProps) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { Layout } from "./filtersLayout.styles";
3
+ export const FiltersLayout = ({ children, ...props }) => {
4
+ return React.createElement(Layout, { ...props }, children);
5
+ };
@@ -0,0 +1,5 @@
1
+ import { LayoutSpacing } from "../../../../hooks/UseLayoutSpacing/types";
2
+ export declare const Layout: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme;
4
+ as?: React.ElementType;
5
+ } & LayoutSpacing, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,24 @@
1
+ import styled from "@emotion/styled";
2
+ import { PALETTE } from "../../../../../../styles/common/constants/palette";
3
+ import { mediaTabletDown } from "../../../../../../styles/common/mixins/breakpoints";
4
+ import { LAYOUT_SPACING } from "../../constants";
5
+ const PB = LAYOUT_SPACING.FILTERS_PADDING_BOTTOM; /* bottom padding */
6
+ const PT = LAYOUT_SPACING.FILTERS_PADDING_TOP; /* top padding */
7
+ const TITLE_HEIGHT = LAYOUT_SPACING.TITLE_HEIGHT; /* title height */
8
+ export const Layout = styled("div") `
9
+ align-self: flex-start;
10
+ background-color: ${PALETTE.BACKGROUND_DEFAULT};
11
+ grid-column: 2;
12
+ grid-row: 1;
13
+ margin-bottom: ${PB}px;
14
+ padding-top: ${({ top }) => top + TITLE_HEIGHT + PT}px;
15
+ position: sticky;
16
+ top: 0;
17
+ z-index: 2; /* required, filters should be on top of entities */
18
+
19
+ ${mediaTabletDown} {
20
+ grid-column: 1;
21
+ grid-row: auto;
22
+ padding-top: ${PT}px;
23
+ }
24
+ `;
@@ -0,0 +1,5 @@
1
+ import { ReactNode } from "react";
2
+ import { LayoutSpacing } from "../../../../hooks/UseLayoutSpacing/types";
3
+ export interface FiltersLayoutProps extends LayoutSpacing {
4
+ children: ReactNode;
5
+ }
@@ -2,7 +2,7 @@ import styled from "@emotion/styled";
2
2
  import { mediaTabletDown } from "../../../../../../styles/common/mixins/breakpoints";
3
3
  import { LAYOUT_SPACING } from "../../constants";
4
4
  const PB = LAYOUT_SPACING.CONTENT_PADDING_BOTTOM; /* bottom padding */
5
- const PT = LAYOUT_SPACING.CONTENT_PADDING_TOP; /* top padding */
5
+ const PT = LAYOUT_SPACING.OUTLINE_PADDING_TOP; /* top padding */
6
6
  const TITLE_HEIGHT = LAYOUT_SPACING.TITLE_HEIGHT; /* title height */
7
7
  export const Layout = styled("div") `
8
8
  grid-column: 1;
@@ -7,6 +7,7 @@ export const Layout = styled("div") `
7
7
  padding-top: ${({ top }) => top}px; /* header height */
8
8
  position: sticky;
9
9
  top: 0;
10
+ z-index: 4;
10
11
 
11
12
  ${mediaTabletDown} {
12
13
  grid-column: 1;
@@ -1,5 +1,9 @@
1
1
  export declare const LAYOUT_SPACING: {
2
2
  CONTENT_PADDING_BOTTOM: number;
3
3
  CONTENT_PADDING_TOP: number;
4
+ FILTERS_HEIGHT: number;
5
+ FILTERS_PADDING_BOTTOM: number;
6
+ FILTERS_PADDING_TOP: number;
7
+ OUTLINE_PADDING_TOP: number;
4
8
  TITLE_HEIGHT: number;
5
9
  };
@@ -1,5 +1,9 @@
1
1
  export const LAYOUT_SPACING = {
2
2
  CONTENT_PADDING_BOTTOM: 24,
3
3
  CONTENT_PADDING_TOP: 16,
4
+ FILTERS_HEIGHT: 40,
5
+ FILTERS_PADDING_BOTTOM: 16,
6
+ FILTERS_PADDING_TOP: 16,
7
+ OUTLINE_PADDING_TOP: 16,
4
8
  TITLE_HEIGHT: 74,
5
9
  };
@@ -1,9 +1,9 @@
1
- import { RowData } from "@tanstack/react-table";
2
- import { Attribute, Class } from "../../../../common/entities";
1
+ import { RowData, Table } from "@tanstack/react-table";
2
+ import { Attribute } from "../../../../common/entities";
3
3
  import { OutlineItem } from "../../../Layout/components/Outline/types";
4
4
  /**
5
- * Returns outline items from classes.
6
- * @param classes - Class entities.
5
+ * Returns outline items from class metadata.
6
+ * @param table - Table instance.
7
7
  * @returns Outline items.
8
8
  */
9
- export declare function buildClassesOutline<T extends RowData = Attribute>(classes: Class<T>[]): OutlineItem[];
9
+ export declare function buildClassesOutline<T extends RowData = Attribute>(table: Table<T>): OutlineItem[];
@@ -1,15 +1,32 @@
1
1
  /**
2
- * Returns outline items from classes.
3
- * @param classes - Class entities.
2
+ * Returns outline items from class metadata.
3
+ * @param table - Table instance.
4
4
  * @returns Outline items.
5
5
  */
6
- export function buildClassesOutline(classes) {
7
- return classes.map(({ name, title }) => {
6
+ export function buildClassesOutline(table) {
7
+ const meta = table.options.meta;
8
+ if (!meta)
9
+ return [];
10
+ if (!("classMeta" in meta))
11
+ return [];
12
+ return Object.entries(meta.classMeta).map(([classKey, { title }]) => {
8
13
  return {
9
14
  depth: 2,
10
- disabled: false,
11
- hash: name,
15
+ disabled: !hasGroupedRow(table, classKey),
16
+ hash: classKey,
12
17
  value: title,
13
18
  };
14
19
  });
15
20
  }
21
+ /**
22
+ * Returns true if a grouped row exists for a class key.
23
+ * @param table - Table instance.
24
+ * @param classKey - Class key.
25
+ * @returns True if a grouped row exists, false otherwise.
26
+ */
27
+ function hasGroupedRow(table, classKey) {
28
+ const groupRow = table
29
+ .getGroupedRowModel()
30
+ .rows.find((row) => row.getValue("classKey") === classKey);
31
+ return !!groupRow;
32
+ }
@@ -1,3 +1,3 @@
1
- import { ColumnDef, RowData, Table } from "@tanstack/react-table";
2
- import { Attribute } from "../../../../common/entities";
3
- export declare const useTable: <T extends RowData = Attribute>(data: T[], columnDefs: ColumnDef<T, T[keyof T]>[]) => Table<T>;
1
+ import { ColumnDef, RowData, Table, TableOptions } from "@tanstack/react-table";
2
+ import { Attribute, Class } from "../../../../common/entities";
3
+ export declare const useTable: <T extends RowData = Attribute>(classes: Class<T>[], columnDefs: ColumnDef<T, T[keyof T]>[], tableOptions?: Omit<TableOptions<T>, "columns" | "data" | "getCoreRowModel">) => Table<T>;
@@ -1,12 +1,20 @@
1
1
  import { useReactTable, } from "@tanstack/react-table";
2
+ import { useMemo } from "react";
2
3
  import { useTableOptions } from "./options/hook";
3
- export const useTable = (data, columnDefs) => {
4
- // Table options.
5
- const tableOptions = useTableOptions();
4
+ import { buildClassMeta, buildTableData } from "./utils";
5
+ export const useTable = (classes, columnDefs, tableOptions) => {
6
+ // Build table data.
7
+ const data = useMemo(() => buildTableData(classes), [classes]);
8
+ // Default table options.
9
+ const defaultTableOptions = useTableOptions();
10
+ // Build class meta.
11
+ const classMeta = useMemo(() => buildClassMeta(classes), [classes]);
6
12
  // Table instance.
7
13
  return useReactTable({
14
+ ...defaultTableOptions,
8
15
  ...tableOptions,
9
16
  columns: columnDefs,
10
17
  data,
18
+ meta: { classMeta },
11
19
  });
12
20
  };
@@ -0,0 +1,2 @@
1
+ import { ColumnFiltersOptions, RowData } from "@tanstack/react-table";
2
+ export declare const COLUMN_FILTERS_OPTIONS: Pick<ColumnFiltersOptions<RowData>, "enableColumnFilters" | "enableFilters" | "filterFns" | "getFilteredRowModel">;
@@ -0,0 +1,8 @@
1
+ import { getFilteredRowModel, } from "@tanstack/react-table";
2
+ import { arrIncludesSome } from "../../../../../Table/columnDef/columnFilters/filterFn";
3
+ export const COLUMN_FILTERS_OPTIONS = {
4
+ enableColumnFilters: true,
5
+ enableFilters: true,
6
+ filterFns: { arrIncludesSome },
7
+ getFilteredRowModel: getFilteredRowModel(),
8
+ };
@@ -0,0 +1,6 @@
1
+ import { ColumnFiltersOptions, ColumnFiltersState, RowData } from "@tanstack/react-table";
2
+ import { Dispatch, SetStateAction } from "react";
3
+ import { Attribute } from "../../../../../../common/entities";
4
+ export declare const useColumnFiltersOptions: <T extends RowData = Attribute>({ setColumnFilters, }: {
5
+ setColumnFilters: Dispatch<SetStateAction<ColumnFiltersState>>;
6
+ }) => ColumnFiltersOptions<T>;
@@ -0,0 +1,14 @@
1
+ import { useCallback } from "react";
2
+ import { resolveUpdater } from "../../../../../Table/options/updater";
3
+ import { COLUMN_FILTERS_OPTIONS } from "./constants";
4
+ export const useColumnFiltersOptions = ({ setColumnFilters, }) => {
5
+ // Column filters change handler.
6
+ // TODO dispatch to provider with reducer.
7
+ const onColumnFiltersChange = useCallback((updaterOrValue) => {
8
+ setColumnFilters((old) => resolveUpdater(updaterOrValue, old));
9
+ }, [setColumnFilters]);
10
+ return {
11
+ ...COLUMN_FILTERS_OPTIONS,
12
+ onColumnFiltersChange,
13
+ };
14
+ };
@@ -0,0 +1,2 @@
1
+ import { ExpandedOptions, RowData } from "@tanstack/react-table";
2
+ export declare const EXPANDED_OPTIONS: Pick<ExpandedOptions<RowData>, "enableExpanding" | "getExpandedRowModel">;