UNPKG

@bloomreach/ng-sdk

Version:

Bloomreach SPA SDK for Angular

284 lines (264 loc) 14.9 kB
import * as i0 from '@angular/core'; import { TemplateRef, Type, OnChanges, OnDestroy, OnInit, ViewContainerRef, SimpleChanges, AfterContentChecked, AfterContentInit, StateKey, EventEmitter, NgZone, TransferState, Injector, ChangeDetectorRef, PipeTransform } from '@angular/core'; import { Component, Page, Container, ContainerItem, MetaCollection, Configuration, PageModel, ManageContentButton, Menu } from '@bloomreach/spa-sdk'; import * as rxjs from 'rxjs'; import { BehaviorSubject } from 'rxjs'; import { HttpErrorResponse, HttpClient } from '@angular/common/http'; import * as i15 from '@angular/common'; declare class BrNodeDirective { component: Component; template?: TemplateRef<BrComponentContext>; static ɵfac: i0.ɵɵFactoryDeclaration<BrNodeDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<BrNodeDirective, "[brNode]", never, { "component": { "alias": "brNode"; "required": false; }; "template": { "alias": "brNodeTemplate"; "required": false; }; }, {}, never, never, false, never>; } /** * The mapped component properties. */ interface BrProps<T extends Component = Component> { /** * The mapped component. */ component?: T; /** * The current page. */ page?: Page; } interface BrNodeContext extends BrComponentContext { template?: TemplateRef<BrComponentContext>; } declare class BrPageService { private _mapping; private _node; private readonly state$; constructor(); get mapping(): Record<keyof any, Type<BrProps>>; set mapping(mapping: Record<keyof any, Type<BrProps>>); get node(): TemplateRef<BrNodeContext>; set node(node: TemplateRef<BrNodeContext>); get state(): BehaviorSubject<Page | undefined>; static ɵfac: i0.ɵɵFactoryDeclaration<BrPageService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<BrPageService>; } /** * The template context holding the current brXM Component. */ interface BrComponentContext { /** * The implicit value of the context is pointing to the current component. */ $implicit?: Component; /** * The current component. */ component?: Component; /** * The current page. */ page?: Page; } /** * The brXM component. */ declare class BrComponentDirective implements OnChanges, OnDestroy, OnInit { private container; private template?; private node?; private page?; /** * The component instance or a path to a component. * The path is defined as a slash-separated components name chain * relative to the current component (e.g. `main/container`). * If it is omitted, all the children will be rendered. */ component?: Component | string; constructor(container: ViewContainerRef, template?: TemplateRef<BrComponentContext> | undefined, node?: BrNodeDirective | undefined, page?: BrPageService | undefined); ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; ngOnInit(): void; private get context(); private get components(); static ɵfac: i0.ɵɵFactoryDeclaration<BrComponentDirective, [null, { optional: true; }, { optional: true; }, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<BrComponentDirective, "[brComponent]", never, { "component": { "alias": "brComponent"; "required": false; }; }, {}, never, never, false, never>; } declare class BrContainerBoxComponent { component: Container; page: Page; get isPreview(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<BrContainerBoxComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<BrContainerBoxComponent, "div.br-container-box", never, { "component": { "alias": "component"; "required": false; }; "page": { "alias": "page"; "required": false; }; }, {}, never, never, false, never>; } declare class BrContainerInlineComponent { component: Container; page: Page; get isPreview(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<BrContainerInlineComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<BrContainerInlineComponent, "div.br-container-inline", never, { "component": { "alias": "component"; "required": false; }; "page": { "alias": "page"; "required": false; }; }, {}, never, never, false, never>; } declare class BrContainerOrderedListComponent { component: Container; page: Page; get isPreview(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<BrContainerOrderedListComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<BrContainerOrderedListComponent, "ol.br-container-ordered-list", never, { "component": { "alias": "component"; "required": false; }; "page": { "alias": "page"; "required": false; }; }, {}, never, never, false, never>; } declare class BrContainerUnorderedListComponent { component: Container; page: Page; get isPreview(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<BrContainerUnorderedListComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<BrContainerUnorderedListComponent, "ul.br-container-unordered-list", never, { "component": { "alias": "component"; "required": false; }; "page": { "alias": "page"; "required": false; }; }, {}, never, never, false, never>; } declare class BrContainerItemUndefinedComponent { component: ContainerItem; static ɵfac: i0.ɵɵFactoryDeclaration<BrContainerItemUndefinedComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<BrContainerItemUndefinedComponent, "br-container-item-undefined", never, { "component": { "alias": "component"; "required": false; }; }, {}, never, never, false, never>; } declare abstract class BrMetaDirective implements OnChanges, OnDestroy { private container; private template?; protected meta?: MetaCollection | undefined; private clear?; constructor(container: ViewContainerRef, template?: TemplateRef<never> | undefined); ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; private render; static ɵfac: i0.ɵɵFactoryDeclaration<BrMetaDirective, [null, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<BrMetaDirective, never, never, {}, {}, never, never, false, never>; } /** * The brXM page. */ declare class BrPageComponent implements AfterContentChecked, AfterContentInit, OnChanges, OnDestroy { private httpClient; private pageService; private platform; private transferState?; /** * The configuration of the SPA SDK. * @see https://www.npmjs.com/package/@bloomreach/spa-sdk#configuration */ configuration: Omit<Configuration, 'httpClient'>; /** * The brXM and Angular components mapping. */ mapping: Record<keyof any, Type<BrProps>>; /** * The pre-initialized page instance or prefetched page model. * Mostly this property should be used to transfer state from the server-side to the client-side. */ page?: Page | PageModel; /** * The TransferState key is used to transfer the state from the server-side to the client-side. * By default, it equals to `brPage`. * If `false` is passed then the state transferring feature will be disabled. */ stateKey: StateKey<PageModel | undefined> | false; /** * The current state of the page component. */ state: rxjs.BehaviorSubject<Page | undefined>; /** * Http error handling */ httpError: EventEmitter<HttpErrorResponse>; node: TemplateRef<BrNodeContext>; private template?; private afterContentChecked$; constructor(httpClient: HttpClient, pageService: BrPageService, zone: NgZone, platform: any, transferState?: TransferState | undefined); get context(): BrNodeContext; ngOnChanges(changes: SimpleChanges): void; ngAfterContentChecked(): void; ngAfterContentInit(): void; ngOnDestroy(): void; private initialize; private request; isPlatformBrowser(platform: object): boolean; isPlatformServer(platform: object): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<BrPageComponent, [null, null, null, null, { optional: true; }]>; static ɵcmp: i0.ɵɵComponentDeclaration<BrPageComponent, "br-page", never, { "configuration": { "alias": "configuration"; "required": false; }; "mapping": { "alias": "mapping"; "required": false; }; "page": { "alias": "page"; "required": false; }; "stateKey": { "alias": "stateKey"; "required": false; }; }, { "state": "state"; "httpError": "httpError"; }, ["template"], never, false, never>; } /** * The button directive that opens for editing a content. */ declare class BrManageContentButtonDirective extends BrMetaDirective implements OnChanges, ManageContentButton { private page?; content?: ManageContentButton['content']; documentTemplateQuery?: ManageContentButton['documentTemplateQuery']; folderTemplateQuery?: ManageContentButton['folderTemplateQuery']; path?: ManageContentButton['path']; parameter?: ManageContentButton['parameter']; pickerConfiguration?: ManageContentButton['pickerConfiguration']; pickerEnableUpload?: ManageContentButton['pickerEnableUpload']; pickerInitialPath?: ManageContentButton['pickerInitialPath']; pickerRemembersLastVisited?: ManageContentButton['pickerRemembersLastVisited']; pickerRootPath?: ManageContentButton['pickerRootPath']; pickerSelectableNodeTypes?: ManageContentButton['pickerSelectableNodeTypes']; relative?: ManageContentButton['relative']; root?: ManageContentButton['root']; constructor(container: ViewContainerRef, template?: TemplateRef<never>, page?: BrPageComponent | undefined); ngOnChanges(changes: SimpleChanges): void; static ɵfac: i0.ɵɵFactoryDeclaration<BrManageContentButtonDirective, [null, { optional: true; }, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<BrManageContentButtonDirective, "[brManageContentButton]", never, { "content": { "alias": "brManageContentButton"; "required": false; }; "documentTemplateQuery": { "alias": "documentTemplateQuery"; "required": false; }; "folderTemplateQuery": { "alias": "folderTemplateQuery"; "required": false; }; "path": { "alias": "path"; "required": false; }; "parameter": { "alias": "parameter"; "required": false; }; "pickerConfiguration": { "alias": "pickerConfiguration"; "required": false; }; "pickerEnableUpload": { "alias": "pickerEnableUpload"; "required": false; }; "pickerInitialPath": { "alias": "pickerInitialPath"; "required": false; }; "pickerRemembersLastVisited": { "alias": "pickerRemembersLastVisited"; "required": false; }; "pickerRootPath": { "alias": "pickerRootPath"; "required": false; }; "pickerSelectableNodeTypes": { "alias": "pickerSelectableNodeTypes"; "required": false; }; "relative": { "alias": "relative"; "required": false; }; "root": { "alias": "root"; "required": false; }; }, {}, never, never, false, never>; } /** * The button directive that opens a menu editor. */ declare class BrManageMenuButtonDirective extends BrMetaDirective implements OnChanges { private page?; /** * The related menu model. */ menu: Menu; constructor(container: ViewContainerRef, template?: TemplateRef<never>, page?: BrPageComponent | undefined); ngOnChanges(changes: SimpleChanges): void; static ɵfac: i0.ɵɵFactoryDeclaration<BrManageMenuButtonDirective, [null, { optional: true; }, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<BrManageMenuButtonDirective, "[brManageMenuButton]", never, { "menu": { "alias": "brManageMenuButton"; "required": false; }; }, {}, never, never, false, never>; } declare class BrNodeComponentDirective implements OnChanges, OnDestroy { private container; private injector; private node; protected page: BrPageService; component?: Component; private clear?; constructor(container: ViewContainerRef, injector: Injector, node: BrNodeDirective, page: BrPageService); ngOnChanges(changes: SimpleChanges): void; protected getMapping(): Type<BrProps> | undefined; private render; private renderTemplate; private renderChildren; private renderMapping; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<BrNodeComponentDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<BrNodeComponentDirective, "[brNodeComponent]", never, { "component": { "alias": "brNodeComponent"; "required": false; }; }, {}, never, never, false, never>; } declare class BrNodeContainerDirective extends BrNodeComponentDirective { component?: Container; protected getMapping(): Type<BrProps> | undefined; static ɵfac: i0.ɵɵFactoryDeclaration<BrNodeContainerDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<BrNodeContainerDirective, "[brNodeContainer]", never, { "component": { "alias": "brNodeContainer"; "required": false; }; }, {}, never, never, false, never>; } declare class BrNodeContainerItemDirective extends BrNodeComponentDirective implements OnChanges, OnDestroy { private changeDetectorRef; constructor(container: ViewContainerRef, injector: Injector, node: BrNodeDirective, page: BrPageService, changeDetectorRef: ChangeDetectorRef); component?: ContainerItem; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; private onUpdate; protected getMapping(): Type<BrProps> | undefined; static ɵfac: i0.ɵɵFactoryDeclaration<BrNodeContainerItemDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<BrNodeContainerItemDirective, "[brNodeContainerItem]", never, { "component": { "alias": "brNodeContainerItem"; "required": false; }; }, {}, never, never, false, never>; } declare class BrNodeTypePipe implements PipeTransform { transform(component: Component): string; static ɵfac: i0.ɵɵFactoryDeclaration<BrNodeTypePipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<BrNodeTypePipe, "brNodeType", false>; } declare class BrSdkModule { static ɵfac: i0.ɵɵFactoryDeclaration<BrSdkModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<BrSdkModule, [typeof BrComponentDirective, typeof BrContainerBoxComponent, typeof BrContainerInlineComponent, typeof BrContainerOrderedListComponent, typeof BrContainerUnorderedListComponent, typeof BrContainerItemUndefinedComponent, typeof BrManageContentButtonDirective, typeof BrManageMenuButtonDirective, typeof BrNodeComponentDirective, typeof BrNodeContainerDirective, typeof BrNodeContainerItemDirective, typeof BrNodeDirective, typeof BrNodeTypePipe, typeof BrPageComponent], [typeof i15.CommonModule], [typeof BrComponentDirective, typeof BrManageContentButtonDirective, typeof BrManageMenuButtonDirective, typeof BrPageComponent]>; static ɵinj: i0.ɵɵInjectorDeclaration<BrSdkModule>; } export { BrComponentDirective, BrManageContentButtonDirective, BrManageMenuButtonDirective, BrPageComponent, BrPageService, BrSdkModule }; export type { BrComponentContext, BrNodeContext, BrProps };