UNPKG

@nibo-ai/ngx-powerbi

Version:

TypeScript library for embedding Power BI assets (reports/dashboards/tiles) in your application. This TypeScript library is built on top of the official powerbi-client library provided by Microsoft.

82 lines (81 loc) 3.6 kB
import { Embed, IEmbedConfiguration, Report, service as pbiService, Tile } from 'powerbi-client'; export declare function powerBiServiceFactory(): pbiService.Service; export declare class NgxPowerBiService { private service?; private powerBiCoreService; constructor(service?: pbiService.Service); /** * Creates new report * @param HTMLElement Parent HTML element * @param IEmbedConfiguration Embed configuration * @returns Embed Embedded object */ createReport(element: HTMLElement, config: IEmbedConfiguration): Embed; /** * Given a configuration based on an HTML element, * if the component has already been created and attached to the element, reuses the component instance and existing iframe, * otherwise creates a new component instance. * * @param HTMLElement Parent HTML element * @param IEmbedConfiguration Embed configuration * @returns Embed Embedded object */ embed(element: HTMLElement, config: IEmbedConfiguration): Embed; /** * Given a configuration based on an HTML element, * if the component has already been created and attached to the element, reuses the component instance and existing iframe, * otherwise creates a new component instance. * This is used for the phased embedding API, once element is loaded successfully, one can call 'render' on it. * * @param HTMLElement} Parent HTML element * @param IEmbedConfiguration Embed configuration * @returns Embed Embedded object */ load(element: HTMLElement, config: IEmbedConfiguration): Embed; /** * Adds an event handler for DOMContentLoaded, which searches the DOM for elements that have the 'powerbi-embed-url' attribute, * and automatically attempts to embed a Power BI component based on information from other powerbi-* attributes. * * Note: Only runs if `config.autoEmbedOnContentLoaded` is true when the service is created. * This handler is typically useful only for applications that are rendered on the server so that all * required data is available when the handler is called. */ enableAutoEmbed(): void; /** * Returns an instance of the component associated with the element. * * @param HTMLElement Parent HTML element * @returns (Report | Tile) Embedded report/tile object */ get(element: HTMLElement): Embed; /** * Finds an embed instance by the name or unique ID that is provided. * * @param string} uniqueId or name of the report/tile * @returns (Report | Tile) Embedded report/tile object */ findById(uniqueId: string): Report | Tile; /** * Given an HTML element that has a component embedded within it, * removes the component from the list of embedded components, * removes the association between the element and the component, and removes the iframe. * * @param HTMLElement Parent HTML element * @returns void */ reset(element: HTMLElement): void; /** * handles tile events * * @param IEvent<any> event */ handleTileEvents(event: pbiService.IEvent<any>): void; /** * API for warm starting Power BI embedded endpoints. * Use this API to preload Power BI Embedded in the background. * * @param embed.IEmbedConfiguration Embed configuration * @param HTMLElement [element=undefined] */ preload(config: IEmbedConfiguration, element: HTMLElement): HTMLIFrameElement; }