Merged PR 25222: Add GetVisuals to SDK and live sample.

This commit is contained in:
Ali Hamud 2017-11-19 12:39:14 +00:00
Родитель 7f3c5ab819
Коммит 3a710806e3
25 изменённых файлов: 465 добавлений и 191 удалений

Просмотреть файл

@ -23,40 +23,40 @@
<div id="report-operations-div" class="operations-div">
<ul class="function-ul">
<li class="active" onclick="Report_GetId()">Get Id</li>
<li class="" onclick="Report_GetPages()">Get pages</li>
<li class="" onclick="Report_SetPage()">Set page</li>
<li class="" onclick="Report_SetFilters()">Set filters</li>
<li class="" onclick="Report_GetFilters()">Get filters</li>
<li class="" onclick="Report_RemoveFilters()">Remove filters</li>
<li class="" onclick="Report_PrintCurrentReport()">Print</li>
<li class="" onclick="Report_UpdateSettings()">Update settings</li>
<li class="" onclick="Report_Reload()">Reload</li>
<li class="" onclick="Report_Refresh()">Refresh</li>
<li class="" onclick="Report_FullScreen()">Full screen</li>
<li class="" onclick="Report_ExitFullScreen()">Exit full screen</li>
<li onclick="Report_GetPages()">Get pages</li>
<li onclick="Report_SetPage()">Set page</li>
<li onclick="Report_SetFilters()">Set filters</li>
<li onclick="Report_GetFilters()">Get filters</li>
<li onclick="Report_RemoveFilters()">Remove filters</li>
<li onclick="Report_PrintCurrentReport()">Print</li>
<li onclick="Report_UpdateSettings()">Update settings</li>
<li onclick="Report_Reload()">Reload</li>
<li onclick="Report_Refresh()">Refresh</li>
<li onclick="Report_FullScreen()">Full screen</li>
<li onclick="Report_ExitFullScreen()">Exit full screen</li>
</ul>
</div>
<div id="page-operations-div" class="operations-div" style="display: none;">
<ul class="function-ul">
<li class="active" onclick="Page_SetActive()">Set Active</li>
<li class="" onclick="Page_SetFilters()">Set Filters</li>
<li class="" onclick="Page_GetFilters()">Get Filters</li>
<li class="" onclick="Page_RemoveFilters()">Remove Filters</li>
<li onclick="Page_SetFilters()">Set Filters</li>
<li onclick="Page_GetFilters()">Get Filters</li>
<li onclick="Page_RemoveFilters()">Remove Filters</li>
</ul>
</div>
<div id="events-operations-div" class="operations-div" style="display: none;">
<ul class="function-ul">
<li class="active" onclick="Events_PageChanged()">Page Changed</li>
<li class="" onclick="Events_DataSelected()">Data Selected</li>
<li class="" onclick="Events_SaveAsTriggered()">SaveAs Triggered</li>
<li onclick="Events_DataSelected()">Data Selected</li>
<li onclick="Events_SaveAsTriggered()">SaveAs Triggered</li>
</ul>
</div>
<div id="editandsave-operations-div" class="operations-div" style="display: none;">
<ul class="function-ul">
<li class="" onclick="Report_switchModeEdit()">Enter edit mode</li>
<li class="" onclick="Report_switchModeView()">Enter view mode</li>
<li class="" onclick="Report_save()">Save report</li>
<li class="" onclick="Report_saveAs()">SaveAs report</li>
<li onclick="Report_switchModeEdit()">Enter edit mode</li>
<li onclick="Report_switchModeView()">Enter view mode</li>
<li onclick="Report_save()">Save report</li>
<li onclick="Report_saveAs()">SaveAs report</li>
</ul>
</div>
</div>

Просмотреть файл

@ -17,12 +17,12 @@
<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
<li id="pageLinkStatic" class=""><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic" class=""><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav" class=""><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkStatic"><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic"><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav"><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters"><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults"><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings"><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class="active"><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>

Просмотреть файл

@ -17,13 +17,13 @@
<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
<li id="pageLinkStatic" class=""><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic" class=""><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav" class=""><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkStatic"><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic"><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav"><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters"><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class="active"><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
<li id="pageLinkSettings"><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection"><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>
<h2>Default Page and/or Default Filter</h2>

Просмотреть файл

