@dlr-eoc/core-ui
Version:
This project includes schematics to add the base UKIS-Layout to an angular application. The Layout is based on Clarity so [add this first](https://clarity.design/get-started/developing/angular)!
50 lines (49 loc) • 2.19 kB
TypeScript
import { OnInit, ComponentRef, OnDestroy, SimpleChanges, OnChanges, EventEmitter, ViewContainerRef, Type } from '@angular/core';
import { Subscription } from 'rxjs';
import * as i0 from "@angular/core";
export interface IDynamicComponent {
component: Type<any>;
inputs?: {
[input: string]: any;
};
outputs?: {
[inputChange: string]: (value: any) => void;
};
}
export declare class ViewRefDirective {
viewContainerRef: ViewContainerRef;
constructor(viewContainerRef: ViewContainerRef);
static ɵfac: i0.ɵɵFactoryDeclaration<ViewRefDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<ViewRefDirective, "[ukisAddHost]", never, {}, {}, never, never, true, never>;
}
export declare class DynamicComponentComponent implements OnInit, OnDestroy, OnChanges {
dynamicComponent: IDynamicComponent;
dynamicComponentChange: EventEmitter<IDynamicComponent>;
ukisAddHost: ViewRefDirective;
componentRef: ComponentRef<any>;
viewContainerRef: ViewContainerRef;
subs: Subscription[];
constructor();
loadComponent(): void;
/**
* Set's the inputs defined in IDynamicComponent
*
* To subscribe to the outputs of the IDynamicComponent.component use '<name>Change' as output name in your component.
* e.g.
* @Input() set value()...
* get value()...
* @Output() valueChange = new EventEmitter<number>();
*
*
* To reset the Inputs after ngOnInit, change to Object binding for the input 'dynamicComponent' in the parent which creates the dynamic component.
* e.g.
* this.Comp.inputs.test = 'value';
* CustomLayer.action = this.Comp = Object.assign({}, this.Comp);
*/
setInputOutputs(): void;
ngOnChanges(changes: SimpleChanges): void;
ngOnInit(): void;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicComponentComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicComponentComponent, "ukis-dynamic-component", never, { "dynamicComponent": { "alias": "dynamicComponent"; "required": false; }; }, { "dynamicComponentChange": "dynamicComponentChange"; }, never, never, true, never>;
}