@ts4nfdi/terminology-service-suite 5.5.2 → 5.6.1

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 (37) hide show
  1. package/dist/esm/api/ols/OlsHierarchyApi.d.ts +1 -0
  2. package/dist/esm/api/ols/OlsHierarchyApi.js +1 -0
  3. package/dist/esm/api/ols/OlsHierarchyApi.js.map +1 -1
  4. package/dist/esm/app/types.d.ts +6 -0
  5. package/dist/esm/components/widgets/AutocompleteWidget/AutocompleteWidget.js +32 -14
  6. package/dist/esm/components/widgets/AutocompleteWidget/AutocompleteWidget.js.map +1 -1
  7. package/dist/esm/components/widgets/AutocompleteWidget/AutocompleteWidget.stories.d.ts +1 -0
  8. package/dist/esm/components/widgets/AutocompleteWidget/AutocompleteWidgetStories.d.ts +1 -0
  9. package/dist/esm/components/widgets/MetadataWidget/MetadataWidget.js +1 -1
  10. package/dist/esm/components/widgets/MetadataWidget/MetadataWidget.js.map +1 -1
  11. package/dist/esm/components/widgets/MetadataWidget/MetadataWidget.stories.d.ts +37 -0
  12. package/dist/esm/components/widgets/MetadataWidget/MetadataWidgetHTML.stories.d.ts +37 -0
  13. package/dist/esm/components/widgets/MetadataWidget/MetadataWidgetStories.d.ts +38 -0
  14. package/dist/esm/components/widgets/MetadataWidget/TabWidget/HierarchyWidget/HierarchyWidget.d.ts +1 -1
  15. package/dist/esm/components/widgets/MetadataWidget/TabWidget/HierarchyWidget/HierarchyWidget.js +44 -61
  16. package/dist/esm/components/widgets/MetadataWidget/TabWidget/HierarchyWidget/HierarchyWidget.js.map +1 -1
  17. package/dist/esm/components/widgets/MetadataWidget/TabWidget/HierarchyWidget/HierarchyWidget.stories.d.ts +10 -0
  18. package/dist/esm/components/widgets/MetadataWidget/TabWidget/HierarchyWidget/HierarchyWidgetStories.d.ts +10 -0
  19. package/dist/esm/components/widgets/MetadataWidget/TabWidget/HierarchyWidget/HierarchyWidgetsHTML.stories.d.ts +11 -1
  20. package/dist/esm/components/widgets/MetadataWidget/TabWidget/TabPresentation.js +1 -1
  21. package/dist/esm/components/widgets/MetadataWidget/TabWidget/TabPresentation.js.map +1 -1
  22. package/dist/esm/index.css +1 -1
  23. package/dist/esm/stories/storyArgs.d.ts +44 -0
  24. package/dist/server/api/ols/OlsHierarchyApi.d.ts +1 -0
  25. package/dist/server/app/types.d.ts +6 -0
  26. package/dist/server/components/widgets/AutocompleteWidget/AutocompleteWidget.stories.d.ts +1 -0
  27. package/dist/server/components/widgets/AutocompleteWidget/AutocompleteWidgetStories.d.ts +1 -0
  28. package/dist/server/components/widgets/MetadataWidget/MetadataWidget.stories.d.ts +37 -0
  29. package/dist/server/components/widgets/MetadataWidget/MetadataWidgetHTML.stories.d.ts +37 -0
  30. package/dist/server/components/widgets/MetadataWidget/MetadataWidgetStories.d.ts +38 -0
  31. package/dist/server/components/widgets/MetadataWidget/TabWidget/HierarchyWidget/HierarchyWidget.d.ts +1 -1
  32. package/dist/server/components/widgets/MetadataWidget/TabWidget/HierarchyWidget/HierarchyWidget.stories.d.ts +10 -0
  33. package/dist/server/components/widgets/MetadataWidget/TabWidget/HierarchyWidget/HierarchyWidgetStories.d.ts +10 -0
  34. package/dist/server/components/widgets/MetadataWidget/TabWidget/HierarchyWidget/HierarchyWidgetsHTML.stories.d.ts +11 -1
  35. package/dist/server/index.css +1 -1
  36. package/dist/server/stories/storyArgs.d.ts +44 -0
  37. package/package.json +1 -1
@@ -11,6 +11,7 @@ export declare const HIERARCHY_WIDGET_DEFAULT_VALUES: {
11
11
  readonly KEEP_EXPANSION_STATES: false;
12
12
  readonly SHOW_SIBLINGS_ON_INIT: false;
13
13
  readonly USE_LEGACY: false;
14
+ readonly WRAP: false;
14
15
  };
