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> <div id="chart-button-type" style=""></div>
</td> </td>
</tr> </tr>
<tr> <tr class="not-combined">
<td class="padding-small" colspan=2> <td class="padding-small" colspan=2>
<div class="" id="chart-combo-style" style="width: 100%;"></div> <div class="" id="chart-combo-style" style="width: 100%;"></div>
</td> </td>

View file

@ -94,6 +94,7 @@ define([
this.labelWidth = el.find('#chart-label-width'); this.labelWidth = el.find('#chart-label-width');
this.labelHeight = el.find('#chart-label-height'); this.labelHeight = el.find('#chart-label-height');
this.NotCombinedSettings = $('.not-combined');
}, },
setApi: function(api) { setApi: function(api) {
@ -147,11 +148,15 @@ define([
this.btnChartType.setIconCls('svgicon ' + 'chart-' + record.get('iconCls')); this.btnChartType.setIconCls('svgicon ' + 'chart-' + record.get('iconCls'));
} else } else
this.btnChartType.setIconCls('svgicon'); 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; 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(); value = props.get_SeveralChartStyles();
if (this._state.SeveralCharts && value) { if (this._state.SeveralCharts && value) {
this.cmbChartStyle.fieldPicker.deselectAll(); this.cmbChartStyle.fieldPicker.deselectAll();
@ -159,7 +164,7 @@ define([
this._state.ChartStyle = null; this._state.ChartStyle = null;
} else { } else {
value = this.chartProps.getStyle(); value = this.chartProps.getStyle();
if (this._state.ChartStyle!==value || this._isChartStylesChanged) { if (this._state.ChartStyle !== value || this._isChartStylesChanged) {
this.cmbChartStyle.suspendEvents(); this.cmbChartStyle.suspendEvents();
var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value}); var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value});
this.cmbChartStyle.menuPicker.selectRecord(rec); this.cmbChartStyle.menuPicker.selectRecord(rec);
@ -167,14 +172,15 @@ define([
if (this._isChartStylesChanged) { if (this._isChartStylesChanged) {
if (rec) if (rec)
this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(),true); this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(), true);
else else
this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0), true); 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; this._noApply = false;
@ -414,7 +420,9 @@ define([
}, },
_onUpdateChartStyles: function() { _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)); this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType));
}, },
@ -471,6 +479,11 @@ define([
this.cmbChartStyle.setDisabled(!styles || styles.length<1 || this._locked); 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) { setLocked: function (locked) {
this._locked = locked; this._locked = locked;
}, },

View file

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

View file

@ -131,11 +131,15 @@ define([
this.btnChartType.setIconCls('svgicon ' + 'chart-' + record.get('iconCls')); this.btnChartType.setIconCls('svgicon ' + 'chart-' + record.get('iconCls'));
} else } else
this.btnChartType.setIconCls('svgicon'); 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; 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(); value = props.get_SeveralChartStyles();
if (this._state.SeveralCharts && value) { if (this._state.SeveralCharts && value) {
this.cmbChartStyle.fieldPicker.deselectAll(); this.cmbChartStyle.fieldPicker.deselectAll();
@ -143,7 +147,7 @@ define([
this._state.ChartStyle = null; this._state.ChartStyle = null;
} else { } else {
value = props.getStyle(); value = props.getStyle();
if (this._state.ChartStyle!==value || this._isChartStylesChanged) { if (this._state.ChartStyle !== value || this._isChartStylesChanged) {
this.cmbChartStyle.suspendEvents(); this.cmbChartStyle.suspendEvents();
var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value}); var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value});
this.cmbChartStyle.menuPicker.selectRecord(rec); this.cmbChartStyle.menuPicker.selectRecord(rec);
@ -151,14 +155,15 @@ define([
if (this._isChartStylesChanged) { if (this._isChartStylesChanged) {
if (rec) if (rec)
this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(),true); this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(), true);
else else
this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0), true); 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; this._noApply = false;
@ -285,6 +290,7 @@ define([
this.linkAdvanced = $('#chart-advanced-link'); this.linkAdvanced = $('#chart-advanced-link');
$(this.el).on('click', '#chart-advanced-link', _.bind(this.openAdvancedSettings, this)); $(this.el).on('click', '#chart-advanced-link', _.bind(this.openAdvancedSettings, this));
this.NotCombinedSettings = $('.not-combined');
}, },
createDelayedElements: function() { createDelayedElements: function() {
@ -351,7 +357,9 @@ define([
}, },
_onUpdateChartStyles: function() { _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)); 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) { setLocked: function (locked) {
this._locked = locked; this._locked = locked;
}, },

View file

@ -156,10 +156,13 @@ define([
var type = (this._state.SeveralCharts && value) ? null : this.chartProps.getType(); var type = (this._state.SeveralCharts && value) ? null : this.chartProps.getType();
if (this._state.ChartType !== type) { if (this._state.ChartType !== type) {
this.ShowCombinedProps(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; 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(); value = props.asc_getSeveralChartStyles();
if (this._state.SeveralCharts && value) { if (this._state.SeveralCharts && value) {
this.cmbChartStyle.fieldPicker.deselectAll(); this.cmbChartStyle.fieldPicker.deselectAll();
@ -183,6 +186,7 @@ define([
} }
} }
this._isChartStylesChanged = false; this._isChartStylesChanged = false;
}
this._noApply = false; this._noApply = false;
@ -954,7 +958,9 @@ define([
}, },
_onUpdateChartStyles: function() { _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)); this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType));
}, },