Skip to content

Commit

Permalink
Update the latest Angular version (angular#26862)
Browse files Browse the repository at this point in the history
* build: resolve build errors after APF changes

Fixes some build errors that came up after the recent APF updates.

* fix(multiple): useDefineForClassFields-related fixes

`useDefineForClassFields` is enabled by default when targeting es2022. Even though we're likely to disable it, we may have to support it in the future. These changes update our components to be compatible.

* build: update API goldens

The .d.ts produced by the compiler has changed in the latest version so we have to update all the goldens.
  • Loading branch information
crisbeto authored Mar 30, 2023
1 parent 3aaabbd commit a2ebcbc
Show file tree
Hide file tree
Showing 99 changed files with 865 additions and 654 deletions.
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@
},
"version": "16.0.0-next.4",
"dependencies": {
"@angular/animations": "^16.0.0-next.2",
"@angular/common": "^16.0.0-next.2",
"@angular/compiler": "^16.0.0-next.2",
"@angular/core": "^16.0.0-next.2",
"@angular/forms": "^16.0.0-next.2",
"@angular/platform-browser": "^16.0.0-next.2",
"@angular/animations": "^16.0.0-next.5",
"@angular/common": "^16.0.0-next.5",
"@angular/compiler": "^16.0.0-next.5",
"@angular/core": "^16.0.0-next.5",
"@angular/forms": "^16.0.0-next.5",
"@angular/platform-browser": "^16.0.0-next.5",
"@types/google.maps": "^3.52.4",
"@types/youtube": "^0.0.46",
"rxjs": "^6.6.7",
Expand All @@ -70,18 +70,18 @@
"zone.js": "~0.11.5"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.0.0-next.3",
"@angular-devkit/core": "^16.0.0-next.3",
"@angular-devkit/schematics": "^16.0.0-next.3",
"@angular-devkit/build-angular": "^16.0.0-next.5",
"@angular-devkit/core": "^16.0.0-next.5",
"@angular-devkit/schematics": "^16.0.0-next.5",
"@angular/bazel": "15.0.4",
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#16f13b9e919478d61ec98ce60901f3bdebb5d4e5",
"@angular/cli": "^16.0.0-next.3",
"@angular/compiler-cli": "^16.0.0-next.2",
"@angular/localize": "^16.0.0-next.2",
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#4c7d40592a36f061c23dd08f437f734081f9979d",
"@angular/cli": "^16.0.0-next.5",
"@angular/compiler-cli": "^16.0.0-next.5",
"@angular/localize": "^16.0.0-next.5",
"@angular/ng-dev": "https://github.com/angular/dev-infra-private-ng-dev-builds.git#46a6cb28a6ca6a3a7a096656280ed27b02243e9a",
"@angular/platform-browser-dynamic": "^16.0.0-next.2",
"@angular/platform-server": "^16.0.0-next.2",
"@angular/router": "^16.0.0-next.2",
"@angular/platform-browser-dynamic": "^16.0.0-next.5",
"@angular/platform-server": "^16.0.0-next.5",
"@angular/router": "^16.0.0-next.5",
"@axe-core/webdriverjs": "^4.3.2",
"@babel/core": "^7.16.12",
"@bazel/bazelisk": "1.12.1",
Expand Down Expand Up @@ -146,7 +146,7 @@
"@octokit/rest": "18.3.5",
"@rollup/plugin-commonjs": "^21.0.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"@schematics/angular": "^16.0.0-next.3",
"@schematics/angular": "^16.0.0-next.5",
"@types/babel__core": "^7.1.18",
"@types/browser-sync": "^2.26.3",
"@types/fs-extra": "^9.0.13",
Expand Down
3 changes: 2 additions & 1 deletion scripts/create-legacy-tests-bundle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function main() {
const specEntryPointFile = await createEntryPointSpecFile();
const esbuildLinkerPlugin = await createEsbuildAngularOptimizePlugin({
enableLinker: {
filterPaths: /fesm2020/,
filterPaths: /fesm2022/,
linkerOptions: {
linkerJitMode: true,
},
Expand All @@ -63,6 +63,7 @@ async function main() {
sourceRoot: projectDir,
platform: 'browser',
format: 'iife',
target: 'es2015',
outfile: outFile,
plugins: [esbuildResolvePlugin, esbuildLinkerPlugin],
stdin: {contents: specEntryPointFile, resolveDir: projectDir},
Expand Down
7 changes: 2 additions & 5 deletions src/cdk-experimental/popover-edit/table-directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ export class CdkPopoverEdit<C> implements AfterViewInit, OnDestroy {
inputs: POPOVER_EDIT_INPUTS,
})
export class CdkPopoverEditTabOut<C> extends CdkPopoverEdit<C> {
protected override focusTrap?: FocusEscapeNotifier;
protected override focusTrap?: FocusEscapeNotifier = undefined;

constructor(
elementRef: ElementRef,
Expand All @@ -382,10 +382,7 @@ export class CdkPopoverEditTabOut<C> extends CdkPopoverEdit<C> {
.escapes()
.pipe(takeUntil(this.destroyed))
.subscribe(direction => {
if (this.services.editEventDispatcher.editRef) {
this.services.editEventDispatcher.editRef.blur();
}

this.services.editEventDispatcher.editRef?.blur();
this.services.focusDispatcher.moveFocusHorizontally(
closest(this.elementRef.nativeElement!, CELL_SELECTOR) as HTMLElement,
direction === FocusEscapeNotifierDirection.START ? -1 : 1,
Expand Down
18 changes: 11 additions & 7 deletions src/cdk-experimental/selection/select-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,14 @@ export class CdkSelectAll<T> implements OnDestroy, OnInit {
* The checked state of the toggle.
* Resolves to `true` if all the values are selected, `false` if no value is selected.
*/
readonly checked: Observable<boolean> = this._selection.change.pipe(
switchMap(() => observableOf(this._selection.isAllSelected())),
);
readonly checked: Observable<boolean>;

/**
* The indeterminate state of the toggle.
* Resolves to `true` if part (not all) of the values are selected, `false` if all values or no
* value at all are selected.
*/
readonly indeterminate: Observable<boolean> = this._selection.change.pipe(
switchMap(() => observableOf(this._selection.isPartialSelected())),
);
readonly indeterminate: Observable<boolean>;

/**
* Toggles the select-all state.
Expand Down Expand Up @@ -72,7 +68,15 @@ export class CdkSelectAll<T> implements OnDestroy, OnInit {
@Self()
@Inject(NG_VALUE_ACCESSOR)
private readonly _controlValueAccessor: ControlValueAccessor[],
) {}
) {
this.checked = _selection.change.pipe(
switchMap(() => observableOf(_selection.isAllSelected())),
);

this.indeterminate = _selection.change.pipe(
switchMap(() => observableOf(_selection.isPartialSelected())),
);
}

ngOnInit() {
this._assertValidParentSelection();
Expand Down
12 changes: 7 additions & 5 deletions src/cdk-experimental/selection/selection-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ export class CdkSelectionToggle<T> implements OnDestroy, OnInit {
protected _index?: number;

/** The checked state of the selection toggle */
readonly checked: Observable<boolean> = this._selection.change.pipe(
switchMap(() => observableOf(this._isSelected())),
distinctUntilChanged(),
);
readonly checked: Observable<boolean>;

/** Toggles the selection */
toggle() {
Expand All @@ -61,7 +58,12 @@ export class CdkSelectionToggle<T> implements OnDestroy, OnInit {
@Self()
@Inject(NG_VALUE_ACCESSOR)
private _controlValueAccessors: ControlValueAccessor[],
) {}
) {
this.checked = _selection.change.pipe(
switchMap(() => observableOf(this._isSelected())),
distinctUntilChanged(),
);
}

ngOnInit() {
this._assertValidParentSelection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ export class MyTelInput implements ControlValueAccessor, MatFormFieldControl<MyT
@ViewChild('exchange') exchangeInput: HTMLInputElement;
@ViewChild('subscriber') subscriberInput: HTMLInputElement;

parts = this._formBuilder.group({
area: ['', [Validators.required, Validators.minLength(3), Validators.maxLength(3)]],
exchange: ['', [Validators.required, Validators.minLength(3), Validators.maxLength(3)]],
subscriber: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(4)]],
});
parts: FormGroup<{
area: FormControl<string | null>;
exchange: FormControl<string | null>;
subscriber: FormControl<string | null>;
}>;
stateChanges = new Subject<void>();
focused = false;
touched = false;
Expand Down Expand Up @@ -134,7 +134,7 @@ export class MyTelInput implements ControlValueAccessor, MatFormFieldControl<MyT
}

constructor(
private _formBuilder: FormBuilder,
formBuilder: FormBuilder,
private _focusMonitor: FocusMonitor,
private _elementRef: ElementRef<HTMLElement>,
@Optional() @Inject(MAT_FORM_FIELD) public _formField: MatFormField,
Expand All @@ -143,6 +143,12 @@ export class MyTelInput implements ControlValueAccessor, MatFormFieldControl<MyT
if (this.ngControl != null) {
this.ngControl.valueAccessor = this;
}

this.parts = formBuilder.group({
area: ['', [Validators.required, Validators.minLength(3), Validators.maxLength(3)]],
exchange: ['', [Validators.required, Validators.minLength(3), Validators.maxLength(3)]],
subscriber: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(4)]],
});
}

ngOnDestroy() {
Expand Down
4 changes: 2 additions & 2 deletions src/dev-app/menubar/mat-menubar-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import {MatMenuBarModule} from '@angular/material-experimental/menubar';
exportAs: 'demoMenu',
template: '<ng-content></ng-content>',
host: {
'[tabindex]': 'isInline() ? 0 : null',
'[tabindex]': 'isInline ? 0 : null',
'role': 'menu',
'class': 'cdk-menu mat-menu mat-menu-panel',
'[class.cdk-menu-inline]': 'isInline()',
'[class.cdk-menu-inline]': 'isInline',
'[attr.aria-orientation]': 'orientation',
},
providers: [
Expand Down
5 changes: 2 additions & 3 deletions src/dev-app/stepper/stepper-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {Component} from '@angular/core';
import {Component, inject} from '@angular/core';
import {
AbstractControl,
FormBuilder,
Expand Down Expand Up @@ -40,6 +40,7 @@ import {MatStepperModule} from '@angular/material/stepper';
],
})
export class StepperDemo {
private _formBuilder = inject(FormBuilder);
isNonLinear = false;
isNonEditable = false;
disableRipple = false;
Expand Down Expand Up @@ -86,6 +87,4 @@ export class StepperDemo {
get formArray(): AbstractControl | null {
return this.formGroup.get('formArray');
}

constructor(private _formBuilder: FormBuilder) {}
}
3 changes: 2 additions & 1 deletion src/google-maps/google-map/google-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
NgZone,
SimpleChanges,
EventEmitter,
inject,
} from '@angular/core';
import {isPlatformBrowser} from '@angular/common';
import {Observable} from 'rxjs';
Expand Down Expand Up @@ -60,7 +61,7 @@ export const DEFAULT_WIDTH = '500px';
encapsulation: ViewEncapsulation.None,
})
export class GoogleMap implements OnChanges, OnInit, OnDestroy {
private _eventManager: MapEventManager = new MapEventManager(this._ngZone);
private _eventManager: MapEventManager = new MapEventManager(inject(NgZone));
private _mapEl: HTMLElement;
private _existingAuthFailureCallback: GoogleMapsWindow['gm_authFailure'];

Expand Down
4 changes: 2 additions & 2 deletions src/google-maps/map-circle/map-circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265
/// <reference types="google.maps" />

import {Directive, Input, NgZone, OnDestroy, OnInit, Output} from '@angular/core';
import {Directive, Input, NgZone, OnDestroy, OnInit, Output, inject} from '@angular/core';
import {BehaviorSubject, combineLatest, Observable, Subject} from 'rxjs';
import {map, take, takeUntil} from 'rxjs/operators';

Expand All @@ -25,7 +25,7 @@ import {MapEventManager} from '../map-event-manager';
exportAs: 'mapCircle',
})
export class MapCircle implements OnInit, OnDestroy {
private _eventManager = new MapEventManager(this._ngZone);
private _eventManager = new MapEventManager(inject(NgZone));
private readonly _options = new BehaviorSubject<google.maps.CircleOptions>({});
private readonly _center = new BehaviorSubject<
google.maps.LatLng | google.maps.LatLngLiteral | undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
OnInit,
Output,
SimpleChanges,
inject,
} from '@angular/core';
import {Observable} from 'rxjs';
import {GoogleMap} from '../google-map/google-map';
Expand All @@ -34,7 +35,7 @@ import {MapEventManager} from '../map-event-manager';
exportAs: 'mapDirectionsRenderer',
})
export class MapDirectionsRenderer implements OnInit, OnChanges, OnDestroy {
private _eventManager = new MapEventManager(this._ngZone);
private _eventManager = new MapEventManager(inject(NgZone));

/**
* See developers.google.com/maps/documentation/javascript/reference/directions
Expand Down
4 changes: 2 additions & 2 deletions src/google-maps/map-ground-overlay/map-ground-overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265
/// <reference types="google.maps" />

import {Directive, Input, NgZone, OnDestroy, OnInit, Output} from '@angular/core';
import {Directive, Input, NgZone, OnDestroy, OnInit, Output, inject} from '@angular/core';
import {BehaviorSubject, Observable, Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';

Expand All @@ -26,7 +26,7 @@ import {MapEventManager} from '../map-event-manager';
exportAs: 'mapGroundOverlay',
})
export class MapGroundOverlay implements OnInit, OnDestroy {
private _eventManager = new MapEventManager(this._ngZone);
private _eventManager = new MapEventManager(inject(NgZone));

private readonly _opacity = new BehaviorSubject<number>(1);
private readonly _url = new BehaviorSubject<string>('');
Expand Down
13 changes: 11 additions & 2 deletions src/google-maps/map-info-window/map-info-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@
// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265
/// <reference types="google.maps" />

import {Directive, ElementRef, Input, NgZone, OnDestroy, OnInit, Output} from '@angular/core';
import {
Directive,
ElementRef,
Input,
NgZone,
OnDestroy,
OnInit,
Output,
inject,
} from '@angular/core';
import {BehaviorSubject, combineLatest, Observable, Subject} from 'rxjs';
import {map, take, takeUntil} from 'rxjs/operators';

Expand All @@ -28,7 +37,7 @@ import {MapAnchorPoint} from '../map-anchor-point';
host: {'style': 'display: none'},
})
export class MapInfoWindow implements OnInit, OnDestroy {
private _eventManager = new MapEventManager(this._ngZone);
private _eventManager = new MapEventManager(inject(NgZone));
private readonly _options = new BehaviorSubject<google.maps.InfoWindowOptions>({});
private readonly _position = new BehaviorSubject<
google.maps.LatLngLiteral | google.maps.LatLng | undefined
Expand Down
4 changes: 2 additions & 2 deletions src/google-maps/map-kml-layer/map-kml-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265
/// <reference types="google.maps" />

import {Directive, Input, NgZone, OnDestroy, OnInit, Output} from '@angular/core';
import {Directive, Input, NgZone, OnDestroy, OnInit, Output, inject} from '@angular/core';
import {BehaviorSubject, combineLatest, Observable, Subject} from 'rxjs';
import {map, take, takeUntil} from 'rxjs/operators';

Expand All @@ -26,7 +26,7 @@ import {MapEventManager} from '../map-event-manager';
exportAs: 'mapKmlLayer',
})
export class MapKmlLayer implements OnInit, OnDestroy {
private _eventManager = new MapEventManager(this._ngZone);
private _eventManager = new MapEventManager(inject(NgZone));
private readonly _options = new BehaviorSubject<google.maps.KmlLayerOptions>({});
private readonly _url = new BehaviorSubject<string>('');

Expand Down
3 changes: 2 additions & 1 deletion src/google-maps/map-marker-clusterer/map-marker-clusterer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
QueryList,
SimpleChanges,
ViewEncapsulation,
inject,
} from '@angular/core';
import {Observable, Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
Expand Down Expand Up @@ -62,7 +63,7 @@ declare const MarkerClusterer: typeof MarkerClustererInstance;
})
export class MapMarkerClusterer implements OnInit, AfterContentInit, OnChanges, OnDestroy {
private readonly _currentMarkers = new Set<google.maps.Marker>();
private readonly _eventManager = new MapEventManager(this._ngZone);
private readonly _eventManager = new MapEventManager(inject(NgZone));
private readonly _destroy = new Subject<void>();

/** Whether the clusterer is allowed to be initialized. */
Expand Down
3 changes: 2 additions & 1 deletion src/google-maps/map-marker/map-marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
Directive,
OnChanges,
SimpleChanges,
inject,
} from '@angular/core';
import {Observable} from 'rxjs';

Expand All @@ -43,7 +44,7 @@ export const DEFAULT_MARKER_OPTIONS = {
exportAs: 'mapMarker',
})
export class MapMarker implements OnInit, OnChanges, OnDestroy, MapAnchorPoint {
private _eventManager = new MapEventManager(this._ngZone);
private _eventManager = new MapEventManager(inject(NgZone));

/**
* Title of the marker.
Expand Down
Loading

0 comments on commit a2ebcbc

Please sign in to comment.