[SSE] Bug 37388

This commit is contained in:
Julia Svinareva 2019-08-30 16:34:11 +03:00
parent 7c8150ca16
commit c708c55056
3 changed files with 43 additions and 6 deletions

View file

@ -82,6 +82,10 @@ define([
this.$el.addClass('active'); this.$el.addClass('active');
}, },
isSelected: function() {
return this.$el.hasClass('selected');
},
deactivate: function(){ deactivate: function(){
this.$el.removeClass('active'); this.$el.removeClass('active');
}, },
@ -110,6 +114,11 @@ define([
this.$el.removeClass(cls); this.$el.removeClass(cls);
}, },
toggleClass: function(cls) {
if (cls.length)
this.$el.toggleClass(cls);
},
hasClass: function(cls) { hasClass: function(cls) {
return this.$el.hasClass(cls); return this.$el.hasClass(cls);
}, },

View file

@ -69,12 +69,20 @@ define([
}; };
StateManager.prototype.attach = function (tab) { StateManager.prototype.attach = function (tab) {
tab.changeState = $.proxy(function () { tab.changeState = $.proxy(function (select) {
this.trigger('tab:change', tab); if (select) {
this.bar.$el.find('ul > li.active').removeClass('active'); tab.toggleClass('selected');
tab.activate(); } else {
if (!tab.isSelected()) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
tab.addClass('selected');
}
this.trigger('tab:change', tab);
this.bar.$el.find('ul > li.active').removeClass('active');
tab.activate();
this.bar.trigger('tab:changed', this.bar, this.bar.tabs.indexOf(tab), tab); this.bar.trigger('tab:changed', this.bar, this.bar.tabs.indexOf(tab), tab);
}
}, this); }, this);
var dragHelper = new (function() { var dragHelper = new (function() {
@ -283,10 +291,22 @@ define([
}); });
tab.$el.on({ tab.$el.on({
click: $.proxy(function () { click: $.proxy(function (event) {
if (!tab.disabled && !tab.$el.hasClass('active')) { if (!tab.disabled && !tab.$el.hasClass('active')) {
if (tab.control == 'manual') { if (tab.control == 'manual') {
this.bar.trigger('tab:manual', this.bar, this.bar.tabs.indexOf(tab), tab); this.bar.trigger('tab:manual', this.bar, this.bar.tabs.indexOf(tab), tab);
} else if (event.ctrlKey || event.metaKey) {
tab.changeState(true);
} else if (event.shiftKey) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
var $active = this.bar.$el.find('ul > li.active'),
indexAct = $active.index(),
indexCur = tab.sheetindex;
var startIndex = (indexCur > indexAct) ? indexAct : indexCur,
endIndex = (indexCur > indexAct) ? indexCur : indexAct;
for(var i = startIndex; i <= endIndex; i++) {
this.bar.tabs[i].changeState(true);
}
} else { } else {
tab.changeState(); tab.changeState();
} }

View file

@ -194,6 +194,14 @@
} }
} }
&.selected {
> a {
border-bottom-color: @body-bg;
background-color: @body-bg;
box-shadow: 0px 2px 0 @gray-deep inset;
}
}
&.coauth-locked { &.coauth-locked {
> a { > a {
outline: none; outline: none;