Skip to content

Commit 2a3a49b

Browse files
committed
Merged PR 16640: add page size and page display options to page object
add page size and page display options to page object
1 parent 2bb9080 commit 2a3a49b

File tree

5 files changed

+77
-33
lines changed

5 files changed

+77
-33
lines changed

dist/powerbi-client.d.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@ declare module "embed" {
397397
* Sets Iframe for embed
398398
*/
399399
private setIframe(isLoad, phasedRender?);
400+
/**
401+
* Sets Iframe's title
402+
*/
403+
setComponentTitle(title: string): void;
400404
/**
401405
* Adds the ability to get groupId from url.
402406
* By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration.
@@ -625,6 +629,16 @@ declare module "page" {
625629
* @type {models.SectionVisibility}
626630
*/
627631
visibility: models.SectionVisibility;
632+
/**
633+
* Page size as saved in the report.
634+
* @type {models.ICustomPageSize}
635+
*/
636+
defaultSize: models.ICustomPageSize;
637+
/**
638+
* Page display options as saved in the report.
639+
* @type {models.ICustomPageSize}
640+
*/
641+
defaultDisplayOption: models.DisplayOption;
628642
/**
629643
* Creates an instance of a Power BI report page.
630644
*
@@ -634,7 +648,7 @@ declare module "page" {
634648
* @param {boolean} [isActivePage]
635649
* @param {models.SectionVisibility} [visibility]
636650
*/
637-
constructor(report: IReportNode, name: string, displayName?: string, isActivePage?: boolean, visibility?: models.SectionVisibility);
651+
constructor(report: IReportNode, name: string, displayName?: string, isActivePage?: boolean, visibility?: models.SectionVisibility, defaultSize?: models.ICustomPageSize, defaultDisplayOption?: models.DisplayOption);
638652
/**
639653
* Gets all page level filters within the report.
640654
*

dist/powerbi.js

Lines changed: 21 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/powerbi.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/page.ts

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as models from 'powerbi-models';
55

66
/**
77
* A Page node within a report hierarchy
8-
*
8+
*
99
* @export
1010
* @interface IPageNode
1111
*/
@@ -16,7 +16,7 @@ export interface IPageNode {
1616

1717
/**
1818
* A Power BI report page
19-
*
19+
*
2020
* @export
2121
* @class Page
2222
* @implements {IPageNode}
@@ -25,65 +25,79 @@ export interface IPageNode {
2525
export class Page implements IPageNode, IFilterable {
2626
/**
2727
* The parent Power BI report that this page is a member of
28-
*
28+
*
2929
* @type {IReportNode}
3030
*/
3131
report: IReportNode;
3232
/**
3333
* The report page name
34-
*
34+
*
3535
* @type {string}
3636
*/
3737
name: string;
3838

3939
/**
4040
* The user defined display name of the report page, which is undefined if the page is created manually
41-
*
41+
*
4242
* @type {string}
4343
*/
4444
displayName: string;
4545

4646
/**
4747
* Is this page is the active page
48-
*
48+
*
4949
* @type {boolean}
5050
*/
51-
isActive: boolean;
51+
isActive: boolean;
5252

5353
/**
5454
* The visibility of the page.
5555
* 0 - Always Visible
5656
* 1 - Hidden in View Mode
57-
*
57+
*
5858
* @type {models.SectionVisibility}
5959
*/
6060
visibility: models.SectionVisibility;
6161

62+
/**
63+
* Page size as saved in the report.
64+
* @type {models.ICustomPageSize}
65+
*/
66+
defaultSize: models.ICustomPageSize;
67+
68+
/**
69+
* Page display options as saved in the report.
70+
* @type {models.ICustomPageSize}
71+
*/
72+
defaultDisplayOption: models.DisplayOption;
73+
6274
/**
6375
* Creates an instance of a Power BI report page.
64-
*
76+
*
6577
* @param {IReportNode} report
6678
* @param {string} name
6779
* @param {string} [displayName]
6880
* @param {boolean} [isActivePage]
6981
* @param {models.SectionVisibility} [visibility]
7082
*/
71-
constructor(report: IReportNode, name: string, displayName?: string, isActivePage?: boolean, visibility?: models.SectionVisibility) {
83+
constructor(report: IReportNode, name: string, displayName?: string, isActivePage?: boolean, visibility?: models.SectionVisibility, defaultSize?: models.ICustomPageSize, defaultDisplayOption?: models.DisplayOption) {
7284
this.report = report;
7385
this.name = name;
7486
this.displayName = displayName;
7587
this.isActive = isActivePage;
7688
this.visibility = visibility;
89+
this.defaultSize = defaultSize;
90+
this.defaultDisplayOption = defaultDisplayOption;
7791
}
7892

7993
/**
8094
* Gets all page level filters within the report.
81-
*
95+
*
8296
* ```javascript
8397
* page.getFilters()
8498
* .then(filters => { ... });
8599
* ```
86-
*
100+
*
87101
* @returns {(Promise<models.IFilter[]>)}
88102
*/
89103
getFilters(): Promise<models.IFilter[]> {
@@ -96,11 +110,11 @@ export class Page implements IPageNode, IFilterable {
96110

97111
/**
98112
* Removes all filters from this page of the report.
99-
*
113+
*
100114
* ```javascript
101115
* page.removeFilters();
102116
* ```
103-
*
117+
*
104118
* @returns {Promise<void>}
105119
*/
106120
removeFilters(): Promise<void> {
@@ -109,11 +123,11 @@ export class Page implements IPageNode, IFilterable {
109123

110124
/**
111125
* Makes the current page the active page of the report.
112-
*
126+
*
113127
* ```javascripot
114128
* page.setActive();
115129
* ```
116-
*
130+
*
117131
* @returns {Promise<void>}
118132
*/
119133
setActive(): Promise<void> {
@@ -131,12 +145,12 @@ export class Page implements IPageNode, IFilterable {
131145

132146
/**
133147
* Sets all filters on the current page.
134-
*
148+
*
135149
* ```javascript
136150
* page.setFilters(filters);
137151
* .catch(errors => { ... });
138152
* ```
139-
*
153+
*
140154
* @param {(models.IFilter[])} filters
141155
* @returns {Promise<void>}
142156
*/
@@ -149,12 +163,12 @@ export class Page implements IPageNode, IFilterable {
149163

150164
/**
151165
* Gets all the visuals on the page.
152-
*
166+
*
153167
* ```javascript
154168
* page.getVisuals()
155169
* .then(visuals => { ... });
156170
* ```
157-
*
171+
*
158172
* @returns {Promise<VisualDescriptor[]>}
159173
*/
160174
getVisuals(): Promise<VisualDescriptor[]> {
@@ -171,12 +185,12 @@ export class Page implements IPageNode, IFilterable {
171185

172186
/**
173187
* Checks if page has layout.
174-
*
188+
*
175189
* ```javascript
176190
* page.hasLayout(layoutType)
177191
* .then(hasLayout: boolean => { ... });
178192
* ```
179-
*
193+
*
180194
* @returns {(Promise<boolean>)}
181195
*/
182196
hasLayout(layoutType): Promise<boolean> {

src/report.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
169169
.then(response => {
170170
return response.body
171171
.map(page => {
172-
return new Page(this, page.name, page.displayName, page.isActive, page.visibility);
172+
return new Page(this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption);
173173
});
174174
}, response => {
175175
throw response.body;

0 commit comments

Comments
 (0)