15
16
  export declare class OlsHierarchyApi implements HierarchyBuilder {
16
17
  protected axiosInstance: AxiosInstance;
@@ -14,6 +14,7 @@ const HIERARCHY_WIDGET_DEFAULT_VALUES = {
14
14
  KEEP_EXPANSION_STATES: false,
15
15
  SHOW_SIBLINGS_ON_INIT: false,
16
16
  USE_LEGACY: false,
17
+ WRAP: false,
17
18
  };
18
19
  class OlsHierarchyApi {
19
20
  axiosInstance;
@@ -1 +1 @@
1
- {"version":3,"file":"OlsHierarchyApi.js","sources":["../../../../../src/api/ols/OlsHierarchyApi.ts"],"sourcesContent":["import {\n classTypeNames,\n EntityTypeName,\n isClassTypeName,\n isIndividualTypeName,\n} from \"../../model/ModelTypeCheck\";\nimport { Entity } from \"../../model/interfaces\";\nimport {\n asArray,\n getEntityInOntologySuffix,\n getUseLegacy,\n pluralizeType,\n} from \"../../app/util\";\nimport {\n buildOtherParams,\n check_for_errors,\n isTop,\n} from \"../../utils/olsApiUtils\";\nimport { createModelObject } from \"../../model/ModelObjectCreator\";\nimport { JSTreeNode } from \"../../utils/olsApiTypes\";\nimport {\n BuildHierarchyProps,\n HierarchyBuilder,\n HierarchyIriProp,\n LoadHierarchyChildrenProps,\n} from \"../HierarchyBuilder\";\nimport {\n Hierarchy,\n ParentChildRelation,\n TreeNode,\n} from \"../../model/interfaces/Hierarchy\";\nimport { EntityData } from \"../../app\";\nimport Reified from \"../../model/Reified\";\nimport axios, { AxiosInstance, AxiosRequestConfig } from \"axios\";\nimport { OlsEntityApi } from \"./OlsEntityApi\";\nimport { OlsOntologyApi } from \"./OlsOntologyApi\";\n\nexport const HIERARCHY_WIDGET_DEFAULT_VALUES = {\n INCLUDE_OBSOLETE_ENTITIES: false,\n PREFERRED_ROOTS: false,\n KEEP_EXPANSION_STATES: false,\n SHOW_SIBLINGS_ON_INIT: false,\n USE_LEGACY: false,\n} as const;\n\nexport class OlsHierarchyApi implements HierarchyBuilder {\n protected axiosInstance: AxiosInstance;\n private entityService: OlsEntityApi;\n private ontologyService: OlsOntologyApi;\n\n constructor(api: string | AxiosInstance) {\n this.axiosInstance =\n typeof api === \"string\"\n ? axios.create({\n baseURL: api,\n headers: { Accept: \"application/json\" },\n })\n : api;\n this.entityService = new OlsEntityApi(this.axiosInstance);\n this.ontologyService = new OlsOntologyApi(this.axiosInstance);\n }\n\n protected async makeCall(\n url: string,\n config: AxiosRequestConfig<any> | undefined,\n useLegacy: boolean,\n ) {\n const apiVersionPrefix = getUseLegacy(useLegacy) ? \"\" : \"v2/\";\n const response = (\n await this.axiosInstance.get(apiVersionPrefix + url, config)\n ).data;\n return check_for_errors(response);\n }\n\n public async getAncestors(\n iri: string,\n entityType: EntityTypeName,\n ontologyId: string,\n useLegacy = false,\n includeObsoleteEntities = false,\n parameter: string | undefined,\n ): Promise<Entity[]> {\n let ancestors: any;\n if (isClassTypeName(entityType)) {\n ancestors = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n entityType,\n iri,\n useLegacy,\n )}/hierarchicalAncestors`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n } else {\n ancestors = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n entityType,\n iri,\n useLegacy,\n )}/ancestors`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n }\n if (useLegacy) {\n const listOfAncestorObj: Array<Entity> = [];\n let extractKey = \"\";\n switch (entityType) {\n case \"class\":\n extractKey = \"terms\";\n break;\n case \"term\":\n extractKey = \"terms\";\n break;\n case \"property\":\n extractKey = \"properties\";\n break;\n case \"individual\":\n extractKey = \"individuals\";\n break;\n default:\n throw Error(\"Entity type could not be correctly inferred.\");\n }\n ancestors[\"_embedded\"][extractKey].map((obj: any) => {\n listOfAncestorObj.push(\n createModelObject({ _embedded: { [extractKey]: [obj] } }) as Entity,\n );\n });\n return listOfAncestorObj;\n }\n return ancestors[\"elements\"].map(\n (obj: any) => createModelObject({ elements: [obj] }) as Entity,\n );\n }\n\n public async getJSTree(\n iri: string,\n entityType: EntityTypeName,\n ontologyId: string,\n parameter: string | undefined,\n ): Promise<JSTreeNode[]> {\n return await this.makeCall(\n `${getEntityInOntologySuffix(ontologyId, entityType, iri, true)}/jstree`,\n {\n params: {\n size: \"1000\",\n viewMode: \"All\",\n ...buildOtherParams(parameter),\n },\n },\n true,\n );\n }\n\n // TODO: Do we want the same behavior as EMBL EBI (e.g. not getting instances for classes if entityType != \"individual\")?\n public async getChildren(\n iri: string,\n entityType: EntityTypeName,\n ontologyId: string,\n includeObsoleteEntities = false,\n useLegacy = false,\n parameter: string,\n ): Promise<Entity[]> {\n let children: any;\n if (isClassTypeName(entityType)) {\n children = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n classTypeNames[0],\n iri,\n useLegacy,\n )}/hierarchicalChildren`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n } else if (isIndividualTypeName(entityType)) {\n // entityType does NOT indicate which type the entity of the provided iri has, but which type of hierarchy is desired\n // -> \"class\" has to be provided for individual hierarchy as well, as individuals are always children of classes\n if (useLegacy) {\n // TODO: Does descendants always work for this (or are there classes with both individuals and classes as descendants)?\n children = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n classTypeNames[0],\n iri,\n useLegacy,\n )}/descendants`,\n {\n params: {\n size: \"1000\",\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n } else {\n children = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n classTypeNames[0],\n iri,\n useLegacy,\n )}/instances`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n }\n } else {\n children = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n entityType,\n iri,\n useLegacy,\n )}/children`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n }\n\n if (useLegacy) {\n return children[\"_embedded\"][\n isIndividualTypeName(entityType)\n ? pluralizeType(classTypeNames[0], useLegacy)\n : pluralizeType(entityType, useLegacy)\n ].map(\n (obj: any) =>\n createModelObject({\n [\"_embedded\"]: {\n [isIndividualTypeName(entityType)\n ? pluralizeType(classTypeNames[0], useLegacy)\n : pluralizeType(entityType)]: [obj],\n },\n }) as Entity,\n );\n } else {\n return children[\"elements\"].map(\n (obj: any) => createModelObject({ elements: [obj] }) as Entity,\n );\n }\n }\n\n public async getRootEntities(\n entityType: EntityTypeName,\n ontologyId: string,\n preferredRoots = false,\n includeObsoleteEntities = false,\n useLegacy = false,\n parameter = \"\",\n ): Promise<Entity[]> {\n if (useLegacy) {\n if (isIndividualTypeName(entityType)) {\n // TODO: Implement behaviour for individuals\n return [];\n } else {\n // TODO: /preferredRoots route should exist in legacy api, but does not work\n const roots = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n entityType,\n undefined,\n useLegacy,\n )}/roots`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n\n return roots[\"_embedded\"][pluralizeType(entityType, useLegacy)].map(\n (obj: any) =>\n createModelObject({\n [\"_embedded\"]: { [pluralizeType(entityType, useLegacy)]: [obj] },\n }) as Entity,\n );\n }\n } else {\n if (isIndividualTypeName(entityType)) {\n // TODO: Implement behaviour for individuals\n return [];\n } else {\n const roots = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n entityType,\n undefined,\n useLegacy,\n )}`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n hasDirectParents: preferredRoots ? undefined : \"false\",\n isPreferredRoot: preferredRoots ? \"true\" : undefined,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n\n return roots[\"elements\"].map(\n (obj: any) => createModelObject({ elements: [obj] }) as Entity,\n );\n }\n }\n }\n\n public async buildHierarchyWithIri(\n props: BuildHierarchyProps & HierarchyIriProp,\n ): Promise<Hierarchy> {\n const {\n iri,\n ontologyId,\n entityType,\n preferredRoots = false,\n includeObsoleteEntities = false,\n keepExpansionStates = true,\n showSiblingsOnInit = false,\n useLegacy = false,\n parameter,\n } = props;\n\n if (iri) {\n return await this.entityService\n .getEntityObject(iri, entityType, ontologyId, parameter, useLegacy)\n .then((entity) =>\n this.buildHierarchyWithEntity({\n entityType: entityType || (entity.getType() as EntityTypeName),\n ontologyId: ontologyId || entity.getOntologyId(),\n includeObsoleteEntities: includeObsoleteEntities,\n preferredRoots: preferredRoots,\n mainEntity: entity,\n keepExpansionStates: keepExpansionStates,\n showSiblingsOnInit: showSiblingsOnInit,\n useLegacy: useLegacy,\n parameter: parameter,\n }),\n );\n } else {\n if (entityType == undefined || ontologyId == undefined)\n throw Error(\n \"Either iri or ontologyId and entityType have to be provided.\",\n );\n return await this.buildRootHierarchy({\n entityType: entityType,\n ontologyId: ontologyId,\n includeObsoleteEntities: includeObsoleteEntities,\n preferredRoots: preferredRoots,\n keepExpansionStates: keepExpansionStates,\n showSiblingsOnInit: showSiblingsOnInit,\n useLegacy: useLegacy,\n parameter: parameter,\n });\n }\n }\n\n public jsTreeNodeToEntityData(jsTreeNode: JSTreeNode): EntityData {\n return {\n iri: jsTreeNode.iri,\n label: jsTreeNode.text,\n hasChildren: jsTreeNode.children || jsTreeNode.state.opened,\n parents: [],\n };\n }\n\n public entityToEntityData(entity: Entity): EntityData {\n return {\n iri: entity.getIri(),\n label: asArray(entity.getLabel())[0],\n definedBy: entity.getDefinedBy(),\n hasChildren: entity.hasChildren(),\n numDescendants:\n entity.getNumHierarchicalDescendants() || entity.getNumDescendants(),\n parents: entity.getParents(),\n };\n }\n\n public async buildRootHierarchy(\n props: {\n ontologyId: string;\n entityType: EntityTypeName;\n } & BuildHierarchyProps,\n ): Promise<Hierarchy> {\n const {\n ontologyId,\n entityType,\n preferredRoots,\n includeObsoleteEntities,\n useLegacy = HIERARCHY_WIDGET_DEFAULT_VALUES.USE_LEGACY,\n parameter,\n } = props;\n\n /* QUERY root entities */\n const rootEntitiesData = (\n await this.getRootEntities(\n entityType,\n ontologyId,\n preferredRoots,\n includeObsoleteEntities,\n useLegacy,\n parameter,\n )\n )\n .map((entity) => this.entityToEntityData(entity))\n .filter((root) => !isTop(root.iri));\n /* --- */\n\n /* INITIALIZE entitiesData, parentChildRelations */\n const parentChildRelations: Map<string, ParentChildRelation[]> = new Map<\n string,\n ParentChildRelation[]\n >();\n const entitiesData: Map<string, EntityData> = new Map<string, EntityData>();\n for (const entityData of rootEntitiesData) {\n parentChildRelations.set(entityData.iri, []); // initialize with empty array\n entitiesData.set(entityData.iri, entityData);\n }\n /* --- */\n\n return new Hierarchy({\n parentChildRelations: parentChildRelations,\n entitiesData: entitiesData,\n allChildrenPresent: new Set(),\n roots: rootEntitiesData\n .map((root) => new TreeNode(root))\n .sort((a, b) =>\n (a.entityData.label || a.entityData.iri).localeCompare(\n b.entityData.label || b.entityData.iri,\n ),\n ),\n api: new OlsHierarchyApi(this.axiosInstance.getUri()),\n ontologyId: ontologyId,\n includeObsoleteEntities: includeObsoleteEntities,\n entityType: entityType,\n keepExpansionStates: props.keepExpansionStates,\n useLegacy: useLegacy,\n parameter: parameter,\n });\n }\n\n public async buildHierarchyWithEntity(\n props: {\n mainEntity: Entity;\n ontologyId: string;\n entityType: EntityTypeName;\n } & BuildHierarchyProps,\n ): Promise<Hierarchy> {\n const {\n mainEntity,\n ontologyId,\n entityType,\n preferredRoots,\n includeObsoleteEntities = HIERARCHY_WIDGET_DEFAULT_VALUES.INCLUDE_OBSOLETE_ENTITIES,\n showSiblingsOnInit,\n useLegacy = HIERARCHY_WIDGET_DEFAULT_VALUES.USE_LEGACY,\n parameter,\n } = props;\n\n /* LOAD ancestors */\n let entities: EntityData[] = [];\n\n if (useLegacy) {\n // TODO: JSTree sometimes returns smaller trees than would be possible via querying hierarchical ancestors and all children of those (e.g. http://purl.obolibrary.org/obo/UBERON_2001747 -> strange and not really useful hierarchy because many entities are both sibling and children of other entities (is it wrong to take hierarchicalParent instead of directParent in entityToEntityDataToHierarchy? EMBL-EBI does it like that as well))\n // Question: Should we prefer complete hierarchies (query /hierarchicalAncestors + /children for each) or slim queries (query /jstree)?\n const jsTree = await this.getJSTree(\n mainEntity.getIri(),\n entityType,\n ontologyId,\n parameter,\n );\n const idToIri: Map<string, string> = new Map<string, string>();\n const parents: Map<string, Set<string>> = new Map<string, Set<string>>();\n\n for (const jsTreeNode of jsTree) {\n idToIri.set(jsTreeNode.id, jsTreeNode.iri);\n parents.set(jsTreeNode.iri, new Set<string>());\n }\n\n for (const jsTreeNode of jsTree) {\n const parArr = parents.get(jsTreeNode.iri);\n const parIri = idToIri.get(jsTreeNode.parent);\n if (parArr != undefined && parIri != undefined) {\n parArr.add(parIri);\n }\n }\n\n entities = [];\n const inArr = new Set<string>();\n\n for (const jsTreeNode of jsTree) {\n if (!inArr.has(jsTreeNode.iri)) {\n inArr.add(jsTreeNode.iri);\n\n entities.push(this.jsTreeNodeToEntityData(jsTreeNode));\n const par = parents.get(jsTreeNode.iri);\n if (par != undefined)\n entities[entities.length - 1].parents =\n Reified.fromJson(Array.from(par.values())) || [];\n }\n }\n } else {\n const ancestors = await this.getAncestors(\n mainEntity.getIri(),\n entityType,\n ontologyId || mainEntity.getOntologyId(),\n useLegacy,\n includeObsoleteEntities,\n parameter,\n );\n entities = [\n this.entityToEntityData(mainEntity),\n ...ancestors.map((entity) => this.entityToEntityData(entity)),\n ];\n }\n\n // filter top entities\n entities = entities.filter((e) => !isTop(e.iri));\n /* --- */\n\n /* BUILD parentChildRelations */\n const parentChildRelations: Map<string, ParentChildRelation[]> = new Map<\n string,\n ParentChildRelation[]\n >();\n const allChildrenPresent: Set<string> = new Set<string>();\n const entitiesData: Map<string, EntityData> = new Map<string, EntityData>();\n\n // initialize parentChildRelations & entitiesData\n for (const entityData of entities) {\n parentChildRelations.set(entityData.iri, []); // initialize with empty array\n entitiesData.set(entityData.iri, entityData);\n }\n\n if (showSiblingsOnInit) {\n // additionally load siblings from api\n const realEntityType = entityType || mainEntity.getType();\n const entityTypeForQuery =\n realEntityType == \"individual\" ? \"class\" : realEntityType; // TODO: only relevant for entityType == \"individual\" (maybe we don't even need this as behaviour for individual hierarchies is not yet determined)\n\n const promises: Promise<void>[] = [];\n for (const entityData of entities) {\n if (entityData.iri != mainEntity.getIri()) {\n promises.push(\n new Promise((resolve) =>\n this.getChildren(\n entityData.iri,\n entityTypeForQuery,\n ontologyId,\n includeObsoleteEntities,\n useLegacy,\n parameter || \"\",\n )\n .then((children) =>\n children.map((child) => this.entityToEntityData(child)),\n )\n .then((children) => {\n const parChildRel: ParentChildRelation[] = [];\n for (const child of children) {\n entitiesData.set(child.iri, child);\n if (child.parents) {\n const parRelation = child.parents.filter(\n (par) => par.value == entityData.iri,\n );\n parChildRel.push({\n childIri: child.iri,\n childRelationToParent:\n parRelation.length > 0 && parRelation[0].getMetadata()\n ? parRelation[0].getMetadata()[\n \"childRelationToParent\"\n ]\n : undefined,\n });\n } // should have exactly one element\n }\n\n parentChildRelations.set(entityData.iri, parChildRel);\n allChildrenPresent.add(entityData.iri);\n })\n .then(resolve),\n ),\n );\n }\n }\n\n await Promise.allSettled(promises);\n\n // TODO: only relevant for entityType == \"individual\" (maybe we don't even need this as behaviour for individual hierarchies is not yet determined)\n if (realEntityType == \"individual\") {\n for (const parentReified of mainEntity.getParents()) {\n const children = (\n await this.getChildren(\n parentReified.value,\n realEntityType,\n ontologyId,\n includeObsoleteEntities,\n useLegacy,\n parameter || \"\",\n )\n ).map((child) => this.entityToEntityData(child));\n\n const parChildRel: ParentChildRelation[] = [];\n for (const child of children) {\n parChildRel.push({\n childIri: child.iri,\n childRelationToParent:\n \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\",\n });\n }\n parentChildRelations.set(parentReified.value, parChildRel);\n }\n }\n } else {\n for (const entityData of entities) {\n if (entityData.parents) {\n const parents = entityData.parents.filter(\n (parentReified: Reified<string>) => !isTop(parentReified.value),\n );\n if (\n entityData.iri == mainEntity?.getIri() &&\n isIndividualTypeName(entityType || mainEntity.getType())\n ) {\n for (const parentReified of parents) {\n if (parentChildRelations.has(parentReified.value)) {\n parentChildRelations.get(parentReified.value)?.push({\n childIri: entityData.iri,\n childRelationToParent:\n \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\",\n });\n }\n }\n } else {\n for (const parentReified of parents) {\n if (parentChildRelations.has(parentReified.value)) {\n parentChildRelations.get(parentReified.value)?.push({\n childIri: entityData.iri,\n childRelationToParent: parentReified.getMetadata()\n ? parentReified.getMetadata()[\"childRelationToParent\"]\n : undefined,\n });\n }\n }\n }\n }\n }\n }\n\n // sort parentChildRelations\n for (const rel of parentChildRelations.values())\n rel.sort((a, b) =>\n (entitiesData.get(a.childIri)?.label || a.childIri).localeCompare(\n entitiesData.get(b.childIri)?.label || b.childIri,\n ),\n );\n /* --- */\n\n /* BUILD rootEntities */\n const rootEntities: string[] = [];\n if (preferredRoots) {\n const preferredRootEntities = (\n await this.ontologyService.getOntologyObject(\n ontologyId,\n undefined,\n useLegacy,\n )\n ).getPreferredRoots();\n for (const e of preferredRootEntities) {\n if (entitiesData.has(e)) rootEntities.push(e);\n }\n } else {\n for (const entityData of entities) {\n if (entityData.parents) {\n const parents = entityData.parents.filter(\n (parentReified: Reified<string>) => !isTop(parentReified.value),\n );\n if (parents.length == 0) rootEntities.push(entityData.iri);\n }\n }\n }\n\n /* --- */\n\n function createTreeNode(\n entityData: EntityData,\n cycleCheck: Set<string>,\n childRelationToParent?: string,\n ): TreeNode {\n cycleCheck.add(entityData.iri); // add current entity to cycle check set\n\n const node = new TreeNode(entityData);\n node.childRelationToParent = childRelationToParent;\n const children = parentChildRelations.get(entityData.iri) || [];\n\n for (const child of children) {\n if (cycleCheck.has(child.childIri)) {\n // cyclic tree, skip cycle\n console.error(`Cyclic tree at entity \"${child.childIri}\".`);\n continue;\n }\n\n const childData = entitiesData.get(child.childIri);\n if (childData != undefined)\n node.addChild(\n createTreeNode(childData, cycleCheck, child.childRelationToParent),\n );\n }\n\n if (node.loadedChildren.length > 0) node.expanded = true;\n\n cycleCheck.delete(entityData.iri);\n return node;\n }\n\n const cycleCheck: Set<string> = new Set<string>(); // Contains iris of all entities that have occurred within the current recursion branch. Is used to check for cycles.\n\n return new Hierarchy({\n parentChildRelations: parentChildRelations,\n entitiesData: entitiesData,\n allChildrenPresent: allChildrenPresent,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n roots: rootEntities\n .map((rootEntity) =>\n createTreeNode(entitiesData.get(rootEntity)!, cycleCheck),\n )\n .sort((a, b) =>\n (a.entityData.label || a.entityData.iri).localeCompare(\n b.entityData.label || b.entityData.iri,\n ),\n ),\n api: new OlsHierarchyApi(this.axiosInstance.getUri()),\n ontologyId: ontologyId,\n includeObsoleteEntities: includeObsoleteEntities,\n entityType: entityType,\n mainEntityIri: mainEntity?.getIri(),\n keepExpansionStates: props.keepExpansionStates,\n useLegacy: useLegacy,\n parameter: parameter,\n });\n }\n\n public async loadHierarchyChildren(\n props: LoadHierarchyChildrenProps,\n ): Promise<EntityData[]> {\n if (props.entityType == undefined)\n throw Error(\"EntityType has to be provided to load children in OLS.\");\n\n return (\n await this.getChildren(\n props.nodeToExpand.entityData.iri,\n props.entityType,\n props.ontologyId,\n props.includeObsoleteEntities,\n props.useLegacy,\n props.parameter || \"\",\n )\n ).map((entity) => this.entityToEntityData(entity));\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAqCa,MAAA,+BAA+B,GAAG;AAC7C,IAAA,yBAAyB,EAAE,KAAK;AAChC,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,qBAAqB,EAAE,KAAK;AAC5B,IAAA,qBAAqB,EAAE,KAAK;AAC5B,IAAA,UAAU,EAAE,KAAK;EACR;MAEE,eAAe,CAAA;AAChB,IAAA,aAAa,CAAgB;AAC/B,IAAA,aAAa,CAAe;AAC5B,IAAA,eAAe,CAAiB;AAExC,IAAA,WAAA,CAAY,GAA2B,EAAA;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AAC,SAAS,IAAI,EAAE,CACtB,EACD,GAAG,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;KACpD;AACF;;;;"}
1
+ {"version":3,"file":"OlsHierarchyApi.js","sources":["../../../../../src/api/ols/OlsHierarchyApi.ts"],"sourcesContent":["import {\n classTypeNames,\n EntityTypeName,\n isClassTypeName,\n isIndividualTypeName,\n} from \"../../model/ModelTypeCheck\";\nimport { Entity } from \"../../model/interfaces\";\nimport {\n asArray,\n getEntityInOntologySuffix,\n getUseLegacy,\n pluralizeType,\n} from \"../../app/util\";\nimport {\n buildOtherParams,\n check_for_errors,\n isTop,\n} from \"../../utils/olsApiUtils\";\nimport { createModelObject } from \"../../model/ModelObjectCreator\";\nimport { JSTreeNode } from \"../../utils/olsApiTypes\";\nimport {\n BuildHierarchyProps,\n HierarchyBuilder,\n HierarchyIriProp,\n LoadHierarchyChildrenProps,\n} from \"../HierarchyBuilder\";\nimport {\n Hierarchy,\n ParentChildRelation,\n TreeNode,\n} from \"../../model/interfaces/Hierarchy\";\nimport { EntityData } from \"../../app\";\nimport Reified from \"../../model/Reified\";\nimport axios, { AxiosInstance, AxiosRequestConfig } from \"axios\";\nimport { OlsEntityApi } from \"./OlsEntityApi\";\nimport { OlsOntologyApi } from \"./OlsOntologyApi\";\n\nexport const HIERARCHY_WIDGET_DEFAULT_VALUES = {\n INCLUDE_OBSOLETE_ENTITIES: false,\n PREFERRED_ROOTS: false,\n KEEP_EXPANSION_STATES: false,\n SHOW_SIBLINGS_ON_INIT: false,\n USE_LEGACY: false,\n WRAP: false,\n} as const;\n\nexport class OlsHierarchyApi implements HierarchyBuilder {\n protected axiosInstance: AxiosInstance;\n private entityService: OlsEntityApi;\n private ontologyService: OlsOntologyApi;\n\n constructor(api: string | AxiosInstance) {\n this.axiosInstance =\n typeof api === \"string\"\n ? axios.create({\n baseURL: api,\n headers: { Accept: \"application/json\" },\n })\n : api;\n this.entityService = new OlsEntityApi(this.axiosInstance);\n this.ontologyService = new OlsOntologyApi(this.axiosInstance);\n }\n\n protected async makeCall(\n url: string,\n config: AxiosRequestConfig<any> | undefined,\n useLegacy: boolean,\n ) {\n const apiVersionPrefix = getUseLegacy(useLegacy) ? \"\" : \"v2/\";\n const response = (\n await this.axiosInstance.get(apiVersionPrefix + url, config)\n ).data;\n return check_for_errors(response);\n }\n\n public async getAncestors(\n iri: string,\n entityType: EntityTypeName,\n ontologyId: string,\n useLegacy = false,\n includeObsoleteEntities = false,\n parameter: string | undefined,\n ): Promise<Entity[]> {\n let ancestors: any;\n if (isClassTypeName(entityType)) {\n ancestors = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n entityType,\n iri,\n useLegacy,\n )}/hierarchicalAncestors`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n } else {\n ancestors = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n entityType,\n iri,\n useLegacy,\n )}/ancestors`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n }\n if (useLegacy) {\n const listOfAncestorObj: Array<Entity> = [];\n let extractKey = \"\";\n switch (entityType) {\n case \"class\":\n extractKey = \"terms\";\n break;\n case \"term\":\n extractKey = \"terms\";\n break;\n case \"property\":\n extractKey = \"properties\";\n break;\n case \"individual\":\n extractKey = \"individuals\";\n break;\n default:\n throw Error(\"Entity type could not be correctly inferred.\");\n }\n ancestors[\"_embedded\"][extractKey].map((obj: any) => {\n listOfAncestorObj.push(\n createModelObject({ _embedded: { [extractKey]: [obj] } }) as Entity,\n );\n });\n return listOfAncestorObj;\n }\n return ancestors[\"elements\"].map(\n (obj: any) => createModelObject({ elements: [obj] }) as Entity,\n );\n }\n\n public async getJSTree(\n iri: string,\n entityType: EntityTypeName,\n ontologyId: string,\n parameter: string | undefined,\n ): Promise<JSTreeNode[]> {\n return await this.makeCall(\n `${getEntityInOntologySuffix(ontologyId, entityType, iri, true)}/jstree`,\n {\n params: {\n size: \"1000\",\n viewMode: \"All\",\n ...buildOtherParams(parameter),\n },\n },\n true,\n );\n }\n\n // TODO: Do we want the same behavior as EMBL EBI (e.g. not getting instances for classes if entityType != \"individual\")?\n public async getChildren(\n iri: string,\n entityType: EntityTypeName,\n ontologyId: string,\n includeObsoleteEntities = false,\n useLegacy = false,\n parameter: string,\n ): Promise<Entity[]> {\n let children: any;\n if (isClassTypeName(entityType)) {\n children = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n classTypeNames[0],\n iri,\n useLegacy,\n )}/hierarchicalChildren`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n } else if (isIndividualTypeName(entityType)) {\n // entityType does NOT indicate which type the entity of the provided iri has, but which type of hierarchy is desired\n // -> \"class\" has to be provided for individual hierarchy as well, as individuals are always children of classes\n if (useLegacy) {\n // TODO: Does descendants always work for this (or are there classes with both individuals and classes as descendants)?\n children = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n classTypeNames[0],\n iri,\n useLegacy,\n )}/descendants`,\n {\n params: {\n size: \"1000\",\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n } else {\n children = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n classTypeNames[0],\n iri,\n useLegacy,\n )}/instances`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n }\n } else {\n children = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n entityType,\n iri,\n useLegacy,\n )}/children`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n }\n\n if (useLegacy) {\n return children[\"_embedded\"][\n isIndividualTypeName(entityType)\n ? pluralizeType(classTypeNames[0], useLegacy)\n : pluralizeType(entityType, useLegacy)\n ].map(\n (obj: any) =>\n createModelObject({\n [\"_embedded\"]: {\n [isIndividualTypeName(entityType)\n ? pluralizeType(classTypeNames[0], useLegacy)\n : pluralizeType(entityType)]: [obj],\n },\n }) as Entity,\n );\n } else {\n return children[\"elements\"].map(\n (obj: any) => createModelObject({ elements: [obj] }) as Entity,\n );\n }\n }\n\n public async getRootEntities(\n entityType: EntityTypeName,\n ontologyId: string,\n preferredRoots = false,\n includeObsoleteEntities = false,\n useLegacy = false,\n parameter = \"\",\n ): Promise<Entity[]> {\n if (useLegacy) {\n if (isIndividualTypeName(entityType)) {\n // TODO: Implement behaviour for individuals\n return [];\n } else {\n // TODO: /preferredRoots route should exist in legacy api, but does not work\n const roots = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n entityType,\n undefined,\n useLegacy,\n )}/roots`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n\n return roots[\"_embedded\"][pluralizeType(entityType, useLegacy)].map(\n (obj: any) =>\n createModelObject({\n [\"_embedded\"]: { [pluralizeType(entityType, useLegacy)]: [obj] },\n }) as Entity,\n );\n }\n } else {\n if (isIndividualTypeName(entityType)) {\n // TODO: Implement behaviour for individuals\n return [];\n } else {\n const roots = await this.makeCall(\n `${getEntityInOntologySuffix(\n ontologyId,\n entityType,\n undefined,\n useLegacy,\n )}`,\n {\n params: {\n size: \"1000\",\n includeObsoleteEntities: includeObsoleteEntities,\n hasDirectParents: preferredRoots ? undefined : \"false\",\n isPreferredRoot: preferredRoots ? \"true\" : undefined,\n ...buildOtherParams(parameter),\n },\n },\n useLegacy,\n );\n\n return roots[\"elements\"].map(\n (obj: any) => createModelObject({ elements: [obj] }) as Entity,\n );\n }\n }\n }\n\n public async buildHierarchyWithIri(\n props: BuildHierarchyProps & HierarchyIriProp,\n ): Promise<Hierarchy> {\n const {\n iri,\n ontologyId,\n entityType,\n preferredRoots = false,\n includeObsoleteEntities = false,\n keepExpansionStates = true,\n showSiblingsOnInit = false,\n useLegacy = false,\n parameter,\n } = props;\n\n if (iri) {\n return await this.entityService\n .getEntityObject(iri, entityType, ontologyId, parameter, useLegacy)\n .then((entity) =>\n this.buildHierarchyWithEntity({\n entityType: entityType || (entity.getType() as EntityTypeName),\n ontologyId: ontologyId || entity.getOntologyId(),\n includeObsoleteEntities: includeObsoleteEntities,\n preferredRoots: preferredRoots,\n mainEntity: entity,\n keepExpansionStates: keepExpansionStates,\n showSiblingsOnInit: showSiblingsOnInit,\n useLegacy: useLegacy,\n parameter: parameter,\n }),\n );\n } else {\n if (entityType == undefined || ontologyId == undefined)\n throw Error(\n \"Either iri or ontologyId and entityType have to be provided.\",\n );\n return await this.buildRootHierarchy({\n entityType: entityType,\n ontologyId: ontologyId,\n includeObsoleteEntities: includeObsoleteEntities,\n preferredRoots: preferredRoots,\n keepExpansionStates: keepExpansionStates,\n showSiblingsOnInit: showSiblingsOnInit,\n useLegacy: useLegacy,\n parameter: parameter,\n });\n }\n }\n\n public jsTreeNodeToEntityData(jsTreeNode: JSTreeNode): EntityData {\n return {\n iri: jsTreeNode.iri,\n label: jsTreeNode.text,\n hasChildren: jsTreeNode.children || jsTreeNode.state.opened,\n parents: [],\n };\n }\n\n public entityToEntityData(entity: Entity): EntityData {\n return {\n iri: entity.getIri(),\n label: asArray(entity.getLabel())[0],\n definedBy: entity.getDefinedBy(),\n hasChildren: entity.hasChildren(),\n numDescendants:\n entity.getNumHierarchicalDescendants() || entity.getNumDescendants(),\n parents: entity.getParents(),\n };\n }\n\n public async buildRootHierarchy(\n props: {\n ontologyId: string;\n entityType: EntityTypeName;\n } & BuildHierarchyProps,\n ): Promise<Hierarchy> {\n const {\n ontologyId,\n entityType,\n preferredRoots,\n includeObsoleteEntities,\n useLegacy = HIERARCHY_WIDGET_DEFAULT_VALUES.USE_LEGACY,\n parameter,\n } = props;\n\n /* QUERY root entities */\n const rootEntitiesData = (\n await this.getRootEntities(\n entityType,\n ontologyId,\n preferredRoots,\n includeObsoleteEntities,\n useLegacy,\n parameter,\n )\n )\n .map((entity) => this.entityToEntityData(entity))\n .filter((root) => !isTop(root.iri));\n /* --- */\n\n /* INITIALIZE entitiesData, parentChildRelations */\n const parentChildRelations: Map<string, ParentChildRelation[]> = new Map<\n string,\n ParentChildRelation[]\n >();\n const entitiesData: Map<string, EntityData> = new Map<string, EntityData>();\n for (const entityData of rootEntitiesData) {\n parentChildRelations.set(entityData.iri, []); // initialize with empty array\n entitiesData.set(entityData.iri, entityData);\n }\n /* --- */\n\n return new Hierarchy({\n parentChildRelations: parentChildRelations,\n entitiesData: entitiesData,\n allChildrenPresent: new Set(),\n roots: rootEntitiesData\n .map((root) => new TreeNode(root))\n .sort((a, b) =>\n (a.entityData.label || a.entityData.iri).localeCompare(\n b.entityData.label || b.entityData.iri,\n ),\n ),\n api: new OlsHierarchyApi(this.axiosInstance.getUri()),\n ontologyId: ontologyId,\n includeObsoleteEntities: includeObsoleteEntities,\n entityType: entityType,\n keepExpansionStates: props.keepExpansionStates,\n useLegacy: useLegacy,\n parameter: parameter,\n });\n }\n\n public async buildHierarchyWithEntity(\n props: {\n mainEntity: Entity;\n ontologyId: string;\n entityType: EntityTypeName;\n } & BuildHierarchyProps,\n ): Promise<Hierarchy> {\n const {\n mainEntity,\n ontologyId,\n entityType,\n preferredRoots,\n includeObsoleteEntities = HIERARCHY_WIDGET_DEFAULT_VALUES.INCLUDE_OBSOLETE_ENTITIES,\n showSiblingsOnInit,\n useLegacy = HIERARCHY_WIDGET_DEFAULT_VALUES.USE_LEGACY,\n parameter,\n } = props;\n\n /* LOAD ancestors */\n let entities: EntityData[] = [];\n\n if (useLegacy) {\n // TODO: JSTree sometimes returns smaller trees than would be possible via querying hierarchical ancestors and all children of those (e.g. http://purl.obolibrary.org/obo/UBERON_2001747 -> strange and not really useful hierarchy because many entities are both sibling and children of other entities (is it wrong to take hierarchicalParent instead of directParent in entityToEntityDataToHierarchy? EMBL-EBI does it like that as well))\n // Question: Should we prefer complete hierarchies (query /hierarchicalAncestors + /children for each) or slim queries (query /jstree)?\n const jsTree = await this.getJSTree(\n mainEntity.getIri(),\n entityType,\n ontologyId,\n parameter,\n );\n const idToIri: Map<string, string> = new Map<string, string>();\n const parents: Map<string, Set<string>> = new Map<string, Set<string>>();\n\n for (const jsTreeNode of jsTree) {\n idToIri.set(jsTreeNode.id, jsTreeNode.iri);\n parents.set(jsTreeNode.iri, new Set<string>());\n }\n\n for (const jsTreeNode of jsTree) {\n const parArr = parents.get(jsTreeNode.iri);\n const parIri = idToIri.get(jsTreeNode.parent);\n if (parArr != undefined && parIri != undefined) {\n parArr.add(parIri);\n }\n }\n\n entities = [];\n const inArr = new Set<string>();\n\n for (const jsTreeNode of jsTree) {\n if (!inArr.has(jsTreeNode.iri)) {\n inArr.add(jsTreeNode.iri);\n\n entities.push(this.jsTreeNodeToEntityData(jsTreeNode));\n const par = parents.get(jsTreeNode.iri);\n if (par != undefined)\n entities[entities.length - 1].parents =\n Reified.fromJson(Array.from(par.values())) || [];\n }\n }\n } else {\n const ancestors = await this.getAncestors(\n mainEntity.getIri(),\n entityType,\n ontologyId || mainEntity.getOntologyId(),\n useLegacy,\n includeObsoleteEntities,\n parameter,\n );\n entities = [\n this.entityToEntityData(mainEntity),\n ...ancestors.map((entity) => this.entityToEntityData(entity)),\n ];\n }\n\n // filter top entities\n entities = entities.filter((e) => !isTop(e.iri));\n /* --- */\n\n /* BUILD parentChildRelations */\n const parentChildRelations: Map<string, ParentChildRelation[]> = new Map<\n string,\n ParentChildRelation[]\n >();\n const allChildrenPresent: Set<string> = new Set<string>();\n const entitiesData: Map<string, EntityData> = new Map<string, EntityData>();\n\n // initialize parentChildRelations & entitiesData\n for (const entityData of entities) {\n parentChildRelations.set(entityData.iri, []); // initialize with empty array\n entitiesData.set(entityData.iri, entityData);\n }\n\n if (showSiblingsOnInit) {\n // additionally load siblings from api\n const realEntityType = entityType || mainEntity.getType();\n const entityTypeForQuery =\n realEntityType == \"individual\" ? \"class\" : realEntityType; // TODO: only relevant for entityType == \"individual\" (maybe we don't even need this as behaviour for individual hierarchies is not yet determined)\n\n const promises: Promise<void>[] = [];\n for (const entityData of entities) {\n if (entityData.iri != mainEntity.getIri()) {\n promises.push(\n new Promise((resolve) =>\n this.getChildren(\n entityData.iri,\n entityTypeForQuery,\n ontologyId,\n includeObsoleteEntities,\n useLegacy,\n parameter || \"\",\n )\n .then((children) =>\n children.map((child) => this.entityToEntityData(child)),\n )\n .then((children) => {\n const parChildRel: ParentChildRelation[] = [];\n for (const child of children) {\n entitiesData.set(child.iri, child);\n if (child.parents) {\n const parRelation = child.parents.filter(\n (par) => par.value == entityData.iri,\n );\n parChildRel.push({\n childIri: child.iri,\n childRelationToParent:\n parRelation.length > 0 && parRelation[0].getMetadata()\n ? parRelation[0].getMetadata()[\n \"childRelationToParent\"\n ]\n : undefined,\n });\n } // should have exactly one element\n }\n\n parentChildRelations.set(entityData.iri, parChildRel);\n allChildrenPresent.add(entityData.iri);\n })\n .then(resolve),\n ),\n );\n }\n }\n\n await Promise.allSettled(promises);\n\n // TODO: only relevant for entityType == \"individual\" (maybe we don't even need this as behaviour for individual hierarchies is not yet determined)\n if (realEntityType == \"individual\") {\n for (const parentReified of mainEntity.getParents()) {\n const children = (\n await this.getChildren(\n parentReified.value,\n realEntityType,\n ontologyId,\n includeObsoleteEntities,\n useLegacy,\n parameter || \"\",\n )\n ).map((child) => this.entityToEntityData(child));\n\n const parChildRel: ParentChildRelation[] = [];\n for (const child of children) {\n parChildRel.push({\n childIri: child.iri,\n childRelationToParent:\n \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\",\n });\n }\n parentChildRelations.set(parentReified.value, parChildRel);\n }\n }\n } else {\n for (const entityData of entities) {\n if (entityData.parents) {\n const parents = entityData.parents.filter(\n (parentReified: Reified<string>) => !isTop(parentReified.value),\n );\n if (\n entityData.iri == mainEntity?.getIri() &&\n isIndividualTypeName(entityType || mainEntity.getType())\n ) {\n for (const parentReified of parents) {\n if (parentChildRelations.has(parentReified.value)) {\n parentChildRelations.get(parentReified.value)?.push({\n childIri: entityData.iri,\n childRelationToParent:\n \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\",\n });\n }\n }\n } else {\n for (const parentReified of parents) {\n if (parentChildRelations.has(parentReified.value)) {\n parentChildRelations.get(parentReified.value)?.push({\n childIri: entityData.iri,\n childRelationToParent: parentReified.getMetadata()\n ? parentReified.getMetadata()[\"childRelationToParent\"]\n : undefined,\n });\n }\n }\n }\n }\n }\n }\n\n // sort parentChildRelations\n for (const rel of parentChildRelations.values())\n rel.sort((a, b) =>\n (entitiesData.get(a.childIri)?.label || a.childIri).localeCompare(\n entitiesData.get(b.childIri)?.label || b.childIri,\n ),\n );\n /* --- */\n\n /* BUILD rootEntities */\n const rootEntities: string[] = [];\n if (preferredRoots) {\n const preferredRootEntities = (\n await this.ontologyService.getOntologyObject(\n ontologyId,\n undefined,\n useLegacy,\n )\n ).getPreferredRoots();\n for (const e of preferredRootEntities) {\n if (entitiesData.has(e)) rootEntities.push(e);\n }\n } else {\n for (const entityData of entities) {\n if (entityData.parents) {\n const parents = entityData.parents.filter(\n (parentReified: Reified<string>) => !isTop(parentReified.value),\n );\n if (parents.length == 0) rootEntities.push(entityData.iri);\n }\n }\n }\n\n /* --- */\n\n function createTreeNode(\n entityData: EntityData,\n cycleCheck: Set<string>,\n childRelationToParent?: string,\n ): TreeNode {\n cycleCheck.add(entityData.iri); // add current entity to cycle check set\n\n const node = new TreeNode(entityData);\n node.childRelationToParent = childRelationToParent;\n const children = parentChildRelations.get(entityData.iri) || [];\n\n for (const child of children) {\n if (cycleCheck.has(child.childIri)) {\n // cyclic tree, skip cycle\n console.error(`Cyclic tree at entity \"${child.childIri}\".`);\n continue;\n }\n\n const childData = entitiesData.get(child.childIri);\n if (childData != undefined)\n node.addChild(\n createTreeNode(childData, cycleCheck, child.childRelationToParent),\n );\n }\n\n if (node.loadedChildren.length > 0) node.expanded = true;\n\n cycleCheck.delete(entityData.iri);\n return node;\n }\n\n const cycleCheck: Set<string> = new Set<string>(); // Contains iris of all entities that have occurred within the current recursion branch. Is used to check for cycles.\n\n return new Hierarchy({\n parentChildRelations: parentChildRelations,\n entitiesData: entitiesData,\n allChildrenPresent: allChildrenPresent,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n roots: rootEntities\n .map((rootEntity) =>\n createTreeNode(entitiesData.get(rootEntity)!, cycleCheck),\n )\n .sort((a, b) =>\n (a.entityData.label || a.entityData.iri).localeCompare(\n b.entityData.label || b.entityData.iri,\n ),\n ),\n api: new OlsHierarchyApi(this.axiosInstance.getUri()),\n ontologyId: ontologyId,\n includeObsoleteEntities: includeObsoleteEntities,\n entityType: entityType,\n mainEntityIri: mainEntity?.getIri(),\n keepExpansionStates: props.keepExpansionStates,\n useLegacy: useLegacy,\n parameter: parameter,\n });\n }\n\n public async loadHierarchyChildren(\n props: LoadHierarchyChildrenProps,\n ): Promise<EntityData[]> {\n if (props.entityType == undefined)\n throw Error(\"EntityType has to be provided to load children in OLS.\");\n\n return (\n await this.getChildren(\n props.nodeToExpand.entityData.iri,\n props.entityType,\n props.ontologyId,\n props.includeObsoleteEntities,\n props.useLegacy,\n props.parameter || \"\",\n )\n ).map((entity) => this.entityToEntityData(entity));\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAqCa,MAAA,+BAA+B,GAAG;AAC7C,IAAA,yBAAyB,EAAE,KAAK;AAChC,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,qBAAqB,EAAE,KAAK;AAC5B,IAAA,qBAAqB,EAAE,KAAK;AAC5B,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,IAAI,EAAE,KAAK;EACF;MAEE,eAAe,CAAA;AAChB,IAAA,aAAa,CAAgB;AAC/B,IAAA,aAAa,CAAe;AAC5B,IA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K,CAAC,uBAAuB,EAC7B,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,SAAS,IAAI,EAAE,CACtB,EACD,GAAG,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;KACpD;AACF;;;;"}
@@ -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;
@@ -272,6 +276,7 @@ export type TabWidgetProps = TabSubwidgetsProps & TabList & OnNavigates & CssCla
272
276
  hierarchyPreferredRoots?: boolean;
273
277
  hierarchyKeepExpansionStates?: boolean;
274
278
  hierarchyShowSiblingsOnInit?: boolean;
279
+ hierarchyWrap?: boolean;
275
280
  };
276
281
  export type TabPresentationProps = TabWidgetProps & CssClassNameObj & {
277
282
  data: Thing;
@@ -357,6 +362,7 @@ export type HierarchyWidgetProps = CssClassNameObj & {
357
362
  apiUrl: string;
358
363
  apiKey?: string;
359
364
  backendType?: string;
365
+ hierarchyWrap?: boolean;
360
366
  } & BuildHierarchyProps & HierarchyIriProp & OnNavigateToEntity & OnNavigateToOntology & ParameterObj;
361
367
  export type TitleTextObj = {
362
368
  /**
@@ -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: {
@@ -72,7 +72,7 @@ function MetadataWidget(props) {
72
72
  React.createElement(EuiFlexItem, null,
73
73
  React.createElement(TabPresentation, { data: data.entity, isLoading: isLoading, error: error, iri: iri, entityType: props.entityType, api: api, ontologyId: props.ontologyId
74
74
  ? props.ontologyId
75
- : data.entity.getOntologyId(), useLegacy: useLegacy, hierarchyTab: hierarchyTab, crossRefTab: crossRefTab, terminologyInfoTab: terminologyInfoTab, termDepictionTab: termDepictionTab, graphViewTab: graphViewTab, altNamesTab: altNamesTab, hierarchyPreferredRoots: props.hierarchyPreferredRoots, hierarchyShowSiblingsOnInit: props.hierarchyShowSiblingsOnInit, hierarchyKeepExpansionStates: props.hierarchyKeepExpansionStates, onNavigateToEntity: props.onNavigateToEntity, onNavigateToOntology: props.onNavigateToOntology, onNavigateToDisambiguate: props.onNavigateToDisambiguate, className: className })))));
75
+ : data.entity.getOntologyId(), useLegacy: useLegacy, hierarchyTab: hierarchyTab, crossRefTab: crossRefTab, terminologyInfoTab: terminologyInfoTab, termDepictionTab: termDepictionTab, graphViewTab: graphViewTab, altNamesTab: altNamesTab, hierarchyPreferredRoots: props.hierarchyPreferredRoots, hierarchyShowSiblingsOnInit: props.hierarchyShowSiblingsOnInit, hierarchyKeepExpansionStates: props.hierarchyKeepExpansionStates, onNavigateToEntity: props.onNavigateToEntity, onNavigateToOntology: props.onNavigateToOntology, onNavigateToDisambiguate: props.onNavigateToDisambiguate, className: className, hierarchyWrap: props.hierarchyWrap })))));
76
76
  }
77
77
  return (React.createElement(React.Fragment, null,
78
78
  isLoading && React.createElement(EuiLoadingSpinner, null),
@@ -1 +1 @@
1
- {"version":3,"file":"MetadataWidget.js","sources":["../../../../../../src/components/widgets/MetadataWidget/MetadataWidget.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport {\n EuiFlexGroup,\n EuiFlexItem,\n EuiLoadingSpinner,\n EuiProvider,\n EuiText,\n EuiLink,\n} from \"@elastic/eui\";\nimport { IriWidget } from \"./IriWidget\";\nimport { QueryClient, QueryClientProvider, useQuery } from \"react-query\";\nimport { MetadataWidgetProps } from \"../../../app/types\";\nimport { Entity } from \"../../../model/interfaces\";\nimport { BreadcrumbPresentation } from \"./BreadcrumbWidget/BreadcrumbPresentation/BreadcrumbPresentation\";\nimport { TabPresentation } from \"./TabWidget/TabPresentation\";\nimport { DescriptionPresentation } from \"./DescriptionWidget/DescriptionPresentation\";\nimport { TitlePresentation } from \"./TitleWidget/TitlePresentation\";\nimport { getErrorMessageToDisplay } from \"../../../app/util\";\nimport { EntityTypeName, isEntity } from \"../../../model/ModelTypeCheck\";\nimport ReactDOM from \"react-dom\";\nimport {\n createModelObject,\n getPreferredOntologyJSON,\n} from \"../../../model/ModelObjectCreator\";\nimport { EntityOntoListPresentation } from \"./EntityOntoListWidget/EntityOntoListPresentation\";\nimport { EntityDefinedByPresentation } from \"./EntityDefinedByWidget/EntityDefinedByPresentation\";\nimport \"../../../style/tssStyles.css\";\nimport \"../../../style/ts4nfdiStyles/ts4nfdiMetadataStyle.css\";\nimport { OlsEntityApi } from \"../../../api/ols/OlsEntityApi\";\n\ntype MetadataInfo = {\n entity: Entity;\n ontoList: string[];\n definedBy: string[];\n};\n\nfunction MetadataWidget(props: MetadataWidgetProps) {\n const {\n iri,\n api,\n ontologyId,\n entityType,\n parameter,\n useLegacy,\n onNavigateToOntology,\n hierarchyTab,\n crossRefTab,\n terminologyInfoTab,\n graphViewTab,\n termDepictionTab,\n altNamesTab,\n termLink,\n className,\n } = props;\n const olsApi = new OlsEntityApi(api);\n const finalClassName = className || \"ts4nfdi-metadata-style\";\n\n const { data, isLoading, isSuccess, isError, error } = useQuery<MetadataInfo>(\n [\"metadata\", api, parameter, entityType, iri, ontologyId, useLegacy],\n async () => {\n let entity: Entity, ontoList: string[], definedBy: string[];\n if (useLegacy) {\n const embedded = (\n await olsApi.getEntityResponse(\n iri,\n entityType,\n undefined,\n parameter,\n useLegacy,\n )\n )[\"_embedded\"];\n entity = createModelObject({\n _embedded: {\n [Object.keys(embedded)[0]]: getPreferredOntologyJSON(\n embedded[Object.keys(embedded)[0]],\n useLegacy,\n ontologyId,\n ),\n },\n }) as Entity;\n ontoList = embedded[Object.keys(embedded)[0]].map(\n (entityInOntology: any) => entityInOntology[\"ontology_name\"],\n );\n definedBy = embedded[Object.keys(embedded)[0]]\n .filter(\n (entityInOntology: any) => entityInOntology[\"is_defining_ontology\"],\n )\n .map((entityInOntology: any) => entityInOntology[\"ontology_name\"]);\n } else {\n entity = await olsApi.getEntityObject(\n iri,\n entityType,\n ontologyId,\n parameter,\n useLegacy,\n );\n ontoList = entity.getAppearsIn();\n definedBy = entity.getDefinedBy();\n }\n\n definedBy = definedBy\n .filter((onto: string) => onto != entity.getOntologyId())\n .sort();\n ontoList = ontoList\n .filter(\n (onto: string) =>\n onto != entity.getOntologyId() && !definedBy.includes(onto),\n )\n .sort();\n\n return {\n entity: entity,\n ontoList: ontoList,\n definedBy: definedBy,\n } as MetadataInfo;\n },\n );\n\n function render(data: MetadataInfo) {\n return (\n <div className={finalClassName}>\n <EuiFlexGroup direction=\"column\">\n <EuiFlexItem grow={false} style={{ maxWidth: 600 }}>\n {termLink ? (\n <EuiLink href={termLink} target=\"_blank\" external={false}>\n <TitlePresentation\n title={data.entity.getLabel()}\n className={`${finalClassName}-title`}\n isLoading={isLoading}\n error={error}\n />\n </EuiLink>\n ) : (\n <TitlePresentation\n title={data.entity.getLabel()}\n className={`${finalClassName}-title`}\n isLoading={isLoading}\n error={error}\n />\n )}\n </EuiFlexItem>\n <EuiFlexItem grow={false}>\n <span>\n <BreadcrumbPresentation\n onNavigateToOntology={props.onNavigateToOntology}\n ontologyId={ontologyId || data.entity.getOntologyId()}\n shortForm={data.entity.getShortForm()}\n className={`${finalClassName}-breadcrumb`}\n />\n </span>\n </EuiFlexItem>\n <EuiFlexItem>\n <EuiFlexGroup direction=\"column\">\n <EuiFlexItem>\n <EuiFlexGroup>\n <EuiFlexItem grow={false} style={{ maxWidth: 600 }}>\n <IriWidget iri={iri} className={`${finalClassName}-iri`} />\n </EuiFlexItem>\n </EuiFlexGroup>\n </EuiFlexItem>\n </EuiFlexGroup>\n </EuiFlexItem>\n <EuiFlexItem style={{ maxWidth: 600 }}>\n <DescriptionPresentation\n description={data.entity.getDescription()}\n className={`${finalClassName}-description`}\n isLoading={isLoading}\n error={error}\n />\n </EuiFlexItem>\n\n <div style={{ margin: \"0 12px 0\", maxWidth: 600 }}>\n <EntityOntoListPresentation\n iri={props.iri}\n label={data.entity.getLabel() || \"\"}\n ontolist={data.ontoList}\n entityType={\n entityType || (data.entity.getType() as EntityTypeName)\n }\n onNavigateToOntology={onNavigateToOntology}\n className={`${finalClassName}-entity-onto-list`}\n />\n <EntityDefinedByPresentation\n iri={props.iri}\n ontolist={data.definedBy}\n label={data.entity.getLabel() || \"\"}\n entityType={\n entityType || (data.entity.getType() as EntityTypeName)\n }\n onNavigateToOntology={onNavigateToOntology}\n className={`${finalClassName}-entity-defined-by`}\n />\n </div>\n\n <EuiFlexItem>\n <TabPresentation\n data={data.entity}\n isLoading={isLoading}\n error={error}\n iri={iri}\n entityType={props.entityType}\n api={api}\n ontologyId={\n props.ontologyId\n ? props.ontologyId\n : data.entity.getOntologyId()\n }\n useLegacy={useLegacy}\n hierarchyTab={hierarchyTab}\n crossRefTab={crossRefTab}\n terminologyInfoTab={terminologyInfoTab}\n termDepictionTab={termDepictionTab}\n graphViewTab={graphViewTab}\n altNamesTab={altNamesTab}\n hierarchyPreferredRoots={props.hierarchyPreferredRoots}\n hierarchyShowSiblingsOnInit={props.hierarchyShowSiblingsOnInit}\n hierarchyKeepExpansionStates={props.hierarchyKeepExpansionStates}\n onNavigateToEntity={props.onNavigateToEntity}\n onNavigateToOntology={props.onNavigateToOntology}\n onNavigateToDisambiguate={props.onNavigateToDisambiguate}\n className={className}\n />\n </EuiFlexItem>\n </EuiFlexGroup>\n </div>\n );\n }\n\n return (\n <>\n {isLoading && <EuiLoadingSpinner />}\n {isError && (\n <EuiText>{getErrorMessageToDisplay(error, \"metadata\")}</EuiText>\n )}\n {isSuccess && data && <>{isEntity(data.entity) ? render(data) : null}</>}\n </>\n );\n}\n\nfunction createMetadata(\n props: MetadataWidgetProps,\n container: Element,\n callback?: () => void,\n) {\n ReactDOM.render(WrappedMetadataWidget(props), container, callback);\n}\n\nfunction WrappedMetadataWidget(props: MetadataWidgetProps) {\n const queryClient = new QueryClient();\n return (\n <EuiProvider colorMode=\"light\" globalStyles={false}>\n <QueryClientProvider client={queryClient}>\n <MetadataWidget\n iri={props.iri}\n ontologyId={props.ontologyId}\n api={props.api}\n entityType={props.entityType}\n parameter={props.parameter}\n useLegacy={props.useLegacy}\n termLink={props.termLink}\n altNamesTab={props.altNamesTab}\n hierarchyTab={props.hierarchyTab}\n crossRefTab={props.crossRefTab}\n terminologyInfoTab={props.terminologyInfoTab}\n graphViewTab={props.graphViewTab}\n termDepictionTab={props.termDepictionTab}\n hierarchyPreferredRoots={props.hierarchyPreferredRoots}\n hierarchyShowSiblingsOnInit={props.hierarchyShowSiblingsOnInit}\n hierarchyKeepExpansionStates={props.hierarchyKeepExpansionStates}\n onNavigateToEntity={props.onNavigateToEntity}\n onNavigateToOntology={props.onNavigateToOntology}\n onNavigateToDisambiguate={props.onNavigateToDisambiguate}\n className={props.className}\n />\n </QueryClientProvider>\n </EuiProvider>\n );\n}\n\nexport { MetadataWidget, createMetadata };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAsCA;AACE;AAiBA;AACA;AAEA;AAGI;;;;AAYI;AACE;AAKD;AACF;;AAID;;;;;AAMA;AAOA;AACA;;AAGF;AACG;AACA;AACH;;AAKG;;AAGD;AACA;AACA;;AAEJ;;AAIA;AAEI;AACE;;AAmBA;AACE;AACE;AAQJ;AACE;AACE;AACE;AACE;AACE;;;;;;AAsCV;AACE;;AAUM;;AAuBhB;;AAGK;;AAMP;AAEA;AAKE;AACF;AAEA;AACE;;AAGI;AACE;AAyBR;;"}
1
+ {"version":3,"file":"MetadataWidget.js","sources":["../../../../../../src/components/widgets/MetadataWidget/MetadataWidget.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport {\n EuiFlexGroup,\n EuiFlexItem,\n EuiLoadingSpinner,\n EuiProvider,\n EuiText,\n EuiLink,\n} from \"@elastic/eui\";\nimport { IriWidget } from \"./IriWidget\";\nimport { QueryClient, QueryClientProvider, useQuery } from \"react-query\";\nimport { MetadataWidgetProps } from \"../../../app/types\";\nimport { Entity } from \"../../../model/interfaces\";\nimport { BreadcrumbPresentation } from \"./BreadcrumbWidget/BreadcrumbPresentation/BreadcrumbPresentation\";\nimport { TabPresentation } from \"./TabWidget/TabPresentation\";\nimport { DescriptionPresentation } from \"./DescriptionWidget/DescriptionPresentation\";\nimport { TitlePresentation } from \"./TitleWidget/TitlePresentation\";\nimport { getErrorMessageToDisplay } from \"../../../app/util\";\nimport { EntityTypeName, isEntity } from \"../../../model/ModelTypeCheck\";\nimport ReactDOM from \"react-dom\";\nimport {\n createModelObject,\n getPreferredOntologyJSON,\n} from \"../../../model/ModelObjectCreator\";\nimport { EntityOntoListPresentation } from \"./EntityOntoListWidget/EntityOntoListPresentation\";\nimport { EntityDefinedByPresentation } from \"./EntityDefinedByWidget/EntityDefinedByPresentation\";\nimport \"../../../style/tssStyles.css\";\nimport \"../../../style/ts4nfdiStyles/ts4nfdiMetadataStyle.css\";\nimport { OlsEntityApi } from \"../../../api/ols/OlsEntityApi\";\n\ntype MetadataInfo = {\n entity: Entity;\n ontoList: string[];\n definedBy: string[];\n};\n\nfunction MetadataWidget(props: MetadataWidgetProps) {\n const {\n iri,\n api,\n ontologyId,\n entityType,\n parameter,\n useLegacy,\n onNavigateToOntology,\n hierarchyTab,\n crossRefTab,\n terminologyInfoTab,\n graphViewTab,\n termDepictionTab,\n altNamesTab,\n termLink,\n className,\n } = props;\n const olsApi = new OlsEntityApi(api);\n const finalClassName = className || \"ts4nfdi-metadata-style\";\n\n const { data, isLoading, isSuccess, isError, error } = useQuery<MetadataInfo>(\n [\"metadata\", api, parameter, entityType, iri, ontologyId, useLegacy],\n async () => {\n let entity: Entity, ontoList: string[], definedBy: string[];\n if (useLegacy) {\n const embedded = (\n await olsApi.getEntityResponse(\n iri,\n entityType,\n undefined,\n parameter,\n useLegacy,\n )\n )[\"_embedded\"];\n entity = createModelObject({\n _embedded: {\n [Object.keys(embedded)[0]]: getPreferredOntologyJSON(\n embedded[Object.keys(embedded)[0]],\n useLegacy,\n ontologyId,\n ),\n },\n }) as Entity;\n ontoList = embedded[Object.keys(embedded)[0]].map(\n (entityInOntology: any) => entityInOntology[\"ontology_name\"],\n );\n definedBy = embedded[Object.keys(embedded)[0]]\n .filter(\n (entityInOntology: any) => entityInOntology[\"is_defining_ontology\"],\n )\n .map((entityInOntology: any) => entityInOntology[\"ontology_name\"]);\n } else {\n entity = await olsApi.getEntityObject(\n iri,\n entityType,\n ontologyId,\n parameter,\n useLegacy,\n );\n ontoList = entity.getAppearsIn();\n definedBy = entity.getDefinedBy();\n }\n\n definedBy = definedBy\n .filter((onto: string) => onto != entity.getOntologyId())\n .sort();\n ontoList = ontoList\n .filter(\n (onto: string) =>\n onto != entity.getOntologyId() && !definedBy.includes(onto),\n )\n .sort();\n\n return {\n entity: entity,\n ontoList: ontoList,\n definedBy: definedBy,\n } as MetadataInfo;\n },\n );\n\n function render(data: MetadataInfo) {\n return (\n <div className={finalClassName}>\n <EuiFlexGroup direction=\"column\">\n <EuiFlexItem grow={false} style={{ maxWidth: 600 }}>\n {termLink ? (\n <EuiLink href={termLink} target=\"_blank\" external={false}>\n <TitlePresentation\n title={data.entity.getLabel()}\n className={`${finalClassName}-title`}\n isLoading={isLoading}\n error={error}\n />\n </EuiLink>\n ) : (\n <TitlePresentation\n title={data.entity.getLabel()}\n className={`${finalClassName}-title`}\n isLoading={isLoading}\n error={error}\n />\n )}\n </EuiFlexItem>\n <EuiFlexItem grow={false}>\n <span>\n <BreadcrumbPresentation\n onNavigateToOntology={props.onNavigateToOntology}\n ontologyId={ontologyId || data.entity.getOntologyId()}\n shortForm={data.entity.getShortForm()}\n className={`${finalClassName}-breadcrumb`}\n />\n </span>\n </EuiFlexItem>\n <EuiFlexItem>\n <EuiFlexGroup direction=\"column\">\n <EuiFlexItem>\n <EuiFlexGroup>\n <EuiFlexItem grow={false} style={{ maxWidth: 600 }}>\n <IriWidget iri={iri} className={`${finalClassName}-iri`} />\n </EuiFlexItem>\n </EuiFlexGroup>\n </EuiFlexItem>\n </EuiFlexGroup>\n </EuiFlexItem>\n <EuiFlexItem style={{ maxWidth: 600 }}>\n <DescriptionPresentation\n description={data.entity.getDescription()}\n className={`${finalClassName}-description`}\n isLoading={isLoading}\n error={error}\n />\n </EuiFlexItem>\n\n <div style={{ margin: \"0 12px 0\", maxWidth: 600 }}>\n <EntityOntoListPresentation\n iri={props.iri}\n label={data.entity.getLabel() || \"\"}\n ontolist={data.ontoList}\n entityType={\n entityType || (data.entity.getType() as EntityTypeName)\n }\n onNavigateToOntology={onNavigateToOntology}\n className={`${finalClassName}-entity-onto-list`}\n />\n <EntityDefinedByPresentation\n iri={props.iri}\n ontolist={data.definedBy}\n label={data.entity.getLabel() || \"\"}\n entityType={\n entityType || (data.entity.getType() as EntityTypeName)\n }\n onNavigateToOntology={onNavigateToOntology}\n className={`${finalClassName}-entity-defined-by`}\n />\n </div>\n\n <EuiFlexItem>\n <TabPresentation\n data={data.entity}\n isLoading={isLoading}\n error={error}\n iri={iri}\n entityType={props.entityType}\n api={api}\n ontologyId={\n props.ontologyId\n ? props.ontologyId\n : data.entity.getOntologyId()\n }\n useLegacy={useLegacy}\n hierarchyTab={hierarchyTab}\n crossRefTab={crossRefTab}\n terminologyInfoTab={terminologyInfoTab}\n termDepictionTab={termDepictionTab}\n graphViewTab={graphViewTab}\n altNamesTab={altNamesTab}\n hierarchyPreferredRoots={props.hierarchyPreferredRoots}\n hierarchyShowSiblingsOnInit={props.hierarchyShowSiblingsOnInit}\n hierarchyKeepExpansionStates={props.hierarchyKeepExpansionStates}\n onNavigateToEntity={props.onNavigateToEntity}\n onNavigateToOntology={props.onNavigateToOntology}\n onNavigateToDisambiguate={props.onNavigateToDisambiguate}\n className={className}\n hierarchyWrap={props.hierarchyWrap}\n />\n </EuiFlexItem>\n </EuiFlexGroup>\n </div>\n );\n }\n\n return (\n <>\n {isLoading && <EuiLoadingSpinner />}\n {isError && (\n <EuiText>{getErrorMessageToDisplay(error, \"metadata\")}</EuiText>\n )}\n {isSuccess && data && <>{isEntity(data.entity) ? render(data) : null}</>}\n </>\n );\n}\n\nfunction createMetadata(\n props: MetadataWidgetProps,\n container: Element,\n callback?: () => void,\n) {\n ReactDOM.render(WrappedMetadataWidget(props), container, callback);\n}\n\nfunction WrappedMetadataWidget(props: MetadataWidgetProps) {\n const queryClient = new QueryClient();\n return (\n <EuiProvider colorMode=\"light\" globalStyles={false}>\n <QueryClientProvider client={queryClient}>\n <MetadataWidget\n iri={props.iri}\n ontologyId={props.ontologyId}\n api={props.api}\n entityType={props.entityType}\n parameter={props.parameter}\n useLegacy={props.useLegacy}\n termLink={props.termLink}\n altNamesTab={props.altNamesTab}\n hierarchyTab={props.hierarchyTab}\n crossRefTab={props.crossRefTab}\n terminologyInfoTab={props.terminologyInfoTab}\n graphViewTab={props.graphViewTab}\n termDepictionTab={props.termDepictionTab}\n hierarchyPreferredRoots={props.hierarchyPreferredRoots}\n hierarchyShowSiblingsOnInit={props.hierarchyShowSiblingsOnInit}\n hierarchyKeepExpansionStates={props.hierarchyKeepExpansionStates}\n onNavigateToEntity={props.onNavigateToEntity}\n onNavigateToOntology={props.onNavigateToOntology}\n onNavigateToDisambiguate={props.onNavigateToDisambiguate}\n className={props.className}\n />\n </QueryClientProvider>\n </EuiProvider>\n );\n}\n\nexport { MetadataWidget, createMetadata };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAsCA;AACE;AAiBA;AACA;AAEA;AAGI;;;;AAYI;AACE;AAKD;AACF;;AAID;;;;;AAMA;AAOA;AACA;;AAGF;AACG;AACA;AACH;;AAKG;;AAGD;AACA;AACA;;AAEJ;;AAIA;AAEI;AACE;;AAmBA;AACE;AACE;AAQJ;AACE;AACE;AACE;AACE;AACE;;;;;;AAsCV;AACE;;AAUM;;AAwBhB;;AAGK;;AAMP;AAEA;AAKE;AACF;AAEA;AACE;;AAGI;AACE;AAyBR;;"}
@@ -15,6 +15,42 @@ declare const _default: {
15
15
  };
16
16
  };
17
17
  argTypes: {
18
+ hierarchyShowSiblingsOnInit: {
19
+ required: boolean;
20
+ description: string;
21
+ table: {
22
+ defaultValue: {
23
+ summary: false;
24
+ };
25
+ };
26
+ };
27
+ hierarchyKeepExpansionStates: {
28
+ required: boolean;
29
+ description: string;
30
+ table: {
31
+ defaultValue: {
32
+ summary: false;
33
+ };
34
+ };
35
+ };
36
+ hierarchyPreferredRoots: {
37
+ required: boolean;
38
+ description: string;
39
+ table: {
40
+ defaultValue: {
41
+ summary: false;
42
+ };
43
+ };
44
+ };
45
+ hierarchyWrap: {
46
+ required: boolean;
47
+ description: string;
48
+ table: {
49
+ defaultValue: {
50
+ summary: false;
51
+ };
52
+ };
53
+ };
18
54
  useLegacy: {
19
55
  required: boolean;
20
56
  description: string;
@@ -164,6 +200,7 @@ declare const _default: {
164
200
  onNavigateToEntity: string;
165
201
  onNavigateToOntology: string;
166
202
  onNavigateToDisambiguate: string;
203
+ hierarchyWrap: false;
167
204
  parameter: string;
168
205
  };
169
206
  };