@weng-lab/genomebrowser-ui 0.1.11 → 0.2.0-beta.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 (84) hide show
  1. package/.env.local +1 -0
  2. package/dist/TrackSelect/DataGrid/DefaultGroupingCell.d.ts +6 -0
  3. package/dist/TrackSelect/FolderList/Breadcrumb.d.ts +6 -0
  4. package/dist/TrackSelect/FolderList/FolderCard.d.ts +6 -0
  5. package/dist/TrackSelect/FolderList/FolderList.d.ts +6 -0
  6. package/dist/TrackSelect/{Data/humanBiosamples.json.d.ts → Folders/biosamples/data/human.json.d.ts} +1940 -1919
  7. package/dist/TrackSelect/{Data/mouseBiosamples.json.d.ts → Folders/biosamples/data/mouse.json.d.ts} +408 -357
  8. package/dist/TrackSelect/Folders/biosamples/human.d.ts +7 -0
  9. package/dist/TrackSelect/Folders/biosamples/mouse.d.ts +7 -0
  10. package/dist/TrackSelect/Folders/biosamples/shared/AssayToggle.d.ts +14 -0
  11. package/dist/TrackSelect/Folders/biosamples/shared/BiosampleGroupingCell.d.ts +6 -0
  12. package/dist/TrackSelect/Folders/biosamples/shared/BiosampleTreeItem.d.ts +7 -0
  13. package/dist/TrackSelect/Folders/biosamples/shared/columns.d.ts +14 -0
  14. package/dist/TrackSelect/Folders/biosamples/shared/constants.d.ts +19 -0
  15. package/dist/TrackSelect/Folders/biosamples/shared/createFolder.d.ts +24 -0
  16. package/dist/TrackSelect/Folders/biosamples/shared/treeBuilder.d.ts +25 -0
  17. package/dist/TrackSelect/Folders/biosamples/shared/types.d.ts +44 -0
  18. package/dist/TrackSelect/Folders/genes/data/human.json.d.ts +10 -0
  19. package/dist/TrackSelect/Folders/genes/data/mouse.json.d.ts +10 -0
  20. package/dist/TrackSelect/Folders/genes/human.d.ts +7 -0
  21. package/dist/TrackSelect/Folders/genes/mouse.d.ts +7 -0
  22. package/dist/TrackSelect/Folders/genes/shared/columns.d.ts +14 -0
  23. package/dist/TrackSelect/Folders/genes/shared/createFolder.d.ts +12 -0
  24. package/dist/TrackSelect/Folders/genes/shared/treeBuilder.d.ts +13 -0
  25. package/dist/TrackSelect/Folders/genes/shared/types.d.ts +26 -0
  26. package/dist/TrackSelect/Folders/index.d.ts +14 -0
  27. package/dist/TrackSelect/Folders/types.d.ts +76 -0
  28. package/dist/TrackSelect/TrackSelect.d.ts +12 -5
  29. package/dist/TrackSelect/TreeView/CustomTreeItem.d.ts +3 -0
  30. package/dist/TrackSelect/TreeView/TreeViewWrapper.d.ts +1 -1
  31. package/dist/TrackSelect/store.d.ts +1 -2
  32. package/dist/TrackSelect/types.d.ts +24 -62
  33. package/dist/genomebrowser-ui.es.js +1373 -2117
  34. package/dist/genomebrowser-ui.es.js.map +1 -1
  35. package/dist/lib.d.ts +2 -2
  36. package/package.json +3 -3
  37. package/src/TrackSelect/DataGrid/DataGridWrapper.tsx +36 -20
  38. package/src/TrackSelect/DataGrid/DefaultGroupingCell.tsx +64 -0
  39. package/src/TrackSelect/FolderList/Breadcrumb.tsx +38 -0
  40. package/src/TrackSelect/FolderList/FolderCard.tsx +51 -0
  41. package/src/TrackSelect/FolderList/FolderList.tsx +47 -0
  42. package/src/TrackSelect/Folders/NEW.md +929 -0
  43. package/src/TrackSelect/{Data → Folders/biosamples/data}/formatBiosamples.go +2 -2
  44. package/src/TrackSelect/{Data/humanBiosamples.json → Folders/biosamples/data/human.json} +1940 -1919
  45. package/src/TrackSelect/{Data/mouseBiosamples.json → Folders/biosamples/data/mouse.json} +408 -357
  46. package/src/TrackSelect/Folders/biosamples/human.ts +17 -0
  47. package/src/TrackSelect/Folders/biosamples/mouse.ts +17 -0
  48. package/src/TrackSelect/Folders/biosamples/shared/AssayToggle.tsx +65 -0
  49. package/src/TrackSelect/{DataGrid/GroupingCell.tsx → Folders/biosamples/shared/BiosampleGroupingCell.tsx} +7 -5
  50. package/src/TrackSelect/Folders/biosamples/shared/BiosampleTreeItem.tsx +15 -0
  51. package/src/TrackSelect/{DataGrid → Folders/biosamples/shared}/columns.tsx +31 -17
  52. package/src/TrackSelect/Folders/biosamples/shared/constants.tsx +116 -0
  53. package/src/TrackSelect/Folders/biosamples/shared/createFolder.ts +116 -0
  54. package/src/TrackSelect/Folders/biosamples/shared/treeBuilder.ts +227 -0
  55. package/src/TrackSelect/Folders/biosamples/shared/types.ts +48 -0
  56. package/src/TrackSelect/Folders/genes/data/human.json +7 -0
  57. package/src/TrackSelect/Folders/genes/data/mouse.json +7 -0
  58. package/src/TrackSelect/Folders/genes/human.ts +16 -0
  59. package/src/TrackSelect/Folders/genes/mouse.ts +16 -0
  60. package/src/TrackSelect/Folders/genes/shared/columns.tsx +42 -0
  61. package/src/TrackSelect/Folders/genes/shared/createFolder.ts +68 -0
  62. package/src/TrackSelect/Folders/genes/shared/treeBuilder.ts +45 -0
  63. package/src/TrackSelect/Folders/genes/shared/types.ts +29 -0
  64. package/src/TrackSelect/Folders/index.ts +27 -0
  65. package/src/TrackSelect/Folders/types.ts +95 -0
  66. package/src/TrackSelect/TrackSelect.tsx +409 -311
  67. package/src/TrackSelect/TreeView/CustomTreeItem.tsx +217 -0
  68. package/src/TrackSelect/TreeView/TreeViewWrapper.tsx +47 -42
  69. package/src/TrackSelect/store.ts +103 -46
  70. package/src/TrackSelect/types.ts +28 -74
  71. package/src/lib.ts +2 -2
  72. package/test/main.tsx +113 -169
  73. package/.claude/settings.local.json +0 -7
  74. package/dist/TrackSelect/DataGrid/CustomToolbar.d.ts +0 -12
  75. package/dist/TrackSelect/DataGrid/GroupingCell.d.ts +0 -2
  76. package/dist/TrackSelect/DataGrid/columns.d.ts +0 -4
  77. package/dist/TrackSelect/DataGrid/dataGridHelpers.d.ts +0 -49
  78. package/dist/TrackSelect/TreeView/treeViewHelpers.d.ts +0 -49
  79. package/dist/TrackSelect/consts.d.ts +0 -11
  80. package/src/TrackSelect/DataGrid/CustomToolbar.tsx +0 -152
  81. package/src/TrackSelect/DataGrid/dataGridHelpers.tsx +0 -155
  82. package/src/TrackSelect/TreeView/treeViewHelpers.tsx +0 -475
  83. package/src/TrackSelect/consts.ts +0 -92
  84. package/src/TrackSelect/issues.md +0 -404
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Human biosamples folder configuration for GRCh38 assembly.
3
+ *
4
+ * Contains epigenomic data (DNase, ATAC, H3K4me3, H3K27ac, CTCF, cCRE, RNA-seq, ChromHMM)
5
+ * from human tissue samples, primary cells, cell lines, and organoids.
6
+ */
7
+ export declare const humanBiosamplesFolder: import('..').FolderDefinition<import('./shared/types').BiosampleRowInfo>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Mouse biosamples folder configuration for mm10 assembly.
3
+ *
4
+ * Contains epigenomic data (DNase, ATAC, H3K4me3, H3K27ac, CTCF, cCRE, RNA-seq, ChromHMM)
5
+ * from mouse tissue samples, primary cells, cell lines, and organoids.
6
+ */
7
+ export declare const mouseBiosamplesFolder: import('..').FolderDefinition<import('./shared/types').BiosampleRowInfo>;
@@ -0,0 +1,14 @@
1
+ import { FolderRuntimeConfig } from '../../types';
2
+ export interface AssayToggleProps {
3
+ updateConfig: (partial: Partial<FolderRuntimeConfig>) => void;
4
+ }
5
+ /**
6
+ * Biosample-specific toolbar component that toggles between
7
+ * sample-grouped and assay-grouped views.
8
+ *
9
+ * When toggled, it updates the folder's runtime config to switch:
10
+ * - columns: Different column definitions for each view
11
+ * - groupingModel: ["ontology", "displayName"] vs ["assay", "ontology", "displayName"]
12
+ * - leafField: "assay" vs "id"
13
+ */
14
+ export declare function AssayToggle({ updateConfig }: AssayToggleProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { GridRenderCellParams } from '@mui/x-data-grid-premium';
2
+ /**
3
+ * Biosample-specific grouping cell that renders AssayIcon for assay groups/values.
4
+ * Handles expand/collapse, truncation, and tooltips.
5
+ */
6
+ export default function BiosampleGroupingCell(params: GridRenderCellParams): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { CustomTreeItemProps } from '../../../types';
3
+ /**
4
+ * Biosample-specific TreeItem that renders AssayIcon for assay items.
5
+ * Wraps the generic CustomTreeItem with the AssayIcon renderer.
6
+ */
7
+ export declare const BiosampleTreeItem: React.ForwardRefExoticComponent<CustomTreeItemProps & React.RefAttributes<HTMLLIElement>>;
@@ -0,0 +1,14 @@
1
+ import { GridColDef } from '@mui/x-data-grid-premium';
2
+ import { BiosampleRowInfo } from './types';
3
+ /** Columns for sorted-by-assay view (assay as top-level grouping) */
4
+ export declare const sortedByAssayColumns: GridColDef<BiosampleRowInfo>[];
5
+ /** Default columns (ontology as top-level grouping) */
6
+ export declare const defaultColumns: GridColDef<BiosampleRowInfo>[];
7
+ /** Grouping model for sorted-by-assay view */
8
+ export declare const sortedByAssayGroupingModel: string[];
9
+ /** Default grouping model (ontology-based) */
10
+ export declare const defaultGroupingModel: string[];
11
+ /** Leaf field for sorted-by-assay view */
12
+ export declare const sortedByAssayLeafField = "id";
13
+ /** Default leaf field */
14
+ export declare const defaultLeafField = "assay";
@@ -0,0 +1,19 @@
1
+ import { Assembly } from '../../types';
2
+ export type { Assembly };
3
+ export declare const assayTypes: string[];
4
+ export declare const ontologyTypes: string[];
5
+ /** Color mapping for assay types */
6
+ export declare const assayColorMap: {
7
+ [key: string]: string;
8
+ };
9
+ /**
10
+ * Creates the assay icon for DataGrid and RichTreeView
11
+ * @param type - assay type
12
+ * @returns an icon of the assay's respective color
13
+ */
14
+ export declare function AssayIcon(type: string): import("react/jsx-runtime").JSX.Element;
15
+ /**
16
+ * Convert JSON assay key to display name.
17
+ * Used only during data loading to normalize assay names.
18
+ */
19
+ export declare function formatAssayType(jsonKey: string): string;
@@ -0,0 +1,24 @@
1
+ import { FolderDefinition } from '../../types';
2
+ import { BiosampleDataFile, BiosampleRowInfo } from './types';
3
+ export interface CreateBiosampleFolderOptions {
4
+ /** Unique identifier for this folder */
5
+ id: string;
6
+ /** Display label shown in the UI */
7
+ label: string;
8
+ /** Optional description shown in folder cards */
9
+ description?: string;
10
+ /** Raw biosample data from JSON file */
11
+ data: BiosampleDataFile;
12
+ }
13
+ /**
14
+ * Factory function that creates a FolderDefinition for biosample data.
15
+ *
16
+ * This handles all the common setup for biosample folders:
17
+ * - Transforms JSON data into flattened rows
18
+ * - Creates the rowById lookup map
19
+ * - Configures columns, grouping, and tree building
20
+ *
21
+ * @param options - Configuration options for the folder
22
+ * @returns A complete FolderDefinition for the biosample data
23
+ */
24
+ export declare function createBiosampleFolder(options: CreateBiosampleFolderOptions): FolderDefinition<BiosampleRowInfo>;
@@ -0,0 +1,25 @@
1
+ import { TreeViewBaseItem } from '@mui/x-tree-view';
2
+ import { ExtendedTreeItemProps } from '../../../types';
3
+ import { BiosampleRowInfo } from './types';
4
+ /**
5
+ * Builds tree in the sorted by assay view
6
+ * Hierarchy: Assay -> Ontology -> DisplayName -> Experiment
7
+ *
8
+ * @param selectedIds - list of selected row IDs
9
+ * @param rowById - Mapping between an id and its BiosampleRowInfo object
10
+ * @param rootLabel - Label for the root node
11
+ * @param folderId - Folder ID to prefix tree item IDs with
12
+ * @returns tree items for the RichTreeView
13
+ */
14
+ export declare function buildSortedAssayTreeView(selectedIds: string[], rowById: Map<string, BiosampleRowInfo>, rootLabel?: string, folderId?: string): TreeViewBaseItem<ExtendedTreeItemProps>[];
15
+ /**
16
+ * Builds tree in the default view (sorted by ontology)
17
+ * Hierarchy: Ontology -> DisplayName -> Experiment
18
+ *
19
+ * @param selectedIds - list of selected row IDs
20
+ * @param rowById - Mapping between an id and its BiosampleRowInfo object
21
+ * @param rootLabel - Label for the root node
22
+ * @param folderId - Folder ID to prefix tree item IDs with
23
+ * @returns tree items for the RichTreeView
24
+ */
25
+ export declare function buildTreeView(selectedIds: string[], rowById: Map<string, BiosampleRowInfo>, rootLabel?: string, folderId?: string): TreeViewBaseItem<ExtendedTreeItemProps>[];
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Types for biosample folder data
3
+ */
4
+ /**
5
+ * Assay information from the JSON data
6
+ */
7
+ export type BiosampleAssayInfo = {
8
+ id: string;
9
+ assay: string;
10
+ url: string;
11
+ experimentAccession: string;
12
+ fileAccession: string;
13
+ };
14
+ /**
15
+ * Track information from the JSON data
16
+ */
17
+ export type BiosampleTrackInfo = {
18
+ name: string;
19
+ ontology: string;
20
+ lifeStage: string;
21
+ sampleType: string;
22
+ displayName: string;
23
+ assays: BiosampleAssayInfo[];
24
+ };
25
+ /**
26
+ * Row format for DataGrid (flattened from TrackInfo)
27
+ */
28
+ export type BiosampleRowInfo = {
29
+ id: string;
30
+ ontology: string;
31
+ lifeStage: string;
32
+ sampleType: string;
33
+ displayName: string;
34
+ assay: string;
35
+ experimentAccession: string;
36
+ fileAccession: string;
37
+ url: string;
38
+ };
39
+ /**
40
+ * Structure of the biosample JSON data files
41
+ */
42
+ export type BiosampleDataFile = {
43
+ tracks: BiosampleTrackInfo[];
44
+ };
@@ -0,0 +1,10 @@
1
+ declare const _default: [
2
+ {
3
+ "id": "genocode-basic",
4
+ "displayName": "GENCODE Basic Genes",
5
+ "versions": [29, 40]
6
+ }
7
+ ]
8
+ ;
9
+
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: [
2
+ {
3
+ "id": "genocode-basic",
4
+ "displayName": "GENCODE Basic Genes",
5
+ "versions": [21, 25]
6
+ }
7
+ ]
8
+ ;
9
+
10
+ export default _default;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Gene annotations folder for human (GRCh38 assembly)
3
+ *
4
+ * Contains gene annotation tracks like GENCODE that users can
5
+ * select to display in the genome browser.
6
+ */
7
+ export declare const humanGenesFolder: import('..').FolderDefinition<import('./shared/types').GeneRowInfo>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Gene annotations folder for human (GRCh38 assembly)
3
+ *
4
+ * Contains gene annotation tracks like GENCODE that users can
5
+ * select to display in the genome browser.
6
+ */
7
+ export declare const mouseGenesFolder: import('..').FolderDefinition<import('./shared/types').GeneRowInfo>;
@@ -0,0 +1,14 @@
1
+ import { GridColDef } from '@mui/x-data-grid-premium';
2
+ import { GeneRowInfo } from './types';
3
+ /**
4
+ * Default columns for genes DataGrid (flat list, no grouping)
5
+ */
6
+ export declare const defaultColumns: GridColDef<GeneRowInfo>[];
7
+ /**
8
+ * No grouping for genes - flat list
9
+ */
10
+ export declare const defaultGroupingModel: string[];
11
+ /**
12
+ * Leaf field - the unique identifier
13
+ */
14
+ export declare const defaultLeafField = "id";
@@ -0,0 +1,12 @@
1
+ import { FolderDefinition } from '../../types';
2
+ import { GeneDataFile, GeneRowInfo } from './types';
3
+ export interface CreateGeneFolderOptions {
4
+ id: string;
5
+ label: string;
6
+ description?: string;
7
+ data: GeneDataFile;
8
+ }
9
+ /**
10
+ * Factory function that creates a FolderDefinition for genes
11
+ */
12
+ export declare function createGeneFolder(options: CreateGeneFolderOptions): FolderDefinition<GeneRowInfo>;
@@ -0,0 +1,13 @@
1
+ import { TreeViewBaseItem } from '@mui/x-tree-view';
2
+ import { ExtendedTreeItemProps } from '../../../types';
3
+ import { GeneRowInfo } from './types';
4
+ /**
5
+ * Builds a flat tree structure for the TreeView panel (selected items)
6
+ * Since genes have no grouping, this is a simple root -> leaf structure
7
+ *
8
+ * @param selectedIds - Array of selected row IDs
9
+ * @param rowById - Map of row ID to row data
10
+ * @param rootLabel - Label for the root node
11
+ * @returns Tree structure for RichTreeView
12
+ */
13
+ export declare function buildTreeView(selectedIds: string[], rowById: Map<string, GeneRowInfo>, rootLabel?: string): TreeViewBaseItem<ExtendedTreeItemProps>[];
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Types for genes folder data
3
+ */
4
+ /**
5
+ * Gene track information from the JSON data
6
+ */
7
+ export type GeneTrackInfo = {
8
+ /** Unique identifier for this gene track */
9
+ id: string;
10
+ /** Display name shown in the UI */
11
+ displayName: string;
12
+ /** Available versions for this gene annotation */
13
+ versions: number[];
14
+ };
15
+ /**
16
+ * Row format for DataGrid (same as track info for genes since it's flat)
17
+ */
18
+ export type GeneRowInfo = {
19
+ id: string;
20
+ displayName: string;
21
+ versions: number[];
22
+ };
23
+ /**
24
+ * Structure of the gene JSON data files (direct array)
25
+ */
26
+ export type GeneDataFile = GeneTrackInfo[];
@@ -0,0 +1,14 @@
1
+ import { Assembly, FolderDefinition } from './types';
2
+ export { type Assembly, type FolderDefinition, type FolderRuntimeConfig, } from './types';
3
+ /**
4
+ * Registry of folders available for each assembly.
5
+ *
6
+ * Each assembly can have multiple folders (e.g., biosamples, genes, etc.).
7
+ * TrackSelect receives the folders for the current assembly and renders
8
+ * them as tabs or a folder selector.
9
+ *
10
+ * To add a new folder:
11
+ * 1. Create a folder config file (e.g., folders/genes/human.ts)
12
+ * 2. Import and add it to the appropriate assembly array below
13
+ */
14
+ export declare const foldersByAssembly: Record<Assembly, FolderDefinition[]>;
@@ -0,0 +1,76 @@
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
+ export type Assembly = "GRCh38" | "mm10";
5
+ /**
6
+ * Runtime configuration that can be modified by ToolbarExtras components.
7
+ * This allows folder-specific UI (like AssayToggle) to dynamically update
8
+ * how the DataGrid displays data.
9
+ */
10
+ export interface FolderRuntimeConfig {
11
+ columns: GridColDef[];
12
+ groupingModel: string[];
13
+ leafField: string;
14
+ }
15
+ /**
16
+ * Definition for a folder in TrackSelect.
17
+ *
18
+ * A folder represents a category of data (e.g., biosamples, genes, etc.)
19
+ * that can be displayed in the DataGrid and TreeView. Each folder is
20
+ * self-contained with its own data, column definitions, and tree building logic.
21
+ *
22
+ * @template TRow - The type of row data stored in this folder
23
+ */
24
+ export interface FolderDefinition<TRow = any> {
25
+ /** Unique identifier for this folder */
26
+ id: string;
27
+ /** Display label shown in the UI */
28
+ label: string;
29
+ /** Optional description shown in folder cards */
30
+ description?: string;
31
+ /**
32
+ * Single source of truth for all row data.
33
+ * Maps row ID to the full row object.
34
+ */
35
+ rowById: Map<string, TRow>;
36
+ /**
37
+ * Function to extract the unique ID from a row object.
38
+ * Used for selection tracking and lookups.
39
+ */
40
+ getRowId: (row: TRow) => string;
41
+ /** Column definitions for the DataGrid */
42
+ columns: GridColDef[];
43
+ /** Fields to group by in the DataGrid (row grouping) */
44
+ groupingModel: string[];
45
+ /** The field that represents the leaf level in the grouping hierarchy */
46
+ leafField: string;
47
+ /**
48
+ * Builds a tree structure from selected row IDs.
49
+ * Used to display selected items in the TreeView panel.
50
+ *
51
+ * @param selectedIds - Array of selected row IDs
52
+ * @param rowById - Map of row ID to row data (same as this.rowById)
53
+ * @returns Array of tree items to render in the TreeView
54
+ */
55
+ buildTree: (selectedIds: string[], rowById: Map<string, TRow>) => TreeViewBaseItem<ExtendedTreeItemProps>[];
56
+ /**
57
+ * Optional component to render folder-specific toolbar controls.
58
+ * For example, biosamples folder uses this to render an assay toggle
59
+ * that switches between sample-grouped and assay-grouped views.
60
+ *
61
+ * @param updateConfig - Callback to update the folder's runtime config
62
+ */
63
+ ToolbarExtras?: React.FC<{
64
+ updateConfig: (partial: Partial<FolderRuntimeConfig>) => void;
65
+ }>;
66
+ /**
67
+ * Optional custom component for rendering grouping cells in the DataGrid.
68
+ * If not provided, a default grouping cell renderer will be used.
69
+ */
70
+ GroupingCellComponent?: React.FC<GridRenderCellParams>;
71
+ /**
72
+ * Optional custom TreeItem component for the TreeView.
73
+ * If not provided, the default CustomTreeItem will be used.
74
+ */
75
+ TreeItemComponent?: React.ForwardRefExoticComponent<CustomTreeItemProps & React.RefAttributes<HTMLLIElement>>;
76
+ }
@@ -1,8 +1,15 @@
1
- import { SelectionStoreInstance } from './store';
1
+ import { FolderDefinition } from './Folders/types';
2
2
  export interface TrackSelectProps {
3
- store: SelectionStoreInstance;
4
- onSubmit?: (trackIds: Set<string>) => void;
3
+ folders: FolderDefinition[];
4
+ onSubmit: (selectedByFolder: Map<string, Set<string>>) => void;
5
5
  onCancel?: () => void;
6
- onReset?: () => void;
6
+ onClear?: () => void;
7
+ maxTracks?: number;
8
+ storageKey?: string;
9
+ /** Initial selection to use when no stored selection exists */
10
+ initialSelection?: Map<string, Set<string>>;
11
+ open: boolean;
12
+ onClose: () => void;
13
+ title?: string;
7
14
  }
8
- export default function TrackSelect({ store, onSubmit, onCancel, onReset, }: TrackSelectProps): import("react/jsx-runtime").JSX.Element;
15
+ export default function TrackSelect({ folders, onSubmit, onCancel, onClear, maxTracks, storageKey, initialSelection, open, onClose, title, }: TrackSelectProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { CustomTreeItemProps } from '../types';
3
+ export declare const CustomTreeItem: React.ForwardRefExoticComponent<CustomTreeItemProps & React.RefAttributes<HTMLLIElement>>;
@@ -1,2 +1,2 @@
1
1
  import { TreeViewWrapperProps } from '../types';
2
- export declare function TreeViewWrapper({ store, items, trackIds, isSearchResult, }: TreeViewWrapperProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function TreeViewWrapper({ items, selectedCount, onRemove, TreeItemComponent, }: TreeViewWrapperProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,4 @@
1
1
  import { StoreApi, UseBoundStore } from 'zustand';
2
- import { Assembly } from './consts';
3
2
  import { SelectionAction, SelectionState } from './types';
4
3
  export type SelectionStoreInstance = UseBoundStore<StoreApi<SelectionState & SelectionAction>>;
5
- export declare function createSelectionStore(assembly: Assembly, initialIds?: Set<string>): UseBoundStore<StoreApi<SelectionState & SelectionAction>>;
4
+ export declare function createSelectionStore(folderIds: string[], storageKey?: string, initialSelection?: Map<string, Set<string>>): UseBoundStore<StoreApi<SelectionState & SelectionAction>>;
@@ -1,50 +1,8 @@
1
- import { FuseOptionKey } from 'fuse.js';
2
1
  import { UseTreeItemParameters } from '@mui/x-tree-view/useTreeItem';
3
2
  import { TreeViewBaseItem } from '@mui/x-tree-view';
4
- import { DataGridPremiumProps, GridRowSelectionModel } from '@mui/x-data-grid-premium';
3
+ import { DataGridPremiumProps, GridColDef, GridRenderCellParams } from '@mui/x-data-grid-premium';
5
4
  import { ReactElement, ReactNode } from 'react';
6
5
  import { SvgIconOwnProps } from '@mui/material';
7
- import { SelectionStoreInstance } from './store';
8
- export interface SearchTracksProps {
9
- query: string;
10
- keyWeightMap: FuseOptionKey<any>[];
11
- jsonStructure?: string;
12
- treeItems?: TreeViewBaseItem<ExtendedTreeItemProps>[];
13
- threshold?: number;
14
- limit?: number;
15
- }
16
- /**
17
- * Types for the JSON-formatted tracks fomr modifiedHumanTracks.json
18
- */
19
- export type AssayInfo = {
20
- id: string;
21
- assay: string;
22
- url: string;
23
- experimentAccession: string;
24
- fileAccession: string;
25
- };
26
- export type TrackInfo = {
27
- name: string;
28
- ontology: string;
29
- lifeStage: string;
30
- sampleType: string;
31
- displayname: string;
32
- assays: AssayInfo[];
33
- };
34
- /**
35
- * Row format for DataGrid
36
- */
37
- export type RowInfo = {
38
- id: string;
39
- ontology: string;
40
- lifeStage: string;
41
- sampleType: string;
42
- displayname: string;
43
- assay: string;
44
- experimentAccession: string;
45
- fileAccession: string;
46
- url: string;
47
- };
48
6
  /**
49
7
  * Custom Tree Props for RichTreeView Panel
50
8
  */
@@ -52,6 +10,7 @@ export type ExtendedTreeItemProps = {
52
10
  id: string;
53
11
  label: string;
54
12
  icon: string;
13
+ folderId?: string;
55
14
  isAssayItem?: boolean;
56
15
  /**
57
16
  * The assay name for leaf nodes (experiment accession items)
@@ -62,40 +21,39 @@ export type ExtendedTreeItemProps = {
62
21
  * this is used in updating the rowSelectionModel when removing items from the Tree View panel
63
22
  */
64
23
  allExpAccessions?: string[];
65
- allRowInfo?: RowInfo[];
66
24
  };
67
25
  export type TreeViewWrapperProps = {
68
- store: SelectionStoreInstance;
69
26
  items: TreeViewBaseItem<ExtendedTreeItemProps>[];
70
- trackIds: Set<string>;
71
- isSearchResult: boolean;
27
+ selectedCount: number;
28
+ onRemove: (item: TreeViewBaseItem<ExtendedTreeItemProps>) => void;
29
+ /** Optional custom TreeItem component */
30
+ TreeItemComponent?: React.ForwardRefExoticComponent<CustomTreeItemProps & React.RefAttributes<HTMLLIElement>>;
72
31
  };
73
32
  export interface CustomLabelProps {
74
33
  id: string;
75
34
  children: React.ReactNode;
76
35
  isAssayItem?: boolean;
77
36
  assayName?: string;
78
- icon: React.ElementType | React.ReactElement;
37
+ icon?: React.ElementType | React.ReactElement | ReactNode;
38
+ /** Optional function to render custom icons for assay items */
39
+ renderIcon?: (name: string) => ReactNode;
79
40
  }
80
41
  export interface CustomTreeItemProps extends Omit<UseTreeItemParameters, "rootRef">, Omit<React.HTMLAttributes<HTMLLIElement>, "onFocus"> {
81
42
  onRemove?: (item: TreeViewBaseItem<ExtendedTreeItemProps>) => void;
43
+ /** Optional function to render custom icons for assay items */
44
+ renderIcon?: (name: string) => ReactNode;
82
45
  }
83
46
  /**
84
47
  * Types for useSelectionStore to keep track of selected DataGrid rows/tracks
85
48
  */
86
49
  export type SelectionState = {
87
- maxTracks: number;
88
- assembly: string;
89
- rows: RowInfo[];
90
- rowById: Map<string, RowInfo>;
91
- selectedIds: Set<string>;
50
+ selectedByFolder: Map<string, Set<string>>;
51
+ activeFolderId: string;
92
52
  };
93
53
  export type SelectionAction = {
94
- getTrackIds: () => Set<string>;
95
- getTrackMap: () => Map<string, RowInfo>;
96
- setSelected: (ids: Set<string>) => void;
97
- removeIds: (removedIds: Set<string>) => void;
98
- clear: () => void;
54
+ clear: (folderId?: string) => void;
55
+ setActiveFolder: (folderId: string) => void;
56
+ setSelection: (folderId: string, ids: Set<string>) => void;
99
57
  };
100
58
  /**
101
59
  * DataGrid Props
@@ -116,11 +74,15 @@ interface BaseTableProps extends Omit<DataGridPremiumProps, "columns"> {
116
74
  */
117
75
  toolbarIconColor?: SvgIconOwnProps["htmlColor"];
118
76
  }
119
- type DataGridWrapperProps = {
120
- rows: RowInfo[];
77
+ export type DataGridWrapperProps = {
78
+ rows: any[];
79
+ columns: GridColDef[];
80
+ groupingModel: string[];
81
+ leafField: string;
121
82
  selectedIds: Set<string>;
122
- handleSelection: (newSelection: GridRowSelectionModel) => void;
123
- sortedAssay: boolean;
83
+ onSelectionChange: (ids: Set<string>) => void;
84
+ /** Optional custom component for rendering grouping cells */
85
+ GroupingCellComponent?: React.FC<GridRenderCellParams>;
124
86
  };
125
87
  export type DataGridProps = DataGridWrapperProps & BaseTableProps & ({
126
88
  label?: string;