Skip to content

Commit 14c6cab

Browse files
committed
tslint
1 parent cb59281 commit 14c6cab

18 files changed

+240
-104
lines changed

src/cdk-experimental/column-resize/column-resize-module.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
19
import {NgModule} from '@angular/core';
210

311
import {

src/cdk-experimental/column-resize/column-resize-notifier.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
19
import {Injectable} from '@angular/core';
210
import {Observable, Subject} from 'rxjs';
311

@@ -11,7 +19,7 @@ export interface ColumnSizeAction extends ColumnSize {
1119
}
1220

1321
@Injectable()
14-
export class _ColumnResizeNotifierSource {
22+
export class ColumnResizeNotifierSource {
1523
readonly resizeCanceled = new Subject<ColumnSizeAction>();
1624
readonly resizeCompleted = new Subject<ColumnSize>();
1725
readonly triggerResize = new Subject<ColumnSizeAction>();
@@ -20,8 +28,8 @@ export class _ColumnResizeNotifierSource {
2028
@Injectable()
2129
export class ColumnResizeNotifier {
2230
readonly resizeCompleted: Observable<ColumnSize> = this._source.resizeCompleted.asObservable();
23-
24-
constructor(private readonly _source: _ColumnResizeNotifierSource) {}
31+
32+
constructor(private readonly _source: ColumnResizeNotifierSource) {}
2533

2634
resize(columnId: string, size: number): void {
2735
this._source.triggerResize.next({columnId, size, completeImmediately: true});

src/cdk-experimental/column-resize/column-resize.ts

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
19
import {AfterViewInit, Directive, ElementRef, NgZone, OnDestroy} from '@angular/core';
210
import {Directionality} from '@angular/cdk/bidi';
311
import {fromEvent, merge, ReplaySubject} from 'rxjs';
412
import {filter, map, mapTo, pairwise, startWith, take, takeUntil} from 'rxjs/operators';
513

6-
import {matches} from '../popover-edit/polyfill';
14+
import {closest, matches} from '../popover-edit/polyfill';
715

8-
import {ColumnResizeNotifier, _ColumnResizeNotifierSource} from './column-resize-notifier';
16+
import {ColumnResizeNotifier, ColumnResizeNotifierSource} from './column-resize-notifier';
917
import {HEADER_CELL_SELECTOR, RESIZE_OVERLAY_SELECTOR} from './constants';
10-
import {_HeaderRowEventDispatcher} from './event-dispatcher';
18+
import {HeaderRowEventDispatcher} from './event-dispatcher';
1119
import {
1220
TABLE_LAYOUT_FIXED_RESIZE_STRATEGY_PROVIDER,
1321
FLEX_RESIZE_STRATEGY_PROVIDER,
1422
} from './resize-strategy';
1523

16-
import {closest} from '../popover-edit/polyfill';
17-
18-
const PROVIDERS = [ColumnResizeNotifier, _HeaderRowEventDispatcher, _ColumnResizeNotifierSource];
24+
const PROVIDERS = [ColumnResizeNotifier, HeaderRowEventDispatcher, ColumnResizeNotifierSource];
1925
const TABLE_PROVIDERS = [...PROVIDERS, TABLE_LAYOUT_FIXED_RESIZE_STRATEGY_PROVIDER];
2026
const FLEX_PROVIDERS = [...PROVIDERS, FLEX_RESIZE_STRATEGY_PROVIDER];
2127
const HOST_BINDINGS = {
@@ -27,13 +33,13 @@ let idSequence = 0;
2733

2834
export abstract class ColumnResize implements AfterViewInit, OnDestroy {
2935
protected readonly destroyed = new ReplaySubject<void>();
30-
36+
3137
abstract readonly directionality: Directionality;
3238
protected abstract readonly elementRef: ElementRef;
33-
protected abstract readonly eventDispatcher: _HeaderRowEventDispatcher;
39+
protected abstract readonly eventDispatcher: HeaderRowEventDispatcher;
3440
protected abstract readonly ngZone: NgZone;
35-
protected abstract readonly notifier: _ColumnResizeNotifierSource;
36-
41+
protected abstract readonly notifier: ColumnResizeNotifierSource;
42+
3743
private _specifiedId?: string;
3844
private _generatedId?: string;
3945

@@ -49,37 +55,38 @@ export abstract class ColumnResize implements AfterViewInit, OnDestroy {
4955
set id(value: string) {
5056
this._specifiedId = value;
5157
}
52-
58+
5359
ngAfterViewInit() {
5460
this._listenForRowHoverEvents();
5561
this._listenForResizeActivity();
5662
this._listenForHoverActivity();
5763
}
58-
64+
5965
ngOnDestroy() {
6066
this.destroyed.next();
6167
this.destroyed.complete();
6268
}
63-
69+
6470
getIdClass() {
6571
return `column-resize-${this.id}`;
6672
}
67-
73+
6874
getWithResizedColumnClass() {
6975
return 'with-resized-column';
7076
}
71-
77+
7278
private _listenForRowHoverEvents() {
7379
this.ngZone.runOutsideAngular(() => {
7480
const element = this.elementRef.nativeElement!;
75-
81+
7682
fromEvent<MouseEvent>(element, 'mouseover').pipe(
7783
takeUntil(this.destroyed),
7884
map(event => closest(event.target, HEADER_CELL_SELECTOR)),
7985
).subscribe(this.eventDispatcher.headerCellHovered);
8086
fromEvent<MouseEvent>(element, 'mouseleave').pipe(
8187
takeUntil(this.destroyed),
82-
filter(event => !!event.relatedTarget && !matches(event.relatedTarget as Element, RESIZE_OVERLAY_SELECTOR)),
88+
filter(event => !!event.relatedTarget &&
89+
!matches(event.relatedTarget as Element, RESIZE_OVERLAY_SELECTOR)),
8390
mapTo(null),
8491
).subscribe(this.eventDispatcher.headerCellHovered);
8592
});
@@ -97,7 +104,7 @@ export abstract class ColumnResize implements AfterViewInit, OnDestroy {
97104
this.elementRef.nativeElement!.classList.add(this.getWithResizedColumnClass());
98105
});
99106
}
100-
107+
101108
private _listenForHoverActivity() {
102109
this.eventDispatcher.headerRowHoveredOrActiveDistinct.pipe(
103110
takeUntil(this.destroyed),
@@ -126,9 +133,9 @@ export class CdkDefaultEnabledColumnResize extends ColumnResize {
126133
constructor(
127134
readonly directionality: Directionality,
128135
protected readonly elementRef: ElementRef,
129-
protected readonly eventDispatcher: _HeaderRowEventDispatcher,
136+
protected readonly eventDispatcher: HeaderRowEventDispatcher,
130137
protected readonly ngZone: NgZone,
131-
protected readonly notifier: _ColumnResizeNotifierSource) {
138+
protected readonly notifier: ColumnResizeNotifierSource) {
132139
super();
133140
}
134141
}
@@ -145,9 +152,9 @@ export class CdkDefaultEnabledColumnResizeFlex extends ColumnResize {
145152
constructor(
146153
readonly directionality: Directionality,
147154
protected readonly elementRef: ElementRef,
148-
protected readonly eventDispatcher: _HeaderRowEventDispatcher,
155+
protected readonly eventDispatcher: HeaderRowEventDispatcher,
149156
protected readonly ngZone: NgZone,
150-
protected readonly notifier: _ColumnResizeNotifierSource) {
157+
protected readonly notifier: ColumnResizeNotifierSource) {
151158
super();
152159
}
153160
}
@@ -164,9 +171,9 @@ export class CdkColumnResize extends ColumnResize {
164171
constructor(
165172
readonly directionality: Directionality,
166173
protected readonly elementRef: ElementRef,
167-
protected readonly eventDispatcher: _HeaderRowEventDispatcher,
174+
protected readonly eventDispatcher: HeaderRowEventDispatcher,
168175
protected readonly ngZone: NgZone,
169-
protected readonly notifier: _ColumnResizeNotifierSource) {
176+
protected readonly notifier: ColumnResizeNotifierSource) {
170177
super();
171178
}
172179
}
@@ -183,9 +190,9 @@ export class CdkColumnResizeFlex extends ColumnResize {
183190
constructor(
184191
readonly directionality: Directionality,
185192
protected readonly elementRef: ElementRef,
186-
protected readonly eventDispatcher: _HeaderRowEventDispatcher,
193+
protected readonly eventDispatcher: HeaderRowEventDispatcher,
187194
protected readonly ngZone: NgZone,
188-
protected readonly notifier: _ColumnResizeNotifierSource) {
195+
protected readonly notifier: ColumnResizeNotifierSource) {
189196
super();
190197
}
191198
}

src/cdk-experimental/column-resize/column-size-store.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
19
import {Injectable} from '@angular/core';
210

311
@Injectable()

src/cdk-experimental/column-resize/constants.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
19
export const HEADER_CELL_SELECTOR = '.cdk-header-cell, .mat-header-cell';
210

311
export const HEADER_ROW_SELECTOR = '.cdk-header-row, .mat-header-row';

src/cdk-experimental/column-resize/event-dispatcher.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
19
import {Injectable, NgZone} from '@angular/core';
210
import {combineLatest, MonoTypeOperatorFunction, Observable, Subject} from 'rxjs';
311
import {distinctUntilChanged, map, share, skip, startWith} from 'rxjs/operators';
@@ -7,19 +15,19 @@ import {closest} from '../popover-edit/polyfill';
715
import {HEADER_ROW_SELECTOR} from './constants';
816

917
@Injectable()
10-
export class _HeaderRowEventDispatcher {
18+
export class HeaderRowEventDispatcher {
1119
readonly headerCellHovered = new Subject<Element|null>();
12-
20+
1321
// element refers to header row
1422
readonly overlayHandleActiveForCell = new Subject<Element|null>();
15-
23+
1624
constructor(private readonly _ngZone: NgZone) {}
17-
25+
1826
readonly headerCellHoveredDistinct = this.headerCellHovered.pipe(
1927
distinctUntilChanged(),
2028
share(),
2129
);
22-
30+
2331
readonly headerRowHoveredOrActiveDistinct = combineLatest(
2432
this.headerCellHoveredDistinct.pipe(
2533
map(cell => closest(cell, HEADER_ROW_SELECTOR)),
@@ -37,18 +45,18 @@ export class _HeaderRowEventDispatcher {
3745
distinctUntilChanged(),
3846
share(),
3947
);
40-
48+
4149
private readonly _headerRowHoveredOrActiveDistinctReenterZone =
4250
this.headerRowHoveredOrActiveDistinct.pipe(
4351
this._enterZone(),
4452
share(),
4553
);
46-
54+
4755
// Optimization: Share row events observable with subsequent callers.
4856
// At startup, calls will be sequential by row (and typically there's only one).
4957
private _lastSeenRow: Element|null = null;
5058
private _lastSeenRowHover: Observable<boolean>|null = null;
51-
59+
5260
resizeOverlayVisibleForHeaderRow(row: Element): Observable<boolean> {
5361
if (row !== this._lastSeenRow) {
5462
this._lastSeenRow = row;

src/cdk-experimental/column-resize/overlay-handle.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
19
import {AfterViewInit, ElementRef, OnDestroy, NgZone} from '@angular/core';
210
import {coerceCssPixelValue} from '@angular/cdk/coercion';
311
import {Directionality} from '@angular/cdk/bidi';
@@ -17,8 +25,8 @@ import {
1725
import {closest} from '../popover-edit/polyfill';
1826

1927
import {HEADER_CELL_SELECTOR} from './constants';
20-
import {_ColumnResizeNotifierSource} from './column-resize-notifier';
21-
import {_HeaderRowEventDispatcher} from './event-dispatcher';
28+
import {ColumnResizeNotifierSource} from './column-resize-notifier';
29+
import {HeaderRowEventDispatcher} from './event-dispatcher';
2230
import {ResizeRef} from './resize-ref';
2331

2432
export abstract class ResizeOverlayHandle implements AfterViewInit, OnDestroy {
@@ -28,9 +36,9 @@ export abstract class ResizeOverlayHandle implements AfterViewInit, OnDestroy {
2836
protected abstract readonly document: Document;
2937
protected abstract readonly directionality: Directionality;
3038
protected abstract readonly elementRef: ElementRef;
31-
protected abstract readonly eventDispatcher: _HeaderRowEventDispatcher;
39+
protected abstract readonly eventDispatcher: HeaderRowEventDispatcher;
3240
protected abstract readonly ngZone: NgZone;
33-
protected abstract readonly resizeNotifier: _ColumnResizeNotifierSource;
41+
protected abstract readonly resizeNotifier: ColumnResizeNotifierSource;
3442
protected abstract readonly resizeRef: ResizeRef;
3543

3644
ngAfterViewInit() {
@@ -56,7 +64,8 @@ export abstract class ResizeOverlayHandle implements AfterViewInit, OnDestroy {
5664
).subscribe(cell => this.eventDispatcher.headerCellHovered.next(cell));
5765
mouseleave.pipe(
5866
takeUntilDestroyed,
59-
map(event => event.relatedTarget && closest(event.relatedTarget as Element, HEADER_CELL_SELECTOR)),
67+
map(event => event.relatedTarget &&
68+
closest(event.relatedTarget as Element, HEADER_CELL_SELECTOR)),
6069
).subscribe(cell => this.eventDispatcher.headerCellHovered.next(cell));
6170

6271
mousedown.pipe(takeUntilDestroyed).subscribe(mousedownEvent => {
@@ -112,7 +121,8 @@ export abstract class ResizeOverlayHandle implements AfterViewInit, OnDestroy {
112121
return;
113122
} else {
114123
const remainingOvershot = overshot + deltaX;
115-
overshot = overshot > 0 ? Math.max(remainingOvershot, 0) : Math.min(remainingOvershot, 0);
124+
overshot = overshot > 0 ?
125+
Math.max(remainingOvershot, 0) : Math.min(remainingOvershot, 0);
116126
deltaX = remainingOvershot - overshot;
117127

118128
if (deltaX === 0) {
@@ -122,7 +132,8 @@ export abstract class ResizeOverlayHandle implements AfterViewInit, OnDestroy {
122132
}
123133

124134
let computedNewSize: number = size + (this._isLtr() ? deltaX : -deltaX);
125-
computedNewSize = Math.min(Math.max(computedNewSize, this.resizeRef.minPx, 0), this.resizeRef.maxPx);
135+
computedNewSize = Math.min(
136+
Math.max(computedNewSize, this.resizeRef.minPx, 0), this.resizeRef.maxPx);
126137

127138
this.resizeNotifier.triggerResize.next({columnId, size: computedNewSize});
128139

@@ -151,7 +162,7 @@ export abstract class ResizeOverlayHandle implements AfterViewInit, OnDestroy {
151162
private _getOverlayOffset(): number {
152163
const overlayElement = this.resizeRef.overlayRef.overlayElement;
153164
return this._isLtr() ?
154-
parseInt(overlayElement.style.left!, 10) : parseInt(overlayElement.style.right!, 10)
165+
parseInt(overlayElement.style.left!, 10) : parseInt(overlayElement.style.right!, 10);
155166
}
156167

157168
private _updateOverlayOffset(offset: number): void {
@@ -168,4 +179,4 @@ export abstract class ResizeOverlayHandle implements AfterViewInit, OnDestroy {
168179
private _isLtr(): boolean {
169180
return this.directionality.value === 'ltr';
170181
}
171-
}
182+
}

0 commit comments

Comments
 (0)