Skip to content

Commit ba4e839

Browse files
author
Tobias Schweizer
committed
Merge branch 'master' into tobiasschweizer/calendar-header-comp
# Conflicts: # src/lib/datepicker/datepicker-module.ts # src/lib/datepicker/datepicker.ts
2 parents 822dd56 + f7b5d34 commit ba4e839

Some content is hidden

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

52 files changed

+254
-386
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cdk/layout/breakpoints-observer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface Query {
2828
}
2929

3030
/** Utility for checking the matching state of @media queries. */
31-
@Injectable()
31+
@Injectable({providedIn: 'root'})
3232
export class BreakpointObserver implements OnDestroy {
3333
/** A map of all media queries currently being listened for. */
3434
private _queries: Map<string, Query> = new Map();

src/cdk/layout/layout-module.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import {NgModule} from '@angular/core';
9-
import {PlatformModule} from '@angular/cdk/platform';
10-
import {BreakpointObserver} from './breakpoints-observer';
11-
import {MediaMatcher} from './media-matcher';
129

13-
@NgModule({
14-
providers: [BreakpointObserver, MediaMatcher],
15-
imports: [PlatformModule],
16-
})
10+
11+
@NgModule()
1712
export class LayoutModule {}

src/cdk/layout/media-matcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {Platform} from '@angular/cdk/platform';
1414
const styleElementForWebkitCompatibility: Map<string, HTMLStyleElement> = new Map();
1515

1616
/** A utility for calling matchMedia queries. */
17-
@Injectable()
17+
@Injectable({providedIn: 'root'})
1818
export class MediaMatcher {
1919
/** The internal matchMedia method to return back a MediaQueryList like object. */
2020
private _matchMedia: (query: string) => MediaQueryList;

src/lib/autocomplete/autocomplete-module.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,14 @@ import {NgModule} from '@angular/core';
1010
import {CommonModule} from '@angular/common';
1111
import {OverlayModule} from '@angular/cdk/overlay';
1212
import {MatOptionModule, MatCommonModule} from '@angular/material/core';
13-
import {MatAutocomplete, MAT_AUTOCOMPLETE_DEFAULT_OPTIONS} from './autocomplete';
13+
import {MatAutocomplete} from './autocomplete';
1414
import {
1515
MatAutocompleteTrigger,
16-
MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER,
1716
} from './autocomplete-trigger';
1817

1918
@NgModule({
2019
imports: [MatOptionModule, OverlayModule, MatCommonModule, CommonModule],
2120
exports: [MatAutocomplete, MatOptionModule, MatAutocompleteTrigger, MatCommonModule],
2221
declarations: [MatAutocomplete, MatAutocompleteTrigger],
23-
providers: [
24-
MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER,
25-
{provide: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, useValue: false}
26-
],
2722
})
2823
export class MatAutocompleteModule {}

src/lib/autocomplete/autocomplete-trigger.ts

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,25 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import {Directionality} from '@angular/cdk/bidi';
9-
import {DOWN_ARROW, ENTER, ESCAPE, UP_ARROW, TAB} from '@angular/cdk/keycodes';
9+
import {DOWN_ARROW, ENTER, ESCAPE, TAB, UP_ARROW} from '@angular/cdk/keycodes';
1010
import {
1111
FlexibleConnectedPositionStrategy,
1212
Overlay,
13-
OverlayRef,
1413
OverlayConfig,
14+
OverlayRef,
1515
PositionStrategy,
1616
ScrollStrategy,
1717
} from '@angular/cdk/overlay';
1818
import {TemplatePortal} from '@angular/cdk/portal';
19-
import {filter} from 'rxjs/operators/filter';
20-
import {take} from 'rxjs/operators/take';
21-
import {switchMap} from 'rxjs/operators/switchMap';
22-
import {tap} from 'rxjs/operators/tap';
23-
import {delay} from 'rxjs/operators/delay';
19+
import {DOCUMENT} from '@angular/common';
2420
import {
2521
ChangeDetectorRef,
2622
Directive,
2723
ElementRef,
2824
forwardRef,
2925
Host,
3026
Inject,
27+
inject,
3128
InjectionToken,
3229
Input,
3330
NgZone,
@@ -37,19 +34,23 @@ import {
3734
} from '@angular/core';
3835
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
3936
import {
37+
_countGroupLabelsBeforeOption,
38+
_getOptionScrollPosition,
4039
MatOption,
4140
MatOptionSelectionChange,
42-
_getOptionScrollPosition,
43-
_countGroupLabelsBeforeOption,
4441
} from '@angular/material/core';
4542
import {MatFormField} from '@angular/material/form-field';
46-
import {DOCUMENT} from '@angular/common';
4743
import {Observable} from 'rxjs/Observable';
48-
import {Subject} from 'rxjs/Subject';
4944
import {defer} from 'rxjs/observable/defer';
5045
import {fromEvent} from 'rxjs/observable/fromEvent';
5146
import {merge} from 'rxjs/observable/merge';
5247
import {of as observableOf} from 'rxjs/observable/of';
48+
import {delay} from 'rxjs/operators/delay';
49+
import {filter} from 'rxjs/operators/filter';
50+
import {switchMap} from 'rxjs/operators/switchMap';
51+
import {take} from 'rxjs/operators/take';
52+
import {tap} from 'rxjs/operators/tap';
53+
import {Subject} from 'rxjs/Subject';
5354
import {Subscription} from 'rxjs/Subscription';
5455
import {MatAutocomplete} from './autocomplete';
5556

@@ -68,20 +69,13 @@ export const AUTOCOMPLETE_PANEL_HEIGHT = 256;
6869

6970
/** Injection token that determines the scroll handling while the autocomplete panel is open. */
7071
export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY =
71-
new InjectionToken<() => ScrollStrategy>('mat-autocomplete-scroll-strategy');
72-
73-
/** @docs-private */
74-
export function MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay):
75-
() => ScrollStrategy {
76-
return () => overlay.scrollStrategies.reposition();
77-
}
78-
79-
/** @docs-private */
80-
export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER = {
81-
provide: MAT_AUTOCOMPLETE_SCROLL_STRATEGY,
82-
deps: [Overlay],
83-
useFactory: MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER_FACTORY,
84-
};
72+
new InjectionToken<() => ScrollStrategy>('mat-autocomplete-scroll-strategy', {
73+
providedIn: 'root',
74+
factory: () => {
75+
const overlay = inject(Overlay);
76+
return () => overlay.scrollStrategies.reposition();
77+
}
78+
});
8579

8680
/**
8781
* Provider that allows the autocomplete to register as a ControlValueAccessor.

src/lib/autocomplete/autocomplete.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ export interface MatAutocompleteDefaultOptions {
6161

6262
/** Injection token to be used to override the default options for `mat-autocomplete`. */
6363
export const MAT_AUTOCOMPLETE_DEFAULT_OPTIONS =
64-
new InjectionToken<MatAutocompleteDefaultOptions>('mat-autocomplete-default-options');
64+
new InjectionToken<MatAutocompleteDefaultOptions>('mat-autocomplete-default-options', {
65+
providedIn: 'root',
66+
factory: () => ({autoActiveFirstOption: false}),
67+
});
6568

6669

6770
@Component({

src/lib/badge/badge-module.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,12 @@
88

99
import {NgModule} from '@angular/core';
1010
import {MatCommonModule} from '@angular/material/core';
11-
import {A11yModule} from '@angular/cdk/a11y';
1211
import {MatBadge} from './badge';
1312

1413

1514
@NgModule({
16-
imports: [
17-
MatCommonModule,
18-
A11yModule,
19-
],
20-
exports: [
21-
MatBadge,
22-
],
23-
declarations: [
24-
MatBadge,
25-
],
15+
imports: [MatCommonModule],
16+
exports: [MatBadge],
17+
declarations: [MatBadge],
2618
})
2719
export class MatBadgeModule {}

src/lib/bottom-sheet/bottom-sheet-module.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,21 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {NgModule} from '@angular/core';
10-
import {CommonModule} from '@angular/common';
11-
import {MatCommonModule} from '@angular/material/core';
12-
import {A11yModule} from '@angular/cdk/a11y';
139
import {OverlayModule} from '@angular/cdk/overlay';
1410
import {PortalModule} from '@angular/cdk/portal';
15-
import {LayoutModule} from '@angular/cdk/layout';
16-
import {MatBottomSheetContainer} from './bottom-sheet-container';
11+
import {CommonModule} from '@angular/common';
12+
import {NgModule} from '@angular/core';
13+
import {MatCommonModule} from '@angular/material/core';
1714
import {MatBottomSheet} from './bottom-sheet';
15+
import {MatBottomSheetContainer} from './bottom-sheet-container';
1816

1917

2018
@NgModule({
2119
imports: [
22-
A11yModule,
2320
CommonModule,
2421
OverlayModule,
2522
MatCommonModule,
2623
PortalModule,
27-
LayoutModule,
2824
],
2925
exports: [MatBottomSheetContainer, MatCommonModule],
3026
declarations: [MatBottomSheetContainer],

src/lib/button-toggle/button-toggle-module.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {A11yModule} from '@angular/cdk/a11y';
109
import {NgModule} from '@angular/core';
1110
import {MatCommonModule, MatRippleModule} from '@angular/material/core';
1211
import {MatButtonToggle, MatButtonToggleGroup} from './button-toggle';
1312

1413

1514
@NgModule({
16-
imports: [MatCommonModule, MatRippleModule, A11yModule],
15+
imports: [MatCommonModule, MatRippleModule],
1716
exports: [MatCommonModule, MatButtonToggleGroup, MatButtonToggle],
1817
declarations: [MatButtonToggleGroup, MatButtonToggle],
1918
})

src/lib/button/button-module.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,17 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {NgModule} from '@angular/core';
109
import {CommonModule} from '@angular/common';
10+
import {NgModule} from '@angular/core';
1111
import {MatCommonModule, MatRippleModule} from '@angular/material/core';
12-
import {A11yModule} from '@angular/cdk/a11y';
13-
import {
14-
MatAnchor,
15-
MatButton,
16-
} from './button';
12+
import {MatAnchor, MatButton} from './button';
1713

1814

1915
@NgModule({
2016
imports: [
2117
CommonModule,
2218
MatRippleModule,
2319
MatCommonModule,
24-
A11yModule,
2520
],
2621
exports: [
2722
MatButton,

src/lib/card/card-module.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ import {NgModule} from '@angular/core';
1010
import {MatCommonModule} from '@angular/material/core';
1111
import {
1212
MatCard,
13-
MatCardHeader,
14-
MatCardTitleGroup,
15-
MatCardContent,
16-
MatCardTitle,
17-
MatCardSubtitle,
1813
MatCardActions,
14+
MatCardAvatar,
15+
MatCardContent,
1916
MatCardFooter,
20-
MatCardSmImage,
21-
MatCardMdImage,
22-
MatCardLgImage,
17+
MatCardHeader,
2318
MatCardImage,
19+
MatCardLgImage,
20+
MatCardMdImage,
21+
MatCardSmImage,
22+
MatCardSubtitle,
23+
MatCardTitle,
24+
MatCardTitleGroup,
2425
MatCardXlImage,
25-
MatCardAvatar,
2626
} from './card';
2727

2828

src/lib/checkbox/checkbox-module.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {NgModule} from '@angular/core';
10-
import {CommonModule} from '@angular/common';
119
import {ObserversModule} from '@angular/cdk/observers';
12-
import {MatRippleModule, MatCommonModule} from '@angular/material/core';
10+
import {CommonModule} from '@angular/common';
11+
import {NgModule} from '@angular/core';
12+
import {MatCommonModule, MatRippleModule} from '@angular/material/core';
1313
import {MatCheckbox} from './checkbox';
1414
import {MatCheckboxRequiredValidator} from './checkbox-required-validator';
15-
import {A11yModule} from '@angular/cdk/a11y';
15+
1616

1717
@NgModule({
18-
imports: [CommonModule, MatRippleModule, MatCommonModule, ObserversModule, A11yModule],
18+
imports: [CommonModule, MatRippleModule, MatCommonModule, ObserversModule],
1919
exports: [MatCheckbox, MatCheckboxRequiredValidator, MatCommonModule],
2020
declarations: [MatCheckbox, MatCheckboxRequiredValidator],
2121
})

src/lib/chips/chips-module.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {PlatformModule} from '@angular/cdk/platform';
9+
import {ENTER} from '@angular/cdk/keycodes';
1010
import {NgModule} from '@angular/core';
1111
import {ErrorStateMatcher} from '@angular/material/core';
1212
import {MatChip, MatChipAvatar, MatChipRemove, MatChipTrailingIcon} from './chip';
13+
import {MAT_CHIPS_DEFAULT_OPTIONS, MatChipsDefaultOptions} from './chip-default-options';
1314
import {MatChipInput} from './chip-input';
1415
import {MatChipList} from './chip-list';
15-
import {MAT_CHIPS_DEFAULT_OPTIONS, MatChipsDefaultOptions} from './chip-default-options';
16-
import {ENTER} from '@angular/cdk/keycodes';
1716

1817
const CHIP_DECLARATIONS = [
1918
MatChipList,
@@ -25,7 +24,6 @@ const CHIP_DECLARATIONS = [
2524
];
2625

2726
@NgModule({
28-
imports: [PlatformModule],
2927
exports: CHIP_DECLARATIONS,
3028
declarations: CHIP_DECLARATIONS,
3129
providers: [

src/lib/core/common-behaviors/common-module.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ import {BidiModule} from '@angular/cdk/bidi';
1111

1212

1313
/** Injection token that configures whether the Material sanity checks are enabled. */
14-
export const MATERIAL_SANITY_CHECKS = new InjectionToken<boolean>('mat-sanity-checks');
14+
export const MATERIAL_SANITY_CHECKS = new InjectionToken<boolean>('mat-sanity-checks', {
15+
providedIn: 'root',
16+
factory: () => true,
17+
});
1518

1619

1720
/**
@@ -23,9 +26,6 @@ export const MATERIAL_SANITY_CHECKS = new InjectionToken<boolean>('mat-sanity-ch
2326
@NgModule({
2427
imports: [BidiModule],
2528
exports: [BidiModule],
26-
providers: [{
27-
provide: MATERIAL_SANITY_CHECKS, useValue: true,
28-
}],
2929
})
3030
export class MatCommonModule {
3131
/** Whether we've done the global sanity checks (e.g. a theme is loaded, there is a doctype). */

src/lib/core/datetime/date-adapter.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {InjectionToken, LOCALE_ID} from '@angular/core';
9+
import {inject, InjectionToken, LOCALE_ID} from '@angular/core';
1010
import {Observable} from 'rxjs/Observable';
1111
import {Subject} from 'rxjs/Subject';
1212

1313

1414
/** InjectionToken for datepicker that can be used to override default locale code. */
15-
export const MAT_DATE_LOCALE = new InjectionToken<string>('MAT_DATE_LOCALE');
16-
17-
/** Provider for MAT_DATE_LOCALE injection token. */
18-
export const MAT_DATE_LOCALE_PROVIDER = {provide: MAT_DATE_LOCALE, useExisting: LOCALE_ID};
15+
export const MAT_DATE_LOCALE = new InjectionToken<string>('MAT_DATE_LOCALE', {
16+
providedIn: 'root',
17+
factory: () => inject(LOCALE_ID)
18+
});
1919

2020
/** Adapts type `D` to be usable as a date by cdk-based components that work with dates. */
2121
export abstract class DateAdapter<D> {

0 commit comments

Comments
 (0)