@databiosphere/findable-ui 21.1.1 → 21.3.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 (46) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/lib/common/entities.d.ts +33 -0
  4. package/lib/components/DataDictionary/common/utils.d.ts +38 -0
  5. package/lib/components/DataDictionary/common/utils.js +122 -0
  6. package/lib/components/DataDictionary/components/Tooltip/components/Title/constants.d.ts +3 -0
  7. package/lib/components/DataDictionary/components/Tooltip/components/Title/constants.js +8 -0
  8. package/lib/components/DataDictionary/components/Tooltip/components/Title/title.d.ts +3 -0
  9. package/lib/components/DataDictionary/components/Tooltip/components/Title/title.js +9 -0
  10. package/lib/components/DataDictionary/components/Tooltip/components/Title/types.d.ts +5 -0
  11. package/lib/components/DataDictionary/components/Tooltip/components/Title/types.js +1 -0
  12. package/lib/components/DataDictionary/components/Tooltip/constants.d.ts +2 -0
  13. package/lib/components/DataDictionary/components/Tooltip/constants.js +24 -0
  14. package/lib/components/DataDictionary/components/Tooltip/tooltip.d.ts +4 -0
  15. package/lib/components/DataDictionary/components/Tooltip/tooltip.js +8 -0
  16. package/lib/components/DataDictionary/components/Tooltip/types.d.ts +5 -0
  17. package/lib/components/DataDictionary/components/Tooltip/types.js +1 -0
  18. package/lib/components/Filter/components/Filter/filter.js +1 -1
  19. package/lib/components/Filter/components/FilterLabel/filterLabel.d.ts +3 -1
  20. package/lib/components/Filter/components/FilterLabel/filterLabel.js +4 -2
  21. package/lib/components/Index/components/Tabs/common/utils.js +2 -1
  22. package/lib/components/Table/components/TableHead/tableHead.js +4 -1
  23. package/lib/components/common/Tabs/tabs.d.ts +2 -0
  24. package/lib/components/common/Tabs/tabs.js +14 -1
  25. package/lib/config/entities.d.ts +5 -1
  26. package/lib/hooks/useCategoryFilter.js +1 -0
  27. package/lib/providers/config.js +9 -2
  28. package/package.json +1 -1
  29. package/src/common/entities.ts +37 -0
  30. package/src/components/DataDictionary/common/utils.ts +160 -0
  31. package/src/components/DataDictionary/components/Tooltip/components/Title/constants.ts +11 -0
  32. package/src/components/DataDictionary/components/Tooltip/components/Title/title.tsx +19 -0
  33. package/src/components/DataDictionary/components/Tooltip/components/Title/types.ts +6 -0
  34. package/src/components/DataDictionary/components/Tooltip/constants.ts +26 -0
  35. package/src/components/DataDictionary/components/Tooltip/tooltip.tsx +26 -0
  36. package/src/components/DataDictionary/components/Tooltip/types.ts +10 -0
  37. package/src/components/Filter/components/Filter/filter.tsx +1 -0
  38. package/src/components/Filter/components/FilterLabel/filterLabel.tsx +16 -10
  39. package/src/components/Index/components/Tabs/common/utils.ts +2 -0
  40. package/src/components/Table/components/TableHead/tableHead.tsx +26 -15
  41. package/src/components/common/Tabs/tabs.tsx +33 -3
  42. package/src/config/entities.ts +10 -1
  43. package/src/hooks/useCategoryFilter.ts +1 -0
  44. package/src/providers/config.tsx +10 -2
  45. package/tests/dataDictionary_utils.test.ts +153 -0
  46. package/types/data-explorer-ui.d.ts +2 -0