@ -17,13 +17,13 @@
<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
<li id="pageLinkStatic" class=""><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkStatic"><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic" class="active"><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav" class=""><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
<li id="pageLinkPageNav"><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters"><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults"><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings"><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection"><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>
<h2>Dynamic Embed</h2>

Просмотреть файл

@ -17,13 +17,13 @@
<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
<li id="pageLinkStatic" class=""><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic" class=""><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav" class=""><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkStatic"><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic"><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav"><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters" class="active"><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
<li id="pageLinkDefaults"><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings"><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection"><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>
<h2>Custom Filter Pane</h2>

Просмотреть файл

@ -35,7 +35,7 @@
"fetch": "^1.0.0",
"http-server": "^0.9.0",
"jquery": "^3.1.0",
"powerbi-client": "2.4.3",
"powerbi-client": "2.4.4",
"syntaxhighlighter": "4.0.1"
},
"devDependencies": {}

Просмотреть файл

@ -17,13 +17,13 @@
<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
<li id="pageLinkStatic" class=""><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic" class=""><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkStatic"><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic"><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav" class="active"><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
<li id="pageLinkFilters"><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults"><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings"><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection"><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>
<h2>Custom Page Navigation</h2>

Просмотреть файл

@ -17,13 +17,13 @@
<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
<li id="pageLinkStatic" class=""><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic" class=""><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav" class=""><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkStatic"><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic"><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav"><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters"><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults"><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class="active"><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
<li id="pageLinkDataSelection"><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>
<h2>Update Settings</h2>

Просмотреть файл

@ -18,12 +18,12 @@
<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
<li id="pageLinkStatic" class="active"><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic" class=""><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav" class=""><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
<li id="pageLinkDynamic"><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav"><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters"><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults"><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings"><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection"><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>
<h2>Static Embed</h2>

Просмотреть файл

