[SSE] Add lock for controls on the Pivot tab
This commit is contained in:
parent
8124fa2666
commit
30e5e09766
|
@ -147,7 +147,7 @@ define([
|
|||
|
||||
onApiSelectionChanged: function(info) {
|
||||
var seltype = info.asc_getFlags().asc_getSelectionType(),
|
||||
coauth_disable = (!this.mode.isEditMailMerge && !this.mode.isEditDiagram) ? (info.asc_getLocked() === true || info.asc_getLockedTable() === true) : false;
|
||||
coauth_disable = (!this.mode.isEditMailMerge && !this.mode.isEditDiagram) ? (info.asc_getLocked() === true || info.asc_getLockedTable() === true || info.asc_getLockedPivotTable()===true) : false;
|
||||
|
||||
var is_chart_text = seltype == Asc.c_oAscSelectionType.RangeChartText,
|
||||
is_chart = seltype == Asc.c_oAscSelectionType.RangeChart,
|
||||
|
|
|
@ -99,8 +99,10 @@ define([
|
|||
if (api) {
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.SetDisabled, this));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this));
|
||||
this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this));
|
||||
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this));
|
||||
Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -377,16 +379,22 @@ define([
|
|||
},
|
||||
|
||||
onSelectionChanged: function(info) {
|
||||
if (this.rangeSelectionMode || !this.appConfig.isEdit) return;
|
||||
if (this.rangeSelectionMode || !this.appConfig.isEdit || !this.view) return;
|
||||
|
||||
var selectType = info.asc_getFlags().asc_getSelectionType(),
|
||||
pivotInfo = info.asc_getPivotTableInfo();
|
||||
|
||||
this.view.SetDisabled(!pivotInfo || info.asc_getLockedPivotTable());
|
||||
Common.Utils.lockControls(SSE.enumLock.noPivot, !pivotInfo, {array: this.view.lockedControls});
|
||||
Common.Utils.lockControls(SSE.enumLock.editPivot, !!pivotInfo, {array: [this.view.btnAddPivot]});
|
||||
|
||||
if (pivotInfo)
|
||||
this.ChangeSettings(pivotInfo);
|
||||
},
|
||||
|
||||
onCellsRange: function(status) {
|
||||
this.rangeSelectionMode = (status != Asc.c_oAscSelectionDialogType.None);
|
||||
},
|
||||
|
||||
createToolbarPanel: function() {
|
||||
return this.view.getPanel();
|
||||
},
|
||||
|
|
|
@ -1947,7 +1947,7 @@ define([
|
|||
return this.onApiSelectionChanged_MailMergeEditor(info);
|
||||
|
||||
var selectionType = info.asc_getFlags().asc_getSelectionType(),
|
||||
coauth_disable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram) ? (info.asc_getLocked()===true || info.asc_getLockedTable()===true) : false,
|
||||
coauth_disable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram) ? (info.asc_getLocked()===true || info.asc_getLockedTable()===true || info.asc_getLockedPivotTable()===true) : false,
|
||||
editOptionsDisabled = this._disableEditOptions(selectionType, coauth_disable),
|
||||
me = this,
|
||||
toolbar = this.toolbar,
|
||||
|
@ -3149,10 +3149,12 @@ define([
|
|||
|
||||
if ( !config.isOffline ) {
|
||||
tab = {action: 'pivot', caption: me.textPivot};
|
||||
$panel = me.getApplication().getController('PivotTable').createToolbarPanel();
|
||||
var pivottab = me.getApplication().getController('PivotTable');
|
||||
$panel = pivottab.createToolbarPanel();
|
||||
if ($panel) {
|
||||
me.toolbar.addTab(tab, $panel, 5);
|
||||
me.toolbar.setVisible('pivot', true);
|
||||
Array.prototype.push.apply(me.toolbar.lockControls, pivottab.getView('PivotTable').getButtons());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,23 +152,29 @@ define([
|
|||
this.appConfig = options.mode;
|
||||
this.lockedControls = [];
|
||||
|
||||
var _set = SSE.enumLock;
|
||||
|
||||
this.chRowHeader = new Common.UI.CheckBox({
|
||||
labelText: this.textRowHeader
|
||||
labelText: this.textRowHeader,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot]
|
||||
});
|
||||
this.lockedControls.push(this.chRowHeader);
|
||||
|
||||
this.chColHeader = new Common.UI.CheckBox({
|
||||
labelText: this.textColHeader
|
||||
labelText: this.textColHeader,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot]
|
||||
});
|
||||
this.lockedControls.push(this.chColHeader);
|
||||
|
||||
this.chRowBanded = new Common.UI.CheckBox({
|
||||
labelText: this.textRowBanded
|
||||
labelText: this.textRowBanded,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot]
|
||||
});
|
||||
this.lockedControls.push(this.chRowBanded);
|
||||
|
||||
this.chColBanded = new Common.UI.CheckBox({
|
||||
labelText: this.textColBanded
|
||||
labelText: this.textColBanded,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot]
|
||||
});
|
||||
this.lockedControls.push(this.chColBanded);
|
||||
|
||||
|
@ -176,7 +182,8 @@ define([
|
|||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'btn-add-pivot',
|
||||
caption: this.txtCreate,
|
||||
disabled : false
|
||||
disabled : false,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.editPivot]
|
||||
});
|
||||
// this.lockedControls.push(this.btnAddPivot);
|
||||
|
||||
|
@ -185,6 +192,7 @@ define([
|
|||
iconCls : 'btn-pivot-layout',
|
||||
caption : this.capLayout,
|
||||
disabled : true,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot],
|
||||
menu : new Common.UI.Menu({
|
||||
items: [
|
||||
{ caption: this.mniLayoutCompact, value: 0 },
|
||||
|
@ -203,6 +211,7 @@ define([
|
|||
iconCls : 'btn-blank-rows',
|
||||
caption : this.capBlankRows,
|
||||
disabled : true,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot],
|
||||
menu : new Common.UI.Menu({
|
||||
items: [
|
||||
{ caption: this.mniInsertBlankLine, value: 'insert' },
|
||||
|
@ -217,6 +226,7 @@ define([
|
|||
iconCls : 'btn-subtotals',
|
||||
caption : this.capSubtotals,
|
||||
disabled : true,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot],
|
||||
menu : new Common.UI.Menu({
|
||||
items: [
|
||||
{ caption: this.mniNoSubtotals, value: 0 },
|
||||
|
@ -232,6 +242,7 @@ define([
|
|||
iconCls : 'btn-grand-totals',
|
||||
caption : this.capGrandTotals,
|
||||
disabled : true,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot],
|
||||
menu : new Common.UI.Menu({
|
||||
items: [
|
||||
{ caption: this.mniOffTotals, value: 0 },
|
||||
|
@ -247,14 +258,16 @@ define([
|
|||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'btn-update-pivot',
|
||||
caption: this.txtRefresh,
|
||||
disabled : true
|
||||
disabled : true,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot]
|
||||
});
|
||||
this.lockedControls.push(this.btnRefreshPivot);
|
||||
|
||||
this.btnSelectPivot = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'btn-select-pivot',
|
||||
caption: this.txtSelect
|
||||
caption: this.txtSelect,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot]
|
||||
});
|
||||
this.lockedControls.push(this.btnSelectPivot);
|
||||
|
||||
|
@ -263,8 +276,8 @@ define([
|
|||
enableKeyEvents : true,
|
||||
itemWidth : 61,
|
||||
itemHeight : 49,
|
||||
menuMaxHeight : 300
|
||||
// lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
|
||||
menuMaxHeight : 300,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot]
|
||||
});
|
||||
this.lockedControls.push(this.pivotStyles);
|
||||
|
||||
|
@ -320,11 +333,12 @@ define([
|
|||
this.fireEvent('show', this);
|
||||
},
|
||||
|
||||
getButton: function(type, parent) {
|
||||
getButtons: function(type) {
|
||||
return this.lockedControls.concat(this.btnAddPivot);
|
||||
},
|
||||
|
||||
SetDisabled: function (state) {
|
||||
this.lockedControls && this.lockedControls.forEach(function(button) {
|
||||
this.lockedControls.concat(this.btnAddPivot).forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(state);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,8 @@ define([
|
|||
namedRangeLock: 'named-range-lock',
|
||||
multiselectCols:'is-multiselect-cols',
|
||||
headerLock: 'header-lock',
|
||||
sheetLock: 'sheet-lock'
|
||||
sheetLock: 'sheet-lock',
|
||||
noPivot: 'no-pivot'
|
||||
};
|
||||
|
||||
SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({
|
||||
|
|
Loading…
Reference in a new issue