[SSE] Bug 37388
This commit is contained in:
parent
0cc3ddfca6
commit
db5e747c36
|
@ -72,10 +72,18 @@ define([
|
||||||
tab.changeState = $.proxy(function (select) {
|
tab.changeState = $.proxy(function (select) {
|
||||||
if (select) {
|
if (select) {
|
||||||
tab.toggleClass('selected');
|
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 {
|
} else {
|
||||||
if (!tab.isSelected()) {
|
if (!tab.isSelected()) {
|
||||||
this.bar.$el.find('ul > li.selected').removeClass('selected');
|
this.bar.$el.find('ul > li.selected').removeClass('selected');
|
||||||
tab.addClass('selected');
|
tab.addClass('selected');
|
||||||
|
this.bar.selectTabs.length = 0;
|
||||||
|
this.bar.selectTabs.push(tab);
|
||||||
}
|
}
|
||||||
this.trigger('tab:change', tab);
|
this.trigger('tab:change', tab);
|
||||||
this.bar.$el.find('ul > li.active').removeClass('active');
|
this.bar.$el.find('ul > li.active').removeClass('active');
|
||||||
|
@ -297,9 +305,10 @@ define([
|
||||||
tab.changeState(true);
|
tab.changeState(true);
|
||||||
} else if (event.shiftKey) {
|
} else if (event.shiftKey) {
|
||||||
this.bar.$el.find('ul > li.selected').removeClass('selected');
|
this.bar.$el.find('ul > li.selected').removeClass('selected');
|
||||||
|
this.bar.selectTabs.length = 0;
|
||||||
var $active = this.bar.$el.find('ul > li.active'),
|
var $active = this.bar.$el.find('ul > li.active'),
|
||||||
indexAct = $active.index(),
|
indexAct = $active.index(),
|
||||||
indexCur = tab.sheetindex;
|
indexCur = this.bar.tabs.indexOf(tab);
|
||||||
var startIndex = (indexCur > indexAct) ? indexAct : indexCur,
|
var startIndex = (indexCur > indexAct) ? indexAct : indexCur,
|
||||||
endIndex = (indexCur > indexAct) ? indexCur : indexAct;
|
endIndex = (indexCur > indexAct) ? indexCur : indexAct;
|
||||||
for (var i = startIndex; i <= endIndex; i++) {
|
for (var i = startIndex; i <= endIndex; i++) {
|
||||||
|
@ -319,7 +328,11 @@ define([
|
||||||
this.trigger('tab:dblclick', this, this.tabs.indexOf(tab), tab);
|
this.trigger('tab:dblclick', this, this.tabs.indexOf(tab), tab);
|
||||||
}, this.bar),
|
}, this.bar),
|
||||||
contextmenu: $.proxy(function () {
|
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),
|
}, this.bar),
|
||||||
mousedown: $.proxy(function (e) {
|
mousedown: $.proxy(function (e) {
|
||||||
if (this.bar.options.draggable && !_.isUndefined(dragHelper) && (3 !== e.which)) {
|
if (this.bar.options.draggable && !_.isUndefined(dragHelper) && (3 !== e.which)) {
|
||||||
|
@ -344,6 +357,7 @@ define([
|
||||||
|
|
||||||
tabs: [],
|
tabs: [],
|
||||||
template: _.template('<ul class="nav nav-tabs <%= placement %>" />'),
|
template: _.template('<ul class="nav nav-tabs <%= placement %>" />'),
|
||||||
|
selectTabs: [],
|
||||||
|
|
||||||
initialize : function (options) {
|
initialize : function (options) {
|
||||||
_.extend(this.config, options);
|
_.extend(this.config, options);
|
||||||
|
@ -419,6 +433,10 @@ define([
|
||||||
me.$bar.append(tab.render().$el);
|
me.$bar.append(tab.render().$el);
|
||||||
me.tabs.push(tab);
|
me.tabs.push(tab);
|
||||||
me.manager.attach(tab);
|
me.manager.attach(tab);
|
||||||
|
if (tab.isActive()) {
|
||||||
|
me.selectTabs.length = 0;
|
||||||
|
me.selectTabs.push(tab);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = tabs.length; i-- > 0 ; ) {
|
for (i = tabs.length; i-- > 0 ; ) {
|
||||||
|
@ -432,6 +450,11 @@ define([
|
||||||
me.tabs.splice(index, 0, tab);
|
me.tabs.splice(index, 0, tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tab.isActive()) {
|
||||||
|
me.selectTabs.length = 0;
|
||||||
|
me.selectTabs.push(tab);
|
||||||
|
}
|
||||||
|
|
||||||
me.manager.attach(tab);
|
me.manager.attach(tab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,20 +247,54 @@ define([
|
||||||
|
|
||||||
onTabMenu: function(obj, item, e) {
|
onTabMenu: function(obj, item, e) {
|
||||||
var me = this;
|
var me = this;
|
||||||
switch (item.value){
|
var selectTabs = this.statusbar.tabbar.selectTabs;
|
||||||
case 'ins':
|
if (selectTabs.length > 1) {
|
||||||
setTimeout(function(){
|
switch (item.value) {
|
||||||
me.api.asc_insertWorksheet(me.createSheetName());
|
case 'ins':
|
||||||
}, 1);
|
setTimeout(function () {
|
||||||
break;
|
//me.api.asc_insertWorksheets();
|
||||||
case 'del': this.deleteWorksheet(); break;
|
}, 1);
|
||||||
case 'ren': this.renameWorksheet(); break;
|
break;
|
||||||
case 'copy': this.moveWorksheet(false); break;
|
case 'del':
|
||||||
case 'move': this.moveWorksheet(true); break;
|
this.deleteWorksheets();
|
||||||
case 'hide':
|
break;
|
||||||
setTimeout(function(){
|
case 'copy':
|
||||||
me.hideWorksheet(true);}, 1);
|
this.moveWorksheets(false);
|
||||||
break;
|
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;
|
return name;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
deleteWorksheets: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
deleteWorksheet: function() {
|
deleteWorksheet: function() {
|
||||||
var me = this;
|
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) {
|
hideWorksheet: function(hide, index) {
|
||||||
if ( hide ) {
|
if ( hide ) {
|
||||||
this.statusbar.tabbar.tabs.length == 1 ?
|
this.statusbar.tabbar.tabs.length == 1 ?
|
||||||
|
@ -376,6 +427,10 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
moveWorksheets: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
moveWorksheet: function(cut, silent, index, destPos) {
|
moveWorksheet: function(cut, silent, index, destPos) {
|
||||||
var me = this;
|
var me = this;
|
||||||
var wc = me.api.asc_getWorksheetsCount(), items = [], i = -1;
|
var wc = me.api.asc_getWorksheetsCount(), items = [], i = -1;
|
||||||
|
|
|
@ -409,7 +409,7 @@ define([
|
||||||
// Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getActiveWorksheetId()], false); // hide popover
|
// 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) &&
|
if (this.mode.isEdit && !this.isEditFormula && (this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.Chart) &&
|
||||||
(this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.FormatTable) &&
|
(this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.FormatTable) &&
|
||||||
!this.mode.isDisconnected ) {
|
!this.mode.isDisconnected ) {
|
||||||
|
|
Loading…
Reference in a new issue