From 64904a2a0b2ed172e1efdfdeb6714be8a54457ca Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 May 2020 17:05:20 +0300 Subject: [PATCH] [SSE] Fix slicer settings --- .../main/app/template/SlicerSettings.template | 4 +-- .../main/app/view/SlicerSettings.js | 34 ++++++++++++++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template index fb68d3f6b..279a00689 100644 --- a/apps/spreadsheeteditor/main/app/template/SlicerSettings.template +++ b/apps/spreadsheeteditor/main/app/template/SlicerSettings.template @@ -20,11 +20,11 @@ - +
- +
diff --git a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js index c66ddc394..32a3b37fd 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerSettings.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerSettings.js @@ -75,7 +75,8 @@ define([ ColWidth: 0, ColHeight: 0, PosVert: 0, - PosHor: 0 + PosHor: 0, + PosLocked: false }; this.spinners = []; this.lockedControls = []; @@ -94,7 +95,7 @@ define([ scope: this })); - this.linkAdvanced = $('#image-advanced-link'); + this.linkAdvanced = $('#slicer-advanced-link'); }, setApi: function(api) { @@ -181,7 +182,7 @@ define([ minValue: 0 }); this.spinners.push(this.spnHor); - this.lockedControls.push(this.spnVert); + this.lockedControls.push(this.spnHor); this.spnVert = new Common.UI.MetricSpinner({ el: $('#slicer-spin-vert'), @@ -200,6 +201,14 @@ define([ this.spnHor.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.spnVert.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + this.chLock = new Common.UI.CheckBox({ + el: $('#slicer-checkbox-disable-resize'), + labelText: this.textLock, + disabled: this._locked + }); + this.lockedControls.push(this.chLock); + this.chLock.on('change', this.onLockSlicerChange.bind(this)); + this.spnColWidth = new Common.UI.MetricSpinner({ el: $('#slicer-spin-col-width'), step: .1, @@ -367,6 +376,11 @@ define([ } this._isTemplatesChanged = false; + value = slicerprops.asc_getLockedPosition(); + if ( this._state.PosLocked!==value ) { + this.chLock.setValue((value !== null && value !== undefined) ? !!value : 'indeterminate', true); + this._state.PosLocked=value; + } } } }, @@ -493,7 +507,7 @@ define([ self.mnuSlicerPicker.store.reset(arr); } } - this.btnSlicerStyle.setDisabled(this.mnuSlicerPicker.store.length<1); + this.btnSlicerStyle.setDisabled(this.mnuSlicerPicker.store.length<1 || this._locked); }, onSelectSlicerStyle: function(btn, picker, itemView, record) { @@ -505,6 +519,15 @@ define([ } }, + onLockSlicerChange: function(field, newValue, oldValue, eOpts){ + if (this.api) { + if (this._originalProps) { + this._originalProps.asc_getSlicerProperties().asc_setLockedPosition(field.getValue()=='checked'); + this.api.asc_setGraphicObjectProps(this._originalProps); + } + } + }, + setLocked: function (locked) { this._locked = locked; }, @@ -531,7 +554,8 @@ define([ textVert: 'Vertical', textButtons: 'Buttons', textColumns: 'Columns', - textStyle: 'Style' + textStyle: 'Style', + textLock: 'Disable resizing or moving' }, SSE.Views.SlicerSettings || {})); });