Skip to content

Commit 170bece

Browse files
Angular Material Teammmalerba
authored andcommitted
Project import generated by Copybara.
PiperOrigin-RevId: 310167103
1 parent 14a51ef commit 170bece

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+325
-375
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import {
1010
AfterViewInit,
11-
Directive,
1211
ElementRef,
1312
Injector,
1413
NgZone,
@@ -39,7 +38,6 @@ const OVERLAY_ACTIVE_CLASS = 'cdk-resizable-overlay-thumb-active';
3938
* Base class for Resizable directives which are applied to column headers to make those columns
4039
* resizable.
4140
*/
42-
@Directive()
4341
export abstract class Resizable<HandleComponent extends ResizeOverlayHandle>
4442
implements AfterViewInit, OnDestroy {
4543
protected minWidthPxInternal: number = 0;

src/cdk/drag-drop/drag-ref.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export class DragRef<T = any> {
164164
* Inline style value of `-webkit-tap-highlight-color` at the time the
165165
* dragging was started. Used to restore the value once we're done dragging.
166166
*/
167-
private _rootElementTapHighlight: string;
167+
private _rootElementTapHighlight: string | null;
168168

169169
/** Subscription to pointer movement events. */
170170
private _pointerMoveSubscription = Subscription.EMPTY;
@@ -772,7 +772,7 @@ export class DragRef<T = any> {
772772
// otherwise iOS will still add it, even though all the drag interactions on the handle
773773
// are disabled.
774774
if (this._handles.length) {
775-
this._rootElementTapHighlight = rootElement.style.webkitTapHighlightColor || '';
775+
this._rootElementTapHighlight = rootElement.style.webkitTapHighlightColor;
776776
rootElement.style.webkitTapHighlightColor = 'transparent';
777777
}
778778

src/cdk/drag-drop/drag-styling.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@ type Writeable<T> = { -readonly [P in keyof T]-?: T[P] };
1616
* Extended CSSStyleDeclaration that includes a couple of drag-related
1717
* properties that aren't in the built-in TS typings.
1818
*/
19-
export interface DragCSSStyleDeclaration extends CSSStyleDeclaration {
19+
interface DragCSSStyleDeclaration extends CSSStyleDeclaration {
2020
webkitUserDrag: string;
2121
MozUserSelect: string; // For some reason the Firefox property is in PascalCase.
22-
msScrollSnapType: string;
23-
scrollSnapType: string;
24-
msUserSelect: string;
2522
}
2623

2724
/**

src/cdk/drag-drop/drop-list-ref.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
isInsideClientRect,
2424
} from './client-rect';
2525
import {ParentPositionTracker} from './parent-position-tracker';
26-
import {DragCSSStyleDeclaration} from './drag-styling';
2726

2827
/**
2928
* Proximity, as a ratio to width/height, at which a
@@ -236,15 +235,15 @@ export class DropListRef<T = any> {
236235

237236
/** Starts dragging an item. */
238237
start(): void {
239-
const styles = coerceElement(this.element).style as DragCSSStyleDeclaration;
238+
const styles = coerceElement(this.element).style;
240239
this.beforeStarted.next();
241240
this._isDragging = true;
242241

243242
// We need to disable scroll snapping while the user is dragging, because it breaks automatic
244243
// scrolling. The browser seems to round the value based on the snapping points which means
245244
// that we can't increment/decrement the scroll position.
246-
this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
247-
styles.scrollSnapType = styles.msScrollSnapType = 'none';
245+
this._initialScrollSnap = styles.msScrollSnapType || (styles as any).scrollSnapType || '';
246+
(styles as any).scrollSnapType = styles.msScrollSnapType = 'none';
248247
this._cacheItems();
249248
this._siblings.forEach(sibling => sibling._startReceiving(this));
250249
this._viewportScrollSubscription.unsubscribe();
@@ -630,8 +629,8 @@ export class DropListRef<T = any> {
630629
private _reset() {
631630
this._isDragging = false;
632631

633-
const styles = coerceElement(this.element).style as DragCSSStyleDeclaration;
634-
styles.scrollSnapType = styles.msScrollSnapType = this._initialScrollSnap;
632+
const styles = coerceElement(this.element).style;
633+
(styles as any).scrollSnapType = styles.msScrollSnapType = this._initialScrollSnap;
635634

636635
// TODO(crisbeto): may have to wait for the animations to finish.
637636
this._activeDraggables.forEach(item => {

src/cdk/overlay/keyboard/overlay-keyboard-dispatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class OverlayKeyboardDispatcher implements OnDestroy {
8787
// (e.g. for select and autocomplete). We skip overlays without keydown event subscriptions,
8888
// because we don't want overlays that don't handle keyboard events to block the ones below
8989
// them that do.
90-
if (overlays[i]._keydownEvents.observers.length > 0) {
90+
if (overlays[i]._keydownEventSubscriptions > 0) {
9191
overlays[i]._keydownEvents.next(event);
9292
break;
9393
}

src/cdk/overlay/overlay-ref.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {Direction, Directionality} from '@angular/cdk/bidi';
1010
import {ComponentPortal, Portal, PortalOutlet, TemplatePortal} from '@angular/cdk/portal';
1111
import {ComponentRef, EmbeddedViewRef, NgZone} from '@angular/core';
1212
import {Location} from '@angular/common';
13-
import {Observable, Subject, merge, SubscriptionLike, Subscription} from 'rxjs';
13+
import {Observable, Subject, merge, SubscriptionLike, Subscription, Observer} from 'rxjs';
1414
import {take, takeUntil} from 'rxjs/operators';
1515
import {OverlayKeyboardDispatcher} from './keyboard/overlay-keyboard-dispatcher';
1616
import {OverlayConfig} from './overlay-config';
@@ -45,9 +45,23 @@ export class OverlayRef implements PortalOutlet, OverlayReference {
4545
*/
4646
private _previousHostParent: HTMLElement;
4747

48+
private _keydownEventsObservable: Observable<KeyboardEvent> =
49+
new Observable((observer: Observer<KeyboardEvent>) => {
50+
const subscription = this._keydownEvents.subscribe(observer);
51+
this._keydownEventSubscriptions++;
52+
53+
return () => {
54+
subscription.unsubscribe();
55+
this._keydownEventSubscriptions--;
56+
};
57+
});
58+
4859
/** Stream of keydown events dispatched to this overlay. */
4960
_keydownEvents = new Subject<KeyboardEvent>();
5061

62+
/** Amount of subscriptions to the keydown events. */
63+
_keydownEventSubscriptions = 0;
64+
5165
constructor(
5266
private _portalOutlet: PortalOutlet,
5367
private _host: HTMLElement,
@@ -251,7 +265,7 @@ export class OverlayRef implements PortalOutlet, OverlayReference {
251265

252266
/** Gets an observable of keydown events targeted to this overlay. */
253267
keydownEvents(): Observable<KeyboardEvent> {
254-
return this._keydownEvents.asObservable();
268+
return this._keydownEventsObservable;
255269
}
256270

257271
/** Gets the current overlay configuration, which is immutable. */

src/cdk/table/row.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export const CDK_ROW_TEMPLATE = `<ng-container cdkCellOutlet></ng-container>`;
3737
* Base class for the CdkHeaderRowDef and CdkRowDef that handles checking their columns inputs
3838
* for changes and notifying the table.
3939
*/
40-
@Directive()
4140
export abstract class BaseRowDef implements OnChanges {
4241
/** The columns to be displayed on this row. */
4342
columns: Iterable<string>;

src/google-maps/google-map/google-map.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
290290
bounds: google.maps.LatLngBounds|google.maps.LatLngBoundsLiteral,
291291
padding?: number|google.maps.Padding) {
292292
this._assertInitialized();
293-
this.googleMap.fitBounds(bounds, padding);
293+
this.googleMap!.fitBounds(bounds, padding);
294294
}
295295

296296
/**
@@ -299,7 +299,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
299299
*/
300300
panBy(x: number, y: number) {
301301
this._assertInitialized();
302-
this.googleMap.panBy(x, y);
302+
this.googleMap!.panBy(x, y);
303303
}
304304

305305
/**
@@ -308,7 +308,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
308308
*/
309309
panTo(latLng: google.maps.LatLng|google.maps.LatLngLiteral) {
310310
this._assertInitialized();
311-
this.googleMap.panTo(latLng);
311+
this.googleMap!.panTo(latLng);
312312
}
313313

314314
/**
@@ -319,7 +319,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
319319
latLngBounds: google.maps.LatLngBounds|google.maps.LatLngBoundsLiteral,
320320
padding?: number|google.maps.Padding) {
321321
this._assertInitialized();
322-
this.googleMap.panToBounds(latLngBounds, padding);
322+
this.googleMap!.panToBounds(latLngBounds, padding);
323323
}
324324

325325
/**
@@ -328,7 +328,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
328328
*/
329329
getBounds(): google.maps.LatLngBounds|null {
330330
this._assertInitialized();
331-
return this.googleMap.getBounds() || null;
331+
return this.googleMap!.getBounds() || null;
332332
}
333333

334334
/**
@@ -337,7 +337,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
337337
*/
338338
getCenter(): google.maps.LatLng {
339339
this._assertInitialized();
340-
return this.googleMap.getCenter();
340+
return this.googleMap!.getCenter();
341341
}
342342

343343
/**
@@ -346,7 +346,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
346346
*/
347347
getClickableIcons(): boolean {
348348
this._assertInitialized();
349-
return this.googleMap.getClickableIcons();
349+
return this.googleMap!.getClickableIcons();
350350
}
351351

352352
/**
@@ -355,7 +355,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
355355
*/
356356
getHeading(): number {
357357
this._assertInitialized();
358-
return this.googleMap.getHeading();
358+
return this.googleMap!.getHeading();
359359
}
360360

361361
/**
@@ -364,7 +364,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
364364
*/
365365
getMapTypeId(): google.maps.MapTypeId|string {
366366
this._assertInitialized();
367-
return this.googleMap.getMapTypeId();
367+
return this.googleMap!.getMapTypeId();
368368
}
369369

370370
/**
@@ -373,7 +373,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
373373
*/
374374
getProjection(): google.maps.Projection|null {
375375
this._assertInitialized();
376-
return this.googleMap.getProjection();
376+
return this.googleMap!.getProjection();
377377
}
378378

379379
/**
@@ -382,7 +382,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
382382
*/
383383
getStreetView(): google.maps.StreetViewPanorama {
384384
this._assertInitialized();
385-
return this.googleMap.getStreetView();
385+
return this.googleMap!.getStreetView();
386386
}
387387

388388
/**
@@ -391,7 +391,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
391391
*/
392392
getTilt(): number {
393393
this._assertInitialized();
394-
return this.googleMap.getTilt();
394+
return this.googleMap!.getTilt();
395395
}
396396

397397
/**
@@ -400,7 +400,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
400400
*/
401401
getZoom(): number {
402402
this._assertInitialized();
403-
return this.googleMap.getZoom();
403+
return this.googleMap!.getZoom();
404404
}
405405

406406
/**
@@ -409,7 +409,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
409409
*/
410410
get controls(): Array<google.maps.MVCArray<Node>> {
411411
this._assertInitialized();
412-
return this.googleMap.controls;
412+
return this.googleMap!.controls;
413413
}
414414

415415
/**
@@ -418,7 +418,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
418418
*/
419419
get data(): google.maps.Data {
420420
this._assertInitialized();
421-
return this.googleMap.data;
421+
return this.googleMap!.data;
422422
}
423423

424424
/**
@@ -427,7 +427,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
427427
*/
428428
get mapTypes(): google.maps.MapTypeRegistry {
429429
this._assertInitialized();
430-
return this.googleMap.mapTypes;
430+
return this.googleMap!.mapTypes;
431431
}
432432

433433
/**
@@ -436,7 +436,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
436436
*/
437437
get overlayMapTypes(): google.maps.MVCArray<google.maps.MapType> {
438438
this._assertInitialized();
439-
return this.googleMap.overlayMapTypes;
439+
return this.googleMap!.overlayMapTypes;
440440
}
441441

442442
private _setSize() {
@@ -503,7 +503,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
503503
}
504504

505505
/** Asserts that the map has been initialized. */
506-
private _assertInitialized(): asserts this is {googleMap: google.maps.Map} {
506+
private _assertInitialized() {
507507
if (!this.googleMap) {
508508
throw Error('Cannot access Google Map information before the API has been initialized. ' +
509509
'Please wait for the API to load before trying to interact with it.');

0 commit comments

Comments
 (0)