@weng-lab/genomebrowser-ui 0.2.2 → 0.2.4

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 (54) hide show
  1. package/.env.local +1 -1
  2. package/dist/TrackSelect/Folders/biosamples/data/human.json.d.ts +57141 -57141
  3. package/dist/TrackSelect/Folders/biosamples/data/mouse.json.d.ts +10394 -10394
  4. package/dist/TrackSelect/Folders/genes/data/human.json.d.ts +7 -7
  5. package/dist/TrackSelect/Folders/genes/data/mouse.json.d.ts +7 -7
  6. package/dist/genomebrowser-ui.es.js +14 -9
  7. package/dist/genomebrowser-ui.es.js.map +1 -1
  8. package/eslint.config.js +30 -30
  9. package/index.html +14 -14
  10. package/package.json +1 -1
  11. package/src/TrackSelect/DataGrid/DataGridWrapper.tsx +137 -137
  12. package/src/TrackSelect/DataGrid/DefaultGroupingCell.tsx +64 -64
  13. package/src/TrackSelect/Dialogs/ClearDialog.tsx +63 -63
  14. package/src/TrackSelect/Dialogs/LimitDialog.tsx +33 -33
  15. package/src/TrackSelect/Dialogs/ResetDialog.tsx +43 -43
  16. package/src/TrackSelect/FolderList/Breadcrumb.tsx +38 -38
  17. package/src/TrackSelect/FolderList/FolderCard.tsx +51 -51
  18. package/src/TrackSelect/FolderList/FolderList.tsx +47 -47
  19. package/src/TrackSelect/Folders/NEW.md +929 -929
  20. package/src/TrackSelect/Folders/biosamples/data/formatBiosamples.go +254 -254
  21. package/src/TrackSelect/Folders/biosamples/data/human.json +57141 -57141
  22. package/src/TrackSelect/Folders/biosamples/data/mouse.json +10394 -10394
  23. package/src/TrackSelect/Folders/biosamples/human.ts +17 -17
  24. package/src/TrackSelect/Folders/biosamples/mouse.ts +17 -17
  25. package/src/TrackSelect/Folders/biosamples/shared/AssayToggle.tsx +78 -78
  26. package/src/TrackSelect/Folders/biosamples/shared/BiosampleGroupingCell.tsx +146 -146
  27. package/src/TrackSelect/Folders/biosamples/shared/BiosampleTreeItem.tsx +15 -15
  28. package/src/TrackSelect/Folders/biosamples/shared/columns.tsx +165 -165
  29. package/src/TrackSelect/Folders/biosamples/shared/constants.tsx +116 -116
  30. package/src/TrackSelect/Folders/biosamples/shared/createFolder.ts +116 -116
  31. package/src/TrackSelect/Folders/biosamples/shared/treeBuilder.ts +224 -224
  32. package/src/TrackSelect/Folders/biosamples/shared/types.ts +48 -48
  33. package/src/TrackSelect/Folders/genes/data/human.json +7 -7
  34. package/src/TrackSelect/Folders/genes/data/mouse.json +7 -7
  35. package/src/TrackSelect/Folders/genes/human.ts +16 -16
  36. package/src/TrackSelect/Folders/genes/mouse.ts +16 -16
  37. package/src/TrackSelect/Folders/genes/shared/columns.tsx +42 -42
  38. package/src/TrackSelect/Folders/genes/shared/createFolder.ts +68 -68
  39. package/src/TrackSelect/Folders/genes/shared/treeBuilder.ts +45 -45
  40. package/src/TrackSelect/Folders/genes/shared/types.ts +29 -29
  41. package/src/TrackSelect/Folders/index.ts +30 -30
  42. package/src/TrackSelect/Folders/types.ts +106 -106
  43. package/src/TrackSelect/TrackSelect.tsx +11 -7
  44. package/src/TrackSelect/TreeView/CustomTreeItem.tsx +213 -214
  45. package/src/TrackSelect/TreeView/TreeViewWrapper.tsx +141 -145
  46. package/src/TrackSelect/store.ts +117 -117
  47. package/src/TrackSelect/types.ts +121 -121
  48. package/src/lib.ts +13 -13
  49. package/src/vite-env.d.ts +1 -1
  50. package/test/main.tsx +369 -369
  51. package/tsconfig.app.json +25 -25
  52. package/tsconfig.json +7 -7
  53. package/tsconfig.node.json +25 -25
  54. package/vite.config.ts +66 -66
