Skip to content
Snippets Groups Projects
reference-list.component.ts 1.12 KiB
Newer Older
  • Learn to ignore specific revisions
  • import {
      Component, Inject, Input, Optional
    } from '@angular/core';
    import { MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar';
    import { ReferenceList } from 'editor/src/app/services/reference-manager';
    
    import { NgForOf } from '@angular/common';
    import { MatListModule } from '@angular/material/list';
    import { MatIconModule } from '@angular/material/icon';
    import { ElementListComponent } from 'editor/src/app/components/element-list.component';
    
    
    @Component({
      selector: 'aspect-reference-list',
    
      standalone: true,
      imports: [
        NgForOf,
        MatListModule,
        MatIconModule,
        ElementListComponent
      ],
    
      template: `
        <ng-container *ngFor="let refGroup of refs ? refs : data">
          <span>
    
            <b>{{ refGroup.element.alias }}</b> wird referenziert von:
    
          <aspect-element-list [elements]="refGroup.refs"></aspect-element-list>
    
        </ng-container>
      `,
      styles: [
        '.mat-mdc-list-item-title {color: inherit !important;}'
      ]
    })
    export class ReferenceListComponent {
      @Input() refs: ReferenceList[] | undefined;
    
      constructor(@Optional()@Inject(MAT_SNACK_BAR_DATA) public data?: ReferenceList[]) { }
    }