@databiosphere/findable-ui 35.0.3 → 35.2.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 (178) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +19 -0
  3. package/lib/common/entities.d.ts +1 -0
  4. package/lib/components/DataDictionary/components/Table/hook.js +1 -0
  5. package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.js +15 -2
  6. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestDownload/fileManifestDownload.js +21 -29
  7. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestSpreadsheet/fileManifestSpreadsheet.js +21 -36
  8. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.d.ts +2 -0
  9. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.js +22 -0
  10. package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.d.ts +3 -0
  11. package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.js +9 -0
  12. package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.styles.d.ts +5 -0
  13. package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.styles.js +15 -0
  14. package/lib/hooks/useFileManifest/useFileManifestDownload.d.ts +2 -2
  15. package/lib/hooks/useFileManifest/useFileManifestDownload.js +3 -10
  16. package/lib/hooks/useFileManifest/useFileManifestSpreadsheet.d.ts +5 -4
  17. package/lib/hooks/useFileManifest/useFileManifestSpreadsheet.js +24 -20
  18. package/package.json +1 -1
  19. package/src/common/entities.ts +1 -0
  20. package/src/components/DataDictionary/components/Table/hook.ts +1 -0
  21. package/src/components/DataDictionary/hooks/UseDataDictionary/hook.ts +17 -4
  22. package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestDownload/fileManifestDownload.tsx +43 -71
  23. package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestSpreadsheet/fileManifestSpreadsheet.tsx +52 -74
  24. package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.ts +24 -0
  25. package/src/components/Table/components/TableCell/components/CodeCell/codeCell.styles.ts +16 -0
  26. package/src/components/Table/components/TableCell/components/CodeCell/codeCell.tsx +21 -0
  27. package/src/hooks/useFileManifest/useFileManifestDownload.ts +9 -16
  28. package/src/hooks/useFileManifest/useFileManifestSpreadsheet.ts +41 -26
  29. package/lib/components/DataDictionary/components/Table/columns/columnDef.d.ts +0 -6
  30. package/lib/components/DataDictionary/components/Table/columns/columnDef.js +0 -33
  31. package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.d.ts +0 -5
  32. package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.js +0 -5
  33. package/lib/components/DataDictionary/components/Table/columns/types.d.ts +0 -2
  34. package/lib/components/DataDictionary/components/Table/columns/types.js +0 -1
  35. package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +0 -4
  36. package/lib/components/DataDictionary/components/Table/components/BasicCell/types.js +0 -1
  37. package/lib/components/Detail/components/Table/components/TableHead/tableHead.d.ts +0 -8
  38. package/lib/components/Detail/components/Table/components/TableHead/tableHead.js +0 -36
  39. package/lib/components/Filter/components/Filter/filter.stories.d.ts +0 -25
  40. package/lib/components/Filter/components/Filter/filter.stories.js +0 -42
  41. package/lib/components/Filter/components/FilterTag/filterTag.stories.d.ts +0 -16
  42. package/lib/components/Filter/components/FilterTag/filterTag.stories.js +0 -17
  43. package/lib/components/Filter/components/Filters/filters.stories.d.ts +0 -6
  44. package/lib/components/Filter/components/Filters/filters.stories.js +0 -91
  45. package/lib/components/Index/components/Cell/cell.d.ts +0 -7
  46. package/lib/components/Index/components/Cell/cell.js +0 -10
  47. package/lib/components/Index/components/EntitiesView/constants.d.ts +0 -1
  48. package/lib/components/Index/components/EntitiesView/constants.js +0 -1
  49. package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.d.ts +0 -13
  50. package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.js +0 -18
  51. package/lib/components/Index/components/Hero/hero.stories.d.ts +0 -23
  52. package/lib/components/Index/components/Hero/hero.stories.js +0 -22
  53. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.d.ts +0 -8
  54. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.js +0 -57
  55. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.d.ts +0 -4
  56. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.js +0 -10
  57. package/lib/components/Index/components/NTag/nTag.d.ts +0 -10
  58. package/lib/components/Index/components/NTag/nTag.js +0 -8
  59. package/lib/components/Index/components/NTagCell/nTagCell.d.ts +0 -11
  60. package/lib/components/Index/components/NTagCell/nTagCell.js +0 -29
  61. package/lib/components/Index/components/NTagCell/nTagCell.stories.d.ts +0 -5
  62. package/lib/components/Index/components/NTagCell/nTagCell.stories.js +0 -16
  63. package/lib/components/Index/components/TitleCell/titleCell.d.ts +0 -6
  64. package/lib/components/Index/components/TitleCell/titleCell.js +0 -10
  65. package/lib/components/Index/components/TitleCell/titleCell.styles.d.ts +0 -3
  66. package/lib/components/Index/components/TitleCell/titleCell.styles.js +0 -6
  67. package/lib/components/Index/index.stories.d.ts +0 -6
  68. package/lib/components/Index/index.stories.js +0 -26
  69. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.d.ts +0 -6
  70. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.js +0 -10
  71. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.d.ts +0 -5
  72. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.js +0 -29
  73. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.d.ts +0 -6
  74. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.js +0 -13
  75. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +0 -36
  76. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.js +0 -9
  77. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.d.ts +0 -5
  78. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.js +0 -10
  79. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +0 -36
  80. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.js +0 -9
  81. package/lib/components/Layout/components/Header/hooks/useMeasureHeader.d.ts +0 -5
  82. package/lib/components/Layout/components/Header/hooks/useMeasureHeader.js +0 -19
  83. package/lib/components/Layout/components/Outline/common/constants.d.ts +0 -2
  84. package/lib/components/Layout/components/Outline/common/constants.js +0 -1
  85. package/lib/components/Login/login.stories.d.ts +0 -6
  86. package/lib/components/Login/login.stories.js +0 -31
  87. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.d.ts +0 -16
  88. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.js +0 -28
  89. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.d.ts +0 -5
  90. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.js +0 -46
  91. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.d.ts +0 -3
  92. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.js +0 -21
  93. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.d.ts +0 -2
  94. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.js +0 -37
  95. package/lib/components/TableCreator/common/constants.d.ts +0 -6
  96. package/lib/components/TableCreator/common/constants.js +0 -19
  97. package/lib/components/TableCreator/common/entities.d.ts +0 -5
  98. package/lib/components/TableCreator/common/entities.js +0 -1
  99. package/lib/components/TableCreator/tableCreator.styles.d.ts +0 -4
  100. package/lib/components/TableCreator/tableCreator.styles.js +0 -4
  101. package/lib/components/common/Alert/alert.stories.d.ts +0 -6
  102. package/lib/components/common/Alert/alert.stories.js +0 -36
  103. package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +0 -4
  104. package/lib/components/common/Alert/components/AlertText/alertText.styles.js +0 -19
  105. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.d.ts +0 -7
  106. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.js +0 -5
  107. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.d.ts +0 -3
  108. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.js +0 -19
  109. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.d.ts +0 -10
  110. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.js +0 -16
  111. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.d.ts +0 -3
  112. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.js +0 -21
  113. package/lib/components/common/Button/components/LoginButton/loginButton.d.ts +0 -3
  114. package/lib/components/common/Button/components/LoginButton/loginButton.js +0 -6
  115. package/lib/components/common/Button/components/LoginButton/loginButton.styles.d.ts +0 -7
  116. package/lib/components/common/Button/components/LoginButton/loginButton.styles.js +0 -11
  117. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.d.ts +0 -5
  118. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.js +0 -10
  119. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.d.ts +0 -3
  120. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.js +0 -9
  121. package/lib/hooks/useAuthentication/common/constants.d.ts +0 -4
  122. package/lib/hooks/useAuthentication/common/constants.js +0 -19
  123. package/lib/hooks/useAuthentication/common/entities.d.ts +0 -25
  124. package/lib/hooks/useAuthentication/common/entities.js +0 -11
  125. package/lib/hooks/useAuthentication/common/utils.d.ts +0 -15
  126. package/lib/hooks/useAuthentication/common/utils.js +0 -25
  127. package/lib/hooks/useAuthentication/useAuthentication.d.ts +0 -6
  128. package/lib/hooks/useAuthentication/useAuthentication.js +0 -9
  129. package/lib/hooks/useAuthentication/useAuthenticationComplete.d.ts +0 -6
  130. package/lib/hooks/useAuthentication/useAuthenticationComplete.js +0 -55
  131. package/lib/hooks/useAuthentication/useAuthenticationForm.d.ts +0 -20
  132. package/lib/hooks/useAuthentication/useAuthenticationForm.js +0 -88
  133. package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.d.ts +0 -18
  134. package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.js +0 -50
  135. package/lib/hooks/useAuthentication/useAuthenticationStatus.d.ts +0 -20
  136. package/lib/hooks/useAuthentication/useAuthenticationStatus.js +0 -32
  137. package/lib/hooks/useAuthentication/useFetchGoogleProfile.d.ts +0 -21
  138. package/lib/hooks/useAuthentication/useFetchGoogleProfile.js +0 -41
  139. package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.d.ts +0 -18
  140. package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.js +0 -62
  141. package/lib/hooks/useAuthentication/useFetchTerraProfile.d.ts +0 -24
  142. package/lib/hooks/useAuthentication/useFetchTerraProfile.js +0 -62
  143. package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.d.ts +0 -15
  144. package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.js +0 -62
  145. package/lib/hooks/useAuthentication/useTokenClient.d.ts +0 -11
  146. package/lib/hooks/useAuthentication/useTokenClient.js +0 -29
  147. package/lib/hooks/useAuthenticationConfig.d.ts +0 -6
  148. package/lib/hooks/useAuthenticationConfig.js +0 -14
  149. package/lib/hooks/useCategoryConfigs.d.ts +0 -6
  150. package/lib/hooks/useCategoryConfigs.js +0 -17
  151. package/lib/hooks/useEntityListRelatedView.d.ts +0 -15
  152. package/lib/hooks/useEntityListRelatedView.js +0 -62
  153. package/lib/hooks/useExploreMode.d.ts +0 -14
  154. package/lib/hooks/useExploreMode.js +0 -20
  155. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.d.ts +0 -15
  156. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.js +0 -27
  157. package/lib/hooks/useFileManifest/useFileManifestURL.d.ts +0 -5
  158. package/lib/hooks/useFileManifest/useFileManifestURL.js +0 -11
  159. package/lib/hooks/useFileManifest/useRequestFileManifest.d.ts +0 -9
  160. package/lib/hooks/useFileManifest/useRequestFileManifest.js +0 -37
  161. package/lib/hooks/useLayoutState.d.ts +0 -6
  162. package/lib/hooks/useLayoutState.js +0 -9
  163. package/lib/hooks/useMenu.d.ts +0 -10
  164. package/lib/hooks/useMenu.js +0 -17
  165. package/lib/hooks/useMenuWithPosition.d.ts +0 -14
  166. package/lib/hooks/useMenuWithPosition.js +0 -33
  167. package/lib/hooks/useSessionTimeout.d.ts +0 -11
  168. package/lib/hooks/useSessionTimeout.js +0 -28
  169. package/lib/providers/authentication.d.ts +0 -51
  170. package/lib/providers/authentication.js +0 -110
  171. package/lib/providers/layoutState.d.ts +0 -40
  172. package/lib/providers/layoutState.js +0 -47
  173. package/lib/styles/common/mixins/shadows.d.ts +0 -3
  174. package/lib/styles/common/mixins/shadows.js +0 -4
  175. package/lib/styles/common/mui/palette.d.ts +0 -47
  176. package/lib/styles/common/mui/palette.js +0 -47
  177. package/lib/theme/common/entities.d.ts +0 -6
  178. package/lib/theme/common/entities.js +0 -1
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "35.0.3"
2
+ ".": "35.2.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [35.2.0](https://github.com/DataBiosphere/findable-ui/compare/v35.1.0...v35.2.0) (2025-06-16)
4
+
5
+
6
+ ### Features
7
+
8
+ * add table <code> element ([#525](https://github.com/DataBiosphere/findable-ui/issues/525)) ([#527](https://github.com/DataBiosphere/findable-ui/issues/527)) ([02cb3b6](https://github.com/DataBiosphere/findable-ui/commit/02cb3b698b25a4295fc5ea2048541869301b918f))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * make user request project metadata by clicking the request link button ([#530](https://github.com/DataBiosphere/findable-ui/issues/530)) ([#531](https://github.com/DataBiosphere/findable-ui/issues/531)) ([b645e0f](https://github.com/DataBiosphere/findable-ui/commit/b645e0fe5604dfc7fc195f91747d4a7985b39e4d))
14
+
15
+ ## [35.1.0](https://github.com/DataBiosphere/findable-ui/compare/v35.0.3...v35.1.0) (2025-06-05)
16
+
17
+
18
+ ### Features
19
+
20
+ * added handling of multiple dictionaries [#423](https://github.com/DataBiosphere/findable-ui/issues/423) ([#523](https://github.com/DataBiosphere/findable-ui/issues/523)) ([212d09a](https://github.com/DataBiosphere/findable-ui/commit/212d09a55f0699a19f5a9dd9c5f917bd46de7a14))
21
+
3
22
  ## [35.0.3](https://github.com/DataBiosphere/findable-ui/compare/v35.0.2...v35.0.3) (2025-06-04)
4
23
 
5
24
 
@@ -65,6 +65,7 @@ export interface DataDictionary<T extends RowData = Attribute> {
65
65
  export interface DataDictionaryConfig<T extends RowData = Attribute> {
66
66
  columnDefs: ColumnDef<T, T[keyof T]>[];
67
67
  dataDictionary: DataDictionary<T>;
68
+ path: string;
68
69
  tableOptions?: Omit<TableOptions<T>, "columns" | "data" | "getCoreRowModel">;
69
70
  }
70
71
  /**
@@ -15,6 +15,7 @@ export const useTable = (classes, columnDefs, tableOptions) => {
15
15
  ...tableOptions,
16
16
  columns: columnDefs,
17
17
  data,
18
+ manualPagination: true,
18
19
  meta: { classMeta },
19
20
  });
20
21
  };
@@ -1,11 +1,24 @@
1
+ import { useRouter } from "next/router";
1
2
  import { useMemo } from "react";
2
3
  import { useConfig } from "../../../../hooks/useConfig";
3
4
  import { buildClassesOutline } from "../../components/Outline/utils";
4
5
  import { useTable } from "../../components/Table/hook";
5
6
  export const useDataDictionary = () => {
6
7
  const { config: { dataDictionaries: dataDictionaryConfigs }, } = useConfig();
7
- // Get dictionary config.
8
- const dataDictionaryConfig = dataDictionaryConfigs?.[0]; // TODO: Handle multiple data dictionaries
8
+ // Dynamic paths must be resolved at this point otherwise the initial settings
9
+ // passed to useTable on subsequent renders will be ignored (as the table will have
10
+ // already been initialized).
11
+ const router = useRouter();
12
+ const query = router.query;
13
+ const { dictionary } = query;
14
+ // Get dictionary config by matching the current path with the data dictionary path
15
+ const dataDictionaryConfig = useMemo(() => {
16
+ if (!dataDictionaryConfigs?.length)
17
+ return undefined;
18
+ // Find the data dictionary with a path that matches the current route
19
+ // We check if the current path starts with the dictionary path to handle nested routes
20
+ return dataDictionaryConfigs.find((config) => config.path === dictionary);
21
+ }, [dataDictionaryConfigs, dictionary]);
9
22
  // Get configured dictionary classes, column definitions and table options.
10
23
  const { classes, columnDefs, tableOptions, title } = useMemo(() => {
11
24
  return {
@@ -1,49 +1,41 @@
1
- import { ButtonBase, TableBody, TableCell, TableRow, Tooltip, } from "@mui/material";
1
+ import { Button, TableBody, TableCell, TableRow, Tooltip } from "@mui/material";
2
2
  import copy from "copy-to-clipboard";
3
- import React, { useRef } from "react";
3
+ import React from "react";
4
4
  import { useDownloadStatus } from "../../../../../../../../hooks/useDownloadStatus";
5
5
  import { useFileManifestDownload } from "../../../../../../../../hooks/useFileManifest/useFileManifestDownload";
6
6
  import { useLoginGuard } from "../../../../../../../../providers/loginGuard/hook";
7
+ import { BUTTON_PROPS } from "../../../../../../../common/Button/constants";
7
8
  import { ButtonGroup } from "../../../../../../../common/ButtonGroup/buttonGroup";
8
- import { ButtonGroupButton } from "../../../../../../../common/ButtonGroup/components/ButtonGroupButton/buttonGroupButton";
9
9
  import { ContentCopyIconSmall, DownloadIconSmall, } from "../../../../../../../common/CustomIcon/common/constants";
10
10
  import { FluidPaper, GridPaper, } from "../../../../../../../common/Paper/paper.styles";
11
11
  import { Loading, LOADING_PANEL_STYLE, } from "../../../../../../../Loading/loading";
12
12
  import { GridTable } from "../../../../../../../Table/common/gridTable.styles";
13
+ import { TOOLTIP_PROPS } from "../../constants";
13
14
  import { SectionTitle, TableContainer, } from "../../manifestDownloadEntity.styles";
14
15
  export const FileManifestDownload = ({ filters, }) => {
15
- const downloadRef = useRef(null);
16
16
  const { disabled, message } = useDownloadStatus();
17
- const { fileName, isIdle, isLoading, manifestURL } = useFileManifestDownload(filters, disabled);
18
- const isInProgress = (isIdle || isLoading) && !disabled;
19
- const isReady = Boolean(manifestURL) || disabled;
17
+ const { fileName, isIdle, isLoading, manifestURL, requestManifest } = useFileManifestDownload(filters);
20
18
  // Prompt user for login before download and copy, if required.
21
19
  const { requireLogin } = useLoginGuard();
22
- // Copies file manifest.
23
- const copyManifestURL = (url) => {
24
- if (!url)
25
- return;
26
- copy(url);
27
- };
28
- // Downloads file manifest.
29
- const downloadManifestURL = () => {
30
- downloadRef.current?.click();
31
- };
32
20
  return (React.createElement(FluidPaper, null,
33
21
  React.createElement(GridPaper, null,
34
22
  React.createElement(SectionTitle, null, "File Manifest"),
35
23
  React.createElement(TableContainer, null,
36
- React.createElement(Loading, { loading: isInProgress, panelStyle: LOADING_PANEL_STYLE.INHERIT }),
37
- React.createElement(GridTable, { gridTemplateColumns: isReady ? "auto 1fr" : "1fr" },
24
+ React.createElement(Loading, { loading: isLoading, panelStyle: LOADING_PANEL_STYLE.INHERIT }),
25
+ React.createElement(GridTable, { gridTemplateColumns: "auto 1fr" },
38
26
  React.createElement(TableBody, null,
39
- React.createElement(TableRow, null, isInProgress ? (React.createElement(TableCell, null)) : isReady ? (React.createElement(React.Fragment, null,
40
- React.createElement(TableCell, null,
41
- React.createElement(ButtonBase, { disabled: disabled, href: manifestURL ?? "", ref: downloadRef, sx: { display: "none" } }),
42
- React.createElement(Tooltip, { arrow: true, title: message },
43
- React.createElement("span", null,
44
- React.createElement(ButtonGroup, { Buttons: [
45
- React.createElement(ButtonGroupButton, { key: "download", action: "Download file manifest", disabled: disabled, label: React.createElement(DownloadIconSmall, null), onClick: () => requireLogin(downloadManifestURL) }),
46
- React.createElement(ButtonGroupButton, { key: "copy", action: "Copy file manifest", disabled: disabled, label: React.createElement(ContentCopyIconSmall, null), onClick: () => requireLogin(() => copyManifestURL(manifestURL)) }),
47
- ] })))),
48
- React.createElement(TableCell, null, fileName))) : (React.createElement(TableCell, null, "The manifest is not available for this project.")))))))));
27
+ React.createElement(TableRow, null, isIdle || isLoading ? (React.createElement(TableCell, null,
28
+ React.createElement(Tooltip, { ...TOOLTIP_PROPS, title: message },
29
+ React.createElement("span", null,
30
+ React.createElement(Button, { ...BUTTON_PROPS.PRIMARY_CONTAINED, disabled: disabled || isLoading, onClick: () => requireLogin(requestManifest) }, "Request link"))))) : (React.createElement(React.Fragment, null,
31
+ manifestURL && (React.createElement(TableCell, null,
32
+ React.createElement(ButtonGroup, { Buttons: [
33
+ React.createElement(Button, { key: "download", download: true, href: manifestURL },
34
+ React.createElement(DownloadIconSmall, null)),
35
+ React.createElement(Button, { key: "copy", onClick: () => copy(manifestURL) },
36
+ React.createElement(ContentCopyIconSmall, null)),
37
+ ] }))),
38
+ React.createElement(TableCell, null, manifestURL
39
+ ? fileName
40
+ : "The manifest is not available for this project."))))))))));
49
41
  };
@@ -1,53 +1,38 @@
1
- import { ButtonBase, TableBody, TableCell, TableRow, Tooltip, } from "@mui/material";
1
+ import { Button, TableBody, TableCell, TableRow, Tooltip } from "@mui/material";
2
2
  import copy from "copy-to-clipboard";
3
- import React, { useEffect, useRef } from "react";
3
+ import React from "react";
4
4
  import { useDownloadStatus } from "../../../../../../../../hooks/useDownloadStatus";
5
5
  import { useFileManifestSpreadsheet } from "../../../../../../../../hooks/useFileManifest/useFileManifestSpreadsheet";
6
- import { useRequestFileLocation } from "../../../../../../../../hooks/useRequestFileLocation";
6
+ import { BUTTON_PROPS } from "../../../../../../../common/Button/constants";
7
7
  import { ButtonGroup } from "../../../../../../../common/ButtonGroup/buttonGroup";
8
- import { ButtonGroupButton } from "../../../../../../../common/ButtonGroup/components/ButtonGroupButton/buttonGroupButton";
9
8
  import { ContentCopyIconSmall, DownloadIconSmall, } from "../../../../../../../common/CustomIcon/common/constants";
10
9
  import { FluidPaper, GridPaper, } from "../../../../../../../common/Paper/paper.styles";
11
10
  import { Loading, LOADING_PANEL_STYLE, } from "../../../../../../../Loading/loading";
12
11
  import { GridTable } from "../../../../../../../Table/common/gridTable.styles";
12
+ import { TOOLTIP_PROPS } from "../../constants";
13
13
  import { SectionTitle, TableContainer, } from "../../manifestDownloadEntity.styles";
14
14
  export const FileManifestSpreadsheet = ({ filters, }) => {
15
- const downloadRef = useRef(null);
16
15
  const { disabled, message } = useDownloadStatus();
17
- const { exists, fileName, fileUrl } = useFileManifestSpreadsheet(filters, disabled) || {};
18
- const { data, isLoading, run } = useRequestFileLocation(fileUrl);
19
- const spreadsheetURL = data?.location;
20
- const isInProgress = (exists === undefined || isLoading) && !disabled;
21
- const isReady = Boolean(spreadsheetURL) || disabled;
22
- // Copies metadata spreadsheet.
23
- const copyMetadataURL = (url) => {
24
- if (!url)
25
- return;
26
- copy(url);
27
- };
28
- // Downloads metadata spreadsheet.
29
- const downloadMetadataURL = () => {
30
- downloadRef.current?.click();
31
- };
32
- // Requests metadata spreadsheet.
33
- useEffect(() => {
34
- run();
35
- }, [fileUrl, run]);
16
+ const { fileName, isIdle = false, isLoading = false, requestManifest, spreadsheetUrl, } = useFileManifestSpreadsheet(filters) || {};
36
17
  return (React.createElement(FluidPaper, null,
37
18
  React.createElement(GridPaper, null,
38
19
  React.createElement(SectionTitle, null, "Metadata"),
39
20
  React.createElement(TableContainer, null,
40
- React.createElement(Loading, { loading: isInProgress, panelStyle: LOADING_PANEL_STYLE.INHERIT }),
41
- React.createElement(GridTable, { gridTemplateColumns: isReady ? "auto 1fr" : "1fr" },
21
+ React.createElement(Loading, { loading: isLoading, panelStyle: LOADING_PANEL_STYLE.INHERIT }),
22
+ React.createElement(GridTable, { gridTemplateColumns: "auto 1fr" },
42
23
  React.createElement(TableBody, null,
43
- React.createElement(TableRow, null, isInProgress ? (React.createElement(TableCell, null)) : isReady ? (React.createElement(React.Fragment, null,
44
- React.createElement(TableCell, null,
45
- React.createElement(ButtonBase, { disabled: disabled, download: true, href: spreadsheetURL ?? "", ref: downloadRef, sx: { display: "none" } }),
46
- React.createElement(Tooltip, { arrow: true, title: message },
47
- React.createElement("span", null,
48
- React.createElement(ButtonGroup, { Buttons: [
49
- React.createElement(ButtonGroupButton, { key: "download", action: "Download metadata spreadsheet", disabled: disabled, label: React.createElement(DownloadIconSmall, null), onClick: downloadMetadataURL }),
50
- React.createElement(ButtonGroupButton, { key: "copy", action: "Copy metadata spreadsheet", disabled: disabled, label: React.createElement(ContentCopyIconSmall, null), onClick: () => copyMetadataURL(spreadsheetURL) }),
51
- ] })))),
52
- React.createElement(TableCell, null, fileName))) : (React.createElement(TableCell, null, "The metadata is not available for this project.")))))))));
24
+ React.createElement(TableRow, null, isIdle || isLoading ? (React.createElement(TableCell, null,
25
+ React.createElement(Tooltip, { ...TOOLTIP_PROPS, title: message },
26
+ React.createElement("span", null,
27
+ React.createElement(Button, { ...BUTTON_PROPS.PRIMARY_CONTAINED, disabled: disabled || isLoading, onClick: () => requestManifest?.() }, "Request link"))))) : (React.createElement(React.Fragment, null,
28
+ spreadsheetUrl && (React.createElement(TableCell, null,
29
+ React.createElement(ButtonGroup, { Buttons: [
30
+ React.createElement(Button, { key: "download", download: true, href: spreadsheetUrl },
31
+ React.createElement(DownloadIconSmall, null)),
32
+ React.createElement(Button, { key: "copy", onClick: () => copy(spreadsheetUrl) },
33
+ React.createElement(ContentCopyIconSmall, null)),
34
+ ] }))),
35
+ React.createElement(TableCell, null, spreadsheetUrl
36
+ ? fileName
37
+ : "The metadata is not available for this project."))))))))));
53
38
  };
@@ -0,0 +1,2 @@
1
+ import { TooltipProps } from "@mui/material";
2
+ export declare const TOOLTIP_PROPS: Partial<TooltipProps>;
@@ -0,0 +1,22 @@
1
+ export const TOOLTIP_PROPS = {
2
+ arrow: true,
3
+ slotProps: {
4
+ popper: {
5
+ modifiers: [
6
+ {
7
+ name: "offset",
8
+ options: {
9
+ offset: [0, -4],
10
+ },
11
+ },
12
+ {
13
+ name: "preventOverflow",
14
+ options: { padding: 8 },
15
+ },
16
+ ],
17
+ },
18
+ tooltip: {
19
+ sx: { maxWidth: "none" },
20
+ },
21
+ },
22
+ };
@@ -0,0 +1,3 @@
1
+ import { CellContext, RowData } from "@tanstack/react-table";
2
+ import { BaseComponentProps } from "../../../../../types";
3
+ export declare const CodeCell: <T extends RowData, TValue extends string = string>({ className, getValue, }: BaseComponentProps & CellContext<T, TValue>) => JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { CHIP_PROPS } from "../../../../../../styles/common/mui/chip";
3
+ import { StyledChip } from "./codeCell.styles";
4
+ export const CodeCell = ({ className, getValue, }) => {
5
+ const value = getValue();
6
+ if (!value)
7
+ return null;
8
+ return (React.createElement(StyledChip, { className: className, color: CHIP_PROPS.COLOR.DEFAULT, label: value, size: CHIP_PROPS.SIZE.SMALL }));
9
+ };
@@ -0,0 +1,5 @@
1
+ export declare const StyledChip: import("@emotion/styled").StyledComponent<import("@mui/material").ChipOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
2
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
3
+ }, "label" | "style" | "className" | "classes" | "tabIndex" | "color" | "children" | "sx" | "variant" | "disabled" | "size" | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "skipFocusWhenDisabled"> & {
4
+ theme?: import("@emotion/react").Theme;
5
+ }, {}, {}>;
@@ -0,0 +1,15 @@
1
+ import styled from "@emotion/styled";
2
+ import { Chip } from "@mui/material";
3
+ import { PALETTE } from "../../../../../../styles/common/constants/palette";
4
+ export const StyledChip = styled(Chip) `
5
+ border-radius: 4px;
6
+ box-shadow: 0 0 0 2px ${PALETTE.COMMON_WHITE};
7
+ height: auto;
8
+ justify-self: flex-start;
9
+ min-width: 0;
10
+
11
+ .MuiChip-label {
12
+ padding: 2px 8px;
13
+ white-space: normal;
14
+ }
15
+ `;
@@ -4,11 +4,11 @@ export interface ManifestDownload {
4
4
  isIdle: boolean;
5
5
  isLoading: boolean;
6
6
  manifestURL?: string;
7
+ requestManifest: () => void;
7
8
  }
8
9
  /**
9
10
  * Returns file manifest download url and file name.
10
11
  * @param filters - Filters.
11
- * @param disabled - Disabled.
12
12
  * @returns file manifest download url and file name.
13
13
  */
14
- export declare const useFileManifestDownload: (filters: Filters, disabled: boolean) => ManifestDownload;
14
+ export declare const useFileManifestDownload: (filters: Filters) => ManifestDownload;
@@ -1,4 +1,3 @@
1
- import { useEffect } from "react";
2
1
  import { MANIFEST_DOWNLOAD_FORMAT } from "../../apis/azul/common/entities";
3
2
  import { BULK_DOWNLOAD_EXECUTION_ENVIRONMENT } from "../../components/Export/common/entities";
4
3
  import { useCatalog } from "../useCatalog";
@@ -8,10 +7,9 @@ import { buildRequestManifest } from "../useRequestManifest/utils";
8
7
  /**
9
8
  * Returns file manifest download url and file name.
10
9
  * @param filters - Filters.
11
- * @param disabled - Disabled.
12
10
  * @returns file manifest download url and file name.
13
11
  */
14
- export const useFileManifestDownload = (filters, disabled) => {
12
+ export const useFileManifestDownload = (filters) => {
15
13
  // Retrieve the endpoint URL from configured data source.
16
14
  const config = useConfig();
17
15
  const endpointUrl = config.config.dataSource.url;
@@ -19,20 +17,15 @@ export const useFileManifestDownload = (filters, disabled) => {
19
17
  const catalog = useCatalog(); // catalog should be defined.
20
18
  // Build request manifest request URL.
21
19
  const { requestMethod, requestUrl } = buildRequestManifest(endpointUrl, catalog, filters, MANIFEST_DOWNLOAD_FORMAT.COMPACT);
22
- const { data, isIdle, isLoading, run } = useRequestFileLocation(requestUrl, requestMethod);
20
+ const { data, isIdle, isLoading, run: requestManifest, } = useRequestFileLocation(requestUrl, requestMethod);
23
21
  const manifestURL = getManifestDownloadURL(data);
24
22
  const fileName = getManifestDownloadFileName(data);
25
- // Requests file manifest.
26
- useEffect(() => {
27
- if (disabled)
28
- return;
29
- run();
30
- }, [disabled, requestUrl, run]);
31
23
  return {
32
24
  fileName,
33
25
  isIdle,
34
26
  isLoading,
35
27
  manifestURL,
28
+ requestManifest,
36
29
  };
37
30
  };
38
31
  /**
@@ -1,14 +1,15 @@
1
1
  import { Filters } from "../../common/entities";
2
2
  export interface ManifestSpreadsheet {
3
- exists?: boolean;
4
- fileFormat?: string;
5
3
  fileName?: string;
6
4
  fileUrl?: string;
5
+ isIdle?: boolean;
6
+ isLoading?: boolean;
7
+ requestManifest?: () => void;
8
+ spreadsheetUrl?: string;
7
9
  }
8
10
  /**
9
11
  * Returns file manifest spreadsheet.
10
12
  * @param filters - Filters.
11
- * @param disabled - Disabled.
12
13
  * @returns file manifest spreadsheet.
13
14
  */
14
- export declare const useFileManifestSpreadsheet: (filters: Filters, disabled: boolean) => ManifestSpreadsheet | undefined;
15
+ export declare const useFileManifestSpreadsheet: (filters: Filters) => Omit<ManifestSpreadsheet, "fileUrl">;
@@ -1,17 +1,17 @@
1
- import { useEffect, useMemo } from "react";
1
+ import { useCallback, useEffect, useMemo } from "react";
2
2
  import { APIEndpoints, } from "../../apis/azul/common/entities";
3
3
  import { fetchEntitiesFromURL } from "../../entity/common/service";
4
4
  import { fetchQueryParams } from "../../utils/fetchQueryParams";
5
5
  import { useAsync } from "../useAsync";
6
6
  import { useCatalog } from "../useCatalog";
7
7
  import { useFetchRequestURL } from "../useFetchRequestURL";
8
+ import { useRequestFileLocation } from "../useRequestFileLocation";
8
9
  /**
9
10
  * Returns file manifest spreadsheet.
10
11
  * @param filters - Filters.
11
- * @param disabled - Disabled.
12
12
  * @returns file manifest spreadsheet.
13
13
  */
14
- export const useFileManifestSpreadsheet = (filters, disabled) => {
14
+ export const useFileManifestSpreadsheet = (filters) => {
15
15
  // Determine catalog.
16
16
  const catalog = useCatalog(); // catalog should be defined.
17
17
  // Build request params.
@@ -19,16 +19,26 @@ export const useFileManifestSpreadsheet = (filters, disabled) => {
19
19
  // Build request URL.
20
20
  const requestURL = useFetchRequestURL(APIEndpoints.FILES, requestParams);
21
21
  // Fetch files to determine if file exists.
22
- const { data, run } = useAsync();
22
+ const { data: files, isIdle, isLoading: isFilesLoading, run: requestFiles, } = useAsync();
23
23
  // Grab manifest spreadsheet.
24
- const manifestSpreadsheet = useMemo(() => getManifestSpreadsheet(data?.hits), [data]);
24
+ const { fileName, fileUrl } = useMemo(() => getManifestSpreadsheet(files?.hits), [files]);
25
+ // Fetch file manifest.
26
+ const { data, isLoading, run } = useRequestFileLocation(fileUrl);
25
27
  // Fetch response from files endpoint.
28
+ const requestManifest = useCallback(() => {
29
+ requestFiles(fetchEntitiesFromURL(requestURL, undefined));
30
+ }, [requestFiles, requestURL]);
31
+ // Fetch file manifest.
26
32
  useEffect(() => {
27
- if (disabled)
28
- return;
29
- run(fetchEntitiesFromURL(requestURL, undefined));
30
- }, [disabled, requestURL, run]);
31
- return manifestSpreadsheet;
33
+ run();
34
+ }, [fileUrl, run]);
35
+ return {
36
+ fileName,
37
+ isIdle,
38
+ isLoading: isFilesLoading || isLoading,
39
+ requestManifest,
40
+ spreadsheetUrl: data?.location,
41
+ };
32
42
  };
33
43
  /**
34
44
  * Prepend "/fetch" to the path of the specified file URL, if not already included.
@@ -52,20 +62,14 @@ function buildFetchFileUrl(fileUrl) {
52
62
  * @returns manifest spreadsheet.
53
63
  */
54
64
  function getManifestSpreadsheet(files) {
55
- if (!files) {
56
- return;
57
- }
65
+ if (!files)
66
+ return { fileName: undefined, fileUrl: undefined };
58
67
  // Handle case where file does not exist.
59
- if (files.length === 0) {
60
- return {
61
- exists: false,
62
- };
63
- }
68
+ if (files.length === 0)
69
+ return { fileName: undefined, fileUrl: undefined };
64
70
  // Project manifest spreadsheet exists.
65
71
  const file = files[0];
66
72
  return {
67
- exists: true,
68
- fileFormat: file.files[0]?.format,
69
73
  fileName: file.files[0]?.name,
70
74
  fileUrl: buildFetchFileUrl(file.files[0]?.url),
71
75
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "35.0.3",
3
+ "version": "35.2.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -74,6 +74,7 @@ export interface DataDictionary<T extends RowData = Attribute> {
74
74
  export interface DataDictionaryConfig<T extends RowData = Attribute> {
75
75
  columnDefs: ColumnDef<T, T[keyof T]>[];
76
76
  dataDictionary: DataDictionary<T>;
77
+ path: string; // Used as a key to find the dictionary to display
77
78
  tableOptions?: Omit<TableOptions<T>, "columns" | "data" | "getCoreRowModel">;
78
79
  }
79
80
 
@@ -30,6 +30,7 @@ export const useTable = <T extends RowData = Attribute>(
30
30
  ...tableOptions,
31
31
  columns: columnDefs,
32
32
  data,
33
+ manualPagination: true,
33
34
  meta: { classMeta },
34
35
  });
35
36
  };
@@ -1,4 +1,5 @@
1
1
  import { RowData } from "@tanstack/react-table";
2
+ import { useRouter } from "next/router";
2
3
  import { useMemo } from "react";
3
4
  import { Attribute, DataDictionaryConfig } from "../../../../common/entities";
4
5
  import { useConfig } from "../../../../hooks/useConfig";
@@ -12,11 +13,23 @@ export const useDataDictionary = <
12
13
  const {
13
14
  config: { dataDictionaries: dataDictionaryConfigs },
14
15
  } = useConfig();
16
+ // Dynamic paths must be resolved at this point otherwise the initial settings
17
+ // passed to useTable on subsequent renders will be ignored (as the table will have
18
+ // already been initialized).
19
+ const router = useRouter();
20
+ const query = router.query;
21
+ const { dictionary } = query;
15
22
 
16
- // Get dictionary config.
17
- const dataDictionaryConfig = dataDictionaryConfigs?.[0] as
18
- | DataDictionaryConfig<T>
19
- | undefined; // TODO: Handle multiple data dictionaries
23
+ // Get dictionary config by matching the current path with the data dictionary path
24
+ const dataDictionaryConfig = useMemo(() => {
25
+ if (!dataDictionaryConfigs?.length) return undefined;
26
+
27
+ // Find the data dictionary with a path that matches the current route
28
+ // We check if the current path starts with the dictionary path to handle nested routes
29
+ return dataDictionaryConfigs.find(
30
+ (config) => config.path === dictionary
31
+ ) as DataDictionaryConfig<T> | undefined;
32
+ }, [dataDictionaryConfigs, dictionary]);
20
33
 
21
34
  // Get configured dictionary classes, column definitions and table options.
22
35
  const { classes, columnDefs, tableOptions, title } = useMemo(() => {