From c5a4982382e9fe6d17c36e783ef6c42d64d447c3 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Sat, 30 Jan 2021 16:15:25 +0300 Subject: [PATCH] Hide styles for combined charts --- .../main/app/template/ChartSettings.template | 2 +- .../main/app/view/ChartSettings.js | 55 ++++++++++++------- .../main/app/template/ChartSettings.template | 2 +- .../main/app/view/ChartSettings.js | 55 ++++++++++++------- .../main/app/view/ChartSettings.js | 48 +++++++++------- 5 files changed, 97 insertions(+), 65 deletions(-) diff --git a/apps/documenteditor/main/app/template/ChartSettings.template b/apps/documenteditor/main/app/template/ChartSettings.template index 41d89483b..880e21134 100644 --- a/apps/documenteditor/main/app/template/ChartSettings.template +++ b/apps/documenteditor/main/app/template/ChartSettings.template @@ -42,7 +42,7 @@
- +
diff --git a/apps/documenteditor/main/app/view/ChartSettings.js b/apps/documenteditor/main/app/view/ChartSettings.js index 011a52bd1..0c346314f 100644 --- a/apps/documenteditor/main/app/view/ChartSettings.js +++ b/apps/documenteditor/main/app/view/ChartSettings.js @@ -94,6 +94,7 @@ define([ this.labelWidth = el.find('#chart-label-width'); this.labelHeight = el.find('#chart-label-height'); + this.NotCombinedSettings = $('.not-combined'); }, setApi: function(api) { @@ -147,34 +148,39 @@ define([ this.btnChartType.setIconCls('svgicon ' + 'chart-' + record.get('iconCls')); } else this.btnChartType.setIconCls('svgicon'); - this.updateChartStyles(this.api.asc_getChartPreviews(type)); + this.ShowCombinedProps(type); + !(type===null || type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom) && this.updateChartStyles(this.api.asc_getChartPreviews(type)); this._state.ChartType = type; } } - value = props.get_SeveralChartStyles(); - if (this._state.SeveralCharts && value) { - this.cmbChartStyle.fieldPicker.deselectAll(); - this.cmbChartStyle.menuPicker.deselectAll(); - this._state.ChartStyle = null; - } else { - value = this.chartProps.getStyle(); - if (this._state.ChartStyle!==value || this._isChartStylesChanged) { - this.cmbChartStyle.suspendEvents(); - var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value}); - this.cmbChartStyle.menuPicker.selectRecord(rec); - this.cmbChartStyle.resumeEvents(); + if (!(type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom)) { + value = props.get_SeveralChartStyles(); + if (this._state.SeveralCharts && value) { + this.cmbChartStyle.fieldPicker.deselectAll(); + this.cmbChartStyle.menuPicker.deselectAll(); + this._state.ChartStyle = null; + } else { + value = this.chartProps.getStyle(); + if (this._state.ChartStyle !== value || this._isChartStylesChanged) { + this.cmbChartStyle.suspendEvents(); + var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value}); + this.cmbChartStyle.menuPicker.selectRecord(rec); + this.cmbChartStyle.resumeEvents(); - if (this._isChartStylesChanged) { - if (rec) - this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(),true); - else - this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0), true); + if (this._isChartStylesChanged) { + if (rec) + this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(), true); + else + this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0), true); + } + this._state.ChartStyle = value; } - this._state.ChartStyle=value; } + this._isChartStylesChanged = false; } - this._isChartStylesChanged = false; this._noApply = false; @@ -414,7 +420,9 @@ define([ }, _onUpdateChartStyles: function() { - if (this.api && this._state.ChartType!==null && this._state.ChartType>-1) + if (this.api && this._state.ChartType!==null && this._state.ChartType>-1 && + !(this._state.ChartType==Asc.c_oAscChartTypeSettings.comboBarLine || this._state.ChartType==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + this._state.ChartType==Asc.c_oAscChartTypeSettings.comboAreaBar || this._state.ChartType==Asc.c_oAscChartTypeSettings.comboCustom)) this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType)); }, @@ -471,6 +479,11 @@ define([ this.cmbChartStyle.setDisabled(!styles || styles.length<1 || this._locked); }, + ShowCombinedProps: function(type) { + this.NotCombinedSettings.toggleClass('settings-hidden', type===null || type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom); + }, + setLocked: function (locked) { this._locked = locked; }, diff --git a/apps/presentationeditor/main/app/template/ChartSettings.template b/apps/presentationeditor/main/app/template/ChartSettings.template index 0d84fa8e8..fadf1f2b1 100644 --- a/apps/presentationeditor/main/app/template/ChartSettings.template +++ b/apps/presentationeditor/main/app/template/ChartSettings.template @@ -34,7 +34,7 @@
- +
diff --git a/apps/presentationeditor/main/app/view/ChartSettings.js b/apps/presentationeditor/main/app/view/ChartSettings.js index 0e7461baf..739c79af4 100644 --- a/apps/presentationeditor/main/app/view/ChartSettings.js +++ b/apps/presentationeditor/main/app/view/ChartSettings.js @@ -131,34 +131,39 @@ define([ this.btnChartType.setIconCls('svgicon ' + 'chart-' + record.get('iconCls')); } else this.btnChartType.setIconCls('svgicon'); - this.updateChartStyles(this.api.asc_getChartPreviews(type)); + this.ShowCombinedProps(type); + !(type===null || type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom) && this.updateChartStyles(this.api.asc_getChartPreviews(type)); this._state.ChartType = type; } } - value = props.get_SeveralChartStyles(); - if (this._state.SeveralCharts && value) { - this.cmbChartStyle.fieldPicker.deselectAll(); - this.cmbChartStyle.menuPicker.deselectAll(); - this._state.ChartStyle = null; - } else { - value = props.getStyle(); - if (this._state.ChartStyle!==value || this._isChartStylesChanged) { - this.cmbChartStyle.suspendEvents(); - var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value}); - this.cmbChartStyle.menuPicker.selectRecord(rec); - this.cmbChartStyle.resumeEvents(); + if (!(type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom)) { + value = props.get_SeveralChartStyles(); + if (this._state.SeveralCharts && value) { + this.cmbChartStyle.fieldPicker.deselectAll(); + this.cmbChartStyle.menuPicker.deselectAll(); + this._state.ChartStyle = null; + } else { + value = props.getStyle(); + if (this._state.ChartStyle !== value || this._isChartStylesChanged) { + this.cmbChartStyle.suspendEvents(); + var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value}); + this.cmbChartStyle.menuPicker.selectRecord(rec); + this.cmbChartStyle.resumeEvents(); - if (this._isChartStylesChanged) { - if (rec) - this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(),true); - else - this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0), true); + if (this._isChartStylesChanged) { + if (rec) + this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(), true); + else + this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0), true); + } + this._state.ChartStyle = value; } - this._state.ChartStyle=value; } + this._isChartStylesChanged = false; } - this._isChartStylesChanged = false; this._noApply = false; @@ -285,6 +290,7 @@ define([ this.linkAdvanced = $('#chart-advanced-link'); $(this.el).on('click', '#chart-advanced-link', _.bind(this.openAdvancedSettings, this)); + this.NotCombinedSettings = $('.not-combined'); }, createDelayedElements: function() { @@ -351,7 +357,9 @@ define([ }, _onUpdateChartStyles: function() { - if (this.api && this._state.ChartType!==null && this._state.ChartType>-1) + if (this.api && this._state.ChartType!==null && this._state.ChartType>-1 && + !(this._state.ChartType==Asc.c_oAscChartTypeSettings.comboBarLine || this._state.ChartType==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + this._state.ChartType==Asc.c_oAscChartTypeSettings.comboAreaBar || this._state.ChartType==Asc.c_oAscChartTypeSettings.comboCustom)) this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType)); }, @@ -479,6 +487,11 @@ define([ } }, + ShowCombinedProps: function(type) { + this.NotCombinedSettings.toggleClass('settings-hidden', type===null || type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom); + }, + setLocked: function (locked) { this._locked = locked; }, diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettings.js b/apps/spreadsheeteditor/main/app/view/ChartSettings.js index 2debb33d7..f3565fef2 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettings.js @@ -156,33 +156,37 @@ define([ var type = (this._state.SeveralCharts && value) ? null : this.chartProps.getType(); if (this._state.ChartType !== type) { this.ShowCombinedProps(type); - (type !== null) && this.updateChartStyles(this.api.asc_getChartPreviews(type)); + !(type===null || type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom) && this.updateChartStyles(this.api.asc_getChartPreviews(type)); this._state.ChartType = type; } - value = props.asc_getSeveralChartStyles(); - if (this._state.SeveralCharts && value) { - this.cmbChartStyle.fieldPicker.deselectAll(); - this.cmbChartStyle.menuPicker.deselectAll(); - this._state.ChartStyle = null; - } else { - value = this.chartProps.getStyle(); - if (this._state.ChartStyle!==value || this._isChartStylesChanged) { - this.cmbChartStyle.suspendEvents(); - var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value}); - this.cmbChartStyle.menuPicker.selectRecord(rec); - this.cmbChartStyle.resumeEvents(); + if (!(type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom)) { + value = props.asc_getSeveralChartStyles(); + if (this._state.SeveralCharts && value) { + this.cmbChartStyle.fieldPicker.deselectAll(); + this.cmbChartStyle.menuPicker.deselectAll(); + this._state.ChartStyle = null; + } else { + value = this.chartProps.getStyle(); + if (this._state.ChartStyle!==value || this._isChartStylesChanged) { + this.cmbChartStyle.suspendEvents(); + var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value}); + this.cmbChartStyle.menuPicker.selectRecord(rec); + this.cmbChartStyle.resumeEvents(); - if (this._isChartStylesChanged) { - if (rec) - this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(),true); - else - this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0), true); + if (this._isChartStylesChanged) { + if (rec) + this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(),true); + else + this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0), true); + } + this._state.ChartStyle=value; } - this._state.ChartStyle=value; } + this._isChartStylesChanged = false; } - this._isChartStylesChanged = false; this._noApply = false; @@ -954,7 +958,9 @@ define([ }, _onUpdateChartStyles: function() { - if (this.api && this._state.ChartType!==null && this._state.ChartType>-1) + if (this.api && this._state.ChartType!==null && this._state.ChartType>-1 && + !(this._state.ChartType==Asc.c_oAscChartTypeSettings.comboBarLine || this._state.ChartType==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + this._state.ChartType==Asc.c_oAscChartTypeSettings.comboAreaBar || this._state.ChartType==Asc.c_oAscChartTypeSettings.comboCustom)) this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType)); },