Skip to content

Commit 6d909af

Browse files
committed
Merged PR 4079: push bookmarks changes to master
1 parent 700a6ac commit 6d909af

File tree

5 files changed

+432
-90
lines changed

5 files changed

+432
-90
lines changed

dist/powerbi-client.d.ts

Lines changed: 115 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
/*! powerbi-client v2.4.7 | (c) 2016 Microsoft Corporation MIT */
2-
declare module "config" {
3-
const config: {
4-
version: string;
5-
type: string;
6-
};
7-
export default config;
8-
}
92
declare module "util" {
103
/**
114
* Raises a custom event with event data on the specified HTML element.
@@ -659,6 +652,7 @@ declare module "report" {
659652
import { IFilterable } from "ifilterable";
660653
import { Page } from "page";
661654
import { IReportLoadConfiguration } from 'powerbi-models';
655+
import { BookmarksManager } from "bookmarksManager";
662656
/**
663657
* A Report node within a report hierarchy
664658
*
@@ -686,6 +680,7 @@ declare module "report" {
686680
static navContentPaneEnabledAttribute: string;
687681
static typeAttribute: string;
688682
static type: string;
683+
bookmarksManager: BookmarksManager;
689684
/**
690685
* Creates an instance of a Power BI Report.
691686
*
@@ -862,6 +857,42 @@ declare module "report" {
862857
refresh(): Promise<void>;
863858
}
864859
}
860+
declare module "create" {
861+
import * as service from "service";
862+
import * as models from 'powerbi-models';
863+
import * as embed from "embed";
864+
export class Create extends embed.Embed {
865+
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration, phasedRender?: boolean);
866+
/**
867+
* Gets the dataset ID from the first available location: createConfig or embed url.
868+
*
869+
* @returns {string}
870+
*/
871+
getId(): string;
872+
/**
873+
* Validate create report configuration.
874+
*/
875+
validate(config: embed.IEmbedConfigurationBase): models.IError[];
876+
/**
877+
* Populate config for create
878+
*
879+
* @param {IEmbedConfigurationBase}
880+
* @returns {void}
881+
*/
882+
populateConfig(baseConfig: embed.IEmbedConfigurationBase): void;
883+
/**
884+
* Adds the ability to get datasetId from url.
885+
* (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1).
886+
*
887+
* By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration.
888+
*
889+
* @static
890+
* @param {string} url
891+
* @returns {string}
892+
*/
893+
static findIdFromEmbedUrl(url: string): string;
894+
}
895+
}
865896
declare module "dashboard" {
866897
import * as service from "service";
867898
import * as embed from "embed";
@@ -1275,42 +1306,99 @@ declare module "service" {
12751306
preload(config: embed.IEmbedConfigurationBase, element?: HTMLElement): HTMLIFrameElement;
12761307
}
12771308
}
1278-
declare module "create" {
1309+
declare module "bookmarksManager" {
12791310
import * as service from "service";
1280-
import * as models from 'powerbi-models';
12811311
import * as embed from "embed";
1282-
export class Create extends embed.Embed {
1283-
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration, phasedRender?: boolean);
1312+
import * as models from 'powerbi-models';
1313+
/**
1314+
* Report bookmarks management APIs.
1315+
*
1316+
* @export
1317+
* @interface IBookmarksManager
1318+
*/
1319+
export interface IBookmarksManager {
1320+
getBookmarks(): Promise<models.IReportBookmark[]>;
1321+
apply(bookmarkName: string): Promise<void>;
1322+
play(playMode: models.BookmarksPlayMode): Promise<void>;
1323+
capture(): Promise<models.IReportBookmark>;
1324+
applyState(state: string): Promise<void>;
1325+
}
1326+
/**
1327+
* Manages report bookmarks.
1328+
*
1329+
* @export
1330+
* @class BookmarksManager
1331+
* @implements {IBookmarksManager}
1332+
*/
1333+
export class BookmarksManager implements IBookmarksManager {
1334+
private service;
1335+
private config;
1336+
private iframe;
1337+
constructor(service: service.Service, config: embed.IEmbedConfigurationBase, iframe?: HTMLIFrameElement);
12841338
/**
1285-
* Gets the dataset ID from the first available location: createConfig or embed url.
1339+
* Gets bookmarks that are defined in the report.
12861340
*
1287-
* @returns {string}
1341+
* ```javascript
1342+
* // Gets bookmarks that are defined in the report
1343+
* bookmarksManager.getBookmarks()
1344+
* .then(bookmarks => {
1345+
* ...
1346+
* });
1347+
* ```
1348+
*
1349+
* @returns {Promise<models.IReportBookmark[]>}
12881350
*/
1289-
getId(): string;
1351+
getBookmarks(): Promise<models.IReportBookmark[]>;
12901352
/**
1291-
* Validate create report configuration.
1353+
* Apply bookmark By name.
1354+
*
1355+
* ```javascript
1356+
* bookmarksManager.apply(bookmarkName)
1357+
* ```
1358+
*
1359+
* @returns {Promise<void>}
12921360
*/
1293-
validate(config: embed.IEmbedConfigurationBase): models.IError[];
1361+
apply(bookmarkName: string): Promise<void>;
12941362
/**
1295-
* Populate config for create
1363+
* Play bookmarks: Enter or Exit bookmarks presentation mode.
12961364
*
1297-
* @param {IEmbedConfigurationBase}
1298-
* @returns {void}
1365+
* ```javascript
1366+
* // Enter presentation mode.
1367+
* bookmarksManager.play(true)
1368+
* ```
1369+
*
1370+
* @returns {Promise<void>}
12991371
*/
1300-
populateConfig(baseConfig: embed.IEmbedConfigurationBase): void;
1372+
play(playMode: models.BookmarksPlayMode): Promise<void>;
13011373
/**
1302-
* Adds the ability to get datasetId from url.
1303-
* (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1).
1374+
* Capture bookmark from current state.
13041375
*
1305-
* By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration.
1376+
* ```javascript
1377+
* bookmarksManager.capture()
1378+
* ```
13061379
*
1307-
* @static
1308-
* @param {string} url
1309-
* @returns {string}
1380+
* @returns {Promise<models.IReportBookmark>}
13101381
*/
1311-
static findIdFromEmbedUrl(url: string): string;
1382+
capture(): Promise<models.IReportBookmark>;
1383+
/**
1384+
* Apply bookmark state.
1385+
*
1386+
* ```javascript
1387+
* bookmarksManager.applyState(bookmarkName)
1388+
* ```
1389+
*
1390+
* @returns {Promise<void>}
1391+
*/
1392+
applyState(state: string): Promise<void>;
13121393
}
13131394
}
1395+
declare module "config" {
1396+
const config: {
1397+
version: string;
1398+
type: string;
1399+
};
1400+
export default config;
1401+
}
13141402
declare module "factories" {
13151403
/**
13161404
* TODO: Need to find better place for these factory functions or refactor how we handle dependency injection

0 commit comments

Comments
 (0)