[SSE] Remove data settings from chart settings dialog (use chart data dialog instead)

This commit is contained in:
Julia Radzhabova 2020-07-08 16:07:57 +03:00
parent 05c520015b
commit 96704a1f1f
2 changed files with 123 additions and 122 deletions

View file

@ -9,27 +9,27 @@
</tr> </tr>
</table> </table>
</div> </div>
<div class="separator horizontal padding-large"></div> <!--<div class="separator horizontal padding-large"></div>-->
<div class="inner-content"> <!--<div class="inner-content">-->
<table cols="1" style="width: 100%;"> <!--<table cols="1" style="width: 100%;">-->
<tr> <!--<tr>-->
<td> <!--<td>-->
<label class="header"><%= scope.textDataRange %></label> <!--<label class="header"><%= scope.textDataRange %></label>-->
</td> <!--</td>-->
</tr> <!--</tr>-->
<tr> <!--<tr>-->
<td class="padding-small" width="200"> <!--<td class="padding-small" width="200">-->
<div id="chart-dlg-txt-range" class="input-row" style="margin-right: 10px;"></div> <!--<div id="chart-dlg-txt-range" class="input-row" style="margin-right: 10px;"></div>-->
</td> <!--</td>-->
</tr> <!--</tr>-->
<tr> <!--<tr>-->
<td class="padding-small"> <!--<td class="padding-small">-->
<label class="input-label"><%= scope.textDataSeries %></label> <!--<label class="input-label"><%= scope.textDataSeries %></label>-->
<div id="chart-dlg-combo-range" class="input-group-nr" style="width:120px;"></div> <!--<div id="chart-dlg-combo-range" class="input-group-nr" style="width:120px;"></div>-->
</td> <!--</td>-->
</tr> <!--</tr>-->
</table> <!--</table>-->
</div> <!--</div>-->
</div> </div>
<div id="id-chart-settings-dlg-layout" class="settings-panel"> <div id="id-chart-settings-dlg-layout" class="settings-panel">
<div class="inner-content"> <div class="inner-content">

View file

