@databiosphere/findable-ui 44.0.0 → 45.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 (95) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +29 -0
  3. package/lib/components/DataDictionary/components/Table/options/core/constants.js +2 -1
  4. package/lib/components/DataDictionary/components/Table/options/hook.js +2 -0
  5. package/lib/components/Detail/components/Table/common/utils.js +1 -1
  6. package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +1 -1
  7. package/lib/components/Detail/components/Table/components/TableRows/tableRows.js +1 -1
  8. package/lib/components/Detail/components/Table/table.js +10 -1
  9. package/lib/components/Index/table/hook.js +10 -1
  10. package/lib/components/Table/common/columnDef.js +2 -0
  11. package/lib/components/Table/common/utils.d.ts +0 -6
  12. package/lib/components/Table/common/utils.js +0 -63
  13. package/lib/components/Table/components/TableCell/components/RowSelectionCell/constants.d.ts +2 -0
  14. package/lib/components/Table/components/TableCell/components/RowSelectionCell/constants.js +13 -0
  15. package/lib/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.js +12 -8
  16. package/lib/components/Table/components/TableFeatures/TableDownload/tableDownload.d.ts +3 -0
  17. package/lib/components/Table/components/TableFeatures/TableDownload/tableDownload.js +9 -0
  18. package/lib/components/Table/components/{DownloadEntityResults/downloadEntityResults.styles.js → TableFeatures/TableDownload/tableDownload.styles.js} +1 -1
  19. package/lib/components/Table/components/TableFeatures/TableDownload/types.d.ts +5 -0
  20. package/lib/components/Table/components/TableFeatures/TableDownload/types.js +1 -0
  21. package/lib/components/Table/components/TableRow/tableRow.styles.d.ts +2 -0
  22. package/lib/components/Table/components/TableRow/tableRow.styles.js +15 -1
  23. package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +1 -1
  24. package/lib/components/Table/components/TableRows/tableRows.js +1 -1
  25. package/lib/components/Table/components/TableToolbar/tableToolbar.js +3 -3
  26. package/lib/components/Table/components/TableToolbar2/tableToolbar2.d.ts +3 -0
  27. package/lib/components/Table/components/TableToolbar2/tableToolbar2.js +8 -0
  28. package/lib/components/Table/components/TableToolbar2/tableToolbar2.styles.d.ts +10 -0
  29. package/lib/components/Table/components/TableToolbar2/tableToolbar2.styles.js +16 -0
  30. package/lib/components/Table/components/TableToolbar2/types.d.ts +4 -0
  31. package/lib/components/Table/components/TableToolbar2/types.js +1 -0
  32. package/lib/components/Table/featureOptions/tableDownload/constants.d.ts +3 -0
  33. package/lib/components/Table/featureOptions/tableDownload/constants.js +3 -0
  34. package/lib/components/Table/features/RowSelectionValidation/constants.d.ts +2 -0
  35. package/lib/components/Table/features/RowSelectionValidation/constants.js +14 -0
  36. package/lib/components/Table/features/RowSelectionValidation/types.d.ts +8 -0
  37. package/lib/components/Table/features/RowSelectionValidation/types.js +1 -0
  38. package/lib/components/Table/features/RowSelectionValidation/utils.d.ts +8 -0
  39. package/lib/components/Table/features/RowSelectionValidation/utils.js +11 -0
  40. package/lib/components/Table/features/TableDownload/constants.d.ts +2 -0
  41. package/lib/components/Table/features/TableDownload/constants.js +10 -0
  42. package/lib/components/Table/features/TableDownload/onDownload/utils.d.ts +14 -0
  43. package/lib/components/Table/features/TableDownload/onDownload/utils.js +63 -0
  44. package/lib/components/Table/features/TableDownload/types.d.ts +15 -0
  45. package/lib/components/Table/features/TableDownload/types.js +1 -0
  46. package/lib/components/Table/features/TableDownload/utils.d.ts +19 -0
  47. package/lib/components/Table/features/TableDownload/utils.js +46 -0
  48. package/lib/components/Table/features/entities.d.ts +9 -3
  49. package/lib/components/TableCreator/options/hook.js +0 -3
  50. package/lib/components/common/CustomIcon/components/UncheckedDisabledIcon/uncheckedDisabledIcon.d.ts +2 -0
  51. package/lib/components/common/CustomIcon/components/UncheckedDisabledIcon/uncheckedDisabledIcon.js +8 -0
  52. package/lib/config/entities.d.ts +0 -1
  53. package/package.json +1 -1
  54. package/src/components/DataDictionary/components/Table/options/core/constants.ts +2 -1
  55. package/src/components/DataDictionary/components/Table/options/hook.ts +2 -0
  56. package/src/components/Detail/components/Table/common/utils.ts +1 -1
  57. package/src/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +1 -0
  58. package/src/components/Detail/components/Table/components/TableRows/tableRows.tsx +2 -0
  59. package/src/components/Detail/components/Table/table.tsx +10 -1
  60. package/src/components/Index/table/hook.ts +10 -1
  61. package/src/components/Table/common/columnDef.ts +2 -0
  62. package/src/components/Table/common/utils.ts +0 -75
  63. package/src/components/Table/components/TableCell/components/RowSelectionCell/constants.ts +15 -0
  64. package/src/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.tsx +25 -13
  65. package/src/components/Table/components/{DownloadEntityResults/downloadEntityResults.styles.ts → TableFeatures/TableDownload/tableDownload.styles.ts} +1 -1
  66. package/src/components/Table/components/TableFeatures/TableDownload/tableDownload.tsx +23 -0
  67. package/src/components/Table/components/TableFeatures/TableDownload/types.ts +7 -0
  68. package/src/components/Table/components/TableRow/tableRow.styles.ts +19 -1
  69. package/src/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +1 -0
  70. package/src/components/Table/components/TableRows/tableRows.tsx +2 -0
  71. package/src/components/Table/components/TableToolbar/tableToolbar.tsx +3 -8
  72. package/src/components/Table/components/TableToolbar2/tableToolbar2.styles.ts +18 -0
  73. package/src/components/Table/components/TableToolbar2/tableToolbar2.tsx +17 -0
  74. package/src/components/Table/components/TableToolbar2/types.ts +5 -0
  75. package/src/components/Table/featureOptions/tableDownload/constants.ts +9 -0
  76. package/src/components/Table/features/RowSelectionValidation/constants.ts +24 -0
  77. package/src/components/Table/features/RowSelectionValidation/types.ts +10 -0
  78. package/src/components/Table/features/RowSelectionValidation/utils.ts +15 -0
  79. package/src/components/Table/features/TableDownload/constants.ts +24 -0
  80. package/src/components/Table/features/TableDownload/onDownload/utils.ts +76 -0
  81. package/src/components/Table/features/TableDownload/types.ts +19 -0
  82. package/src/components/Table/features/TableDownload/utils.ts +60 -0
  83. package/src/components/Table/features/entities.ts +27 -3
  84. package/src/components/TableCreator/options/hook.ts +0 -3
  85. package/src/components/common/CustomIcon/components/UncheckedDisabledIcon/uncheckedDisabledIcon.tsx +27 -0
  86. package/src/config/entities.ts +0 -1
  87. package/tests/rowSelectionValidation.test.ts +282 -0
  88. package/types/data-explorer-ui.d.ts +16 -2
  89. package/lib/components/Table/components/DownloadEntityResults/downloadEntityResults.d.ts +0 -6
  90. package/lib/components/Table/components/DownloadEntityResults/downloadEntityResults.js +0 -18
  91. package/lib/components/common/Button/components/FileDownloadButton/fileDownloadButton.d.ts +0 -5
  92. package/lib/components/common/Button/components/FileDownloadButton/fileDownloadButton.js +0 -14
  93. package/src/components/Table/components/DownloadEntityResults/downloadEntityResults.tsx +0 -39
  94. package/src/components/common/Button/components/FileDownloadButton/fileDownloadButton.tsx +0 -27
  95. /package/lib/components/Table/components/{DownloadEntityResults/downloadEntityResults.styles.d.ts → TableFeatures/TableDownload/tableDownload.styles.d.ts} +0 -0
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "44.0.0"
2
+ ".": "45.1.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## [45.1.0](https://github.com/DataBiosphere/findable-ui/compare/v45.0.0...v45.1.0) (2025-09-18)
4
+
5
+
6
+ ### Features
7
+
8
+ * extend row selection feature to handle validation messages for each row ([#666](https://github.com/DataBiosphere/findable-ui/issues/666)) ([#669](https://github.com/DataBiosphere/findable-ui/issues/669)) ([04fc041](https://github.com/DataBiosphere/findable-ui/commit/04fc0411cae9f1ae9c47d8f384e599413cffe639))
9
+ * update row selection component to display disabled state ([#663](https://github.com/DataBiosphere/findable-ui/issues/663)) ([#667](https://github.com/DataBiosphere/findable-ui/issues/667)) ([c2c9fb2](https://github.com/DataBiosphere/findable-ui/commit/c2c9fb24e458858dd6d26be2be8e74f4e3e976da))
10
+ * update table row to display disabled state ([#665](https://github.com/DataBiosphere/findable-ui/issues/665)) ([#668](https://github.com/DataBiosphere/findable-ui/issues/668)) ([2c6000f](https://github.com/DataBiosphere/findable-ui/commit/2c6000f86d0066b91409032f9970284f6b4b6443))
11
+
12
+ ## [45.0.0](https://github.com/DataBiosphere/findable-ui/compare/v44.0.0...v45.0.0) (2025-09-10)
13
+
14
+
15
+ ### ⚠ BREAKING CHANGES
16
+
17
+ * refactor existing tabletoolbar with download button component ([#652](https://github.com/DataBiosphere/findable-ui/issues/652)) (#656)
18
+
19
+ ### Features
20
+
21
+ * create download button ([#651](https://github.com/DataBiosphere/findable-ui/issues/651)) ([#655](https://github.com/DataBiosphere/findable-ui/issues/655)) ([2c4959a](https://github.com/DataBiosphere/findable-ui/commit/2c4959ac3f30e81d65466d3b3edfa559997053d6))
22
+ * create new tabletoolbar with download button - independent of explorestate ([#653](https://github.com/DataBiosphere/findable-ui/issues/653)) ([028558a](https://github.com/DataBiosphere/findable-ui/commit/028558a3f0d7bc51da5bc30a1e847b04c41c32c0))
23
+ * create new tabletoolbar with download button - independent of explorestate ([#653](https://github.com/DataBiosphere/findable-ui/issues/653)) ([#657](https://github.com/DataBiosphere/findable-ui/issues/657)) ([028558a](https://github.com/DataBiosphere/findable-ui/commit/028558a3f0d7bc51da5bc30a1e847b04c41c32c0))
24
+ * implement tanstack custom feature to support download table data ([#650](https://github.com/DataBiosphere/findable-ui/issues/650)) ([#654](https://github.com/DataBiosphere/findable-ui/issues/654)) ([c897fbb](https://github.com/DataBiosphere/findable-ui/commit/c897fbb68003af09fe04ccbfed18ec71fe8ef5a7))
25
+ * refactor existing tabletoolbar with download button component ([#652](https://github.com/DataBiosphere/findable-ui/issues/652)) ([#656](https://github.com/DataBiosphere/findable-ui/issues/656)) ([f4d5695](https://github.com/DataBiosphere/findable-ui/commit/f4d5695c28e1f4a6d7a3df2d684d4472005f33c0))
26
+
27
+
28
+ ### Code Refactoring
29
+
30
+ * align table download feature more closely with tanstack standards ([#659](https://github.com/DataBiosphere/findable-ui/issues/659)) ([#660](https://github.com/DataBiosphere/findable-ui/issues/660)) ([46d3bb3](https://github.com/DataBiosphere/findable-ui/commit/46d3bb315f8aaf4ed25c7c5c81e364d7c000f332))
31
+
3
32
  ## [44.0.0](https://github.com/DataBiosphere/findable-ui/compare/v43.0.0...v44.0.0) (2025-08-28)
4
33
 
5
34
 
@@ -1,7 +1,8 @@
1
1
  import { getCoreRowModel } from "@tanstack/react-table";
2
2
  import { ROW_POSITION } from "../../../../../Table/features/RowPosition/constants";
3
3
  import { ROW_PREVIEW } from "../../../../../Table/features/RowPreview/constants";
4
+ import { TABLE_DOWNLOAD } from "../../../../../Table/features/TableDownload/constants";
4
5
  export const CORE_OPTIONS = {
5
- _features: [ROW_POSITION, ROW_PREVIEW],
6
+ _features: [ROW_POSITION, ROW_PREVIEW, TABLE_DOWNLOAD],
6
7
  getCoreRowModel: getCoreRowModel(),
7
8
  };
@@ -1,3 +1,4 @@
1
+ import { TABLE_DOWNLOAD_OPTIONS } from "../../../../Table/featureOptions/tableDownload/constants";
1
2
  import { useColumnFiltersOptions } from "./columnFilters/hook";
2
3
  import { CORE_OPTIONS } from "./core/constants";
3
4
  import { EXPANDED_OPTIONS } from "./expanded/constants";
@@ -22,6 +23,7 @@ export const useTableOptions = () => {
22
23
  ...GROUPING_OPTIONS,
23
24
  ...PAGINATION_OPTIONS,
24
25
  ...SORTING_OPTIONS,
26
+ ...TABLE_DOWNLOAD_OPTIONS,
25
27
  ...VISIBILITY_OPTIONS,
26
28
  };
27
29
  };
@@ -9,7 +9,7 @@ export function generateColumnDefinitions(columns) {
9
9
  ...column,
10
10
  meta: {
11
11
  ...column.meta,
12
- header: column.meta?.header || column.header,
12
+ header: column.meta?.header ?? column.header,
13
13
  },
14
14
  };
15
15
  });
@@ -10,7 +10,7 @@ export const CollapsableRows = ({ rows: leafOrSubRows, tableInstance, }) => {
10
10
  return (React.createElement(Fragment, null, (leafOrSubRows || rows).map((row) => {
11
11
  if (row.depth > 0 && !leafOrSubRows)
12
12
  return null; // Hide sub rows that are not already leaf or sub rows.
13
- return (React.createElement(StyledTableRow, { key: row.id, id: row.id, isPreview: row.getIsPreview() },
13
+ return (React.createElement(StyledTableRow, { key: row.id, id: row.id, isPreview: row.getIsPreview(), isSelected: row.getIsSelected() },
14
14
  React.createElement(CollapsableCell, { isDisabled: isCollapsableRowDisabled(tableInstance), row: row })));
15
15
  })));
16
16
  };
@@ -10,7 +10,7 @@ export const TableRows = ({ rows: leafOrSubRows, tableInstance, tableView, }) =>
10
10
  const { tableCell } = tableView || {};
11
11
  const { size: tableCellSize = "medium" } = tableCell || {};
12
12
  return (React.createElement(Fragment, null, (leafOrSubRows || rows).map((row) => {
13
- return (React.createElement(StyledTableRow, { key: row.id, id: row.id, canExpand: row.getCanExpand(), isExpanded: row.getIsExpanded(), isGrouped: row.getIsGrouped(), isPreview: row.getIsPreview(), onClick: () => handleToggleExpanded(row) }, row.getVisibleCells().map((cell) => {
13
+ return (React.createElement(StyledTableRow, { key: row.id, id: row.id, canExpand: row.getCanExpand(), canSelect: row.getCanSelect(), isExpanded: row.getIsExpanded(), isGrouped: row.getIsGrouped(), isPreview: row.getIsPreview(), isSelected: row.getIsSelected(), onClick: () => handleToggleExpanded(row) }, row.getVisibleCells().map((cell) => {
14
14
  if (cell.getIsAggregated())
15
15
  return null; // Display of aggregated cells is currently not supported.
16
16
  if (cell.getIsPlaceholder())
@@ -6,8 +6,11 @@ import { arrIncludesSome } from "../../../Table/columnDef/columnFilters/filterFn
6
6
  import { COLUMN_DEF } from "../../../Table/common/columnDef";
7
7
  import { ROW_DIRECTION } from "../../../Table/common/entities";
8
8
  import { TableHead } from "../../../Table/components/TableHead/tableHead";
9
+ import { TABLE_DOWNLOAD_OPTIONS } from "../../../Table/featureOptions/tableDownload/constants";
9
10
  import { ROW_POSITION } from "../../../Table/features/RowPosition/constants";
10
11
  import { ROW_PREVIEW } from "../../../Table/features/RowPreview/constants";
12
+ import { ROW_SELECTION_VALIDATION } from "../../../Table/features/RowSelectionValidation/constants";
13
+ import { TABLE_DOWNLOAD } from "../../../Table/features/TableDownload/constants";
11
14
  import { GridTable } from "../../../Table/table.styles";
12
15
  import { generateColumnDefinitions } from "./common/utils";
13
16
  import { TableBody } from "./components/TableBody/tableBody";
@@ -18,7 +21,12 @@ export const Table = ({ className, collapsable = true, columns, gridTemplateColu
18
21
  const { stickyHeader = false } = table || {};
19
22
  const { sx: tableContainerSx } = tableContainer || {};
20
23
  const tableInstance = useReactTable({
21
- _features: [ROW_POSITION, ROW_PREVIEW],
24
+ _features: [
25
+ ROW_POSITION,
26
+ ROW_PREVIEW,
27
+ ROW_SELECTION_VALIDATION,
28
+ TABLE_DOWNLOAD,
29
+ ],
22
30
  columns: generateColumnDefinitions([
23
31
  COLUMN_DEF.ROW_POSITION,
24
32
  ...columns,
@@ -27,6 +35,7 @@ export const Table = ({ className, collapsable = true, columns, gridTemplateColu
27
35
  enableSorting: false,
28
36
  filterFns: { arrIncludesSome },
29
37
  getCoreRowModel: getCoreRowModel(),
38
+ ...TABLE_DOWNLOAD_OPTIONS,
30
39
  ...tableOptions,
31
40
  });
32
41
  return (React.createElement(TableContainer, { className: className, sx: tableContainerSx },
@@ -11,8 +11,11 @@ import { arrIncludesSome } from "../../Table/columnDef/columnFilters/filterFn";
11
11
  import { COLUMN_DEF } from "../../Table/common/columnDef";
12
12
  import { buildCategoryViews, getFacetedUniqueValuesWithArrayValues, getTableStatePagination, isClientFilteringEnabled, sortingFn, } from "../../Table/common/utils";
13
13
  import { getFacetedMinMaxValues } from "../../Table/featureOptions/facetedColumn/getFacetedMinMaxValues";
14
+ import { TABLE_DOWNLOAD_OPTIONS } from "../../Table/featureOptions/tableDownload/constants";
14
15
  import { ROW_POSITION } from "../../Table/features/RowPosition/constants";
15
16
  import { ROW_PREVIEW } from "../../Table/features/RowPreview/constants";
17
+ import { ROW_SELECTION_VALIDATION } from "../../Table/features/RowSelectionValidation/constants";
18
+ import { TABLE_DOWNLOAD } from "../../Table/features/TableDownload/constants";
16
19
  import { buildBaseColumnDef } from "../../TableCreator/common/utils";
17
20
  import { useTableOptions } from "../../TableCreator/options/hook";
18
21
  import { createCell } from "./coreOptions/columns/cellFactory";
@@ -97,7 +100,12 @@ export const useTable = ({ entityListType, }) => {
97
100
  * - This will simplify the configuration structure and centralize table state definitions, reducing redundancy and improving clarity.
98
101
  */
99
102
  const table = useReactTable({
100
- _features: [ROW_POSITION, ROW_PREVIEW],
103
+ _features: [
104
+ ROW_POSITION,
105
+ ROW_PREVIEW,
106
+ ROW_SELECTION_VALIDATION,
107
+ TABLE_DOWNLOAD,
108
+ ],
101
109
  columns: columnDefs,
102
110
  data: listItems || [],
103
111
  enableColumnFilters: true, // client-side filtering.
@@ -122,6 +130,7 @@ export const useTable = ({ entityListType, }) => {
122
130
  onRowSelectionChange,
123
131
  onSortingChange,
124
132
  pageCount,
133
+ ...TABLE_DOWNLOAD_OPTIONS,
125
134
  state,
126
135
  ...tableOptions,
127
136
  });
@@ -10,6 +10,7 @@ export const COLUMN_DEF = {
10
10
  enableGrouping: false,
11
11
  enableHiding: false,
12
12
  enableSorting: false,
13
+ enableTableDownload: false,
13
14
  header: "",
14
15
  id: COLUMN_IDENTIFIER.ROW_POSITION,
15
16
  meta: {
@@ -25,6 +26,7 @@ export const COLUMN_DEF = {
25
26
  enableGrouping: false,
26
27
  enableHiding: false,
27
28
  enableSorting: false,
29
+ enableTableDownload: false,
28
30
  header: HeadSelectionCell,
29
31
  id: COLUMN_IDENTIFIER.ROW_SELECTION,
30
32
  meta: {
@@ -22,12 +22,6 @@ export declare function buildCategoryViews<T extends RowData>(columns: Column<T>
22
22
  * @returns column header.
23
23
  */
24
24
  export declare function getColumnHeader<T extends RowData>(column: Column<T>): string;
25
- /**
26
- * Returns filtered entity results as a blob.
27
- * @param rows - Table rows.
28
- * @returns filtered entity results as a blob.
29
- */
30
- export declare function generateDownloadBlob<T extends RowData>(rows: Row<T>[]): Blob | undefined;
31
25
  /**
32
26
  * Returns unique category term counts keyed by category terms.
33
27
  * Custom function based off react table function getFacetedUniqueValues, see
@@ -1,6 +1,5 @@
1
1
  import { memo, sortingFns, } from "@tanstack/react-table";
2
2
  import { EXPLORE_MODE } from "../../../hooks/useExploreMode/types";
3
- import { COLUMN_IDENTIFIER } from "./columnIdentifier";
4
3
  /**
5
4
  * Build view-specific models from react table faceted values function.
6
5
  * @param columns - Table columns.
@@ -60,46 +59,6 @@ export function getColumnHeader(column) {
60
59
  // Return header from meta or id.
61
60
  return meta?.header || id;
62
61
  }
63
- /**
64
- * Format data to TSV string.
65
- * @param data - Table data.
66
- * @returns table data formatted into a TSV string.
67
- */
68
- function formatDataToTSV(data) {
69
- return data
70
- .map((row) => {
71
- return row
72
- .map((data) => {
73
- // Use empty string in place of undefined and null.
74
- if (data === undefined || data === null)
75
- return "";
76
- // Convert to string.
77
- const dataString = Array.isArray(data)
78
- ? data.join(", ")
79
- : String(data);
80
- // Quote if necessary.
81
- return /[\t\r\n"]/.test(dataString)
82
- ? `"${dataString.replaceAll('"', '""')}"`
83
- : dataString;
84
- })
85
- .join("\t");
86
- })
87
- .join("\n");
88
- }
89
- /**
90
- * Returns filtered entity results as a blob.
91
- * @param rows - Table rows.
92
- * @returns filtered entity results as a blob.
93
- */
94
- export function generateDownloadBlob(rows) {
95
- if (rows.length === 0) {
96
- return;
97
- }
98
- const tableHeaders = getHeadersTableData(rows);
99
- const tableData = getRowsTableData(rows);
100
- const tsv = formatDataToTSV([tableHeaders, ...tableData]);
101
- return new Blob([tsv], { type: "text/tab-separated-values" });
102
- }
103
62
  /**
104
63
  * Returns unique category term counts keyed by category terms.
105
64
  * Custom function based off react table function getFacetedUniqueValues, see
@@ -166,28 +125,6 @@ export function getTableStatePagination(pageIndex = 0, pageSize) {
166
125
  pageSize,
167
126
  };
168
127
  }
169
- /**
170
- * Returns the list of table headers, excluding "rowSelection" column.
171
- * @param rows - Table rows.
172
- * @returns list of headers.
173
- */
174
- function getHeadersTableData(rows) {
175
- return rows[0]
176
- .getAllCells()
177
- .filter((cell) => cell.column.id !== COLUMN_IDENTIFIER.ROW_SELECTION)
178
- .map((cell) => cell.column.columnDef.header);
179
- }
180
- /**
181
- * Returns the list of table data, excluding "rowSelection" column.
182
- * @param rows - Table rows.
183
- * @returns list of data.
184
- */
185
- function getRowsTableData(rows) {
186
- return rows.map((row) => row
187
- .getAllCells()
188
- .filter((cell) => cell.column.id !== COLUMN_IDENTIFIER.ROW_SELECTION)
189
- .map((cell) => cell.getValue()));
190
- }
191
128
  /**
192
129
  * Returns true if any or all table rows are selected.
193
130
  * @param table - Table.
@@ -0,0 +1,2 @@
1
+ import { TooltipProps } from "@mui/material";
2
+ export declare const TOOLTIP_PROPS: Partial<TooltipProps>;
@@ -0,0 +1,13 @@
1
+ export const TOOLTIP_PROPS = {
2
+ arrow: true,
3
+ disableInteractive: true,
4
+ slotProps: {
5
+ popper: {
6
+ modifiers: [
7
+ { name: "offset", options: { offset: [0, -4] } },
8
+ { name: "preventOverflow", options: { padding: 8 } },
9
+ ],
10
+ },
11
+ tooltip: { sx: { maxWidth: "220px" } },
12
+ },
13
+ };
@@ -1,13 +1,17 @@
1
- import { Checkbox as MCheckbox } from "@mui/material";
1
+ import { Checkbox as MCheckbox, Tooltip } from "@mui/material";
2
2
  import React from "react";
3
3
  import { CheckedIcon } from "../../../../../common/CustomIcon/components/CheckedIcon/checkedIcon";
4
+ import { UncheckedDisabledIcon } from "../../../../../common/CustomIcon/components/UncheckedDisabledIcon/uncheckedDisabledIcon";
4
5
  import { UncheckedIcon } from "../../../../../common/CustomIcon/components/UncheckedIcon/uncheckedIcon";
6
+ import { TOOLTIP_PROPS } from "./constants";
5
7
  export const RowSelectionCell = ({ row, }) => {
6
- const { getIsSelected, getToggleSelectedHandler } = row;
7
- return (React.createElement(MCheckbox, { checked: getIsSelected(), checkedIcon: React.createElement(CheckedIcon, null), icon: React.createElement(UncheckedIcon, null),
8
- /*
9
- * Prevents click events from bubbling up to parent components
10
- * (such as CardActionArea or Accordion) when the checkbox is activated.
11
- */
12
- onClick: (e) => e.stopPropagation(), onChange: getToggleSelectedHandler() }));
8
+ const { getCanSelect, getIsSelected, getSelectionValidation, getToggleSelectedHandler, } = row;
9
+ return (React.createElement(Tooltip, { ...TOOLTIP_PROPS, title: getSelectionValidation?.() },
10
+ React.createElement("span", null,
11
+ React.createElement(MCheckbox, { checked: getIsSelected(), checkedIcon: React.createElement(CheckedIcon, null), disabled: !getCanSelect(), icon: getCanSelect() ? React.createElement(UncheckedIcon, null) : React.createElement(UncheckedDisabledIcon, null),
12
+ /*
13
+ * Prevents click events from bubbling up to parent components
14
+ * (such as CardActionArea or Accordion) when the checkbox is activated.
15
+ */
16
+ onClick: (e) => e.stopPropagation(), onChange: getToggleSelectedHandler() }))));
13
17
  };
@@ -0,0 +1,3 @@
1
+ import { RowData } from "@tanstack/react-table";
2
+ import { TableDownloadProps } from "./types";
3
+ export declare const TableDownload: <T extends RowData>({ className, table, }: TableDownloadProps<T>) => JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { BUTTON_PROPS } from "../../../../common/Button/constants";
3
+ import { DownloadIcon } from "../../../../common/CustomIcon/components/DownloadIcon/downloadIcon";
4
+ import { StyledButton } from "./tableDownload.styles";
5
+ export const TableDownload = ({ className, table, }) => {
6
+ if (!table.options.enableTableDownload)
7
+ return null;
8
+ return (React.createElement(StyledButton, { ...BUTTON_PROPS.SECONDARY_CONTAINED, className: className, onClick: () => table.downloadData(), startIcon: React.createElement(DownloadIcon, null) }, "Download TSV"));
9
+ };
@@ -1,6 +1,6 @@
1
1
  import styled from "@emotion/styled";
2
2
  import { Button } from "@mui/material";
3
- import { bpDownSm } from "../../../../styles/common/mixins/breakpoints";
3
+ import { bpDownSm } from "../../../../../styles/common/mixins/breakpoints";
4
4
  export const StyledButton = styled(Button) `
5
5
  ${bpDownSm} {
6
6
  display: none;
@@ -0,0 +1,5 @@
1
+ import { RowData, Table } from "@tanstack/react-table";
2
+ import { BaseComponentProps } from "../../../../types";
3
+ export interface TableDownloadProps<T extends RowData> extends BaseComponentProps {
4
+ table: Table<T>;
5
+ }
@@ -1,8 +1,10 @@
1
1
  export interface StyledTableRowProps {
2
2
  canExpand?: boolean;
3
+ canSelect?: boolean;
3
4
  isExpanded?: boolean;
4
5
  isGrouped?: boolean;
5
6
  isPreview?: boolean;
7
+ isSelected?: boolean;
6
8
  }
7
9
  export declare const StyledTableRow: import("@emotion/styled").StyledComponent<import("@mui/material").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
8
10
  ref?: ((instance: HTMLTableRowElement | 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<HTMLTableRowElement> | null | undefined;
@@ -5,9 +5,11 @@ import { FONT } from "../../../../styles/common/constants/font";
5
5
  import { PALETTE } from "../../../../styles/common/constants/palette";
6
6
  export const StyledTableRow = styled(MTableRow, {
7
7
  shouldForwardProp: (prop) => prop !== "canExpand" &&
8
+ prop !== "canSelect" &&
8
9
  prop !== "isExpanded" &&
10
+ prop !== "isGrouped" &&
9
11
  prop !== "isPreview" &&
10
- prop !== "isGrouped",
12
+ prop !== "isSelected",
11
13
  }) `
12
14
  && {
13
15
  transition: background-color 300ms ease-in;
@@ -42,5 +44,17 @@ export const StyledTableRow = styled(MTableRow, {
42
44
  css `
43
45
  background-color: ${PALETTE.PRIMARY_LIGHTEST};
44
46
  `}
47
+
48
+ ${({ isSelected }) => isSelected &&
49
+ css `
50
+ background-color: ${PALETTE.PRIMARY_LIGHTEST};
51
+ `}
52
+
53
+ ${({ canSelect }) => !canSelect &&
54
+ css `
55
+ .MuiTableCell-root {
56
+ color: ${PALETTE.INK_LIGHT};
57
+ }
58
+ `}
45
59
  }
46
60
  `;
@@ -13,7 +13,7 @@ export const CollapsableRows = ({ rows, tableInstance, virtualizer, }) => {
13
13
  const row = rows[rowIndex];
14
14
  if (grouping.length > 0 && row.depth > 0)
15
15
  return null; // TODO(cc) hide sub rows -- sub-rows are within collapsed content -- UI TBD.
16
- return (React.createElement(StyledTableRow, { key: row.id, "data-index": rowIndex, ref: virtualizer.measureElement, isPreview: row.getIsPreview() },
16
+ return (React.createElement(StyledTableRow, { key: row.id, "data-index": rowIndex, ref: virtualizer.measureElement, isPreview: row.getIsPreview(), isSelected: row.getIsSelected() },
17
17
  React.createElement(CollapsableCell, { isDisabled: isCollapsableRowDisabled(tableInstance), row: row })));
18
18
  })));
19
19
  };
@@ -11,7 +11,7 @@ export const TableRows = ({ rows, virtualizer, }) => {
11
11
  const rowIndex = virtualRow.index;
12
12
  const row = rows[rowIndex];
13
13
  const { getCanExpand, getIsExpanded, getIsGrouped, getIsPreview } = row;
14
- return (React.createElement(StyledTableRow, { key: row.id, canExpand: getCanExpand(), "data-index": rowIndex, isExpanded: getIsExpanded(), isGrouped: getIsGrouped(), isPreview: getIsPreview(), onClick: () => handleToggleExpanded(row), ref: virtualizer.measureElement }, row.getVisibleCells().map((cell, i) => {
14
+ return (React.createElement(StyledTableRow, { key: row.id, canExpand: getCanExpand(), canSelect: row.getCanSelect(), "data-index": rowIndex, isExpanded: getIsExpanded(), isGrouped: getIsGrouped(), isPreview: getIsPreview(), isSelected: row.getIsSelected(), onClick: () => handleToggleExpanded(row), ref: virtualizer.measureElement }, row.getVisibleCells().map((cell, i) => {
15
15
  if (cell.getIsAggregated())
16
16
  return null; // Display of aggregated cells is currently not supported.
17
17
  if (cell.getIsPlaceholder())
@@ -3,8 +3,8 @@ import React, { Fragment } from "react";
3
3
  import { useExploreState } from "../../../../hooks/useExploreState";
4
4
  import { ViewToggle } from "../../../Index/components/EntityView/components/controls/ViewToggle/viewToggle";
5
5
  import { isAnyRowSelected } from "../../common/utils";
6
- import { DownloadEntityResults } from "../DownloadEntityResults/downloadEntityResults";
7
6
  import { PaginationSummary } from "../PaginationSummary/paginationSummary";
7
+ import { TableDownload } from "../TableFeatures/TableDownload/tableDownload";
8
8
  import { ColumnGrouping } from "./components/ColumnGrouping/columnGrouping";
9
9
  import { ColumnVisibility } from "./components/ColumnVisibility/columnVisibility";
10
10
  import { RowPreview } from "./components/RowPreview/rowPreview";
@@ -16,14 +16,14 @@ export const TableToolbar = ({ listView, tableInstance, }) => {
16
16
  const { paginationState } = exploreState;
17
17
  const { currentPage, pages, pageSize, rows } = paginationState;
18
18
  const { getSelectedRowModel } = tableInstance;
19
- const { enableDownload, rowPreviewView } = listView || {};
19
+ const { rowPreviewView } = listView || {};
20
20
  return (React.createElement(Fragment, null,
21
21
  React.createElement(StyledToolbar, null,
22
22
  React.createElement(Grid, { ...GRID_PROPS, gap: 6 },
23
23
  React.createElement(ViewToggle, null),
24
24
  isAnyRowSelected(tableInstance) ? (React.createElement(RowSelection, { rows: getSelectedRowModel().rows, rowSelectionView: listView?.rowSelectionView })) : (React.createElement(PaginationSummary, { firstResult: (currentPage - 1) * pageSize + 1, lastResult: currentPage === pages ? rows : pageSize * currentPage, totalResult: rows }))),
25
25
  React.createElement(Grid, { ...GRID_PROPS },
26
- enableDownload && (React.createElement(DownloadEntityResults, { entityName: exploreState.tabValue, rows: tableInstance.getFilteredRowModel().rows })),
26
+ React.createElement(TableDownload, { table: tableInstance }),
27
27
  React.createElement(ColumnGrouping, { tableInstance: tableInstance }),
28
28
  React.createElement(ColumnVisibility, { tableInstance: tableInstance }))),
29
29
  React.createElement(RowPreview, { rowPreviewView: rowPreviewView, tableInstance: tableInstance })));
@@ -0,0 +1,3 @@
1
+ import { RowData } from "@tanstack/react-table";
2
+ import { TableToolbar2Props } from "./types";
3
+ export declare const TableToolbar2: <T extends RowData>({ table, }: TableToolbar2Props<T>) => JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { TableDownload } from "../TableFeatures/TableDownload/tableDownload";
3
+ import { StyledStack, StyledToolbar } from "./tableToolbar2.styles";
4
+ export const TableToolbar2 = ({ table, }) => {
5
+ return (React.createElement(StyledToolbar, null,
6
+ React.createElement(StyledStack, null,
7
+ React.createElement(TableDownload, { table: table }))));
8
+ };
@@ -0,0 +1,10 @@
1
+ export declare const StyledToolbar: import("@emotion/styled").StyledComponent<import("@mui/material").ToolbarOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
2
+ 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;
3
+ }, "style" | "className" | "classes" | "children" | "sx" | "variant" | "disableGutters"> & {
4
+ theme?: import("@emotion/react").Theme;
5
+ }, {}, {}>;
6
+ export declare const StyledStack: import("@emotion/styled").StyledComponent<import("@mui/material").StackOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
7
+ 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;
8
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/material").StackOwnProps> & {
9
+ theme?: import("@emotion/react").Theme;
10
+ }, {}, {}>;
@@ -0,0 +1,16 @@
1
+ import styled from "@emotion/styled";
2
+ import { Toolbar as MToolbar, Stack } from "@mui/material";
3
+ import { PALETTE } from "../../../../styles/common/constants/palette";
4
+ export const StyledToolbar = styled(MToolbar) `
5
+ align-items: center;
6
+ background-color: ${PALETTE.COMMON_WHITE};
7
+ display: flex;
8
+ padding: 16px;
9
+ `;
10
+ export const StyledStack = styled(Stack) `
11
+ align-items: center;
12
+ flex: 1;
13
+ flex-direction: row;
14
+ gap: 8px;
15
+ justify-content: flex-end;
16
+ `;
@@ -0,0 +1,4 @@
1
+ import { RowData, Table } from "@tanstack/react-table";
2
+ export interface TableToolbar2Props<T extends RowData> {
3
+ table: Table<T>;
4
+ }
@@ -0,0 +1,3 @@
1
+ import { RowData } from "@tanstack/react-table";
2
+ import { TableDownloadOptions } from "../../features/TableDownload/types";
3
+ export declare const TABLE_DOWNLOAD_OPTIONS: Pick<TableDownloadOptions<RowData>, "enableTableDownload">;
@@ -0,0 +1,3 @@
1
+ export const TABLE_DOWNLOAD_OPTIONS = {
2
+ enableTableDownload: false,
3
+ };
@@ -0,0 +1,2 @@
1
+ import { TableFeature } from "@tanstack/react-table";
2
+ export declare const ROW_SELECTION_VALIDATION: TableFeature;
@@ -0,0 +1,14 @@
1
+ import { getSelectionValidation } from "./utils";
2
+ export const ROW_SELECTION_VALIDATION = {
3
+ createRow: (row, table) => {
4
+ row.getSelectionValidation = () => {
5
+ return getSelectionValidation(row, table);
6
+ };
7
+ },
8
+ getDefaultOptions: () => {
9
+ return {
10
+ enableRowSelectionValidation: false,
11
+ getRowSelectionValidation: undefined,
12
+ };
13
+ },
14
+ };
@@ -0,0 +1,8 @@
1
+ import { Row, RowData } from "@tanstack/react-table";
2
+ export interface RowSelectionValidationOptions<T extends RowData> {
3
+ enableRowSelectionValidation?: boolean;
4
+ getRowSelectionValidation?: (row: Row<T>) => string | undefined;
5
+ }
6
+ export interface RowSelectionValidationRow {
7
+ getSelectionValidation?: () => string | undefined;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Row, RowData, Table } from "@tanstack/react-table";
2
+ /**
3
+ * Returns the validation message for a row.
4
+ * @param row - Row.
5
+ * @param table - Table.
6
+ * @returns The validation message for the row.
7
+ */
8
+ export declare function getSelectionValidation<T extends RowData>(row: Row<T>, table: Table<T>): string | undefined;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Returns the validation message for a row.
3
+ * @param row - Row.
4
+ * @param table - Table.
5
+ * @returns The validation message for the row.
6
+ */
7
+ export function getSelectionValidation(row, table) {
8
+ if (!table.options.enableRowSelectionValidation)
9
+ return;
10
+ return table.options.getRowSelectionValidation?.(row);
11
+ }
@@ -0,0 +1,2 @@
1
+ import { TableFeature } from "@tanstack/react-table";
2
+ export declare const TABLE_DOWNLOAD: TableFeature;
@@ -0,0 +1,10 @@
1
+ import { downloadData, getCanTableDownload, onTableDownload } from "./utils";
2
+ export const TABLE_DOWNLOAD = {
3
+ createColumn: (column, table) => {
4
+ column.getCanTableDownload = () => getCanTableDownload(column, table);
5
+ },
6
+ createTable: (table) => {
7
+ table.downloadData = () => downloadData(table);
8
+ },
9
+ getDefaultOptions: () => ({ enableTableDownload: false, onTableDownload }),
10
+ };
@@ -0,0 +1,14 @@
1
+ import { Column, RowData, Table } from "@tanstack/react-table";
2
+ /**
3
+ * Format data to TSV string.
4
+ * @param data - Table data.
5
+ * @returns table data formatted into a TSV string.
6
+ */
7
+ export declare function formatDataToTSV(data: unknown[][]): string;
8
+ export declare function getBlob<T extends RowData>(table: Table<T>): Blob | undefined;
9
+ /**
10
+ * Filters table columns from column.getCanDownload API.
11
+ * @param table - Table.
12
+ * @returns Columns configured to be downloadable.
13
+ */
14
+ export declare function getDownloadableColumns<T extends RowData>(table: Table<T>): Column<T>[];