-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: provide a context menu on view tabs
closes: #174
- Loading branch information
1 parent
2ee9df3
commit 1bdb195
Showing
33 changed files
with
1,044 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { map } from 'rxjs/operators'; | ||
import { MonoTypeOperatorFunction, OperatorFunction } from 'rxjs'; | ||
|
||
/** | ||
* Filters items in the source array and emits an array with items satisfying the given predicate. | ||
*/ | ||
export function filterArray<T>(predicate?: (item: T) => boolean): MonoTypeOperatorFunction<T[]> { | ||
return map((items: T[]): T[] => items.filter(item => !predicate || predicate(item))); | ||
} | ||
|
||
/** | ||
* Maps each element in the source array to its mapped value. | ||
*/ | ||
export function mapArray<I, P>(fn: (item: I) => P): OperatorFunction<I[], P[]> { | ||
return map((items: I[]): P[] => items.map(item => fn(item))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
projects/scion/workbench/src/lib/view-part-grid/view-part-grid-provider.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { ViewPartGrid } from './view-part-grid.model'; | ||
import { BehaviorSubject, Observable } from 'rxjs'; | ||
import { filter } from 'rxjs/operators'; | ||
|
||
/** | ||
* Provides access to the viewpart grid which represents the visual arrangement of the viewparts. | ||
*/ | ||
@Injectable() | ||
export class ViewPartGridProvider { | ||
|
||
private readonly _grid$ = new BehaviorSubject<ViewPartGrid>(null); | ||
|
||
/** | ||
* Sets the given viewpart grid. | ||
*/ | ||
public setGrid(grid: ViewPartGrid): void { | ||
this._grid$.next(grid); | ||
} | ||
|
||
/** | ||
* Returns a reference to the viewpart grid, if any. Is `null` until the initial navigation is performed. | ||
*/ | ||
public get grid(): ViewPartGrid { | ||
return this._grid$.value; | ||
} | ||
|
||
/** | ||
* Emits the viewpart grid. | ||
* | ||
* Upon subscription, the current grid is emitted, if any, and then emits continuously when the grid changes. It never completes. | ||
*/ | ||
public get grid$(): Observable<ViewPartGrid> { | ||
return this._grid$.pipe(filter(Boolean)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.