[SSE] Change chart type in diagram mode

This commit is contained in:
Julia Radzhabova 2020-12-08 12:48:23 +03:00
parent a5aadac49d
commit 52742b6d54
3 changed files with 46 additions and 5 deletions

View file

@ -275,6 +275,7 @@ define([
toolbar.cmbNumberFormat.cmpEl.on('click', '#id-toolbar-mnu-item-more-formats a', _.bind(this.onNumberFormatSelect, this));
toolbar.btnEditChart.on('click', _.bind(this.onEditChart, this));
toolbar.btnEditChartData.on('click', _.bind(this.onEditChartData, this));
toolbar.btnEditChartType.on('click', _.bind(this.onEditChartType, this));
} else
if ( me.appConfig.isEditMailMerge ) {
toolbar.btnUndo.on('click', _.bind(this.onUndo, this));
@ -951,7 +952,7 @@ define([
{
chartSettings: props,
imageSettings: imageSettings,
isDiagramMode: me.toolbar.mode.isEditDiagram,
// isDiagramMode: me.toolbar.mode.isEditDiagram,
isChart: true,
api: me.api,
handler: function(result, value) {
@ -999,6 +1000,35 @@ define([
}
},
onEditChartType: function(btn) {
if (!this.editMode) return;
var me = this;
var props;
if (me.api){
props = me.api.asc_getChartObject();
if (props) {
me._isEditType = true;
props.startEdit();
var win = new SSE.Views.ChartTypeDialog({
chartSettings: props,
api: me.api,
handler: function(result, value) {
if (result == 'ok') {
props.endEdit();
me._isEditType = false;
}
Common.NotificationCenter.trigger('edit:complete', me);
}
}).on('close', function() {
me._isEditType && props.cancelEdit();
me._isEditType = false;
});
win.show();
}
}
},
onSelectChart: function(group, type) {
if (!this.editMode) return;
var me = this,
@ -1860,7 +1890,7 @@ define([
var toolbar = this.toolbar;
if (toolbar.mode.isEditDiagram || toolbar.mode.isEditMailMerge) {
is_cell_edited = (state == Asc.c_oAscCellEditorState.editStart);
toolbar.lockToolbar(SSE.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {array: [toolbar.btnDecDecimal,toolbar.btnIncDecimal,toolbar.cmbNumberFormat, toolbar.btnEditChartData]});
toolbar.lockToolbar(SSE.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {array: [toolbar.btnDecDecimal,toolbar.btnIncDecimal,toolbar.cmbNumberFormat, toolbar.btnEditChartData, toolbar.btnEditChartType]});
} else
if (state == Asc.c_oAscCellEditorState.editStart || state == Asc.c_oAscCellEditorState.editEnd) {
toolbar.lockToolbar(SSE.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {
@ -2601,7 +2631,7 @@ define([
var need_disable = (selectionType === Asc.c_oAscSelectionType.RangeCells || selectionType === Asc.c_oAscSelectionType.RangeCol ||
selectionType === Asc.c_oAscSelectionType.RangeRow || selectionType === Asc.c_oAscSelectionType.RangeMax);
this.toolbar.lockToolbar( SSE.enumLock.selRange, need_disable, {array:[this.toolbar.btnEditChartData]} );
this.toolbar.lockToolbar( SSE.enumLock.selRange, need_disable, {array:[this.toolbar.btnEditChartData, this.toolbar.btnEditChartType]} );
if (selectionType == Asc.c_oAscSelectionType.RangeChart || selectionType == Asc.c_oAscSelectionType.RangeChartText)
return;

View file

@ -31,6 +31,7 @@
<div class="elset">
<span class="btn-slot border" id="slot-btn-chart" style="width: auto;"></span>
<span class="btn-slot border" id="slot-btn-chart-data" style="width: auto;margin-left: 12px;"></span>
<span class="btn-slot border" id="slot-btn-chart-type" style="width: auto;margin-left: 12px;"></span>
</div>
</div>
<div class="group" style="width: 100%;"></div>

View file

@ -285,6 +285,14 @@ define([
lock : [_set.editCell, _set.selRange, _set.selRangeEdit, _set.lostConnect],
style : 'width: 120px;'
});
me.btnEditChartType = new Common.UI.Button({
id : 'id-toolbar-rtn-edit-chart-type',
cls : 'btn-toolbar btn-text-value',
caption : me.tipEditChartType,
lock : [_set.editCell, _set.selRange, _set.selRangeEdit, _set.lostConnect],
style : 'width: 120px;'
});
} else
if ( config.isEditMailMerge ) {
me.$layout = $(_.template(simple)(config));
@ -1639,6 +1647,7 @@ define([
_injectComponent('#slot-field-styles', this.listStyles);
_injectComponent('#slot-btn-chart', this.btnEditChart);
_injectComponent('#slot-btn-chart-data', this.btnEditChartData);
_injectComponent('#slot-btn-chart-type', this.btnEditChartType);
_injectComponent('#slot-btn-pageorient', this.btnPageOrient);
_injectComponent('#slot-btn-pagemargins', this.btnPageMargins);
_injectComponent('#slot-btn-pagesize', this.btnPageSize);
@ -1983,7 +1992,7 @@ define([
if (mode.isDisconnected) {
this.lockToolbar( SSE.enumLock.lostConnect, true );
this.lockToolbar( SSE.enumLock.lostConnect, true,
{array:[this.btnEditChart, this.btnEditChartData, this.btnUndo,this.btnRedo]} );
{array:[this.btnEditChart, this.btnEditChartData, this.btnEditChartType, this.btnUndo,this.btnRedo]} );
if (!mode.enableDownload)
this.lockToolbar(SSE.enumLock.cantPrint, true, {array: [this.btnPrint]});
} else {
@ -2447,6 +2456,7 @@ define([
tipInsertSlicer: 'Insert slicer',
textVertical: 'Vertical Text',
textTabView: 'View',
tipEditChartData: 'Select Data'
tipEditChartData: 'Select Data',
tipEditChartType: 'Change Chart Type'
}, SSE.Views.Toolbar || {}));
});