fix indentations & commas

This commit is contained in:
Dan Percic 2022-07-23 11:33:58 +02:00
parent 97867a6f38
commit 3a2dd1f160
3 changed files with 18 additions and 20 deletions

View File

@ -19,11 +19,11 @@ import { ListingService } from '../../services';
import { WorkflowColumn } from '../models/workflow-column.model'; import { WorkflowColumn } from '../models/workflow-column.model';
interface ColumnHeaderContext { interface ColumnHeaderContext {
entities: IListable[], entities: IListable[];
allSelected: boolean, allSelected: boolean;
indeterminate: boolean, indeterminate: boolean;
selectedLength: number, selectedLength: number;
disableSelection: () => void, disableSelection: () => void;
} }
@Component({ @Component({
@ -59,11 +59,10 @@ export class ColumnHeaderComponent<T extends IListable, K extends string> extend
const indeterminate$ = combineLatest([this.listingService.selectedLength$, this.column.entities]).pipe( const indeterminate$ = combineLatest([this.listingService.selectedLength$, this.column.entities]).pipe(
map(([length, columnEntities]) => length > 0 && length !== columnEntities.length), map(([length, columnEntities]) => length > 0 && length !== columnEntities.length),
); );
const disableSelection$ = this.column.entities const disableSelection$ = this.column.entities.pipe(
.pipe( filter(entities => entities.length <= 1),
filter(entities => entities.length <= 1), tap(() => this.disableSelection()),
tap(() => this.disableSelection()), );
);
super._initContext({ super._initContext({
entities: this.column.entities, entities: this.column.entities,
@ -71,7 +70,7 @@ export class ColumnHeaderComponent<T extends IListable, K extends string> extend
indeterminate: indeterminate$, indeterminate: indeterminate$,
selectedLength: this.listingService.selectedLength$, selectedLength: this.listingService.selectedLength$,
disableSelection: disableSelection$, disableSelection: disableSelection$,
}) });
} }
toggleSelectAll(): void { toggleSelectAll(): void {

View File

@ -86,18 +86,17 @@ export class WorkflowComponent<T extends IListable, K extends string> extends Co
for (const column of this.config.columns) { for (const column of this.config.columns) {
column.entities = new BehaviorSubject<T[]>([]); column.entities = new BehaviorSubject<T[]>([]);
} }
const updateConfigItems$ = this.listingService.displayed$.pipe(tap(entities => this._updateConfigItems(entities))) const updateConfigItems$ = this.listingService.displayed$.pipe(tap(entities => this._updateConfigItems(entities)));
const setupResizeObserver$ = this.entitiesService.noData$ const setupResizeObserver$ = this.entitiesService.noData$.pipe(
.pipe( filter(noData => noData),
filter(noData => noData), tap(() => this._setupResizeObserver()),
tap(() => this._setupResizeObserver()), );
);
this._setupResizeObserver(); this._setupResizeObserver();
super._initContext({ super._initContext({
updateConfigItems: updateConfigItems$, updateConfigItems: updateConfigItems$,
setupResizeObserver: setupResizeObserver$ setupResizeObserver: setupResizeObserver$,
}) });
} }
canMoveTo(column: WorkflowColumn<T, K>): () => boolean { canMoveTo(column: WorkflowColumn<T, K>): () => boolean {

View File

@ -11,7 +11,7 @@ export class ContextComponent<T> {
this.componentContext$ = combineLatest(observables).pipe(map(values => this._mapKeysToObs(keys, values))); this.componentContext$ = combineLatest(observables).pipe(map(values => this._mapKeysToObs(keys, values)));
} }
protected _mapKeysToObs(keys: string[], observables: (ValuesOf<T> | null) []): T { protected _mapKeysToObs(keys: string[], observables: (ValuesOf<T> | null)[]): T {
return keys.reduce((acc, key, index) => ({ ...acc, [key]: observables[index] }), {} as T); return keys.reduce((acc, key, index) => ({ ...acc, [key]: observables[index] }), {} as T);
} }
} }