Merge pull request #524 from ONLYOFFICE/fix/bug-46841

Fix Bug 46841
This commit is contained in:
Julia Radzhabova 2020-10-09 14:29:41 +03:00 committed by GitHub
commit 866c5af737
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 35 deletions

View file

@ -951,6 +951,7 @@ define([
{ {
chartSettings: props, chartSettings: props,
imageSettings: imageSettings, imageSettings: imageSettings,
isDiagramMode: me.toolbar.mode.isEditDiagram,
isChart: true, isChart: true,
api: me.api, api: me.api,
handler: function(result, value) { handler: function(result, value) {

View file

@ -96,6 +96,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
this.imageSettings = this.options.imageSettings; this.imageSettings = this.options.imageSettings;
this.sparklineStyles = this.options.sparklineStyles; this.sparklineStyles = this.options.sparklineStyles;
this.isChart = this.options.isChart; this.isChart = this.options.isChart;
this.isDiagramMode = !!this.options.isDiagramMode;
this.vertAxisProps = null; this.vertAxisProps = null;
this.horAxisProps = null; this.horAxisProps = null;
this.currentAxisProps = null; this.currentAxisProps = null;
@ -114,29 +115,31 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
// Layout // Layout
// this.btnChartType = new Common.UI.Button({ if (this.isDiagramMode) {
// cls : 'btn-large-dataview', this.btnChartType = new Common.UI.Button({
// iconCls : 'svgicon chart-bar-normal', cls : 'btn-large-dataview',
// menu : new Common.UI.Menu({ iconCls : 'svgicon chart-bar-normal',
// style: 'width: 364px; padding-top: 12px;', menu : new Common.UI.Menu({
// additionalAlign: this.menuAddAlign, style: 'width: 364px; padding-top: 12px;',
// items: [ additionalAlign: this.menuAddAlign,
// { template: _.template('<div id="id-chart-dlg-menu-type" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>') } items: [
// ] { template: _.template('<div id="id-chart-dlg-menu-type" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>') }
// }) ]
// }); })
// this.btnChartType.on('render:after', function(btn) { });
// me.mnuChartTypePicker = new Common.UI.DataView({ this.btnChartType.on('render:after', function(btn) {
// el: $('#id-chart-dlg-menu-type'), me.mnuChartTypePicker = new Common.UI.DataView({
// parentMenu: btn.menu, el: $('#id-chart-dlg-menu-type'),
// restoreHeight: 421, parentMenu: btn.menu,
// groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()), restoreHeight: 421,
// store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()), groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),
// itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist"><svg width="40" height="40" class=\"icon\"><use xlink:href=\"#chart-<%= iconCls %>\"></use></svg></div>') store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()),
// }); itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist"><svg width="40" height="40" class=\"icon\"><use xlink:href=\"#chart-<%= iconCls %>\"></use></svg></div>')
// }); });
// this.btnChartType.render($('#chart-dlg-button-type')); });
// this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this, this.btnChartType)); this.btnChartType.render($('#chart-dlg-button-type'));
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'),
@ -979,7 +982,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
this.setTitle((this.isChart) ? this.textTitle : this.textTitleSparkline); this.setTitle((this.isChart) ? this.textTitle : this.textTitleSparkline);
this.btnsCategory[0].setVisible(false); // hide type for charts this.btnsCategory[0].setVisible(this.isDiagramMode); // hide type for charts
if (this.isChart) { if (this.isChart) {
this.btnsCategory[4].setVisible(false); this.btnsCategory[4].setVisible(false);
this.btnsCategory[5].setVisible(false); this.btnsCategory[5].setVisible(false);
@ -1284,12 +1287,14 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
// Layout // Layout
// var record = this.mnuChartTypePicker.store.findWhere({type: this._state.ChartType}); if (this.isDiagramMode) {
// this.mnuChartTypePicker.selectRecord(record, true); var record = this.mnuChartTypePicker.store.findWhere({type: this._state.ChartType});
// if (record) { this.mnuChartTypePicker.selectRecord(record, true);
// this.btnChartType.setIconCls('svgicon ' + 'chart-' + record.get('iconCls')); if (record) {
// } else this.btnChartType.setIconCls('svgicon ' + 'chart-' + record.get('iconCls'));
// this.btnChartType.setIconCls('svgicon'); } else
this.btnChartType.setIconCls('svgicon');
}
this._noApply = false; this._noApply = false;
@ -1418,9 +1423,11 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
var value; var value;
if (this.isChart) { if (this.isChart) {
// var rec = this.mnuChartTypePicker.getSelectedRec(),
// type = (rec) ? rec.get('type') : this.currentChartType;
var type = this.currentChartType; var type = this.currentChartType;
if (this.isDiagramMode) {
var rec = this.mnuChartTypePicker.getSelectedRec();
rec && (type = rec.get('type'));
}
this.chartSettings.putType(type); this.chartSettings.putType(type);
@ -1489,10 +1496,11 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template'
var isvalid, var isvalid,
range = this.chartSettings.getRange(); range = this.chartSettings.getRange();
if (!_.isEmpty(range)) { if (!_.isEmpty(range)) {
// var rec = this.mnuChartTypePicker.getSelectedRec(),
// type = (rec) ? rec.get('type') : this.currentChartType;
var type = this.currentChartType; var type = this.currentChartType;
if (this.isDiagramMode) {
var rec = this.mnuChartTypePicker.getSelectedRec();
rec && (type = rec.get('type'));
}
isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, range, true, !this.chartSettings.getInColumns(), type); isvalid = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, range, true, !this.chartSettings.getInColumns(), type);
if (isvalid == Asc.c_oAscError.ID.No) if (isvalid == Asc.c_oAscError.ID.No)
return true; return true;