{"version":3,"file":"FluxView.min.js","sources":["EncompassWebServices/Reporting_ECP/FluxView.js"],"sourcesContent":["\"use strict\";\n\nclass EC_FluxView {\n constructor({ el, ReportID }) {\n this.Container = el;\n this.ReportID = ReportID;\n\n this._QueryStringMap = new Map();\n this._ParameterMap = new Map();\n }\n\n SetQueryString(name, value) {\n this._QueryStringMap.set(name, value);\n }\n\n SetParameter(name, value) {\n this._ParameterMap.set(name, value);\n }\n\n SetPinnedPeriod(selectAs, value) {\n this.SetParameter(selectAs, value);\n }\n\n SetPinnedFilter(selectAs, value) {\n this.SetParameter(selectAs, value);\n }\n\n SetPinnedVariable(selectAs, value) {\n this.SetParameter(selectAs, value);\n }\n\n _GetRequest() {\n const myRequest = new ECP.EC_Request(\"FusionView\");\n myRequest.SetReturnType(ECP.EC_ReturnType.Text);\n myRequest.AddRequestVariable(\"ReportID\", this.ReportID);\n\n this._QueryStringMap.forEach((value, key) => {\n myRequest.AddRequestVariable(key, value);\n });\n\n this._ParameterMap.forEach((value, key) => {\n myRequest.AddParameter(key, value);\n });\n\n return myRequest;\n }\n\n GetResult() {\n return this._GetRequest().Submit();\n }\n\n GetHtml() {\n this.SetQueryString(\"Format\", \"HTML\");\n this.SetQueryString(\"LoadData\", \"True\");\n\n return this._GetRequest().Submit();\n }\n\n GetJson() {\n this.SetQueryString(\"Format\", \"JSON\");\n return this._GetRequest().SetReturnType(ECP.EC_ReturnType.Json).Submit();\n }\n\n static FillToElements({ el, ReportID }) {\n return new Promise((resolve, reject) => {\n const myFluxView = new EC_FluxView({ el, ReportID });\n\n myFluxView.GetHtml().then((reportHtml) => {\n myFluxView.Container.innerHTML = reportHtml;\n\n resolve();\n }).catch(reject);\n });\n }\n}\n\nclass FluxDisplay {\n constructor({ el, ReportID, BaseReportID }) {\n this.Container = el;\n this.ReportID = ReportID;\n this.BaseReportID = BaseReportID;\n this.ParametersStr = null;\n this.Guid = EC_Fmt.Guid();\n this.DrillDownFilterCallBack = null;\n\n if (el) {\n el.setAttribute(\"guid\", this.Guid);\n this.table = el.querySelector(\"table.FusionTable\") || el;\n this.pinnedFiltersForm = el.querySelector(\".ecp-fusion-pinned-override\") || el;\n this.postToDashboardForm = el.querySelector(\".ecp-fusion-post-dashboard\") || el;\n }\n }\n\n Init() {\n const me = this;\n\n me.FixHeader();\n me.InitCharts();\n me.InitOrder();\n me.InitDrillDown();\n me.InitPostToDashboard();\n }\n\n SetDrillDownFilterCallBack(callback) {\n this.DrillDownFilterCallBack = callback;\n }\n\n FixHeader() {\n if (this.table) {\n const me = this;\n let headerHeight = -2;\n const headerRows = me.table.querySelectorAll(\"thead tr:not([rowtype=ReportHeader]\");\n for (let i = 0; i < headerRows.length; i++) {\n const headerCells = headerRows[i].querySelectorAll(\"th\");\n for (let j = 0; j < headerCells.length; j++) {\n const th = headerCells[j];\n // Task 957070: Allow user to freeze columns in Fusion so they always display on the left side while scrolling\n if (th.hasAttribute(\"sort-desc\")) {\n th.innerHTML = `