@weng-lab/genomebrowser-ui 0.3.6 → 0.4.0-beta.1
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.
- package/.env.local +1 -1
- package/dist/TrackSelect/Folders/biosamples/shared/BiosampleViewSelector.d.ts +7 -0
- package/dist/TrackSelect/Folders/biosamples/shared/createFolder.d.ts +1 -13
- package/dist/TrackSelect/Folders/biosamples/shared/toTrack.d.ts +20 -0
- package/dist/TrackSelect/Folders/biosamples/shared/types.d.ts +4 -13
- package/dist/TrackSelect/Folders/genes/shared/columns.d.ts +2 -2
- package/dist/TrackSelect/Folders/genes/shared/createFolder.d.ts +1 -3
- package/dist/TrackSelect/Folders/genes/shared/toTrack.d.ts +18 -0
- package/dist/TrackSelect/Folders/genes/shared/types.d.ts +2 -0
- package/dist/TrackSelect/Folders/index.d.ts +6 -12
- package/dist/TrackSelect/Folders/mohd/data/human.json.d.ts +2948 -0
- package/dist/TrackSelect/Folders/mohd/human.d.ts +1 -0
- package/dist/TrackSelect/Folders/mohd/shared/MohdGroupingCell.d.ts +2 -0
- package/dist/TrackSelect/Folders/mohd/shared/MohdTreeItem.d.ts +3 -0
- package/dist/TrackSelect/Folders/mohd/shared/MohdViewSelector.d.ts +7 -0
- package/dist/TrackSelect/Folders/mohd/shared/columns.d.ts +5 -0
- package/dist/TrackSelect/Folders/mohd/shared/config.d.ts +42 -0
- package/dist/TrackSelect/Folders/mohd/shared/createFolder.d.ts +9 -0
- package/dist/TrackSelect/Folders/mohd/shared/toTrack.d.ts +9 -0
- package/dist/TrackSelect/Folders/mohd/shared/types.d.ts +40 -0
- package/dist/TrackSelect/Folders/other-tracks/shared/toTrack.d.ts +5 -0
- package/dist/TrackSelect/Folders/other-tracks/shared/types.d.ts +1 -0
- package/dist/TrackSelect/Folders/types.d.ts +23 -55
- package/dist/TrackSelect/TrackSelect.d.ts +10 -7
- package/dist/TrackSelect/TreeView/TreeViewWrapper.d.ts +1 -1
- package/dist/TrackSelect/buildSelectedTree.d.ts +15 -0
- package/dist/TrackSelect/managedTracks.d.ts +13 -0
- package/dist/TrackSelect/resolveFolderView.d.ts +2 -0
- package/dist/TrackSelect/trackContext.d.ts +5 -0
- package/dist/TrackSelect/types.d.ts +12 -33
- package/dist/genomebrowser-ui.es.js +2231 -1732
- package/dist/genomebrowser-ui.es.js.map +1 -1
- package/dist/lib.d.ts +4 -4
- package/dist/muiLicense.d.ts +1 -0
- package/package.json +6 -3
- package/src/TrackSelect/Dialogs/ClearDialog.tsx +3 -8
- package/src/TrackSelect/Dialogs/ResetDialog.tsx +5 -4
- package/src/TrackSelect/FolderList/FolderCard.tsx +1 -1
- package/src/TrackSelect/Folders/biosamples/shared/BiosampleViewSelector.tsx +33 -0
- package/src/TrackSelect/Folders/biosamples/shared/createFolder.ts +39 -58
- package/src/TrackSelect/Folders/biosamples/shared/toTrack.ts +138 -0
- package/src/TrackSelect/Folders/biosamples/shared/types.ts +4 -16
- package/src/TrackSelect/Folders/genes/shared/columns.tsx +2 -2
- package/src/TrackSelect/Folders/genes/shared/createFolder.ts +11 -31
- package/src/TrackSelect/Folders/genes/shared/toTrack.ts +59 -0
- package/src/TrackSelect/Folders/genes/shared/types.ts +2 -0
- package/src/TrackSelect/Folders/index.ts +14 -17
- package/src/TrackSelect/Folders/mohd/data/human.json +2945 -0
- package/src/TrackSelect/Folders/mohd/human.ts +10 -0
- package/src/TrackSelect/Folders/mohd/shared/MohdGroupingCell.tsx +68 -0
- package/src/TrackSelect/Folders/mohd/shared/MohdTreeItem.tsx +17 -0
- package/src/TrackSelect/Folders/mohd/shared/MohdViewSelector.tsx +33 -0
- package/src/TrackSelect/Folders/mohd/shared/columns.tsx +79 -0
- package/src/TrackSelect/Folders/mohd/shared/config.tsx +71 -0
- package/src/TrackSelect/Folders/mohd/shared/createFolder.ts +144 -0
- package/src/TrackSelect/Folders/mohd/shared/toTrack.ts +164 -0
- package/src/TrackSelect/Folders/mohd/shared/types.ts +46 -0
- package/src/TrackSelect/Folders/other-tracks/shared/createFolder.ts +13 -14
- package/src/TrackSelect/Folders/other-tracks/shared/toTrack.ts +17 -0
- package/src/TrackSelect/Folders/other-tracks/shared/types.ts +1 -0
- package/src/TrackSelect/Folders/types.ts +26 -69
- package/src/TrackSelect/TrackSelect.tsx +301 -257
- package/src/TrackSelect/TreeView/CustomTreeItem.tsx +9 -9
- package/src/TrackSelect/TreeView/TreeViewWrapper.tsx +84 -6
- package/src/TrackSelect/buildSelectedTree.ts +145 -0
- package/src/TrackSelect/managedTracks.ts +92 -0
- package/src/TrackSelect/resolveFolderView.ts +20 -0
- package/src/TrackSelect/trackContext.ts +9 -0
- package/src/TrackSelect/types.ts +14 -39
- package/src/lib.ts +13 -7
- package/src/muiLicense.ts +9 -0
- package/src/vite-env.d.ts +9 -0
- package/test/TrackSelect.test.tsx +435 -0
- package/test/main.tsx +36 -352
- package/test/mocks/logo-test.tsx +11 -0
- package/test/mohdDisplay.test.tsx +45 -0
- package/test/startup.test.ts +206 -0
- package/test/trackSelectState.test.ts +176 -0
- package/vite.config.ts +1 -0
- package/vitest.config.ts +20 -0
- package/dist/TrackSelect/Folders/biosamples/shared/AssayToggle.d.ts +0 -18
- package/dist/TrackSelect/Folders/biosamples/shared/treeBuilder.d.ts +0 -28
- package/dist/TrackSelect/Folders/genes/shared/treeBuilder.d.ts +0 -13
- package/dist/TrackSelect/Folders/other-tracks/shared/treeBuilder.d.ts +0 -4
- package/dist/TrackSelect/store.d.ts +0 -4
- package/src/TrackSelect/Folders/NEW.md +0 -929
- package/src/TrackSelect/Folders/biosamples/shared/AssayToggle.tsx +0 -78
- package/src/TrackSelect/Folders/biosamples/shared/treeBuilder.ts +0 -224
- package/src/TrackSelect/Folders/genes/shared/treeBuilder.ts +0 -45
- package/src/TrackSelect/Folders/other-tracks/shared/treeBuilder.ts +0 -34
- package/src/TrackSelect/store.ts +0 -117
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const humanMohdFolder: import('..').FolderDefinition<import('..').MohdRowInfo>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FolderView } from '../../types';
|
|
2
|
+
export interface MohdViewSelectorProps {
|
|
3
|
+
views: FolderView[];
|
|
4
|
+
activeViewId: string;
|
|
5
|
+
onChange: (viewId: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function MohdViewSelector({ views, activeViewId, onChange, }: MohdViewSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const MOHD_BASE_URL = "https://downloads.mohdconsortium.org";
|
|
2
|
+
export declare const MOHD_OME_CONFIG: {
|
|
3
|
+
readonly atac: {
|
|
4
|
+
readonly label: "ATAC";
|
|
5
|
+
readonly color: "#02c7b9";
|
|
6
|
+
readonly downloadPath: "2_ATAC";
|
|
7
|
+
};
|
|
8
|
+
readonly rna: {
|
|
9
|
+
readonly label: "RNA";
|
|
10
|
+
readonly color: "#00aa00";
|
|
11
|
+
readonly downloadPath: "3_RNA";
|
|
12
|
+
};
|
|
13
|
+
readonly wgbs: {
|
|
14
|
+
readonly label: "WGBS";
|
|
15
|
+
readonly color: "#648bd8";
|
|
16
|
+
readonly downloadPath: "1_WGBS";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type MohdRawOme = keyof typeof MOHD_OME_CONFIG;
|
|
20
|
+
export type MohdOme = (typeof MOHD_OME_CONFIG)[MohdRawOme]["label"];
|
|
21
|
+
export declare function getMohdOmeConfig(rawOme: string): {
|
|
22
|
+
readonly label: "ATAC";
|
|
23
|
+
readonly color: "#02c7b9";
|
|
24
|
+
readonly downloadPath: "2_ATAC";
|
|
25
|
+
} | {
|
|
26
|
+
readonly label: "RNA";
|
|
27
|
+
readonly color: "#00aa00";
|
|
28
|
+
readonly downloadPath: "3_RNA";
|
|
29
|
+
} | {
|
|
30
|
+
readonly label: "WGBS";
|
|
31
|
+
readonly color: "#648bd8";
|
|
32
|
+
readonly downloadPath: "1_WGBS";
|
|
33
|
+
};
|
|
34
|
+
export declare function createMohdFileUrl({ ome, sampleId, filename, }: {
|
|
35
|
+
ome: string;
|
|
36
|
+
sampleId: string;
|
|
37
|
+
filename: string;
|
|
38
|
+
}): string;
|
|
39
|
+
export declare function isMohdOmeLabel(value: string): boolean;
|
|
40
|
+
export declare function MohdOmeIcon({ type }: {
|
|
41
|
+
type: string;
|
|
42
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FolderDefinition } from '../../types';
|
|
2
|
+
import { MohdDataFile, MohdRowInfo } from './types';
|
|
3
|
+
export interface CreateMohdFolderOptions {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
data: MohdDataFile;
|
|
8
|
+
}
|
|
9
|
+
export declare function createMohdFolder(options: CreateMohdFolderOptions): FolderDefinition<MohdRowInfo>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Track, ValuedPoint } from '@weng-lab/genomebrowser';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import { CreateTrackOptions } from '../../types';
|
|
4
|
+
import { MohdRowInfo } from './types';
|
|
5
|
+
export type MohdTrackContext = {
|
|
6
|
+
mohdSignalTooltip?: FC<ValuedPoint[]>;
|
|
7
|
+
mohdMethylTooltip?: FC<ValuedPoint[]>;
|
|
8
|
+
};
|
|
9
|
+
export declare function createMohdTrack(row: MohdRowInfo, options: CreateTrackOptions): Track | null;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { MohdOme } from './config';
|
|
2
|
+
export type MohdMethylStrandUrls = {
|
|
3
|
+
cpg: string;
|
|
4
|
+
chg: string;
|
|
5
|
+
chh: string;
|
|
6
|
+
depth: string;
|
|
7
|
+
};
|
|
8
|
+
export type MohdDataRow = {
|
|
9
|
+
ome: string;
|
|
10
|
+
site: string;
|
|
11
|
+
sample_id: string;
|
|
12
|
+
file_type: string;
|
|
13
|
+
filename: string;
|
|
14
|
+
sex: string;
|
|
15
|
+
status: string;
|
|
16
|
+
};
|
|
17
|
+
type MohdBaseRowInfo = {
|
|
18
|
+
id: string;
|
|
19
|
+
ome: MohdOme;
|
|
20
|
+
site: string;
|
|
21
|
+
sampleId: string;
|
|
22
|
+
sex: string;
|
|
23
|
+
status: string;
|
|
24
|
+
description: string;
|
|
25
|
+
trackCategory: "Signal" | "Annotation" | "Methylation";
|
|
26
|
+
};
|
|
27
|
+
export type MohdFileRowInfo = MohdBaseRowInfo & {
|
|
28
|
+
kind: "file";
|
|
29
|
+
filename: string;
|
|
30
|
+
};
|
|
31
|
+
export type MohdWgbsMethylRowInfo = MohdBaseRowInfo & {
|
|
32
|
+
kind: "wgbs-methyl";
|
|
33
|
+
filenames: {
|
|
34
|
+
plusStrand: MohdMethylStrandUrls;
|
|
35
|
+
minusStrand: MohdMethylStrandUrls;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type MohdRowInfo = MohdFileRowInfo | MohdWgbsMethylRowInfo;
|
|
39
|
+
export type MohdDataFile = MohdDataRow[];
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Track } from '@weng-lab/genomebrowser';
|
|
2
|
+
import { CreateTrackOptions } from '../../types';
|
|
3
|
+
import { OtherTrackInfo } from './types';
|
|
4
|
+
export type OtherTracksTrackContext = {};
|
|
5
|
+
export declare function createOtherTrack(row: OtherTrackInfo, _options: CreateTrackOptions): Track | null;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { GridColDef, GridRenderCellParams } from '@mui/x-data-grid-premium';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Track } from '@weng-lab/genomebrowser';
|
|
3
|
+
import { TrackSelectTrackContext } from '../trackContext';
|
|
4
|
+
import { CustomTreeItemProps } from '../types';
|
|
4
5
|
export type Assembly = "GRCh38" | "mm10";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* how the DataGrid and TreeView display data.
|
|
9
|
-
*/
|
|
10
|
-
export interface FolderRuntimeConfig {
|
|
6
|
+
export interface FolderView {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
11
9
|
columns: GridColDef[];
|
|
12
10
|
groupingModel: string[];
|
|
13
11
|
leafField: string;
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
}
|
|
13
|
+
/** Options passed to folder-owned track factories. */
|
|
14
|
+
export interface CreateTrackOptions {
|
|
15
|
+
assembly: Assembly;
|
|
16
|
+
trackContext?: TrackSelectTrackContext;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Definition for a folder in TrackSelect.
|
|
@@ -24,61 +25,28 @@ export interface FolderRuntimeConfig {
|
|
|
24
25
|
* @template TRow - The type of row data stored in this folder
|
|
25
26
|
*/
|
|
26
27
|
export interface FolderDefinition<TRow = any> {
|
|
27
|
-
/** Unique identifier for this folder */
|
|
28
28
|
id: string;
|
|
29
|
-
/** Display label shown in the UI */
|
|
30
29
|
label: string;
|
|
31
|
-
/** Optional description shown in folder cards */
|
|
32
30
|
description?: string;
|
|
33
|
-
|
|
34
|
-
* Single source of truth for all row data.
|
|
35
|
-
* Maps row ID to the full row object.
|
|
36
|
-
*/
|
|
37
|
-
rowById: Map<string, TRow>;
|
|
38
|
-
/**
|
|
39
|
-
* Function to extract the unique ID from a row object.
|
|
40
|
-
* Used for selection tracking and lookups.
|
|
41
|
-
*/
|
|
42
|
-
getRowId: (row: TRow) => string;
|
|
43
|
-
/** Column definitions for the DataGrid */
|
|
31
|
+
rows: TRow[];
|
|
44
32
|
columns: GridColDef[];
|
|
45
|
-
/** Fields to group by in the DataGrid (row grouping) */
|
|
46
33
|
groupingModel: string[];
|
|
47
|
-
/** The field that represents the leaf level in the grouping hierarchy */
|
|
48
34
|
leafField: string;
|
|
49
35
|
/**
|
|
50
|
-
*
|
|
51
|
-
* Used to display selected items in the TreeView panel.
|
|
52
|
-
*
|
|
53
|
-
* @param selectedIds - Array of selected row IDs
|
|
54
|
-
* @param rowById - Map of row ID to row data (same as this.rowById)
|
|
55
|
-
* @returns Array of tree items to render in the TreeView
|
|
56
|
-
*/
|
|
57
|
-
buildTree: (selectedIds: string[], rowById: Map<string, TRow>) => TreeViewBaseItem<ExtendedTreeItemProps>[];
|
|
58
|
-
/**
|
|
59
|
-
* Optional component to render folder-specific toolbar controls.
|
|
60
|
-
* For example, biosamples folder uses this to render an assay toggle
|
|
61
|
-
* that switches between sample-grouped and assay-grouped views.
|
|
36
|
+
* Creates a browser track from a folder row.
|
|
62
37
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* @param config - The current runtime config for this folder
|
|
38
|
+
* This keeps folder-specific track creation logic colocated with the
|
|
39
|
+
* folder's data and presentation logic instead of requiring consumers to
|
|
40
|
+
* branch on folder IDs.
|
|
67
41
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
42
|
+
createTrack: (row: TRow, options: CreateTrackOptions) => Track | null;
|
|
43
|
+
views?: FolderView[];
|
|
44
|
+
ViewSelector?: React.FC<{
|
|
45
|
+
views: FolderView[];
|
|
46
|
+
activeViewId: string;
|
|
47
|
+
onChange: (viewId: string) => void;
|
|
73
48
|
}>;
|
|
74
|
-
/**
|
|
75
|
-
* Optional custom component for rendering grouping cells in the DataGrid.
|
|
76
|
-
* If not provided, a default grouping cell renderer will be used.
|
|
77
|
-
*/
|
|
78
49
|
GroupingCellComponent?: React.FC<GridRenderCellParams>;
|
|
79
|
-
/**
|
|
80
|
-
* Optional custom TreeItem component for the TreeView.
|
|
81
|
-
* If not provided, the default CustomTreeItem will be used.
|
|
82
|
-
*/
|
|
83
50
|
TreeItemComponent?: React.ForwardRefExoticComponent<CustomTreeItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
51
|
+
LeafTreeItemComponent?: React.ForwardRefExoticComponent<CustomTreeItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
84
52
|
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TrackStoreInstance } from '@weng-lab/genomebrowser';
|
|
2
|
+
import { Assembly, FolderDefinition } from './Folders/types';
|
|
3
|
+
import { TrackSelectTrackContext } from './trackContext';
|
|
4
|
+
export type InitialSelectedIdsByAssembly = Partial<Record<Assembly, Record<string, string[]>>>;
|
|
2
5
|
export interface TrackSelectProps {
|
|
6
|
+
assembly: Assembly;
|
|
3
7
|
folders: FolderDefinition[];
|
|
4
|
-
|
|
8
|
+
initialSelectedIds?: InitialSelectedIdsByAssembly;
|
|
9
|
+
sessionStorageKey?: string;
|
|
10
|
+
trackStore?: TrackStoreInstance;
|
|
5
11
|
onCancel?: () => void;
|
|
6
|
-
onClear?: () => void;
|
|
7
12
|
maxTracks?: number;
|
|
8
|
-
|
|
9
|
-
/** Initial selection to use when no stored selection exists */
|
|
10
|
-
initialSelection?: Map<string, Set<string>>;
|
|
13
|
+
trackContext?: TrackSelectTrackContext;
|
|
11
14
|
open: boolean;
|
|
12
15
|
onClose: () => void;
|
|
13
16
|
title?: string;
|
|
14
17
|
}
|
|
15
|
-
export default function TrackSelect({ folders,
|
|
18
|
+
export default function TrackSelect({ assembly, folders, initialSelectedIds, sessionStorageKey, trackStore, onCancel, maxTracks, trackContext, open, onClose, title, }: TrackSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TreeViewWrapperProps } from '../types';
|
|
2
|
-
export declare function TreeViewWrapper({
|
|
2
|
+
export declare function TreeViewWrapper({ folders, selectedByFolder, activeViewIdByFolder, selectedCount, onRemove, }: TreeViewWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TreeViewBaseItem } from '@mui/x-tree-view';
|
|
2
|
+
import { ExtendedTreeItemProps } from './types';
|
|
3
|
+
type TreeRow = {
|
|
4
|
+
id: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
type BuildSelectedTreeOptions = {
|
|
8
|
+
folderId: string;
|
|
9
|
+
rootLabel: string;
|
|
10
|
+
selectedRows: TreeRow[];
|
|
11
|
+
groupingModel: string[];
|
|
12
|
+
leafField: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const buildSelectedTree: ({ folderId, rootLabel, selectedRows, groupingModel, leafField, }: BuildSelectedTreeOptions) => TreeViewBaseItem<ExtendedTreeItemProps>[];
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Track } from '@weng-lab/genomebrowser';
|
|
2
|
+
import { Assembly, FolderDefinition } from './Folders/types';
|
|
3
|
+
import { TrackSelectTrackContext } from './trackContext';
|
|
4
|
+
export declare const diffManagedTracks: ({ assembly, currentTracks, folders, selectedByFolder, trackContext, }: {
|
|
5
|
+
assembly: Assembly;
|
|
6
|
+
currentTracks: Track[];
|
|
7
|
+
folders: FolderDefinition[];
|
|
8
|
+
selectedByFolder: Map<string, Set<string>>;
|
|
9
|
+
trackContext?: TrackSelectTrackContext;
|
|
10
|
+
}) => {
|
|
11
|
+
idsToRemove: string[];
|
|
12
|
+
tracksToAdd: Track[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BiosampleTrackContext } from './Folders/biosamples/shared/toTrack';
|
|
2
|
+
import { GeneTrackContext } from './Folders/genes/shared/toTrack';
|
|
3
|
+
import { MohdTrackContext } from './Folders/mohd/shared/toTrack';
|
|
4
|
+
import { OtherTracksTrackContext } from './Folders/other-tracks/shared/toTrack';
|
|
5
|
+
export type TrackSelectTrackContext = GeneTrackContext & BiosampleTrackContext & MohdTrackContext & OtherTracksTrackContext;
|
|
@@ -3,6 +3,7 @@ import { TreeViewBaseItem } from '@mui/x-tree-view';
|
|
|
3
3
|
import { DataGridPremiumProps, GridColDef, GridRenderCellParams } from '@mui/x-data-grid-premium';
|
|
4
4
|
import { ReactElement, ReactNode } from 'react';
|
|
5
5
|
import { SvgIconOwnProps } from '@mui/material';
|
|
6
|
+
import { FolderDefinition } from './Folders/types';
|
|
6
7
|
/**
|
|
7
8
|
* Custom Tree Props for RichTreeView Panel
|
|
8
9
|
*/
|
|
@@ -10,60 +11,38 @@ export type ExtendedTreeItemProps = {
|
|
|
10
11
|
id: string;
|
|
11
12
|
label: string;
|
|
12
13
|
icon: string;
|
|
14
|
+
kind?: "root" | "group" | "leaf";
|
|
15
|
+
field?: string;
|
|
16
|
+
value?: string;
|
|
17
|
+
rowId?: string;
|
|
13
18
|
folderId?: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* The assay name for leaf nodes (experiment accession items)
|
|
17
|
-
*/
|
|
18
|
-
assayName?: string;
|
|
19
|
+
isHighlightedItem?: boolean;
|
|
20
|
+
highlightName?: string;
|
|
19
21
|
/**
|
|
20
22
|
* list of all the experimentAccession values in the children/grandchildren of the item, or the accession of the item itself
|
|
21
23
|
* this is used in updating the rowSelectionModel when removing items from the Tree View panel
|
|
22
24
|
*/
|
|
23
25
|
allExpAccessions?: string[];
|
|
24
26
|
};
|
|
25
|
-
/**
|
|
26
|
-
* Configuration for a single folder's tree in the TreeViewWrapper.
|
|
27
|
-
* Each folder gets its own tree with its own TreeItemComponent.
|
|
28
|
-
*/
|
|
29
|
-
export type FolderTreeConfig = {
|
|
30
|
-
folderId: string;
|
|
31
|
-
items: TreeViewBaseItem<ExtendedTreeItemProps>[];
|
|
32
|
-
/** Optional custom TreeItem component for this folder */
|
|
33
|
-
TreeItemComponent?: React.ForwardRefExoticComponent<CustomTreeItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
34
|
-
};
|
|
35
27
|
export type TreeViewWrapperProps = {
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
folders: FolderDefinition[];
|
|
29
|
+
selectedByFolder: Map<string, Set<string>>;
|
|
30
|
+
activeViewIdByFolder: Map<string, string>;
|
|
38
31
|
selectedCount: number;
|
|
39
32
|
onRemove: (item: TreeViewBaseItem<ExtendedTreeItemProps>) => void;
|
|
40
33
|
};
|
|
41
34
|
export interface CustomLabelProps {
|
|
42
35
|
id: string;
|
|
43
36
|
children: React.ReactNode;
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
isHighlightedItem?: boolean;
|
|
38
|
+
highlightName?: string;
|
|
46
39
|
icon?: React.ElementType | React.ReactElement | ReactNode;
|
|
47
|
-
/** Optional function to render custom icons for assay items */
|
|
48
40
|
renderIcon?: (name: string) => ReactNode;
|
|
49
41
|
}
|
|
50
42
|
export interface CustomTreeItemProps extends Omit<UseTreeItemParameters, "rootRef">, Omit<React.HTMLAttributes<HTMLLIElement>, "onFocus"> {
|
|
51
43
|
onRemove?: (item: TreeViewBaseItem<ExtendedTreeItemProps>) => void;
|
|
52
|
-
/** Optional function to render custom icons for assay items */
|
|
53
44
|
renderIcon?: (name: string) => ReactNode;
|
|
54
45
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Types for useSelectionStore to keep track of selected DataGrid rows/tracks
|
|
57
|
-
*/
|
|
58
|
-
export type SelectionState = {
|
|
59
|
-
selectedByFolder: Map<string, Set<string>>;
|
|
60
|
-
activeFolderId: string;
|
|
61
|
-
};
|
|
62
|
-
export type SelectionAction = {
|
|
63
|
-
clear: (folderId?: string) => void;
|
|
64
|
-
setActiveFolder: (folderId: string) => void;
|
|
65
|
-
setSelection: (folderId: string, ids: Set<string>) => void;
|
|
66
|
-
};
|
|
67
46
|
/**
|
|
68
47
|
* DataGrid Props
|
|
69
48
|
*/
|