1- import { ColumnDef } from "@tanstack/react-table" ;
2- import { GridTrackSize } from "../config/entities" ;
1+ import { ColumnDef , RowData } from "@tanstack/react-table" ;
32
43/**
54 * Model of a value of a metadata class.
@@ -19,11 +18,6 @@ export interface Attribute {
1918 values ?: string ; // Free text description of attribute values
2019}
2120
22- /**
23- * Model of attribute key types; used mostly when building data dictionary column definitions.
24- */
25- export type AttributeValueTypes < TValue = unknown > = TValue ;
26-
2721/**
2822 * Filterable metadata keys.
2923 */
@@ -41,8 +35,8 @@ export interface CategoryTag {
4135/**
4236 * Model of a metadata class, to be specified manually or built from LinkML schema.
4337 */
44- export interface Class {
45- attributes : Attribute [ ] ;
38+ export interface Class < T extends RowData = Attribute > {
39+ attributes : T [ ] ;
4640 description : string ;
4741 name : string ; // Programmatic name or key (e.g. cell, sample)
4842 title : string ; // Display name
@@ -62,41 +56,24 @@ export type DataDictionaryPrefix = Record<string, string>;
6256/**
6357 * Model of a metadata dictionary containing a set of classes and their definitions.
6458 */
65- export interface DataDictionary {
59+ export interface DataDictionary < T extends RowData = Attribute > {
6660 annotations ?: {
6761 [ key in keyof DataDictionaryPrefix ] : string ; // Prefix to title e.g. "cxg": "CELLxGENE"
6862 } ;
69- classes : Class [ ] ;
63+ classes : Class < T > [ ] ;
7064 description ?: string ; // Free text description of data dictionary
7165 name : string ; // Programmatic name or key (e.g. tier1, hca)
7266 prefixes ?: DataDictionaryPrefix ;
7367 title : string ; // Display name
7468}
7569
76- /**
77- * Display model of a data dictionary column.
78- */
79- export interface DataDictionaryColumnDef {
80- attributeAccessorFnName ?: string ; // Name of accessor function to map to.
81- attributeCellName ?: string ; // Name of cell renderer component to map to.
82- attributeDisplayName : string ;
83- attributeSlotName : string ;
84- // Adding width here for now; possibly revisit separating column def and UI.
85- width :
86- | Omit < GridTrackSize , "GridTrackMinMax" >
87- | {
88- max : string ;
89- min : string ;
90- } ;
91- }
92-
9370/**
9471 * Configuration of data dictionary; contains schema definition (that is, the actual data
9572 * dictionary) as well as column def for displaying the data dictionary.
9673 */
97- export interface DataDictionaryConfig {
98- columnDefs : ColumnDef < Attribute , AttributeValueTypes > [ ] ;
99- dataDictionary : DataDictionary ;
74+ export interface DataDictionaryConfig < T extends RowData = Attribute > {
75+ columnDefs : ColumnDef < T , T [ keyof T ] > [ ] ;
76+ dataDictionary : DataDictionary < T > ;
10077}
10178
10279/**
0 commit comments