@ts4nfdi/terminology-service-suite 5.0.4 → 5.0.6

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/dist/esm/index.js CHANGED
@@ -1880,11 +1880,10 @@ class OlsApi {
1880
1880
  * 2) If a termIri is defined but no child in jsTreeParams, the hierarchy containing that term will be queried
1881
1881
  * 3) If a termIri is defined and also a child in jsTreeParams, the subhierarchy of that child will be queried
1882
1882
  */
1883
- getTermTree = async (contentParams, treeParams, paginationParams, sortingParams) => {
1883
+ getTermTree = async (contentParams, treeParams) => {
1884
1884
  let baseRequest = "ontologies/" + contentParams?.ontologyId + "/terms";
1885
1885
  if (!contentParams.termIri)
1886
1886
  return (await this.axiosInstance.get(baseRequest + "/roots")).data; //1)
1887
- // @ts-ignore
1888
1887
  baseRequest =
1889
1888
  baseRequest +
1890
1889
  "/" +
@@ -1897,11 +1896,10 @@ class OlsApi {
1897
1896
  return (await this.axiosInstance.get(baseRequest, { params: treeParams }))
1898
1897
  .data; //2)
1899
1898
  };
1900
- getTermRelations = async (contentParams, paginationParams, sortingParams) => {
1899
+ getTermRelations = async (contentParams) => {
1901
1900
  let baseRequest = "ontologies/" + contentParams?.ontologyId + "/terms";
1902
1901
  if (!contentParams.termIri)
1903
1902
  return (await this.axiosInstance.get(baseRequest + "/roots")).data; //1)
1904
- // @ts-ignore
1905
1903
  baseRequest =
1906
1904
  baseRequest +
1907
1905
  "/" +
@@ -2057,7 +2055,7 @@ class OlsApi {
2057
2055
  }, useLegacy);
2058
2056
  }
2059
2057
  if (useLegacy) {
2060
- let listOfAncestorObj = [];
2058
+ const listOfAncestorObj = [];
2061
2059
  let extractKey = "";
2062
2060
  switch (entityType) {
2063
2061
  case "class":
@@ -2510,7 +2508,7 @@ function AutocompleteWidget(props) {
2510
2508
  // if we have a custom term, just show the label
2511
2509
  return label;
2512
2510
  }
2513
- let prefix = value.type === "ontology"
2511
+ const prefix = value.type === "ontology"
2514
2512
  ? "Prefix: " + value.ontology_name
2515
2513
  : "Prefix > Short form: " +
2516
2514
  value.ontology_name +
@@ -4007,10 +4005,9 @@ class SkosApi {
4007
4005
  entitiesData.set(childNodeData.iri, childNodeData);
4008
4006
  }
4009
4007
  else {
4010
- // @ts-ignore
4011
- if (!childNodeData.parents.map((r) => r.value).includes(node.uri))
4012
- if (childNodeData.parents) {
4013
- childNodeData.parents.push(...Reified.fromJson(node.uri));
4008
+ if (!childNodeData?.parents?.map((r) => r.value).includes(node.uri))
4009
+ if (childNodeData?.parents) {
4010
+ childNodeData?.parents?.push(...Reified.fromJson(node.uri));
4014
4011
  }
4015
4012
  }
4016
4013
  children.push(childNodeData);
@@ -4302,6 +4299,8 @@ function HierarchyWidget(props) {
4302
4299
  showSiblingsOnInit: showSiblingsOnInit,
4303
4300
  useLegacy: useLegacy,
4304
4301
  });
4302
+ }, {
4303
+ refetchOnWindowFocus: false,
4305
4304
  });
4306
4305
  const toggleNode = useCallback((node) => {
4307
4306
  if (!(hierarchy instanceof Hierarchy))
@@ -4403,7 +4402,7 @@ function GraphViewWidget(props) {
4403
4402
  ], async () => {
4404
4403
  if (rootWalkIsSelected && firstLoad) {
4405
4404
  // only use this call on load. Double ckicking on a node should call the normal getTermRelations function.
4406
- return olsApi.getTermTree({ ontologyId: ontologyId, termIri: iri }, { viewMode: "All", siblings: false }, undefined, undefined);
4405
+ return olsApi.getTermTree({ ontologyId: ontologyId, termIri: iri }, { viewMode: "All", siblings: false });
4407
4406
  }
4408
4407
  else if (firstLoad || dbclicked) {
4409
4408
  return olsApi.getTermRelations({
@@ -4573,8 +4572,9 @@ function GraphViewWidget(props) {
4573
4572
  }
4574
4573
  useEffect(() => {
4575
4574
  let graphData = { nodes: nodes.current, edges: edges.current };
4575
+ graphNetwork.current = new Network(
4576
4576
  //@ts-ignore
4577
- graphNetwork.current = new Network(container.current, graphData, graphNetworkConfig);
4577
+ container.current, graphData, graphNetworkConfig);
4578
4578
  }, []);
4579
4579
  useEffect(() => {
4580
4580
  if (graphNetwork.current) {
@@ -4855,7 +4855,7 @@ function TitleWidget(props) {
4855
4855
  const { data, isLoading, isSuccess, isError, error } = useQuery(["titleData", api, parameter, thingType, iri, ontologyId, useLegacy], async () => {
4856
4856
  return olsApi.getThingObject(iri, thingType, ontologyId, parameter, useLegacy);
4857
4857
  });
4858
- return (React.createElement(TitlePresentation, { title: data ? (isOntology(data) ? data.getName() : data.getLabel()) : null, titleText: titleText, defaultValue: defaultValue, className: className, isLoading: isLoading, error: isError ? error : null, iri: iri ? iri : data ? data.getIri() : null, onNavigateTo: onNavigateTo, ontologyId: ontologyId ? ontologyId : data ? data.getOntologyId() : null, thingType: thingType ? thingType : data ? data.getType() : null, href: href }));
4858
+ return (React.createElement(TitlePresentation, { title: data ? (isOntology(data) ? data.getName() : data.getLabel()) : null, titleText: titleText, defaultValue: defaultValue, className: className, isLoading: isLoading, error: isError ? error : null, iri: iri ? iri : data ? data.getIri() : null, onNavigateTo: onNavigateTo, ontologyId: ontologyId ? ontologyId : data ? data.getOntologyId() : undefined, thingType: thingType ? thingType : data ? data.getType() : undefined, href: href }));
4859
4859
  }
4860
4860
  function createTitle(props, container, callback) {
4861
4861
  ReactDOM.render(WrappedTitleWidget(props), container, callback);
@@ -5200,7 +5200,9 @@ function ResourcesWidget(props) {
5200
5200
  let homepage = null;
5201
5201
  let licenseUrl = "";
5202
5202
  let licenseLabel = "";
5203
- resource.config.homepage ? (homepage = resource.config.homepage) : null;
5203
+ if (resource.config.homepage) {
5204
+ homepage = resource.config.homepage;
5205
+ }
5204
5206
  if (resource?.config?.annotations?.license) {
5205
5207
  const license = resource.config.annotations.license;
5206
5208
  if (useLegacy) {
@@ -5265,7 +5267,7 @@ function ResourcesWidget(props) {
5265
5267
  React.createElement("strong", null, "Ontologies")),
5266
5268
  React.createElement(EuiSpacer, { size: "s" }),
5267
5269
  React.createElement(EuiHorizontalRule, { margin: "none", style: { height: 2 } }),
5268
- React.createElement(EuiBasicTable, { columns: columnsWithExpandingRowToggle, items: pageOfItems, onChange: onTableChange, pagination: pagination, sorting: sorting, itemIdToExpandedRowMap: itemIdToExpandedRowMap, isExpandable: true, itemId: "ontologyId", ...rest }))),
5270
+ React.createElement(EuiBasicTable, { columns: columnsWithExpandingRowToggle, items: pageOfItems, onChange: onTableChange, pagination: pagination, sorting: sorting, itemIdToExpandedRowMap: itemIdToExpandedRowMap, itemId: "ontologyId", ...rest }))),
5269
5271
  isLoading && (React.createElement(EuiBasicTable, { columns: columnsWithExpandingRowToggle, items: pageOfItems, onChange: onTableChange, pagination: pagination, sorting: sorting, loading: true, ...rest })),
5270
5272
  isError && (React.createElement(EuiBasicTable, { columns: columns, items: pageOfItems, onChange: onTableChange, pagination: pagination, sorting: sorting, ...rest }))));
5271
5273
  }
@@ -5340,7 +5342,7 @@ function SearchBarWidget(props) {
5340
5342
  }));
5341
5343
  }, [selectedOptions]);
5342
5344
  return (React.createElement(React.Fragment, null,
5343
- React.createElement(EuiComboBox, { id: "suggest", isClearable: true, "aria-label": "searchBar", fullWidth: true, async: true, placeholder: "Search", autoFocus: true, singleSelection: true, isLoading: isLoading, options: options, selectedOptions: selectedOptions, onChange: onChange, onCreateOption: onCreateOption, onSearchChange: (item) => {
5345
+ React.createElement(EuiComboBox, { id: "suggest", isClearable: true, "aria-label": "searchBar", fullWidth: true, async: true, placeholder: "Search", singleSelection: true, isLoading: isLoading, options: options, selectedOptions: selectedOptions, onChange: onChange, onCreateOption: onCreateOption, onSearchChange: (item) => {
5344
5346
  setSearchValue(item);
5345
5347
  } })));
5346
5348
  }
@@ -5591,8 +5593,7 @@ function SearchResultsListWidget(props) {
5591
5593
  });
5592
5594
  }, {
5593
5595
  keepPreviousData: true,
5594
- } // See: https://react-query-v3.tanstack.com/guides/paginated-queries
5595
- );
5596
+ });
5596
5597
  function onChangeItemsPerPage(newItemsPerPage) {
5597
5598
  setActivePage(Math.floor((activePage * itemsPerPage + 1) / newItemsPerPage));
5598
5599
  setItemsPerPage(newItemsPerPage);