[SSE] Bug 37388 (Add Ungroup Sheets, Select All Sheets)

This commit is contained in:
Julia Svinareva 2019-09-06 13:07:47 +03:00
parent db5e747c36
commit b7364f5631
3 changed files with 47 additions and 39 deletions

View file

@ -315,6 +315,10 @@ define([
this.bar.tabs[i].changeState(true);
}
} else if (!tab.$el.hasClass('active')) {
if (this.bar.tabs.length === this.bar.selectTabs.length) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
this.bar.selectTabs.length = 0;
}
if (tab.control == 'manual') {
this.bar.trigger('tab:manual', this.bar, this.bar.tabs.indexOf(tab), tab);
} else {
@ -328,11 +332,7 @@ define([
this.trigger('tab:dblclick', this, this.tabs.indexOf(tab), tab);
}, this.bar),
contextmenu: $.proxy(function () {
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.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab, this.selectTabs);
}, this.bar),
mousedown: $.proxy(function (e) {
if (this.bar.options.draggable && !_.isUndefined(dragHelper) && (3 !== e.which)) {
@ -507,6 +507,27 @@ define([
this.checkInvisible();
},
setSelectAll: function(isSelect) {
var me = this;
me.selectTabs.length = 0;
if (isSelect) {
me.tabs.forEach(function(tab){
if (!tab.isSelected()) {
tab.addClass('selected');
}
me.selectTabs.push(tab);
});
} else {
me.tabs.forEach(function(tab){
if (tab.isActive()) {
me.selectTabs.push(tab);
} else if (tab.isSelected()) {
tab.removeClass('selected');
}
});
}
},
getActive: function(iselem) {
return iselem ? this.$bar.find('> li.active') : this.$bar.find('> li.active').index();
},

View file

@ -248,29 +248,6 @@ define([
onTabMenu: function(obj, item, e) {
var me = this;
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 () {
@ -295,7 +272,6 @@ define([
}, 1);
break;
}
}
},
createSheetName: function() {
@ -331,10 +307,6 @@ define([
return name;
},
deleteWorksheets: function() {
},
deleteWorksheet: function() {
var me = this;
@ -427,10 +399,6 @@ define([
}
},
moveWorksheets: function() {
},
moveWorksheet: function(cut, silent, index, destPos) {
var me = this;
var wc = me.api.asc_getWorksheetsCount(), items = [], i = -1;

View file

@ -241,7 +241,10 @@ define([
{
caption: this.itemTabColor,
menu: menuColorItems
}
},
{ caption: '--' },
{caption: this.selectAllSheets, value: 'selectall'},
{caption: this.ungroupSheets, value: 'noselect'}
]
}).on('render:after', function(btn) {
var colorVal = $('<div class="btn-color-value-line"></div>');
@ -432,6 +435,15 @@ define([
this.tabMenu.items[6].setDisabled(isdoclocked);
this.tabMenu.items[7].setDisabled(issheetlocked);
if (select.length === 1) {
this.tabMenu.items[10].hide();
} else {
this.tabMenu.items[10].show();
}
this.tabMenu.items[9].setDisabled(issheetlocked);
this.tabMenu.items[10].setDisabled(issheetlocked);
this.api.asc_closeCellEditor();
this.api.asc_enableKeyEvents(false);
@ -473,6 +485,11 @@ define([
onTabMenuClick: function (o, item) {
if (item && this.api) {
this.enableKeyEvents = (item.value === 'ins' || item.value === 'hide');
if (item.value === 'selectall') {
this.tabbar.setSelectAll(true);
} else if (item.value === 'noselect') {
this.tabbar.setSelectAll(false);
}
}
},
@ -544,7 +561,9 @@ define([
textMin : 'MIN',
textMax : 'MAX',
filteredRecordsText : '{0} of {1} records filtered',
filteredText : 'Filter mode'
filteredText : 'Filter mode',
selectAllSheets : 'Select All Sheets',
ungroupSheets : 'Ungroup Sheets'
}, SSE.Views.Statusbar || {}));
SSE.Views.Statusbar.RenameDialog = Common.UI.Window.extend(_.extend({