@acoustic-content-sdk/ng-utils 中文文档教程

发布于 4年前 浏览 11 更新于 3年前

npm

为基于 Angular 的项目实现实用方法和类。

Table of Contents

Home; @acoustic-content-sdk/ng-utils

ng-utils package

Implementation of a utility methods and classes for Angular based projects

Classes

ClassDescription
AbstractBaseComponentImplementation of a base component for Angular Components that expose the renderingContext and layoutMode output observables.
AbstractLifeCycleComponenttslint:disable:no-conflicting-lifecycle
AbstractRenderingComponentConvenience base class for components that work with a RenderingContextV2.
AcNgBrowserWindowModuleExposes the window as the ACOUSTIC_TOKEN_WINDOW token for the case that the application runs in the browser (as opposed to running on the server via Angular Universal)
AcNgEditHostWindowModuleExposes the edit host as the ACOUSTIC_TOKEN_EDIT_HOST_WINDOW token.Depends on: ACOUSTIC_TOKEN_WINDOW

Functions

FunctionDescription
proxyGetEditHostWindow(aCurrentWindow)Returns the window that controls the application

Variables

VariableDescription
VERSIONVersion and build number of the package

首页 @acoustic-content-sdk/ng-utils > AbstractBaseComponent

AbstractBaseComponent class

实现 Angular 组件的基础组件,公开 renderingContextlayoutMode 输出可观察值。

Signature:

export declare abstract class AbstractBaseComponent extends AbstractLifeCycleComponent implements RenderingContextProviderV2 

Constructors

ConstructorModifiersDescription
(constructor)()Constructs a new instance of the AbstractBaseComponent class

Properties

PropertyModifiersTypeDescription
layoutModestringSet the layout mode to render this page
layoutMode$Observable<string>Fires whenever the layout mode changed, includes the initial default mode.
renderingContext$Observable<RenderingContextV2>The rendering context for the page. This is the context of the element that is referenced by the currently active route.

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent

AbstractLifeCycleComponent class

tslint:disable:no-conflicting-lifecycle

Signature:

export declare abstract class AbstractLifeCycleComponent implements OnInit, OnDestroy, OnChanges, DoCheck, AfterContentInit, AfterContentChecked, AfterViewInit, AfterViewChecked 

Properties

PropertyModifiersTypeDescription
afterContentChecked$Observable<void>AfterContentChecked
afterContentInit$Observable<void>AfterContentInit
afterViewChecked$Observable<void>AfterViewChecked
afterViewInit$Observable<void>AfterViewInit
doCheck$Observable<void>DoCheck
onChanges$Observable<SimpleChanges>OnChanges
onDestroy$Observable<void>OnDestroy
onInit$Observable<void>OnInit

Methods

