1- import { Component , computed , input } from '@angular/core' ;
2- import { ReferenceEntity } from " ../../../model/graph/reference-entity/reference-entity.model" ;
3- import { EntityService } from " ../../../services/entity.service" ;
4- import { isArray , isString } from " lodash" ;
5- import { NgClass , TitleCasePipe } from " @angular/common" ;
6- import { StructureViewerComponent } from " ../../tabs/molecule-tab/structure-viewer/structure-viewer.component" ;
7- import { DatabaseIdentifier } from " ../../../model/graph/database-identifier.model" ;
8- import { MatIconButton } from " @angular/material/button" ;
9- import { MatIcon } from " @angular/material/icon" ;
10- import { UrlStateService } from " ../../../services/url-state.service" ;
11- import { MatTooltip } from " @angular/material/tooltip" ;
12- import { DataStateService } from " ../../../services/data-state.service" ;
13- import { Labels } from " ../../../constants/constants" ;
14- import { StructureService } from " ../../../services/structure.service" ;
15- import { MoleculeType } from " ../../tabs/molecule-tab/molecule-tab.component" ;
1+ import { Component , computed , input } from '@angular/core' ;
2+ import { ReferenceEntity } from ' ../../../model/graph/reference-entity/reference-entity.model' ;
3+ import { EntityService } from ' ../../../services/entity.service' ;
4+ import { isArray , isString } from ' lodash' ;
5+ import { NgClass , TitleCasePipe } from ' @angular/common' ;
6+ import { StructureViewerComponent } from ' ../../tabs/molecule-tab/structure-viewer/structure-viewer.component' ;
7+ import { DatabaseIdentifier } from ' ../../../model/graph/database-identifier.model' ;
8+ import { MatIconButton } from ' @angular/material/button' ;
9+ import { MatIcon } from ' @angular/material/icon' ;
10+ import { UrlStateService } from ' ../../../services/url-state.service' ;
11+ import { MatTooltip } from ' @angular/material/tooltip' ;
12+ import { DataStateService } from ' ../../../services/data-state.service' ;
13+ import { Labels } from ' ../../../constants/constants' ;
14+ import { StructureService } from ' ../../../services/structure.service' ;
15+ import { MoleculeType } from ' ../../tabs/molecule-tab/molecule-tab.component' ;
1616
1717@Component ( {
1818 selector : 'cr-external-reference' ,
@@ -25,11 +25,10 @@ import {MoleculeType} from "../../tabs/molecule-tab/molecule-tab.component";
2525 MatIconButton ,
2626 MatTooltip ,
2727 NgClass ,
28- StructureViewerComponent
29- ]
28+ StructureViewerComponent ,
29+ ] ,
3030} )
3131export class ExternalReferenceComponent {
32-
3332 readonly referenceEntity = input . required < ReferenceEntity > ( ) ;
3433 readonly xRefs = input < DatabaseIdentifier [ ] > ( [ ] ) ;
3534
@@ -42,22 +41,28 @@ export class ExternalReferenceComponent {
4241 moleculeType = computed ( ( ) => {
4342 const entity = this . referenceEntity ( ) ;
4443 return entity ? entity . moleculeType : null ;
45- } )
46-
47- hasStructure = computed ( ( ) => this . moleculeType ( ) === MoleculeType . PROTEIN || this . moleculeType ( ) === MoleculeType . CHEMICAL ) ;
44+ } ) ;
4845
46+ hasStructure = computed ( ( ) =>
47+ [
48+ MoleculeType . CHEMICAL ,
49+ MoleculeType . CHEMICAL_DRUG ,
50+ MoleculeType . PROTEIN ,
51+ ] . includes ( this . moleculeType ( ) as MoleculeType )
52+ ) ;
4953
50- constructor ( private entity : EntityService ,
51- private state : UrlStateService ,
52- public data : DataStateService ,
53- private structure : StructureService ) {
54- }
54+ constructor (
55+ private entity : EntityService ,
56+ private state : UrlStateService ,
57+ public data : DataStateService ,
58+ private structure : StructureService
59+ ) { }
5560
5661 protected readonly isString = isString ;
5762 protected readonly isArray = isArray ;
5863
5964 onSelect ( ) {
60- this . state . select . set ( this . referenceEntity ( ) . stId ! )
65+ this . state . select . set ( this . referenceEntity ( ) . stId ! ) ;
6166 }
6267
6368 protected readonly Labels = Labels ;
0 commit comments