@databiosphere/findable-ui 17.0.0 → 19.0.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 (201) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +22 -0
  3. package/lib/apis/azul/common/filterTransformer.js +1 -1
  4. package/lib/apis/azul/common/utils.d.ts +1 -1
  5. package/lib/apis/azul/common/utils.js +5 -1
  6. package/lib/common/entities.d.ts +3 -3
  7. package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +2 -0
  8. package/lib/components/Detail/components/Table/components/TableRows/tableRows.js +1 -15
  9. package/lib/components/Export/components/ExportForm/components/ExportFileSummaryForm/exportFileSummaryForm.js +9 -10
  10. package/lib/components/Filter/common/utils.js +1 -1
  11. package/lib/components/Filter/components/VariableSizeList/VariableSizeList.d.ts +1 -1
  12. package/lib/components/Filter/components/VariableSizeListItem/variableSizeListItem.d.ts +1 -1
  13. package/lib/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.js +23 -12
  14. package/lib/components/Table/common/columnDef.js +1 -0
  15. package/lib/components/Table/common/gridTable.styles.js +5 -11
  16. package/lib/components/Table/common/utils.d.ts +3 -29
  17. package/lib/components/Table/common/utils.js +26 -61
  18. package/lib/components/Table/components/TableBody/hooks/virtualizer/constants.d.ts +3 -0
  19. package/lib/components/Table/components/TableBody/hooks/virtualizer/constants.js +3 -0
  20. package/lib/components/Table/components/TableBody/hooks/virtualizer/hook.d.ts +8 -0
  21. package/lib/components/Table/components/TableBody/hooks/virtualizer/hook.js +18 -0
  22. package/lib/components/Table/components/TableBody/hooks/virtualizer/types.d.ts +4 -0
  23. package/lib/components/Table/components/TableBody/tableBody.d.ts +3 -2
  24. package/lib/components/Table/components/TableBody/tableBody.js +7 -28
  25. package/lib/components/Table/components/TableBody/utils.d.ts +12 -0
  26. package/lib/components/Table/components/TableBody/utils.js +17 -0
  27. package/lib/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.d.ts +3 -1
  28. package/lib/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.js +6 -14
  29. package/lib/components/Table/components/TableFeatures/ColumnGrouping/utils.d.ts +28 -0
  30. package/lib/components/Table/components/TableFeatures/ColumnGrouping/utils.js +52 -0
  31. package/lib/components/Table/components/TableFeatures/ColumnVisibility/utils.d.ts +21 -0
  32. package/lib/components/Table/components/TableFeatures/ColumnVisibility/utils.js +37 -0
  33. package/lib/components/Table/components/TableFeatures/RowSorting/utils.d.ts +29 -0
  34. package/lib/components/Table/components/TableFeatures/RowSorting/utils.js +68 -0
  35. package/lib/components/Table/components/TableHead/tableHead.d.ts +2 -6
  36. package/lib/components/Table/components/TableHead/tableHead.js +6 -4
  37. package/lib/components/Table/components/TableHead/types.d.ts +6 -0
  38. package/lib/components/Table/components/TableHead/types.js +1 -0
  39. package/lib/components/Table/components/TableHead/utils.d.ts +19 -0
  40. package/lib/components/Table/components/TableHead/utils.js +34 -0
  41. package/lib/components/Table/components/TableRow/tableRow.styles.d.ts +1 -0
  42. package/lib/components/Table/components/TableRow/tableRow.styles.js +14 -2
  43. package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.d.ts +3 -2
  44. package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +8 -4
  45. package/lib/components/Table/components/TableRows/components/CollapsableRows/hook.d.ts +9 -0
  46. package/lib/components/Table/components/TableRows/components/CollapsableRows/hook.js +17 -0
  47. package/lib/components/Table/components/TableRows/tableRows.d.ts +3 -3
  48. package/lib/components/Table/components/TableRows/tableRows.js +9 -5
  49. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.d.ts +3 -0
  50. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.js +26 -0
  51. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.styles.d.ts +2 -0
  52. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.styles.js +16 -0
  53. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/menuItems.d.ts +3 -0
  54. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/menuItems.js +12 -0
  55. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/types.d.ts +7 -0
  56. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/types.js +1 -0
  57. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/constants.d.ts +4 -0
  58. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/constants.js +13 -0
  59. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/types.d.ts +4 -0
  60. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/types.js +1 -0
  61. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/utils.d.ts +17 -0
  62. package/lib/components/Table/components/TableToolbar/components/ColumnGrouping/utils.js +36 -0
  63. package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.d.ts +2 -3
  64. package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.js +3 -11
  65. package/lib/components/Table/components/TableToolbar/tableToolbar.js +4 -2
  66. package/lib/components/Table/features/RowPosition/constants.js +2 -2
  67. package/lib/components/Table/features/RowPosition/utils.d.ts +2 -2
  68. package/lib/components/Table/features/RowPosition/utils.js +12 -5
  69. package/lib/components/Table/options/updater.d.ts +10 -0
  70. package/lib/components/Table/options/updater.js +24 -0
  71. package/lib/components/Table/table.js +22 -17
  72. package/lib/components/TableCreator/common/constants.d.ts +2 -2
  73. package/lib/components/TableCreator/common/constants.js +2 -1
  74. package/lib/components/TableCreator/common/utils.d.ts +5 -2
  75. package/lib/components/TableCreator/common/utils.js +11 -4
  76. package/lib/components/TableCreator/options/expanded/constants.d.ts +2 -0
  77. package/lib/components/TableCreator/options/expanded/constants.js +6 -0
  78. package/lib/components/TableCreator/options/expanded/hook.d.ts +2 -0
  79. package/lib/components/TableCreator/options/expanded/hook.js +4 -0
  80. package/lib/components/TableCreator/options/grouping/constants.d.ts +2 -0
  81. package/lib/components/TableCreator/options/grouping/constants.js +5 -0
  82. package/lib/components/TableCreator/options/grouping/hook.d.ts +2 -0
  83. package/lib/components/TableCreator/options/grouping/hook.js +9 -0
  84. package/lib/components/TableCreator/options/hook.d.ts +2 -0
  85. package/lib/components/TableCreator/options/hook.js +25 -0
  86. package/lib/components/TableCreator/options/rowSelection/constants.d.ts +2 -0
  87. package/lib/components/TableCreator/options/rowSelection/constants.js +5 -0
  88. package/lib/components/TableCreator/options/rowSelection/hook.d.ts +2 -0
  89. package/lib/components/TableCreator/options/rowSelection/hook.js +4 -0
  90. package/lib/components/TableCreator/options/sorting/constants.d.ts +2 -0
  91. package/lib/components/TableCreator/options/sorting/constants.js +5 -0
  92. package/lib/components/TableCreator/options/sorting/hook.d.ts +2 -0
  93. package/lib/components/TableCreator/options/sorting/hook.js +4 -0
  94. package/lib/components/TableCreator/tableCreator.d.ts +3 -5
  95. package/lib/components/TableCreator/tableCreator.js +4 -2
  96. package/lib/components/common/DropdownMenu/dropdownMenu.d.ts +2 -3
  97. package/lib/components/common/DropdownMenu/dropdownMenu.js +7 -7
  98. package/lib/components/common/DropdownMenu/dropdownMenu.styles.d.ts +1 -1
  99. package/lib/components/common/DropdownMenu/dropdownMenu.styles.js +1 -1
  100. package/lib/components/common/Menu/hooks/useMenu.d.ts +5 -6
  101. package/lib/config/entities.d.ts +7 -7
  102. package/lib/config/utils.d.ts +0 -7
  103. package/lib/config/utils.js +0 -12
  104. package/lib/hooks/useCategoryFilter.js +5 -1
  105. package/lib/providers/exploreState/actions/updateGrouping/action.d.ts +10 -0
  106. package/lib/providers/exploreState/actions/updateGrouping/action.js +16 -0
  107. package/lib/providers/exploreState/actions/updateGrouping/dispatch.d.ts +7 -0
  108. package/lib/providers/exploreState/actions/updateGrouping/dispatch.js +12 -0
  109. package/lib/providers/exploreState/actions/updateGrouping/types.d.ts +9 -0
  110. package/lib/providers/exploreState/actions/updateGrouping/types.js +1 -0
  111. package/lib/providers/exploreState/actions/updateGrouping/utils.d.ts +10 -0
  112. package/lib/providers/exploreState/actions/updateGrouping/utils.js +26 -0
  113. package/lib/providers/exploreState/entities.d.ts +3 -4
  114. package/lib/providers/exploreState/initializer/utils.js +41 -8
  115. package/lib/providers/exploreState/payloads/entities.d.ts +2 -1
  116. package/lib/providers/exploreState/utils.d.ts +6 -4
  117. package/lib/providers/exploreState/utils.js +7 -4
  118. package/lib/providers/exploreState.d.ts +3 -1
  119. package/lib/providers/exploreState.js +15 -5
  120. package/lib/providers/fileManifestState.js +2 -4
  121. package/lib/viewModelBuilders/common/utils.d.ts +6 -6
  122. package/lib/viewModelBuilders/common/utils.js +10 -10
  123. package/lib/views/ExploreView/exploreView.js +3 -3
  124. package/package.json +1 -1
  125. package/src/apis/azul/common/filterTransformer.ts +1 -1
  126. package/src/apis/azul/common/utils.ts +4 -2
  127. package/src/common/entities.ts +3 -3
  128. package/src/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +2 -0
  129. package/src/components/Detail/components/Table/components/TableRows/tableRows.tsx +3 -18
  130. package/src/components/Export/components/ExportForm/components/ExportFileSummaryForm/exportFileSummaryForm.tsx +28 -32
  131. package/src/components/Filter/common/utils.ts +1 -1
  132. package/src/components/Filter/components/VariableSizeList/VariableSizeList.tsx +1 -1
  133. package/src/components/Filter/components/VariableSizeListItem/variableSizeListItem.tsx +1 -1
  134. package/src/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.tsx +27 -13
  135. package/src/components/Table/common/columnDef.ts +1 -0
  136. package/src/components/Table/common/gridTable.styles.ts +5 -11
  137. package/src/components/Table/common/utils.ts +45 -108
  138. package/src/components/Table/components/TableBody/hooks/virtualizer/constants.ts +3 -0
  139. package/src/components/Table/components/TableBody/hooks/virtualizer/hook.ts +23 -0
  140. package/src/components/Table/components/TableBody/hooks/virtualizer/types.ts +5 -0
  141. package/src/components/Table/components/TableBody/tableBody.tsx +14 -30
  142. package/src/components/Table/components/TableBody/utils.ts +21 -0
  143. package/src/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.tsx +14 -15
  144. package/src/components/Table/components/TableFeatures/ColumnGrouping/utils.ts +70 -0
  145. package/src/components/Table/components/TableFeatures/ColumnVisibility/utils.ts +52 -0
  146. package/src/components/Table/components/TableFeatures/RowSorting/utils.ts +87 -0
  147. package/src/components/Table/components/TableHead/tableHead.tsx +21 -29
  148. package/src/components/Table/components/TableHead/types.ts +7 -0
  149. package/src/components/Table/components/TableHead/utils.ts +42 -0
  150. package/src/components/Table/components/TableRow/tableRow.styles.ts +19 -2
  151. package/src/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +8 -2
  152. package/src/components/Table/components/TableRows/components/CollapsableRows/hook.ts +20 -0
  153. package/src/components/Table/components/TableRows/tableRows.tsx +18 -15
  154. package/src/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.styles.ts +17 -0
  155. package/src/components/Table/components/TableToolbar/components/ColumnGrouping/columnGrouping.tsx +54 -0
  156. package/src/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/menuItems.tsx +28 -0
  157. package/src/components/Table/components/TableToolbar/components/ColumnGrouping/components/MenuItems/types.ts +8 -0
  158. package/src/components/Table/components/TableToolbar/components/ColumnGrouping/constants.ts +17 -0
  159. package/src/components/Table/components/TableToolbar/components/ColumnGrouping/types.ts +5 -0
  160. package/src/components/Table/components/TableToolbar/components/ColumnGrouping/utils.ts +45 -0
  161. package/src/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.tsx +7 -20
  162. package/src/components/Table/components/TableToolbar/tableToolbar.tsx +8 -2
  163. package/src/components/Table/features/RowPosition/constants.ts +2 -2
  164. package/src/components/Table/features/RowPosition/utils.ts +10 -5
  165. package/src/components/Table/options/updater.ts +29 -0
  166. package/src/components/Table/table.tsx +43 -25
  167. package/src/components/TableCreator/common/constants.ts +4 -6
  168. package/src/components/TableCreator/common/utils.ts +14 -7
  169. package/src/components/TableCreator/options/expanded/constants.ts +14 -0
  170. package/src/components/TableCreator/options/expanded/hook.ts +6 -0
  171. package/src/components/TableCreator/options/grouping/constants.ts +6 -0
  172. package/src/components/TableCreator/options/grouping/hook.ts +17 -0
  173. package/src/components/TableCreator/options/hook.ts +31 -0
  174. package/src/components/TableCreator/options/rowSelection/constants.ts +10 -0
  175. package/src/components/TableCreator/options/rowSelection/hook.ts +8 -0
  176. package/src/components/TableCreator/options/sorting/constants.ts +10 -0
  177. package/src/components/TableCreator/options/sorting/hook.ts +6 -0
  178. package/src/components/TableCreator/tableCreator.tsx +4 -11
  179. package/src/components/common/DropdownMenu/dropdownMenu.styles.ts +1 -1
  180. package/src/components/common/DropdownMenu/dropdownMenu.tsx +19 -17
  181. package/src/components/common/Menu/hooks/useMenu.ts +8 -9
  182. package/src/config/entities.ts +11 -10
  183. package/src/config/utils.ts +0 -14
  184. package/src/hooks/useCategoryFilter.ts +5 -1
  185. package/src/hooks/useFileManifest/common/utils.ts +2 -2
  186. package/src/providers/exploreState/actions/updateGrouping/action.ts +26 -0
  187. package/src/providers/exploreState/actions/updateGrouping/dispatch.ts +16 -0
  188. package/src/providers/exploreState/actions/updateGrouping/types.ts +11 -0
  189. package/src/providers/exploreState/actions/updateGrouping/utils.ts +33 -0
  190. package/src/providers/exploreState/entities.ts +3 -3
  191. package/src/providers/exploreState/initializer/utils.ts +58 -10
  192. package/src/providers/exploreState/payloads/entities.ts +2 -0
  193. package/src/providers/exploreState/utils.ts +10 -7
  194. package/src/providers/exploreState.tsx +29 -6
  195. package/src/providers/fileManifestState.tsx +2 -4
  196. package/src/viewModelBuilders/common/utils.ts +10 -10
  197. package/src/views/ExploreView/exploreView.tsx +2 -4
  198. package/types/data-explorer-ui.d.ts +8 -1
  199. package/lib/components/TableCreator/common/entities.d.ts +0 -5
  200. package/src/components/TableCreator/common/entities.ts +0 -6
  201. /package/lib/components/{TableCreator/common/entities.js → Table/components/TableBody/hooks/virtualizer/types.js} +0 -0
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "17.0.0"
2
+ ".": "19.0.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [19.0.0](https://github.com/DataBiosphere/findable-ui/compare/v18.0.0...v19.0.0) (2025-01-03)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * implement group by list ([#302](https://github.com/DataBiosphere/findable-ui/issues/302)) (#303)
9
+
10
+ ### Features
11
+
12
+ * implement group by list ([#302](https://github.com/DataBiosphere/findable-ui/issues/302)) ([#303](https://github.com/DataBiosphere/findable-ui/issues/303)) ([36e4330](https://github.com/DataBiosphere/findable-ui/commit/36e433053b1c2f17ddc75964c8e8eec35440b7bd))
13
+
14
+ ## [18.0.0](https://github.com/DataBiosphere/findable-ui/compare/v17.0.0...v18.0.0) (2024-12-18)
15
+
16
+
17
+ ### ⚠ BREAKING CHANGES
18
+
19
+ * ensure select category value label is string and type key as unknown ([#298](https://github.com/DataBiosphere/findable-ui/issues/298)) (#299)
20
+
21
+ ### Bug Fixes
22
+
23
+ * ensure select category value label is string and type key as unknown ([#298](https://github.com/DataBiosphere/findable-ui/issues/298)) ([#299](https://github.com/DataBiosphere/findable-ui/issues/299)) ([c7b5baa](https://github.com/DataBiosphere/findable-ui/commit/c7b5baae525f6e54493a2748070fa46cc36d9f67))
24
+
3
25
  ## [17.0.0](https://github.com/DataBiosphere/findable-ui/compare/v16.1.0...v17.0.0) (2024-12-12)
4
26
 
5
27
 
@@ -88,7 +88,7 @@ export function transformTermFacets(termFacets, filterState) {
88
88
  categoryValues.push({
89
89
  count: 0,
90
90
  key: term,
91
- label: term ?? LABEL.UNSPECIFIED,
91
+ label: String(term ?? LABEL.UNSPECIFIED),
92
92
  selected: false, // Selected state updated in filter hook
93
93
  });
94
94
  }
@@ -4,4 +4,4 @@ import { ParamValue } from "./filterTransformer";
4
4
  * @param value - Filter value.
5
5
  * @returns filter parameter value.
6
6
  */
7
- export declare function getFilterParameterValue(value: string): ParamValue;
7
+ export declare function getFilterParameterValue(value: unknown): ParamValue;
@@ -13,5 +13,9 @@ export function getFilterParameterValue(value) {
13
13
  if (value === "false") {
14
14
  return false;
15
15
  }
16
- return value;
16
+ if (typeof value === "string" || typeof value === "boolean")
17
+ return value;
18
+ if (value === null || value === undefined)
19
+ return null;
20
+ return String(value);
17
21
  }
@@ -13,7 +13,7 @@ export interface CategoryTag {
13
13
  /**
14
14
  * Category values to be used as keys. For example, "Homo sapiens" or "10X 3' v2 sequencing".
15
15
  */
16
- export type CategoryValueKey = string;
16
+ export type CategoryValueKey = unknown;
17
17
  /**
18
18
  * Set of selected category values.
19
19
  */
@@ -46,7 +46,7 @@ export interface SelectCategory {
46
46
  */
47
47
  export interface SelectCategoryValue {
48
48
  count: number;
49
- key: CategoryKey;
49
+ key: CategoryValueKey;
50
50
  label: string;
51
51
  selected: boolean;
52
52
  }
@@ -64,7 +64,7 @@ export interface SelectCategoryValueView {
64
64
  */
65
65
  export interface SelectCategoryView {
66
66
  isDisabled?: boolean;
67
- key: CategoryValueKey;
67
+ key: CategoryKey;
68
68
  label: string;
69
69
  values: SelectCategoryValueView[];
70
70
  }
@@ -2,9 +2,11 @@ import React, { Fragment } from "react";
2
2
  import { isCollapsableRowDisabled } from "../../../../../../../Table/common/utils";
3
3
  import { CollapsableCell } from "../../../../../../../Table/components/TableCell/components/CollapsableCell/collapsableCell";
4
4
  import { TableRow } from "../../../../../../../Table/components/TableRow/tableRow.styles";
5
+ import { useCollapsableRows } from "../../../../../../../Table/components/TableRows/components/CollapsableRows/hook";
5
6
  export const CollapsableRows = ({ tableInstance, }) => {
6
7
  const { getRowModel } = tableInstance;
7
8
  const { rows } = getRowModel();
9
+ useCollapsableRows(tableInstance);
8
10
  return (React.createElement(Fragment, null, rows.map((row) => {
9
11
  if (row.depth > 0)
10
12
  return null; // Hide sub rows.
@@ -9,7 +9,7 @@ export const TableRows = ({ tableInstance, tableView, }) => {
9
9
  const { tableCell } = tableView || {};
10
10
  const { size: tableCellSize = "medium" } = tableCell || {};
11
11
  return (React.createElement(Fragment, null, rows.map((row) => {
12
- return (React.createElement(TableRow, { id: getRowId(row), isPreview: row.getIsPreview(), key: row.id }, row.getVisibleCells().map((cell) => {
12
+ return (React.createElement(TableRow, { key: row.id, isGrouped: row.getIsGrouped(), isPreview: row.getIsPreview() }, row.getVisibleCells().map((cell) => {
13
13
  if (cell.getIsAggregated())
14
14
  return null; // Display of aggregated cells is currently not supported.
15
15
  if (cell.getIsPlaceholder())
@@ -18,17 +18,3 @@ export const TableRows = ({ tableInstance, tableView, }) => {
18
18
  })));
19
19
  })));
20
20
  };
21
- /**
22
- * Returns identifier for a row.
23
- * @param row - Row.
24
- * @returns row identifier.
25
- */
26
- function getRowId(row) {
27
- const { depth, getIsGrouped, id } = row;
28
- if (getIsGrouped()) {
29
- return `grouped-row-${id}`;
30
- }
31
- if (depth > 0) {
32
- return `sub-row-${id}`;
33
- }
34
- }
@@ -1,5 +1,5 @@
1
1
  import { Checkbox, FormControlLabel, FormHelperText, FormLabel, TableBody, TableCell, TableHead, TableRow, } from "@mui/material";
2
- import React, { Fragment } from "react";
2
+ import React from "react";
3
3
  import { formatCountSize } from "../../../../../../utils/formatCountSize";
4
4
  import { formatFileSize } from "../../../../../../utils/formatFileSize";
5
5
  import { CheckedIcon } from "../../../../../common/CustomIcon/components/CheckedIcon/checkedIcon";
@@ -33,15 +33,14 @@ export const ExportFileSummaryForm = ({ error, fileSummaryFacet, onClearError, o
33
33
  } }) })),
34
34
  React.createElement(TableCell, null, "File Count"),
35
35
  hasFileSize && React.createElement(TableCell, null, "File Size"))),
36
- React.createElement(TableBody, null,
37
- React.createElement(TableRow, null, fileSummaryFacet.terms.map(({ count, name, selected, size = 0 }) => (React.createElement(Fragment, { key: name },
38
- React.createElement(TableCell, null,
39
- React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: selected, checkedIcon: React.createElement(CheckedIcon, null), icon: error ? React.createElement(UncheckedErrorIcon, null) : React.createElement(UncheckedIcon, null), onChange: () => {
40
- onClearError(error, ERROR.FILE_SUMMARY_ERROR);
41
- onFilter(fileSummaryFacet.name, name, selected);
42
- } }), key: name, label: name })),
43
- React.createElement(TableCell, null, formatCountSize(count)),
44
- hasFileSize && (React.createElement(TableCell, null, formatFileSize(size))))))))))));
36
+ React.createElement(TableBody, null, fileSummaryFacet.terms.map(({ count, name, selected, size = 0 }) => (React.createElement(TableRow, { key: name },
37
+ React.createElement(TableCell, null,
38
+ React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: selected, checkedIcon: React.createElement(CheckedIcon, null), icon: error ? React.createElement(UncheckedErrorIcon, null) : React.createElement(UncheckedIcon, null), onChange: () => {
39
+ onClearError(error, ERROR.FILE_SUMMARY_ERROR);
40
+ onFilter(fileSummaryFacet.name, name, selected);
41
+ } }), key: name, label: name })),
42
+ React.createElement(TableCell, null, formatCountSize(count)),
43
+ hasFileSize && React.createElement(TableCell, null, formatFileSize(size))))))))));
45
44
  };
