Merge pull request #521 from ONLYOFFICE/fix/sse-chart-data

[SSE] Select chart data in diagramm mode
This commit is contained in:
Julia Radzhabova 2020-10-02 19:04:00 +03:00 committed by GitHub
commit 65d4be70c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 3 deletions

View file

@ -274,6 +274,7 @@ define([
if (toolbar.cmbNumberFormat.cmpEl)
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));
} else
if ( me.appConfig.isEditMailMerge ) {
toolbar.btnUndo.on('click', _.bind(this.onUndo, this));
@ -968,6 +969,35 @@ define([
}
},
onEditChartData: function(btn) {
if (!this.editMode) return;
var me = this;
var props;
if (me.api){
props = me.api.asc_getChartObject();
if (props) {
me._isEditRanges = true;
props.startEdit();
var win = new SSE.Views.ChartDataDialog({
chartSettings: props,
api: me.api,
handler: function(result, value) {
if (result == 'ok') {
props.endEdit();
me._isEditRanges = false;
}
Common.NotificationCenter.trigger('edit:complete', me);
}
}).on('close', function() {
me._isEditRanges && props.cancelEdit();
me._isEditRanges = false;
});
win.show();
}
}
},
onSelectChart: function(group, type) {
if (!this.editMode) return;
var me = this,
@ -1817,7 +1847,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.lockToolbar(SSE.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {array: [toolbar.btnDecDecimal,toolbar.btnIncDecimal,toolbar.cmbNumberFormat, toolbar.btnEditChartData]});
} else
if (state == Asc.c_oAscCellEditorState.editStart || state == Asc.c_oAscCellEditorState.editEnd) {
toolbar.lockToolbar(SSE.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {
@ -2556,6 +2586,10 @@ define([
if ( _disableEditOptions(selectionType, coauth_disable) ) return;
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]} );
if (selectionType == Asc.c_oAscSelectionType.RangeChart || selectionType == Asc.c_oAscSelectionType.RangeChartText)
return;

View file

@ -30,6 +30,7 @@
<div class="group">
<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>
</div>
</div>
<div class="group" style="width: 100%;"></div>

View file

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

View file

@ -2896,6 +2896,7 @@
"SSE.Views.Toolbar.txtUnmerge": "Unmerge Cells",
"SSE.Views.Toolbar.txtYen": "¥ Yen",
"SSE.Views.Toolbar.textTabView": "View",
"SSE.Views.Toolbar.tipEditChartData": "Select Data",
"SSE.Views.Top10FilterDialog.textType": "Show",
"SSE.Views.Top10FilterDialog.txtBottom": "Bottom",
"SSE.Views.Top10FilterDialog.txtBy": "by",