UNPKG

powerbi-report-authoring

Version:

A library for authoring Power BI reports while embedded into your apps. Provides service which makes it easy to change report and visual elements in session. It gives APIs such as creating visual, changing visual properties, etc ...

2 lines 7.27 kB
/*! For license information please see powerbi-report-authoring.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("powerbi-client")):"function"==typeof define&&define.amd?define(["powerbi-client"],e):"object"==typeof exports?exports["powerbi-report-authoring"]=e(require("powerbi-client")):t["powerbi-report-authoring"]=e(t["powerbi-client"])}(self,(t=>(()=>{var e={913:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Config=void 0;var o=function(){function t(){}return t.version="3.0.0",t}();e.Config=o},758:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=void 0;var o=function(){function t(){}return t.PowerBIClientIsNotInitialized="powerbi-client module is not initialized. Please import powerbi-client script before importing powerbi-report-authoring.",t}();e.Errors=o},733:(t,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extensions=void 0;var n=o(856),i=o(230),r=o(379);e.extensions=[new i.ReportExtensions,new n.PageExtensions,new r.VisualExtensions]},856:(t,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PageExtensions=void 0;var n=o(719),i=o(913),r=o(758),a=function(){function t(){}return t.post=function(e,o,n){var r=t.hpm(e),a=t.uid(e),s=t.contentWindow(e),u=i.Config.version;return r.post(o,n,{uid:a,"x-report-authoring-sdk-version":u},s).then((function(t){return t.body}),(function(t){throw t.body}))},t.contentWindow=function(t){return t.report.iframe.contentWindow},t.uid=function(t){return t.report.config.uniqueId},t.hpm=function(t){return t.report.service.hpm},t.prototype.initialize=function(){null!=n.Page?(n.Page.prototype.createVisual=function(e,o,i){var r=this,a={visualType:e,layout:o,autoFocus:i};return t.post(this,"/report/pages/".concat(this.name,"/createVisual"),a).then((function(t){var e=t.visual;return{visual:new n.VisualDescriptor(r,e.name,e.title,e.type,e.layout)}}),(function(t){throw t}))},n.Page.prototype.deleteVisual=function(e){return t.post(this,"/report/pages/".concat(this.name,"/deleteVisual"),{visualName:e})}):console.error(r.Errors.PowerBIClientIsNotInitialized)},t}();e.PageExtensions=a},230:(t,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReportExtensions=void 0;var n=o(719),i=o(913),r=o(758),a=function(){function t(){}return t.get=function(e,o){var n=t.hpm(e),r=t.uid(e),a=t.contentWindow(e),s=i.Config.version;return n.get(o,{uid:r,"x-report-authoring-sdk-version":s},a).then((function(t){return t.body}),(function(t){throw t.body}))},t.contentWindow=function(t){return t.iframe.contentWindow},t.uid=function(t){return t.config.uniqueId},t.hpm=function(t){return t.service.hpm},t.prototype.initialize=function(){null!=n.Report?(n.Report.prototype.getVisualCapabilities=function(e){if(!e)throw{message:"visualType parameter is missing"};return t.get(this,"/report/visuals/types/".concat(e,"/capabilities"))},n.Report.prototype.getAvailableVisualTypes=function(){return t.get(this,"/report/availableVisualTypes")}):console.error(r.Errors.PowerBIClientIsNotInitialized)},t}();e.ReportExtensions=a},379:(t,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VisualExtensions=void 0;var n=o(719),i=o(913),r=o(758),a=function(){function t(){}return t.delete=function(e,o,n){return t.sendRequestWithBody(e,"delete",o,n)},t.post=function(e,o,n){return t.sendRequestWithBody(e,"post",o,n)},t.put=function(e,o,n){return t.sendRequestWithBody(e,"put",o,n)},t.sendRequestWithBody=function(e,o,n,r){var a=t.hpm(e),s=t.uid(e),u=t.contentWindow(e),c=i.Config.version;return a[o](n,r,{uid:s,"x-report-authoring-sdk-version":c},u).then((function(t){return t.body}),(function(t){throw t.body}))},t.get=function(e,o){var n=t.hpm(e),r=t.uid(e),a=t.contentWindow(e),s=i.Config.version;return n.get(o,{uid:r,"x-report-authoring-sdk-version":s},a).then((function(t){return t.body}),(function(t){throw t.body}))},t.contentWindow=function(t){return t.page.report.iframe.contentWindow},t.uid=function(t){return t.page.report.config.uniqueId},t.hpm=function(t){return t.page.report.service.hpm},t.prototype.initialize=function(){null!=n.VisualDescriptor?(n.VisualDescriptor.prototype.changeType=function(e){return t.post(this,"/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/changeType"),{visualType:e})},n.VisualDescriptor.prototype.getCapabilities=function(){return t.get(this,"/report/visuals/types/".concat(this.type,"/capabilities"))},n.VisualDescriptor.prototype.getDataFieldDisplayName=function(e,o){return t.get(this,"/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/dataroles/").concat(e,"/fields/").concat(o,"/displayName"))},n.VisualDescriptor.prototype.setDataFieldDisplayName=function(e,o,n){return t.put(this,"/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/dataroles/").concat(e,"/fields/").concat(o,"/displayName"),{newDisplayName:n})},n.VisualDescriptor.prototype.addDataField=function(e,o,n){return t.post(this,"/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/dataroles/").concat(e,"/fields/").concat(n),o)},n.VisualDescriptor.prototype.getDataFields=function(e){return t.get(this,"/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/dataroles/").concat(e,"/fields"))},n.VisualDescriptor.prototype.removeDataField=function(e,o){var n="/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/dataroles/").concat(e,"/fields/").concat(o);return t.delete(this,n,o)},n.VisualDescriptor.prototype.getProperty=function(e){return t.post(this,"/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/property"),e)},n.VisualDescriptor.prototype.setProperty=function(e,o){return t.put(this,"/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/property"),{selector:e,value:o})},n.VisualDescriptor.prototype.resetProperty=function(t){return this.setProperty(t,{schema:"http://powerbi.com/product/schema#default",value:{}})},n.VisualDescriptor.prototype.getDataFieldName=function(e,o){return t.get(this,"/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/dataroles/").concat(e,"/fields/").concat(o,"/dataFieldName"))},n.VisualDescriptor.prototype.getFieldFormatString=function(e,o){return t.get(this,"/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/dataroles/").concat(e,"/fields/").concat(o,"/formatString"))},n.VisualDescriptor.prototype.setFieldFormatString=function(e,o,n){return t.put(this,"/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/dataroles/").concat(e,"/fields/").concat(o,"/formatString"),{formatString:n})},n.VisualDescriptor.prototype.setFieldHidden=function(e,o,n){return t.put(this,"/report/pages/".concat(this.page.name,"/visuals/").concat(this.name,"/dataroles/").concat(e,"/fields/").concat(o,"/hidden"),{isHidden:n})}):console.error(r.Errors.PowerBIClientIsNotInitialized)},t}();e.VisualExtensions=a},719:e=>{"use strict";e.exports=t}},o={};function n(t){var i=o[t];if(void 0!==i)return i.exports;var r=o[t]={exports:{}};return e[t](r,r.exports,n),r.exports}var i={};return(()=>{var t=i;Object.defineProperty(t,"__esModule",{value:!0}),t.startAuthoring=void 0;var e=n(733);function o(){e.extensions.forEach((function(t){t.initialize()}))}t.startAuthoring=o,o()})(),i})()));