Skip to content

Commit acdd5cf

Browse files
committed
Merged PR 25258: phased embedding api: load + render
phased embedding api: load + render
1 parent b1e2748 commit acdd5cf

16 files changed

+382
-200
lines changed

demo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"fetch": "^1.0.0",
3636
"http-server": "^0.9.0",
3737
"jquery": "^3.1.0",
38-
"powerbi-client": "2.4.4",
38+
"powerbi-client": "2.4.5",
3939
"syntaxhighlighter": "4.0.1"
4040
},
4141
"devDependencies": {}

dist/powerbi-client.d.ts

+45-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! powerbi-client v2.4.4 | (c) 2016 Microsoft Corporation MIT */
1+
/*! powerbi-client v2.4.5 | (c) 2016 Microsoft Corporation MIT */
22
declare module "config" {
33
const config: {
44
version: string;
@@ -191,6 +191,10 @@ declare module "embed" {
191191
* Url used in the load request.
192192
*/
193193
loadPath: string;
194+
/**
195+
* Url used in the load request.
196+
*/
197+
phasedLoadPath: string;
194198
/**
195199
* Type of embed
196200
*/
@@ -205,7 +209,7 @@ declare module "embed" {
205209
* @param {HTMLElement} element
206210
* @param {IEmbedConfigurationBase} config
207211
*/
208-
constructor(service: service.Service, element: HTMLElement, config: IEmbedConfigurationBase, iframe?: HTMLIFrameElement);
212+
constructor(service: service.Service, element: HTMLElement, config: IEmbedConfigurationBase, iframe?: HTMLIFrameElement, phasedRender?: boolean);
209213
/**
210214
* Sends createReport configuration data.
211215
*
@@ -253,9 +257,10 @@ declare module "embed" {
253257
* ```
254258
*
255259
* @param {models.ILoadConfiguration} config
260+
* @param {boolean} phasedRender
256261
* @returns {Promise<void>}
257262
*/
258-
load(config: IEmbedConfigurationBase): Promise<void>;
263+
load(config: IEmbedConfigurationBase, phasedRender?: boolean): Promise<void>;
259264
/**
260265
* Removes one or more event handlers from the list of handlers.
261266
* If a reference to the existing handle function is specified, remove the specific handler.
@@ -375,7 +380,7 @@ declare module "embed" {
375380
/**
376381
* Sets Iframe for embed
377382
*/
378-
private setIframe(isLoad);
383+
private setIframe(isLoad, phasedRender?);
379384
}
380385
}
381386
declare module "ifilterable" {
@@ -592,6 +597,7 @@ declare module "report" {
592597
import * as models from 'powerbi-models';
593598
import { IFilterable } from "ifilterable";
594599
import { Page } from "page";
600+
import { IReportLoadConfiguration } from 'powerbi-models';
595601
/**
596602
* A Report node within a report hierarchy
597603
*
@@ -626,7 +632,7 @@ declare module "report" {
626632
* @param {HTMLElement} element
627633
* @param {embed.IEmbedConfiguration} config
628634
*/
629-
constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, iframe?: HTMLIFrameElement);
635+
constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean, iframe?: HTMLIFrameElement);
630636
/**
631637
* Adds backwards compatibility for the previous load configuration, which used the reportId query parameter to specify the report ID
632638
* (e.g. http://embedded.powerbi.com/appTokenReportEmbed?reportId=854846ed-2106-4dc2-bc58-eb77533bf2f1).
@@ -638,6 +644,22 @@ declare module "report" {
638644
* @returns {string}
639645
*/
640646
static findIdFromEmbedUrl(url: string): string;
647+
/**
648+
* Render a preloaded report, using phased embedding API
649+
*
650+
* ```javascript
651+
* // Load report
652+
* var report = powerbi.load(element, config);
653+
*
654+
* ...
655+
*
656+
* // Render report
657+
* report.render()
658+
* ```
659+
*
660+
* @returns {Promise<void>}
661+
*/
662+
render(config?: IReportLoadConfiguration): Promise<void>;
641663
/**
642664
* Gets filters that are applied at the report level.
643665
*
@@ -814,7 +836,7 @@ declare module "dashboard" {
814836
* @param {service.Service} service
815837
* @param {HTMLElement} element
816838
*/
817-
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfigurationBase);
839+
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfigurationBase, phasedRender?: boolean);
818840
/**
819841
* This adds backwards compatibility for older config which used the dashboardId query param to specify dashboard id.
820842
* E.g. https://powerbi-df.analysis-df.windows.net/dashboardEmbedHost?dashboardId=e9363c62-edb6-4eac-92d3-2199c5ca2a9e
@@ -863,7 +885,7 @@ declare module "tile" {
863885
export class Tile extends embed.Embed {
864886
static type: string;
865887
static allowedEvents: string[];
866-
constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase);
888+
constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean);
867889
/**
868890
* The ID of the tile
869891
*
@@ -919,7 +941,7 @@ declare module "qna" {
919941
export class Qna extends embed.Embed {
920942
static type: string;
921943
static allowedEvents: string[];
922-
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfigurationBase);
944+
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfigurationBase, phasedRender?: boolean);
923945
/**
924946
* The ID of the Qna embed component
925947
*
@@ -1047,7 +1069,18 @@ declare module "service" {
10471069
* @returns {embed.Embed}
10481070
*/
10491071
embed(element: HTMLElement, config?: embed.IEmbedConfigurationBase): embed.Embed;
1050-
embedInternal(element: HTMLElement, config?: embed.IEmbedConfigurationBase): embed.Embed;
1072+
/**
1073+
* Given a configuration based on an HTML element,
1074+
* if the component has already been created and attached to the element, reuses the component instance and existing iframe,
1075+
* otherwise creates a new component instance.
1076+
* This is used for the phased embedding API, once element is loaded successfully, one can call 'render' on it.
1077+
*
1078+
* @param {HTMLElement} element
1079+
* @param {embed.IEmbedConfigurationBase} [config={}]
1080+
* @returns {embed.Embed}
1081+
*/
1082+
load(element: HTMLElement, config?: embed.IEmbedConfigurationBase): embed.Embed;
1083+
embedInternal(element: HTMLElement, config?: embed.IEmbedConfigurationBase, phasedRender?: boolean): embed.Embed;
10511084
/**
10521085
* Given a configuration based on a Power BI element, saves the component instance that reference the element for later lookup.
10531086
*
@@ -1056,7 +1089,7 @@ declare module "service" {
10561089
* @param {embed.IEmbedConfigurationBase} config
10571090
* @returns {embed.Embed}
10581091
*/
1059-
private embedNew(element, config);
1092+
private embedNew(element, config, phasedRender?);
10601093
/**
10611094
* Given an element that already contains an embed component, load with a new configuration.
10621095
*
@@ -1065,7 +1098,7 @@ declare module "service" {
10651098
* @param {embed.IEmbedConfigurationBase} config
10661099
* @returns {embed.Embed}
10671100
*/
1068-
private embedExisting(element, config);
1101+
private embedExisting(element, config, phasedRender?);
10691102
/**
10701103
* Adds an event handler for DOMContentLoaded, which searches the DOM for elements that have the 'powerbi-embed-url' attribute,
10711104
* and automatically attempts to embed a powerbi component based on information from other powerbi-* attributes.
@@ -1125,7 +1158,7 @@ declare module "create" {
11251158
import * as models from 'powerbi-models';
11261159
import * as embed from "embed";
11271160
export class Create extends embed.Embed {
1128-
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration);
1161+
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration, phasedRender?: boolean);
11291162
/**
11301163
* Gets the dataset ID from the first available location: createConfig or embed url.
11311164
*

0 commit comments

Comments
 (0)