[SSE] Bug 37388

This commit is contained in:
Julia Svinareva 2019-09-03 14:09:22 +03:00
parent 0cc3ddfca6
commit db5e747c36
3 changed files with 95 additions and 17 deletions

View file

@ -72,10 +72,18 @@ define([
tab.changeState = $.proxy(function (select) {
if (select) {
tab.toggleClass('selected');
var selectTab = _.find(this.bar.selectTabs, function (item) {return item.sheetindex === tab.sheetindex;});
if (selectTab) {
this.bar.selectTabs = _.without(this.bar.selectTabs, selectTab);
} else {
this.bar.selectTabs.push(tab);
}
} else {
if (!tab.isSelected()) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
tab.addClass('selected');
this.bar.selectTabs.length = 0;
this.bar.selectTabs.push(tab);
}
this.trigger('tab:change', tab);
this.bar.$el.find('ul > li.active').removeClass('active');
@ -297,9 +305,10 @@ define([
tab.changeState(true);
} else if (event.shiftKey) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
this.bar.selectTabs.length = 0;
var $active = this.bar.$el.find('ul > li.active'),
indexAct = $active.index(),
indexCur = tab.sheetindex;
indexCur = this.bar.tabs.indexOf(tab);
var startIndex = (indexCur > indexAct) ? indexAct : indexCur,
endIndex = (indexCur > indexAct) ? indexCur : indexAct;
for (var i = startIndex; i <= endIndex; i++) {
@ -319,7 +328,11 @@ define([
this.trigger('tab:dblclick', this, this.tabs.indexOf(tab), tab);
}, this.bar),
contextmenu: $.proxy(function () {
this.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab);
if (this.selectTabs.length > 1) {
this.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab, this.selectTabs);
} else {
this.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab);
}
}, this.bar),
mousedown: $.proxy(function (e) {
if (this.bar.options.draggable && !_.isUndefined(dragHelper) && (3 !== e.which)) {
@ -344,6 +357,7 @@ define([
tabs: [],
template: _.template('<ul class="nav nav-tabs <%= placement %>" />'),
selectTabs: [],
initialize : function (options) {
_.extend(this.config, options);
@ -419,6 +433,10 @@ define([
me.$bar.append(tab.render().$el);
me.tabs.push(tab);
me.manager.attach(tab);
if (tab.isActive()) {
me.selectTabs.length = 0;
me.selectTabs.push(tab);
}
}
} else {
for (i = tabs.length; i-- > 0 ; ) {
@ -432,6 +450,11 @@ define([
me.tabs.splice(index, 0, tab);
}
if (tab.isActive()) {
me.selectTabs.length = 0;
me.selectTabs.push(tab);
}
me.manager.attach(tab);
}
}

View file

@ -247,20 +247,54 @@ define([
onTabMenu: function(obj, item, e) {
var me = this;
switch (item.value){
case 'ins':
setTimeout(function(){
me.api.asc_insertWorksheet(me.createSheetName());
}, 1);
break;
case 'del': this.deleteWorksheet(); break;
case 'ren': this.renameWorksheet(); break;
case 'copy': this.moveWorksheet(false); break;
case 'move': this.moveWorksheet(true); break;
case 'hide':
setTimeout(function(){
me.hideWorksheet(true);}, 1);
break;
var selectTabs = this.statusbar.tabbar.selectTabs;
if (selectTabs.length > 1) {
switch (item.value) {
case 'ins':
setTimeout(function () {
//me.api.asc_insertWorksheets();
}, 1);
break;
case 'del':
this.deleteWorksheets();
break;
case 'copy':
this.moveWorksheets(false);
break;
case 'move':
this.moveWorksheets(true);
break;
case 'hide':
setTimeout(function () {
me.hideWorksheets(selectTabs);
}, 1,);
break;
}
} else {
switch (item.value) {
case 'ins':
setTimeout(function () {
me.api.asc_insertWorksheet(me.createSheetName());
}, 1);
break;
case 'del':
this.deleteWorksheet();
break;
case 'ren':
this.renameWorksheet();
break;
case 'copy':
this.moveWorksheet(false);
break;
case 'move':
this.moveWorksheet(true);
break;
case 'hide':
setTimeout(function () {
me.hideWorksheet(true);
}, 1);
break;
}
}
},
@ -297,6 +331,10 @@ define([
return name;
},
deleteWorksheets: function() {
},
deleteWorksheet: function() {
var me = this;
@ -317,6 +355,19 @@ define([
}
},
hideWorksheets: function(selectTabs) {
var me = this;
if (selectTabs) {
if (selectTabs.length === me.statusbar.tabbar.tabs.length) {
Common.UI.warning({msg: me.errorLastSheet});
} else {
me.statusbar.tabbar.selectTabs.forEach(function (item) {
//me.hideWorksheet(true, item.sheetindex);
});
}
}
},
hideWorksheet: function(hide, index) {
if ( hide ) {
this.statusbar.tabbar.tabs.length == 1 ?
@ -376,6 +427,10 @@ define([
}
},
moveWorksheets: function() {
},
moveWorksheet: function(cut, silent, index, destPos) {
var me = this;
var wc = me.api.asc_getWorksheetsCount(), items = [], i = -1;

View file

@ -409,7 +409,7 @@ define([
// Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getActiveWorksheetId()], false); // hide popover
},
onTabMenu: function (o, index, tab) {
onTabMenu: function (o, index, tab, select) {
if (this.mode.isEdit && !this.isEditFormula && (this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.Chart) &&
(this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.FormatTable) &&
!this.mode.isDisconnected ) {