@databiosphere/findable-ui 28.0.1 → 29.0.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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +18 -0
- package/lib/common/entities.d.ts +27 -7
- package/lib/components/DataDictionary/common/utils.js +4 -4
- package/lib/components/DataDictionary/components/Entities/entities.js +1 -1
- package/lib/components/DataDictionary/components/Entities/types.d.ts +2 -2
- package/lib/components/DataDictionary/components/Entity/entity.js +3 -3
- package/lib/components/DataDictionary/components/Entity/types.d.ts +2 -2
- package/lib/components/DataDictionary/components/Outline/utils.js +3 -3
- package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +2 -2
- package/lib/components/DataDictionary/components/Table/hook.d.ts +2 -2
- package/lib/components/DataDictionary/hooks/UseDataDictionary/types.d.ts +2 -2
- package/package.json +1 -1
- package/src/common/entities.ts +29 -8
- package/src/components/DataDictionary/common/utils.ts +4 -4
- package/src/components/DataDictionary/components/Entities/entities.tsx +1 -1
- package/src/components/DataDictionary/components/Entities/types.ts +6 -2
- package/src/components/DataDictionary/components/Entity/entity.tsx +2 -2
- package/src/components/DataDictionary/components/Entity/types.ts +6 -2
- package/src/components/DataDictionary/components/Outline/utils.ts +3 -3
- package/src/components/DataDictionary/components/Table/components/BasicCell/types.ts +5 -2
- package/src/components/DataDictionary/components/Table/hook.ts +2 -2
- package/src/components/DataDictionary/hooks/UseDataDictionary/types.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [29.0.1](https://github.com/DataBiosphere/findable-ui/compare/v29.0.0...v29.0.1) (2025-05-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* updated optional dictionary values [#423](https://github.com/DataBiosphere/findable-ui/issues/423) ([#459](https://github.com/DataBiosphere/findable-ui/issues/459)) ([f6dbfb5](https://github.com/DataBiosphere/findable-ui/commit/f6dbfb5461541166a6f8b82ae4f5d07761e447d4))
|
|
9
|
+
|
|
10
|
+
## [29.0.0](https://github.com/DataBiosphere/findable-ui/compare/v28.0.1...v29.0.0) (2025-05-06)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### ⚠ BREAKING CHANGES
|
|
14
|
+
|
|
15
|
+
* updated data dictionary model #423 ([#454](https://github.com/DataBiosphere/findable-ui/issues/454))
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* updated data dictionary model [#423](https://github.com/DataBiosphere/findable-ui/issues/423) ([#454](https://github.com/DataBiosphere/findable-ui/issues/454)) ([729da9e](https://github.com/DataBiosphere/findable-ui/commit/729da9e569addd680c2b160973f47630441d613c))
|
|
20
|
+
|
|
3
21
|
## [28.0.1](https://github.com/DataBiosphere/findable-ui/compare/v28.0.0...v28.0.1) (2025-04-30)
|
|
4
22
|
|
|
5
23
|
|
package/lib/common/entities.d.ts
CHANGED
|
@@ -3,14 +3,23 @@ import { ColumnDef } from "@tanstack/react-table";
|
|
|
3
3
|
* Model of a value of a metadata class.
|
|
4
4
|
*/
|
|
5
5
|
export interface Attribute {
|
|
6
|
+
annotations?: {
|
|
7
|
+
[key in keyof DataDictionaryPrefix]: string;
|
|
8
|
+
};
|
|
6
9
|
description: string;
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
example?: string;
|
|
11
|
+
multivalued: boolean;
|
|
12
|
+
name: string;
|
|
13
|
+
range: string;
|
|
14
|
+
rationale?: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
title: string;
|
|
17
|
+
values?: string;
|
|
9
18
|
}
|
|
10
19
|
/**
|
|
11
|
-
* Model of attribute
|
|
20
|
+
* Model of attribute key types; used mostly when building data dictionary column definitions.
|
|
12
21
|
*/
|
|
13
|
-
export type
|
|
22
|
+
export type AttributeValueTypes = string | boolean;
|
|
14
23
|
/**
|
|
15
24
|
* Filterable metadata keys.
|
|
16
25
|
*/
|
|
@@ -29,19 +38,30 @@ export interface CategoryTag {
|
|
|
29
38
|
export interface Class {
|
|
30
39
|
attributes: Attribute[];
|
|
31
40
|
description: string;
|
|
32
|
-
key: string;
|
|
33
|
-
label: string;
|
|
34
41
|
name: string;
|
|
42
|
+
title: string;
|
|
35
43
|
}
|
|
36
44
|
/**
|
|
37
45
|
* Category values to be used as keys. For example, "Homo sapiens" or "10X 3' v2 sequencing".
|
|
38
46
|
*/
|
|
39
47
|
export type CategoryValueKey = unknown;
|
|
48
|
+
/**
|
|
49
|
+
* Key value pair where the key is an identifier for a schema and the value is
|
|
50
|
+
* a URL to the schema definition.
|
|
51
|
+
*/
|
|
52
|
+
export type DataDictionaryPrefix = Record<string, string>;
|
|
40
53
|
/**
|
|
41
54
|
* Model of a metadata dictionary containing a set of classes and their definitions.
|
|
42
55
|
*/
|
|
43
56
|
export interface DataDictionary {
|
|
57
|
+
annotations?: {
|
|
58
|
+
[key in keyof DataDictionaryPrefix]: string;
|
|
59
|
+
};
|
|
44
60
|
classes: Class[];
|
|
61
|
+
description?: string;
|
|
62
|
+
name: string;
|
|
63
|
+
prefixes?: DataDictionaryPrefix;
|
|
64
|
+
title: string;
|
|
45
65
|
}
|
|
46
66
|
/**
|
|
47
67
|
* Display model of a data dictionary column.
|
|
@@ -59,7 +79,7 @@ export interface DataDictionaryColumnDef {
|
|
|
59
79
|
* dictionary) as well as column def for displaying the data dictionary.
|
|
60
80
|
*/
|
|
61
81
|
export interface DataDictionaryConfig {
|
|
62
|
-
columnDefs: ColumnDef<Attribute
|
|
82
|
+
columnDefs: ColumnDef<Attribute>[];
|
|
63
83
|
dataDictionary: DataDictionary;
|
|
64
84
|
}
|
|
65
85
|
/**
|
|
@@ -108,15 +108,15 @@ function annotateCategoryGroupConfig(categoryGroupConfig, annotationsByKey) {
|
|
|
108
108
|
function keyAnnotationsByKey(dataDictionary) {
|
|
109
109
|
return dataDictionary.classes.reduce((acc, cls) => {
|
|
110
110
|
// Add class to map.
|
|
111
|
-
acc[cls.
|
|
111
|
+
acc[cls.name] = {
|
|
112
112
|
description: cls.description,
|
|
113
|
-
label: cls.
|
|
113
|
+
label: cls.title,
|
|
114
114
|
};
|
|
115
115
|
// Add each class attribute to the map.
|
|
116
116
|
cls.attributes.forEach((attribute) => {
|
|
117
|
-
acc[attribute.
|
|
117
|
+
acc[attribute.name] = {
|
|
118
118
|
description: attribute.description,
|
|
119
|
-
label: attribute.
|
|
119
|
+
label: attribute.title,
|
|
120
120
|
};
|
|
121
121
|
});
|
|
122
122
|
return acc;
|
|
@@ -3,5 +3,5 @@ import React from "react";
|
|
|
3
3
|
import { Entity } from "../Entity/entity";
|
|
4
4
|
import { GRID_PROPS } from "./constants";
|
|
5
5
|
export const Entities = ({ classes, columnDefs, spacing, }) => {
|
|
6
|
-
return (React.createElement(Grid, { ...GRID_PROPS }, classes.map((classData) => (React.createElement(Entity, { key: classData.
|
|
6
|
+
return (React.createElement(Grid, { ...GRID_PROPS }, classes.map((classData) => (React.createElement(Entity, { key: classData.name, class: classData, columnDefs: columnDefs, spacing: spacing })))));
|
|
7
7
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
-
import { Attribute,
|
|
2
|
+
import { Attribute, AttributeValueTypes, Class } from "../../../../common/entities";
|
|
3
3
|
import { LayoutSpacing } from "../../hooks/UseLayoutSpacing/types";
|
|
4
4
|
export interface ClassesProps {
|
|
5
5
|
classes: Class[];
|
|
6
|
-
columnDefs: ColumnDef<Attribute,
|
|
6
|
+
columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
|
|
7
7
|
spacing?: LayoutSpacing;
|
|
8
8
|
}
|
|
@@ -10,10 +10,10 @@ export const Entity = ({ class: classData, columnDefs, spacing, }) => {
|
|
|
10
10
|
const table = useTable(classData.attributes, columnDefs);
|
|
11
11
|
return (React.createElement(Grid, { ...GRID_PROPS, rowGap: 4 },
|
|
12
12
|
React.createElement(Grid, { ...GRID_PROPS, rowGap: 1 },
|
|
13
|
-
React.createElement(StyledTypography, { component: "h3", id: classData.
|
|
14
|
-
classData.
|
|
13
|
+
React.createElement(StyledTypography, { component: "h3", id: classData.name, variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_HEADING_SMALL, ...spacing },
|
|
14
|
+
classData.title,
|
|
15
15
|
" ",
|
|
16
|
-
React.createElement(AnchorLink, { anchorLink: classData.
|
|
16
|
+
React.createElement(AnchorLink, { anchorLink: classData.name })),
|
|
17
17
|
React.createElement(Typography, { color: TYPOGRAPHY_PROPS.COLOR.INK_LIGHT, component: "div", variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_BODY_400_2_LINES }, classData.description)),
|
|
18
18
|
React.createElement(Table, { table: table })));
|
|
19
19
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
-
import { Attribute,
|
|
2
|
+
import { Attribute, AttributeValueTypes, Class } from "../../../../common/entities";
|
|
3
3
|
import { LayoutSpacing } from "../../hooks/UseLayoutSpacing/types";
|
|
4
4
|
export interface EntityProps {
|
|
5
5
|
class: Class;
|
|
6
|
-
columnDefs: ColumnDef<Attribute,
|
|
6
|
+
columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
|
|
7
7
|
spacing?: LayoutSpacing;
|
|
8
8
|
}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* @returns Outline items.
|
|
5
5
|
*/
|
|
6
6
|
export function buildClassesOutline(classes) {
|
|
7
|
-
return classes.map(({
|
|
7
|
+
return classes.map(({ name, title }) => {
|
|
8
8
|
return {
|
|
9
9
|
depth: 2,
|
|
10
10
|
disabled: false,
|
|
11
|
-
hash:
|
|
12
|
-
value:
|
|
11
|
+
hash: name,
|
|
12
|
+
value: title,
|
|
13
13
|
};
|
|
14
14
|
});
|
|
15
15
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CellContext } from "@tanstack/react-table";
|
|
2
|
-
import { Attribute,
|
|
3
|
-
export type BasicCellProps = CellContext<Attribute,
|
|
2
|
+
import { Attribute, AttributeValueTypes } from "../../../../../../common/entities";
|
|
3
|
+
export type BasicCellProps = CellContext<Attribute, AttributeValueTypes>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ColumnDef, Table } from "@tanstack/react-table";
|
|
2
|
-
import { Attribute } from "../../../../common/entities";
|
|
3
|
-
export declare const useTable: (data: Attribute[], columnDefs: ColumnDef<Attribute,
|
|
2
|
+
import { Attribute, AttributeValueTypes } from "../../../../common/entities";
|
|
3
|
+
export declare const useTable: (data: Attribute[], columnDefs: ColumnDef<Attribute, AttributeValueTypes>[]) => Table<Attribute>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
-
import { Attribute,
|
|
2
|
+
import { Attribute, AttributeValueTypes, Class } from "../../../../common/entities";
|
|
3
3
|
export interface UseDataDictionary {
|
|
4
4
|
classes: Class[];
|
|
5
|
-
columnDefs: ColumnDef<Attribute,
|
|
5
|
+
columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
|
|
6
6
|
}
|
package/package.json
CHANGED
package/src/common/entities.ts
CHANGED
|
@@ -4,15 +4,24 @@ import { ColumnDef } from "@tanstack/react-table";
|
|
|
4
4
|
* Model of a value of a metadata class.
|
|
5
5
|
*/
|
|
6
6
|
export interface Attribute {
|
|
7
|
+
annotations?: {
|
|
8
|
+
[key in keyof DataDictionaryPrefix]: string; // Prefix to fragment mapping, e.g. cxg: "batch_condition".
|
|
9
|
+
};
|
|
7
10
|
description: string;
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
example?: string; // Free text example of attribute
|
|
12
|
+
multivalued: boolean; // True if attribute can have multiple values
|
|
13
|
+
name: string; // Programmatic slot name or key (e.g. batch_condition, biosamples.anatomical_site)
|
|
14
|
+
range: string; // Type of attribute value e.g. "string"
|
|
15
|
+
rationale?: string; // Free text rationale for attribute
|
|
16
|
+
required: boolean;
|
|
17
|
+
title: string; // Display name
|
|
18
|
+
values?: string; // Free text description of attribute values
|
|
10
19
|
}
|
|
11
20
|
|
|
12
21
|
/**
|
|
13
|
-
* Model of attribute
|
|
22
|
+
* Model of attribute key types; used mostly when building data dictionary column definitions.
|
|
14
23
|
*/
|
|
15
|
-
export type
|
|
24
|
+
export type AttributeValueTypes = string | boolean;
|
|
16
25
|
|
|
17
26
|
/**
|
|
18
27
|
* Filterable metadata keys.
|
|
@@ -34,9 +43,8 @@ export interface CategoryTag {
|
|
|
34
43
|
export interface Class {
|
|
35
44
|
attributes: Attribute[];
|
|
36
45
|
description: string;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
name: string;
|
|
46
|
+
name: string; // Programmatic name or key (e.g. cell, sample)
|
|
47
|
+
title: string; // Display name
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
/**
|
|
@@ -44,11 +52,24 @@ export interface Class {
|
|
|
44
52
|
*/
|
|
45
53
|
export type CategoryValueKey = unknown;
|
|
46
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Key value pair where the key is an identifier for a schema and the value is
|
|
57
|
+
* a URL to the schema definition.
|
|
58
|
+
*/
|
|
59
|
+
export type DataDictionaryPrefix = Record<string, string>;
|
|
60
|
+
|
|
47
61
|
/**
|
|
48
62
|
* Model of a metadata dictionary containing a set of classes and their definitions.
|
|
49
63
|
*/
|
|
50
64
|
export interface DataDictionary {
|
|
65
|
+
annotations?: {
|
|
66
|
+
[key in keyof DataDictionaryPrefix]: string; // Prefix to title e.g. "cxg": "CELLxGENE"
|
|
67
|
+
};
|
|
51
68
|
classes: Class[];
|
|
69
|
+
description?: string; // Free text description of data dictionary
|
|
70
|
+
name: string; // Programmatic name or key (e.g. tier1, hca)
|
|
71
|
+
prefixes?: DataDictionaryPrefix;
|
|
72
|
+
title: string; // Display name
|
|
52
73
|
}
|
|
53
74
|
|
|
54
75
|
/**
|
|
@@ -69,7 +90,7 @@ export interface DataDictionaryColumnDef {
|
|
|
69
90
|
* dictionary) as well as column def for displaying the data dictionary.
|
|
70
91
|
*/
|
|
71
92
|
export interface DataDictionaryConfig {
|
|
72
|
-
columnDefs: ColumnDef<Attribute
|
|
93
|
+
columnDefs: ColumnDef<Attribute>[];
|
|
73
94
|
dataDictionary: DataDictionary;
|
|
74
95
|
}
|
|
75
96
|
|
|
@@ -145,16 +145,16 @@ function keyAnnotationsByKey(
|
|
|
145
145
|
return dataDictionary.classes.reduce(
|
|
146
146
|
(acc: Record<string, DataDictionaryAnnotation>, cls: Class) => {
|
|
147
147
|
// Add class to map.
|
|
148
|
-
acc[cls.
|
|
148
|
+
acc[cls.name] = {
|
|
149
149
|
description: cls.description,
|
|
150
|
-
label: cls.
|
|
150
|
+
label: cls.title,
|
|
151
151
|
};
|
|
152
152
|
|
|
153
153
|
// Add each class attribute to the map.
|
|
154
154
|
cls.attributes.forEach((attribute: Attribute) => {
|
|
155
|
-
acc[attribute.
|
|
155
|
+
acc[attribute.name] = {
|
|
156
156
|
description: attribute.description,
|
|
157
|
-
label: attribute.
|
|
157
|
+
label: attribute.title,
|
|
158
158
|
};
|
|
159
159
|
});
|
|
160
160
|
return acc;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Attribute,
|
|
4
|
+
AttributeValueTypes,
|
|
5
|
+
Class,
|
|
6
|
+
} from "../../../../common/entities";
|
|
3
7
|
import { LayoutSpacing } from "../../hooks/UseLayoutSpacing/types";
|
|
4
8
|
|
|
5
9
|
export interface ClassesProps {
|
|
6
10
|
classes: Class[];
|
|
7
|
-
columnDefs: ColumnDef<Attribute,
|
|
11
|
+
columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
|
|
8
12
|
spacing?: LayoutSpacing;
|
|
9
13
|
}
|
|
@@ -19,11 +19,11 @@ export const Entity = ({
|
|
|
19
19
|
<Grid {...GRID_PROPS} rowGap={1}>
|
|
20
20
|
<StyledTypography
|
|
21
21
|
component="h3"
|
|
22
|
-
id={classData.
|
|
22
|
+
id={classData.name}
|
|
23
23
|
variant={TYPOGRAPHY_PROPS.VARIANT.TEXT_HEADING_SMALL}
|
|
24
24
|
{...spacing}
|
|
25
25
|
>
|
|
26
|
-
{classData.
|
|
26
|
+
{classData.title} <AnchorLink anchorLink={classData.name} />
|
|
27
27
|
</StyledTypography>
|
|
28
28
|
<Typography
|
|
29
29
|
color={TYPOGRAPHY_PROPS.COLOR.INK_LIGHT}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Attribute,
|
|
4
|
+
AttributeValueTypes,
|
|
5
|
+
Class,
|
|
6
|
+
} from "../../../../common/entities";
|
|
3
7
|
import { LayoutSpacing } from "../../hooks/UseLayoutSpacing/types";
|
|
4
8
|
|
|
5
9
|
export interface EntityProps {
|
|
6
10
|
class: Class;
|
|
7
|
-
columnDefs: ColumnDef<Attribute,
|
|
11
|
+
columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
|
|
8
12
|
spacing?: LayoutSpacing;
|
|
9
13
|
}
|
|
@@ -7,12 +7,12 @@ import { OutlineItem } from "../../../Layout/components/Outline/types";
|
|
|
7
7
|
* @returns Outline items.
|
|
8
8
|
*/
|
|
9
9
|
export function buildClassesOutline(classes: Class[]): OutlineItem[] {
|
|
10
|
-
return classes.map(({
|
|
10
|
+
return classes.map(({ name, title }) => {
|
|
11
11
|
return {
|
|
12
12
|
depth: 2,
|
|
13
13
|
disabled: false,
|
|
14
|
-
hash:
|
|
15
|
-
value:
|
|
14
|
+
hash: name,
|
|
15
|
+
value: title,
|
|
16
16
|
};
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { CellContext } from "@tanstack/react-table";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Attribute,
|
|
4
|
+
AttributeValueTypes,
|
|
5
|
+
} from "../../../../../../common/entities";
|
|
3
6
|
|
|
4
|
-
export type BasicCellProps = CellContext<Attribute,
|
|
7
|
+
export type BasicCellProps = CellContext<Attribute, AttributeValueTypes>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ColumnDef, Table, useReactTable } from "@tanstack/react-table";
|
|
2
|
-
import { Attribute } from "../../../../common/entities";
|
|
2
|
+
import { Attribute, AttributeValueTypes } from "../../../../common/entities";
|
|
3
3
|
import { useTableOptions } from "./options/hook";
|
|
4
4
|
|
|
5
5
|
export const useTable = (
|
|
6
6
|
data: Attribute[],
|
|
7
|
-
columnDefs: ColumnDef<Attribute,
|
|
7
|
+
columnDefs: ColumnDef<Attribute, AttributeValueTypes>[]
|
|
8
8
|
): Table<Attribute> => {
|
|
9
9
|
const tableOptions = useTableOptions();
|
|
10
10
|
return useReactTable<Attribute>({
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Attribute,
|
|
4
|
+
AttributeValueTypes,
|
|
5
|
+
Class,
|
|
6
|
+
} from "../../../../common/entities";
|
|
3
7
|
|
|
4
8
|
export interface UseDataDictionary {
|
|
5
9
|
classes: Class[];
|
|
6
|
-
columnDefs: ColumnDef<Attribute,
|
|
10
|
+
columnDefs: ColumnDef<Attribute, AttributeValueTypes>[];
|
|
7
11
|
}
|