Merged PR 4079: push bookmarks changes to master
This commit is contained in:
Родитель
700a6ac5be
Коммит
6d909afd7a
|
@ -1,11 +1,4 @@
|
|||
/*! powerbi-client v2.4.7 | (c) 2016 Microsoft Corporation MIT */
|
||||
declare module "config" {
|
||||
const config: {
|
||||
version: string;
|
||||
type: string;
|
||||
};
|
||||
export default config;
|
||||
}
|
||||
declare module "util" {
|
||||
/**
|
||||
* Raises a custom event with event data on the specified HTML element.
|
||||
|
@ -659,6 +652,7 @@ declare module "report" {
|
|||
import { IFilterable } from "ifilterable";
|
||||
import { Page } from "page";
|
||||
import { IReportLoadConfiguration } from 'powerbi-models';
|
||||
import { BookmarksManager } from "bookmarksManager";
|
||||
/**
|
||||
* A Report node within a report hierarchy
|
||||
*
|
||||
|
@ -686,6 +680,7 @@ declare module "report" {
|
|||
static navContentPaneEnabledAttribute: string;
|
||||
static typeAttribute: string;
|
||||
static type: string;
|
||||
bookmarksManager: BookmarksManager;
|
||||
/**
|
||||
* Creates an instance of a Power BI Report.
|
||||
*
|
||||
|
@ -862,6 +857,42 @@ declare module "report" {
|
|||
refresh(): Promise<void>;
|
||||
}
|
||||
}
|
||||
declare module "create" {
|
||||
import * as service from "service";
|
||||
import * as models from 'powerbi-models';
|
||||
import * as embed from "embed";
|
||||
export class Create extends embed.Embed {
|
||||
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration, phasedRender?: boolean);
|
||||
/**
|
||||
* Gets the dataset ID from the first available location: createConfig or embed url.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
getId(): string;
|
||||
/**
|
||||
* Validate create report configuration.
|
||||
*/
|
||||
validate(config: embed.IEmbedConfigurationBase): models.IError[];
|
||||
/**
|
||||
* Populate config for create
|
||||
*
|
||||
* @param {IEmbedConfigurationBase}
|
||||
* @returns {void}
|
||||
*/
|
||||
populateConfig(baseConfig: embed.IEmbedConfigurationBase): void;
|
||||
/**
|
||||
* Adds the ability to get datasetId from url.
|
||||
* (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1).
|
||||
*
|
||||
* By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration.
|
||||
*
|
||||
* @static
|
||||
* @param {string} url
|
||||
* @returns {string}
|
||||
*/
|
||||
static findIdFromEmbedUrl(url: string): string;
|
||||
}
|
||||
}
|
||||
declare module "dashboard" {
|
||||
import * as service from "service";
|
||||
import * as embed from "embed";
|
||||
|
@ -1275,41 +1306,98 @@ declare module "service" {
|
|||
preload(config: embed.IEmbedConfigurationBase, element?: HTMLElement): HTMLIFrameElement;
|
||||
}
|
||||
}
|
||||
declare module "create" {
|
||||
declare module "bookmarksManager" {
|
||||
import * as service from "service";
|
||||
import * as models from 'powerbi-models';
|
||||
import * as embed from "embed";
|
||||
export class Create extends embed.Embed {
|
||||
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration, phasedRender?: boolean);
|
||||
/**
|
||||
* Gets the dataset ID from the first available location: createConfig or embed url.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
getId(): string;
|
||||
/**
|
||||
* Validate create report configuration.
|
||||
*/
|
||||
validate(config: embed.IEmbedConfigurationBase): models.IError[];
|
||||
/**
|
||||
* Populate config for create
|
||||
*
|
||||
* @param {IEmbedConfigurationBase}
|
||||
* @returns {void}
|
||||
*/
|
||||
populateConfig(baseConfig: embed.IEmbedConfigurationBase): void;
|
||||
/**
|
||||
* Adds the ability to get datasetId from url.
|
||||
* (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1).
|
||||
*
|
||||
* By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration.
|
||||
*
|
||||
* @static
|
||||
* @param {string} url
|
||||
* @returns {string}
|
||||
*/
|
||||
static findIdFromEmbedUrl(url: string): string;
|
||||
import * as models from 'powerbi-models';
|
||||
/**
|
||||
* Report bookmarks management APIs.
|
||||
*
|
||||
* @export
|
||||
* @interface IBookmarksManager
|
||||
*/
|
||||
export interface IBookmarksManager {
|
||||
getBookmarks(): Promise<models.IReportBookmark[]>;
|
||||
apply(bookmarkName: string): Promise<void>;
|
||||
play(playMode: models.BookmarksPlayMode): Promise<void>;
|
||||
capture(): Promise<models.IReportBookmark>;
|
||||
applyState(state: string): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Manages report bookmarks.
|
||||
*
|
||||
* @export
|
||||
* @class BookmarksManager
|
||||
* @implements {IBookmarksManager}
|
||||
*/
|
||||
export class BookmarksManager implements IBookmarksManager {
|
||||
private service;
|
||||
private config;
|
||||
private iframe;
|
||||
constructor(service: service.Service, config: embed.IEmbedConfigurationBase, iframe?: HTMLIFrameElement);
|
||||
/**
|
||||
* Gets bookmarks that are defined in the report.
|
||||
*
|
||||
* ```javascript
|
||||
* // Gets bookmarks that are defined in the report
|
||||
* bookmarksManager.getBookmarks()
|
||||
* .then(bookmarks => {
|
||||
* ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<models.IReportBookmark[]>}
|
||||
*/
|
||||
getBookmarks(): Promise<models.IReportBookmark[]>;
|
||||
/**
|
||||
* Apply bookmark By name.
|
||||
*
|
||||
* ```javascript
|
||||
* bookmarksManager.apply(bookmarkName)
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
apply(bookmarkName: string): Promise<void>;
|
||||
/**
|
||||
* Play bookmarks: Enter or Exit bookmarks presentation mode.
|
||||
*
|
||||
* ```javascript
|
||||
* // Enter presentation mode.
|
||||
* bookmarksManager.play(true)
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
play(playMode: models.BookmarksPlayMode): Promise<void>;
|
||||
/**
|
||||
* Capture bookmark from current state.
|
||||
*
|
||||
* ```javascript
|
||||
* bookmarksManager.capture()
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<models.IReportBookmark>}
|
||||
*/
|
||||
capture(): Promise<models.IReportBookmark>;
|
||||
/**
|
||||
* Apply bookmark state.
|
||||
*
|
||||
* ```javascript
|
||||
* bookmarksManager.applyState(bookmarkName)
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
applyState(state: string): Promise<void>;
|
||||
}
|
||||
}
|
||||
declare module "config" {
|
||||
const config: {
|
||||
version: string;
|
||||
type: string;
|
||||
};
|
||||
export default config;
|
||||
}
|
||||
declare module "factories" {
|
||||
/**
|
||||
|
|
|
@ -57,23 +57,23 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
var service = __webpack_require__(1);
|
||||
exports.service = service;
|
||||
var factories = __webpack_require__(14);
|
||||
var factories = __webpack_require__(15);
|
||||
exports.factories = factories;
|
||||
var models = __webpack_require__(4);
|
||||
exports.models = models;
|
||||
var report_1 = __webpack_require__(5);
|
||||
exports.Report = report_1.Report;
|
||||
var dashboard_1 = __webpack_require__(10);
|
||||
var dashboard_1 = __webpack_require__(11);
|
||||
exports.Dashboard = dashboard_1.Dashboard;
|
||||
var tile_1 = __webpack_require__(11);
|
||||
var tile_1 = __webpack_require__(12);
|
||||
exports.Tile = tile_1.Tile;
|
||||
var embed_1 = __webpack_require__(2);
|
||||
exports.Embed = embed_1.Embed;
|
||||
var page_1 = __webpack_require__(6);
|
||||
exports.Page = page_1.Page;
|
||||
var qna_1 = __webpack_require__(12);
|
||||
var qna_1 = __webpack_require__(13);
|
||||
exports.Qna = qna_1.Qna;
|
||||
var visual_1 = __webpack_require__(13);
|
||||
var visual_1 = __webpack_require__(14);
|
||||
exports.Visual = visual_1.Visual;
|
||||
var visualDescriptor_1 = __webpack_require__(7);
|
||||
exports.VisualDescriptor = visualDescriptor_1.VisualDescriptor;
|
||||
|
@ -92,12 +92,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
var embed = __webpack_require__(2);
|
||||
var report_1 = __webpack_require__(5);
|
||||
var create_1 = __webpack_require__(9);
|
||||
var dashboard_1 = __webpack_require__(10);
|
||||
var tile_1 = __webpack_require__(11);
|
||||
var create_1 = __webpack_require__(10);
|
||||
var dashboard_1 = __webpack_require__(11);
|
||||
var tile_1 = __webpack_require__(12);
|
||||
var page_1 = __webpack_require__(6);
|
||||
var qna_1 = __webpack_require__(12);
|
||||
var visual_1 = __webpack_require__(13);
|
||||
var qna_1 = __webpack_require__(13);
|
||||
var visual_1 = __webpack_require__(14);
|
||||
var utils = __webpack_require__(3);
|
||||
/**
|
||||
* The Power BI Service embed component, which is the entry point to embed all other Power BI components into your application
|
||||
|
@ -3416,6 +3416,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
var utils = __webpack_require__(3);
|
||||
var page_1 = __webpack_require__(6);
|
||||
var defaults_1 = __webpack_require__(8);
|
||||
var bookmarksManager_1 = __webpack_require__(9);
|
||||
/**
|
||||
* The Power BI Report embed component
|
||||
*
|
||||
|
@ -3447,6 +3448,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
this.loadPath = "/report/load";
|
||||
this.phasedLoadPath = "/report/prepare";
|
||||
Array.prototype.push.apply(this.allowedEvents, Report.allowedEvents);
|
||||
this.bookmarksManager = new bookmarksManager_1.BookmarksManager(service, config, this.iframe);
|
||||
}
|
||||
/**
|
||||
* Adds backwards compatibility for the previous load configuration, which used the reportId query parameter to specify the report ID
|
||||
|
@ -3714,7 +3716,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
throw response.body;
|
||||
});
|
||||
};
|
||||
Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd"];
|
||||
Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied"];
|
||||
Report.reportIdAttribute = 'powerbi-report-id';
|
||||
Report.filterPaneEnabledAttribute = 'powerbi-settings-filter-pane-enabled';
|
||||
Report.navContentPaneEnabledAttribute = 'powerbi-settings-nav-content-pane-enabled';
|
||||
|
@ -3974,6 +3976,117 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
/***/ }),
|
||||
/* 9 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/**
|
||||
* Manages report bookmarks.
|
||||
*
|
||||
* @export
|
||||
* @class BookmarksManager
|
||||
* @implements {IBookmarksManager}
|
||||
*/
|
||||
var BookmarksManager = (function () {
|
||||
function BookmarksManager(service, config, iframe) {
|
||||
this.service = service;
|
||||
this.config = config;
|
||||
this.iframe = iframe;
|
||||
}
|
||||
/**
|
||||
* Gets bookmarks that are defined in the report.
|
||||
*
|
||||
* ```javascript
|
||||
* // Gets bookmarks that are defined in the report
|
||||
* bookmarksManager.getBookmarks()
|
||||
* .then(bookmarks => {
|
||||
* ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<models.IReportBookmark[]>}
|
||||
*/
|
||||
BookmarksManager.prototype.getBookmarks = function () {
|
||||
return this.service.hpm.get("/report/bookmarks", { uid: this.config.uniqueId }, this.iframe.contentWindow)
|
||||
.then(function (response) { return response.body; }, function (response) {
|
||||
throw response.body;
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Apply bookmark By name.
|
||||
*
|
||||
* ```javascript
|
||||
* bookmarksManager.apply(bookmarkName)
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
BookmarksManager.prototype.apply = function (bookmarkName) {
|
||||
var request = {
|
||||
name: bookmarkName
|
||||
};
|
||||
return this.service.hpm.post("/report/bookmarks/applyByName", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)
|
||||
.catch(function (response) {
|
||||
throw response.body;
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Play bookmarks: Enter or Exit bookmarks presentation mode.
|
||||
*
|
||||
* ```javascript
|
||||
* // Enter presentation mode.
|
||||
* bookmarksManager.play(true)
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
BookmarksManager.prototype.play = function (playMode) {
|
||||
var playBookmarkRequest = {
|
||||
playMode: playMode
|
||||
};
|
||||
return this.service.hpm.post("/report/bookmarks/play", playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow)
|
||||
.catch(function (response) {
|
||||
throw response.body;
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Capture bookmark from current state.
|
||||
*
|
||||
* ```javascript
|
||||
* bookmarksManager.capture()
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<models.IReportBookmark>}
|
||||
*/
|
||||
BookmarksManager.prototype.capture = function () {
|
||||
return this.service.hpm.post("/report/bookmarks/capture", null, { uid: this.config.uniqueId }, this.iframe.contentWindow)
|
||||
.then(function (response) { return response.body; }, function (response) {
|
||||
throw response.body;
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Apply bookmark state.
|
||||
*
|
||||
* ```javascript
|
||||
* bookmarksManager.applyState(bookmarkName)
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
BookmarksManager.prototype.applyState = function (state) {
|
||||
var request = {
|
||||
state: state
|
||||
};
|
||||
return this.service.hpm.post("/report/bookmarks/applyState", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)
|
||||
.catch(function (response) {
|
||||
throw response.body;
|
||||
});
|
||||
};
|
||||
return BookmarksManager;
|
||||
}());
|
||||
exports.BookmarksManager = BookmarksManager;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 10 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
|
@ -4052,7 +4165,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
|
||||
/***/ }),
|
||||
/* 10 */
|
||||
/* 11 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
|
@ -4160,7 +4273,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
|
||||
/***/ }),
|
||||
/* 11 */
|
||||
/* 12 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
|
@ -4247,7 +4360,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
|
||||
/***/ }),
|
||||
/* 12 */
|
||||
/* 13 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
|
@ -4309,7 +4422,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
|
||||
/***/ }),
|
||||
/* 13 */
|
||||
/* 14 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
|
@ -4447,13 +4560,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
|
||||
/***/ }),
|
||||
/* 14 */
|
||||
/* 15 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var config_1 = __webpack_require__(15);
|
||||
var wpmp = __webpack_require__(16);
|
||||
var hpm = __webpack_require__(17);
|
||||
var router = __webpack_require__(18);
|
||||
var config_1 = __webpack_require__(16);
|
||||
var wpmp = __webpack_require__(17);
|
||||
var hpm = __webpack_require__(18);
|
||||
var router = __webpack_require__(19);
|
||||
exports.hpmFactory = function (wpmp, defaultTargetWindow, sdkVersion, sdkType) {
|
||||
if (sdkVersion === void 0) { sdkVersion = config_1.default.version; }
|
||||
if (sdkType === void 0) { sdkType = config_1.default.type; }
|
||||
|
@ -4481,7 +4594,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
|
||||
/***/ }),
|
||||
/* 15 */
|
||||
/* 16 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var config = {
|
||||
|
@ -4493,10 +4606,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
|
||||
/***/ }),
|
||||
/* 16 */
|
||||
/* 17 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/*! window-post-message-proxy v0.2.4 | (c) 2016 Microsoft Corporation MIT */
|
||||
/*! window-post-message-proxy v0.2.5 | (c) 2016 Microsoft Corporation MIT */
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(true)
|
||||
module.exports = factory();
|
||||
|
@ -4551,7 +4664,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
var WindowPostMessageProxy = (function () {
|
||||
|
@ -4786,14 +4899,14 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
exports.WindowPostMessageProxy = WindowPostMessageProxy;
|
||||
|
||||
|
||||
/***/ }
|
||||
/***/ })
|
||||
/******/ ])
|
||||
});
|
||||
;
|
||||
//# sourceMappingURL=windowPostMessageProxy.js.map
|
||||
|
||||
/***/ }),
|
||||
/* 17 */
|
||||
/* 18 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/*! http-post-message v0.2.3 | (c) 2016 Microsoft Corporation MIT */
|
||||
|
@ -4977,7 +5090,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
//# sourceMappingURL=httpPostMessage.js.map
|
||||
|
||||
/***/ }),
|
||||
/* 18 */
|
||||
/* 19 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/*! powerbi-router v0.1.5 | (c) 2016 Microsoft Corporation MIT */
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -0,0 +1,136 @@
|
|||
import * as service from './service';
|
||||
import * as embed from './embed';
|
||||
import * as models from 'powerbi-models';
|
||||
import * as wpmp from 'window-post-message-proxy';
|
||||
import * as hpm from 'http-post-message';
|
||||
import * as utils from './util';
|
||||
import { IPageNode, Page } from './page';
|
||||
import { Defaults } from './defaults';
|
||||
import { IReportLoadConfiguration } from 'powerbi-models';
|
||||
|
||||
/**
|
||||
* Report bookmarks management APIs.
|
||||
*
|
||||
* @export
|
||||
* @interface IBookmarksManager
|
||||
*/
|
||||
export interface IBookmarksManager {
|
||||
getBookmarks(): Promise<models.IReportBookmark[]>;
|
||||
apply(bookmarkName: string): Promise<void>;
|
||||
play(playMode: models.BookmarksPlayMode): Promise<void>;
|
||||
|
||||
capture(): Promise<models.IReportBookmark>;
|
||||
applyState(state: string): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages report bookmarks.
|
||||
*
|
||||
* @export
|
||||
* @class BookmarksManager
|
||||
* @implements {IBookmarksManager}
|
||||
*/
|
||||
export class BookmarksManager implements IBookmarksManager {
|
||||
|
||||
constructor(private service: service.Service, private config: embed.IEmbedConfigurationBase, private iframe?: HTMLIFrameElement) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets bookmarks that are defined in the report.
|
||||
*
|
||||
* ```javascript
|
||||
* // Gets bookmarks that are defined in the report
|
||||
* bookmarksManager.getBookmarks()
|
||||
* .then(bookmarks => {
|
||||
* ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<models.IReportBookmark[]>}
|
||||
*/
|
||||
getBookmarks(): Promise<models.IReportBookmark[]> {
|
||||
return this.service.hpm.get<models.IReportBookmark[]>(`/report/bookmarks`, { uid: this.config.uniqueId }, this.iframe.contentWindow)
|
||||
.then(response => response.body,
|
||||
response => {
|
||||
throw response.body;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply bookmark By name.
|
||||
*
|
||||
* ```javascript
|
||||
* bookmarksManager.apply(bookmarkName)
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
apply(bookmarkName: string): Promise<void> {
|
||||
var request: models.IApplyBookmarkByNameRequest = {
|
||||
name: bookmarkName
|
||||
};
|
||||
|
||||
return this.service.hpm.post<models.IError[]>(`/report/bookmarks/applyByName`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow)
|
||||
.catch(response => {
|
||||
throw response.body;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Play bookmarks: Enter or Exit bookmarks presentation mode.
|
||||
*
|
||||
* ```javascript
|
||||
* // Enter presentation mode.
|
||||
* bookmarksManager.play(true)
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
play(playMode: models.BookmarksPlayMode): Promise<void> {
|
||||
var playBookmarkRequest: models.IPlayBookmarkRequest = {
|
||||
playMode: playMode
|
||||
};
|
||||
|
||||
return this.service.hpm.post<models.IError[]>(`/report/bookmarks/play`, playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow)
|
||||
.catch(response => {
|
||||
throw response.body;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture bookmark from current state.
|
||||
*
|
||||
* ```javascript
|
||||
* bookmarksManager.capture()
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<models.IReportBookmark>}
|
||||
*/
|
||||
capture(): Promise<models.IReportBookmark> {
|
||||
return this.service.hpm.post<models.IReportBookmark>(`/report/bookmarks/capture`, null, { uid: this.config.uniqueId }, this.iframe.contentWindow)
|
||||
.then(response => response.body,
|
||||
response => {
|
||||
throw response.body;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply bookmark state.
|
||||
*
|
||||
* ```javascript
|
||||
* bookmarksManager.applyState(bookmarkName)
|
||||
* ```
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
applyState(state: string): Promise<void> {
|
||||
var request: models.IApplyBookmarkStateRequest = {
|
||||
state: state
|
||||
};
|
||||
|
||||
return this.service.hpm.post<models.IError[]>(`/report/bookmarks/applyState`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow)
|
||||
.catch(response => {
|
||||
throw response.body;
|
||||
});
|
||||
}
|
||||
}
|
|
@ -8,10 +8,11 @@ import { IFilterable } from './ifilterable';
|
|||
import { IPageNode, Page } from './page';
|
||||
import { Defaults } from './defaults';
|
||||
import { IReportLoadConfiguration } from 'powerbi-models';
|
||||
import { BookmarksManager } from './bookmarksManager';
|
||||
|
||||
/**
|
||||
* A Report node within a report hierarchy
|
||||
*
|
||||
*
|
||||
* @export
|
||||
* @interface IReportNode
|
||||
*/
|
||||
|
@ -23,7 +24,7 @@ export interface IReportNode {
|
|||
|
||||
/**
|
||||
* The Power BI Report embed component
|
||||
*
|
||||
*
|
||||
* @export
|
||||
* @class Report
|
||||
* @extends {embed.Embed}
|
||||
|
@ -31,16 +32,18 @@ export interface IReportNode {
|
|||
* @implements {IFilterable}
|
||||
*/
|
||||
export class Report extends embed.Embed implements IReportNode, IFilterable {
|
||||
static allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd"];
|
||||
static allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied"];
|
||||
static reportIdAttribute = 'powerbi-report-id';
|
||||
static filterPaneEnabledAttribute = 'powerbi-settings-filter-pane-enabled';
|
||||
static navContentPaneEnabledAttribute = 'powerbi-settings-nav-content-pane-enabled';
|
||||
static typeAttribute = 'powerbi-type';
|
||||
static type = "Report";
|
||||
|
||||
public bookmarksManager: BookmarksManager;
|
||||
|
||||
/**
|
||||
* Creates an instance of a Power BI Report.
|
||||
*
|
||||
*
|
||||
* @param {service.Service} service
|
||||
* @param {HTMLElement} element
|
||||
* @param {embed.IEmbedConfiguration} config
|
||||
|
@ -60,14 +63,16 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
this.loadPath = "/report/load";
|
||||
this.phasedLoadPath = "/report/prepare";
|
||||
Array.prototype.push.apply(this.allowedEvents, Report.allowedEvents);
|
||||
|
||||
this.bookmarksManager = new BookmarksManager(service, config, this.iframe);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds backwards compatibility for the previous load configuration, which used the reportId query parameter to specify the report ID
|
||||
* (e.g. http://embedded.powerbi.com/appTokenReportEmbed?reportId=854846ed-2106-4dc2-bc58-eb77533bf2f1).
|
||||
*
|
||||
*
|
||||
* By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration.
|
||||
*
|
||||
*
|
||||
* @static
|
||||
* @param {string} url
|
||||
* @returns {string}
|
||||
|
@ -84,20 +89,20 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
return reportId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Render a preloaded report, using phased embedding API
|
||||
*
|
||||
*
|
||||
* ```javascript
|
||||
* // Load report
|
||||
* var report = powerbi.load(element, config);
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Render report
|
||||
* report.render()
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
render(config?: IReportLoadConfiguration): Promise<void> {
|
||||
|
@ -112,7 +117,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
|
||||
/**
|
||||
* Gets filters that are applied at the report level.
|
||||
*
|
||||
*
|
||||
* ```javascript
|
||||
* // Get filters applied at report level
|
||||
* report.getFilters()
|
||||
|
@ -120,7 +125,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
* ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @returns {Promise<models.IFilter[]>}
|
||||
*/
|
||||
getFilters(): Promise<models.IFilter[]> {
|
||||
|
@ -133,7 +138,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
|
||||
/**
|
||||
* Gets the report ID from the first available location: options, attribute, embed url.
|
||||
*
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
getId(): string {
|
||||
|
@ -149,14 +154,14 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
|
||||
/**
|
||||
* Gets the list of pages within the report.
|
||||
*
|
||||
*
|
||||
* ```javascript
|
||||
* report.getPages()
|
||||
* .then(pages => {
|
||||
* ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @returns {Promise<Page[]>}
|
||||
*/
|
||||
getPages(): Promise<Page[]> {
|
||||
|
@ -173,18 +178,18 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
|
||||
/**
|
||||
* Creates an instance of a Page.
|
||||
*
|
||||
*
|
||||
* Normally you would get Page objects by calling `report.getPages()`, but in the case
|
||||
* that the page name is known and you want to perform an action on a page without having to retrieve it
|
||||
* you can create it directly.
|
||||
*
|
||||
*
|
||||
* Note: Because you are creating the page manually there is no guarantee that the page actually exists in the report, and subsequent requests could fail.
|
||||
*
|
||||
*
|
||||
* ```javascript
|
||||
* const page = report.page('ReportSection1');
|
||||
* page.setActive();
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {string} [displayName]
|
||||
* @param {boolean} [isActive]
|
||||
|
@ -209,11 +214,11 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
|
||||
/**
|
||||
* Removes all filters at the report level.
|
||||
*
|
||||
*
|
||||
* ```javascript
|
||||
* report.removeFilters();
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
removeFilters(): Promise<void> {
|
||||
|
@ -222,12 +227,12 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
|
||||
/**
|
||||
* Sets the active page of the report.
|
||||
*
|
||||
*
|
||||
* ```javascript
|
||||
* report.setPage("page2")
|
||||
* .catch(error => { ... });
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @param {string} pageName
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
|
@ -246,18 +251,18 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
|
||||
/**
|
||||
* Sets filters at the report level.
|
||||
*
|
||||
*
|
||||
* ```javascript
|
||||
* const filters: [
|
||||
* ...
|
||||
* ];
|
||||
*
|
||||
*
|
||||
* report.setFilters(filters)
|
||||
* .catch(errors => {
|
||||
* ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @param {(models.IFilter[])} filters
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
|
@ -270,17 +275,17 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
|
||||
/**
|
||||
* Updates visibility settings for the filter pane and the page navigation pane.
|
||||
*
|
||||
*
|
||||
* ```javascript
|
||||
* const newSettings = {
|
||||
* navContentPaneEnabled: true,
|
||||
* filterPaneEnabled: false
|
||||
* };
|
||||
*
|
||||
*
|
||||
* report.updateSettings(newSettings)
|
||||
* .catch(error => { ... });
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @param {models.ISettings} settings
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
|
@ -300,7 +305,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
|
||||
/**
|
||||
* Populate config for load config
|
||||
*
|
||||
*
|
||||
* @param {IEmbedConfigurationBase}
|
||||
* @returns {void}
|
||||
*/
|
||||
|
@ -321,7 +326,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
|
||||
/**
|
||||
* Switch Report view mode.
|
||||
*
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
switchMode(viewMode: models.ViewMode): Promise<void> {
|
||||
|
@ -337,7 +342,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
|
|||
|
||||
/**
|
||||
* Refreshes data sources for the report.
|
||||
*
|
||||
*
|
||||
* ```javascript
|
||||
* report.refresh();
|
||||
* ```
|
||||
|
|
Загрузка…
Ссылка в новой задаче