Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 1x 1x 1x 1x 1x 15x 15x 15x 15x 15x 15x 7x 1x 6x 6x 6x 6x 6x 6x | import { WorkspaceTabComponent } from './workspace-tab.component';
import { IconComponent } from '../icon/icon.component';
import { NgTemplateOutlet } from '@angular/common';
import { ChangeDetectionStrategy, Component, contentChildren, output, signal } from '@angular/core';
@Component({
selector: 'ui-workspace',
imports: [IconComponent, NgTemplateOutlet],
templateUrl: './workspace.component.html',
styleUrl: './workspace.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class WorkspaceComponent {
readonly tabs = contentChildren(WorkspaceTabComponent);
readonly activeTabChange = output<number>();
private readonly _activeIndex = signal(0);
readonly activeIndex = this._activeIndex.asReadonly();
private readonly _activatedIndices = signal(new Set<number>([0]));
readonly activatedIndices = this._activatedIndices.asReadonly();
selectTab(index: number): void {
if (index === this._activeIndex()) {
return;
}
this._activeIndex.set(index);
this._activatedIndices.update(set => {
const next = new Set(set);
next.add(index);
return next;
});
this.activeTabChange.emit(index);
}
}
|