@@ -0,0 +1,153 @@
1
+ import {
2
+ annotateColumnConfig,
3
+ annotateDefaultCategoryConfig,
4
+ annotateEntityCategoryConfig,
5
+ annotateEntityConfig,
6
+ } from "../src/components/DataDictionary/common/utils";
7
+ import { SiteConfig } from "../src/config/entities";
8
+
9
+ describe("Data Dictionary", () => {
10
+ it("annotates entity", () => {
11
+ const key = "entity";
12
+
13
+ // Create annotation for column and add to dummy annotation map.
14
+ const annotation = {
15
+ description: "description for entity",
16
+ label: "entity",
17
+ };
18
+ const annotationsByKey = {
19
+ [key]: annotation,
20
+ };
21
+
22
+ // Create dummy site config.
23
+ const siteConfig = {
24
+ entities: [
25
+ {
26
+ key,
27
+ list: {
28
+ columns: [{ id: "col150" }, { id: "col1" }],
29
+ },
30
+ },
31
+ ],
32
+ } as unknown as SiteConfig;
33
+
34
+ // Annotate
35
+ annotateEntityConfig(siteConfig, annotationsByKey);
36
+
37
+ // Confirm entity is annotated.
38
+ const entity = siteConfig.entities[0];
39
+ expect(entity.annotation).toEqual(annotation);
40
+ });
41
+
42
+ it("annotates entity category config", () => {
43
+ const key = "filter0";
44
+
45
+ // Create annotation for column and add to dummy annotation map.
46
+ const annotation = {
47
+ description: "description for filter 0",
48
+ label: "filter 0",
49
+ };
50
+ const annotationsByKey = {
51
+ [key]: annotation,
52
+ };
53
+
54
+ // Create dummy site config.
55
+ const siteConfig = {
56
+ entities: [
57
+ {
58
+ categoryGroupConfig: {
59
+ categoryGroups: [
60
+ {
61
+ categoryConfigs: [
62
+ {
63
+ key,
64
+ label: "filter 0",
65
+ },
66
+ ],
67
+ },
68
+ ],
69
+ },
70
+ },
71
+ ],
72
+ } as unknown as SiteConfig;
73
+
74
+ // Annotate
75
+ annotateEntityCategoryConfig(siteConfig, annotationsByKey);
76
+
77
+ // Confirm filter is annotated.
78
+ const categoryConfig =
79
+ siteConfig.entities[0].categoryGroupConfig?.categoryGroups[0]
80
+ .categoryConfigs[0];
81
+ expect(categoryConfig?.annotation).toEqual(annotation);
82
+ });
83
+
84
+ it("annotates default category config", () => {
85
+ const key = "filter0";
86
+
87
+ // Create annotation for column and add to dummy annotation map.
88
+ const annotation = {
89
+ description: "description for filter 0",
90
+ label: "filter 0",
91
+ };
92
+ const annotationsByKey = {
93
+ [key]: annotation,
94
+ };
95
+
96
+ // Create dummy site config.
97
+ const siteConfig = {
98
+ categoryGroupConfig: {
99
+ categoryGroups: [
100
+ {
101
+ categoryConfigs: [
102
+ {
103
+ key,
104
+ label: "filter 0",
105
+ },
106
+ ],
107
+ },
108
+ ],
109
+ },
110
+ } as unknown as SiteConfig;
111
+
112
+ // Annotate
113
+ annotateDefaultCategoryConfig(siteConfig, annotationsByKey);
114
+
115
+ // Confirm filter is annotated.
116
+ const categoryConfig =
117
+ siteConfig.categoryGroupConfig?.categoryGroups[0].categoryConfigs[0];
118
+ expect(categoryConfig?.annotation).toEqual(annotation);
119
+ });
120
+
121
+ it("annotates column", () => {
122
+ const key = "col0";
123
+
124
+ // Create annotation for column and add to dummy annotation map.
125
+ const annotation = {
126
+ description: "description for column 0",
127
+ label: "column 0",
128
+ };
129
+ const annotationsByKey = {
130
+ [key]: annotation,
131
+ };
132
+
133
+ // Create dummy site config.
134
+ const siteConfig = {
135
+ entities: [
136
+ {
137
+ list: {
138
+ columns: [{ id: key }, { id: "col1" }],
139
+ },
140
+ name: "entity",
141
+ },
142
+ ],
143
+ } as unknown as SiteConfig;
144
+
145
+ // Annotate
146
+ annotateColumnConfig(siteConfig, annotationsByKey);
147
+
148
+ // Confirm column 0 is annotated and column 1 is not.
149
+ const columns = siteConfig.entities[0].list.columns ?? [];
150
+ expect((columns[0]?.meta as any)?.annotation).toEqual(annotation);
151
+ expect((columns[1]?.meta as any)?.annotation).toBeUndefined();
152
+ });
153
+ });
@@ -18,6 +18,7 @@ import type {} from "@mui/material/Typography";
18
18
  import type {} from "@tanstack/react-table";
19
19
  import { RowData } from "@tanstack/react-table";
20
20
  import { DataLayer } from "../src/common/analytics/entities";
21
+ import { DataDictionaryAnnotation } from "../src/common/entities";
21
22
  import {
22
23
  CustomFeatureInitialTableState,
23
24
  CustomFeatureInstance,
@@ -268,6 +269,7 @@ declare module "@tanstack/react-table" {
268
269
  // eslint-disable-next-line @typescript-eslint/no-unused-vars -- TData and TValue are unused variables.
269
270
  interface ColumnMeta<TData extends RowData, TValue> {
270
271
  align?: TableCellProps["align"];
272
+ annotation?: DataDictionaryAnnotation;
271
273
  columnPinned?: boolean;
272
274
  header?: string;
273
275
  width?: GridTrackSize;