From 174a0c9e712d48fbab5390e91889034265403f9e Mon Sep 17 00:00:00 2001 From: Bobrova Alena Date: Fri, 17 Aug 2018 13:25:33 +0300 Subject: [PATCH 1/2] template name --- src/dashboard-panel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dashboard-panel.ts b/src/dashboard-panel.ts index 25c1180..23af984 100644 --- a/src/dashboard-panel.ts +++ b/src/dashboard-panel.ts @@ -191,7 +191,7 @@ module CustomExtensions { } private _getCustomTemplate() { return { - name: "dx-dashboard-working-mode-extension", + name: "dashboard-custom-panel-extension", data: { panelWidth: this._actualPanelWidth, allowSwitchToDesigner: this.allowSwitchToDesigner, From 6daa6f7bfbe658672d14345ee1a77c78a8200320 Mon Sep 17 00:00:00 2001 From: Bobrova Alena Date: Fri, 17 Aug 2018 14:32:08 +0300 Subject: [PATCH 2/2] js files --- dist/dashboard-panel.js | 2 +- dist/dashboard-panel.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/dashboard-panel.js b/dist/dashboard-panel.js index 4e72371..e0b3abf 100644 --- a/dist/dashboard-panel.js +++ b/dist/dashboard-panel.js @@ -171,7 +171,7 @@ var CustomExtensions; CustomDashboardPanelExtension.prototype._getCustomTemplate = function () { var _this = this; return { - name: "dx-dashboard-working-mode-extension", + name: "dashboard-custom-panel-extension", data: { panelWidth: this._actualPanelWidth, allowSwitchToDesigner: this.allowSwitchToDesigner, diff --git a/dist/dashboard-panel.min.js b/dist/dashboard-panel.min.js index 33a3a08..0b22fc8 100644 --- a/dist/dashboard-panel.min.js +++ b/dist/dashboard-panel.min.js @@ -1 +1 @@ -var CustomExtensions;!function(t){var e=function(){function t(t,e){void 0===e&&(e={});var s=this;this._dashboardControl=t,this.options=e,this.name="custom-dashboard-panel",this._iconBack="dx-dashboard-back",this._dashboardsButtonName="Dashboards",this._flexParent="dx-dashboard-flex-parent",this._dashboardsButton="dx-dashboards-button",this._dashboardTruncated="dx-dashboard-truncated",this._ellipsisText="dx-dashboard-ellipsis",this._itemTemplate=ko.observable(),this._isMobile=ko.observable(!1),this._disposables=[],this.panelWidth=250,this.visible=ko.observable(!1),this.allowSwitchToDesigner=ko.observable(!0),this.selectedItemKeys=ko.observableArray(),this.availableDashboards=ko.observableArray(),this._actualPanelWidth=ko.observable(this.panelWidth),this._left=ko.computed(function(){return s.visible()?0:-s._actualPanelWidth()}),this.showPanelAsync=function(t){var e=$.Deferred();return s.visible(!0),s.updateDashboardsList(),setTimeout(function(){t.surfaceLeft=s.panelWidth,e.resolve(t)},500),e.promise()},this.hidePanelAsync=function(t){var e=$.Deferred();return s.visible(!1),setTimeout(function(){t.surfaceLeft=0,e.resolve(t)},500),e.promise()},this.switchToViewer=function(){s._dashboardControl.switchToViewer()},this.switchToDesigner=function(){s._dashboardControl.switchToDesigner()},this._toolbarElement=new DevExpress.Dashboard.DashboardToolbarGroup("viewer-button","",100);var o=new DevExpress.Dashboard.DashboardToolbarItem("toviewer",function(){return s.switchToViewer()});o.template="dashboard-custom-panel-extension-viewer-button",o.disabled=ko.pureComputed(function(){return!!s._dashboardControl.dashboard()}),this._toolbarElement.items.push(o),this.designerToViewerAction={orderNo:60,action:this.showPanelAsync},this.viewerToDesignerAction={orderNo:20,action:this.hidePanelAsync},this.selectedItemKeys.subscribe(function(t){if(t.length){var e=t[0];s._dashboardControl.dashboardContainer()&&s._dashboardControl.dashboardContainer().id===e||s._dashboardControl.loadDashboard(e)}})}return t.prototype.start=function(){var t=this,e=this._dashboardControl.findExtension("mobile-layout");this._isMobile(e&&e.mobileLayoutEnabled()),e.mobileLayoutEnabled.subscribe(function(){t.stop(),t.start()}),this._isMobile()?this.allowSwitchToDesigner(!1):void 0===this.allowSwitchToDesigner()&&this.allowSwitchToDesigner(this._dashboardControl.allowSwitchToDesigner),this.visible(!this._isMobile()&&!this._dashboardControl.isDesignMode()),this._itemTemplate(this._getTemplateName()),this._isMobile()&&(this._actualPanelWidth($(window).width()),DevExpress.devices.on("orientationChanged",function(e){t._actualPanelWidth($(window).width())})),this._customTemplate=this._getCustomTemplate(),this._dashboardControl.customTemplates.push(this._customTemplate);var s=this._dashboardControl.findExtension("toolbox");if(s&&s.toolbarGroups.push(this._toolbarElement),this._disposables.push(this._dashboardControl.dashboardContainer.subscribe(function(e){e&&t._validateSelection(e,t.availableDashboards())})),this._disposables.push(this.availableDashboards.subscribe(function(e){return t._validateSelection(t._dashboardControl.dashboardContainer(),e)})),this._isMobile()){var o=this._dashboardControl.findExtension("viewer-api"),i=o._options.onDashboardTitleToolbarUpdated;o._options.onDashboardTitleToolbarUpdated=function(e){e.options.navigationItems.push({type:"button",template:function(){return $("
").addClass([t._flexParent,t._ellipsisText].join(" ")).append($('')).append($("
").text(t._dashboardsButtonName).addClass([t._dashboardsButton,t._dashboardTruncated].join(" ")))},click:function(){t.showPanelAsync({surfaceLeft:t._actualPanelWidth()})}}),i.call(t,e)}}this._dashboardControl.isDesignMode()||this._dashboardControl.surfaceLeft(this._isMobile()?0:this.panelWidth),this.updateDashboardsList()},t.prototype.stop=function(){this._disposables.forEach(function(t){return t.dispose()}),this._disposables=[];var t=this._dashboardControl.findExtension("toolbox");t&&t.toolbarGroups.remove(this._toolbarElement),this._dashboardControl.customTemplates.remove(this._customTemplate)},t.prototype.updateDashboardsList=function(){var t=this,e=(this._dashboardControl.dashboardContainer(),this.options);this._dashboardControl.requestDashboardList().done(function(o){t.availableDashboards(o.map(function(t){return new s(t.id,t.name,e.dashboardThumbnail?DevExpress.utils.string.format(e.dashboardThumbnail,t.id):void 0)}))})},t.prototype._validateSelection=function(t,e){if(t){var s=e.filter(function(e){return e.id===t.id})[0];s&&this.selectedItemKeys([s.id])}},t.prototype._getTemplateName=function(){return this._isMobile()?this.options.dashboardThumbnail?"dashboard-preview":"dashboard-card-view":"dashboard-list-item"},t.prototype._hidePanel=function(){this._isMobile()&&this.hidePanelAsync({surfaceLeft:0})},t.prototype._getCustomTemplate=function(){var t=this;return{name:"dx-dashboard-working-mode-extension",data:{panelWidth:this._actualPanelWidth,allowSwitchToDesigner:this.allowSwitchToDesigner,left:this._left,selectedItemKeys:this.selectedItemKeys,availableDashboards:this.availableDashboards,itemTemplate:this._itemTemplate,isMobile:this._isMobile,hidePanel:function(){t._hidePanel()},switchToDesigner:this.switchToDesigner,switchToViewer:this.switchToViewer}}},t}();t.CustomDashboardPanelExtension=e;var s=function(){function t(t,e,s){this.id=t,this.name=e,this.imageUrl=s,this.hidden=ko.observable(!1)}return t.prototype.hide=function(){this.hidden(!0)},t}()}(CustomExtensions||(CustomExtensions={})); \ No newline at end of file +var CustomExtensions;!function(t){var s=function(){function t(t,s){void 0===s&&(s={});var e=this;this._dashboardControl=t,this.options=s,this.name="custom-dashboard-panel",this._iconBack="dx-dashboard-back",this._dashboardsButtonName="Dashboards",this._flexParent="dx-dashboard-flex-parent",this._dashboardsButton="dx-dashboards-button",this._dashboardTruncated="dx-dashboard-truncated",this._ellipsisText="dx-dashboard-ellipsis",this._itemTemplate=ko.observable(),this._isMobile=ko.observable(!1),this._disposables=[],this.panelWidth=250,this.visible=ko.observable(!1),this.allowSwitchToDesigner=ko.observable(!0),this.selectedItemKeys=ko.observableArray(),this.availableDashboards=ko.observableArray(),this._actualPanelWidth=ko.observable(this.panelWidth),this._left=ko.computed(function(){return e.visible()?0:-e._actualPanelWidth()}),this.showPanelAsync=function(t){var s=$.Deferred();return e.visible(!0),e.updateDashboardsList(),setTimeout(function(){t.surfaceLeft=e.panelWidth,s.resolve(t)},500),s.promise()},this.hidePanelAsync=function(t){var s=$.Deferred();return e.visible(!1),setTimeout(function(){t.surfaceLeft=0,s.resolve(t)},500),s.promise()},this.switchToViewer=function(){e._dashboardControl.switchToViewer()},this.switchToDesigner=function(){e._dashboardControl.switchToDesigner()},this._toolbarElement=new DevExpress.Dashboard.DashboardToolbarGroup("viewer-button","",100);var o=new DevExpress.Dashboard.DashboardToolbarItem("toviewer",function(){return e.switchToViewer()});o.template="dashboard-custom-panel-extension-viewer-button",o.disabled=ko.pureComputed(function(){return!!e._dashboardControl.dashboard()}),this._toolbarElement.items.push(o),this.designerToViewerAction={orderNo:60,action:this.showPanelAsync},this.viewerToDesignerAction={orderNo:20,action:this.hidePanelAsync},this.selectedItemKeys.subscribe(function(t){if(t.length){var s=t[0];e._dashboardControl.dashboardContainer()&&e._dashboardControl.dashboardContainer().id===s||e._dashboardControl.loadDashboard(s)}})}return t.prototype.start=function(){var t=this,s=this._dashboardControl.findExtension("mobile-layout");this._isMobile(s&&s.mobileLayoutEnabled()),s.mobileLayoutEnabled.subscribe(function(){t.stop(),t.start()}),this._isMobile()?this.allowSwitchToDesigner(!1):void 0===this.allowSwitchToDesigner()&&this.allowSwitchToDesigner(this._dashboardControl.allowSwitchToDesigner),this.visible(!this._isMobile()&&!this._dashboardControl.isDesignMode()),this._itemTemplate(this._getTemplateName()),this._isMobile()&&(this._actualPanelWidth($(window).width()),DevExpress.devices.on("orientationChanged",function(s){t._actualPanelWidth($(window).width())})),this._customTemplate=this._getCustomTemplate(),this._dashboardControl.customTemplates.push(this._customTemplate);var e=this._dashboardControl.findExtension("toolbox");if(e&&e.toolbarGroups.push(this._toolbarElement),this._disposables.push(this._dashboardControl.dashboardContainer.subscribe(function(s){s&&t._validateSelection(s,t.availableDashboards())})),this._disposables.push(this.availableDashboards.subscribe(function(s){return t._validateSelection(t._dashboardControl.dashboardContainer(),s)})),this._isMobile()){var o=this._dashboardControl.findExtension("viewer-api"),i=o._options.onDashboardTitleToolbarUpdated;o._options.onDashboardTitleToolbarUpdated=function(s){s.options.navigationItems.push({type:"button",template:function(){return $("
").addClass([t._flexParent,t._ellipsisText].join(" ")).append($('')).append($("
").text(t._dashboardsButtonName).addClass([t._dashboardsButton,t._dashboardTruncated].join(" ")))},click:function(){t.showPanelAsync({surfaceLeft:t._actualPanelWidth()})}}),i.call(t,s)}}this._dashboardControl.isDesignMode()||this._dashboardControl.surfaceLeft(this._isMobile()?0:this.panelWidth),this.updateDashboardsList()},t.prototype.stop=function(){this._disposables.forEach(function(t){return t.dispose()}),this._disposables=[];var t=this._dashboardControl.findExtension("toolbox");t&&t.toolbarGroups.remove(this._toolbarElement),this._dashboardControl.customTemplates.remove(this._customTemplate)},t.prototype.updateDashboardsList=function(){var t=this,s=(this._dashboardControl.dashboardContainer(),this.options);this._dashboardControl.requestDashboardList().done(function(o){t.availableDashboards(o.map(function(t){return new e(t.id,t.name,s.dashboardThumbnail?DevExpress.utils.string.format(s.dashboardThumbnail,t.id):void 0)}))})},t.prototype._validateSelection=function(t,s){if(t){var e=s.filter(function(s){return s.id===t.id})[0];e&&this.selectedItemKeys([e.id])}},t.prototype._getTemplateName=function(){return this._isMobile()?this.options.dashboardThumbnail?"dashboard-preview":"dashboard-card-view":"dashboard-list-item"},t.prototype._hidePanel=function(){this._isMobile()&&this.hidePanelAsync({surfaceLeft:0})},t.prototype._getCustomTemplate=function(){var t=this;return{name:"dashboard-custom-panel-extension",data:{panelWidth:this._actualPanelWidth,allowSwitchToDesigner:this.allowSwitchToDesigner,left:this._left,selectedItemKeys:this.selectedItemKeys,availableDashboards:this.availableDashboards,itemTemplate:this._itemTemplate,isMobile:this._isMobile,hidePanel:function(){t._hidePanel()},switchToDesigner:this.switchToDesigner,switchToViewer:this.switchToViewer}}},t}();t.CustomDashboardPanelExtension=s;var e=function(){function t(t,s,e){this.id=t,this.name=s,this.imageUrl=e,this.hidden=ko.observable(!1)}return t.prototype.hide=function(){this.hidden(!0)},t}()}(CustomExtensions||(CustomExtensions={})); \ No newline at end of file