[DE] Refactoring loading chart types
This commit is contained in:
parent
23db6a35c6
commit
d7f435a0f0
|
@ -109,7 +109,8 @@ define([
|
|||
'Toolbar': {
|
||||
'insert:break' : this.onClickPageBreak,
|
||||
'change:compact' : this.onClickChangeCompact,
|
||||
'home:open' : this.onHomeOpen
|
||||
'home:open' : this.onHomeOpen,
|
||||
'add:chart' : this.onSelectChart
|
||||
},
|
||||
'FileMenu': {
|
||||
'menu:hide': this.onFileMenu.bind(this, 'hide'),
|
||||
|
@ -313,7 +314,6 @@ define([
|
|||
toolbar.mnuColorSchema.on('item:click', _.bind(this.onColorSchemaClick, this));
|
||||
toolbar.mnuColorSchema.on('show:after', _.bind(this.onColorSchemaShow, this));
|
||||
toolbar.btnMailRecepients.on('click', _.bind(this.onSelectRecepientsClick, this));
|
||||
toolbar.mnuInsertChartPicker.on('item:click', _.bind(this.onSelectChart, this));
|
||||
toolbar.mnuPageNumberPosPicker.on('item:click', _.bind(this.onInsertPageNumberClick, this));
|
||||
toolbar.btnEditHeader.menu.on('item:click', _.bind(this.onEditHeaderFooterClick, this));
|
||||
toolbar.mnuPageNumCurrentPos.on('click', _.bind(this.onPageNumCurrentPosClick, this));
|
||||
|
@ -1839,11 +1839,8 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
onSelectChart: function(picker, item, record) {
|
||||
if (!record) return;
|
||||
|
||||
onSelectChart: function(type) {
|
||||
var me = this,
|
||||
type = record.get('type'),
|
||||
chart = false;
|
||||
|
||||
var selectedElements = me.api.getSelectedElements();
|
||||
|
|
|
@ -506,12 +506,7 @@ define([
|
|||
cls: 'btn-toolbar x-huge icon-top',
|
||||
caption: me.capBtnInsChart,
|
||||
iconCls: 'btn-insertchart',
|
||||
menu: new Common.UI.Menu({
|
||||
style: 'width: 435px;',
|
||||
items: [
|
||||
{template: _.template('<div id="id-toolbar-menu-insertchart" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}
|
||||
]
|
||||
})
|
||||
menu: true
|
||||
});
|
||||
this.paragraphControls.push(this.btnInsertChart);
|
||||
|
||||
|
@ -1656,6 +1651,71 @@ define([
|
|||
this.paragraphControls.push(this.mnuPageNumCurrentPos);
|
||||
this.paragraphControls.push(this.mnuInsertPageCount);
|
||||
|
||||
this.btnInsertChart.setMenu( new Common.UI.Menu({
|
||||
style: 'width: 435px;',
|
||||
items: [
|
||||
{template: _.template('<div id="id-toolbar-menu-insertchart" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}
|
||||
]
|
||||
}));
|
||||
|
||||
var onShowBefore = function(menu) {
|
||||
var picker = new Common.UI.DataView({
|
||||
el: $('#id-toolbar-menu-insertchart'),
|
||||
parentMenu: menu,
|
||||
showLast: false,
|
||||
restoreHeight: 421,
|
||||
groups: new Common.UI.DataViewGroupStore([
|
||||
{id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts},
|
||||
{id: 'menu-chart-group-line', caption: me.textLine},
|
||||
{id: 'menu-chart-group-pie', caption: me.textPie},
|
||||
{id: 'menu-chart-group-hbar', caption: me.textBar},
|
||||
{id: 'menu-chart-group-area', caption: me.textArea, inline: true},
|
||||
{id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true},
|
||||
{id: 'menu-chart-group-stock', caption: me.textStock, inline: true}
|
||||
// {id: 'menu-chart-group-surface', caption: me.textSurface}
|
||||
]),
|
||||
store: new Common.UI.DataViewStore([
|
||||
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal'},
|
||||
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'},
|
||||
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'},
|
||||
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'},
|
||||
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'},
|
||||
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'},
|
||||
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'},
|
||||
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'},
|
||||
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'},
|
||||
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'},
|
||||
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'},
|
||||
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'},
|
||||
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'},
|
||||
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'},
|
||||
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'},
|
||||
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'},
|
||||
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'},
|
||||
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'},
|
||||
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'},
|
||||
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'},
|
||||
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'},
|
||||
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'},
|
||||
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'},
|
||||
{ group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'},
|
||||
{ group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'}
|
||||
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'},
|
||||
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'},
|
||||
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'},
|
||||
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'}
|
||||
|
||||
]),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')
|
||||
});
|
||||
picker.on('item:click', function (picker, item, record, e) {
|
||||
if (record)
|
||||
me.fireEvent('add:chart', [record.get('type')]);
|
||||
});
|
||||
menu.off('show:before', onShowBefore);
|
||||
};
|
||||
this.btnInsertChart.menu.on('show:before', onShowBefore);
|
||||
|
||||
// set dataviews
|
||||
|
||||
var _conf = this.mnuMarkersPicker.conf;
|
||||
|
@ -1773,181 +1833,6 @@ define([
|
|||
});
|
||||
_conf && this.mnuPageNumberPosPicker.setDisabled(_conf.disabled);
|
||||
|
||||
this.mnuInsertChartPicker = new Common.UI.DataView({
|
||||
el: $('#id-toolbar-menu-insertchart'),
|
||||
parentMenu: this.btnInsertChart.menu,
|
||||
showLast: false,
|
||||
restoreHeight: 421,
|
||||
groups: new Common.UI.DataViewGroupStore([
|
||||
{id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts},
|
||||
{id: 'menu-chart-group-line', caption: me.textLine},
|
||||
{id: 'menu-chart-group-pie', caption: me.textPie},
|
||||
{id: 'menu-chart-group-hbar', caption: me.textBar},
|
||||
{id: 'menu-chart-group-area', caption: me.textArea, inline: true},
|
||||
{id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true},
|
||||
{id: 'menu-chart-group-stock', caption: me.textStock, inline: true}
|
||||
// {id: 'menu-chart-group-surface', caption: me.textSurface}
|
||||
]),
|
||||
store: new Common.UI.DataViewStore([
|
||||
{
|
||||
group: 'menu-chart-group-bar',
|
||||
type: Asc.c_oAscChartTypeSettings.barNormal,
|
||||
allowSelected: true,
|
||||
iconCls: 'column-normal',
|
||||
selected: true
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-bar',
|
||||
type: Asc.c_oAscChartTypeSettings.barStacked,
|
||||
allowSelected: true,
|
||||
iconCls: 'column-stack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-bar',
|
||||
type: Asc.c_oAscChartTypeSettings.barStackedPer,
|
||||
allowSelected: true,
|
||||
iconCls: 'column-pstack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-bar',
|
||||
type: Asc.c_oAscChartTypeSettings.barNormal3d,
|
||||
allowSelected: true,
|
||||
iconCls: 'column-3d-normal'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-bar',
|
||||
type: Asc.c_oAscChartTypeSettings.barStacked3d,
|
||||
allowSelected: true,
|
||||
iconCls: 'column-3d-stack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-bar',
|
||||
type: Asc.c_oAscChartTypeSettings.barStackedPer3d,
|
||||
allowSelected: true,
|
||||
iconCls: 'column-3d-pstack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-bar',
|
||||
type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective,
|
||||
allowSelected: true,
|
||||
iconCls: 'column-3d-normal-per'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-line',
|
||||
type: Asc.c_oAscChartTypeSettings.lineNormal,
|
||||
allowSelected: true,
|
||||
iconCls: 'line-normal'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-line',
|
||||
type: Asc.c_oAscChartTypeSettings.lineStacked,
|
||||
allowSelected: true,
|
||||
iconCls: 'line-stack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-line',
|
||||
type: Asc.c_oAscChartTypeSettings.lineStackedPer,
|
||||
allowSelected: true,
|
||||
iconCls: 'line-pstack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-line',
|
||||
type: Asc.c_oAscChartTypeSettings.line3d,
|
||||
allowSelected: true,
|
||||
iconCls: 'line-3d'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-pie',
|
||||
type: Asc.c_oAscChartTypeSettings.pie,
|
||||
allowSelected: true,
|
||||
iconCls: 'pie-normal'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-pie',
|
||||
type: Asc.c_oAscChartTypeSettings.doughnut,
|
||||
allowSelected: true,
|
||||
iconCls: 'pie-doughnut'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-pie',
|
||||
type: Asc.c_oAscChartTypeSettings.pie3d,
|
||||
allowSelected: true,
|
||||
iconCls: 'pie-3d-normal'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-hbar',
|
||||
type: Asc.c_oAscChartTypeSettings.hBarNormal,
|
||||
allowSelected: true,
|
||||
iconCls: 'bar-normal'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-hbar',
|
||||
type: Asc.c_oAscChartTypeSettings.hBarStacked,
|
||||
allowSelected: true,
|
||||
iconCls: 'bar-stack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-hbar',
|
||||
type: Asc.c_oAscChartTypeSettings.hBarStackedPer,
|
||||
allowSelected: true,
|
||||
iconCls: 'bar-pstack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-hbar',
|
||||
type: Asc.c_oAscChartTypeSettings.hBarNormal3d,
|
||||
allowSelected: true,
|
||||
iconCls: 'bar-3d-normal'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-hbar',
|
||||
type: Asc.c_oAscChartTypeSettings.hBarStacked3d,
|
||||
allowSelected: true,
|
||||
iconCls: 'bar-3d-stack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-hbar',
|
||||
type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d,
|
||||
allowSelected: true,
|
||||
iconCls: 'bar-3d-pstack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-area',
|
||||
type: Asc.c_oAscChartTypeSettings.areaNormal,
|
||||
allowSelected: true,
|
||||
iconCls: 'area-normal'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-area',
|
||||
type: Asc.c_oAscChartTypeSettings.areaStacked,
|
||||
allowSelected: true,
|
||||
iconCls: 'area-stack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-area',
|
||||
type: Asc.c_oAscChartTypeSettings.areaStackedPer,
|
||||
allowSelected: true,
|
||||
iconCls: 'area-pstack'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-scatter',
|
||||
type: Asc.c_oAscChartTypeSettings.scatter,
|
||||
allowSelected: true,
|
||||
iconCls: 'point-normal'
|
||||
},
|
||||
{
|
||||
group: 'menu-chart-group-stock',
|
||||
type: Asc.c_oAscChartTypeSettings.stock,
|
||||
allowSelected: true,
|
||||
iconCls: 'stock-normal'
|
||||
}
|
||||
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, allowSelected: true, iconCls: 'surface-normal'},
|
||||
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, allowSelected: true, iconCls: 'surface-wireframe'},
|
||||
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, allowSelected: true, iconCls: 'contour-normal'},
|
||||
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, allowSelected: true, iconCls: 'contour-wireframe'}
|
||||
]),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')
|
||||
});
|
||||
|
||||
this.mnuTablePicker = new Common.UI.DimensionPicker({
|
||||
el: $('#id-toolbar-menu-tablepicker'),
|
||||
minRows: 8,
|
||||
|
|
Loading…
Reference in a new issue