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