@databiosphere/findable-ui 16.0.0 → 16.1.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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "16.0.0"
2
+ ".": "16.1.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [16.1.0](https://github.com/DataBiosphere/findable-ui/compare/v16.0.0...v16.1.0) (2024-12-12)
4
+
5
+
6
+ ### Features
7
+
8
+ * allow url objects for explore links to have a path before the entity name ([#291](https://github.com/DataBiosphere/findable-ui/issues/291)) ([#292](https://github.com/DataBiosphere/findable-ui/issues/292)) ([aa63b5a](https://github.com/DataBiosphere/findable-ui/commit/aa63b5a11c79efa91360aaa6a0395810dd9e5c05))
9
+
3
10
  ## [16.0.0](https://github.com/DataBiosphere/findable-ui/compare/v15.0.2...v16.0.0) (2024-11-25)
4
11
 
5
12
 
@@ -28,7 +28,7 @@ export const ExploreViewLink = ({ className, label, onClick, target = ANCHOR_TAR
28
28
  * @returns entity list type.
29
29
  */
30
30
  function getEntityListType(href) {
31
- return href.substring(1);
31
+ return href.substring(href.lastIndexOf("/") + 1);
32
32
  }
33
33
  /**
34
34
  * Returns the selected filters from the given query.
@@ -87,7 +87,7 @@ function isValidExploreURL(url, exploreState) {
87
87
  return validHref && validQuery;
88
88
  }
89
89
  /**
90
- * Returns true if the given href is a configured key in the explore state's entityPageState.
90
+ * Returns true if the given href is a path ending with a configured key in the explore state's entityPageState.
91
91
  * @param url - Explore link URL.
92
92
  * @param exploreState - Explore state.
93
93
  * @returns true if the given href is configured in the explore state.
@@ -95,7 +95,8 @@ function isValidExploreURL(url, exploreState) {
95
95
  function isValidHref(url, exploreState) {
96
96
  const { entityPageState } = exploreState;
97
97
  const { href } = url;
98
- return href.startsWith("/") && href.substring(1) in entityPageState;
98
+ return (href.startsWith("/") &&
99
+ href.substring(href.lastIndexOf("/") + 1) in entityPageState);
99
100
  }
100
101
  /**
101
102
  * Returns true if the given explore query is valid.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "16.0.0",
3
+ "version": "16.1.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -66,7 +66,7 @@ export const ExploreViewLink = ({
66
66
  * @returns entity list type.
67
67
  */
68
68
  function getEntityListType(href: UrlObjectWithHrefAndQuery["href"]): string {
69
- return href.substring(1);
69
+ return href.substring(href.lastIndexOf("/") + 1);
70
70
  }
71
71
 
72
72
  /**
@@ -139,7 +139,7 @@ function isValidExploreURL(
139
139
  }
140
140
 
141
141
  /**
142
- * Returns true if the given href is a configured key in the explore state's entityPageState.
142
+ * Returns true if the given href is a path ending with a configured key in the explore state's entityPageState.
143
143
  * @param url - Explore link URL.
144
144
  * @param exploreState - Explore state.
145
145
  * @returns true if the given href is configured in the explore state.
@@ -150,7 +150,10 @@ function isValidHref(
150
150
  ): boolean {
151
151
  const { entityPageState } = exploreState;
152
152
  const { href } = url;
153
- return href.startsWith("/") && href.substring(1) in entityPageState;
153
+ return (
154
+ href.startsWith("/") &&
155
+ href.substring(href.lastIndexOf("/") + 1) in entityPageState
156
+ );
154
157
  }
155
158
 
156
159
  /**