Home Manual Reference Source Repository
import {ViewContainer} from 'ug-layout/view/ViewContainer'
public class | source

ViewContainer

A container that holds a 1 to 1 relationship with a component instance. This instance is the main API for a component to interact with the layout framework.

Constructor Summary

Public Constructor
public

constructor(_document: Document, _injector: Injector)

Creates an instance of ViewContainer.

Member Summary

Public Members
public

Notifies when the view has become attached.

public

Notifies that the view is being destroyed.

public get

The component instance associated with this container.

public

Notifies when the component is initialized.

public

Notifies when the component is assigned to the container and ready for access.

public

containerChange: Observable<View | null>

Notifies when this container has changed the View it is associated with.

public

Notifies when the view is destroyed.

public

Notifies when the view has become detached.

public get

The HTML element for this container.

public get
public get

Current height in pixels.

public

A unique identifier for this instance.

public

Contains the state of ths views initialized state.

public get

Whether the container is cacheable.

public get

isLazy: *

public

sizeChanges: Observable<{width: number, height: number}>

Notifies when the dimensions of this views container has changed.

public

status: Observable<ViewContainerStatus>

Notifies when the status of this component changes.

public get

view: *

public

Notifies when the visibility of this view changes.

public get

Current width in pixels.

Method Summary

Public Methods
public

close(args: {silent?: boolean})

Closes this view.

public

Destroys the container.

public

detach()

Detaches this container from it's view.

public

fail(retry: *)

public

get(token: *): U | null

Get's a token from this containers injector. Note, this should not be used to grab parent renderables or any item that can be changed.

public

getParent(Ctor: Type<T>): T | null

Gets this renderables parent or any parent that is an instance of the passed in constructor.

public

getParents(Ctor: Type<T>): T | null

Gets this renderables parents or any parents that are an instance of the passed in constructor.

public

Initializes the component.

public

Determines whether this renderable is visible.

public

Signals up the tree to make this View visible.

public

mount(element: HTMLElement)

Mounts an element to this containers element.

public

mountHTML(html: string)

Sets all the content of this containers element to the given HTML string.

public

mountTo(element: HTMLElement)

Mounts this containers element to the given element.

public

ready(options: {init?: boolean}): Promise<ViewContainer<T>>

Waits for the component to be ready.

public

resolve(options: {}): *

public

retry()

public

setView(container: View | null): void

Sets the containing View for this container.

Public Constructors

public constructor(_document: Document, _injector: Injector) source

Creates an instance of ViewContainer.

Params:

NameTypeAttributeDescription
_document Document
_injector Injector

Public Members

public attached: Observable<boolean> source

Notifies when the view has become attached.

public beforeDestroy: Observable<BeforeDestroyEvent<Renderable>> source

Notifies that the view is being destroyed. This action is cancellable or can be halted until an async action is complete.

See:

public get component: T | null source

The component instance associated with this container.

public componentInitialized: Observable<boolean> source

Notifies when the component is initialized.

public componentReady: Observable<boolean> source

Notifies when the component is assigned to the container and ready for access.

public containerChange: Observable<View | null> source

Notifies when this container has changed the View it is associated with.

public destroyed: Observable<ViewContainer<T>> source

Notifies when the view is destroyed.

public detached: Observable<boolean> source

Notifies when the view has become detached.

public get element: HTMLElement source

The HTML element for this container.

public get hasComponent: * source

public get height: number source

Current height in pixels.

public id: number source

A unique identifier for this instance.

public initialized: Observable<boolean> source

Contains the state of ths views initialized state.

public get isCacheable: boolean source

Whether the container is cacheable.

public get isLazy: * source

public sizeChanges: Observable<{width: number, height: number}> source

Notifies when the dimensions of this views container has changed.

public status: Observable<ViewContainerStatus> source

Notifies when the status of this component changes.

public get view: * source

public visibilityChanges: Observable<boolean> source

Notifies when the visibility of this view changes.

public get width: number source

Current width in pixels.

Public Methods

public close(args: {silent?: boolean}) source

Closes this view.

Params:

NameTypeAttributeDescription
args {silent?: boolean}

public destroy() source

Destroys the container.

public detach() source

Detaches this container from it's view.

public fail(retry: *) source

Params:

NameTypeAttributeDescription
retry *

public get(token: *): U | null source

Get's a token from this containers injector. Note, this should not be used to grab parent renderables or any item that can be changed.

Params:

NameTypeAttributeDescription
token *

Return:

U | null

public getParent(Ctor: Type<T>): T | null source

Gets this renderables parent or any parent that is an instance of the passed in constructor. If non is found then null is returned.

Params:

NameTypeAttributeDescription
Ctor Type<T>
  • optional

Return:

T | null

public getParents(Ctor: Type<T>): T | null source

Gets this renderables parents or any parents that are an instance of the passed in constructor.

Params:

NameTypeAttributeDescription
Ctor Type<T>
  • optional

Return:

T | null

public initialize() source

Initializes the component. This creates the component.

public isVisible(): boolean source

Determines whether this renderable is visible.

Return:

boolean

public makeVisible() source

Signals up the tree to make this View visible.

public mount(element: HTMLElement) source

Mounts an element to this containers element.

Params:

NameTypeAttributeDescription
element HTMLElement

public mountHTML(html: string) source

Sets all the content of this containers element to the given HTML string.

Params:

NameTypeAttributeDescription
html string

public mountTo(element: HTMLElement) source

Mounts this containers element to the given element.

Params:

NameTypeAttributeDescription
element HTMLElement

public ready(options: {init?: boolean}): Promise<ViewContainer<T>> source

Waits for the component to be ready. If the component is not initialized it will be initialized. This is important when the view is lazy and hasn't been shown yet but we need to interact with the component.

Params:

NameTypeAttributeDescription
options {init?: boolean}
  • optional
  • default: {}

Return:

Promise<ViewContainer<T>>

public resolve(options: {}): * source

Params:

NameTypeAttributeDescription
options {}
  • optional
  • default: {}

Return:

*

public retry() source

public setView(container: View | null): void source

Sets the containing View for this container.

Params:

NameTypeAttributeDescription
container View | null

Return:

void