UNPKG

@dotglitch/ngx-common

Version:

Angular components and utilities that are commonly used.

52 lines (51 loc) 2.27 kB
import { AfterViewInit, ApplicationRef, Injector, NgZone, OnChanges, OnDestroy, SimpleChanges, Type, ViewContainerRef } from '@angular/core'; import * as React from 'react'; import { ThemeService } from '../../services/theme.service'; import * as i0 from "@angular/core"; /** * Extend this component to automatically generate * bindings to a React component. * * ! You _must_ override the property `ngReactComponent` * Failure to do so will result in errors * `override readonly ngReactComponent = ReactFlowWrappableComponent;` */ export declare class ReactMagicWrapperComponent implements OnChanges, OnDestroy, AfterViewInit { private readonly ngContainer; private readonly ngTheme; private readonly ngZone; /** * Wrap an angular component inside of a React memo object. * Will attempt to bind @Input and @Output properties if provided, * and will bind the react arguments directly as @Input properties. * * @experimental * @param componentClass Angular component * @param envInjector An `EnvironmentInjector` instance to be used for the component * @param injector An `ElementInjector` instance * @param _inputs * @param _outputs * @returns */ static WrapAngularComponent: (componentClass: Type<any>, appRef: Omit<ApplicationRef, '_runningTick'>, injector: Injector, _inputs?: { [key: string]: any; }, _outputs?: { [key: string]: Function; }, additionalChildren?: React.ReactNode[]) => React.NamedExoticComponent<object>; /** * The react component to be wrapped. * ! Must be overridden for this wrapper to work */ ngReactComponent: React.FunctionComponent<any> | React.ComponentClass<any> | string; private _root; theme: string; private ngSubscriptions; constructor(ngContainer: ViewContainerRef, ngTheme: ThemeService, ngZone: NgZone); ngOnInit(): void; ngOnChanges(changes?: SimpleChanges): void; ngAfterViewInit(): void; ngOnDestroy(): void; private _render; static ɵfac: i0.ɵɵFactoryDeclaration<ReactMagicWrapperComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<ReactMagicWrapperComponent, "app-react-magic-wrapper", never, {}, {}, never, never, true, never>; }