|
1 | 1 | /*! 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 | | -} |
9 | 2 | declare module "util" { |
10 | 3 | /** |
11 | 4 | * Raises a custom event with event data on the specified HTML element. |
@@ -659,6 +652,7 @@ declare module "report" { |
659 | 652 | import { IFilterable } from "ifilterable"; |
660 | 653 | import { Page } from "page"; |
661 | 654 | import { IReportLoadConfiguration } from 'powerbi-models'; |
| 655 | + import { BookmarksManager } from "bookmarksManager"; |
662 | 656 | /** |
663 | 657 | * A Report node within a report hierarchy |
664 | 658 | * |
@@ -686,6 +680,7 @@ declare module "report" { |
686 | 680 | static navContentPaneEnabledAttribute: string; |
687 | 681 | static typeAttribute: string; |
688 | 682 | static type: string; |
| 683 | + bookmarksManager: BookmarksManager; |
689 | 684 | /** |
690 | 685 | * Creates an instance of a Power BI Report. |
691 | 686 | * |
@@ -862,6 +857,42 @@ declare module "report" { |
862 | 857 | refresh(): Promise<void>; |
863 | 858 | } |
864 | 859 | } |
| 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 | +} |
865 | 896 | declare module "dashboard" { |
866 | 897 | import * as service from "service"; |
867 | 898 | import * as embed from "embed"; |
@@ -1275,42 +1306,99 @@ declare module "service" { |
1275 | 1306 | preload(config: embed.IEmbedConfigurationBase, element?: HTMLElement): HTMLIFrameElement; |
1276 | 1307 | } |
1277 | 1308 | } |
1278 | | -declare module "create" { |
| 1309 | +declare module "bookmarksManager" { |
1279 | 1310 | import * as service from "service"; |
1280 | | - import * as models from 'powerbi-models'; |
1281 | 1311 | 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); |
1284 | 1338 | /** |
1285 | | - * Gets the dataset ID from the first available location: createConfig or embed url. |
| 1339 | + * Gets bookmarks that are defined in the report. |
1286 | 1340 | * |
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[]>} |
1288 | 1350 | */ |
1289 | | - getId(): string; |
| 1351 | + getBookmarks(): Promise<models.IReportBookmark[]>; |
1290 | 1352 | /** |
1291 | | - * Validate create report configuration. |
| 1353 | + * Apply bookmark By name. |
| 1354 | + * |
| 1355 | + * ```javascript |
| 1356 | + * bookmarksManager.apply(bookmarkName) |
| 1357 | + * ``` |
| 1358 | + * |
| 1359 | + * @returns {Promise<void>} |
1292 | 1360 | */ |
1293 | | - validate(config: embed.IEmbedConfigurationBase): models.IError[]; |
| 1361 | + apply(bookmarkName: string): Promise<void>; |
1294 | 1362 | /** |
1295 | | - * Populate config for create |
| 1363 | + * Play bookmarks: Enter or Exit bookmarks presentation mode. |
1296 | 1364 | * |
1297 | | - * @param {IEmbedConfigurationBase} |
1298 | | - * @returns {void} |
| 1365 | + * ```javascript |
| 1366 | + * // Enter presentation mode. |
| 1367 | + * bookmarksManager.play(true) |
| 1368 | + * ``` |
| 1369 | + * |
| 1370 | + * @returns {Promise<void>} |
1299 | 1371 | */ |
1300 | | - populateConfig(baseConfig: embed.IEmbedConfigurationBase): void; |
| 1372 | + play(playMode: models.BookmarksPlayMode): Promise<void>; |
1301 | 1373 | /** |
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. |
1304 | 1375 | * |
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 | + * ``` |
1306 | 1379 | * |
1307 | | - * @static |
1308 | | - * @param {string} url |
1309 | | - * @returns {string} |
| 1380 | + * @returns {Promise<models.IReportBookmark>} |
1310 | 1381 | */ |
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>; |
1312 | 1393 | } |
1313 | 1394 | } |
| 1395 | +declare module "config" { |
| 1396 | + const config: { |
| 1397 | + version: string; |
| 1398 | + type: string; |
| 1399 | + }; |
| 1400 | + export default config; |
| 1401 | +} |
1314 | 1402 | declare module "factories" { |
1315 | 1403 | /** |
1316 | 1404 | * TODO: Need to find better place for these factory functions or refactor how we handle dependency injection |
|
0 commit comments