46
45
  /**
47
46
  * Returns true if the file summary facet has file size.
@@ -60,7 +60,7 @@ export function getSortMatchesFn(searchTerm) {
60
60
  if (match) {
61
61
  matches.push({ labelRanges: match.ranges, score: match.score, value });
62
62
  }
63
- else {
63
+ else if (typeof value.key === "string") {
64
64
  match = matchString(value.key || "");
65
65
  if (match)
66
66
  matches.push({ score: match.score, value });
@@ -2,7 +2,7 @@ import { VariableSizeListProps as ListProps } from "react-window";
2
2
  import { CategoryKey } from "../../../../common/entities";
3
3
  import { OnFilterFn } from "../../../../hooks/useCategoryFilter";
4
4
  import { FilterMenuSearchMatch } from "../../common/entities";
5
- export type ItemSizeByItemKey = Map<string, number>;
5
+ export type ItemSizeByItemKey = Map<unknown, number>;
6
6
  export interface VariableSizeListProps {
7
7
  categoryKey: CategoryKey;
8
8
  categorySection?: string;
@@ -7,7 +7,7 @@ interface Props {
7
7
  categorySection?: string;
8
8
  matchedItem: FilterMenuSearchMatch;
9
9
  onFilter: OnFilterFn;
10
- onUpdateItemSizeByItemKey: (itemKey: string, itemSize: number) => void;
10
+ onUpdateItemSizeByItemKey: (itemKey: unknown, itemSize: number) => void;
11
11
  style: CSSProperties;
12
12
  }
13
13
  export default function VariableSizeListItem({ categoryKey, categorySection, matchedItem, onFilter, onUpdateItemSizeByItemKey, style, }: Props): JSX.Element;
@@ -1,26 +1,27 @@
1
1
  import Link from "next/link";
2
- import React, { useCallback } from "react";
2
+ import React from "react";
3
3
  import { useExploreState } from "../../../../../../hooks/useExploreState";
4
4
  import { ExploreActionKind, } from "../../../../../../providers/exploreState";
5
5
  import { ANCHOR_TARGET, REL_ATTRIBUTE, } from "../../../../common/entities";
6
6
  const PARAM_FILTER = "filter";
7
+ const PARAM_GROUPING = "grouping";
7
8
  const PARAM_SORTING = "sorting";
8
9
  export const ExploreViewLink = ({ className, label, onClick, target = ANCHOR_TARGET.SELF, url, }) => {
9
10
  const { exploreDispatch, exploreState } = useExploreState();
10
11
  if (!isValidExploreURL(url, exploreState)) {
11
12
  throwError(url);
12
13
  }
13
- const onNavigate = useCallback(() => {
14
- const entityListType = getEntityListType(url.href);
15
- const filters = getSelectedFilters(url.query);
16
- const sorting = getSorting(url.query);
17
- exploreDispatch({
18
- payload: { entityListType, filters, sorting },
19
- type: ExploreActionKind.UpdateEntityFilters,
20
- });
21
- onClick?.();
22
- }, [exploreDispatch, onClick, url]);
23
- return (React.createElement(Link, { className: className, href: url.href, onClick: onNavigate, rel: REL_ATTRIBUTE.NO_OPENER, target: target }, label));
14
+ const entityListType = getEntityListType(url.href);
15
+ const filters = getSelectedFilters(url.query);
16
+ const grouping = getGrouping(url.query);
17
+ const sorting = getSorting(url.query);
18
+ return (React.createElement(Link, { className: className, href: url.href, onClick: () => {
19
+ exploreDispatch({
20
+ payload: { entityListType, filters, grouping, sorting },
21
+ type: ExploreActionKind.UpdateEntityFilters,
22
+ });
23
+ onClick?.();
24
+ }, rel: REL_ATTRIBUTE.NO_OPENER, target: target }, label));
24
25
  };
25
26
  /**
26
27
  * Returns the entity list type "entityListType" inferred from the given href.
@@ -30,6 +31,16 @@ export const ExploreViewLink = ({ className, label, onClick, target = ANCHOR_TAR
30
31
  function getEntityListType(href) {
31
32
  return href.substring(href.lastIndexOf("/") + 1);
32
33
  }
34
+ /**
35
+ * Returns the grouping from the given query.
36
+ * @param query - Query.
37
+ * @returns grouping.
38
+ */
39
+ function getGrouping(query) {
40
+ const decodedQuery = decodeURIComponent(query);
41
+ const parsedQuery = JSON.parse(decodedQuery);
42
+ return parsedQuery[PARAM_GROUPING];
43
+ }
33
44
  /**
34
45
  * Returns the selected filters from the given query.
35
46
  * @param query - Query.
@@ -4,6 +4,7 @@ import { RowPositionCell } from "../components/TableCell/components/RowPositionC
4
4
  export const COLUMN_DEF = {
5
5
  ROW_POSITION: {
6
6
  cell: RowPositionCell,
7
+ enableGrouping: false,
7
8
  enableHiding: false,
8
9
  enableSorting: false,
9
10
  header: "",
@@ -1,6 +1,6 @@
1
1
  import styled from "@emotion/styled";
2
2
  import { Table as MTable } from "@mui/material";
3
- import { smokeLightest, white } from "../../../styles/common/mixins/colors";
3
+ import { white } from "../../../styles/common/mixins/colors";
4
4
  export const GridTable = styled(MTable, {
5
5
  shouldForwardProp: (prop) => prop !== "gridTemplateColumns",
6
6
  }) `
@@ -12,7 +12,10 @@ export const GridTable = styled(MTable, {
12
12
  tbody,
13
13
  thead,
14
14
  tr {
15
- display: contents; /* required; allows grandchildren of grid template to appear as though direct child */
15
+ display: grid;
16
+ gap: inherit;
17
+ grid-column: 1 / -1;
18
+ grid-template-columns: subgrid;
16
19
  }
