mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-17 09:59:58 +00:00
fixed tab rearranging conditions
This commit is contained in:
parent
c736a84835
commit
f27e1ec62d
@ -4,6 +4,7 @@ import { AppService } from '../services/app.service'
|
|||||||
import { BaseTabComponent } from './baseTab.component'
|
import { BaseTabComponent } from './baseTab.component'
|
||||||
import { SelfPositioningComponent } from './selfPositioning.component'
|
import { SelfPositioningComponent } from './selfPositioning.component'
|
||||||
import { SplitDropZoneInfo } from './splitTab.component'
|
import { SplitDropZoneInfo } from './splitTab.component'
|
||||||
|
import { SplitTabComponent } from './splitTab.component'
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
@Component({
|
@Component({
|
||||||
@ -22,7 +23,7 @@ import { SplitDropZoneInfo } from './splitTab.component'
|
|||||||
})
|
})
|
||||||
export class SplitTabDropZoneComponent extends SelfPositioningComponent {
|
export class SplitTabDropZoneComponent extends SelfPositioningComponent {
|
||||||
@Input() dropZone: SplitDropZoneInfo
|
@Input() dropZone: SplitDropZoneInfo
|
||||||
@Input() parent: BaseTabComponent
|
@Input() parent: SplitTabComponent
|
||||||
@Output() tabDropped = new EventEmitter<BaseTabComponent>()
|
@Output() tabDropped = new EventEmitter<BaseTabComponent>()
|
||||||
@HostBinding('class.active') isActive = false
|
@HostBinding('class.active') isActive = false
|
||||||
@HostBinding('class.highlighted') isHighlighted = false
|
@HostBinding('class.highlighted') isHighlighted = false
|
||||||
@ -34,11 +35,21 @@ export class SplitTabDropZoneComponent extends SelfPositioningComponent {
|
|||||||
) {
|
) {
|
||||||
super(element)
|
super(element)
|
||||||
this.subscribeUntilDestroyed(app.tabDragActive$, tab => {
|
this.subscribeUntilDestroyed(app.tabDragActive$, tab => {
|
||||||
this.isActive = !!tab && tab !== this.parent && (this.dropZone.type === 'relative' || tab !== this.dropZone.container.children[this.dropZone.position])
|
this.isActive = !!tab && this.canActivateFor(tab)
|
||||||
this.layout()
|
this.layout()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canActivateFor (tab: BaseTabComponent): boolean {
|
||||||
|
const allTabs = this.parent.getAllTabs()
|
||||||
|
return !(
|
||||||
|
tab === this.parent ||
|
||||||
|
allTabs.length === 1 && allTabs.includes(tab) ||
|
||||||
|
this.dropZone.type === 'relative' && tab === this.dropZone.relativeTo ||
|
||||||
|
this.dropZone.type === 'absolute' && tab === this.dropZone.container.children[this.dropZone.position]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
ngOnChanges () {
|
ngOnChanges () {
|
||||||
this.layout()
|
this.layout()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user