MethodModifiersDescription
ngAfterContentChecked()AfterContentChecked
ngAfterContentInit()AfterContentInit
ngAfterViewChecked()AfterViewChecked
ngAfterViewInit()AfterViewInit
ngDoCheck()DoCheck
ngOnChanges(changes)OnChanges
ngOnDestroy()OnDestroy
ngOnInit(){@linkhttps://angular.io/guide/lifecycle-hooks| OnInit}

主页 > @acoustic-content-sdk/ng-utils > AbstractRenderingComponent

AbstractRenderingComponent class

使用 RenderingContextV2 的组件的便利基类。

Signature:

export declare abstract class AbstractRenderingComponent extends AbstractBaseComponent implements RenderingContextProviderV2 

Constructors

ConstructorModifiersDescription
(constructor)()Our constructor

Properties

PropertyModifiersTypeDescription
layoutMode$Observable<string>Returns an Observable for the layout mode
renderingContext$Observable<RenderingContextV2>Returns an Observable for the rendering context

Methods

MethodModifiersDescription
trackCtx(aIndex, aCtx)Generates unique IDs for elements using the following strategy: - if the context is a string, use it as the ID - if the context is an element then … -- if the element contains an 'id' field, use that -- if the element has a '$metadata.id' field, use that -- if the element has a '$metadata.accessor' field, use that -- fall back to the index

Home > @acoustic-content-sdk/ng-utils > AcNgBrowserWindowModule

AcNgBrowserWindowModule class

将窗口公开为 ACOUSTIC_TOKEN_WINDOW 令牌,用于应用程序在浏览器中运行的情况(相对于通过 Angular 服务器运行)

Signature:

export declare class AcNgBrowserWindowModule 

Home > @acoustic-content-sdk/ng-utils > AcNgEditHostWindowModule

AcNgEditHostWindowModule class

将编辑主机公开为 ACOUSTIC_TOKEN_EDIT_HOST_WINDOW 令牌。

Depends on: ACOUSTIC_TOKEN_WINDOW

Signature:

export declare class AcNgEditHostWindowModule 

Home > @acoustic-content-sdk/ng-utils > proxyGetEditHostWindow

proxyGetEditHostWindow() function

返回控制应用程序的窗口

签名:

export declare function proxyGetEditHostWindow(aCurrentWindow: WindowType): WindowType;

Parameters

ParameterTypeDescription
aCurrentWindowWindowTypethe current window

返回:

WindowType

控制窗口

Home > @acoustic-content-sdk/ng-utils > VERSION

VERSION variable

Version and build number of the package

Signature:

VERSION: {
    version: {
        major: string;
        minor: string;
        patch: string;
        branch: string;
    };
    build: Date;
}

首页 > @acoustic-content-sdk/ng-utils > 抽象基础组件 > (constructor)

AbstractBaseComponent.(constructor)

Constructs a new instance of the AbstractBaseComponent class

Signature:

protected constructor();

主页 > @acoustic-content-sdk/ng-utils > 抽象基础组件 > layoutMode

AbstractBaseComponent.layoutMode property

Set the layout mode to render this page

Signature:

layoutMode: string;

首页 > @acoustic-content-sdk/ng-utils > 抽象基础组件 > layoutMode$

AbstractBaseComponent.layoutMode$ property

当布局模式改变时触发,包括初始默认模式。

Signature:

readonly layoutMode$: Observable<string>;

Home > @acoustic-content-sdk/ng-utils > 抽象基础组件 > renderingContext$

AbstractBaseComponent.renderingContext$ property

页面的呈现上下文。 这是当前活动路由引用的元素的上下文。

Signature:

renderingContext$: Observable<RenderingContextV2>;

Home > @acoustic-content-sdk/ng-utils > 抽象渲染组件 > (constructor)

AbstractRenderingComponent.(constructor)

Our constructor

Signature:

constructor();

Home< /a> > @acoustic-content-sdk/ng-utils > 抽象渲染组件 > layoutMode$

AbstractRenderingComponent.layoutMode$ property

Returns an Observable for the layout mode

Signature:

readonly layoutMode$: Observable<string>;

首页 > @acoustic-content-sdk/ng-utils > 抽象渲染组件 > renderingContext$

AbstractRenderingComponent.renderingContext$ property

Returns an Observable for the rendering context

Signature:

readonly renderingContext$: Observable<RenderingContextV2>;

首页 > @acoustic-content-sdk/ng-utils > 抽象渲染组件 > trackCtx

AbstractRenderingComponent.trackCtx() method

使用以下策略为元素生成唯一 ID: - 如果上下文是字符串,则将其用作 ID - 如果上下文是元素,则...... - 如果元素包含一个“id”字段,使用它——如果元素有一个“$metadata.id”字段,使用它——如果元素有一个“$metadata.accessor”字段,使用它——返回到index

签名:

trackCtx(aIndex: number, aCtx: RenderingContextInput): string | number;

Parameters

ParameterTypeDescription
aIndexnumberindex of the iteration
aCtxRenderingContextInputthe input

返回:

string | number

the unique ID

Home > @acoustic-content-sdk/ng-utils > 抽象生命周期组件 > AfterContentChecked$

AbstractLifeCycleComponent.afterContentChecked$ property

AfterContentChecked

签名:

protected get afterContentChecked$(): Observable<void>;

< a name="_1f8ac84799047a698f154566b7be845b59432b0e49d7c5185654061147f0e68d">

Home > @acoustic-content-sdk/ng-utils > 抽象生命周期组件 > afterContentInit$

AbstractLifeCycleComponent.afterContentInit$ property

AfterContentInit

签名:

protected get afterContentInit$(): Observable<void>;

<一个名字=“_8a32d39e52886016f044ead2db08c14bb3e3a777b91eb26e24f83ed4a4e1e79f”>

@acoustic-content-sdk/ng-utils > 抽象生命周期组件 > afterViewChecked$

AbstractLifeCycleComponent.afterViewChecked$ property

AfterViewChecked

签名:

protected get afterViewChecked$(): Observable<void>;

<一个名字="_df4177b7fcd1ad9077e28acc13dde45e099eeb79f2f99de78dca9a29fe58fb14">

@acoustic-content-sdk/ng-utils > 抽象生命周期组件 > afterViewInit$

AbstractLifeCycleComponent.afterViewInit$ property

AfterViewInit

签名:

protected get afterViewInit$(): Observable<void>;

<一个名字="_7c8f873cc04d94699b0c279620e88c0830c871be26ef493f83b155329fd12b45">

@acoustic-content-sdk/ng-utils > 抽象生命周期组件 > doCheck$

AbstractLifeCycleComponent.doCheck$ property

DoCheck

签名:

protected get doCheck$(): Observable<void>;

<一个名字=“_05024f7ae59209718ade07eeb6fd5b51f850a61e2a4220bfdbee8807bc773527”>

@acoustic-content-sdk/ng-utils > 抽象生命周期组件 > onChanges$

AbstractLifeCycleComponent.onChanges$ property

OnChanges

签名:

protected get onChanges$(): Observable<SimpleChanges>;

<一个名字=“_eab6a011de126866adfafd407a26a052104c61d92369dc0c72484d4f322ea0ef”>

@acoustic-content-sdk/ng-utils > 抽象生命周期组件 > onDestroy$

AbstractLifeCycleComponent.onDestroy$ property

OnDestroy

签名:

protected get onDestroy$(): Observable<void>;

<一个名字="_4deb421c8c13582e093094350e58bccc71917cd9e883a495e94afcf31231d79c">

@acoustic-content-sdk/ng-utils > 抽象生命周期组件 > onInit$

AbstractLifeCycleComponent.onInit$ property

OnInit

签名:

protected get onInit$(): Observable<void>;

< a name="_d916b59b00525a44c4432a9b08c926a7743eb2b46e0e4c80932a9ba62d789a91">

Home > @acoustic-content-sdk/ng-utils > 抽象生命周期组件 > ngAfterContentChecked

AbstractLifeCycleComponent.ngAfterContentChecked() method

AfterContentChecked

签名:

ngAfterContentChecked(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > 抽象生命周期组件 > ngAfterContentInit

AbstractLifeCycleComponent.ngAfterContentInit() method

AfterContentInit

签名:

ngAfterContentInit(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > 抽象生命周期组件 > ngAfterViewChecked

AbstractLifeCycleComponent.ngAfterViewChecked() method

AfterViewChecked

签名:

ngAfterViewChecked(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > 抽象生命周期组件 > ngAfterViewInit

AbstractLifeCycleComponent.ngAfterViewInit() method

AfterViewInit

签名:

ngAfterViewInit(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > 抽象生命周期组件 > ngDoCheck

AbstractLifeCycleComponent.ngDoCheck() method

DoCheck

签名:

ngDoCheck(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > 抽象生命周期组件 > ngOnChanges

AbstractLifeCycleComponent.ngOnChanges() method

OnChanges

签名:

ngOnChanges(changes: SimpleChanges): void;

Parameters

ParameterTypeDescription
changesSimpleChanges

Returns:

void

Home > @acoustic-content-sdk/ng-utils > 抽象生命周期组件 > ngOnDestroy

AbstractLifeCycleComponent.ngOnDestroy() method

OnDestroy

签名:

ngOnDestroy(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > 抽象生命周期组件 > ngOnInit

AbstractLifeCycleComponent.ngOnInit() method

{@链接https://angular.io/guide/lifecycle-hooks| OnInit}

签名:

ngOnInit(): void;

返回:

void

npm

Implementation of a utility methods and classes for Angular based projects.

Table of Contents

Home > @acoustic-content-sdk/ng-utils

ng-utils package

Implementation of a utility methods and classes for Angular based projects

Classes

ClassDescription
AbstractBaseComponentImplementation of a base component for Angular Components that expose the renderingContext and layoutMode output observables.
AbstractLifeCycleComponenttslint:disable:no-conflicting-lifecycle
AbstractRenderingComponentConvenience base class for components that work with a RenderingContextV2.
AcNgBrowserWindowModuleExposes the window as the ACOUSTIC_TOKEN_WINDOW token for the case that the application runs in the browser (as opposed to running on the server via Angular Universal)
AcNgEditHostWindowModuleExposes the edit host as the ACOUSTIC_TOKEN_EDIT_HOST_WINDOW token.Depends on: ACOUSTIC_TOKEN_WINDOW

Functions

FunctionDescription
proxyGetEditHostWindow(aCurrentWindow)Returns the window that controls the application

Variables

VariableDescription
VERSIONVersion and build number of the package

Home > @acoustic-content-sdk/ng-utils > AbstractBaseComponent

AbstractBaseComponent class

Implementation of a base component for Angular Components that expose the renderingContext and layoutMode output observables.

Signature:

export declare abstract class AbstractBaseComponent extends AbstractLifeCycleComponent implements RenderingContextProviderV2 

Constructors

ConstructorModifiersDescription
(constructor)()Constructs a new instance of the AbstractBaseComponent class

Properties

PropertyModifiersTypeDescription
layoutModestringSet the layout mode to render this page
layoutMode$Observable&lt;string&gt;Fires whenever the layout mode changed, includes the initial default mode.
renderingContext$Observable&lt;RenderingContextV2&gt;The rendering context for the page. This is the context of the element that is referenced by the currently active route.

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent

AbstractLifeCycleComponent class

tslint:disable:no-conflicting-lifecycle

Signature:

export declare abstract class AbstractLifeCycleComponent implements OnInit, OnDestroy, OnChanges, DoCheck, AfterContentInit, AfterContentChecked, AfterViewInit, AfterViewChecked 

Properties

PropertyModifiersTypeDescription
afterContentChecked$Observable&lt;void&gt;AfterContentChecked
afterContentInit$Observable&lt;void&gt;AfterContentInit
afterViewChecked$Observable&lt;void&gt;AfterViewChecked
afterViewInit$Observable&lt;void&gt;AfterViewInit
doCheck$Observable&lt;void&gt;DoCheck
onChanges$Observable&lt;SimpleChanges&gt;OnChanges
onDestroy$Observable&lt;void&gt;OnDestroy
onInit$Observable&lt;void&gt;OnInit

Methods

MethodModifiersDescription
ngAfterContentChecked()AfterContentChecked
ngAfterContentInit()AfterContentInit
ngAfterViewChecked()AfterViewChecked
ngAfterViewInit()AfterViewInit
ngDoCheck()DoCheck
ngOnChanges(changes)OnChanges
ngOnDestroy()OnDestroy
ngOnInit(){@linkhttps://angular.io/guide/lifecycle-hooks| OnInit}

Home > @acoustic-content-sdk/ng-utils > AbstractRenderingComponent

AbstractRenderingComponent class

Convenience base class for components that work with a RenderingContextV2.

Signature:

export declare abstract class AbstractRenderingComponent extends AbstractBaseComponent implements RenderingContextProviderV2 

Constructors

ConstructorModifiersDescription
(constructor)()Our constructor

Properties

PropertyModifiersTypeDescription
layoutMode$Observable&lt;string&gt;Returns an Observable for the layout mode
renderingContext$Observable&lt;RenderingContextV2&gt;Returns an Observable for the rendering context

Methods

MethodModifiersDescription
trackCtx(aIndex, aCtx)Generates unique IDs for elements using the following strategy: - if the context is a string, use it as the ID - if the context is an element then … -- if the element contains an 'id' field, use that -- if the element has a '$metadata.id' field, use that -- if the element has a '$metadata.accessor' field, use that -- fall back to the index

Home > @acoustic-content-sdk/ng-utils > AcNgBrowserWindowModule

AcNgBrowserWindowModule class

Exposes the window as the ACOUSTIC_TOKEN_WINDOW token for the case that the application runs in the browser (as opposed to running on the server via Angular Universal)

Signature:

export declare class AcNgBrowserWindowModule 

Home > @acoustic-content-sdk/ng-utils > AcNgEditHostWindowModule

AcNgEditHostWindowModule class

Exposes the edit host as the ACOUSTIC_TOKEN_EDIT_HOST_WINDOW token.

Depends on: ACOUSTIC_TOKEN_WINDOW

Signature:

export declare class AcNgEditHostWindowModule 

Home > @acoustic-content-sdk/ng-utils > proxyGetEditHostWindow

proxyGetEditHostWindow() function

Returns the window that controls the application

Signature:

export declare function proxyGetEditHostWindow(aCurrentWindow: WindowType): WindowType;

Parameters

ParameterTypeDescription
aCurrentWindowWindowTypethe current window

Returns:

WindowType

the controlling window

Home > @acoustic-content-sdk/ng-utils > VERSION

VERSION variable

Version and build number of the package

Signature:

VERSION: {
    version: {
        major: string;
        minor: string;
        patch: string;
        branch: string;
    };
    build: Date;
}

Home > @acoustic-content-sdk/ng-utils > AbstractBaseComponent > (constructor)

AbstractBaseComponent.(constructor)

Constructs a new instance of the AbstractBaseComponent class

Signature:

protected constructor();

Home > @acoustic-content-sdk/ng-utils > AbstractBaseComponent > layoutMode

AbstractBaseComponent.layoutMode property

Set the layout mode to render this page

Signature:

layoutMode: string;

Home > @acoustic-content-sdk/ng-utils > AbstractBaseComponent > layoutMode$

AbstractBaseComponent.layoutMode$ property

Fires whenever the layout mode changed, includes the initial default mode.

Signature:

readonly layoutMode$: Observable<string>;

Home > @acoustic-content-sdk/ng-utils > AbstractBaseComponent > renderingContext$

AbstractBaseComponent.renderingContext$ property

The rendering context for the page. This is the context of the element that is referenced by the currently active route.

Signature:

renderingContext$: Observable<RenderingContextV2>;

Home > @acoustic-content-sdk/ng-utils > AbstractRenderingComponent > (constructor)

AbstractRenderingComponent.(constructor)

Our constructor

Signature:

constructor();

Home > @acoustic-content-sdk/ng-utils > AbstractRenderingComponent > layoutMode$

AbstractRenderingComponent.layoutMode$ property

Returns an Observable for the layout mode

Signature:

readonly layoutMode$: Observable<string>;

Home > @acoustic-content-sdk/ng-utils > AbstractRenderingComponent > renderingContext$

AbstractRenderingComponent.renderingContext$ property

Returns an Observable for the rendering context

Signature:

readonly renderingContext$: Observable<RenderingContextV2>;

Home > @acoustic-content-sdk/ng-utils > AbstractRenderingComponent > trackCtx

AbstractRenderingComponent.trackCtx() method

Generates unique IDs for elements using the following strategy: - if the context is a string, use it as the ID - if the context is an element then … -- if the element contains an 'id' field, use that -- if the element has a '$metadata.id' field, use that -- if the element has a '$metadata.accessor' field, use that -- fall back to the index

Signature:

trackCtx(aIndex: number, aCtx: RenderingContextInput): string | number;

Parameters

ParameterTypeDescription
aIndexnumberindex of the iteration
aCtxRenderingContextInputthe input

Returns:

string | number

the unique ID

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > afterContentChecked$

AbstractLifeCycleComponent.afterContentChecked$ property

AfterContentChecked

Signature:

protected get afterContentChecked$(): Observable<void>;

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > afterContentInit$

AbstractLifeCycleComponent.afterContentInit$ property

AfterContentInit

Signature:

protected get afterContentInit$(): Observable<void>;

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > afterViewChecked$

AbstractLifeCycleComponent.afterViewChecked$ property

AfterViewChecked

Signature:

protected get afterViewChecked$(): Observable<void>;

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > afterViewInit$

AbstractLifeCycleComponent.afterViewInit$ property

AfterViewInit

Signature:

protected get afterViewInit$(): Observable<void>;

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > doCheck$

AbstractLifeCycleComponent.doCheck$ property

DoCheck

Signature:

protected get doCheck$(): Observable<void>;

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > onChanges$

AbstractLifeCycleComponent.onChanges$ property

OnChanges

Signature:

protected get onChanges$(): Observable<SimpleChanges>;

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > onDestroy$

AbstractLifeCycleComponent.onDestroy$ property

OnDestroy

Signature:

protected get onDestroy$(): Observable<void>;

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > onInit$

AbstractLifeCycleComponent.onInit$ property

OnInit

Signature:

protected get onInit$(): Observable<void>;

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > ngAfterContentChecked

AbstractLifeCycleComponent.ngAfterContentChecked() method

AfterContentChecked

Signature:

ngAfterContentChecked(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > ngAfterContentInit

AbstractLifeCycleComponent.ngAfterContentInit() method

AfterContentInit

Signature:

ngAfterContentInit(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > ngAfterViewChecked

AbstractLifeCycleComponent.ngAfterViewChecked() method

AfterViewChecked

Signature:

ngAfterViewChecked(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > ngAfterViewInit

AbstractLifeCycleComponent.ngAfterViewInit() method

AfterViewInit

Signature:

ngAfterViewInit(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > ngDoCheck

AbstractLifeCycleComponent.ngDoCheck() method

DoCheck

Signature:

ngDoCheck(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > ngOnChanges

AbstractLifeCycleComponent.ngOnChanges() method

OnChanges

Signature:

ngOnChanges(changes: SimpleChanges): void;

Parameters

ParameterTypeDescription
changesSimpleChanges

Returns:

void

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > ngOnDestroy

AbstractLifeCycleComponent.ngOnDestroy() method

OnDestroy

Signature:

ngOnDestroy(): void;

Returns:

void

Home > @acoustic-content-sdk/ng-utils > AbstractLifeCycleComponent > ngOnInit

AbstractLifeCycleComponent.ngOnInit() method

{@linkhttps://angular.io/guide/lifecycle-hooks| OnInit}

Signature:

ngOnInit(): void;

Returns:

void

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文