17
20
 
18
21
  tr {
@@ -34,13 +37,4 @@ export const GridTable = styled(MTable, {
34
37
  min-width: 0; /* required; flexbox child min-width property is "auto" by default making overflow-wrap ineffectual */
35
38
  }
36
39
  }
37
-
38
- [id^="grouped-row"] {
39
- background-color: ${smokeLightest};
40
-
41
- td {
42
- background-color: inherit;
43
- grid-column: 1 / -1;
44
- }
45
- }
46
40
  `;
@@ -1,5 +1,4 @@
1
- import { TableSortLabelProps } from "@mui/material";
2
- import { Cell, Column, ColumnFiltersState, ColumnSort, InitialTableState, PaginationState, Row, RowData, SortDirection, Table, VisibilityState } from "@tanstack/react-table";
1
+ import { Cell, Column, ColumnFiltersState, InitialTableState, PaginationState, Row, RowData, Table, VisibilityState } from "@tanstack/react-table";
3
2
  import { SelectCategory } from "../../../common/entities";
4
3
  import { ColumnConfig } from "../../../config/entities";
5
4
  import { ExploreMode } from "../../../hooks/useExploreMode";
@@ -31,12 +30,6 @@ export declare function arrIncludesSome<T extends RowData>(row: Row<T>, columnId
31
30
  * @returns Array of category views objects.
32
31
  */
33
32
  export declare function buildCategoryViews<T extends RowData>(columns: Column<T>[], columnFilters: ColumnFiltersState): SelectCategory[];
34
- /**
35
- * Returns the column sort direction.
36
- * @param sortDirection - Column sort direction.
37
- * @returns the coumn sort direction.
38
- */
39
- export declare function getColumnSortDirection(sortDirection: false | SortDirection): SortDirection | undefined;
40
33
  /**
41
34
  * Returns filtered entity results as a blob.
42
35
  * @param rows - Table rows.
@@ -67,28 +60,15 @@ export declare function getGridTemplateColumns<T extends RowData>(columns: Colum
67
60
  /**
68
61
  * Returns initial table state.
69
62
  * @param columns - Column configuration.
70
- * @param defaultSort - Column sort configuration.
71
63
  * @returns initial table state.
72
64
  */
73
- export declare function getInitialState(columns: ColumnConfig[], defaultSort: ColumnSort | undefined): InitialTableState;
74
- /**
75
- * Returns the initial table sorting state for the specified column sort configuration.
76
- * @param defaultSort - Column sort configuration.
77
- * @returns initial table sorting state.
78
- */
79
- export declare function getInitialTableStateSorting(defaultSort: ColumnSort | undefined): ColumnSort[];
65
+ export declare function getInitialState<T extends RowData>(columns: ColumnConfig<T>[]): InitialTableState;
80
66
  /**
81
67
  * Returns the pinned cell and its index tuple.
82
68
  * @param row - Row.
83
69
  * @returns pinned cell and index tuple.
84
70
  */
85
71
  export declare function getPinnedCellIndex<T extends RowData>(row: Row<T>): PinnedCell<T>;
86
- /**
87
- * Returns table sort label props.
88
- * @param column - Table column.
89
- * @returns table sort label props.
90
- */
91
- export declare function getTableSortLabelProps<T extends RowData>(column: Column<T>): TableSortLabelProps;
92
72
  /**
93
73
  * Returns table state pagination.
94
74
  * @param pageIndex - Explore state page index.
@@ -114,12 +94,6 @@ export declare function isClientFilteringEnabled(exploreMode: ExploreMode): bool
114
94
  * @returns true if the collapsable row is disabled.
115
95
  */
116
96
  export declare function isCollapsableRowDisabled<T extends RowData>(tableInstance: Table<T>): boolean;
117
- /**
118
- * Returns true if column has a sort direction.
119
- * @param sortDirection - Column sort direction.
120
- * @returns true when column has a sort direction.
121
- */
122
- export declare function isColumnSortActive(sortDirection: false | SortDirection): boolean;
123
97
  /**
124
98
  * Returns sort return value from the compare function. The compare function is dependent on the row value type:
125
99
  * - row values of type "array" use a compare function based off React Table "basic" compare function,
@@ -136,5 +110,5 @@ export declare function sortingFn<T>(rowA: Row<T>, rowB: Row<T>, columnId: strin
136
110
  * @param columns - Column configuration.
137
111
  * @returns initial table visibility state.
138
112
  */
139
- export declare function getInitialTableColumnVisibility(columns: ColumnConfig[]): VisibilityState;
113
+ export declare function getInitialTableColumnVisibility<T extends RowData>(columns: ColumnConfig<T>[]): VisibilityState;
140
114
  export {};
@@ -1,7 +1,7 @@
1
- import SouthRoundedIcon from "@mui/icons-material/SouthRounded";
2
1
  import { memo, sortingFns, } from "@tanstack/react-table";
3
2
  import { EXPLORE_MODE } from "../../../hooks/useExploreMode";
4
3
  import { ACCESSOR_KEYS } from "../../TableCreator/common/constants";
4
+ import { handleToggleVisibility } from "../components/TableFeatures/ColumnVisibility/utils";
5
5
  /**
6
6
  * Returns true if the row should be included in the filtered rows.
7
7
  * The row will be included if:
@@ -42,7 +42,7 @@ export function buildCategoryViews(columns, columnFilters) {
42
42
  const values = [...getFacetedUniqueValues()].map(([value, count]) => ({
43
43
  count,
44
44
  key: value,
45
- label: value,
45
+ label: String(value ?? ""),
46
46
  selected: false, // Selected state updated in reducer.
47
47
  }));
48
48
  categoryViews.push({
@@ -74,17 +74,6 @@ function formatDataToTSV(data) {
74
74
  })
75
75
  .join("\n");
76
76
  }
77
- /**
78
- * Returns the column sort direction.
79
- * @param sortDirection - Column sort direction.
80
- * @returns the coumn sort direction.
81
- */
82
- export function getColumnSortDirection(sortDirection) {
83
- if (!sortDirection) {
84
- return;
85
- }
86
- return sortDirection;
87
- }
88
77
  /**
89
78
  * Returns filtered entity results as a blob.
90
79
  * @param rows - Table rows.
@@ -108,13 +97,16 @@ export function getEditColumnOptions(table) {
108
97
  const { getAllColumns, initialState } = table;
109
98
  const { columnVisibility: initialVisibilityState } = initialState;
110
99
  const allColumns = getAllColumns();
111
- return allColumns.reduce((acc, { columnDef: { header }, getCanHide, getIsVisible, getToggleVisibilityHandler, id, }) => {
100
+ return allColumns.reduce((acc, column) => {
101
+ const { columnDef: { header }, getCanHide, getIsVisible, id, } = column;
112
102
  if (getCanHide()) {
113
103
  const option = {
114
104
  checked: getIsVisible(),
115
- disabled: initialVisibilityState[id],
105
+ disabled: initialVisibilityState[id], // TODO(cc) column visibility toggle should be disabled when table enableGrouping is false, and column is grouped.
116
106
  label: header, // TODO revisit type assertion here
117
- onChange: getToggleVisibilityHandler(),
107
+ onChange: () => {
108
+ handleToggleVisibility(table, column);
109
+ },
118
110
  value: id,
119
111
  };
120
112
  acc.push(option);
@@ -163,6 +155,7 @@ export function getFacetedUniqueValuesWithArrayValues() {
163
155
  */
164
156
  export function getGridTemplateColumns(columns) {
165
157
  return columns
158
+ .filter(filterGroupedColumn)
166
159
  .map(({ columnDef: { meta } }) => {
167
160
  const width = meta?.width;
168
161
  if (isGridTrackMinMax(width)) {
@@ -175,28 +168,14 @@ export function getGridTemplateColumns(columns) {
175
168
  /**
176
169
  * Returns initial table state.
177
170
  * @param columns - Column configuration.
178
- * @param defaultSort - Column sort configuration.
179
171
  * @returns initial table state.
180
172
  */
181
- export function getInitialState(columns, defaultSort) {
173
+ export function getInitialState(columns) {
182
174
  const columnVisibility = getInitialTableColumnVisibility(columns);
183
- const sorting = getInitialTableStateSorting(defaultSort);
184
175
  return {
185
176
  columnVisibility,
186
- sorting,
187
177
  };
188
178
  }
189
- /**
190
- * Returns the initial table sorting state for the specified column sort configuration.
191
- * @param defaultSort - Column sort configuration.
192
- * @returns initial table sorting state.
193
- */
194
- export function getInitialTableStateSorting(defaultSort) {
195
- if (!defaultSort) {
196
- return [];
197
- }
198
- return [defaultSort];
199
- }
200
179
  /**
201
180
  * Returns the pinned cell and its index tuple.
202
181
  * @param row - Row.
@@ -206,28 +185,18 @@ export function getPinnedCellIndex(row) {
206
185
  const visibleCells = row.getVisibleCells();
207
186
  let pinnedIndex = 0;
208
187
  for (let i = 0; i < visibleCells.length; i++) {
209
- if (visibleCells[i].column.columnDef.meta?.columnPinned) {
188
+ const cell = visibleCells[i];
189
+ if (cell.getIsGrouped()) {
190
+ pinnedIndex = i;
191
+ break;
192
+ }
193
+ if (cell.column.columnDef.meta?.columnPinned) {
210
194
  pinnedIndex = i;
211
195
  break;
212
196
  }
213
197
  }
214
198
  return [visibleCells[pinnedIndex], pinnedIndex];
215
199
  }
216
- /**
217
- * Returns table sort label props.
218
- * @param column - Table column.
219
- * @returns table sort label props.
220
- */
221
- export function getTableSortLabelProps(column) {
222
- const { getCanSort, getIsSorted, getToggleSortingHandler } = column;
223
- return {
224
- IconComponent: SouthRoundedIcon,
225
- active: isColumnSortActive(getIsSorted()),
226
- direction: getColumnSortDirection(getIsSorted()),
227
- disabled: !getCanSort(),
228
- onClick: getToggleSortingHandler(),
229
- };
230
- }
231
200
  /**
232
201
  * Returns table state pagination.
233
202
  * @param pageIndex - Explore state page index.
@@ -262,15 +231,22 @@ function getRowsTableData(rows) {
262
231
  .filter((cell) => cell.column.id !== ACCESSOR_KEYS.SELECT)
263
232
  .map((cell) => cell.getValue()));
264
233
  }
234
+ /**
235
+ * Returns true if the column is not grouped (filters out grouped columns).
236
+ * @param column - Table column.
237
+ * @returns true if the column is not grouped.
238
+ */
239
+ function filterGroupedColumn(column) {
240
+ return !column.getIsGrouped();
241
+ }
265
242
  /**
266
243
  * Returns true if any or all table rows are selected.
267
244
  * @param table - Table.
268
245
  * @returns true if a row is selected.
269
246
  */
270
247
  export function isAnyRowSelected(table) {
271
- const { getIsAllPageRowsSelected, getIsSomePageRowsSelected, options: { enableRowSelection }, } = table;
272
- return Boolean(enableRowSelection &&
273
- (getIsSomePageRowsSelected() || getIsAllPageRowsSelected()));
248
+ const { getIsAllPageRowsSelected, getIsSomePageRowsSelected } = table;
249
+ return getIsSomePageRowsSelected() || getIsAllPageRowsSelected();
274
250
  }
275
251
  /**
276
252
  * Returns true if client-side filtering is enabled.
@@ -289,17 +265,6 @@ export function isClientFilteringEnabled(exploreMode) {
289
265
  export function isCollapsableRowDisabled(tableInstance) {
290
266
  return tableInstance.getVisibleLeafColumns().length === 1;
291
267
  }
292
- /**
293
- * Returns true if column has a sort direction.
294
- * @param sortDirection - Column sort direction.
295
- * @returns true when column has a sort direction.
296
- */
297
- export function isColumnSortActive(sortDirection) {
298
- if (!sortDirection) {
299
- return sortDirection;
300
- }
301
- return true;
302
- }
303
268
  /**
304
269
  * Returns sort return value from the compare function. The compare function is dependent on the row value type:
305
270
  * - row values of type "array" use a compare function based off React Table "basic" compare function,
@@ -0,0 +1,3 @@
1
+ export declare const VIRTUALIZER_OPTIONS: {
2
+ overscan: number;
3
+ };
@@ -0,0 +1,3 @@
1
+ export const VIRTUALIZER_OPTIONS = {
2
+ overscan: 20,
3
+ };
@@ -0,0 +1,8 @@
1
+ import { Row, RowData } from "@tanstack/react-table";
2
+ import { UseVirtualizer } from "./types";
3
+ /**
4
+ * A hook to create and manage TanStack window virtualizer for table rows.
5
+ * @param rows - Rows.
6
+ * @returns An object containing the virtualizer instance, which manages the visible rows.
7
+ */
8
+ export declare function useVirtualizer<T extends RowData>(rows: Row<T>[]): UseVirtualizer;
@@ -0,0 +1,18 @@
1
+ import { useWindowVirtualizer } from "@tanstack/react-virtual";
2
+ import { useCallback } from "react";
3
+ import { VIRTUALIZER_OPTIONS } from "./constants";
4
+ /**
5
+ * A hook to create and manage TanStack window virtualizer for table rows.
6
+ * @param rows - Rows.
7
+ * @returns An object containing the virtualizer instance, which manages the visible rows.
8
+ */
9
+ export function useVirtualizer(rows) {
10
+ const estimateSize = useCallback(() => 100, []);
11
+ const count = rows.length;
12
+ const virtualizer = useWindowVirtualizer({
13
+ ...VIRTUALIZER_OPTIONS,
14
+ count,
15
+ estimateSize,
16
+ });
17
+ return { virtualizer };
18
+ }
@@ -0,0 +1,4 @@
1
+ import { Virtualizer } from "@tanstack/react-virtual";
2
+ export interface UseVirtualizer {
3
+ virtualizer: Virtualizer<Window, Element>;
4
+ }
@@ -1,7 +1,8 @@
1
- import { RowData, Table } from "@tanstack/react-table";
1
+ import { Row, RowData, Table } from "@tanstack/react-table";
2
2
  import { ROW_DIRECTION } from "../../common/entities";
3
3
  export interface TableBodyProps<T extends RowData> {
4
4
  rowDirection: ROW_DIRECTION;
5
+ rows: Row<T>[];
5
6
  tableInstance: Table<T>;
6
7
  }
7
- export declare const TableBody: <T extends RowData>({ rowDirection, tableInstance, }: TableBodyProps<T>) => JSX.Element;
8
+ export declare const TableBody: <T extends RowData>({ rowDirection, rows, tableInstance, }: TableBodyProps<T>) => JSX.Element;
@@ -1,37 +1,16 @@
1
1
  import { TableBody as MTableBody } from "@mui/material";
2
- import { useWindowVirtualizer } from "@tanstack/react-virtual";
3
- import React, { useCallback } from "react";
2
+ import React from "react";
4
3
  import { ROW_DIRECTION } from "../../common/entities";
5
4
  import { CollapsableRows } from "../TableRows/components/CollapsableRows/collapsableRows";
6
5
  import { VirtualizedRow } from "../TableRows/components/VirtualizedRow/virtualizedRow";
7
6
  import { TableRows } from "../TableRows/tableRows";
8
- const OVERSCAN = 20;
9
- export const TableBody = ({ rowDirection, tableInstance, }) => {
10
- const { getRowModel } = tableInstance;
11
- const { rows } = getRowModel();
12
- const estimateSize = useCallback(() => 100, []);
13
- const count = rows.length;
14
- const virtualizer = useWindowVirtualizer({
15
- count,
16
- estimateSize,
17
- measureElement,
18
- overscan: OVERSCAN,
19
- });
7
+ import { useVirtualizer } from "./hooks/virtualizer/hook";
8
+ import { getAllVirtualizedRows } from "./utils";
9
+ export const TableBody = ({ rowDirection, rows, tableInstance, }) => {
10
+ const virtualizedRows = getAllVirtualizedRows(tableInstance, rows, rowDirection);
11
+ const { virtualizer } = useVirtualizer(virtualizedRows);
20
12
  return (React.createElement(MTableBody, null,
21
13
  React.createElement(VirtualizedRow, { isUpperRow: true, virtualizer: virtualizer }),
22
- rowDirection === ROW_DIRECTION.DEFAULT ? (React.createElement(TableRows, { tableInstance: tableInstance, virtualizer: virtualizer })) : (React.createElement(CollapsableRows, { tableInstance: tableInstance, virtualizer: virtualizer })),
14
+ rowDirection === ROW_DIRECTION.DEFAULT ? (React.createElement(TableRows, { rows: virtualizedRows, virtualizer: virtualizer })) : (React.createElement(CollapsableRows, { rows: virtualizedRows, tableInstance: tableInstance, virtualizer: virtualizer })),
23
15
  React.createElement(VirtualizedRow, { isUpperRow: false, virtualizer: virtualizer })));
24
16
  };
25
- /**
26
- * Measures the height of the element.
27
- * @param element - Element to measure.
28
- * @returns height of the element.
29
- */
30
- function measureElement(element) {
31
- // We select the first child element because the row is not a box element due to the "display: contents" style attribute.
32
- const box = element.children[0];
33
- if (!box) {
34
- return 0;
35
- }
36
- return box.getBoundingClientRect().height;
37
- }