@ -59,7 +59,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
_.extend(this.options, { _.extend(this.options, {
title: this.textTitle, title: this.textTitle,
items: [ items: [
{panelId: 'id-chart-settings-dlg-style', panelCaption: this.textTypeData}, {panelId: 'id-chart-settings-dlg-style', panelCaption: this.textType},
{panelId: 'id-chart-settings-dlg-layout', panelCaption: this.textLayout}, {panelId: 'id-chart-settings-dlg-layout', panelCaption: this.textLayout},
{panelId: 'id-chart-settings-dlg-vert', panelCaption: this.textVertAxis}, {panelId: 'id-chart-settings-dlg-vert', panelCaption: this.textVertAxis},
{panelId: 'id-chart-settings-dlg-hor', panelCaption: this.textHorAxis}, {panelId: 'id-chart-settings-dlg-hor', panelCaption: this.textHorAxis},
@ -138,26 +138,26 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
this.btnChartType.render($('#chart-dlg-button-type')); this.btnChartType.render($('#chart-dlg-button-type'));
this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this, this.btnChartType)); this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this, this.btnChartType));
this.cmbDataDirect = new Common.UI.ComboBox({ // this.cmbDataDirect = new Common.UI.ComboBox({
el : $('#chart-dlg-combo-range'), // el : $('#chart-dlg-combo-range'),
menuStyle : 'min-width: 120px;', // menuStyle : 'min-width: 120px;',
editable : false, // editable : false,
cls : 'input-group-nr', // cls : 'input-group-nr',
data : [ // data : [
{ value: 0, displayValue: this.textDataRows }, // { value: 0, displayValue: this.textDataRows },
{ value: 1, displayValue: this.textDataColumns } // { value: 1, displayValue: this.textDataColumns }
] // ]
}); // });
//
this.txtDataRange = new Common.UI.InputFieldBtn({ // this.txtDataRange = new Common.UI.InputFieldBtn({
el : $('#chart-dlg-txt-range'), // el : $('#chart-dlg-txt-range'),
name : 'range', // name : 'range',
style : 'width: 100%;', // style : 'width: 100%;',
btnHint : this.textSelectData, // btnHint : this.textSelectData,
allowBlank : true, // allowBlank : true,
validateOnChange: true // validateOnChange: true
}); // });
this.txtDataRange.on('button:click', _.bind(this.onSelectData, this)); // this.txtDataRange.on('button:click', _.bind(this.onSelectData, this));
this.cmbChartTitle = new Common.UI.ComboBox({ this.cmbChartTitle = new Common.UI.ComboBox({
el : $('#chart-dlg-combo-chart-title'), el : $('#chart-dlg-combo-chart-title'),
@ -1293,24 +1293,24 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
this._noApply = false; this._noApply = false;
var value = props.getRange(); // var value = props.getRange();
this.txtDataRange.setValue((value) ? value : ''); // this.txtDataRange.setValue((value) ? value : '');
this.dataRangeValid = value; // this.dataRangeValid = value;
//
this.txtDataRange.validation = function(value) { // this.txtDataRange.validation = function(value) {
if (_.isEmpty(value)) { // if (_.isEmpty(value)) {
if (!me.cmbDataDirect.isDisabled()) me.cmbDataDirect.setDisabled(true); // if (!me.cmbDataDirect.isDisabled()) me.cmbDataDirect.setDisabled(true);
return true; // return true;
} // }
//
if (me.cmbDataDirect.isDisabled()) me.cmbDataDirect.setDisabled(false); // if (me.cmbDataDirect.isDisabled()) me.cmbDataDirect.setDisabled(false);
//
var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); // var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false);
return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; // return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true;
}; // };
//
this.cmbDataDirect.setDisabled(value===null); // this.cmbDataDirect.setDisabled(value===null);
this.cmbDataDirect.setValue(props.getInColumns() ? 1 : 0); // this.cmbDataDirect.setValue(props.getInColumns() ? 1 : 0);
this.cmbChartTitle.setValue(props.getTitle()); this.cmbChartTitle.setValue(props.getTitle());
this.cmbLegendPos.setValue(props.getLegendPos()); this.cmbLegendPos.setValue(props.getLegendPos());
@ -1321,7 +1321,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
this.chCategoryName.setValue(this.chartSettings.getShowCatName(), true); this.chCategoryName.setValue(this.chartSettings.getShowCatName(), true);
this.chValue.setValue(this.chartSettings.getShowVal(), true); this.chValue.setValue(this.chartSettings.getShowVal(), true);
value = props.getSeparator(); var value = props.getSeparator();
this.txtSeparator.setValue((value) ? value : ''); this.txtSeparator.setValue((value) ? value : '');
// Vertical Axis // Vertical Axis
@ -1423,8 +1423,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
this.chartSettings.putType(type); this.chartSettings.putType(type);
this.chartSettings.putInColumns(this.cmbDataDirect.getValue()==1); // this.chartSettings.putInColumns(this.cmbDataDirect.getValue()==1);
this.chartSettings.putRange(this.txtDataRange.getValue()); // this.chartSettings.putRange(this.txtDataRange.getValue());
this.chartSettings.putTitle(this.cmbChartTitle.getValue()); this.chartSettings.putTitle(this.cmbChartTitle.getValue());
this.chartSettings.putLegendPos(this.cmbLegendPos.getValue()); this.chartSettings.putLegendPos(this.cmbLegendPos.getValue());
@ -1484,63 +1484,64 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
}, },
isRangeValid: function() { isRangeValid: function() {
if (this.isChart) { return true;
var isvalid; // if (this.isChart) {
if (!_.isEmpty(this.txtDataRange.getValue())) { // var isvalid;
var rec = this.mnuChartTypePicker.getSelectedRec(), // if (!_.isEmpty(this.txtDataRange.getValue())) {
type = (rec) ? rec.get('type') : this.currentChartType; // var rec = this.mnuChartTypePicker.getSelectedRec(),
// type = (rec) ? rec.get('type') : this.currentChartType;
isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, this.txtDataRange.getValue(), true, this.cmbDataDirect.getValue()==0, type); //
if (isvalid == Asc.c_oAscError.ID.No) // isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, this.txtDataRange.getValue(), true, this.cmbDataDirect.getValue()==0, type);
return true; // if (isvalid == Asc.c_oAscError.ID.No)
} else // return true;
return true; // } else
// return true;
this.setActiveCategory(0); //
if (isvalid == Asc.c_oAscError.ID.StockChartError) { // this.setActiveCategory(0);
Common.UI.warning({msg: this.errorStockChart}); // if (isvalid == Asc.c_oAscError.ID.StockChartError) {
} else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) { // Common.UI.warning({msg: this.errorStockChart});
Common.UI.warning({msg: this.errorMaxRows}); // } else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) {
} else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError) // Common.UI.warning({msg: this.errorMaxRows});
Common.UI.warning({msg: this.errorMaxPoints}); // } else if (isvalid == Asc.c_oAscError.ID.MaxDataPointsError)
else // Common.UI.warning({msg: this.errorMaxPoints});
this.txtDataRange.cmpEl.find('input').focus(); // else
return false; // this.txtDataRange.cmpEl.find('input').focus();
} else // return false;
return true; // } else
// return true;
}, },
onSelectData: function() { // onSelectData: function() {
var me = this; // var me = this;
if (me.api) { // if (me.api) {
me.btnChartType.menu.options.additionalAlign = me.menuAddAlign; // me.btnChartType.menu.options.additionalAlign = me.menuAddAlign;
me.btnSparkType.menu.options.additionalAlign = me.menuAddAlign; // me.btnSparkType.menu.options.additionalAlign = me.menuAddAlign;
//
var handlerDlg = function(dlg, result) { // var handlerDlg = function(dlg, result) {
if (result == 'ok') { // if (result == 'ok') {
me.dataRangeValid = dlg.getSettings(); // me.dataRangeValid = dlg.getSettings();
me.txtDataRange.setValue(me.dataRangeValid); // me.txtDataRange.setValue(me.dataRangeValid);
me.txtDataRange.checkValidate(); // me.txtDataRange.checkValidate();
} // }
}; // };
//
var win = new SSE.Views.CellRangeDialog({ // var win = new SSE.Views.CellRangeDialog({
handler: handlerDlg // handler: handlerDlg
}).on('close', function() { // }).on('close', function() {
me.show(); // me.show();
}); // });
//
var xy = me.$window.offset(); // var xy = me.$window.offset();
me.hide(); // me.hide();
win.show(xy.left + 160, xy.top + 125); // win.show(xy.left + 160, xy.top + 125);
win.setSettings({ // win.setSettings({
api : me.api, // api : me.api,
isRows : (me.cmbDataDirect.getValue()==0), // isRows : (me.cmbDataDirect.getValue()==0),
range : (!_.isEmpty(me.txtDataRange.getValue()) && (me.txtDataRange.checkValidate()==true)) ? me.txtDataRange.getValue() : me.dataRangeValid, // range : (!_.isEmpty(me.txtDataRange.getValue()) && (me.txtDataRange.checkValidate()==true)) ? me.txtDataRange.getValue() : me.dataRangeValid,
type : Asc.c_oAscSelectionDialogType.Chart // type : Asc.c_oAscSelectionDialogType.Chart
}); // });
} // }
}, // },
onSelectDataLabels: function(obj, rec, e) { onSelectDataLabels: function(obj, rec, e) {
var disable = rec.value == Asc.c_oAscChartDataLabelsPos.none; var disable = rec.value == Asc.c_oAscChartDataLabelsPos.none;
@ -1614,10 +1615,10 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
show: function() { show: function() {
Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments);
var me = this; // var me = this;
_.delay(function(){ // _.delay(function(){
me.txtDataRange.cmpEl.find('input').focus(); // me.txtDataRange.cmpEl.find('input').focus();
},50); // },50);
}, },
close: function () { close: function () {