@deliverysolutions/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.
67 lines (66 loc) • 2.79 kB
TypeScript
import { ElementRef, EventEmitter, OnChanges, OnDestroy, AfterViewInit, SimpleChanges } from '@angular/core';
import * as models from 'powerbi-models';
import { NgxPowerBiService } from './ngx-powerbi.service';
import * as i0 from "@angular/core";
export declare const enum TokenType {
Aad = "Aad",
Embed = "Embed"
}
export declare const enum ReportType {
Dashboard = "Dashboard",
Report = "Report",
Tile = "Tile"
}
export declare class NgxPowerBiComponent implements AfterViewInit, OnChanges, OnDestroy {
private ngxPowerBiService;
accessToken: string;
tokenType: TokenType;
embedUrl: string;
id: string;
type: ReportType;
name: string;
options: models.ISettings;
embedded: EventEmitter<number>;
ngxPowerBiIFrameRef: ElementRef;
private component;
private powerBiService;
constructor(ngxPowerBiService: NgxPowerBiService);
ngAfterViewInit(): void;
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
/**
* Ensure required attributes (embedUrl and accessToken are valid before attempting to embed)
*/
private validateRequiredAttributes;
/**
* Get the model class compatible token enum from our token type enum
* @param tokenType - Token type in our custom enum format
* @returns Token type in powerbi-models.TokenType enum format
*/
private getTokenType;
/**
* Returns an embed configuration object.
* @param accessToken - Access token required to embed a component
* @param tokenType - type of accessToken: Aad or Embed
* @param embedUrl - Embed URL obtained through Power BI REST API or Portal
* @param id - component/element GUID
* @param type - type of embedded component e.g. 'dashboard, report or tile'
* @param name - name of the embedded component
* @param options - Embed configuration options
* @returns Embed configuration object
*/
private getConfig;
/**
* Given an HTMLElement, construct an embed configuration based on attributes and pass to service.
* @param element - native element where the embedding needs to be done
* @param config - configuration to be embedded
*/
private embed;
/**
* Reset the component that has been removed from DOM.
* @param element - native element where the embedded was made
*/
reset(element: HTMLElement): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NgxPowerBiComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NgxPowerBiComponent, "ngx-powerbi-component", never, { "accessToken": "accessToken"; "tokenType": "tokenType"; "embedUrl": "embedUrl"; "id": "id"; "type": "type"; "name": "name"; "options": "options"; }, { "embedded": "embedded"; }, never, never, false, never>;
}