@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
@@ -13,27 +13,27 @@ export function mapCategoryKeyLabel(CATEGORY_KEY, CATEGORY_LABEL) {
13
13
  return categoryKeyLabel;
14
14
  }
15
15
  /**
16
- * Sanitizes a string for display i.e. any empty, null or undefined value is sanitized to "Unspecified".
17
- * @param str - String to sanitize.
16
+ * Sanitizes a value to a string for display i.e. any empty, null or undefined value is sanitized to "Unspecified".
17
+ * @param value - Value to sanitize.
18
18
  * @returns the string or sanitized string value.
19
19
  */
20
- export function sanitizeString(str) {
21
- if (str === "" || str === null || str === undefined) {
20
+ export function sanitizeString(value) {
21
+ if (value === "" || value === null || value === undefined) {
22
22
  return "Unspecified";
23
23
  }
24
24
  else {
25
- return str;
25
+ return String(value);
26
26
  }
27
27
  }
28
28
  /**
29
- * Sanitizes a string array for display i.e. any string element within the string array that is an empty, null or
29
+ * Sanitizes array elements to strings for display i.e. any element within the string array that is an empty, null or
30
30
  * undefined value is sanitized to "Unspecified".
31
- * @param strArray - String array to sanitize.
31
+ * @param array - Array to sanitize.
32
32
  * @returns the string array, sanitized.
33
33
  */
34
- export function sanitizeStringArray(strArray) {
35
- if (!strArray || strArray.length === 0) {
34
+ export function sanitizeStringArray(array) {
35
+ if (!array || array.length === 0) {
36
36
  return ["Unspecified"];
37
37
  }
38
- return strArray.map(sanitizeString);
38
+ return array.map(sanitizeString);
39
39
  }
@@ -72,7 +72,7 @@ export const ExploreView = (props) => {
72
72
  if (selected) {
73
73
  track(EVENT_NAME.FILTER_SELECTED, {
74
74
  [EVENT_PARAM.FILTER_NAME]: categoryKey,
75
- [EVENT_PARAM.FILTER_VALUE]: selectedCategoryValue,
75
+ [EVENT_PARAM.FILTER_VALUE]: String(selectedCategoryValue),
76
76
  });
77
77
  }
78
78
  };
@@ -152,7 +152,7 @@ function renderComponent(componentsConfig, response) {
152
152
  function renderList(exploreState, entityConfig, entityListType) {
153
153
  const { listItems, loading, tabValue } = exploreState;
154
154
  const { getId: getRowId, list, listView } = entityConfig;
155
- const { columns: columnsConfig, defaultSort, tableOptions } = list;
155
+ const { columns: columnsConfig } = list;
156
156
  if (!exploreState || !tabValue) {
157
157
  return React.createElement(React.Fragment, null); //TODO: return the loading UI component
158
158
  }
@@ -161,7 +161,7 @@ function renderList(exploreState, entityConfig, entityListType) {
161
161
  // loads with the previous tabs data on the first render after switching tabs. (or similar)
162
162
  return React.createElement(React.Fragment, null);
163
163
  }
164
- return (React.createElement(TableCreator, { columns: columnsConfig, defaultSort: defaultSort, getRowId: getRowId, items: listItems ?? [], listView: listView, loading: loading, tableOptions: tableOptions }));
164
+ return (React.createElement(TableCreator, { columns: columnsConfig, getRowId: getRowId, items: listItems ?? [], listView: listView, loading: loading }));
165
165
  }
166
166
  /**
167
167
  * Renders Summaries component when all the following requirements are fulfilled:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "17.0.0",
3
+ "version": "19.0.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -131,7 +131,7 @@ export function transformTermFacets(
131
131
  categoryValues.push({
132
132
  count: 0,
133
133
  key: term,
134
- label: term ?? LABEL.UNSPECIFIED,
134
+ label: String(term ?? LABEL.UNSPECIFIED),
135
135
  selected: false, // Selected state updated in filter hook
136
136
  });
137
137
  }
@@ -5,7 +5,7 @@ import { ParamValue } from "./filterTransformer";
5
5
  * @param value - Filter value.
6
6
  * @returns filter parameter value.
7
7
  */
8
- export function getFilterParameterValue(value: string): ParamValue {
8
+ export function getFilterParameterValue(value: unknown): ParamValue {
9
9
  if (value === "Unspecified") {
10
10
  return null;
11
11
  }
@@ -15,5 +15,7 @@ export function getFilterParameterValue(value: string): ParamValue {
15
15
  if (value === "false") {
16
16
  return false;
17
17
  }
18
- return value;
18
+ if (typeof value === "string" || typeof value === "boolean") return value;
19
+ if (value === null || value === undefined) return null;
20
+ return String(value);
19
21
  }
@@ -15,7 +15,7 @@ export interface CategoryTag {
15
15
  /**
16
16
  * Category values to be used as keys. For example, "Homo sapiens" or "10X 3' v2 sequencing".
17
17
  */
18
- export type CategoryValueKey = string;
18
+ export type CategoryValueKey = unknown;
19
19
 
20
20
  /**
21
21
  * Set of selected category values.
@@ -53,7 +53,7 @@ export interface SelectCategory {
53
53
  */
54
54
  export interface SelectCategoryValue {
55
55
  count: number;
56
- key: CategoryKey;
56
+ key: CategoryValueKey;
57
57
  label: string; // Allows for displaying null values as "Unspecified"
58
58
  selected: boolean;
59
59
  }
@@ -73,7 +73,7 @@ export interface SelectCategoryValueView {
73
73
  */
74
74
  export interface SelectCategoryView {
75
75
  isDisabled?: boolean;
76
- key: CategoryValueKey;
76
+ key: CategoryKey;
77
77
  label: string;
78
78
  values: SelectCategoryValueView[];
79
79
  }
@@ -3,6 +3,7 @@ import React, { Fragment } from "react";
3
3
  import { isCollapsableRowDisabled } from "../../../../../../../Table/common/utils";
4
4
  import { CollapsableCell } from "../../../../../../../Table/components/TableCell/components/CollapsableCell/collapsableCell";
5
5
  import { TableRow } from "../../../../../../../Table/components/TableRow/tableRow.styles";
6
+ import { useCollapsableRows } from "../../../../../../../Table/components/TableRows/components/CollapsableRows/hook";
6
7
 
7
8
  export interface CollapsableRowsProps<T extends RowData> {
8
9
  tableInstance: Table<T>;
@@ -13,6 +14,7 @@ export const CollapsableRows = <T extends RowData>({
13
14
  }: CollapsableRowsProps<T>): JSX.Element => {
14
15
  const { getRowModel } = tableInstance;
15
16
  const { rows } = getRowModel();
17
+ useCollapsableRows(tableInstance);
16
18
  return (
17
19
  <Fragment>
18
20
  {rows.map((row) => {
@@ -1,5 +1,5 @@
1
1
  import { TableCell } from "@mui/material";
2
- import { flexRender, Row, RowData, Table } from "@tanstack/react-table";
2
+ import { flexRender, RowData, Table } from "@tanstack/react-table";
3
3
  import React, { Fragment } from "react";
4
4
  import {
5
5
  getTableCellAlign,
@@ -26,9 +26,9 @@ export const TableRows = <T extends RowData>({
26
26
  {rows.map((row) => {
27
27
  return (
28
28
  <TableRow
29
- id={getRowId(row)}
30
- isPreview={row.getIsPreview()}
31
29
  key={row.id}
30
+ isGrouped={row.getIsGrouped()}
31
+ isPreview={row.getIsPreview()}
32
32
  >
33
33
  {row.getVisibleCells().map((cell) => {
34
34
  if (cell.getIsAggregated()) return null; // Display of aggregated cells is currently not supported.
@@ -50,18 +50,3 @@ export const TableRows = <T extends RowData>({
50
50
  </Fragment>
51
51
  );
52
52
  };
53
-
54
- /**
55
- * Returns identifier for a row.
56
- * @param row - Row.
57
- * @returns row identifier.
58
- */
59
- function getRowId<T extends RowData>(row: Row<T>): string | undefined {
60
- const { depth, getIsGrouped, id } = row;
61
- if (getIsGrouped()) {
62
- return `grouped-row-${id}`;
63
- }
64
- if (depth > 0) {
65
- return `sub-row-${id}`;
66
- }
67
- }
@@ -8,7 +8,7 @@ import {
8
8
  TableHead,
9
9
  TableRow,
10
10
  } from "@mui/material";
11
- import React, { Fragment } from "react";
11
+ import React from "react";
12
12
  import { formatCountSize } from "../../../../../../utils/formatCountSize";
13
13
  import { formatFileSize } from "../../../../../../utils/formatFileSize";
14
14
  import { CheckedIcon } from "../../../../../common/CustomIcon/components/CheckedIcon/checkedIcon";
@@ -81,37 +81,33 @@ export const ExportFileSummaryForm = ({
81
81
  </TableRow>
82
82
  </TableHead>
83
83
  <TableBody>
84
- <TableRow>
85
- {fileSummaryFacet.terms.map(
86
- ({ count, name, selected, size = 0 }) => (
87
- <Fragment key={name}>
88
- <TableCell>
89
- <FormControlLabel
90
- control={
91
- <Checkbox
92
- checked={selected}
93
- checkedIcon={<CheckedIcon />}
94
- icon={
95
- error ? <UncheckedErrorIcon /> : <UncheckedIcon />
96
- }
97
- onChange={(): void => {
98
- onClearError(error, ERROR.FILE_SUMMARY_ERROR);
99
- onFilter(fileSummaryFacet.name, name, selected);
100
- }}
101
- />
102
- }
103
- key={name}
104
- label={name}
105
- />
106
- </TableCell>
107
- <TableCell>{formatCountSize(count)}</TableCell>
108
- {hasFileSize && (
109
- <TableCell>{formatFileSize(size)}</TableCell>
110
- )}
111
- </Fragment>
112
- )
113
- )}
114
- </TableRow>
84
+ {fileSummaryFacet.terms.map(
85
+ ({ count, name, selected, size = 0 }) => (
86
+ <TableRow key={name}>
87
+ <TableCell>
88
+ <FormControlLabel
89
+ control={
90
+ <Checkbox
91
+ checked={selected}
92
+ checkedIcon={<CheckedIcon />}
93
+ icon={
94
+ error ? <UncheckedErrorIcon /> : <UncheckedIcon />
95
+ }
96
+ onChange={(): void => {
97
+ onClearError(error, ERROR.FILE_SUMMARY_ERROR);
98
+ onFilter(fileSummaryFacet.name, name, selected);
99
+ }}
100
+ />
101
+ }
102
+ key={name}
103
+ label={name}
104
+ />
105
+ </TableCell>
106
+ <TableCell>{formatCountSize(count)}</TableCell>
107
+ {hasFileSize && <TableCell>{formatFileSize(size)}</TableCell>}
108
+ </TableRow>
109
+ )
110
+ )}
115
111
  </TableBody>
116
112
  </GridTable>
117
113
  </GridPaper>
@@ -74,7 +74,7 @@ export function getSortMatchesFn(
74
74
  let match = matchString(value.label || "");
75
75
  if (match) {
76
76
  matches.push({ labelRanges: match.ranges, score: match.score, value });
77
- } else {
77
+ } else if (typeof value.key === "string") {
78
78
  match = matchString(value.key || "");
79
79
  if (match) matches.push({ score: match.score, value });
80
80
  }
@@ -17,7 +17,7 @@ import { FilterMenuSearchMatch } from "../../common/entities";
17
17
  import { List as FilterList } from "../FilterList/filterList.styles";
18
18
  import VariableSizeListItem from "../VariableSizeListItem/variableSizeListItem";
19
19
 
20
- export type ItemSizeByItemKey = Map<string, number>;
20
+ export type ItemSizeByItemKey = Map<unknown, number>;
21
21
 
22
22
  export interface VariableSizeListProps {
23
23
  categoryKey: CategoryKey;
@@ -19,7 +19,7 @@ interface Props {
19
19
  categorySection?: string;
20
20
  matchedItem: FilterMenuSearchMatch;
21
21
  onFilter: OnFilterFn;
22
- onUpdateItemSizeByItemKey: (itemKey: string, itemSize: number) => void;
22
+ onUpdateItemSizeByItemKey: (itemKey: unknown, itemSize: number) => void;
23
23
  style: CSSProperties;
24
24
  }
25
25
 
@@ -1,6 +1,6 @@
1
- import { ColumnSort } from "@tanstack/react-table";
1
+ import { ColumnSort, GroupingState } from "@tanstack/react-table";
2
2
  import Link from "next/link";
3
- import React, { useCallback } from "react";
3
+ import React from "react";
4
4
  import { UrlObject } from "url";
5
5
  import { SelectedFilter } from "../../../../../../common/entities";
6
6
  import { useExploreState } from "../../../../../../hooks/useExploreState";
@@ -16,6 +16,7 @@ import {
16
16
  import { LinkProps } from "../../link";
17
17
 
18
18
  const PARAM_FILTER = "filter";
19
+ const PARAM_GROUPING = "grouping";
19
20
  const PARAM_SORTING = "sorting";
20
21
 
21
22
  export interface ExploreViewLinkProps
@@ -36,22 +37,22 @@ export const ExploreViewLink = ({
36
37
  throwError(url);
37
38
  }
38
39
 
39
- const onNavigate = useCallback(() => {
40
- const entityListType = getEntityListType(url.href);
41
- const filters = getSelectedFilters(url.query);
42
- const sorting = getSorting(url.query);
43
- exploreDispatch({
44
- payload: { entityListType, filters, sorting },
45
- type: ExploreActionKind.UpdateEntityFilters,
46
- });
47
- onClick?.();
48
- }, [exploreDispatch, onClick, url]);
40
+ const entityListType = getEntityListType(url.href);
41
+ const filters = getSelectedFilters(url.query);
42
+ const grouping = getGrouping(url.query);
43
+ const sorting = getSorting(url.query);
49
44
 
50
45
  return (
51
46
  <Link
52
47
  className={className}
53
48
  href={url.href}
54
- onClick={onNavigate}
49
+ onClick={(): void => {
50
+ exploreDispatch({
51
+ payload: { entityListType, filters, grouping, sorting },
52
+ type: ExploreActionKind.UpdateEntityFilters,
53
+ });
54
+ onClick?.();
55
+ }}
55
56
  rel={REL_ATTRIBUTE.NO_OPENER}
56
57
  target={target}
57
58
  >
@@ -69,6 +70,19 @@ function getEntityListType(href: UrlObjectWithHrefAndQuery["href"]): string {
69
70
  return href.substring(href.lastIndexOf("/") + 1);
70
71
  }
71
72
 
73
+ /**
74
+ * Returns the grouping from the given query.
75
+ * @param query - Query.
76
+ * @returns grouping.
77
+ */
78
+ function getGrouping(
79
+ query: UrlObjectWithHrefAndQuery["query"]
80
+ ): GroupingState | undefined {
81
+ const decodedQuery = decodeURIComponent(query);
82
+ const parsedQuery = JSON.parse(decodedQuery);
83
+ return parsedQuery[PARAM_GROUPING];
84
+ }
85
+
72
86
  /**
73
87
  * Returns the selected filters from the given query.
74
88
  * @param query - Query.
@@ -6,6 +6,7 @@ import { RowPositionCell } from "../components/TableCell/components/RowPositionC
6
6
  export const COLUMN_DEF: Record<string, ColumnDef<RowData>> = {
7
7
  ROW_POSITION: {
8
8
  cell: RowPositionCell,
9
+ enableGrouping: false,
9
10
  enableHiding: false,
10
11
  enableSorting: false,
11
12
  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
 
5
5
  export interface GridTableProps {
6
6
  gridTemplateColumns: string;
@@ -17,7 +17,10 @@ export const GridTable = styled(MTable, {
17
17
  tbody,
18
18
  thead,
19
19
  tr {
20
- display: contents; /* required; allows grandchildren of grid template to appear as though direct child */
20
+ display: grid;
21
+ gap: inherit;
22
+ grid-column: 1 / -1;
23
+ grid-template-columns: subgrid;
21
24
  }
22
25
 
23
26
  tr {
@@ -39,13 +42,4 @@ export const GridTable = styled(MTable, {
39
42
  min-width: 0; /* required; flexbox child min-width property is "auto" by default making overflow-wrap ineffectual */
40
43
  }
41
44
  }
42
-
43
- [id^="grouped-row"] {
44
- background-color: ${smokeLightest};
45
-
46
- td {
47
- background-color: inherit;
48
- grid-column: 1 / -1;
49
- }
50
- }
51
45
  `;
@@ -1,16 +1,12 @@
1
- import SouthRoundedIcon from "@mui/icons-material/SouthRounded";
2
- import { TableSortLabelProps } from "@mui/material";
3
1
  import {
4
2
  Cell,
5
3
  Column,
6
4
  ColumnFiltersState,
7
- ColumnSort,
8
5
  InitialTableState,
9
6
  memo,
10
7
  PaginationState,
11
8
  Row,
12
9
  RowData,
13
- SortDirection,
14
10
  sortingFns,
15
11
  Table,
16
12
  VisibilityState,
@@ -24,6 +20,7 @@ import {
24
20
  import { EXPLORE_MODE, ExploreMode } from "../../../hooks/useExploreMode";
25
21
  import { ACCESSOR_KEYS } from "../../TableCreator/common/constants";
26
22
  import { CheckboxMenuListItem } from "../components/CheckboxMenu/checkboxMenu";
23
+ import { handleToggleVisibility } from "../components/TableFeatures/ColumnVisibility/utils";
27
24
 
28
25
  /**
29
26
  * Internal model of a category term count keyed by category term.
@@ -88,7 +85,7 @@ export function buildCategoryViews<T extends RowData>(
88
85
  const values = [...getFacetedUniqueValues()].map(([value, count]) => ({
89
86
  count,
90
87
  key: value,
91
- label: value,
88
+ label: String(value ?? ""),
92
89
  selected: false, // Selected state updated in reducer.
93
90
  }));
94
91
  categoryViews.push({
@@ -122,20 +119,6 @@ function formatDataToTSV(data: TableData[][]): string {
122
119
  .join("\n");
123
120
  }
124
121
 
125
- /**
126
- * Returns the column sort direction.
127
- * @param sortDirection - Column sort direction.
128
- * @returns the coumn sort direction.
129
- */
130
- export function getColumnSortDirection(
131
- sortDirection: false | SortDirection
132
- ): SortDirection | undefined {
133
- if (!sortDirection) {
134
- return;
135
- }
136
- return sortDirection;
137
- }
138
-
139
122
  /**
140
123
  * Returns filtered entity results as a blob.
141
124
  * @param rows - Table rows.
@@ -164,31 +147,27 @@ export function getEditColumnOptions<T extends RowData>(
164
147
  const { getAllColumns, initialState } = table;
165
148
  const { columnVisibility: initialVisibilityState } = initialState;
166
149
  const allColumns = getAllColumns();
167
- return allColumns.reduce(
168
- (
169
- acc,
170
- {
171
- columnDef: { header },
172
- getCanHide,
173
- getIsVisible,
174
- getToggleVisibilityHandler,
175
- id,
176
- }
177
- ) => {
178
- if (getCanHide()) {
179
- const option: CheckboxMenuListItem = {
180
- checked: getIsVisible(),
181
- disabled: initialVisibilityState[id],
182
- label: header as string, // TODO revisit type assertion here
183
- onChange: getToggleVisibilityHandler(),
184
- value: id,
185
- };
186
- acc.push(option);
187
- }
188
- return acc;
189
- },
190
- [] as CheckboxMenuListItem[]
191
- );
150
+ return allColumns.reduce((acc, column) => {
151
+ const {
152
+ columnDef: { header },
153
+ getCanHide,
154
+ getIsVisible,
155
+ id,
156
+ } = column;
157
+ if (getCanHide()) {
158
+ const option: CheckboxMenuListItem = {
159
+ checked: getIsVisible(),
160
+ disabled: initialVisibilityState[id], // TODO(cc) column visibility toggle should be disabled when table enableGrouping is false, and column is grouped.
161
+ label: header as string, // TODO revisit type assertion here
162
+ onChange: () => {
163
+ handleToggleVisibility(table, column);
164
+ },
165
+ value: id,
166
+ };
167
+ acc.push(option);
168
+ }
169
+ return acc;
170
+ }, [] as CheckboxMenuListItem[]);
192
171
  }
193
172
 
194
173
  /**
@@ -243,6 +222,7 @@ export function getGridTemplateColumns<T extends RowData>(
243
222
  columns: Column<T>[]
244
223
  ): string {
245
224
  return columns
225
+ .filter(filterGroupedColumn)
246
226
  .map(({ columnDef: { meta } }) => {
247
227
  const width = meta?.width;
248
228
  if (isGridTrackMinMax(width)) {
@@ -256,35 +236,17 @@ export function getGridTemplateColumns<T extends RowData>(
256
236
  /**
257
237
  * Returns initial table state.
258
238
  * @param columns - Column configuration.
259
- * @param defaultSort - Column sort configuration.
260
239
  * @returns initial table state.
261
240
  */
262
- export function getInitialState(
263
- columns: ColumnConfig[],
264
- defaultSort: ColumnSort | undefined
241
+ export function getInitialState<T extends RowData>(
242
+ columns: ColumnConfig<T>[]
265
243
  ): InitialTableState {
266
244
  const columnVisibility = getInitialTableColumnVisibility(columns);
267
- const sorting = getInitialTableStateSorting(defaultSort);
268
245
  return {
269
246
  columnVisibility,
270
- sorting,
271
247
  };
272
248
  }
273
249
 
274
- /**
275
- * Returns the initial table sorting state for the specified column sort configuration.
276
- * @param defaultSort - Column sort configuration.
277
- * @returns initial table sorting state.
278
- */
279
- export function getInitialTableStateSorting(
280
- defaultSort: ColumnSort | undefined
281
- ): ColumnSort[] {
282
- if (!defaultSort) {
283
- return [];
284
- }
285
- return [defaultSort];
286
- }
287
-
288
250
  /**
289
251
  * Returns the pinned cell and its index tuple.
290
252
  * @param row - Row.
@@ -296,7 +258,12 @@ export function getPinnedCellIndex<T extends RowData>(
296
258
  const visibleCells = row.getVisibleCells();
297
259
  let pinnedIndex = 0;
298
260
  for (let i = 0; i < visibleCells.length; i++) {
299
- if (visibleCells[i].column.columnDef.meta?.columnPinned) {
261
+ const cell = visibleCells[i];
262
+ if (cell.getIsGrouped()) {
263
+ pinnedIndex = i;
264
+ break;
265
+ }
266
+ if (cell.column.columnDef.meta?.columnPinned) {
300
267
  pinnedIndex = i;
301
268
  break;
302
269
  }
@@ -304,24 +271,6 @@ export function getPinnedCellIndex<T extends RowData>(
304
271
  return [visibleCells[pinnedIndex], pinnedIndex];
305
272
  }
306
273
 
307
- /**
308
- * Returns table sort label props.
309
- * @param column - Table column.
310
- * @returns table sort label props.
311
- */
312
- export function getTableSortLabelProps<T extends RowData>(
313
- column: Column<T>
314
- ): TableSortLabelProps {
315
- const { getCanSort, getIsSorted, getToggleSortingHandler } = column;
316
- return {
317
- IconComponent: SouthRoundedIcon,
318
- active: isColumnSortActive(getIsSorted()),
319
- direction: getColumnSortDirection(getIsSorted()),
320
- disabled: !getCanSort(),
321
- onClick: getToggleSortingHandler(),
322
- };
323
- }
324
-
325
274
  /**
326
275
  * Returns table state pagination.
327
276
  * @param pageIndex - Explore state page index.
@@ -364,21 +313,23 @@ function getRowsTableData<T extends RowData>(rows: Row<T>[]): TableData[][] {
364
313
  );
365
314
  }
366
315
 
316
+ /**
317
+ * Returns true if the column is not grouped (filters out grouped columns).
318
+ * @param column - Table column.
319
+ * @returns true if the column is not grouped.
320
+ */
321
+ function filterGroupedColumn<T extends RowData>(column: Column<T>): boolean {
322
+ return !column.getIsGrouped();
323
+ }
324
+
367
325
  /**
368
326
  * Returns true if any or all table rows are selected.
369
327
  * @param table - Table.
370
328
  * @returns true if a row is selected.
371
329
  */
372
330
  export function isAnyRowSelected<T extends RowData>(table: Table<T>): boolean {
373
- const {
374
- getIsAllPageRowsSelected,
375
- getIsSomePageRowsSelected,
376
- options: { enableRowSelection },
377
- } = table;
378
- return Boolean(
379
- enableRowSelection &&
380
- (getIsSomePageRowsSelected() || getIsAllPageRowsSelected())
381
- );
331
+ const { getIsAllPageRowsSelected, getIsSomePageRowsSelected } = table;
332
+ return getIsSomePageRowsSelected() || getIsAllPageRowsSelected();
382
333
  }
383
334
 
384
335
  /**
@@ -404,20 +355,6 @@ export function isCollapsableRowDisabled<T extends RowData>(
404
355
  return tableInstance.getVisibleLeafColumns().length === 1;
405
356
  }
406
357
 
407
- /**
408
- * Returns true if column has a sort direction.
409
- * @param sortDirection - Column sort direction.
410
- * @returns true when column has a sort direction.
411
- */
412
- export function isColumnSortActive(
413
- sortDirection: false | SortDirection
414
- ): boolean {
415
- if (!sortDirection) {
416
- return sortDirection;
417
- }
418
- return true;
419
- }
420
-
421
358
  /**
422
359
  * Returns sort return value from the compare function. The compare function is dependent on the row value type:
423
360
  * - row values of type "array" use a compare function based off React Table "basic" compare function,
@@ -465,8 +402,8 @@ function basicSort<TValue>(val0: TValue, val1: TValue): number {
465
402
  * @param columns - Column configuration.
466
403
  * @returns initial table visibility state.
467
404
  */
468
- export function getInitialTableColumnVisibility(
469
- columns: ColumnConfig[]
405
+ export function getInitialTableColumnVisibility<T extends RowData>(
406
+ columns: ColumnConfig<T>[]
470
407
  ): VisibilityState {
471
408
  return columns.reduce((acc, { columnVisible = true, id }) => {
472
409
  Object.assign(acc, { [id]: columnVisible });
@@ -0,0 +1,3 @@
1
+ export const VIRTUALIZER_OPTIONS = {
2
+ overscan: 20,
3
+ };