Back to home page

EIC code displayed by LXR

 
 

    


Warning, /firebird/firebird-ng/src/app/services/configurator/configurator.component.ts is written in an unsupported language. File is not indexed.

0001 import { Directive, EventEmitter, Input, OnInit, Output } from '@angular/core';
0002 import { PainterConfig } from '../painter-config.interface';
0003 
0004 @Directive()
0005 export abstract class ConfiguratorComponent<T extends PainterConfig> implements OnInit {
0006   @Input() config!: T;
0007   @Output() configChanged = new EventEmitter<T>();
0008 
0009   protected getPropertyMetadata(propertyName: keyof T): any {
0010     return Reflect.getMetadata('configProperty', this.config, propertyName as string);
0011   }
0012 
0013   protected shouldShowProperty(propertyName: keyof T): boolean {
0014     const metadata = this.getPropertyMetadata(propertyName);
0015     return !metadata?.showWhen || metadata.showWhen(this.config);
0016   }
0017 
0018   protected notifyChanges(): void {
0019     this.configChanged.emit(this.config);
0020   }
0021 
0022   ngOnInit() {}
0023 }