Hide styles for combined charts

This commit is contained in:
Julia Radzhabova 2021-01-30 16:15:25 +03:00
parent e83357f86a
commit c5a4982382
5 changed files with 97 additions and 65 deletions

View file

@ -42,7 +42,7 @@
<div id="chart-button-type" style=""></div>
</td>
</tr>
<tr>
<tr class="not-combined">
<td class="padding-small" colspan=2>
<div class="" id="chart-combo-style" style="width: 100%;"></div>
</td>

View file

@ -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,11 +148,15 @@ 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;
}
}
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();
@ -175,6 +180,7 @@ define([
}
}
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;
},

View file

@ -34,7 +34,7 @@
<div id="chart-button-type" style=""></div>
</td>
</tr>
<tr>
<tr class="not-combined">
<td class="padding-small">
<div id="chart-combo-style" style=""></div>
</td>

View file

@ -131,11 +131,15 @@ 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;
}
}
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();
@ -159,6 +163,7 @@ define([
}
}
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;
},

View file

@ -156,10 +156,13 @@ 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;
}
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();
@ -183,6 +186,7 @@ define([
}
}
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));
},