[SSE] Fix slicer styles

This commit is contained in:
Julia Radzhabova 2020-05-27 23:28:27 +03:00
parent 040b22ed81
commit bebe79c925
3 changed files with 17 additions and 11 deletions

View file

@ -884,9 +884,10 @@ define([
var me = this; var me = this;
(new SSE.Views.SlicerSettingsAdvanced({ (new SSE.Views.SlicerSettingsAdvanced({
imageProps : item.imageInfo, imageProps: item.imageInfo,
api : me.api, api : me.api,
handler : function(result, value) { styles : item.imageInfo.asc_getSlicerProperties().asc_getStylesPictures(),
handler : function(result, value) {
if (result == 'ok') { if (result == 'ok') {
if (me.api) { if (me.api) {
me.api.asc_setGraphicObjectProps(value.imageProps); me.api.asc_setGraphicObjectProps(value.imageProps);

View file

@ -493,6 +493,7 @@ define([
self.mnuSlicerPicker.store.reset(arr); self.mnuSlicerPicker.store.reset(arr);
} }
} }
this.btnSlicerStyle.setDisabled(this.mnuSlicerPicker.store.length<1);
}, },
onSelectSlicerStyle: function(btn, picker, itemView, record) { onSelectSlicerStyle: function(btn, picker, itemView, record) {

View file

@ -110,6 +110,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem
iconCls : 'icon-template-slicer', iconCls : 'icon-template-slicer',
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
style: 'width: 333px;', style: 'width: 333px;',
additionalAlign: this.menuAddAlign,
items: [ items: [
{ template: _.template('<div id="sliceradv-menu-style" class="menu-slicer-template" style="margin: 5px 5px 5px 10px;"></div>') } { template: _.template('<div id="sliceradv-menu-style" class="menu-slicer-template" style="margin: 5px 5px 5px 10px;"></div>') }
] ]
@ -386,7 +387,6 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem
this._noApply = true; this._noApply = true;
this.numCols.setValue(slicerprops.asc_getColumnCount(), true); this.numCols.setValue(slicerprops.asc_getColumnCount(), true);
// this.numColWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(slicerprops.asc_getColWidth()).toFixed(2), true);
this.numColHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(slicerprops.asc_getRowHeight()/36000).toFixed(2), true); this.numColHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(slicerprops.asc_getRowHeight()/36000).toFixed(2), true);
this.inputHeader.setValue(slicerprops.asc_getCaption(), true); this.inputHeader.setValue(slicerprops.asc_getCaption(), true);
@ -415,13 +415,16 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem
value = slicerprops.asc_getStyle(); value = slicerprops.asc_getStyle();
var rec = this.mnuSlicerPicker.store.findWhere({type: value}); var rec = this.mnuSlicerPicker.store.findWhere({type: value});
if (!rec) { if (!rec && this.mnuSlicerPicker.store.length>0) {
rec = this.mnuSlicerPicker.store.at(0); rec = this.mnuSlicerPicker.store.at(0);
} }
this.btnSlicerStyle.suspendEvents(); if (rec) {
this.mnuSlicerPicker.selectRecord(rec, true); this.btnSlicerStyle.suspendEvents();
this.btnSlicerStyle.resumeEvents(); this.mnuSlicerPicker.selectRecord(rec, true);
this.$window.find('.icon-template-slicer').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '49px', 'width': '36px', 'background-position': 'center', 'background-size': 'cover'}); this.btnSlicerStyle.resumeEvents();
this.$window.find('.icon-template-slicer').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '49px', 'width': '36px', 'background-position': 'center', 'background-size': 'cover'});
} else
this.$window.find('.icon-template-slicer').css({'height': '49px', 'width': '36px', 'background-position': 'center', 'background-size': 'cover'});
this._noApply = false; this._noApply = false;
@ -450,8 +453,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem
}, },
onInitStyles: function(Templates){ onInitStyles: function(Templates){
var count = this.mnuSlicerPicker.store.length, var arr = [];
arr = [];
Templates && _.each(Templates, function(template){ Templates && _.each(Templates, function(template){
arr.push({ arr.push({
id : Common.UI.getId(), id : Common.UI.getId(),
@ -462,6 +464,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem
}); });
}); });
this.mnuSlicerPicker.store.reset(arr); this.mnuSlicerPicker.store.reset(arr);
this.btnSlicerStyle.setDisabled(this.mnuSlicerPicker.store.length<1);
}, },
onSelectSlicerStyle: function(btn, picker, itemView, record) { onSelectSlicerStyle: function(btn, picker, itemView, record) {
@ -470,6 +473,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem
if (this._changedProps) { if (this._changedProps) {
this._changedProps.asc_setStyle(record.get('type')); this._changedProps.asc_setStyle(record.get('type'));
} }
this.$window.find('.icon-template-slicer').css({'background-image': 'url(' + record.get("imageUrl") + ')', 'height': '49px', 'width': '36px', 'background-position': 'center', 'background-size': 'cover'});
}, },
onRadioSnapChange: function(field, newValue, eOpts) { onRadioSnapChange: function(field, newValue, eOpts) {