@ts4nfdi/terminology-service-suite 5.0.4 → 5.0.5

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);
@@ -4403,7 +4400,7 @@ function GraphViewWidget(props) {
4403
4400
  ], async () => {
4404
4401
  if (rootWalkIsSelected && firstLoad) {
4405
4402
  // 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);
4403
+ return olsApi.getTermTree({ ontologyId: ontologyId, termIri: iri }, { viewMode: "All", siblings: false });
4407
4404
  }
4408
4405
  else if (firstLoad || dbclicked) {
4409
4406
  return olsApi.getTermRelations({
@@ -4573,8 +4570,9 @@ function GraphViewWidget(props) {
4573
4570
  }
4574
4571
  useEffect(() => {
4575
4572
  let graphData = { nodes: nodes.current, edges: edges.current };
4573
+ graphNetwork.current = new Network(
4576
4574
  //@ts-ignore
4577
- graphNetwork.current = new Network(container.current, graphData, graphNetworkConfig);
4575
+ container.current, graphData, graphNetworkConfig);
4578
4576
  }, []);
4579
4577
  useEffect(() => {
4580
4578
  if (graphNetwork.current) {
@@ -4855,7 +4853,7 @@ function TitleWidget(props) {
4855
4853
  const { data, isLoading, isSuccess, isError, error } = useQuery(["titleData", api, parameter, thingType, iri, ontologyId, useLegacy], async () => {
4856
4854
  return olsApi.getThingObject(iri, thingType, ontologyId, parameter, useLegacy);
4857
4855
  });
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 }));
4856
+ 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
4857
  }
4860
4858
  function createTitle(props, container, callback) {
4861
4859
  ReactDOM.render(WrappedTitleWidget(props), container, callback);
@@ -5200,7 +5198,9 @@ function ResourcesWidget(props) {
5200
5198
  let homepage = null;
5201
5199
  let licenseUrl = "";
5202
5200
  let licenseLabel = "";
5203
- resource.config.homepage ? (homepage = resource.config.homepage) : null;
5201
+ if (resource.config.homepage) {
5202
+ homepage = resource.config.homepage;
5203
+ }
5204
5204
  if (resource?.config?.annotations?.license) {
5205
5205
  const license = resource.config.annotations.license;
5206
5206
  if (useLegacy) {
@@ -5265,7 +5265,7 @@ function ResourcesWidget(props) {
5265
5265
  React.createElement("strong", null, "Ontologies")),
5266
5266
  React.createElement(EuiSpacer, { size: "s" }),
5267
5267
  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 }))),
5268
+ React.createElement(EuiBasicTable, { columns: columnsWithExpandingRowToggle, items: pageOfItems, onChange: onTableChange, pagination: pagination, sorting: sorting, itemIdToExpandedRowMap: itemIdToExpandedRowMap, itemId: "ontologyId", ...rest }))),
5269
5269
  isLoading && (React.createElement(EuiBasicTable, { columns: columnsWithExpandingRowToggle, items: pageOfItems, onChange: onTableChange, pagination: pagination, sorting: sorting, loading: true, ...rest })),
5270
5270
  isError && (React.createElement(EuiBasicTable, { columns: columns, items: pageOfItems, onChange: onTableChange, pagination: pagination, sorting: sorting, ...rest }))));
5271
5271
  }
@@ -5340,7 +5340,7 @@ function SearchBarWidget(props) {
5340
5340
  }));
5341
5341
  }, [selectedOptions]);
5342
5342
  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) => {
5343
+ 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
5344
  setSearchValue(item);
5345
5345
  } })));
5346
5346
  }
@@ -5591,8 +5591,7 @@ function SearchResultsListWidget(props) {
5591
5591
  });
5592
5592
  }, {
5593
5593
  keepPreviousData: true,
5594
- } // See: https://react-query-v3.tanstack.com/guides/paginated-queries
5595
- );
5594
+ });
5596
5595
  function onChangeItemsPerPage(newItemsPerPage) {
5597
5596
  setActivePage(Math.floor((activePage * itemsPerPage + 1) / newItemsPerPage));
5598
5597
  setItemsPerPage(newItemsPerPage);