From 1216bae9bdc4d5d12c22046355636fc312a10bb7 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 16 Sep 2020 16:38:40 +0300 Subject: [PATCH 1/7] Optimize table styles loading --- apps/documenteditor/main/app/view/TableSettings.js | 8 +++++--- .../main/app/view/TableSettings.js | 8 +++++--- .../main/app/controller/PivotTable.js | 12 +++++++----- .../spreadsheeteditor/main/app/view/TableSettings.js | 8 +++++--- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/apps/documenteditor/main/app/view/TableSettings.js b/apps/documenteditor/main/app/view/TableSettings.js index 6f4814961..d696c5653 100644 --- a/apps/documenteditor/main/app/view/TableSettings.js +++ b/apps/documenteditor/main/app/view/TableSettings.js @@ -691,9 +691,11 @@ define([ var count = self.mnuTableTemplatePicker.store.length; if (count>0 && count==Templates.length) { - var data = self.mnuTableTemplatePicker.store.models; - _.each(Templates, function(template, index){ - data[index].set('imageUrl', template.asc_getImage()); + var data = self.mnuTableTemplatePicker.dataViewItems; + data && _.each(Templates, function(template, index){ + var img = template.asc_getImage(); + data[index].model.set('imageUrl', img, {silent: true}); + $(data[index].el).find('img').attr('src', img); }); } else { var arr = []; diff --git a/apps/presentationeditor/main/app/view/TableSettings.js b/apps/presentationeditor/main/app/view/TableSettings.js index 5ac50cca6..55aae8bef 100644 --- a/apps/presentationeditor/main/app/view/TableSettings.js +++ b/apps/presentationeditor/main/app/view/TableSettings.js @@ -658,9 +658,11 @@ define([ var count = self.mnuTableTemplatePicker.store.length; if (count>0 && count==Templates.length) { - var data = self.mnuTableTemplatePicker.store.models; - _.each(Templates, function(template, index){ - data[index].set('imageUrl', template.asc_getImage()); + var data = self.mnuTableTemplatePicker.dataViewItems; + data && _.each(Templates, function(template, index){ + var img = template.asc_getImage(); + data[index].model.set('imageUrl', img, {silent: true}); + $(data[index].el).find('img').attr('src', img); }); } else { var arr = []; diff --git a/apps/spreadsheeteditor/main/app/controller/PivotTable.js b/apps/spreadsheeteditor/main/app/controller/PivotTable.js index 88d0a0341..305633f8f 100644 --- a/apps/spreadsheeteditor/main/app/controller/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/controller/PivotTable.js @@ -332,9 +332,9 @@ define([ if (this._isTemplatesChanged) { if (rec) - view.pivotStyles.fillComboView(view.pivotStyles.menuPicker.getSelectedRec(),true); + view.pivotStyles.fillComboView(view.pivotStyles.menuPicker.getSelectedRec(),true, true); else - view.pivotStyles.fillComboView(view.pivotStyles.menuPicker.store.at(0), true); + view.pivotStyles.fillComboView(view.pivotStyles.menuPicker.store.at(0), true, true); } this._state.TemplateName=value; } @@ -357,9 +357,11 @@ define([ var count = styles.menuPicker.store.length; if (count>0 && count==Templates.length) { - var data = styles.menuPicker.store.models; - _.each(Templates, function(template, index){ - data[index].set('imageUrl', template.asc_getImage()); + var data = styles.menuPicker.dataViewItems; + data && _.each(Templates, function(template, index){ + var img = template.asc_getImage(); + data[index].model.set('imageUrl', img, {silent: true}); + $(data[index].el).find('img').attr('src', img); }); } else { styles.menuPicker.store.reset([]); diff --git a/apps/spreadsheeteditor/main/app/view/TableSettings.js b/apps/spreadsheeteditor/main/app/view/TableSettings.js index 8943c8f61..490b56201 100644 --- a/apps/spreadsheeteditor/main/app/view/TableSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TableSettings.js @@ -503,9 +503,11 @@ define([ var count = self.mnuTableTemplatePicker.store.length; if (count>0 && count==Templates.length) { - var data = self.mnuTableTemplatePicker.store.models; - _.each(Templates, function(template, index){ - data[index].set('imageUrl', template.asc_getImage()); + var data = self.mnuTableTemplatePicker.dataViewItems; + data && _.each(Templates, function(template, index){ + var img = template.asc_getImage(); + data[index].model.set('imageUrl', img, {silent: true}); + $(data[index].el).find('img').attr('src', img); }); } else { var arr = []; From 791e967609c793bc694b0e2b74d0721831760675 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 16 Sep 2020 16:40:09 +0300 Subject: [PATCH 2/7] [SSE] Optimize styles update --- .../main/lib/component/ComboDataView.js | 7 ++++ .../main/app/controller/Toolbar.js | 42 ++++++++++++------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/apps/common/main/lib/component/ComboDataView.js b/apps/common/main/lib/component/ComboDataView.js index ff31ae0aa..7c0d31c99 100644 --- a/apps/common/main/lib/component/ComboDataView.js +++ b/apps/common/main/lib/component/ComboDataView.js @@ -459,6 +459,13 @@ define([ this.menuPicker.selectByIndex(index); }, + selectRecord: function(record) { + if (!record) + this.fieldPicker.deselectAll(); + + this.menuPicker.selectRecord(record); + }, + setItemWidth: function(width) { if (this.itemWidth != width) this.itemWidth = window.devicePixelRatio > 1 ? width / 2 : width; diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 19217ebe6..0b3380f4f 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1739,23 +1739,37 @@ define([ return; } - listStyles.menuPicker.store.reset([]); // remove all - var mainController = this.getApplication().getController('Main'); - _.each(styles, function(style){ - listStyles.menuPicker.store.add({ - imageUrl: style.asc_getImage(), - name : style.asc_getName(), - tip : mainController.translationTable[style.get_Name()] || style.get_Name(), - uid : Common.UI.getId() + var count = listStyles.menuPicker.store.length; + var rec; + if (count>0 && count==styles.length) { + rec = listStyles.menuPicker.getSelectedRec(); + var data = listStyles.menuPicker.dataViewItems; + data && _.each(styles, function(style, index){ + var img = style.asc_getImage(); + data[index].model.set('imageUrl', img, {silent: true}); + data[index].model.set({ + name : style.asc_getName(), + tip : mainController.translationTable[style.get_Name()] || style.get_Name() + }); + $(data[index].el).find('img').attr('src', img); }); - }); - - if (listStyles.menuPicker.store.length > 0 && listStyles.rendered) { - listStyles.fillComboView(listStyles.menuPicker.store.at(0), true); - listStyles.selectByIndex(0); + } else { + var arr = []; + _.each(styles, function(style){ + arr.push({ + imageUrl: style.asc_getImage(), + name : style.asc_getName(), + tip : mainController.translationTable[style.get_Name()] || style.get_Name(), + uid : Common.UI.getId() + }); + }); + listStyles.menuPicker.store.reset(arr); + } + if (listStyles.menuPicker.store.length > 0 && listStyles.rendered) { + listStyles.fillComboView(rec ? rec : listStyles.menuPicker.store.at(0), true, true); + rec ? listStyles.selectRecord(rec) : listStyles.selectByIndex(0); } - window.styles_loaded = true; }, From 9067cbe3b59a688808c00c8cce63ffe70e5b53fd Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 16 Sep 2020 16:40:51 +0300 Subject: [PATCH 3/7] [SSE] Optimize pivot settings changing --- .../main/app/view/PivotSettings.js | 213 ++++++++---------- 1 file changed, 89 insertions(+), 124 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/PivotSettings.js b/apps/spreadsheeteditor/main/app/view/PivotSettings.js index f298f50b7..d7ee80d17 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotSettings.js +++ b/apps/spreadsheeteditor/main/app/view/PivotSettings.js @@ -395,6 +395,7 @@ define([ this._state.TableName=props.asc_getName(); var me = this, + isChecked = [], cache_names = props.asc_getCacheFields(), pivot_names = props.asc_getPivotFields(); @@ -403,145 +404,109 @@ define([ me._state.names[index] = item.asc_getName() || cache_names[index].asc_getName(); }); - var arr = [], isChecked = [], - value = props.asc_getColumnFields(); - value && value.forEach(function (item, index) { - var pivotIndex = item.asc_getIndex(); - if (pivotIndex>-1 || pivotIndex == -2) { - var name = (pivotIndex>-1) ? me._state.names[pivotIndex] : me.textValues; - arr.push(new Common.UI.DataViewModel({ - selected : false, - allowSelected : false, - pivotIndex : pivotIndex, - index : index, - value : name, - tip : (name.length>10) ? name : '' - })); - isChecked[name] = true; + var fillList = function(propValue, list, eventIndex, getNameFunction) { + var arr = []; + var models = list.store.models, + equalArr = list.store.length === (propValue ? propValue.length : 0); + propValue && propValue.forEach(function (item, index) { + var pivotIndex = item.asc_getIndex(); + var name = getNameFunction ? getNameFunction(pivotIndex) : item.asc_getName(); + if (equalArr) { + models[index].set({ + pivotIndex: pivotIndex, + index : index, + value : name, + tip : (name.length>10) ? name : '' + }); + } else + arr.push(new Common.UI.DataViewModel({ + selected : false, + allowSelected : false, + pivotIndex : pivotIndex, + index : index, + value : name, + tip : (name.length>10) ? name : '' + })); + isChecked[getNameFunction ? name : me._state.names[pivotIndex]] = true; + }); + if (!equalArr) { + list.store.reset(arr); + list.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); + list.dataViewItems.forEach(function (item, index) { + item.$el.attr('draggable', true); + item.$el.on('dragstart', _.bind(me.onItemsDragStart, me, eventIndex, list, item, index)); + item.$el.on('dragenter', _.bind(me.onDragItemEnter, me, item, index)); + item.$el.on('dragleave', _.bind(me.onDragItemLeave, me, item, index)); + item.$el.on('dragover', _.bind(me.onDragItemOver, me, list, item, index)); + item.$el.on('drop', _.bind(me.onDrop, me)); + item.$el.on('dragend', _.bind(me.onDragEnd, me)); + }); + list.$el.find('.item').last().css({'margin-bottom': '10px'}); } - }); - this.columnsList.store.reset(arr); - this.columnsList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); + }; + + var value = props.asc_getColumnFields(); + value && (value = _.filter(value, function(item){ + var pivotIndex = item.asc_getIndex(); + return (pivotIndex>-1 || pivotIndex == -2); + })); + fillList(value, this.columnsList, 0, function(pivotIndex) { + return (pivotIndex>-1) ? me._state.names[pivotIndex] : me.textValues; + }); - arr = []; value = props.asc_getRowFields(); - value && value.forEach(function (item, index) { + value && (value = _.filter(value, function(item){ var pivotIndex = item.asc_getIndex(); - if (pivotIndex>-1 || pivotIndex == -2) { - var name = (pivotIndex>-1) ? me._state.names[pivotIndex] : me.textValues; - arr.push(new Common.UI.DataViewModel({ - selected : false, - allowSelected : false, - pivotIndex : pivotIndex, - index : index, - value : name, - tip : (name.length>10) ? name : '' - })); - isChecked[name] = true; - } + return (pivotIndex>-1 || pivotIndex == -2); + })); + fillList(value, this.rowsList, 1, function(pivotIndex) { + return (pivotIndex>-1) ? me._state.names[pivotIndex] : me.textValues; }); - this.rowsList.store.reset(arr); - this.rowsList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); - arr = []; value = props.asc_getDataFields(); - value && value.forEach(function (item, index) { - var pivotIndex = item.asc_getIndex(); - if (pivotIndex>-1) { - var name = item.asc_getName(); - arr.push(new Common.UI.DataViewModel({ - selected : false, - allowSelected : false, - pivotIndex : pivotIndex, - index : index, - value : name, - tip : (name.length>10) ? name : '' - })); - isChecked[me._state.names[pivotIndex]] = true; - } - }); - this.valuesList.store.reset(arr); - this.valuesList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); + value && (value = _.filter(value, function(item){ + return (item.asc_getIndex()>-1); + })); + fillList(value, this.valuesList, 2); - arr = []; value = props.asc_getPageFields(); - value && value.forEach(function (item, index) { - var pivotIndex = item.asc_getIndex(); - if (pivotIndex>-1) { - var name = me._state.names[pivotIndex]; + value && (value = _.filter(value, function(item){ + return (item.asc_getIndex()>-1); + })); + fillList(value, this.filtersList, 3, function(pivotIndex) { + return me._state.names[pivotIndex]; + }); + + var arr = []; + var models = this.fieldsList.store.models; + var equalArr = this.fieldsList.store.length === me._state.names.length; + me._state.names.forEach(function (item, index) { + if (equalArr) { + models[index].set({ + value : item, + index : index, + tip : (item.length>25) ? item : '', + check : isChecked[item] + }); + } else arr.push(new Common.UI.DataViewModel({ selected : false, allowSelected : false, - pivotIndex : pivotIndex, + value : item, index : index, - value : name, - tip : (name.length>10) ? name : '' + tip : (item.length>25) ? item : '', + check : isChecked[item] })); - isChecked[name] = true; - } }); - this.filtersList.store.reset(arr); - this.filtersList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); - - arr = []; - me._state.names.forEach(function (item, index) { - arr.push(new Common.UI.DataViewModel({ - selected : false, - allowSelected : false, - value : item, - index : index, - tip : (item.length>25) ? item : '', - check : isChecked[item] - })); - }); - this.fieldsList.store.reset(arr); - this.fieldsList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); - - this.fieldsList.dataViewItems.forEach(function (item, index) { - item.$el.attr('draggable', true); - item.$el.on('dragstart', _.bind(me.onFieldsDragStart, me, item, index)); - item.$el.on('dragend', _.bind(me.onDragEnd, me)); - }); - this.columnsList.dataViewItems.forEach(function (item, index) { - item.$el.attr('draggable', true); - item.$el.on('dragstart', _.bind(me.onItemsDragStart, me, 0, me.columnsList, item, index)); - item.$el.on('dragenter', _.bind(me.onDragItemEnter, me, item, index)); - item.$el.on('dragleave', _.bind(me.onDragItemLeave, me, item, index)); - item.$el.on('dragover', _.bind(me.onDragItemOver, me, me.columnsList, item, index)); - item.$el.on('drop', _.bind(me.onDrop, me)); - item.$el.on('dragend', _.bind(me.onDragEnd, me)); - }); - this.columnsList.$el.find('.item').last().css({'margin-bottom': '10px'}); - this.rowsList.dataViewItems.forEach(function (item, index) { - item.$el.attr('draggable', true); - item.$el.on('dragstart', _.bind(me.onItemsDragStart, me, 1, me.rowsList, item, index)); - item.$el.on('dragenter', _.bind(me.onDragItemEnter, me, item, index)); - item.$el.on('dragleave', _.bind(me.onDragItemLeave, me, item, index)); - item.$el.on('dragover', _.bind(me.onDragItemOver, me, me.rowsList, item, index)); - item.$el.on('drop', _.bind(me.onDrop, me)); - item.$el.on('dragend', _.bind(me.onDragEnd, me)); - }); - this.rowsList.$el.find('.item').last().css({'margin-bottom': '10px'}); - this.valuesList.dataViewItems.forEach(function (item, index) { - item.$el.attr('draggable', true); - item.$el.on('dragstart', _.bind(me.onItemsDragStart, me, 2, me.valuesList, item, index)); - item.$el.on('dragenter', _.bind(me.onDragItemEnter, me, item, index)); - item.$el.on('dragleave', _.bind(me.onDragItemLeave, me, item, index)); - item.$el.on('dragover', _.bind(me.onDragItemOver, me, me.valuesList, item, index)); - item.$el.on('drop', _.bind(me.onDrop, me)); - item.$el.on('dragend', _.bind(me.onDragEnd, me)); - }); - this.valuesList.$el.find('.item').last().css({'margin-bottom': '10px'}); - this.filtersList.dataViewItems.forEach(function (item, index) { - item.$el.attr('draggable', true); - item.$el.on('dragstart', _.bind(me.onItemsDragStart, me, 3, me.filtersList, item, index)); - item.$el.on('dragenter', _.bind(me.onDragItemEnter, me, item, index)); - item.$el.on('dragleave', _.bind(me.onDragItemLeave, me, item, index)); - item.$el.on('dragover', _.bind(me.onDragItemOver, me, me.filtersList, item, index)); - item.$el.on('drop', _.bind(me.onDrop, me)); - item.$el.on('dragend', _.bind(me.onDragEnd, me)); - }); - this.filtersList.$el.find('.item').last().css({'margin-bottom': '10px'}); + if (!equalArr) { + this.fieldsList.store.reset(arr); + this.fieldsList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); + this.fieldsList.dataViewItems.forEach(function (item, index) { + item.$el.attr('draggable', true); + item.$el.on('dragstart', _.bind(me.onFieldsDragStart, me, item, index)); + item.$el.on('dragend', _.bind(me.onDragEnd, me)); + }); + } } }, From 8a08de3c95f3c6b5ecb1d420a329b83217b6ab80 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 16 Sep 2020 23:30:12 +0300 Subject: [PATCH 4/7] [SSE] Fix style updating --- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 0b3380f4f..4616f9aa6 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1741,9 +1741,8 @@ define([ var mainController = this.getApplication().getController('Main'); var count = listStyles.menuPicker.store.length; - var rec; + var rec = listStyles.menuPicker.getSelectedRec(); if (count>0 && count==styles.length) { - rec = listStyles.menuPicker.getSelectedRec(); var data = listStyles.menuPicker.dataViewItems; data && _.each(styles, function(style, index){ var img = style.asc_getImage(); @@ -1767,6 +1766,7 @@ define([ listStyles.menuPicker.store.reset(arr); } if (listStyles.menuPicker.store.length > 0 && listStyles.rendered) { + rec = rec ? listStyles.menuPicker.store.findWhere({name: rec.get('name')}) : null; listStyles.fillComboView(rec ? rec : listStyles.menuPicker.store.at(0), true, true); rec ? listStyles.selectRecord(rec) : listStyles.selectByIndex(0); } From 1448308bcd338fd15351e2b17f085888b1f0338a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 17 Sep 2020 00:38:36 +0300 Subject: [PATCH 5/7] [SSE] Bug 42429 --- apps/spreadsheeteditor/main/app/view/TableSettings.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/TableSettings.js b/apps/spreadsheeteditor/main/app/view/TableSettings.js index 490b56201..12cae8351 100644 --- a/apps/spreadsheeteditor/main/app/view/TableSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TableSettings.js @@ -462,10 +462,7 @@ define([ onSendThemeColors: function() { // get new table templates - if (this.cmbTableTemplate) { - this.onApiInitTableTemplates(this.api.asc_getTablePictures(this._originalProps)); - this.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY: true}); - } + this.btnTableTemplate && this.onApiInitTableTemplates(this.api.asc_getTablePictures(this._originalProps)); }, onApiInitTableTemplates: function(Templates){ From a4965064eb6253a9c530cfafeeba3cdc3dedd4f6 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 17 Sep 2020 16:29:48 +0300 Subject: [PATCH 6/7] [SSE] Fix styles updating --- .../main/app/controller/PivotTable.js | 17 ++++++++++++++--- .../main/app/controller/Toolbar.js | 12 +++++++++++- apps/spreadsheeteditor/main/app/view/Toolbar.js | 7 +++++++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/PivotTable.js b/apps/spreadsheeteditor/main/app/controller/PivotTable.js index 305633f8f..f826afaea 100644 --- a/apps/spreadsheeteditor/main/app/controller/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/controller/PivotTable.js @@ -65,7 +65,8 @@ define([ 'pivottable:layout': _.bind(this.onPivotLayout, this), 'pivottable:blankrows': _.bind(this.onPivotBlankRows, this), 'pivottable:subtotals': _.bind(this.onPivotSubtotals, this), - 'pivottable:grandtotals': _.bind(this.onPivotGrandTotals, this) + 'pivottable:grandtotals': _.bind(this.onPivotGrandTotals, this), + 'pivot:open': _.bind(this.onPivotOpen, this) }, 'TableSettings': { 'pivottable:create': _.bind(this.onCreateClick, this) @@ -332,9 +333,9 @@ define([ if (this._isTemplatesChanged) { if (rec) - view.pivotStyles.fillComboView(view.pivotStyles.menuPicker.getSelectedRec(),true, true); + view.pivotStyles.fillComboView(view.pivotStyles.menuPicker.getSelectedRec(),true); else - view.pivotStyles.fillComboView(view.pivotStyles.menuPicker.store.at(0), true, true); + view.pivotStyles.fillComboView(view.pivotStyles.menuPicker.store.at(0), true); } this._state.TemplateName=value; } @@ -363,6 +364,7 @@ define([ data[index].model.set('imageUrl', img, {silent: true}); $(data[index].el).find('img').attr('src', img); }); + styles.fieldPicker.store.reset(styles.fieldPicker.store.models); } else { styles.menuPicker.store.reset([]); var arr = []; @@ -382,6 +384,15 @@ define([ } }, + onPivotOpen: function() { + var styles = this.view.pivotStyles; + if (styles && styles.needFillComboView && styles.menuPicker.store.length > 0 && styles.rendered){ + var styleRec; + if (this._state.TemplateName) styleRec = styles.menuPicker.store.findWhere({name: this._state.TemplateName}); + styles.fillComboView((styleRec) ? styleRec : styles.menuPicker.store.at(0), true); + } + }, + onSelectionChanged: function(info) { if (this.rangeSelectionMode || !this.appConfig.isEdit || !this.view) return; diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 4616f9aa6..fb7cd548b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -80,7 +80,8 @@ define([ 'add:chart' : this.onSelectChart, 'insert:textart': this.onInsertTextart, 'change:scalespn': this.onClickChangeScaleInMenu.bind(me), - 'click:customscale': this.onScaleClick.bind(me) + 'click:customscale': this.onScaleClick.bind(me), + 'home:open' : this.onHomeOpen }, 'FileMenu': { 'menu:hide': me.onFileMenu.bind(me, 'hide'), @@ -1773,6 +1774,15 @@ define([ window.styles_loaded = true; }, + onHomeOpen: function() { + var listStyles = this.toolbar.listStyles; + if (listStyles && listStyles.needFillComboView && listStyles.menuPicker.store.length > 0 && listStyles.rendered){ + var styleRec; + if (this._state.prstyle) styleRec = listStyles.menuPicker.store.findWhere({name: this._state.prstyle}); + listStyles.fillComboView((styleRec) ? styleRec : listStyles.menuPicker.store.at(0), true); + } + }, + onApiCoAuthoringDisconnect: function(enableDownload) { this.toolbar.setMode({isDisconnected:true, enableDownload: !!enableDownload}); this.editMode = false; diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 1103b9769..116e20b68 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1553,6 +1553,13 @@ define([ me.fireEvent('file:open'); me.setTab(tab); } + if ( me.isTabActive('home')) + me.fireEvent('home:open'); + + if ( me.isTabActive('pivot')) { + var pivottab = SSE.getController('PivotTable'); + pivottab && pivottab.getView('PivotTable').fireEvent('pivot:open'); + } }, rendererComponents: function(html) { From edfcd54b9512fe33b4ac48eba28b5ecb6587e4ea Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 17 Sep 2020 17:00:17 +0300 Subject: [PATCH 7/7] [SSE] Refactoring --- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index fb7cd548b..ca710a338 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1769,7 +1769,6 @@ define([ if (listStyles.menuPicker.store.length > 0 && listStyles.rendered) { rec = rec ? listStyles.menuPicker.store.findWhere({name: rec.get('name')}) : null; listStyles.fillComboView(rec ? rec : listStyles.menuPicker.store.at(0), true, true); - rec ? listStyles.selectRecord(rec) : listStyles.selectByIndex(0); } window.styles_loaded = true; },