@primno/core
Version:
Front-end framework for Model-Driven Apps of Power Apps and Dynamics 365.
50 lines (49 loc) • 1.54 kB
TypeScript
import { ComponentConstructor, Component, Scope } from "../../typing";
import { Container } from "../di/container/container";
import { ComponentLifeCycle } from "./component-lifecycle";
/**
* Represents a sub-component that can be enabled or disabled.
* Must be used in conjunction with the {@link MnSubComponent} decorator.
*
* For example usage see {@link MnSubComponent}.
* @category Component
* @typeparam T Component type
*/
export interface SubComponent<T extends Component> {
/**
* State of the component. true if enabled
*/
readonly enabled: boolean;
/**
* Enable the component. The component will be created if it is not already created.
*/
enable(): void;
/**
* Disable the component. The component will be destroyed if it is not already destroyed.
*/
disable(): void;
}
/**
* @internal
*/
export declare class ComponentActivator<T extends Component> implements SubComponent<T> {
private componentType;
private componentLifeCycle;
constructor(componentType: ComponentConstructor, componentLifeCycle: ComponentLifeCycle, parentContainer: Container, contextScope: Scope, input?: any);
private container;
private componentBrowser;
private inScope;
private component?;
/** State of the component. true if enabled */
get enabled(): boolean;
/**
* Create an instance of the component.
* @returns
*/
enable(): void;
/**
* Destroy instance of the component.
* @returns
*/
disable(): void;
}