@@ -1,42 +1,42 @@
1
- import { GridColDef } from "@mui/x-data-grid-premium";
2
- import { GeneRowInfo } from "./types";
3
-
4
- /**
5
- * Format versions array as comma-separated string with "v" prefix
6
- * e.g., [29, 40] -> "v29, v40"
7
- */
8
- function formatVersions(versions: number[]): string {
9
- return versions.map((v) => `v${v}`).join(", ");
10
- }
11
-
12
- const displayNameCol: GridColDef<GeneRowInfo> = {
13
- field: "displayName",
14
- headerName: "Name",
15
- flex: 1,
16
- minWidth: 200,
17
- };
18
-
19
- const versionsCol: GridColDef<GeneRowInfo> = {
20
- field: "versions",
21
- headerName: "Versions",
22
- width: 150,
23
- valueFormatter: (value: number[]) => value && formatVersions(value),
24
- };
25
-
26
- /**
27
- * Default columns for genes DataGrid (flat list, no grouping)
28
- */
29
- export const defaultColumns: GridColDef<GeneRowInfo>[] = [
30
- displayNameCol,
31
- versionsCol,
32
- ];
33
-
34
- /**
35
- * No grouping for genes - flat list
36
- */
37
- export const defaultGroupingModel: string[] = [];
38
-
39
- /**
40
- * Leaf field - the unique identifier
41
- */
42
- export const defaultLeafField = "id";
1
+ import { GridColDef } from "@mui/x-data-grid-premium";
2
+ import { GeneRowInfo } from "./types";
3
+
4
+ /**
5
+ * Format versions array as comma-separated string with "v" prefix
6
+ * e.g., [29, 40] -> "v29, v40"
7
+ */
8
+ function formatVersions(versions: number[]): string {
9
+ return versions.map((v) => `v${v}`).join(", ");
10
+ }
11
+
12
+ const displayNameCol: GridColDef<GeneRowInfo> = {
13
+ field: "displayName",
14
+ headerName: "Name",
15
+ flex: 1,
16
+ minWidth: 200,
17
+ };
18
+
19
+ const versionsCol: GridColDef<GeneRowInfo> = {
20
+ field: "versions",
21
+ headerName: "Versions",
22
+ width: 150,
23
+ valueFormatter: (value: number[]) => value && formatVersions(value),
24
+ };
25
+
26
+ /**
27
+ * Default columns for genes DataGrid (flat list, no grouping)
28
+ */
29
+ export const defaultColumns: GridColDef<GeneRowInfo>[] = [
30
+ displayNameCol,
31
+ versionsCol,
32
+ ];
33
+
34
+ /**
35
+ * No grouping for genes - flat list
36
+ */
37
+ export const defaultGroupingModel: string[] = [];
38
+
39
+ /**
40
+ * Leaf field - the unique identifier
41
+ */
42
+ export const defaultLeafField = "id";
@@ -1,68 +1,68 @@
1
- import { FolderDefinition } from "../../types";
2
- import { GeneDataFile, GeneRowInfo, GeneTrackInfo } from "./types";
3
- import {
4
- defaultColumns,
5
- defaultGroupingModel,
6
- defaultLeafField,
7
- } from "./columns";
8
- import { buildTreeView } from "./treeBuilder";
9
-
10
- /**
11
- * Transforms a single track from JSON into a row for DataGrid
12
- * For genes, this is a 1:1 mapping (no flattening needed)
13
- */
14
- function trackToRow(track: GeneTrackInfo): GeneRowInfo {
15
- return {
16
- id: track.id,
17
- displayName: track.displayName,
18
- versions: track.versions,
19
- };
20
- }
21
-
22
- /**
23
- * Transforms raw JSON data into rows and lookup map
24
- */
25
- function transformData(data: GeneDataFile): {
26
- rows: GeneRowInfo[];
27
- rowById: Map<string, GeneRowInfo>;
28
- } {
29
- const rows = data.map(trackToRow);
30
- const rowById = new Map<string, GeneRowInfo>(
31
- rows.map((row) => [row.id, row]),
32
- );
33
- return { rows, rowById };
34
- }
35
-
36
- export interface CreateGeneFolderOptions {
37
- id: string;
38
- label: string;
39
- description?: string;
40
- data: GeneDataFile;
41
- }
42
-
43
- /**
44
- * Factory function that creates a FolderDefinition for genes
45
- */
46
- export function createGeneFolder(
47
- options: CreateGeneFolderOptions,
48
- ): FolderDefinition<GeneRowInfo> {
49
- const { id, label, description, data } = options;
50
- const { rowById } = transformData(data);
51
-
52
- return {
53
- id,
54
- label,
55
- description,
56
- rowById,
57
- getRowId: (row) => row.id,
58
-
59
- // Default view configuration
60
- columns: defaultColumns,
61
- groupingModel: defaultGroupingModel,
62
- leafField: defaultLeafField,
63
-
64
- // Tree builder for selected items panel
65
- buildTree: (selectedIds, rowById) =>
66
- buildTreeView(selectedIds, rowById, label),
67
- };
68
- }
1
+ import { FolderDefinition } from "../../types";
2
+ import { GeneDataFile, GeneRowInfo, GeneTrackInfo } from "./types";
3
+ import {
4
+ defaultColumns,
5
+ defaultGroupingModel,
6
+ defaultLeafField,
7
+ } from "./columns";
8
+ import { buildTreeView } from "./treeBuilder";
9
+
10
+ /**
11
+ * Transforms a single track from JSON into a row for DataGrid
12
+ * For genes, this is a 1:1 mapping (no flattening needed)
13
+ */
14
+ function trackToRow(track: GeneTrackInfo): GeneRowInfo {
15
+ return {
16
+ id: track.id,
17
+ displayName: track.displayName,
18
+ versions: track.versions,
19
+ };
20
+ }
21
+
22
+ /**
23
+ * Transforms raw JSON data into rows and lookup map
24
+ */
25
+ function transformData(data: GeneDataFile): {
26
+ rows: GeneRowInfo[];
27
+ rowById: Map<string, GeneRowInfo>;
28
+ } {
29
+ const rows = data.map(trackToRow);
30
+ const rowById = new Map<string, GeneRowInfo>(
31
+ rows.map((row) => [row.id, row]),
32
+ );
33
+ return { rows, rowById };
34
+ }
35
+
36
+ export interface CreateGeneFolderOptions {
37
+ id: string;
38
+ label: string;
39
+ description?: string;
40
+ data: GeneDataFile;
41
+ }
42
+
43
+ /**
44
+ * Factory function that creates a FolderDefinition for genes
45
+ */
46
+ export function createGeneFolder(
47
+ options: CreateGeneFolderOptions,
48
+ ): FolderDefinition<GeneRowInfo> {
49
+ const { id, label, description, data } = options;
50
+ const { rowById } = transformData(data);
51
+
52
+ return {
53
+ id,
54
+ label,
55
+ description,
56
+ rowById,
57
+ getRowId: (row) => row.id,
58
+
59
+ // Default view configuration
60
+ columns: defaultColumns,
61
+ groupingModel: defaultGroupingModel,
62
+ leafField: defaultLeafField,
63
+
64
+ // Tree builder for selected items panel
65
+ buildTree: (selectedIds, rowById) =>
66
+ buildTreeView(selectedIds, rowById, label),
67
+ };
68
+ }
@@ -1,45 +1,45 @@
1
- import { TreeViewBaseItem } from "@mui/x-tree-view";
2
- import { ExtendedTreeItemProps } from "../../../types";
3
- import { GeneRowInfo } from "./types";
4
-
5
- /**
6
- * Builds a flat tree structure for the TreeView panel (selected items)
7
- * Since genes have no grouping, this is a simple root -> leaf structure
8
- *
9
- * @param selectedIds - Array of selected row IDs
10
- * @param rowById - Map of row ID to row data
11
- * @param rootLabel - Label for the root node
12
- * @returns Tree structure for RichTreeView
13
- */
14
- export function buildTreeView(
15
- selectedIds: string[],
16
- rowById: Map<string, GeneRowInfo>,
17
- rootLabel: string = "Genes",
18
- ): TreeViewBaseItem<ExtendedTreeItemProps>[] {
19
- // Root node
20
- const root: TreeViewBaseItem<ExtendedTreeItemProps> = {
21
- id: "root",
22
- label: rootLabel,
23
- icon: "folder",
24
- children: [],
25
- allExpAccessions: [],
26
- };
27
-
28
- // Get selected rows and add as direct children of root
29
- selectedIds.forEach((id) => {
30
- const row = rowById.get(id);
31
- if (row) {
32
- const leafNode: TreeViewBaseItem<ExtendedTreeItemProps> = {
33
- id: row.id,
34
- label: row.displayName,
35
- icon: "removeable",
36
- children: [],
37
- allExpAccessions: [row.id],
38
- };
39
- root.children!.push(leafNode);
40
- root.allExpAccessions!.push(row.id);
41
- }
42
- });
43
-
44
- return [root];
45
- }
1
+ import { TreeViewBaseItem } from "@mui/x-tree-view";
2
+ import { ExtendedTreeItemProps } from "../../../types";
3
+ import { GeneRowInfo } from "./types";
4
+
5
+ /**
6
+ * Builds a flat tree structure for the TreeView panel (selected items)
7
+ * Since genes have no grouping, this is a simple root -> leaf structure
8
+ *
9
+ * @param selectedIds - Array of selected row IDs
10
+ * @param rowById - Map of row ID to row data
11
+ * @param rootLabel - Label for the root node
12
+ * @returns Tree structure for RichTreeView
13
+ */
14
+ export function buildTreeView(
15
+ selectedIds: string[],
16
+ rowById: Map<string, GeneRowInfo>,
17
+ rootLabel: string = "Genes",
18
+ ): TreeViewBaseItem<ExtendedTreeItemProps>[] {
19
+ // Root node
20
+ const root: TreeViewBaseItem<ExtendedTreeItemProps> = {
21
+ id: "root",
22
+ label: rootLabel,
23
+ icon: "folder",
24
+ children: [],
25
+ allExpAccessions: [],
26
+ };
27
+
28
+ // Get selected rows and add as direct children of root
29
+ selectedIds.forEach((id) => {
30
+ const row = rowById.get(id);
31
+ if (row) {
32
+ const leafNode: TreeViewBaseItem<ExtendedTreeItemProps> = {
33
+ id: row.id,
34
+ label: row.displayName,
35
+ icon: "removeable",
36
+ children: [],
37
+ allExpAccessions: [row.id],
38
+ };
39
+ root.children!.push(leafNode);
40
+ root.allExpAccessions!.push(row.id);
41
+ }
42
+ });
43
+
44
+ return [root];
45
+ }
@@ -1,29 +1,29 @@
1
- /**
2
- * Types for genes folder data
3
- */
4
-
5
- /**
6
- * Gene track information from the JSON data
7
- */
8
- export type GeneTrackInfo = {
9
- /** Unique identifier for this gene track */
10
- id: string;
11
- /** Display name shown in the UI */
12
- displayName: string;
13
- /** Available versions for this gene annotation */
14
- versions: number[];
15
- };
16
-
17
- /**
18
- * Row format for DataGrid (same as track info for genes since it's flat)
19
- */
20
- export type GeneRowInfo = {
21
- id: string;
22
- displayName: string;
23
- versions: number[];
24
- };
25
-
26
- /**
27
- * Structure of the gene JSON data files (direct array)
28
- */
29
- export type GeneDataFile = GeneTrackInfo[];
1
+ /**
2
+ * Types for genes folder data
3
+ */
4
+
5
+ /**
6
+ * Gene track information from the JSON data
7
+ */
8
+ export type GeneTrackInfo = {
9
+ /** Unique identifier for this gene track */
10
+ id: string;
11
+ /** Display name shown in the UI */
12
+ displayName: string;
13
+ /** Available versions for this gene annotation */
14
+ versions: number[];
15
+ };
16
+
17
+ /**
18
+ * Row format for DataGrid (same as track info for genes since it's flat)
19
+ */
20
+ export type GeneRowInfo = {
21
+ id: string;
22
+ displayName: string;
23
+ versions: number[];
24
+ };
25
+
26
+ /**
27
+ * Structure of the gene JSON data files (direct array)
28
+ */
29
+ export type GeneDataFile = GeneTrackInfo[];
@@ -1,30 +1,30 @@
1
- import { Assembly, FolderDefinition } from "./types";
2
- import { humanBiosamplesFolder } from "./biosamples/human";
3
- import { mouseBiosamplesFolder } from "./biosamples/mouse";
4
- import { humanGenesFolder } from "./genes/human";
5
- import { mouseGenesFolder } from "./genes/mouse";
6
-
7
- export {
8
- type Assembly,
9
- type FolderDefinition,
10
- type FolderRuntimeConfig,
11
- } from "./types";
12
-
13
- export type { BiosampleRowInfo } from "./biosamples/shared/types";
14
- export type { GeneRowInfo } from "./genes/shared/types";
15
-
16
- /**
17
- * Registry of folders available for each assembly.
18
- *
19
- * Each assembly can have multiple folders (e.g., biosamples, genes, etc.).
20
- * TrackSelect receives the folders for the current assembly and renders
21
- * them as tabs or a folder selector.
22
- *
23
- * To add a new folder:
24
- * 1. Create a folder config file (e.g., folders/genes/human.ts)
25
- * 2. Import and add it to the appropriate assembly array below
26
- */
27
- export const foldersByAssembly: Record<Assembly, FolderDefinition[]> = {
28
- GRCh38: [humanGenesFolder, humanBiosamplesFolder],
29
- mm10: [mouseGenesFolder, mouseBiosamplesFolder],
30
- };
1
+ import { Assembly, FolderDefinition } from "./types";
2
+ import { humanBiosamplesFolder } from "./biosamples/human";
3
+ import { mouseBiosamplesFolder } from "./biosamples/mouse";
4
+ import { humanGenesFolder } from "./genes/human";
5
+ import { mouseGenesFolder } from "./genes/mouse";
6
+
7
+ export {
8
+ type Assembly,
9
+ type FolderDefinition,
10
+ type FolderRuntimeConfig,
11
+ } from "./types";
12
+
13
+ export type { BiosampleRowInfo } from "./biosamples/shared/types";
14
+ export type { GeneRowInfo } from "./genes/shared/types";
15
+
16
+ /**
17
+ * Registry of folders available for each assembly.
18
+ *
19
+ * Each assembly can have multiple folders (e.g., biosamples, genes, etc.).
20
+ * TrackSelect receives the folders for the current assembly and renders
21
+ * them as tabs or a folder selector.
22
+ *
23
+ * To add a new folder:
24
+ * 1. Create a folder config file (e.g., folders/genes/human.ts)
25
+ * 2. Import and add it to the appropriate assembly array below
26
+ */
27
+ export const foldersByAssembly: Record<Assembly, FolderDefinition[]> = {
28
+ GRCh38: [humanGenesFolder, humanBiosamplesFolder],
29
+ mm10: [mouseGenesFolder, mouseBiosamplesFolder],
30
+ };
@@ -1,106 +1,106 @@
1
- import { GridColDef, GridRenderCellParams } from "@mui/x-data-grid-premium";
2
- import { TreeViewBaseItem } from "@mui/x-tree-view";
3
- import { ExtendedTreeItemProps, CustomTreeItemProps } from "../types";
4
-
5
- export type Assembly = "GRCh38" | "mm10";
6
-
7
- /**
8
- * Runtime configuration that can be modified by ToolbarExtras components.
9
- * This allows folder-specific UI (like AssayToggle) to dynamically update
10
- * how the DataGrid and TreeView display data.
11
- */
12
- export interface FolderRuntimeConfig {
13
- columns: GridColDef[];
14
- groupingModel: string[];
15
- leafField: string;
16
- /** Optional override for the tree builder function */
17
- buildTree?: (
18
- selectedIds: string[],
19
- rowById: Map<string, any>,
20
- ) => TreeViewBaseItem<ExtendedTreeItemProps>[];
21
- }
22
-
23
- /**
24
- * Definition for a folder in TrackSelect.
25
- *
26
- * A folder represents a category of data (e.g., biosamples, genes, etc.)
27
- * that can be displayed in the DataGrid and TreeView. Each folder is
28
- * self-contained with its own data, column definitions, and tree building logic.
29
- *
30
- * @template TRow - The type of row data stored in this folder
31
- */
32
- export interface FolderDefinition<TRow = any> {
33
- /** Unique identifier for this folder */
34
- id: string;
35
-
36
- /** Display label shown in the UI */
37
- label: string;
38
-
39
- /** Optional description shown in folder cards */
40
- description?: string;
41
-
42
- /**
43
- * Single source of truth for all row data.
44
- * Maps row ID to the full row object.
45
- */
46
- rowById: Map<string, TRow>;
47
-
48
- /**
49
- * Function to extract the unique ID from a row object.
50
- * Used for selection tracking and lookups.
51
- */
52
- getRowId: (row: TRow) => string;
53
-
54
- /** Column definitions for the DataGrid */
55
- columns: GridColDef[];
56
-
57
- /** Fields to group by in the DataGrid (row grouping) */
58
- groupingModel: string[];
59
-
60
- /** The field that represents the leaf level in the grouping hierarchy */
61
- leafField: string;
62
-
63
- /**
64
- * Builds a tree structure from selected row IDs.
65
- * Used to display selected items in the TreeView panel.
66
- *
67
- * @param selectedIds - Array of selected row IDs
68
- * @param rowById - Map of row ID to row data (same as this.rowById)
69
- * @returns Array of tree items to render in the TreeView
70
- */
71
- buildTree: (
72
- selectedIds: string[],
73
- rowById: Map<string, TRow>,
74
- ) => TreeViewBaseItem<ExtendedTreeItemProps>[];
75
-
76
- /**
77
- * Optional component to render folder-specific toolbar controls.
78
- * For example, biosamples folder uses this to render an assay toggle
79
- * that switches between sample-grouped and assay-grouped views.
80
- *
81
- * @param updateConfig - Callback to update the folder's runtime config
82
- * @param folderId - The folder's unique identifier
83
- * @param label - The folder's display label
84
- * @param config - The current runtime config for this folder
85
- */
86
- ToolbarExtras?: React.FC<{
87
- updateConfig: (partial: Partial<FolderRuntimeConfig>) => void;
88
- folderId: string;
89
- label: string;
90
- config: FolderRuntimeConfig;
91
- }>;
92
-
93
- /**
94
- * Optional custom component for rendering grouping cells in the DataGrid.
95
- * If not provided, a default grouping cell renderer will be used.
96
- */
97
- GroupingCellComponent?: React.FC<GridRenderCellParams>;
98
-
99
- /**
100
- * Optional custom TreeItem component for the TreeView.
101
- * If not provided, the default CustomTreeItem will be used.
102
- */
103
- TreeItemComponent?: React.ForwardRefExoticComponent<
104
- CustomTreeItemProps & React.RefAttributes<HTMLLIElement>
105
- >;
106
- }
1
+ import { GridColDef, GridRenderCellParams } from "@mui/x-data-grid-premium";
2
+ import { TreeViewBaseItem } from "@mui/x-tree-view";
3
+ import { ExtendedTreeItemProps, CustomTreeItemProps } from "../types";
4
+
5
+ export type Assembly = "GRCh38" | "mm10";
6
+
7
+ /**
8
+ * Runtime configuration that can be modified by ToolbarExtras components.
9
+ * This allows folder-specific UI (like AssayToggle) to dynamically update
10
+ * how the DataGrid and TreeView display data.
11
+ */
12
+ export interface FolderRuntimeConfig {
13
+ columns: GridColDef[];
14
+ groupingModel: string[];
15
+ leafField: string;
16
+ /** Optional override for the tree builder function */
17
+ buildTree?: (
18
+ selectedIds: string[],
19
+ rowById: Map<string, any>,
20
+ ) => TreeViewBaseItem<ExtendedTreeItemProps>[];
21
+ }
22
+
23
+ /**
24
+ * Definition for a folder in TrackSelect.
25
+ *
26
+ * A folder represents a category of data (e.g., biosamples, genes, etc.)
27
+ * that can be displayed in the DataGrid and TreeView. Each folder is
28
+ * self-contained with its own data, column definitions, and tree building logic.
29
+ *
30
+ * @template TRow - The type of row data stored in this folder
31
+ */
32
+ export interface FolderDefinition<TRow = any> {
33
+ /** Unique identifier for this folder */
34
+ id: string;
35
+
36
+ /** Display label shown in the UI */
37
+ label: string;
38
+
39
+ /** Optional description shown in folder cards */
40
+ description?: string;
41
+
42
+ /**
43
+ * Single source of truth for all row data.
44
+ * Maps row ID to the full row object.
45
+ */
46
+ rowById: Map<string, TRow>;
47
+
48
+ /**
49
+ * Function to extract the unique ID from a row object.
50
+ * Used for selection tracking and lookups.
51
+ */
52
+ getRowId: (row: TRow) => string;
53
+
54
+ /** Column definitions for the DataGrid */
55
+ columns: GridColDef[];
56
+
57
+ /** Fields to group by in the DataGrid (row grouping) */
58
+ groupingModel: string[];
59
+
60
+ /** The field that represents the leaf level in the grouping hierarchy */
61
+ leafField: string;
62
+
63
+ /**
64
+ * Builds a tree structure from selected row IDs.
65
+ * Used to display selected items in the TreeView panel.
66
+ *
67
+ * @param selectedIds - Array of selected row IDs
68
+ * @param rowById - Map of row ID to row data (same as this.rowById)
69
+ * @returns Array of tree items to render in the TreeView
70
+ */
71
+ buildTree: (
72
+ selectedIds: string[],
73
+ rowById: Map<string, TRow>,
74
+ ) => TreeViewBaseItem<ExtendedTreeItemProps>[];
75
+
76
+ /**
77
+ * Optional component to render folder-specific toolbar controls.
78
+ * For example, biosamples folder uses this to render an assay toggle
79
+ * that switches between sample-grouped and assay-grouped views.
80
+ *
81
+ * @param updateConfig - Callback to update the folder's runtime config
82
+ * @param folderId - The folder's unique identifier
83
+ * @param label - The folder's display label
84
+ * @param config - The current runtime config for this folder
85
+ */
86
+ ToolbarExtras?: React.FC<{
87
+ updateConfig: (partial: Partial<FolderRuntimeConfig>) => void;
88
+ folderId: string;
89
+ label: string;
90
+ config: FolderRuntimeConfig;
91
+ }>;
92
+
93
+ /**
94
+ * Optional custom component for rendering grouping cells in the DataGrid.
95
+ * If not provided, a default grouping cell renderer will be used.
96
+ */
97
+ GroupingCellComponent?: React.FC<GridRenderCellParams>;
98
+
99
+ /**
100
+ * Optional custom TreeItem component for the TreeView.
101
+ * If not provided, the default CustomTreeItem will be used.
102
+ */
103
+ TreeItemComponent?: React.ForwardRefExoticComponent<
104
+ CustomTreeItemProps & React.RefAttributes<HTMLLIElement>
105
+ >;
106
+ }