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,34 +148,39 @@ 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;
} }
} }
value = props.get_SeveralChartStyles(); if (!(type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
if (this._state.SeveralCharts && value) { type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom)) {
this.cmbChartStyle.fieldPicker.deselectAll(); value = props.get_SeveralChartStyles();
this.cmbChartStyle.menuPicker.deselectAll(); if (this._state.SeveralCharts && value) {
this._state.ChartStyle = null; this.cmbChartStyle.fieldPicker.deselectAll();
} else { this.cmbChartStyle.menuPicker.deselectAll();
value = this.chartProps.getStyle(); this._state.ChartStyle = null;
if (this._state.ChartStyle!==value || this._isChartStylesChanged) { } else {
this.cmbChartStyle.suspendEvents(); value = this.chartProps.getStyle();
var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value}); if (this._state.ChartStyle !== value || this._isChartStylesChanged) {
this.cmbChartStyle.menuPicker.selectRecord(rec); this.cmbChartStyle.suspendEvents();
this.cmbChartStyle.resumeEvents(); var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value});
this.cmbChartStyle.menuPicker.selectRecord(rec);
this.cmbChartStyle.resumeEvents();
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,34 +131,39 @@ 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;
} }
} }
value = props.get_SeveralChartStyles(); if (!(type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
if (this._state.SeveralCharts && value) { type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom)) {
this.cmbChartStyle.fieldPicker.deselectAll(); value = props.get_SeveralChartStyles();
this.cmbChartStyle.menuPicker.deselectAll(); if (this._state.SeveralCharts && value) {
this._state.ChartStyle = null; this.cmbChartStyle.fieldPicker.deselectAll();
} else { this.cmbChartStyle.menuPicker.deselectAll();
value = props.getStyle(); this._state.ChartStyle = null;
if (this._state.ChartStyle!==value || this._isChartStylesChanged) { } else {
this.cmbChartStyle.suspendEvents(); value = props.getStyle();
var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value}); if (this._state.ChartStyle !== value || this._isChartStylesChanged) {
this.cmbChartStyle.menuPicker.selectRecord(rec); this.cmbChartStyle.suspendEvents();
this.cmbChartStyle.resumeEvents(); var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value});
this.cmbChartStyle.menuPicker.selectRecord(rec);
this.cmbChartStyle.resumeEvents();
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,33 +156,37 @@ 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;
} }
value = props.asc_getSeveralChartStyles(); if (!(type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
if (this._state.SeveralCharts && value) { type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom)) {
this.cmbChartStyle.fieldPicker.deselectAll(); value = props.asc_getSeveralChartStyles();
this.cmbChartStyle.menuPicker.deselectAll(); if (this._state.SeveralCharts && value) {
this._state.ChartStyle = null; this.cmbChartStyle.fieldPicker.deselectAll();
} else { this.cmbChartStyle.menuPicker.deselectAll();
value = this.chartProps.getStyle(); this._state.ChartStyle = null;
if (this._state.ChartStyle!==value || this._isChartStylesChanged) { } else {
this.cmbChartStyle.suspendEvents(); value = this.chartProps.getStyle();
var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value}); if (this._state.ChartStyle!==value || this._isChartStylesChanged) {
this.cmbChartStyle.menuPicker.selectRecord(rec); this.cmbChartStyle.suspendEvents();
this.cmbChartStyle.resumeEvents(); var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: value});
this.cmbChartStyle.menuPicker.selectRecord(rec);
this.cmbChartStyle.resumeEvents();
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;
@ -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));
}, },