@ts4nfdi/terminology-service-suite 5.6.0 → 5.6.2

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.
@@ -185,6 +185,10 @@ export type AutocompleteWidgetProps = EuiComboBoxProps<string> & ParameterObj &
185
185
  * Whether to show the api source in the result list or not. Default is true. Only when the API gateway is selected.
186
186
  */
187
187
  showApiSource?: boolean;
188
+ /**
189
+ * Initial search value to show results on first render.
190
+ */
191
+ initialSearchQuery?: string;
188
192
  };
189
193
  export type DataContentWidgetProps = ApiObj & ParameterObj;
190
194
  export type EntityInfoWidgetProps = ApiObj & OptionalEntityTypeObj & OptionalOntologyIdObj & ForcedIriObj & HasTitleObj & ShowBadgesObj & ParameterObj & UseLegacyObj & OnNavigates;
@@ -11,7 +11,7 @@ import { OlsEntityApi } from '../../../api/ols/OlsEntityApi.js';
11
11
  * A React component to provide Autosuggestion based on SemLookP.
12
12
  */
13
13
  function AutocompleteWidget(props) {
14
- const { api, parameter, hasShortSelectedLabel, allowCustomTerms, selectionChangedEvent, preselected, placeholder, singleSelection, singleSuggestionRow, ts4nfdiGateway = false, showApiSource = true, className, useLegacy, ...rest } = props;
14
+ const { api, parameter, hasShortSelectedLabel, allowCustomTerms, selectionChangedEvent, preselected, placeholder, singleSelection, singleSuggestionRow, ts4nfdiGateway = false, showApiSource = true, className, useLegacy, initialSearchQuery, ...rest } = props;
15
15
  const olsApi = new OlsSearchApi(api);
16
16
  const olsEntityApi = new OlsEntityApi(api);
17
17
  const visColors = euiPaletteColorBlind();
@@ -19,9 +19,9 @@ function AutocompleteWidget(props) {
19
19
  /**
20
20
  * The current search value
21
21
  */
22
- const [searchValue, setSearchValue] = useState("");
22
+ const [searchValue, setSearchValue] = useState(initialSearchQuery ?? "");
23
23
  /**
24
- * The set of available options.s
24
+ * The set of available options
25
25
  */
26
26
  const [options, setOptions] = useState([]);
27
27
  /**
@@ -62,24 +62,39 @@ function AutocompleteWidget(props) {
62
62
  const renderOntology = () => {
63
63
  return (React.createElement("span", { className: finalClassName },
64
64
  React.createElement(EuiHealth, { color: dotColor },
65
- React.createElement("span", null,
65
+ React.createElement("div", { style: {
66
+ display: "flex",
67
+ flexDirection: "column",
68
+ lineHeight: "1.2",
69
+ } },
66
70
  React.createElement(EuiHighlight, { search: searchValue }, value.label),
67
- React.createElement("br", null),
68
- value.description))));
71
+ value.description && (React.createElement("span", { style: {
72
+ overflow: "hidden",
73
+ textOverflow: "ellipsis",
74
+ whiteSpace: "nowrap",
75
+ display: "block",
76
+ marginTop: "2px",
77
+ color: "#666",
78
+ } }, value.description))))));
69
79
  };
70
80
  const renderEntity = () => {
71
81
  return (React.createElement("span", { title: hoverText, className: finalClassName },
72
- React.createElement("span", null,
82
+ React.createElement("div", { style: {
83
+ display: "flex",
84
+ alignItems: "center",
85
+ gap: "8px",
86
+ } },
73
87
  React.createElement(EuiHealth, { color: dotColor },
74
88
  React.createElement(EuiHighlight, { search: searchValue }, value.label)),
75
- "\u00A0\u00A0\u00A0\u00A0\u00A0",
76
89
  React.createElement(BreadcrumbPresentation, { shortForm: value.short_form, ontologyId: value.ontology_name, colorFirst: "primary", colorSecond: "success", className: `${finalClassName}-breadcrumb` }),
77
- React.createElement(EuiIcon, { type: "iInCircle", style: { marginLeft: "5px" }, title: hoverText })),
90
+ React.createElement(EuiIcon, { type: "iInCircle", title: hoverText })),
78
91
  !singleSuggestionRow && value.description && (React.createElement("span", { style: {
79
92
  overflow: "hidden",
80
93
  textOverflow: "ellipsis",
81
94
  whiteSpace: "nowrap",
82
95
  display: "block",
96
+ marginTop: "4px",
97
+ color: "#666",
83
98
  } }, value.description))));
84
99
  };
85
100
  return value.type === "ontology" ? renderOntology() : renderEntity();
@@ -330,10 +345,13 @@ function AutocompleteWidget(props) {
330
345
  };
331
346
  }, [selectedOptions]);
332
347
  function generateDisplayLabel(item) {
333
- return (item?.getLabel() ??
334
- "-" + " (" + item?.getOntologyId()?.toUpperCase() ??
335
- "-" + " " + item?.getShortForm() ??
336
- "-" + ")");
348
+ const label = item?.getLabel();
349
+ if (label)
350
+ return label;
351
+ const ontologyId = item?.getOntologyId()?.toUpperCase();
352
+ const shortForm = item?.getShortForm();
353
+ return ((ontologyId ? `- (${ontologyId}` : "") +
354
+ (shortForm ? `- (${shortForm}` : "") || "-");
337
355
  }
338
356
  function onChangeHandler(options) {
339
357
  setSelectedOptions(options);
@@ -356,7 +374,7 @@ function AutocompleteWidget(props) {
356
374
  setSelectedOptions(singleSelection ? [newOption] : [...selectedOptions, newOption]);
357
375
  }
358
376
  return (React.createElement("div", { className: finalClassName },
359
- React.createElement(EuiComboBox, { isClearable: true, "aria-label": "searchBar", fullWidth: true, ...rest, async: true, isLoading: isLoadingTerms || isLoadingOnMount, singleSelection: singleSelection ? { asPlainText: true } : false, placeholder: placeholder ? placeholder : "Search for a Concept", options: options, selectedOptions: selectedOptions, onSearchChange: setSearchValue, onChange: onChangeHandler, renderOption: renderOption, onCreateOption: allowCustomTerms ? onCreateOptionHandler : undefined, rowHeight: singleSuggestionRow ? 30 : 50 })));
377
+ React.createElement(EuiComboBox, { isClearable: true, "aria-label": "searchBar", fullWidth: true, ...rest, async: true, isLoading: isLoadingTerms || isLoadingOnMount, singleSelection: singleSelection ? { asPlainText: true } : false, placeholder: placeholder ? placeholder : "", options: options, selectedOptions: selectedOptions, onSearchChange: setSearchValue, onChange: onChangeHandler, renderOption: renderOption, onCreateOption: allowCustomTerms ? onCreateOptionHandler : undefined, rowHeight: singleSuggestionRow ? 30 : 50 })));
360
378
  }
361
379
  function createAutocomplete(props, container, callback) {
362
380
  // @ts-ignore
@@ -1 +1 @@
1
- {"version":3,"file":"AutocompleteWidget.js","sources":["../../../../../../src/components/widgets/AutocompleteWidget/AutocompleteWidget.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useEffect, useState } from \"react\";\nimport ReactDOM from \"react-dom\";\n\nimport { OlsSearchApi } from \"../../../api/ols/OlsSearchApi\";\nimport { EuiComboBoxOptionOption } from \"@elastic/eui/src/components/combo_box/types\";\nimport {\n EuiComboBox,\n euiPaletteColorBlindBehindText,\n euiPaletteColorBlind,\n EuiHighlight,\n EuiHealth,\n EuiProvider,\n EuiIcon,\n} from \"@elastic/eui\";\nimport { QueryClient, QueryClientProvider, useQuery } from \"react-query\";\nimport { AutocompleteWidgetProps } from \"../../../app/types\";\nimport { BreadcrumbPresentation } from \"../MetadataWidget/BreadcrumbWidget/BreadcrumbPresentation/BreadcrumbPresentation\";\nimport \"../../../style/ts4nfdiStyles/ts4nfdiAutocompleteStyle.css\";\nimport \"../../../style/ts4nfdiStyles/ts4nfdiBreadcrumbStyle.css\";\nimport { Entity } from \"../../../model/interfaces\";\nimport { OlsEntityApi } from \"../../../api/ols/OlsEntityApi\";\n\n/**\n * A React component to provide Autosuggestion based on SemLookP.\n */\nfunction AutocompleteWidget(props: AutocompleteWidgetProps) {\n const {\n api,\n parameter,\n hasShortSelectedLabel,\n allowCustomTerms,\n selectionChangedEvent,\n preselected,\n placeholder,\n singleSelection,\n singleSuggestionRow,\n ts4nfdiGateway = false,\n showApiSource = true,\n className,\n useLegacy,\n ...rest\n } = props;\n\n const olsApi = new OlsSearchApi(api);\n const olsEntityApi = new OlsEntityApi(api);\n\n const visColors = euiPaletteColorBlind();\n const visColorsBehindText = euiPaletteColorBlindBehindText();\n\n /**\n * The current search value\n */\n const [searchValue, setSearchValue] = useState<string>(\"\");\n\n /**\n * The set of available options.s\n */\n const [options, setOptions] = useState<Array<EuiComboBoxOptionOption<any>>>(\n [],\n );\n\n /**\n * Store current set of select Options. A subset of options.\n */\n const [selectedOptions, setSelectedOptions] = useState<\n Array<EuiComboBoxOptionOption<any>>\n >([]);\n\n const finalClassName = className || \"ts4nfdi-autocomplete-style\";\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const renderOption = (option, searchValue) => {\n const { label, value } = option;\n const dotColorIndex = visColorsBehindText.indexOf(\n value.type === \"class\"\n ? visColorsBehindText[5]\n : value.type === \"individual\"\n ? visColorsBehindText[3]\n : value.type === \"property\"\n ? visColorsBehindText[1]\n : \"\",\n );\n const dotColor = visColors[dotColorIndex];\n\n if (allowCustomTerms && value.iri == \"\") {\n // if we have a custom term, just show the label\n return label;\n }\n\n const prefix =\n value.type === \"ontology\"\n ? \"Prefix: \" + value.ontology_name\n : \"Prefix > Short form: \" +\n value.ontology_name +\n \" > \" +\n value.short_form;\n\n let hoverText = `Type: ${value.type}\\n\\nLabel: ${value.label}\\n\\n${prefix}`;\n if (value.description != undefined) {\n hoverText += `\\n\\nDescription: ${value.description}`;\n }\n if (showApiSource && value.source_url && value.source_url !== \"\") {\n hoverText += \"\\n\\nSource: \" + value.source;\n hoverText += \"\\n\\nSource URL: \" + value.source_url;\n }\n\n const renderOntology = () => {\n return (\n <span className={finalClassName}>\n <EuiHealth color={dotColor}>\n <span>\n <EuiHighlight search={searchValue}>{value.label}</EuiHighlight>\n <br />\n {value.description}\n </span>\n </EuiHealth>\n </span>\n );\n };\n\n const renderEntity = () => {\n return (\n <span title={hoverText} className={finalClassName}>\n <span>\n <EuiHealth color={dotColor}>\n <EuiHighlight search={searchValue}>{value.label}</EuiHighlight>\n </EuiHealth>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n <BreadcrumbPresentation\n shortForm={value.short_form}\n ontologyId={value.ontology_name}\n colorFirst={\"primary\"}\n colorSecond={\"success\"}\n className={`${finalClassName}-breadcrumb`}\n />\n <EuiIcon\n type={\"iInCircle\"}\n style={{ marginLeft: \"5px\" }}\n title={hoverText}\n />\n </span>\n {!singleSuggestionRow && value.description && (\n <span\n style={{\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n display: \"block\",\n }}\n >\n {value.description}\n </span>\n )}\n </span>\n );\n };\n\n return value.type === \"ontology\" ? renderOntology() : renderEntity();\n };\n\n /**\n * For preselect property\n * Creates option from preselected label and iri\n * @param preselectedElement\n */\n function createCustomTermOption(\n preselectedElement: any,\n ): EuiComboBoxOptionOption<any> {\n return {\n label: preselectedElement.label,\n key: preselectedElement.label,\n value: {\n iri: preselectedElement.iri || \"\",\n label: preselectedElement.label,\n ontology_name: \"\",\n type: \"\",\n short_form: \"\",\n description: \"\",\n source: \"\",\n source_url: \"\",\n },\n };\n }\n\n /**\n * For preselected property\n * Creates option from OLS API select response\n * @param selection The select response\n */\n function createSelectOption(selection: any): EuiComboBoxOptionOption<any> {\n return {\n label: hasShortSelectedLabel\n ? selection.getLabel()\n : generateDisplayLabel(selection),\n key: `${selection.getOntologyId()}::${selection.getIri()}::${selection.getType()}`,\n value: {\n iri: selection.getIri(),\n label: selection.getLabel(),\n ontology_name: selection.getOntologyId(),\n type: selection.getType(),\n short_form: selection.getShortForm(),\n description: selection.getDescription(),\n },\n };\n }\n\n /**\n * For preselected property\n * Creates option from OLS4 API entity response\n * @param entity The Entity object response\n */\n function createEntityOption(entity: Entity): EuiComboBoxOptionOption<any> {\n return {\n label: hasShortSelectedLabel\n ? entity.getLabel()\n : generateDisplayLabel(entity),\n key: `${entity.getOntologyId()}::${entity.getIri()}::${entity.getType()}`,\n value: {\n iri: entity.getIri(),\n label: entity.getLabel(),\n ontology_name: entity.getOntologyId(),\n type: entity.getType(),\n short_form: entity.getShortForm(),\n description: entity.getDescription(),\n },\n };\n }\n\n /**\n * For preselected property\n * Request the OLS4 API entity endpoint and create the entity option\n * @param preselectedElement\n * @param preselectedOptions\n */\n async function fetchAndProcessEntityOption(\n preselectedElement: any,\n preselectedOptions: EuiComboBoxOptionOption<any>[],\n ) {\n try {\n const response = await olsEntityApi.getEntityObject(\n preselectedElement.iri,\n undefined,\n undefined,\n parameter,\n useLegacy,\n );\n\n preselectedOptions.push(createEntityOption(response));\n\n if (singleSelection && preselectedOptions.length > 1) {\n preselectedOptions.length = 1;\n }\n } catch (error) {\n if (preselectedElement.label && allowCustomTerms)\n preselectedOptions.push(createCustomTermOption(preselectedElement));\n if (singleSelection && preselectedOptions.length > 1) {\n preselectedOptions.length = 1;\n }\n console.error(\n \"Error fetching data for option:\",\n preselectedElement,\n error,\n );\n }\n }\n\n /**\n * For preselected property\n * Request the OLS API select endpoint and create select option by either using select response or - if no response - use the preselected label and iri\n * @param preselectedElement\n * @param preselectedOptions\n */\n async function fetchAndProcessSelectOption(\n preselectedElement: any,\n preselectedOptions: EuiComboBoxOptionOption<any>[],\n ) {\n try {\n const response = await olsApi.getSelectData(\n { query: preselectedElement.iri },\n undefined,\n undefined,\n parameter,\n ts4nfdiGateway,\n );\n\n if (!response) return;\n\n const matchFound = processSelectResponse(\n response,\n preselectedElement,\n preselectedOptions,\n );\n\n if (!matchFound && preselectedElement.label && allowCustomTerms) {\n preselectedOptions.push(createCustomTermOption(preselectedElement));\n }\n\n if (singleSelection && preselectedOptions.length > 1) {\n preselectedOptions.length = 1;\n }\n } catch (error) {\n if (preselectedElement.label && allowCustomTerms)\n preselectedOptions.push(createCustomTermOption(preselectedElement));\n if (singleSelection && preselectedOptions.length > 1) {\n preselectedOptions.length = 1;\n }\n console.error(\n \"Error fetching data for option:\",\n preselectedElement,\n error,\n );\n }\n }\n\n /**\n * For preselected property\n * If the preselected element has a select response, create the select option\n * If no select response, return false\n * @param response\n * @param preselectedElement\n * @param preselectedOptions\n */\n function processSelectResponse(\n response: any,\n preselectedElement: any,\n preselectedOptions: EuiComboBoxOptionOption<any>[],\n ): boolean {\n let matchFound = false;\n\n response.properties.forEach((selection: any) => {\n if (preselectedElement.iri === selection.getIri()) {\n matchFound = true;\n preselectedOptions.push(createSelectOption(selection));\n }\n });\n\n return matchFound;\n }\n\n /**\n * on mount: fetches term for preselected\n * sets its label or sets a given label if no iri is provided/the given iri cannot be resolved\n * only if allowCustomTerms is true\n */\n const { isLoading: isLoadingOnMount } = useQuery(\n [\"onMount\", preselected],\n async () => {\n let preselectedOptions: EuiComboBoxOptionOption<any>[] = [];\n\n let uniqueValues = [...new Set(preselected ?? [])].filter(\n (option) => (allowCustomTerms && option.label) || option.iri,\n );\n\n if (uniqueValues.length === 0) return;\n\n if (singleSelection) uniqueValues = [uniqueValues[0]];\n\n for (const preselectedElement of uniqueValues) {\n if (useLegacy) {\n if (preselectedElement?.iri?.startsWith(\"http\")) {\n await fetchAndProcessSelectOption(\n preselectedElement,\n preselectedOptions,\n );\n } else if (preselectedElement?.label && allowCustomTerms) {\n preselectedOptions.push(createCustomTermOption(preselectedElement));\n }\n } else {\n if (preselectedElement?.iri?.startsWith(\"http\")) {\n await fetchAndProcessEntityOption(\n preselectedElement,\n preselectedOptions,\n );\n } else if (preselectedElement?.label && allowCustomTerms) {\n preselectedOptions.push(createCustomTermOption(preselectedElement));\n }\n }\n }\n setOptions(preselectedOptions);\n setSelectedOptions(preselectedOptions);\n },\n );\n\n /**\n * fetches new options when searchValue changes\n */\n const { isLoading: isLoadingTerms } = useQuery(\n [\"onSearchChange\", searchValue],\n async () => {\n if (searchValue.length > 0) {\n return olsApi\n .getSelectData(\n { query: searchValue },\n undefined,\n undefined,\n parameter,\n ts4nfdiGateway,\n )\n .then((response) => {\n if (response) {\n setOptions(\n response.properties.map((selection: any) => ({\n // label to display within the combobox either raw value or generated one\n // #renderOption() is used to display during selection.\n label: hasShortSelectedLabel\n ? selection.getLabel()\n : generateDisplayLabel(selection),\n // key to distinguish the options (especially those with same label)\n key: `${selection.getOntologyId()}::${selection.getIri()}::${selection.getType()}`,\n // values to pass to clients\n value: {\n iri: selection.getIri(),\n label: selection.getLabel(),\n ontology_name: selection.getOntologyId(),\n type: selection.getType(),\n short_form: selection.getShortForm(),\n description: selection.getDescription(),\n source: selection.getApiSourceName(),\n source_url: selection.getApiSourceEndpoint(),\n },\n })),\n );\n }\n });\n }\n },\n );\n\n /**\n * Once the set of selected options changes, pass the event by invoking the passed function.\n */\n useEffect(() => {\n let isMounted = true;\n if (isMounted) {\n selectionChangedEvent(\n selectedOptions.map((x) => {\n // return the value object with the raw values from OLS to a client\n if (allowCustomTerms && x.value.iri == \"\") {\n return {\n iri: \"\",\n label: x.label,\n ontology_name: \"\",\n type: \"\",\n short_form: x.value.short_form,\n description: x.value.description,\n source: x.value.source,\n };\n } else if (x.value.iri == \"\") {\n return {\n iri: \"\",\n label: \"\",\n ontology_name: \"\",\n type: \"\",\n short_form: \"\",\n description: \"\",\n source: \"\",\n };\n } else {\n return {\n iri: x.value.iri,\n label: x.value.label,\n ontology_name: x.value.ontology_name,\n type: x.value.type,\n short_form: x.value.short_form,\n description: x.value.description,\n source: x.value.source,\n };\n }\n }),\n );\n }\n return () => {\n isMounted = false;\n };\n }, [selectedOptions]);\n\n function generateDisplayLabel(item: any): string {\n return (\n item?.getLabel() ??\n \"-\" + \" (\" + item?.getOntologyId()?.toUpperCase() ??\n \"-\" + \" \" + item?.getShortForm() ??\n \"-\" + \")\"\n );\n }\n\n function onChangeHandler(options: Array<any>): void {\n setSelectedOptions(options);\n }\n\n function onCreateOptionHandler(searchValue: string) {\n const newOption = {\n label: searchValue,\n key: searchValue,\n value: {\n iri: \"\",\n label: \"\",\n ontology_name: \"\",\n type: \"\",\n short_form: \"\",\n description: \"\",\n source: \"\",\n },\n };\n\n setOptions([...options, newOption]);\n setSelectedOptions(\n singleSelection ? [newOption] : [...selectedOptions, newOption],\n );\n }\n\n return (\n <div className={finalClassName}>\n <EuiComboBox\n isClearable\n aria-label=\"searchBar\"\n fullWidth={true}\n {...rest} // items above can be overridden by a client\n async={true}\n isLoading={isLoadingTerms || isLoadingOnMount}\n singleSelection={singleSelection ? { asPlainText: true } : false}\n placeholder={placeholder ? placeholder : \"Search for a Concept\"}\n options={options}\n selectedOptions={selectedOptions}\n onSearchChange={setSearchValue}\n onChange={onChangeHandler}\n renderOption={renderOption}\n onCreateOption={allowCustomTerms ? onCreateOptionHandler : undefined}\n rowHeight={singleSuggestionRow ? 30 : 50}\n />\n </div>\n );\n}\n\nfunction createAutocomplete(\n props: AutocompleteWidgetProps,\n container: any,\n callback?: () => void,\n) {\n // @ts-ignore\n ReactDOM.render(WrappedAutocompleteWidget(props), container, callback);\n}\n\nfunction WrappedAutocompleteWidget(props: AutocompleteWidgetProps) {\n const queryClient = new QueryClient();\n return (\n <EuiProvider colorMode=\"light\" globalStyles={false}>\n <QueryClientProvider client={queryClient}>\n <AutocompleteWidget\n api={props.api}\n parameter={props.parameter}\n selectionChangedEvent={props.selectionChangedEvent}\n preselected={props.preselected}\n singleSelection={props.singleSelection as boolean}\n placeholder={props.placeholder}\n hasShortSelectedLabel={props.hasShortSelectedLabel}\n allowCustomTerms={props.allowCustomTerms}\n ts4nfdiGateway={props.ts4nfdiGateway}\n singleSuggestionRow={props.singleSuggestionRow}\n showApiSource={props.showApiSource}\n className={props.className}\n useLegacy={props.useLegacy}\n />\n </QueryClientProvider>\n </EuiProvider>\n );\n}\n\nexport { AutocompleteWidget, createAutocomplete };\n"],"names":[],"mappings":";;;;;;;;;AAwBA;;AAEG;AACH;AACE;AAiBA;AACA;AAEA;AACA;AAEA;;AAEG;;AAGH;;AAEG;;AAKH;;AAEG;;AAKH;;;AAIA;AACE;;AAGI;AACA;AACE;AACA;AACE;;AAGR;;;AAIE;;AAGF;AAEI;AACA;AACE;;;AAIN;AACA;AACE;;AAEF;AACE;AACA;;;AAIA;AAEI;AACE;;;AAGG;AAKX;;;AAKM;AACE;;;;AAWA;;AASI;AACA;AACA;AACA;AACD;AAOX;AAEA;AACF;AAEA;;;;AAIG;;;;;AAOC;AACE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACD;;;AAIL;;;;AAIG;;;AAGC;AACE;AACA;AACF;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACD;;;AAIL;;;;AAIG;;;AAGC;AACE;AACA;AACF;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACD;;;AAIL;;;;;AAKG;AACH;AAIE;AACE;;;AAWE;;;;AAGF;;;AAGE;;;;;AAUN;;;;;AAKG;AACH;AAIE;;AASE;;;;;;;AAaE;;;;AAGF;;;AAGE;;;;;AAUN;;;;;;;AAOG;AACH;;;;;;;AAYE;AAEA;;AAGF;;;;AAIG;AACH;;AAKI;AAIA;;AAEA;AAAqB;AAErB;;;AAGM;;AAIK;;;;;;AAKL;;AAIK;;;;;;;AAOb;AAGF;;AAEG;AACH;AAGI;AACE;AACG;AAOA;;AAEG;;;AAII;AACE;AACA;;AAEF;;AAEA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACD;;;AAIT;;AAEN;AAGF;;AAEG;;;;;;;;AASS;;AAEA;AACA;AACA;AACA;AACA;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAMV;;AAEA;AACF;;AAGE;;AAGE;;;;;;;AAUF;AACE;AACA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACD;;;AAIH;;AAKF;;AAqBF;AAEA;;AAME;AACF;AAEA;AACE;;AAGI;AACE;AAkBR;;"}
1
+ {"version":3,"file":"AutocompleteWidget.js","sources":["../../../../../../src/components/widgets/AutocompleteWidget/AutocompleteWidget.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useEffect, useState } from \"react\";\nimport ReactDOM from \"react-dom\";\n\nimport { OlsSearchApi } from \"../../../api/ols/OlsSearchApi\";\nimport { EuiComboBoxOptionOption } from \"@elastic/eui/src/components/combo_box/types\";\nimport {\n EuiComboBox,\n euiPaletteColorBlindBehindText,\n euiPaletteColorBlind,\n EuiHighlight,\n EuiHealth,\n EuiProvider,\n EuiIcon,\n} from \"@elastic/eui\";\nimport { QueryClient, QueryClientProvider, useQuery } from \"react-query\";\nimport { AutocompleteWidgetProps } from \"../../../app/types\";\nimport { BreadcrumbPresentation } from \"../MetadataWidget/BreadcrumbWidget/BreadcrumbPresentation/BreadcrumbPresentation\";\nimport \"../../../style/ts4nfdiStyles/ts4nfdiAutocompleteStyle.css\";\nimport \"../../../style/ts4nfdiStyles/ts4nfdiBreadcrumbStyle.css\";\nimport { Entity } from \"../../../model/interfaces\";\nimport { OlsEntityApi } from \"../../../api/ols/OlsEntityApi\";\n\n/**\n * A React component to provide Autosuggestion based on SemLookP.\n */\nfunction AutocompleteWidget(props: AutocompleteWidgetProps) {\n const {\n api,\n parameter,\n hasShortSelectedLabel,\n allowCustomTerms,\n selectionChangedEvent,\n preselected,\n placeholder,\n singleSelection,\n singleSuggestionRow,\n ts4nfdiGateway = false,\n showApiSource = true,\n className,\n useLegacy,\n initialSearchQuery,\n ...rest\n } = props;\n\n const olsApi = new OlsSearchApi(api);\n const olsEntityApi = new OlsEntityApi(api);\n\n const visColors = euiPaletteColorBlind();\n const visColorsBehindText = euiPaletteColorBlindBehindText();\n\n /**\n * The current search value\n */\n const [searchValue, setSearchValue] = useState<string>(\n initialSearchQuery ?? \"\",\n );\n\n /**\n * The set of available options\n */\n const [options, setOptions] = useState<Array<EuiComboBoxOptionOption<any>>>(\n [],\n );\n\n /**\n * Store current set of select Options. A subset of options.\n */\n const [selectedOptions, setSelectedOptions] = useState<\n Array<EuiComboBoxOptionOption<any>>\n >([]);\n\n const finalClassName = className || \"ts4nfdi-autocomplete-style\";\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const renderOption = (option, searchValue) => {\n const { label, value } = option;\n const dotColorIndex = visColorsBehindText.indexOf(\n value.type === \"class\"\n ? visColorsBehindText[5]\n : value.type === \"individual\"\n ? visColorsBehindText[3]\n : value.type === \"property\"\n ? visColorsBehindText[1]\n : \"\",\n );\n const dotColor = visColors[dotColorIndex];\n\n if (allowCustomTerms && value.iri == \"\") {\n // if we have a custom term, just show the label\n return label;\n }\n\n const prefix =\n value.type === \"ontology\"\n ? \"Prefix: \" + value.ontology_name\n : \"Prefix > Short form: \" +\n value.ontology_name +\n \" > \" +\n value.short_form;\n\n let hoverText = `Type: ${value.type}\\n\\nLabel: ${value.label}\\n\\n${prefix}`;\n if (value.description != undefined) {\n hoverText += `\\n\\nDescription: ${value.description}`;\n }\n if (showApiSource && value.source_url && value.source_url !== \"\") {\n hoverText += \"\\n\\nSource: \" + value.source;\n hoverText += \"\\n\\nSource URL: \" + value.source_url;\n }\n\n const renderOntology = () => {\n return (\n <span className={finalClassName}>\n <EuiHealth color={dotColor}>\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n lineHeight: \"1.2\",\n }}\n >\n <EuiHighlight search={searchValue}>{value.label}</EuiHighlight>\n\n {value.description && (\n <span\n style={{\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n display: \"block\",\n marginTop: \"2px\",\n color: \"#666\",\n }}\n >\n {value.description}\n </span>\n )}\n </div>\n </EuiHealth>\n </span>\n );\n };\n\n const renderEntity = () => {\n return (\n <span title={hoverText} className={finalClassName}>\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n }}\n >\n <EuiHealth color={dotColor}>\n <EuiHighlight search={searchValue}>{value.label}</EuiHighlight>\n </EuiHealth>\n\n <BreadcrumbPresentation\n shortForm={value.short_form}\n ontologyId={value.ontology_name}\n colorFirst={\"primary\"}\n colorSecond={\"success\"}\n className={`${finalClassName}-breadcrumb`}\n />\n\n <EuiIcon type={\"iInCircle\"} title={hoverText} />\n </div>\n\n {!singleSuggestionRow && value.description && (\n <span\n style={{\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n display: \"block\",\n marginTop: \"4px\",\n color: \"#666\",\n }}\n >\n {value.description}\n </span>\n )}\n </span>\n );\n };\n\n return value.type === \"ontology\" ? renderOntology() : renderEntity();\n };\n\n /**\n * For preselect property\n * Creates option from preselected label and iri\n * @param preselectedElement\n */\n function createCustomTermOption(\n preselectedElement: any,\n ): EuiComboBoxOptionOption<any> {\n return {\n label: preselectedElement.label,\n key: preselectedElement.label,\n value: {\n iri: preselectedElement.iri || \"\",\n label: preselectedElement.label,\n ontology_name: \"\",\n type: \"\",\n short_form: \"\",\n description: \"\",\n source: \"\",\n source_url: \"\",\n },\n };\n }\n\n /**\n * For preselected property\n * Creates option from OLS API select response\n * @param selection The select response\n */\n function createSelectOption(selection: any): EuiComboBoxOptionOption<any> {\n return {\n label: hasShortSelectedLabel\n ? selection.getLabel()\n : generateDisplayLabel(selection),\n key: `${selection.getOntologyId()}::${selection.getIri()}::${selection.getType()}`,\n value: {\n iri: selection.getIri(),\n label: selection.getLabel(),\n ontology_name: selection.getOntologyId(),\n type: selection.getType(),\n short_form: selection.getShortForm(),\n description: selection.getDescription(),\n },\n };\n }\n\n /**\n * For preselected property\n * Creates option from OLS4 API entity response\n * @param entity The Entity object response\n */\n function createEntityOption(entity: Entity): EuiComboBoxOptionOption<any> {\n return {\n label: hasShortSelectedLabel\n ? entity.getLabel()\n : generateDisplayLabel(entity),\n key: `${entity.getOntologyId()}::${entity.getIri()}::${entity.getType()}`,\n value: {\n iri: entity.getIri(),\n label: entity.getLabel(),\n ontology_name: entity.getOntologyId(),\n type: entity.getType(),\n short_form: entity.getShortForm(),\n description: entity.getDescription(),\n },\n };\n }\n\n /**\n * For preselected property\n * Request the OLS4 API entity endpoint and create the entity option\n * @param preselectedElement\n * @param preselectedOptions\n */\n async function fetchAndProcessEntityOption(\n preselectedElement: any,\n preselectedOptions: EuiComboBoxOptionOption<any>[],\n ) {\n try {\n const response = await olsEntityApi.getEntityObject(\n preselectedElement.iri,\n undefined,\n undefined,\n parameter,\n useLegacy,\n );\n\n preselectedOptions.push(createEntityOption(response));\n\n if (singleSelection && preselectedOptions.length > 1) {\n preselectedOptions.length = 1;\n }\n } catch (error) {\n if (preselectedElement.label && allowCustomTerms)\n preselectedOptions.push(createCustomTermOption(preselectedElement));\n if (singleSelection && preselectedOptions.length > 1) {\n preselectedOptions.length = 1;\n }\n console.error(\n \"Error fetching data for option:\",\n preselectedElement,\n error,\n );\n }\n }\n\n /**\n * For preselected property\n * Request the OLS API select endpoint and create select option by either using select response or - if no response - use the preselected label and iri\n * @param preselectedElement\n * @param preselectedOptions\n */\n async function fetchAndProcessSelectOption(\n preselectedElement: any,\n preselectedOptions: EuiComboBoxOptionOption<any>[],\n ) {\n try {\n const response = await olsApi.getSelectData(\n { query: preselectedElement.iri },\n undefined,\n undefined,\n parameter,\n ts4nfdiGateway,\n );\n\n if (!response) return;\n\n const matchFound = processSelectResponse(\n response,\n preselectedElement,\n preselectedOptions,\n );\n\n if (!matchFound && preselectedElement.label && allowCustomTerms) {\n preselectedOptions.push(createCustomTermOption(preselectedElement));\n }\n\n if (singleSelection && preselectedOptions.length > 1) {\n preselectedOptions.length = 1;\n }\n } catch (error) {\n if (preselectedElement.label && allowCustomTerms)\n preselectedOptions.push(createCustomTermOption(preselectedElement));\n if (singleSelection && preselectedOptions.length > 1) {\n preselectedOptions.length = 1;\n }\n console.error(\n \"Error fetching data for option:\",\n preselectedElement,\n error,\n );\n }\n }\n\n /**\n * For preselected property\n * If the preselected element has a select response, create the select option\n * If no select response, return false\n * @param response\n * @param preselectedElement\n * @param preselectedOptions\n */\n function processSelectResponse(\n response: any,\n preselectedElement: any,\n preselectedOptions: EuiComboBoxOptionOption<any>[],\n ): boolean {\n let matchFound = false;\n\n response.properties.forEach((selection: any) => {\n if (preselectedElement.iri === selection.getIri()) {\n matchFound = true;\n preselectedOptions.push(createSelectOption(selection));\n }\n });\n\n return matchFound;\n }\n\n /**\n * on mount: fetches term for preselected\n * sets its label or sets a given label if no iri is provided/the given iri cannot be resolved\n * only if allowCustomTerms is true\n */\n const { isLoading: isLoadingOnMount } = useQuery(\n [\"onMount\", preselected],\n async () => {\n let preselectedOptions: EuiComboBoxOptionOption<any>[] = [];\n\n let uniqueValues = [...new Set(preselected ?? [])].filter(\n (option) => (allowCustomTerms && option.label) || option.iri,\n );\n\n if (uniqueValues.length === 0) return;\n\n if (singleSelection) uniqueValues = [uniqueValues[0]];\n\n for (const preselectedElement of uniqueValues) {\n if (useLegacy) {\n if (preselectedElement?.iri?.startsWith(\"http\")) {\n await fetchAndProcessSelectOption(\n preselectedElement,\n preselectedOptions,\n );\n } else if (preselectedElement?.label && allowCustomTerms) {\n preselectedOptions.push(createCustomTermOption(preselectedElement));\n }\n } else {\n if (preselectedElement?.iri?.startsWith(\"http\")) {\n await fetchAndProcessEntityOption(\n preselectedElement,\n preselectedOptions,\n );\n } else if (preselectedElement?.label && allowCustomTerms) {\n preselectedOptions.push(createCustomTermOption(preselectedElement));\n }\n }\n }\n setOptions(preselectedOptions);\n setSelectedOptions(preselectedOptions);\n },\n );\n\n /**\n * fetches new options when searchValue changes\n */\n const { isLoading: isLoadingTerms } = useQuery(\n [\"onSearchChange\", searchValue],\n async () => {\n if (searchValue.length > 0) {\n return olsApi\n .getSelectData(\n { query: searchValue },\n undefined,\n undefined,\n parameter,\n ts4nfdiGateway,\n )\n .then((response) => {\n if (response) {\n setOptions(\n response.properties.map((selection: any) => ({\n // label to display within the combobox either raw value or generated one\n // #renderOption() is used to display during selection.\n label: hasShortSelectedLabel\n ? selection.getLabel()\n : generateDisplayLabel(selection),\n // key to distinguish the options (especially those with same label)\n key: `${selection.getOntologyId()}::${selection.getIri()}::${selection.getType()}`,\n // values to pass to clients\n value: {\n iri: selection.getIri(),\n label: selection.getLabel(),\n ontology_name: selection.getOntologyId(),\n type: selection.getType(),\n short_form: selection.getShortForm(),\n description: selection.getDescription(),\n source: selection.getApiSourceName(),\n source_url: selection.getApiSourceEndpoint(),\n },\n })),\n );\n }\n });\n }\n },\n );\n\n /**\n * Once the set of selected options changes, pass the event by invoking the passed function.\n */\n useEffect(() => {\n let isMounted = true;\n if (isMounted) {\n selectionChangedEvent(\n selectedOptions.map((x) => {\n // return the value object with the raw values from OLS to a client\n if (allowCustomTerms && x.value.iri == \"\") {\n return {\n iri: \"\",\n label: x.label,\n ontology_name: \"\",\n type: \"\",\n short_form: x.value.short_form,\n description: x.value.description,\n source: x.value.source,\n };\n } else if (x.value.iri == \"\") {\n return {\n iri: \"\",\n label: \"\",\n ontology_name: \"\",\n type: \"\",\n short_form: \"\",\n description: \"\",\n source: \"\",\n };\n } else {\n return {\n iri: x.value.iri,\n label: x.value.label,\n ontology_name: x.value.ontology_name,\n type: x.value.type,\n short_form: x.value.short_form,\n description: x.value.description,\n source: x.value.source,\n };\n }\n }),\n );\n }\n return () => {\n isMounted = false;\n };\n }, [selectedOptions]);\n\n function generateDisplayLabel(item: any): string {\n const label = item?.getLabel();\n if (label) return label;\n\n const ontologyId = item?.getOntologyId()?.toUpperCase();\n const shortForm = item?.getShortForm();\n\n return (\n (ontologyId ? `- (${ontologyId}` : \"\") +\n (shortForm ? `- (${shortForm}` : \"\") || \"-\"\n );\n }\n\n function onChangeHandler(options: Array<any>): void {\n setSelectedOptions(options);\n }\n\n function onCreateOptionHandler(searchValue: string) {\n const newOption = {\n label: searchValue,\n key: searchValue,\n value: {\n iri: \"\",\n label: \"\",\n ontology_name: \"\",\n type: \"\",\n short_form: \"\",\n description: \"\",\n source: \"\",\n },\n };\n\n setOptions([...options, newOption]);\n setSelectedOptions(\n singleSelection ? [newOption] : [...selectedOptions, newOption],\n );\n }\n\n return (\n <div className={finalClassName}>\n <EuiComboBox\n isClearable\n aria-label=\"searchBar\"\n fullWidth={true}\n {...rest} // items above can be overridden by a client\n async={true}\n isLoading={isLoadingTerms || isLoadingOnMount}\n singleSelection={singleSelection ? { asPlainText: true } : false}\n placeholder={placeholder ? placeholder : \"\"}\n options={options}\n selectedOptions={selectedOptions}\n onSearchChange={setSearchValue}\n onChange={onChangeHandler}\n renderOption={renderOption}\n onCreateOption={allowCustomTerms ? onCreateOptionHandler : undefined}\n rowHeight={singleSuggestionRow ? 30 : 50}\n />\n </div>\n );\n}\n\nfunction createAutocomplete(\n props: AutocompleteWidgetProps,\n container: any,\n callback?: () => void,\n) {\n // @ts-ignore\n ReactDOM.render(WrappedAutocompleteWidget(props), container, callback);\n}\n\nfunction WrappedAutocompleteWidget(props: AutocompleteWidgetProps) {\n const queryClient = new QueryClient();\n return (\n <EuiProvider colorMode=\"light\" globalStyles={false}>\n <QueryClientProvider client={queryClient}>\n <AutocompleteWidget\n api={props.api}\n parameter={props.parameter}\n selectionChangedEvent={props.selectionChangedEvent}\n preselected={props.preselected}\n singleSelection={props.singleSelection as boolean}\n placeholder={props.placeholder}\n hasShortSelectedLabel={props.hasShortSelectedLabel}\n allowCustomTerms={props.allowCustomTerms}\n ts4nfdiGateway={props.ts4nfdiGateway}\n singleSuggestionRow={props.singleSuggestionRow}\n showApiSource={props.showApiSource}\n className={props.className}\n useLegacy={props.useLegacy}\n />\n </QueryClientProvider>\n </EuiProvider>\n );\n}\n\nexport { AutocompleteWidget, createAutocomplete };\n"],"names":[],"mappings":";;;;;;;;;AAwBA;;AAEG;AACH;AACE;AAkBA;AACA;AAEA;AACA;AAEA;;AAEG;AACH;AAIA;;AAEG;;AAKH;;AAEG;;AAKH;;;AAIA;AACE;;AAGI;AACA;AACE;AACA;AACE;;AAGR;;;AAIE;;AAGF;AAEI;AACA;AACE;;;AAIN;AACA;AACE;;AAEF;AACE;AACA;;;AAIA;AAEI;AACE;AAEI;AACA;AACA;AACD;;AAIA;AAGK;AACA;AACA;AACA;AACA;AACA;;AAUhB;;;AAKM;AAEI;AACA;AACA;AACD;AAED;;;;;AAkBI;AACA;AACA;AACA;AACA;AACA;AACD;AAOX;AAEA;AACF;AAEA;;;;AAIG;;;;;AAOC;AACE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACD;;;AAIL;;;;AAIG;;;AAGC;AACE;AACA;AACF;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACD;;;AAIL;;;;AAIG;;;AAGC;AACE;AACA;AACF;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACD;;;AAIL;;;;;AAKG;AACH;AAIE;AACE;;;AAWE;;;;AAGF;;;AAGE;;;;;AAUN;;;;;AAKG;AACH;AAIE;;AASE;;;;;;;AAaE;;;;AAGF;;;AAGE;;;;;AAUN;;;;;;;AAOG;AACH;;;;;;;AAYE;AAEA;;AAGF;;;;AAIG;AACH;;AAKI;AAIA;;AAEA;AAAqB;AAErB;;;AAGM;;AAIK;;;;;;AAKL;;AAIK;;;;;;;AAOb;AAGF;;AAEG;AACH;AAGI;AACE;AACG;AAOA;;AAEG;;;AAII;AACE;AACA;;AAEF;;AAEA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACD;;;AAIT;;AAEN;AAGF;;AAEG;;;;;;;;AASS;;AAEA;AACA;AACA;AACA;AACA;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAMV;;AAEA;AACF;;AAGE;AACA;AAAW;;AAGX;AAEA;AAEI;;;;;;AASJ;AACE;AACA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACD;;;AAIH;;AAKF;;AAqBF;AAEA;;AAME;AACF;AAEA;AACE;;AAGI;AACE;AAkBR;;"}
@@ -15,6 +15,7 @@ declare const _default: {
15
15
  className: string;
16
16
  useLegacy: boolean;
17
17
  parameter: string;
18
+ initialSearchQuery: string;
18
19
  };
19
20
  argTypes: {
20
21
  className: {
@@ -104,6 +104,7 @@ export declare const AutocompleteWidgetStoryArgsReact: {
104
104
  className: string;
105
105
  useLegacy: boolean;
106
106
  parameter: string;
107
+ initialSearchQuery: string;
107
108
  };
108
109
  };
109
110
  export declare const AutocompleteWidgetStoryArgsHTML: {
@@ -185,6 +185,10 @@ export type AutocompleteWidgetProps = EuiComboBoxProps<string> & ParameterObj &
185
185
  * Whether to show the api source in the result list or not. Default is true. Only when the API gateway is selected.
186
186
  */
187
187
  showApiSource?: boolean;
188
+ /**
189
+ * Initial search value to show results on first render.
190
+ */
191
+ initialSearchQuery?: string;
188
192
  };
189
193
  export type DataContentWidgetProps = ApiObj & ParameterObj;
190
194
  export type EntityInfoWidgetProps = ApiObj & OptionalEntityTypeObj & OptionalOntologyIdObj & ForcedIriObj & HasTitleObj & ShowBadgesObj & ParameterObj & UseLegacyObj & OnNavigates;
@@ -15,6 +15,7 @@ declare const _default: {
15
15
  className: string;
16
16
  useLegacy: boolean;
17
17
  parameter: string;
18
+ initialSearchQuery: string;
18
19
  };
19
20
  argTypes: {
20
21
  className: {
@@ -104,6 +104,7 @@ export declare const AutocompleteWidgetStoryArgsReact: {
104
104
  className: string;
105
105
  useLegacy: boolean;
106
106
  parameter: string;
107
+ initialSearchQuery: string;
107
108
  };
108
109
  };
109
110
  export declare const AutocompleteWidgetStoryArgsHTML: {
@@ -1 +1 @@
1
- .euiFilterSelectItem:hover{text-decoration:none!important}button{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.surroundCircle{background:#8228cc;border-radius:50%;color:#fff;display:inline-block;font:15px Arial,sans-serif;font-weight:700;height:17px;margin-top:2px;text-align:center;width:17px}.ontology-badge{background-color:#6dccb1;border:2px solid #6dccb1;border-radius:6px;color:#000;font-size:13px;padding:3px 3px 0}.ontology-badge:hover{background-color:#fff}.expand-onto-list{color:#00827c;font-style:italic}.expand-onto-list:hover{text-decoration-line:underline}.no-decoration{color:#000;text-decoration:none}.highlight{background:#add8e6;border-radius:6px;box-decoration-break:clone;padding:4px 3px 1px}.lineNodeInlet{border-bottom:1px dotted #000;height:13px;top:-1px}.lineAfterNodeInlet,.lineNodeInlet{border-left:1px dotted #000;left:5px;position:absolute;width:12px}.lineAfterNodeInlet{height:calc(100% - 11px);top:12px}.outerLine{border-left:1px dotted #000}.clickable{color:#0645ad}.clickable:hover{text-decoration:underline}.ts4nfdi-breadcrumb-style button{background:none;border:none}.ts4nfdi-breadcrumb-style .euiBadge *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-breadcrumb-style .breadcrumb{border:2px solid transparent;border-radius:6px;padding:3px 3px 0}.ts4nfdi-breadcrumb-style .clickable-breadcrumb:hover{border:2px solid #000}.ts4nfdi-autocomplete-style *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-autocomplete-style button{background:none;border:none}.euiComboBoxOptionsList *{background-color:inherit;border:none}.euiComboBoxOptionsList .euiFilterSelectItem{background:none}.euiComboBoxOptionsList__empty{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-autocomplete-breadcrumb button{background:none;border:none}.ts4nfdi-autocomplete-breadcrumb .euiBadge *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-autocomplete-breadcrumb .breadcrumb{border:2px solid transparent;border-radius:6px;padding:3px 3px 0}.ts4nfdi-autocomplete-breadcrumb .clickable-breadcrumb:hover{border:2px solid #000}.ts4nfdi-hierarchy-style,.ts4nfdi-hierarchy-style button,.ts4nfdi-iri-style *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-hierarchy-style button{background:none;border:none;font-size:inherit;padding:0}.ts4nfdi-hierarchy-style ul{margin-block-start:0;padding-inline-start:0}.ts4nfdi-hierarchy-style div{margin:0!important}.ts4nfdi-metadata-style button{background:none;border:none;font-size:inherit;padding:0}.ts4nfdi-metadata-style button,.ts4nfdi-metadata-style-title{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-metadata-style-title .euiText{font-weight:700}.ts4nfdi-metadata-style-description *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-metadata-style-breadcrumb button{background:none;border:none}.ts4nfdi-metadata-style-breadcrumb .breadcrumb{border:2px solid transparent;border-radius:6px;font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif;padding:3px 3px 0}.ts4nfdi-metadata-style-breadcrumb .clickable-breadcrumb:hover{border:2px solid #000}.ts4nfdi-metadata-style-altNameTab *,.ts4nfdi-metadata-style-crossRef *,.ts4nfdi-metadata-style-hierarchy,.ts4nfdi-metadata-style-hierarchy button,.ts4nfdi-metadata-style-iri *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-metadata-style-hierarchy button{background:none;border:none;font-size:inherit;padding:0}.ts4nfdi-metadata-style-hierarchy ul{margin-block-start:0;padding-inline-start:0}.ts4nfdi-metadata-style-hierarchy div{margin:0!important}.ts4nfdi-metadata-style-entity-defined-by *,.ts4nfdi-metadata-style-entity-defined-by button{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-metadata-style-entity-defined-by button{background:none;border:none}.ts4nfdi-metadata-style-entity-onto-list *,.ts4nfdi-metadata-style-entity-onto-list button{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-metadata-style-entity-onto-list button{background:none;border:none}.euiText p{margin:0 0 10px}.euiCard{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-ontologyy-info-style .euiText p{margin:0 0 10px}.ts4nfdi-graph-style,.ts4nfdi-graph-style button,.ts4nfdi-ontologyy-info-style .euiCard{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-graph-style button{border:none}.ts4nfdi-resources-style *,.ts4nfdi-searchResult-style *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-searchResult-style button{background:none;border:none}.ts4nfdi-searchResult-style .euiCard{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif;padding-top:0}.ts4nfdi-searchResult-style .euiCard__content div{align-items:baseline;font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-searchResult-style ul{list-style:none}.ts4nfdi-searchResult-style-metadata-compact-description *,.ts4nfdi-searchResult-style-metadata-compact-iri *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-searchResult-style-metadata-compact-breadcrumb button{background:none;border:none}.ts4nfdi-searchResult-style-metadata-compact-breadcrumb .euiBadge *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-searchResult-style-metadata-compact-breadcrumb .breadcrumb{border:2px solid transparent;border-radius:6px;padding:3px 3px 0}.ts4nfdi-searchResult-style-metadata-compact-breadcrumb .clickable-breadcrumb:hover{border:2px solid #000}.ts4nfdi-description-style *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-tab-style button{background:none;border:none}.ts4nfdi-tab-style-altNameTab *,.ts4nfdi-tab-style-crossRef *,.ts4nfdi-tab-style-hierarchy,.ts4nfdi-tab-style-hierarchy button{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-tab-style-hierarchy button{background:none;border:none;font-size:inherit;padding:0}.ts4nfdi-tab-style-hierarchy ul{margin-block-start:0;padding-inline-start:0}.ts4nfdi-tab-style-hierarchy div{margin:0!important}.ts4nfdi-altNameTab-style *,.ts4nfdi-crossRef-style *,.ts4nfdi-entity-onto-list-style *,.ts4nfdi-entity-onto-list-style button,.ts4nfdi-title-style *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-entity-onto-list-style button{background:none;border:none}.ts4nfdi-entity-defined-by-style *,.ts4nfdi-entity-defined-by-style button{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-entity-defined-by-style button{background:none;border:none}
1
+ .euiFilterSelectItem:hover{text-decoration:none!important}button{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.surroundCircle{background:#8228cc;border-radius:50%;color:#fff;display:inline-block;font:15px Arial,sans-serif;font-weight:700;height:17px;margin-top:2px;text-align:center;width:17px}.ontology-badge{background-color:#6dccb1;border:2px solid #6dccb1;border-radius:6px;color:#000;font-size:13px;padding:3px 3px 0}.ontology-badge:hover{background-color:#fff}.expand-onto-list{color:#00827c;font-style:italic}.expand-onto-list:hover{text-decoration-line:underline}.no-decoration{color:#000;text-decoration:none}.highlight{background:#add8e6;border-radius:6px;box-decoration-break:clone;padding:4px 3px 1px}.lineNodeInlet{border-bottom:1px dotted #000;height:13px;top:-1px}.lineAfterNodeInlet,.lineNodeInlet{border-left:1px dotted #000;left:5px;position:absolute;width:12px}.lineAfterNodeInlet{height:calc(100% - 11px);top:12px}.outerLine{border-left:1px dotted #000}.clickable{color:#0645ad}.clickable:hover{text-decoration:underline}.ts4nfdi-autocomplete-style *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-autocomplete-style button{background:none;border:none}.euiComboBoxOptionsList *{background-color:inherit;border:none}.euiComboBoxOptionsList .euiFilterSelectItem{background:none}.euiComboBoxOptionsList__empty{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-autocomplete-breadcrumb button{background:none;border:none}.ts4nfdi-autocomplete-breadcrumb .euiBadge *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-autocomplete-breadcrumb .breadcrumb{border:2px solid transparent;border-radius:6px;padding:3px 3px 0}.ts4nfdi-autocomplete-breadcrumb .clickable-breadcrumb:hover{border:2px solid #000}.ts4nfdi-breadcrumb-style button{background:none;border:none}.ts4nfdi-breadcrumb-style .euiBadge *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-breadcrumb-style .breadcrumb{border:2px solid transparent;border-radius:6px;padding:3px 3px 0}.ts4nfdi-breadcrumb-style .clickable-breadcrumb:hover{border:2px solid #000}.ts4nfdi-hierarchy-style,.ts4nfdi-hierarchy-style button,.ts4nfdi-iri-style *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-hierarchy-style button{background:none;border:none;font-size:inherit;padding:0}.ts4nfdi-hierarchy-style ul{margin-block-start:0;padding-inline-start:0}.ts4nfdi-hierarchy-style div{margin:0!important}.ts4nfdi-metadata-style button{background:none;border:none;font-size:inherit;padding:0}.ts4nfdi-metadata-style button,.ts4nfdi-metadata-style-title{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-metadata-style-title .euiText{font-weight:700}.ts4nfdi-metadata-style-description *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-metadata-style-breadcrumb button{background:none;border:none}.ts4nfdi-metadata-style-breadcrumb .breadcrumb{border:2px solid transparent;border-radius:6px;font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif;padding:3px 3px 0}.ts4nfdi-metadata-style-breadcrumb .clickable-breadcrumb:hover{border:2px solid #000}.ts4nfdi-metadata-style-altNameTab *,.ts4nfdi-metadata-style-crossRef *,.ts4nfdi-metadata-style-hierarchy,.ts4nfdi-metadata-style-hierarchy button,.ts4nfdi-metadata-style-iri *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-metadata-style-hierarchy button{background:none;border:none;font-size:inherit;padding:0}.ts4nfdi-metadata-style-hierarchy ul{margin-block-start:0;padding-inline-start:0}.ts4nfdi-metadata-style-hierarchy div{margin:0!important}.ts4nfdi-metadata-style-entity-defined-by *,.ts4nfdi-metadata-style-entity-defined-by button{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-metadata-style-entity-defined-by button{background:none;border:none}.ts4nfdi-metadata-style-entity-onto-list *,.ts4nfdi-metadata-style-entity-onto-list button{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-metadata-style-entity-onto-list button{background:none;border:none}.euiText p{margin:0 0 10px}.euiCard{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-ontologyy-info-style .euiText p{margin:0 0 10px}.ts4nfdi-ontologyy-info-style .euiCard,.ts4nfdi-resources-style *,.ts4nfdi-searchResult-style *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-searchResult-style button{background:none;border:none}.ts4nfdi-searchResult-style .euiCard{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif;padding-top:0}.ts4nfdi-searchResult-style .euiCard__content div{align-items:baseline;font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-searchResult-style ul{list-style:none}.ts4nfdi-searchResult-style-metadata-compact-description *,.ts4nfdi-searchResult-style-metadata-compact-iri *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-searchResult-style-metadata-compact-breadcrumb button{background:none;border:none}.ts4nfdi-searchResult-style-metadata-compact-breadcrumb .euiBadge *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-searchResult-style-metadata-compact-breadcrumb .breadcrumb{border:2px solid transparent;border-radius:6px;padding:3px 3px 0}.ts4nfdi-searchResult-style-metadata-compact-breadcrumb .clickable-breadcrumb:hover{border:2px solid #000}.ts4nfdi-description-style *,.ts4nfdi-graph-style,.ts4nfdi-graph-style button{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-graph-style button{border:none}.ts4nfdi-tab-style button{background:none;border:none}.ts4nfdi-tab-style-altNameTab *,.ts4nfdi-tab-style-crossRef *,.ts4nfdi-tab-style-hierarchy,.ts4nfdi-tab-style-hierarchy button{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-tab-style-hierarchy button{background:none;border:none;font-size:inherit;padding:0}.ts4nfdi-tab-style-hierarchy ul{margin-block-start:0;padding-inline-start:0}.ts4nfdi-tab-style-hierarchy div{margin:0!important}.ts4nfdi-altNameTab-style *,.ts4nfdi-crossRef-style *,.ts4nfdi-entity-defined-by-style *,.ts4nfdi-entity-defined-by-style button,.ts4nfdi-title-style *{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-entity-defined-by-style button{background:none;border:none}.ts4nfdi-entity-onto-list-style *,.ts4nfdi-entity-onto-list-style button{font-family:Inter,BlinkMacSystemFont,Helvetica,Arial,sans-serif}.ts4nfdi-entity-onto-list-style button{background:none;border:none}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts4nfdi/terminology-service-suite",
3
- "version": "5.6.0",
3
+ "version": "5.6.2",
4
4
  "description": "This project includes a widget component library derived from the semantic lookup service SemLookP. The Terminology Service is a repository for biomedical resources that aims to provide a single point of access to the latest ontology and terminology versions. User interface (UI) functionalities were extracted and implemented as separate widgets to allow integration into other 3rd party services, thus simplifying the development of user interfaces and the visualization of semantic information. The widgets are built with React and TypeScript and can be used in React applications. SemLookP and the widgets are based on the Ontology Lookup Service (OLS), software developed by EBI.",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -15,12 +15,12 @@
15
15
  "exports": {
16
16
  ".": {
17
17
  "import": "./dist/esm/index.js",
18
- "types": "./dist/types/index.d.ts",
18
+ "types": "./dist/esm/index.d.ts",
19
19
  "default": "./dist/esm/index.js"
20
20
  },
21
21
  "./server": {
22
22
  "import": "./dist/server/index.js",
23
- "types": "./dist/types/components/server/index.d.ts",
23
+ "types": "./dist/esm/components/server/index.d.ts",
24
24
  "default": "./dist/server/index.js"
25
25
  },
26
26
  "./dist/esm/index.css": {
@@ -46,7 +46,7 @@
46
46
  "lint:check": "npx eslint ./src --ext js,jsx,ts,tsx",
47
47
  "lint:fix": "npx eslint ./src --ext js,jsx,ts,tsx --fix"
48
48
  },
49
- "types": "dist/types/index.d.ts",
49
+ "types": "dist/esm/index.d.ts",
50
50
  "author": "TS4NFDI",
51
51
  "license": "MIT",
52
52
  "devDependencies": {