@ -894,19 +894,60 @@ function _Page_GetFilters() {
// Retrieve the page collection and get the filters for the first page.
report.getPages()
.then(function (pages) {
pages[0].getFilters()
.then(function (filters) {
Log.log(filters);
})
.catch(function (errors) {
Log.log(errors);
});
// Retrieve active page.
var activePage = pages.find(function(page) {
return page.isActive
});
activePage.getFilters()
.then(function (filters) {
Log.log(filters);
})
.catch(function (errors) {
Log.log(errors);
});
})
.catch(function (errors) {
Log.log(errors);
});
}
function _Page_GetVisuals() {
// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];
// Get a reference to the embedded report.
report = powerbi.get(embedContainer);
// Retrieve the page collection and get the visuals for the first page.
report.getPages()
.then(function (pages) {
// Retrieve active page.
var activePage = pages.find(function(page) {
return page.isActive
});
activePage.getVisuals()
.then(function (visuals) {
Log.log(
visuals.map(function(visual) {
return {
name: visual.name,
type: visual.type,
title: visual.title,
layout: visual.layout
};
}));
})
.catch(function (errors) {
Log.log(errors);
});
})
.catch(function (errors) {
Log.log(errors);
});
}
function _Page_SetFilters() {
// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];
@ -930,13 +971,18 @@ function _Page_SetFilters() {
// Pay attention that setFilters receives an array.
report.getPages()
.then(function (pages) {
pages[0].setFilters([filter])
.then(function (result) {
Log.log(result);
})
.catch(function (errors) {
Log.log(errors);
});
// Retrieve active page.
var activePage = pages.find(function(page) {
return page.isActive
});
activePage.setFilters([filter])
.then(function (result) {
Log.log(result);
})
.catch(function (errors) {
Log.log(errors);
});
})
.catch(function (errors) {
Log.log(errors);
@ -953,13 +999,18 @@ function _Page_RemoveFilters() {
// Retrieve the page collection and remove the filters for the first page.
report.getPages()
.then(function (pages) {
pages[0].removeFilters()
.then(function (result) {
Log.log(result);
})
.catch(function (errors) {
Log.log(errors);
});
// Retrieve active page.
var activePage = pages.find(function(page) {
return page.isActive
});
activePage.removeFilters()
.then(function (result) {
Log.log(result);
})
.catch(function (errors) {
Log.log(errors);
});
})
.catch(function (errors) {
Log.log(errors);

Просмотреть файл

@ -11,6 +11,7 @@ const mockDict = {
_Page_SetFilters: datasetNotSupported,
_Page_GetFilters: datasetNotSupported,
_Page_RemoveFilters: datasetNotSupported,
_Page_GetVisuals: datasetNotSupported,
_Report_switchModeEdit: datasetNotSupported,
_Report_switchModeView: datasetNotSupported,
_Embed_BasicEmbed: _Mock_Embed_BasicEmbed_ViewMode,

Просмотреть файл

@ -65,6 +65,10 @@ function Page_GetFilters() {
SetCode(_Page_GetFilters);
}
function Page_GetVisuals() {
SetCode(_Page_GetVisuals);
}
function Page_SetFilters() {
SetCode(_Page_SetFilters);
}

Просмотреть файл

@ -23,42 +23,43 @@
<div id="report-operations-div" class="operations-div">
<ul class="function-ul">
<li class="active" onclick="Report_GetId()">Get Id</li>
<li class="" onclick="Report_GetPages()">Get pages</li>
<li class="" onclick="Report_SetPage()">Set page</li>
<li class="" onclick="Report_SetFilters()">Set filters</li>
<li class="" onclick="Report_GetFilters()">Get filters</li>
<li class="" onclick="Report_RemoveFilters()">Remove filters</li>
<li class="" onclick="Report_PrintCurrentReport()">Print</li>
<li class="" onclick="Report_UpdateSettings()">Update settings</li>
<li class="" onclick="Report_Reload()">Reload</li>
<li class="" onclick="Report_Refresh()">Refresh</li>
<li onclick="Report_GetPages()">Get pages</li>
<li onclick="Report_SetPage()">Set page</li>
<li onclick="Report_SetFilters()">Set filters</li>
<li onclick="Report_GetFilters()">Get filters</li>
<li onclick="Report_RemoveFilters()">Remove filters</li>
<li onclick="Report_PrintCurrentReport()">Print</li>
<li onclick="Report_UpdateSettings()">Update settings</li>
<li onclick="Report_Reload()">Reload</li>
<li onclick="Report_Refresh()">Refresh</li>
<li class="newOperation" onclick="Report_Extensions_OptionsMenu()">Extend options menu</li>
<li class="newOperation" onclick="Report_Extensions_ContextMenu()">Extend context menu</li>
<li class="" onclick="Report_FullScreen()">Full screen</li>
<li class="" onclick="Report_ExitFullScreen()">Exit full screen</li>
<li onclick="Report_FullScreen()">Full screen</li>
<li onclick="Report_ExitFullScreen()">Exit full screen</li>
</ul>
</div>
<div id="page-operations-div" class="operations-div" style="display: none;">
<ul class="function-ul">
<li class="active" onclick="Page_SetActive()">Set Active</li>
<li class="" onclick="Page_SetFilters()">Set Filters</li>
<li class="" onclick="Page_GetFilters()">Get Filters</li>
<li class="" onclick="Page_RemoveFilters()">Remove Filters</li>
<li onclick="Page_SetFilters()">Set Filters</li>
<li onclick="Page_GetFilters()">Get Filters</li>
<li onclick="Page_RemoveFilters()">Remove Filters</li>
<li class="newOperation" onclick="Page_GetVisuals()">Get Visuals</li>
</ul>
</div>
<div id="events-operations-div" class="operations-div" style="display: none;">
<ul class="function-ul">
<li class="active" onclick="Events_PageChanged()">Page Changed</li>
<li class="" onclick="Events_DataSelected()">Data Selected</li>
<li class="" onclick="Events_SaveAsTriggered()">SaveAs Triggered</li>
<li onclick="Events_DataSelected()">Data Selected</li>
<li onclick="Events_SaveAsTriggered()">SaveAs Triggered</li>
</ul>
</div>
<div id="editandsave-operations-div" class="operations-div" style="display: none;">
<ul class="function-ul">
<li class="" onclick="Report_switchModeEdit()">Enter edit mode</li>
<li class="" onclick="Report_switchModeView()">Enter view mode</li>
<li class="" onclick="Report_save()">Save report</li>
<li class="" onclick="Report_saveAs()">SaveAs report</li>
<li onclick="Report_switchModeEdit()">Enter edit mode</li>
<li onclick="Report_switchModeView()">Enter view mode</li>
<li onclick="Report_save()">Save report</li>
<li onclick="Report_saveAs()">SaveAs report</li>
</ul>
</div>
</div>

Просмотреть файл

@ -17,8 +17,8 @@
<div id="dashboard-operations-div" class="operations-div">
<ul class="function-ul">
<li class="active" onclick="Dashboard_GetId()">Get Id</li>
<li class="" onclick="Dashboard_FullScreen()">Full screen</li>
<li class="" onclick="Dashboard_ExitFullScreen()">Exit full screen</li>
<li onclick="Dashboard_FullScreen()">Full screen</li>
<li onclick="Dashboard_ExitFullScreen()">Exit full screen</li>
</ul>
</div>
<div id="dashboard-events-operations-div" class="operations-div" style="display: none;">

Просмотреть файл

@ -13,8 +13,8 @@
<div id="wrapper-operations-div" class="operations-div">
<div id="qna-operations-div" class="operations-div">
<ul class="function-ul">
<li class="" onclick="Qna_SetQuestion()">Set question</li>
<li class="" onclick="Qna_QuestionChanged()">Question changed event</li>
<li onclick="Qna_SetQuestion()">Set question</li>
<li onclick="Qna_QuestionChanged()">Question changed event</li>
</ul>
</div>
</div>

72
dist/powerbi-client.d.ts поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
/*! powerbi-client v2.4.2 | (c) 2016 Microsoft Corporation MIT */
/*! powerbi-client v2.4.4 | (c) 2016 Microsoft Corporation MIT */
declare module "config" {
const config: {
version: string;
@ -409,9 +409,67 @@ declare module "ifilterable" {
removeFilters(): Promise<void>;
}
}
declare module "visual" {
import * as models from 'powerbi-models';
import { IPageNode } from "page";
/**
* A Visual node within a report hierarchy
*
* @export
* @interface IVisualNode
*/
export interface IVisualNode {
name: string;
title: string;
type: string;
layout: models.IVisualLayout;
page: IPageNode;
}
/**
* A Power BI visual within a page
*
* @export
* @class Visual
* @implements {IVisualNode}
*/
export class Visual implements IVisualNode {
/**
* The visual name
*
* @type {string}
*/
name: string;
/**
* The visual title
*
* @type {string}
*/
title: string;
/**
* The visual type
*
* @type {string}
*/
type: string;
/**
* The visual layout: position, size and visiblity.
*
* @type {string}
*/
layout: models.IVisualLayout;
/**
* The parent Power BI page that contains this visual
*
* @type {IPageNode}
*/
page: IPageNode;
constructor(page: IPageNode, name: string, title: string, type: string, layout: models.IVisualLayout);
}
}
declare module "page" {
import { IFilterable } from "ifilterable";
import { IReportNode } from "report";
import { Visual } from "visual";
import * as models from 'powerbi-models';
/**
* A Page node within a report hierarchy
@ -508,6 +566,17 @@ declare module "page" {
* @returns {Promise<void>}
*/
setFilters(filters: models.IFilter[]): Promise<void>;
/**
* Gets all the visuals on the page.
*
* ```javascript
* page.getVisuals()
* .then(visuals => { ... });
* ```
*
* @returns {Promise<Visual[]>}
*/
getVisuals(): Promise<Visual[]>;
}
}
declare module "defaults" {
@ -1109,6 +1178,7 @@ declare module "powerbi-client" {
export { IEmbedConfiguration, Embed, ILocaleSettings, IEmbedSettings } from "embed";
export { Page } from "page";
export { Qna } from "qna";
export { Visual } from "visual";
global {
interface Window {
powerbi: service.Service;

195
dist/powerbi.js поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
/*! powerbi-client v2.4.2 | (c) 2016 Microsoft Corporation MIT */
/*! powerbi-client v2.4.4 | (c) 2016 Microsoft Corporation MIT */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
@ -57,22 +57,24 @@ return /******/ (function(modules) { // webpackBootstrap
var service = __webpack_require__(1);
exports.service = service;
var factories = __webpack_require__(12);
var factories = __webpack_require__(13);
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__(9);
var dashboard_1 = __webpack_require__(10);
exports.Dashboard = dashboard_1.Dashboard;
var tile_1 = __webpack_require__(10);
var tile_1 = __webpack_require__(11);
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__(11);
var qna_1 = __webpack_require__(12);
exports.Qna = qna_1.Qna;
var visual_1 = __webpack_require__(7);
exports.Visual = visual_1.Visual;
/**
* Makes Power BI available to the global object for use in applications that don't have module loading support.
*
@ -88,11 +90,11 @@ return /******/ (function(modules) { // webpackBootstrap
var embed = __webpack_require__(2);
var report_1 = __webpack_require__(5);
var create_1 = __webpack_require__(8);
var dashboard_1 = __webpack_require__(9);
var tile_1 = __webpack_require__(10);
var create_1 = __webpack_require__(9);
var dashboard_1 = __webpack_require__(10);
var tile_1 = __webpack_require__(11);
var page_1 = __webpack_require__(6);
var qna_1 = __webpack_require__(11);
var qna_1 = __webpack_require__(12);
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
@ -916,7 +918,7 @@ return /******/ (function(modules) { // webpackBootstrap
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
/*! powerbi-models v1.0.0 | (c) 2016 Microsoft Corporation MIT */
/*! powerbi-models v1.0.1 | (c) 2016 Microsoft Corporation MIT */
(function webpackUniversalModuleDefinition(root, factory) {
if(true)
module.exports = factory();
@ -1484,7 +1486,7 @@ return /******/ (function(modules) { // webpackBootstrap
function ObjectValidator() {
}
ObjectValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
if (typeof input !== "object" || Array.isArray(input)) {
@ -1504,7 +1506,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.itemValidators = itemValidators;
}
ArrayValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
if (!(Array.isArray(input))) {
@ -1538,7 +1540,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.expectedType = expectedType;
}
TypeValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
if (!(typeof input === this.expectedType)) {
@ -1582,7 +1584,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.possibleValues = possibleValues;
}
ValueValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
if (this.possibleValues.indexOf(input) < 0) {
@ -1605,7 +1607,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _this;
}
EnumValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -1701,7 +1703,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
MenuExtensionValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -1730,7 +1732,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
ExtensionPointsValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -1759,7 +1761,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
ExtensionItemValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -1788,7 +1790,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
CommandExtensionValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -1817,7 +1819,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
ExtensionValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -1893,7 +1895,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
SettingsValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -1958,7 +1960,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
FilterColumnTargetValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -1987,7 +1989,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
FilterHierarchyTargetValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2020,7 +2022,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
FilterMeasureTargetValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2049,7 +2051,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
BasicFilterValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2086,7 +2088,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
AdvancedFilterValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2123,7 +2125,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
RelativeDateFilterValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2168,7 +2170,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
TopNFilterValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2205,7 +2207,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
NotSupportedFilterValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2242,7 +2244,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
IncludeExcludeFilterValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2279,7 +2281,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
FilterValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
return validator_1.Validators.anyFilterValidator.validate(input, path, field);
@ -2293,7 +2295,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
ConditionItemValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2327,7 +2329,7 @@ return /******/ (function(modules) { // webpackBootstrap
function FieldRequiredValidator() {
}
FieldRequiredValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return [{
message: field + " is required",
path: (path ? path + "." : "") + field,
@ -2351,7 +2353,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.validators = validators;
}
AnyOfValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var valid = false;
@ -2401,7 +2403,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
ReportLoadValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2474,7 +2476,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
ReportCreateValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2527,7 +2529,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
DashboardLoadValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2584,7 +2586,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
TileLoadValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2653,7 +2655,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
PageSizeValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2678,7 +2680,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
CustomPageSizeValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2707,7 +2709,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
PageValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2732,7 +2734,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
PageViewFieldValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2776,7 +2778,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
LoadQnaValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2821,7 +2823,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
QnaSettingsValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2846,7 +2848,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
QnaInterpretInputDataValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2895,7 +2897,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
SaveAsParametersValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2941,7 +2943,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _this;
}
MapValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -2998,7 +3000,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
CustomLayoutValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -3031,7 +3033,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
VisualLayoutValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -3076,7 +3078,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
DisplayStateValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -3101,7 +3103,7 @@ return /******/ (function(modules) { // webpackBootstrap
return _super !== null && _super.apply(this, arguments) || this;
}
PageLayoutValidator.prototype.validate = function (input, path, field) {
if (input === undefined || input === null) {
if (input == null) {
return null;
}
var errors = _super.prototype.validate.call(this, input, path, field);
@ -3111,7 +3113,11 @@ return /******/ (function(modules) { // webpackBootstrap
var fields = [
{
field: "visualsLayout",
validators: [validator_1.Validators.pageLayoutValidator]
validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageLayoutValidator]
},
{
field: "defaultLayout",
validators: [validator_1.Validators.visualLayoutValidator]
}
];
var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
@ -3141,7 +3147,7 @@ return /******/ (function(modules) { // webpackBootstrap
var models = __webpack_require__(4);
var utils = __webpack_require__(3);
var page_1 = __webpack_require__(6);
var defaults_1 = __webpack_require__(7);
var defaults_1 = __webpack_require__(8);
/**
* The Power BI Report embed component
*
@ -3426,8 +3432,9 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }),
/* 6 */
/***/ (function(module, exports) {
/***/ (function(module, exports, __webpack_require__) {
var visual_1 = __webpack_require__(7);
/**
* A Power BI report page
*
@ -3516,6 +3523,28 @@ return /******/ (function(modules) { // webpackBootstrap
throw response.body;
});
};
/**
* Gets all the visuals on the page.
*
* ```javascript
* page.getVisuals()
* .then(visuals => { ... });
* ```
*
* @returns {Promise<Visual[]>}
*/
Page.prototype.getVisuals = function () {
var _this = this;
return this.report.service.hpm.get("/report/pages/" + this.name + "/visuals", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)
.then(function (response) {
return response.body
.map(function (visual) {
return new visual_1.Visual(_this, visual.name, visual.title, visual.type, visual.layout);
});
}, function (response) {
throw response.body;
});
};
return Page;
}());
exports.Page = Page;
@ -3523,6 +3552,30 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }),
/* 7 */
/***/ (function(module, exports) {
/**
* A Power BI visual within a page
*
* @export
* @class Visual
* @implements {IVisualNode}
*/
var Visual = (function () {
function Visual(page, name, title, type, layout) {
this.name = name;
this.title = title;
this.type = type;
this.layout = layout;
this.page = page;
}
return Visual;
}());
exports.Visual = Visual;
/***/ }),
/* 8 */
/***/ (function(module, exports) {
var Defaults = (function () {
@ -3540,7 +3593,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }),
/* 8 */
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
var __extends = (this && this.__extends) || function (d, b) {
@ -3551,7 +3604,7 @@ return /******/ (function(modules) { // webpackBootstrap
var models = __webpack_require__(4);
var embed = __webpack_require__(2);
var utils = __webpack_require__(3);
var defaults_1 = __webpack_require__(7);
var defaults_1 = __webpack_require__(8);
var Create = (function (_super) {
__extends(Create, _super);
function Create(service, element, config) {
@ -3619,7 +3672,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }),
/* 9 */
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
var __extends = (this && this.__extends) || function (d, b) {
@ -3630,7 +3683,7 @@ return /******/ (function(modules) { // webpackBootstrap
var embed = __webpack_require__(2);
var models = __webpack_require__(4);
var utils = __webpack_require__(3);
var defaults_1 = __webpack_require__(7);
var defaults_1 = __webpack_require__(8);
/**
* A Power BI Dashboard embed component
*
@ -3726,7 +3779,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }),
/* 10 */
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
var __extends = (this && this.__extends) || function (d, b) {
@ -3737,7 +3790,7 @@ return /******/ (function(modules) { // webpackBootstrap
var models = __webpack_require__(4);
var embed = __webpack_require__(2);
var utils = __webpack_require__(3);
var defaults_1 = __webpack_require__(7);
var defaults_1 = __webpack_require__(8);
/**
* The Power BI tile embed component
*
@ -3872,7 +3925,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }),
/* 11 */
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
var __extends = (this && this.__extends) || function (d, b) {
@ -3933,13 +3986,13 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }),
/* 12 */
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
var config_1 = __webpack_require__(13);
var wpmp = __webpack_require__(14);
var hpm = __webpack_require__(15);
var router = __webpack_require__(16);
var config_1 = __webpack_require__(14);
var wpmp = __webpack_require__(15);
var hpm = __webpack_require__(16);
var router = __webpack_require__(17);
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; }
@ -3967,11 +4020,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }),
/* 13 */
/* 14 */
/***/ (function(module, exports) {
var config = {
version: '2.4.2',
version: '2.4.4',
type: 'js'
};
Object.defineProperty(exports, "__esModule", { value: true });
@ -3979,7 +4032,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }),
/* 14 */
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
/*! window-post-message-proxy v0.2.4 | (c) 2016 Microsoft Corporation MIT */
@ -4279,7 +4332,7 @@ return /******/ (function(modules) { // webpackBootstrap
//# sourceMappingURL=windowPostMessageProxy.js.map
/***/ }),
/* 15 */
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
/*! http-post-message v0.2.3 | (c) 2016 Microsoft Corporation MIT */
@ -4463,7 +4516,7 @@ return /******/ (function(modules) { // webpackBootstrap
//# sourceMappingURL=httpPostMessage.js.map
/***/ }),
/* 16 */
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
/*! powerbi-router v0.1.5 | (c) 2016 Microsoft Corporation MIT */

1
dist/powerbi.js.map поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

12
dist/powerbi.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "powerbi-client",
"version": "2.4.3",
"version": "2.4.4",
"description": "JavaScript library for embedding Power BI into your apps. Provides service which makes it easy to embed different types of components and an object model which allows easy interaction with these components such as changing pages, applying filters, and responding to data selection.",
"main": "dist/powerbi.js",
"typings": "dist/powerbi-client.d.ts",
@ -75,7 +75,7 @@
},
"dependencies": {
"http-post-message": "^0.2",
"powerbi-models": "^1.0.0",
"powerbi-models": "^1.0.1",
"powerbi-router": "^0.1",
"window-post-message-proxy": "^0.2"
},

Просмотреть файл

@ -1,5 +1,5 @@
const config = {
version: '2.4.2',
version: '2.4.4',
type: 'js'
};

Просмотреть файл

@ -527,4 +527,4 @@ export abstract class Embed {
this.iframe.addEventListener('load', () => this.createReport(this.createConfig), false);
}
}
}
}

Просмотреть файл

@ -1,5 +1,6 @@
import { IFilterable } from './ifilterable';
import { IReportNode } from './report';
import { Visual } from './visual';
import * as models from 'powerbi-models';
/**
@ -134,4 +135,26 @@ export class Page implements IPageNode, IFilterable {
throw response.body;
});
}
/**
* Gets all the visuals on the page.
*
* ```javascript
* page.getVisuals()
* .then(visuals => { ... });
* ```
*
* @returns {Promise<Visual[]>}
*/
getVisuals(): Promise<Visual[]> {
return this.report.service.hpm.get<models.IVisual[]>(`/report/pages/${this.name}/visuals`, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)
.then(response => {
return response.body
.map(visual => {
return new Visual(this, visual.name, visual.title, visual.type, visual.layout);
});
}, response => {
throw response.body;
});
}
}

Просмотреть файл

@ -30,6 +30,9 @@ export {
export {
Qna
} from './qna';
export {
Visual
} from './visual';
declare var powerbi: service.Service;
declare global {

69
src/visual.ts Normal file
Просмотреть файл

@ -0,0 +1,69 @@
import * as models from 'powerbi-models';
import { IFilterable } from './ifilterable';
import { IPageNode, Page } from './page';
/**
* A Visual node within a report hierarchy
*
* @export
* @interface IVisualNode
*/
export interface IVisualNode {
name: string;
title: string;
type: string;
layout: models.IVisualLayout;
page: IPageNode;
}
/**
* A Power BI visual within a page
*
* @export
* @class Visual
* @implements {IVisualNode}
*/
export class Visual implements IVisualNode {
/**
* The visual name
*
* @type {string}
*/
name: string;
/**
* The visual title
*
* @type {string}
*/
title: string;
/**
* The visual type
*
* @type {string}
*/
type: string;
/**
* The visual layout: position, size and visiblity.
*
* @type {string}
*/
layout: models.IVisualLayout;
/**
* The parent Power BI page that contains this visual
*
* @type {IPageNode}
*/
page: IPageNode;
constructor(page: IPageNode, name: string, title: string, type: string, layout: models.IVisualLayout) {
this.name = name;
this.title = title;
this.type = type;
this.layout = layout;
this.page = page;
}
}