[SSE] Add pivot table button to the Insert tab.
This commit is contained in:
parent
1f056b16a5
commit
2493571d17
|
@ -1149,7 +1149,7 @@ define([
|
|||
}
|
||||
|
||||
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && me.appOptions.canFeaturePivot)
|
||||
application.getController('PivotTable').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
|
||||
application.getController('PivotTable').setMode(me.appOptions);
|
||||
|
||||
var viewport = this.getApplication().getController('Viewport').getView('Viewport');
|
||||
viewport.applyEditorMode();
|
||||
|
|
|
@ -89,12 +89,10 @@ define([
|
|||
Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this));
|
||||
},
|
||||
|
||||
setConfig: function (data, api) {
|
||||
this.view = this.createView('PivotTable');
|
||||
this.setApi(api);
|
||||
if (data) {
|
||||
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
|
||||
}
|
||||
setConfig: function (config) {
|
||||
this.view = this.createView('PivotTable', {
|
||||
toolbar: config.toolbar.toolbar
|
||||
});
|
||||
},
|
||||
|
||||
setApi: function (api) {
|
||||
|
@ -106,6 +104,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this));
|
||||
Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
setMode: function(mode) {
|
||||
|
@ -400,7 +399,7 @@ define([
|
|||
|
||||
Common.Utils.lockControls(SSE.enumLock.noPivot, !pivotInfo, {array: this.view.lockedControls});
|
||||
Common.Utils.lockControls(SSE.enumLock.pivotLock, pivotInfo && (info.asc_getLockedPivotTable()===true), {array: this.view.lockedControls});
|
||||
Common.Utils.lockControls(SSE.enumLock.editPivot, !!pivotInfo, {array: [this.view.btnAddPivot]});
|
||||
Common.Utils.lockControls(SSE.enumLock.editPivot, !!pivotInfo, {array: this.view.btnsAddPivot});
|
||||
|
||||
if (pivotInfo)
|
||||
this.ChangeSettings(pivotInfo);
|
||||
|
|
|
@ -3314,6 +3314,7 @@ define([
|
|||
if ( config.canFeaturePivot ) {
|
||||
tab = {action: 'pivot', caption: me.textPivot};
|
||||
var pivottab = me.getApplication().getController('PivotTable');
|
||||
pivottab.setApi(me.api).setConfig({toolbar: me});
|
||||
$panel = pivottab.createToolbarPanel();
|
||||
if ($panel) {
|
||||
me.toolbar.addTab(tab, $panel, 5);
|
||||
|
|
|
@ -120,6 +120,7 @@
|
|||
</section>
|
||||
<section class="panel" data-tab="ins">
|
||||
<div class="group">
|
||||
<span class="btn-slot text x-huge slot-add-pivot"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-instable"></span>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
|
|
|
@ -53,7 +53,7 @@ define([
|
|||
var template =
|
||||
'<section id="pivot-table-panel" class="panel" data-tab="pivot">' +
|
||||
'<div class="group">' +
|
||||
'<span id="slot-btn-add-pivot" class="btn-slot text x-huge"></span>' +
|
||||
'<span class="btn-slot text x-huge slot-add-pivot"></span>' +
|
||||
'</div>' +
|
||||
'<div class="separator long"></div>' +
|
||||
'<div class="group">' +
|
||||
|
@ -94,8 +94,10 @@ define([
|
|||
function setEvents() {
|
||||
var me = this;
|
||||
|
||||
this.btnAddPivot.on('click', function (e) {
|
||||
me.fireEvent('pivottable:create');
|
||||
this.btnsAddPivot.forEach(function(button) {
|
||||
button.on('click', function (b, e) {
|
||||
me.fireEvent('pivottable:create');
|
||||
});
|
||||
});
|
||||
|
||||
this.btnPivotLayout.menu.on('item:click', function (menu, item, e) {
|
||||
|
@ -149,11 +151,14 @@ define([
|
|||
initialize: function (options) {
|
||||
Common.UI.BaseView.prototype.initialize.call(this, options);
|
||||
|
||||
this.appConfig = options.mode;
|
||||
this.toolbar = options.toolbar;
|
||||
this.lockedControls = [];
|
||||
|
||||
var _set = SSE.enumLock;
|
||||
|
||||
this.btnsAddPivot = Common.Utils.injectButtons(this.toolbar.$el.find('.btn-slot.slot-add-pivot'), '', 'toolbar__icon btn-pivot-sum', this.txtPivotTable,
|
||||
[_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell]);
|
||||
|
||||
this.chRowHeader = new Common.UI.CheckBox({
|
||||
labelText: this.textRowHeader,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock]
|
||||
|
@ -178,14 +183,6 @@ define([
|
|||
});
|
||||
this.lockedControls.push(this.chColBanded);
|
||||
|
||||
this.btnAddPivot = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-pivot-sum',
|
||||
caption: this.txtCreate,
|
||||
disabled : false,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell]
|
||||
});
|
||||
|
||||
this.btnPivotLayout = new Common.UI.Button({
|
||||
cls : 'btn-toolbar x-huge icon-top',
|
||||
iconCls : 'toolbar__icon btn-pivot-layout',
|
||||
|
@ -276,7 +273,9 @@ define([
|
|||
(new Promise(function (accept, reject) {
|
||||
accept();
|
||||
})).then(function(){
|
||||
me.btnAddPivot.updateHint(me.tipCreatePivot);
|
||||
me.btnsAddPivot.forEach( function(btn) {
|
||||
btn.updateHint(me.tipCreatePivot);
|
||||
});
|
||||
me.btnRefreshPivot.updateHint(me.tipRefresh);
|
||||
me.btnSelectPivot.updateHint(me.tipSelect);
|
||||
me.btnPivotLayout.updateHint(me.capLayout);
|
||||
|
@ -325,12 +324,15 @@ define([
|
|||
getPanel: function () {
|
||||
this.$el = $(_.template(template)( {} ));
|
||||
|
||||
var _set = SSE.enumLock;
|
||||
this.btnsAddPivot = this.btnsAddPivot.concat(Common.Utils.injectButtons(this.$el.find('.btn-slot.slot-add-pivot'), '', 'toolbar__icon btn-pivot-sum', this.txtCreate,
|
||||
[_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell]));
|
||||
|
||||
this.chRowHeader.render(this.$el.find('#slot-chk-header-row'));
|
||||
this.chColHeader.render(this.$el.find('#slot-chk-header-column'));
|
||||
this.chRowBanded.render(this.$el.find('#slot-chk-banded-row'));
|
||||
this.chColBanded.render(this.$el.find('#slot-chk-banded-column'));
|
||||
|
||||
this.btnAddPivot.render(this.$el.find('#slot-btn-add-pivot'));
|
||||
this.btnRefreshPivot.render(this.$el.find('#slot-btn-refresh-pivot'));
|
||||
this.btnSelectPivot.render(this.$el.find('#slot-btn-select-pivot'));
|
||||
this.btnPivotLayout.render(this.$el.find('#slot-btn-pivot-report-layout'));
|
||||
|
@ -352,11 +354,11 @@ define([
|
|||
},
|
||||
|
||||
getButtons: function(type) {
|
||||
return this.lockedControls.concat(this.btnAddPivot);
|
||||
return this.btnsAddPivot.concat(this.lockedControls);
|
||||
},
|
||||
|
||||
SetDisabled: function (state) {
|
||||
this.lockedControls.concat(this.btnAddPivot).forEach(function(button) {
|
||||
this.btnsAddPivot.concat(this.lockedControls).forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(state);
|
||||
}
|
||||
|
@ -392,7 +394,8 @@ define([
|
|||
tipGrandTotals: 'Show or hide grand totals',
|
||||
tipSubtotals: 'Show or hide subtotals',
|
||||
txtSelect: 'Select',
|
||||
tipSelect: 'Select entire pivot table'
|
||||
tipSelect: 'Select entire pivot table',
|
||||
txtPivotTable: 'Pivot Table'
|
||||
}
|
||||
}()), SSE.Views.PivotTable || {}));
|
||||
});
|
|
@ -2183,6 +2183,7 @@
|
|||
"SSE.Views.PivotTable.txtCreate": "Insert Table",
|
||||
"SSE.Views.PivotTable.txtRefresh": "Refresh",
|
||||
"SSE.Views.PivotTable.txtSelect": "Select",
|
||||
"SSE.Views.PivotTable.txtPivotTable": "Pivot Table",
|
||||
"SSE.Views.PrintSettings.btnDownload": "Save & Download",
|
||||
"SSE.Views.PrintSettings.btnPrint": "Save & Print",
|
||||
"SSE.Views.PrintSettings.strBottom": "Bottom",
|
||||
|
|
Loading…
Reference in a new issue